diff --git a/packages/shoreline/src/themes/sunrise/components/checkbox.css b/packages/shoreline/src/themes/sunrise/components/checkbox.css index 28e6826115..3eff053d3c 100644 --- a/packages/shoreline/src/themes/sunrise/components/checkbox.css +++ b/packages/shoreline/src/themes/sunrise/components/checkbox.css @@ -5,6 +5,7 @@ height: var(--sl-checkbox-size); display: flex; width: fit-content; + position: relative; & > [data-sl-text] { user-select: none; @@ -13,6 +14,7 @@ [data-sl-checkbox-label] { margin-left: var(--sl-space-2); + position: relative; &[data-disabled="true"] { color: var(--sl-fg-base-disabled); diff --git a/packages/ts-table/src/stories/virtualized-selection.stories.tsx b/packages/ts-table/src/stories/virtualized-selection.stories.tsx new file mode 100644 index 0000000000..75f03eec38 --- /dev/null +++ b/packages/ts-table/src/stories/virtualized-selection.stories.tsx @@ -0,0 +1,68 @@ +import { useMemo } from 'react' +import type { ColumnDef } from '@tanstack/react-table' +import { faker } from '@faker-js/faker' + +import { useVirtualizerModel } from '../use-virtualizer-model' +import { getSelectionColumn, TsTable } from '../index' + +export default { + title: 'ts-table/ts-table', + parameters: { + chromatic: { disableSnapshot: true }, + }, +} + +interface Service { + name: string + department: string + price: string +} + +const data: Service[] = Array(50000) + .fill(1) + .map((_, id) => { + return { + id: `${id}`, + name: faker.company.name(), + price: faker.commerce.price(), + department: faker.commerce.department(), + } + }) + +export function VirtualizedSelection() { + const columns = useMemo>>( + () => [ + getSelectionColumn(), + { + accessorKey: 'name', + header: 'Service name', + }, + { + accessorKey: 'price', + header: 'Price', + }, + ], + [] + ) + + const virtualizer = useVirtualizerModel({ + count: data.length, + }) + + return ( + <> + { + alert(`You clicked: ${row.original.name}`) + }, + }} + virtualizer={virtualizer} + /> +
Number of rows: {data.length}
+ + ) +}