Repository navigation
v0.3.0
The hooks no longer assume a GraphQL API, and the Storybook no longer plays its interactions when a story opens.
Breaking changes
usePagination is page-based
usePagination(pageSize) returns the offset and limit for the current page. Send them to your API, or slice an array with them. getPagination(totalCount) builds DataTable's pagination prop from the total, which usually arrives with the page you fetched:
const { offset, limit, getPagination, reset } = usePagination(25);
const { items, total } = useMembers({ offset, limit });
<DataTable columns={columns} data={items} pagination={getPagination(total)} />;Call reset() when the sort or filters change. On the last page, Next does nothing.
The cursor hook for GraphQL connection queries works the same as before, under a new name:
usePagination(n)is nowuseCursorPagination(n)PaginationInputis nowCursorPaginationInput
useTableSort reports lowercase directions
direction is now 'asc' or 'desc' instead of 'ASC' or 'DESC'. Inputs accept both cases: defaultSortDirection, setSortDirection, and the sort prop all take either, so SortOrder values still work going in. If your API wants uppercase, send direction?.toUpperCase().
Saved sorts carry over. The URL and localStorage already stored lowercase.
Storybook
Opening a story no longer runs its interaction test, so tables stay still until you use them. The tests now live on hidden twin stories and still run in CI, with axe checking every visible story.
Full change: #11