From 55e5f71ad3063ca28a032792ca13e496831de56c Mon Sep 17 00:00:00 2001
From: Brian Vaughn
How many additional rows to render outside of the visible area. This can reduce visual flickering near the edges of a list when scrolling.
+By default, lists will use an item's index as its +key. +This is okay if:
+PureComponentIf your list does not satisfy the above constraints, +use this property to specify your own keys for items.
By default, lists will use an item's index as its\nkey.\nThis is okay if:
\nPureComponentIf your list does not satisfy the above constraints,\nuse this property to specify your own keys for items.
\n" + } + ], + "html": "By default, lists will use an item's index as its -key. -This is okay if:
-PureComponentIf your list does not satisfy the above constraints, -use this property to specify your own keys for items.
+Lists use the row index as a key by default.
+This prop allows a custom key to be used instead.
ℹ️ Custom keys can ensure better UX for sortable or filterable lists, +particularly if your row components are stateful. +Refer to the React documentation for more info.
By default, lists will use an item's index as its\nkey.\nThis is okay if:
\nPureComponentLists use the row index as a key by default.\nThis prop allows a custom key to be used instead.
If your list does not satisfy the above constraints,\nuse this property to specify your own keys for items.
\n" + "content": "Custom keys can ensure better UX for sortable or filterable lists,\nparticularly if your row components are stateful.\nRefer to the React documentation for more info.
\n", + "intent": "primary" } ], "html": "key to be used instead.
ℹ️ Custom keys can ensure better UX for sortable or filterable lists, particularly if your row components are stateful. Refer to the React documentation for more info.
+⚠️ This prop cannot be auto-memoized because it is called during render. +It is important to always useCallback() for this prop; do not use an inline function.
Custom keys can ensure better UX for sortable or filterable lists,\nparticularly if your row components are stateful.\nRefer to the React documentation for more info.
\n", "intent": "primary" + }, + { + "content": "This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback() for this prop; do not use an inline function.
\n", + "intent": "warning" } ], "html": "key to be used instead.
particularly if your row components are stateful.
Refer to the React documentation for more info.
⚠️ This prop cannot be auto-memoized because it is called during render. -It is important to always useCallback() for this prop; do not use an inline function.
+It is important to alwaysuseCallback for this prop; do not use an inline function.
Additional content to be rendered within the grid (above cells). This property can be used to render things like overlays or tooltips.
+Grids use the column index as a key by default.
+This prop allows a custom key to be used instead.
ℹ️ Custom keys can ensure better UX for sortable or filterable grids, +particularly if your cell components are stateful. +Refer to the React documentation for more info.
+⚠️ This prop cannot be auto-memoized because it is called during render.
+It is important to always useCallback for this prop; do not use an inline function.
How many additional rows/columns to render outside of the visible area. This can reduce visual flickering near the edges of a grid when scrolling.
+Grids use the row index as a key by default.
+This prop allows a custom key to be used instead.
ℹ️ Custom keys can ensure better UX for sortable or filterable grids, +particularly if your cell components are stateful. +Refer to the React documentation for more info.
+⚠️ This prop cannot be auto-memoized because it is called during render.
+It is important to always useCallback for this prop; do not use an inline function.
Grids use the column index as a key by default.\nThis prop allows a custom key to be used instead.
Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.
\n", + "intent": "primary" + }, + { + "content": "This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.
Grids use the row index as a key by default.\nThis prop allows a custom key to be used instead.
Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.
\n", + "intent": "primary" + }, + { + "content": "This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.
This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback() for this prop; do not use an inline function.
\n", + "content": "This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.
Lists use the row index as a key by default.
-This prop allows a custom key to be used instead.
key value.
ℹ️ Custom keys can ensure better UX for sortable or filterable lists, particularly if your row components are stateful. Refer to the React documentation for more info.
@@ -283,7 +283,7 @@ This property can be used to render things like overlays or tooltips.Grids use the column index as a key by default.
-This prop allows a custom key to be used instead.
rowKey prop to provide a custom key value.
ℹ️ Custom keys can ensure better UX for sortable or filterable grids, particularly if your cell components are stateful. Refer to the React documentation for more info.
@@ -329,7 +329,7 @@ This can reduce visual flickering near the edges of a grid when scrolling.Grids use the row index as a key by default.
-This prop allows a custom key to be used instead.
columnKey prop to provide a custom key value.
ℹ️ Custom keys can ensure better UX for sortable or filterable grids, particularly if your cell components are stateful. Refer to the React documentation for more info.
diff --git a/lib/components/grid/types.ts b/lib/components/grid/types.ts index e0d43e4a..2c9e09e6 100644 --- a/lib/components/grid/types.ts +++ b/lib/components/grid/types.ts @@ -63,7 +63,7 @@ export type GridProps< /** * Grids use the column index as a `key` by default. - * This prop allows a custom `key` to be used instead. + * This prop can be used along with the `rowKey` prop to provide a custom `key` value. * * ℹ️ Custom keys can ensure better UX for sortable or filterable grids, * particularly if your cell components are stateful. @@ -220,7 +220,7 @@ export type GridProps< /** * Grids use the row index as a `key` by default. - * This prop allows a custom `key` to be used instead. + * This prop can be used along with the `columnKey` prop to provide a custom `key` value. * * ℹ️ Custom keys can ensure better UX for sortable or filterable grids, * particularly if your cell components are stateful. diff --git a/lib/components/list/types.ts b/lib/components/list/types.ts index 794acd43..92fcc18d 100644 --- a/lib/components/list/types.ts +++ b/lib/components/list/types.ts @@ -136,7 +136,7 @@ export type ListProps< /** * Lists use the row index as a `key` by default. - * This prop allows a custom `key` to be used instead. + * This prop can provide a custom `key` value. * * ℹ️ Custom keys can ensure better UX for sortable or filterable lists, * particularly if your row components are stateful. diff --git a/public/generated/docs/Grid.json b/public/generated/docs/Grid.json index e140e05a..d2717ce2 100644 --- a/public/generated/docs/Grid.json +++ b/public/generated/docs/Grid.json @@ -99,7 +99,7 @@ "columnKey": { "description": [ { - "content": "Grids use the column index as a key by default.\nThis prop allows a custom key to be used instead.
Grids use the column index as a key by default.\nThis prop can be used along with the rowKey prop to provide a custom key value.
Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.
\n", @@ -211,7 +211,7 @@ "rowKey": { "description": [ { - "content": "Grids use the row index as a key by default.\nThis prop allows a custom key to be used instead.
Grids use the row index as a key by default.\nThis prop can be used along with the columnKey prop to provide a custom key value.
Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.
\n", diff --git a/public/generated/docs/List.json b/public/generated/docs/List.json index 5ed19988..6c157eac 100644 --- a/public/generated/docs/List.json +++ b/public/generated/docs/List.json @@ -138,7 +138,7 @@ "rowKey": { "description": [ { - "content": "Lists use the row index as a key by default.\nThis prop allows a custom key to be used instead.
Lists use the row index as a key by default.\nThis prop can provide a custom key value.
Custom keys can ensure better UX for sortable or filterable lists,\nparticularly if your row components are stateful.\nRefer to the React documentation for more info.
\n", diff --git a/public/generated/site-map.json b/public/generated/site-map.json index 45e65353..df3e6fd8 100644 --- a/public/generated/site-map.json +++ b/public/generated/site-map.json @@ -47,7 +47,7 @@ { "path": "/list/props", "section": "Lists", - "text": " Renders data with many rows.\n Required props rowComponent: (props: { ariaAttributes: { \"aria-posinset\": number; \"aria-setsize\": number; role: \"listitem\"; }; index: number; style: CSSProperties; } & RowProps) => ReactNode | null React component responsible for rendering a row.\n This component will receive an index and style prop by default.\nAdditionally it will receive prop values passed to rowProps.\n The prop types for this component are exported as RowComponentProps \n rowCount: number Number of items to be rendered in the list.\n rowHeight: string | number | DynamicRowHeight | ((index: number, cellProps: RowProps) => number) Row height; the following formats are supported:\n\nnumber of pixels (number)\npercentage of the grid's current height (string)\nfunction that returns the row height (in pixels) given an index and cellProps \ndynamic row height cache returned by the useDynamicRowHeight hook\n\n Dynamic row heights are not as efficient as predetermined sizes.\nIt's recommended to provide your own height values if they can be determined ahead of time.\n rowProps: RowProps Additional props to be passed to the row-rendering component.\nList will automatically re-render rows when values in this object change.\n This object must not contain ariaAttributes, index, or style props.\n Optional props children?: ReactNode Additional content to be rendered within the list (above cells).\nThis property can be used to render things like overlays or tooltips.\n className?: string CSS class name.\n defaultHeight?: number = 0 Default height of list for initial render.\nThis value is important for server rendering.\n listRef?: Ref<{ readonly element: HTMLDivElement | null; scrollToRow(config: { align?: \"auto\" | \"center\" | \"end\" | \"smart\" | \"start\"; behavior?: \"auto\" | \"instant\" | \"smooth\"; index: number; }): void; }> Ref used to interact with this component's imperative API.\n This API has imperative methods for scrolling and a getter for the outermost DOM element.\n The useListRef and useListCallbackRef hooks are exported for convenience use in TypeScript projects.\n onResize?: (size: { height: number; width: number; }, prevSize: { height: number; width: number; }) => void Callback notified when the List's outermost HTMLElement resizes.\nThis may be used to (re)scroll a row into view.\n onRowsRendered?: (visibleRows: { startIndex: number; stopIndex: number; }, allRows: { startIndex: number; stopIndex: number; }) => void Callback notified when the range of visible rows changes.\n overscanCount?: number = 3 How many additional rows to render outside of the visible area.\nThis can reduce visual flickering near the edges of a list when scrolling.\n rowKey?: (index: number, data: RowProps) => Key Lists use the row index as a key by default.\nThis prop allows a custom key to be used instead.\n Custom keys can ensure better UX for sortable or filterable lists,\nparticularly if your row components are stateful.\nRefer to the React documentation for more info.\n This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.\n style?: CSSProperties Optional CSS properties.\nThe list of rows will fill the height defined by this style.\n tagName?: keyof IntrinsicElements = \"div\" as TagName Can be used to override the root HTML element rendered by the List component.\nThe default value is \"div\", meaning that List renders an HTMLDivElement as its root.\n In most use cases the default ARIA roles are sufficient and this prop is not needed.\n ", + "text": " Renders data with many rows.\n Required props rowComponent: (props: { ariaAttributes: { \"aria-posinset\": number; \"aria-setsize\": number; role: \"listitem\"; }; index: number; style: CSSProperties; } & RowProps) => ReactNode | null React component responsible for rendering a row.\n This component will receive an index and style prop by default.\nAdditionally it will receive prop values passed to rowProps.\n The prop types for this component are exported as RowComponentProps \n rowCount: number Number of items to be rendered in the list.\n rowHeight: string | number | DynamicRowHeight | ((index: number, cellProps: RowProps) => number) Row height; the following formats are supported:\n\nnumber of pixels (number)\npercentage of the grid's current height (string)\nfunction that returns the row height (in pixels) given an index and cellProps \ndynamic row height cache returned by the useDynamicRowHeight hook\n\n Dynamic row heights are not as efficient as predetermined sizes.\nIt's recommended to provide your own height values if they can be determined ahead of time.\n rowProps: RowProps Additional props to be passed to the row-rendering component.\nList will automatically re-render rows when values in this object change.\n This object must not contain ariaAttributes, index, or style props.\n Optional props children?: ReactNode Additional content to be rendered within the list (above cells).\nThis property can be used to render things like overlays or tooltips.\n className?: string CSS class name.\n defaultHeight?: number = 0 Default height of list for initial render.\nThis value is important for server rendering.\n listRef?: Ref<{ readonly element: HTMLDivElement | null; scrollToRow(config: { align?: \"auto\" | \"center\" | \"end\" | \"smart\" | \"start\"; behavior?: \"auto\" | \"instant\" | \"smooth\"; index: number; }): void; }> Ref used to interact with this component's imperative API.\n This API has imperative methods for scrolling and a getter for the outermost DOM element.\n The useListRef and useListCallbackRef hooks are exported for convenience use in TypeScript projects.\n onResize?: (size: { height: number; width: number; }, prevSize: { height: number; width: number; }) => void Callback notified when the List's outermost HTMLElement resizes.\nThis may be used to (re)scroll a row into view.\n onRowsRendered?: (visibleRows: { startIndex: number; stopIndex: number; }, allRows: { startIndex: number; stopIndex: number; }) => void Callback notified when the range of visible rows changes.\n overscanCount?: number = 3 How many additional rows to render outside of the visible area.\nThis can reduce visual flickering near the edges of a list when scrolling.\n rowKey?: (index: number, data: RowProps) => Key Lists use the row index as a key by default.\nThis prop can provide a custom key value.\n Custom keys can ensure better UX for sortable or filterable lists,\nparticularly if your row components are stateful.\nRefer to the React documentation for more info.\n This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.\n style?: CSSProperties Optional CSS properties.\nThe list of rows will fill the height defined by this style.\n tagName?: keyof IntrinsicElements = \"div\" as TagName Can be used to override the root HTML element rendered by the List component.\nThe default value is \"div\", meaning that List renders an HTMLDivElement as its root.\n In most use cases the default ARIA roles are sufficient and this prop is not needed.\n ", "title": "List component props" }, { @@ -89,7 +89,7 @@ { "path": "/grid/props", "section": "Grids", - "text": " Renders data with many rows and columns.\n Unlike List rows, Grid cell sizes must be known ahead of time.\nEither static sizes or something that can be derived (from the data in CellProps) without rendering.\n Required props cellComponent: (props: { ariaAttributes: { \"aria-colindex\": number; role: \"gridcell\"; }; columnIndex: number; rowIndex: number; style: CSSProperties; } & CellProps) => ReactNode | null React component responsible for rendering a cell.\n This component will receive an index and style prop by default.\nAdditionally it will receive prop values passed to cellProps.\n The prop types for this component are exported as CellComponentProps \n cellProps: CellProps Additional props to be passed to the cell-rendering component.\nGrid will automatically re-render cells when values in this object change.\n This object must not contain ariaAttributes, columnIndex, rowIndex, or style props.\n columnCount: number Number of columns to be rendered in the grid.\n columnWidth: string | number | ((index: number, cellProps: CellProps) => number) Column width; the following formats are supported:\n\nnumber of pixels (number)\npercentage of the grid's current width (string)\nfunction that returns the column width (in pixels) given an index and cellProps \n\n rowCount: number Number of rows to be rendered in the grid.\n rowHeight: string | number | ((index: number, cellProps: CellProps) => number) Row height; the following formats are supported:\n\nnumber of pixels (number)\npercentage of the grid's current height (string)\nfunction that returns the row height (in pixels) given an index and cellProps \n\n Optional props children?: ReactNode Additional content to be rendered within the grid (above cells).\nThis property can be used to render things like overlays or tooltips.\n className?: string CSS class name.\n columnKey?: (args: { columnIndex: number; data: CellProps; rowIndex: number; }) => Key Grids use the column index as a key by default.\nThis prop allows a custom key to be used instead.\n Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.\n This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.\n defaultHeight?: number = 0 Default height of grid for initial render.\nThis value is important for server rendering.\n defaultWidth?: number = 0 Default width of grid for initial render.\nThis value is important for server rendering.\n dir?: string Indicates the directionality of grid cells.\n See HTML dir global attribute for more information.\n gridRef?: Ref<{ readonly element: HTMLDivElement | null; scrollToCell(config: { behavior?: \"auto\" | \"instant\" | \"smooth\"; columnAlign?: \"auto\" | \"center\" | \"end\" | \"smart\" | \"start\"; columnIndex: number; rowAlign?: \"auto\" | ... 3 more ... | \"start\"; rowIndex: number; }): void; scrollToColumn(config: { ...; }): void; scrollToR... Imperative Grid API.\n The useGridRef and useGridCallbackRef hooks are exported for convenience use in TypeScript projects.\n onCellsRendered?: (visibleCells: { columnStartIndex: number; columnStopIndex: number; rowStartIndex: number; rowStopIndex: number; }, allCells: { columnStartIndex: number; columnStopIndex: number; rowStartIndex: number; rowStopIndex: number; }) => void Callback notified when the range of rendered cells changes.\n onResize?: (size: { height: number; width: number; }, prevSize: { height: number; width: number; }) => void Callback notified when the Grid's outermost HTMLElement resizes.\nThis may be used to (re)scroll a cell into view.\n overscanCount?: number = 3 How many additional rows/columns to render outside of the visible area.\nThis can reduce visual flickering near the edges of a grid when scrolling.\n rowKey?: (args: { data: CellProps; rowIndex: number; }) => Key Grids use the row index as a key by default.\nThis prop allows a custom key to be used instead.\n Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.\n This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.\n style?: CSSProperties Optional CSS properties.\nThe grid of cells will fill the height and width defined by this style.\n tagName?: keyof IntrinsicElements = \"div\" as TagName Can be used to override the root HTML element rendered by the List component.\nThe default value is \"div\", meaning that List renders an HTMLDivElement as its root.\n In most use cases the default ARIA roles are sufficient and this prop is not needed.\n ", + "text": " Renders data with many rows and columns.\n Unlike List rows, Grid cell sizes must be known ahead of time.\nEither static sizes or something that can be derived (from the data in CellProps) without rendering.\n Required props cellComponent: (props: { ariaAttributes: { \"aria-colindex\": number; role: \"gridcell\"; }; columnIndex: number; rowIndex: number; style: CSSProperties; } & CellProps) => ReactNode | null React component responsible for rendering a cell.\n This component will receive an index and style prop by default.\nAdditionally it will receive prop values passed to cellProps.\n The prop types for this component are exported as CellComponentProps \n cellProps: CellProps Additional props to be passed to the cell-rendering component.\nGrid will automatically re-render cells when values in this object change.\n This object must not contain ariaAttributes, columnIndex, rowIndex, or style props.\n columnCount: number Number of columns to be rendered in the grid.\n columnWidth: string | number | ((index: number, cellProps: CellProps) => number) Column width; the following formats are supported:\n\nnumber of pixels (number)\npercentage of the grid's current width (string)\nfunction that returns the column width (in pixels) given an index and cellProps \n\n rowCount: number Number of rows to be rendered in the grid.\n rowHeight: string | number | ((index: number, cellProps: CellProps) => number) Row height; the following formats are supported:\n\nnumber of pixels (number)\npercentage of the grid's current height (string)\nfunction that returns the row height (in pixels) given an index and cellProps \n\n Optional props children?: ReactNode Additional content to be rendered within the grid (above cells).\nThis property can be used to render things like overlays or tooltips.\n className?: string CSS class name.\n columnKey?: (args: { columnIndex: number; data: CellProps; rowIndex: number; }) => Key Grids use the column index as a key by default.\nThis prop can be used along with the rowKey prop to provide a custom key value.\n Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.\n This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.\n defaultHeight?: number = 0 Default height of grid for initial render.\nThis value is important for server rendering.\n defaultWidth?: number = 0 Default width of grid for initial render.\nThis value is important for server rendering.\n dir?: string Indicates the directionality of grid cells.\n See HTML dir global attribute for more information.\n gridRef?: Ref<{ readonly element: HTMLDivElement | null; scrollToCell(config: { behavior?: \"auto\" | \"instant\" | \"smooth\"; columnAlign?: \"auto\" | \"center\" | \"end\" | \"smart\" | \"start\"; columnIndex: number; rowAlign?: \"auto\" | ... 3 more ... | \"start\"; rowIndex: number; }): void; scrollToColumn(config: { ...; }): void; scrollToR... Imperative Grid API.\n The useGridRef and useGridCallbackRef hooks are exported for convenience use in TypeScript projects.\n onCellsRendered?: (visibleCells: { columnStartIndex: number; columnStopIndex: number; rowStartIndex: number; rowStopIndex: number; }, allCells: { columnStartIndex: number; columnStopIndex: number; rowStartIndex: number; rowStopIndex: number; }) => void Callback notified when the range of rendered cells changes.\n onResize?: (size: { height: number; width: number; }, prevSize: { height: number; width: number; }) => void Callback notified when the Grid's outermost HTMLElement resizes.\nThis may be used to (re)scroll a cell into view.\n overscanCount?: number = 3 How many additional rows/columns to render outside of the visible area.\nThis can reduce visual flickering near the edges of a grid when scrolling.\n rowKey?: (args: { data: CellProps; rowIndex: number; }) => Key Grids use the row index as a key by default.\nThis prop can be used along with the columnKey prop to provide a custom key value.\n Custom keys can ensure better UX for sortable or filterable grids,\nparticularly if your cell components are stateful.\nRefer to the React documentation for more info.\n This prop cannot be auto-memoized because it is called during render.\nIt is important to always useCallback for this prop; do not use an inline function.\n style?: CSSProperties Optional CSS properties.\nThe grid of cells will fill the height and width defined by this style.\n tagName?: keyof IntrinsicElements = \"div\" as TagName Can be used to override the root HTML element rendered by the List component.\nThe default value is \"div\", meaning that List renders an HTMLDivElement as its root.\n In most use cases the default ARIA roles are sufficient and this prop is not needed.\n ", "title": "Grid component props" }, {