@mortenbrudvik/waveui 0.15.0 → 0.17.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/README.md +339 -40
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +405 -219
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/List.registry.cjs +1 -1
- package/dist/components/data-display/List.registry.cjs.map +1 -1
- package/dist/components/data-display/List.registry.mjs +12 -6
- package/dist/components/data-display/List.registry.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +163 -148
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +132 -117
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +1 -0
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +1 -1
- package/dist/components/input/Listbox.cjs.map +1 -1
- package/dist/components/input/Listbox.mjs +90 -78
- package/dist/components/input/Listbox.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.data.cjs +2 -0
- package/dist/components/input/Option.data.cjs.map +1 -0
- package/dist/components/input/Option.data.mjs +114 -0
- package/dist/components/input/Option.data.mjs.map +1 -0
- package/dist/components/input/Option.mjs +21 -17
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/layout/FlatTree.cjs +2 -0
- package/dist/components/layout/FlatTree.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.cjs +2 -0
- package/dist/components/layout/FlatTree.context.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.mjs +20 -0
- package/dist/components/layout/FlatTree.context.mjs.map +1 -0
- package/dist/components/layout/FlatTree.item.cjs +2 -0
- package/dist/components/layout/FlatTree.item.cjs.map +1 -0
- package/dist/components/layout/FlatTree.item.mjs +90 -0
- package/dist/components/layout/FlatTree.item.mjs.map +1 -0
- package/dist/components/layout/FlatTree.mjs +276 -0
- package/dist/components/layout/FlatTree.mjs.map +1 -0
- package/dist/components/layout/Tree.core.cjs +1 -1
- package/dist/components/layout/Tree.core.cjs.map +1 -1
- package/dist/components/layout/Tree.core.mjs +166 -165
- package/dist/components/layout/Tree.core.mjs.map +1 -1
- package/dist/components/layout/Tree.selection.cjs +1 -1
- package/dist/components/layout/Tree.selection.cjs.map +1 -1
- package/dist/components/layout/Tree.selection.mjs +11 -57
- package/dist/components/layout/Tree.selection.mjs.map +1 -1
- package/dist/components/layout/useFlatTree.cjs +2 -0
- package/dist/components/layout/useFlatTree.cjs.map +1 -0
- package/dist/components/layout/useFlatTree.mjs +83 -0
- package/dist/components/layout/useFlatTree.mjs.map +1 -0
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +12 -11
- package/dist/components/portal/Portal.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +59 -35
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.context.cjs +2 -0
- package/dist/components/table/DataGrid.context.cjs.map +1 -0
- package/dist/components/table/DataGrid.context.mjs +74 -0
- package/dist/components/table/DataGrid.context.mjs.map +1 -0
- package/dist/components/table/DataGrid.header.cjs +2 -0
- package/dist/components/table/DataGrid.header.cjs.map +1 -0
- package/dist/components/table/DataGrid.header.mjs +168 -0
- package/dist/components/table/DataGrid.header.mjs.map +1 -0
- package/dist/components/table/DataGrid.mjs +488 -591
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/DataGrid.sizing.cjs +2 -0
- package/dist/components/table/DataGrid.sizing.cjs.map +1 -0
- package/dist/components/table/DataGrid.sizing.mjs +187 -0
- package/dist/components/table/DataGrid.sizing.mjs.map +1 -0
- package/dist/components/table/DataGrid.store.cjs +2 -0
- package/dist/components/table/DataGrid.store.cjs.map +1 -0
- package/dist/components/table/DataGrid.store.mjs +108 -0
- package/dist/components/table/DataGrid.store.mjs.map +1 -0
- package/dist/components/table/DataGrid.window.cjs +2 -0
- package/dist/components/table/DataGrid.window.cjs.map +1 -0
- package/dist/components/table/DataGrid.window.mjs +165 -0
- package/dist/components/table/DataGrid.window.mjs.map +1 -0
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +74 -72
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/Table.resize.cjs +2 -0
- package/dist/components/table/Table.resize.cjs.map +1 -0
- package/dist/components/table/Table.resize.mjs +98 -0
- package/dist/components/table/Table.resize.mjs.map +1 -0
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +343 -140
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/components/table/useTableColumnSizing.cjs +2 -0
- package/dist/components/table/useTableColumnSizing.cjs.map +1 -0
- package/dist/components/table/useTableColumnSizing.mjs +76 -0
- package/dist/components/table/useTableColumnSizing.mjs.map +1 -0
- package/dist/components/table/useTableFeatures.cjs +2 -0
- package/dist/components/table/useTableFeatures.cjs.map +1 -0
- package/dist/components/table/useTableFeatures.mjs +110 -0
- package/dist/components/table/useTableFeatures.mjs.map +1 -0
- package/dist/components/table/useTableSelection.cjs +2 -0
- package/dist/components/table/useTableSelection.cjs.map +1 -0
- package/dist/components/table/useTableSelection.mjs +39 -0
- package/dist/components/table/useTableSelection.mjs.map +1 -0
- package/dist/components/table/useTableSort.cjs +2 -0
- package/dist/components/table/useTableSort.cjs.map +1 -0
- package/dist/components/table/useTableSort.mjs +58 -0
- package/dist/components/table/useTableSort.mjs.map +1 -0
- package/dist/components/typography/Text.cjs +1 -1
- package/dist/components/typography/Text.cjs.map +1 -1
- package/dist/components/typography/Text.mjs +11 -7
- package/dist/components/typography/Text.mjs.map +1 -1
- package/dist/hooks/useActiveDescendant.cjs +1 -1
- package/dist/hooks/useActiveDescendant.cjs.map +1 -1
- package/dist/hooks/useActiveDescendant.mjs +33 -25
- package/dist/hooks/useActiveDescendant.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +140 -130
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +1 -1
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/hooks/useSelection.cjs +2 -0
- package/dist/hooks/useSelection.cjs.map +1 -0
- package/dist/hooks/useSelection.mjs +57 -0
- package/dist/hooks/useSelection.mjs.map +1 -0
- package/dist/hooks/useVirtualWindow.cjs +2 -0
- package/dist/hooks/useVirtualWindow.cjs.map +1 -0
- package/dist/hooks/useVirtualWindow.mjs +102 -0
- package/dist/hooks/useVirtualWindow.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1799 -63
- package/dist/index.d.ts +1799 -63
- package/dist/index.mjs +150 -136
- package/dist/lib/brand.cjs +2 -0
- package/dist/lib/brand.cjs.map +1 -0
- package/dist/lib/brand.mjs +358 -0
- package/dist/lib/brand.mjs.map +1 -0
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +68 -49
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/cn.cjs +1 -1
- package/dist/lib/cn.cjs.map +1 -1
- package/dist/lib/cn.mjs +5 -1
- package/dist/lib/cn.mjs.map +1 -1
- package/dist/lib/columnSizing.cjs +2 -0
- package/dist/lib/columnSizing.cjs.map +1 -0
- package/dist/lib/columnSizing.mjs +27 -0
- package/dist/lib/columnSizing.mjs.map +1 -0
- package/dist/lib/flatTree.cjs +2 -0
- package/dist/lib/flatTree.cjs.map +1 -0
- package/dist/lib/flatTree.mjs +118 -0
- package/dist/lib/flatTree.mjs.map +1 -0
- package/dist/lib/selection.cjs +2 -0
- package/dist/lib/selection.cjs.map +1 -0
- package/dist/lib/selection.mjs +28 -0
- package/dist/lib/selection.mjs.map +1 -0
- package/dist/lib/tokens.cjs +2 -0
- package/dist/lib/tokens.cjs.map +1 -0
- package/dist/lib/tokens.mjs +43 -0
- package/dist/lib/tokens.mjs.map +1 -0
- package/dist/lib/treeCascade.cjs +2 -0
- package/dist/lib/treeCascade.cjs.map +1 -0
- package/dist/lib/treeCascade.mjs +52 -0
- package/dist/lib/treeCascade.mjs.map +1 -0
- package/dist/lib/virtual.cjs +2 -0
- package/dist/lib/virtual.cjs.map +1 -0
- package/dist/lib/virtual.mjs +54 -0
- package/dist/lib/virtual.mjs.map +1 -0
- package/dist/lib/waveTokens.cjs +2 -0
- package/dist/lib/waveTokens.cjs.map +1 -0
- package/dist/lib/waveTokens.mjs +24 -0
- package/dist/lib/waveTokens.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +3 -1
- package/src/styles/tokens.css +210 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid.mjs","names":["useId","useId$1","React","DEFAULT_SELECT_ALL_LABEL","DEFAULT_SELECTION_HEADER_LABEL","createSelectionStore","selected","initial","registered","disabled","enabledCount","selectedEnabled","selectAll","singleMode","initialSingleMode","singleId","rowListeners","selectAllListeners","notify","listener","listeners","getSingleId","first","rowId","onRegistrationChange","previous","updateSelectAll","next","isEnabled","changeRow","wasEnabled","nowEnabled","step","count","counts","subscribeTo","done","items","item","single","createHeaderSlotRegistry","slots","update","nextCell","slot","getCell","cell","DataGridContext","DataGridSortContext","DataGridSectionContext","DataGridHeaderSlotsContext","DataGridHeaderRowHintContext","DataGridItemsContext","DataGridRowIdContext","DataGridRowContext","INERT_CONTEXT","INERT_SORT_CONTEXT","INERT_ROW_CONTEXT","useDataGridContext","reportMissingContext","component","useDataGridRowContext","useDataGridSortContext","EMPTY_ITEMS","toItems","keys","sameItems","a","b","index","renderFlatChild","node","key","columnIdOf","resolveDeprecatedProp","column","warnDuplicateRowId","cellBase","BODY_ROW_CLASSES","isSelectionCellElement","getTablePartKind","DataGridRoot","sortProp","sortColumnProp","sortDirectionProp","selectedItemsProp","rest","props","hasItems","usesSortApi","defaultSort","legacySort","objectMode","setObjectMode","objectCallbacks","legacySortControlled","warnDeprecated","defaultSortColumn","defaultSortDirection","deprecatedSortProps","mixedSortApi","ignoredSortProps","warnOnce","legacyHalves","setLegacyHalves","legacyControlledSort","legacyDefaultSort","controlledSort","initialSort","sortDetailsRef","sort","setSort","useControllable","onSortChange","requestSort","columnId","sortContext","onSelectionChange","legacySelected","selectedKeys","legacyDefaultSelected","defaultSelectedKeys","controlledSelected","defaultSelected","defaultSelectedItems","selectionDetailsRef","setSelectedValue","onSelectedItemsChange","setSelected","selectionMode","store","toggleRow","event","effective","selectedCount","toggleAll","all","enabled","radioName","selectAllLabel","labels","selectionHeaderLabel","context","selectOnRowClick","selectionAppearance","subtleSelection","useGridNavigation","mergedRef","useMergedRefs","ref","gridRef","itemRows","getRowId","sortColumnId","sortDirection","sortCompare","columns","sortedRows","compare","renderColumnsRow","cellKeys","DataGridRow","DataGridCell","itemsContext","columnWithoutId","content","children","flatChildren","flattenChildren","hasChild","isElementOfType","part","generatedHeader","DataGridHeader","DataGridHeaderCell","generatedBody","DataGridBody","isCaption","others","child","footerIndex","bodyIndex","containerClassName","containerLabel","containerLabelledBy","containerRest","containerProps","containerHasRole","droppedContainerName","cn","dataGridClassNames","className","composeEventHandlers","onKeyDown","gridProps","onFocus","onBlur","DataGridSelectionHeaderCell","state","ariaLabel","ariaLabelledBy","ariaDescribedBy","cellProps","checked","stableClassName","dataGridHeaderClassNames","SELECTION_CELL_CLASSES","focusRingInset","TableSelectionControl","controlRef","INERT_HEADER_SLOTS","DataGridSelectionHeaderSlot","cellRef","getIsFirst","initialFirst","getServerIsFirst","isFirst","_disabled","_invisible","_controlRef","_ariaLabel","_ariaLabelledBy","_ariaDescribedBy","withSelectionHeaderSlots","visit","nodes","cells","thead","setThead","isDev","selectionCells","row","sortable","sortedDirection","sortOnButtonClick","button","dataGridHeaderCellClassNames","onClick","TableSortButton","DataGridItemRow","render","rows","renderWithoutItems","renderRows","dataGridBodyClassNames","rowIdProp","itemRowId","section","firstHeaderRowHint","inHeader","selectable","labelId","ownCellProps","hasSelectionCell","selectionDisabled","selectionCellProps","selectionInvisible","ownLabelledBy","ownLabel","selectionLabel","getSelected","isSelected","unregister","unlabelled","handleKeyDown","target","handleClick","isForeignEvent","element","endsTextSelection","labelledBy","idCellIndex","firstCellIndex","firstCell","needsLabel","controlLabelledBy","controlLabel","rowContext","selectionCellElement","DataGridBodySelectionCell","dataGridRowClassNames","forcedColors","DataGridSelectionCell","notSelectable","unseen","rowProps","dataGridSelectionCellClassNames","invisible","markTablePart","dataGridCellClassNames","DataGrid"],"sources":["../../../src/components/table/DataGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport {\n dataGridBodyClassNames,\n dataGridCellClassNames,\n dataGridClassNames,\n dataGridHeaderCellClassNames,\n dataGridHeaderClassNames,\n dataGridRowClassNames,\n dataGridSelectionCellClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport {\n isDev,\n reportMissingContext,\n resolveDeprecatedProp,\n warnDeprecated,\n warnOnce,\n} from '../../lib/dev';\nimport { endsTextSelection, isForeignEvent } from '../../lib/events';\nimport type { Slot } from '../../lib/slot';\nimport { focusRingInset, forcedColors } from '../../lib/styles';\nimport type { SelectionMode } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport {\n SELECTION_CELL_CLASSES,\n TableSelectionControl,\n TableSortButton,\n getTablePartKind,\n markTablePart,\n} from './Table.shared';\nimport type { SortDirection } from './Table.shared';\nimport { useGridNavigation } from './useGridNavigation';\n\nexport type { SortDirection };\n\n/** The sort state of a DataGrid: the sorted column and its direction. */\nexport interface DataGridSort {\n /** The `columnId` of the sorted column. */\n columnId: string;\n /** The sort direction. */\n direction: SortDirection;\n}\n\n/** Second argument of `onSortChange` (the `DataGridSort` form): the event behind the sort. */\nexport interface DataGridSortChangeDetails {\n /** The DOM event behind the sort: the click of the sort button (Enter and Space click it). */\n event: Event;\n}\n\n/** Second argument of `onSelectedItemsChange`: the event behind the change. */\nexport interface DataGridSelectedItemsChangeDetails {\n /**\n * The DOM event behind the change: the click of a selection control (the select-all checkbox\n * included), or the key press of Space on a row.\n */\n event: Event;\n}\n\n/**\n * Defines a column of the DataGrid, typed by the grid's items (`T`): the header cell it renders\n * and, with `items`, the cell of each row. `createTableColumn` builds one with `sortable` resolved.\n * A column with functions (`compare`, `renderCell`, `renderHeaderCell`) cannot be passed from a\n * Server Component to the DataGrid, since functions are not serializable: define such columns in a\n * client component.\n */\nexport interface DataGridColumn<T = unknown> {\n /**\n * Unique identifier of the column: the `columnId` of its header cell (and of the grid's sort) and\n * the React key of its cells. Required in practice: a column without it (and without the\n * deprecated `id`) cannot sort, with a development warning.\n */\n columnId?: string;\n /**\n * @deprecated Use `columnId`. Read only when `columnId` is not given, with a development\n * warning.\n */\n id?: string;\n /** The header content (text or any React node), unless `renderHeaderCell` is given. */\n label: React.ReactNode;\n /**\n * Orders two items of the column, as for `Array.prototype.sort` (negative: `a` first). A column\n * with `compare` is sortable unless `sortable` is `false`. While the grid's sort names the column\n * (its own sort, or a controlled `sort`), a grid with `items` renders its rows in this order: a\n * stable sort of a copy of `items`, so items that compare equal keep their order in `items`,\n * in both directions (descending negates `compare`). Without `compare` the grid never reorders\n * the rows: leave it out when the rows arrive sorted (a server-sorted grid).\n */\n compare?: (a: T, b: T) => number;\n /**\n * Renders the content of the column's cell for one item (rows rendered from `items`). Without\n * it, the column's cells are empty.\n */\n renderCell?: (item: T) => React.ReactNode;\n /** Renders the header content, in place of `label`. */\n renderHeaderCell?: () => React.ReactNode;\n /**\n * Whether the column's header is a sort button (the header cell carries `aria-sort`).\n * @default compare !== undefined\n */\n sortable?: boolean;\n}\n\n/** The built-in text of a DataGrid, for localization (see `DataGridBaseProps.labels`). */\nexport interface DataGridLabels {\n /** Accessible name of the select-all checkbox in the header (`selectionMode=\"multiple\"`).\n * @default 'Select all rows'\n */\n selectAll?: string;\n /**\n * Visually hidden text of the selection column's header cell (`selectionMode=\"single\"`), which\n * names that column.\n * @default 'Selection'\n */\n selectionHeader?: string;\n}\n\nconst DEFAULT_SELECT_ALL_LABEL = 'Select all rows';\nconst DEFAULT_SELECTION_HEADER_LABEL = 'Selection';\n\n/**\n * How a selected row of a DataGrid is filled (`selectionAppearance`): `'brand'` with the selected\n * token, `'neutral'` with the subtle selected token, `'none'` not at all.\n */\nexport type DataGridSelectionAppearance = 'brand' | 'neutral' | 'none';\n\n/**\n * The props of a row's selection cell (`DataGrid.Row` `selectionCellProps`), the automatic cell or\n * a `DataGrid.SelectionCell` child (whose own props win).\n */\nexport interface DataGridRowSelectionCellProps {\n /**\n * Disables the row's selection control natively. The control is then no focus target of the grid\n * (the cell takes focus), and neither a row click (`selectOnRowClick`), Space on a cell nor\n * select-all changes the row's selection: select-all skips it, keeps it as it is, and tells its\n * state from the other rows. In a header row it disables the select-all checkbox.\n * @default false\n */\n disabled?: boolean;\n /**\n * Hides the selection control (it keeps its space and cannot be focused). The row is still\n * selected by a row click and Space, and tells its state with `aria-selected`.\n * @default false\n */\n invisible?: boolean;\n /** Class of the selection cell (`<td>`, or the `<th>` of a header row). */\n className?: string;\n /**\n * Accessible name of the selection control, in place of `selectionLabel` and the name taken from\n * the row's first cell; in a header row, the name of the select-all checkbox.\n */\n 'aria-label'?: string;\n}\n\n/** Properties for the DataGridSelectionCell sub-component. */\nexport interface DataGridSelectionCellProps\n extends\n Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'children'>,\n DataGridRowSelectionCellProps {\n /**\n * The cell holds no content of its own: the grid renders the selection control (or, in a\n * single-mode header row, the hidden \"Selection\" header text).\n */\n children?: never;\n /**\n * Accessible name of the control, in place of `aria-label` and the row's `selectionLabel`.\n * Routed to the control, as `aria-label` and `aria-describedby` are.\n */\n 'aria-labelledby'?: string;\n /** Ref to the selection control (`<input type=\"checkbox\">` or `<input type=\"radio\">`). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the cell element (`<td>`, or the `<th>` of a header row's select-all). */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/**\n * The `items` prop of a DataGrid that renders its rows from data, part of every sort form of\n * `DataGridProps` but the 0.4 one. `T` is the type of the items.\n */\nexport interface DataGridItemsProps<T = unknown> {\n /**\n * The grid's data, one body row per item, in this order unless the sorted column has `compare`\n * (see `DataGridColumn.compare`). With `columns` and no `DataGrid.Body` child (or one without\n * children), the grid renders the rows and cells from the columns; a `DataGrid.Body` whose child\n * is a render function renders the row of each item. Each row's `rowId` comes from `getRowId`.\n * The grid reads the array and never changes it. With `items`, `onSortChange` receives a\n * `DataGridSort` object and `details`, never the 0.4 arguments. `items` may not be `undefined`\n * unless `sort` or `defaultSort` is given; pass `items={data ?? []}` while loading.\n */\n items?: readonly T[];\n}\n\n/** Props of every DataGrid, whatever sort API it uses. `T` is the type of its `items`. */\nexport interface DataGridBaseProps<T = unknown> extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * The row id of an item: the `rowId` of its row (for selection), for rows rendered from `items`.\n * A row's own `rowId` wins. Ids must be unique (a duplicate warns in development).\n * @default the item's index in `items`, as a string\n */\n getRowId?: (item: T) => string;\n /**\n * Column definitions. When given and no `DataGrid.Header` child is present, the header row\n * (including the selection column) is rendered from them: `columnId` becomes the header cell's\n * `columnId`, `renderHeaderCell()` (else `label`) its content, and `sortable` (by default, having\n * `compare`) makes it a sort button. With `items` and no `DataGrid.Body` child, the body rows are\n * rendered from them too: one `DataGrid.Cell` per column, filled by `renderCell`. Those rows\n * render again whenever the array changes, so keep it stable (defined outside the component, or\n * memoised).\n */\n columns?: readonly DataGridColumn<T>[];\n /**\n * Row selection mode. `'multiple'` adds a checkbox column with a \"Select all rows\" header\n * checkbox; `'single'` adds a radio column (its header reads \"Selection\" to assistive\n * technology). `labels` localizes both texts.\n * @default 'none'\n */\n selectionMode?: 'none' | SelectionMode;\n /**\n * The name of the select-all checkbox and the header text of the selection column, for\n * localization. Unset members keep their English defaults. Rows are named with their own\n * `selectionLabel`.\n */\n labels?: DataGridLabels;\n /**\n * Whether a click on a body row toggles its selection in a selectable grid (single mode: selects\n * the row alone, or clears it). The row's own `onClick` runs first; calling `preventDefault()`\n * in it keeps the selection. A click never toggles when it lands on an interactive element in\n * the row (a link, a button, an input, a label, an element with `tabindex` or a widget role, the\n * selection control included), comes from a popup portaled from the row (a Menu, a Popover), or\n * ends a text selection in the row (a drag across its text); nor does a click on a header row\n * or on a row whose selection is disabled (`selectionCellProps.disabled`). Space on a cell\n * toggles the row either way.\n * @default false\n */\n selectOnRowClick?: boolean;\n /**\n * How a selected row is filled: `'brand'` with the selected token, `'neutral'` with the subtle\n * selected token, `'none'` not at all (the selection control, `aria-selected` and, in forced\n * colors, the row's outline still show it). Rendered as `data-selection-appearance` on the grid.\n * @default 'brand'\n */\n selectionAppearance?: DataGridSelectionAppearance;\n /**\n * Subtle selection controls: a row's control is transparent while the row is not selected, until\n * the row is hovered or holds focus, and the select-all checkbox while no row is selected, until\n * the grid is hovered or holds focus. Forced colors and a coarse pointer (touch) always draw\n * them; they stay focusable and named. Rendered as `data-subtle-selection` on the grid.\n * @default false\n */\n subtleSelection?: boolean;\n /**\n * Controlled selected row ids (`DataGrid.Row` `rowId`). In single mode pass at most one id: with\n * several, only the first one whose row is rendered is selected (a development warning says so).\n */\n selectedItems?: readonly string[];\n /** Initially selected row ids (uncontrolled). In single mode, at most one (see `selectedItems`). */\n defaultSelectedItems?: readonly string[];\n /**\n * Called with the new selected row ids when the selection changes, then `details` (`{ event }`,\n * the click or key press behind the change). Ids of rows that are not rendered are left out of\n * the reported selection and of the select-all state, so the next change drops them. Until that\n * change an uncontrolled grid still holds such an id: a row re-added with the same `rowId` before\n * then is shown selected again.\n */\n onSelectedItemsChange?: (\n selectedItems: string[],\n details?: DataGridSelectedItemsChangeDetails,\n ) => void;\n /** @deprecated Use `selectedItems` (an array). A `Set` or an array is accepted. */\n selectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `defaultSelectedItems` (an array). A `Set` or an array is accepted. */\n defaultSelectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `onSelectedItemsChange`, which receives an array. Both are called. */\n onSelectionChange?: (keys: Set<string>) => void;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style (e.g. a max height) or ref. The wrapper\n * is not a tab stop (the grid's own cell tab stop scrolls it) and has no role, so its\n * `aria-label`/`aria-labelledby` are applied only together with a `role` (e.g. `'region'`);\n * without one they are dropped with a development warning. Name the grid with `aria-label`.\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /**\n * DataGrid header, body, and row elements. Optional when `items` and `columns` render the grid;\n * a generated body is placed after the header and before a `<tfoot>` child.\n */\n children?: React.ReactNode;\n /** Ref to the `<table role=\"grid\">` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\ninterface NoDeprecatedSortProps {\n sortColumn?: never;\n defaultSortColumn?: never;\n sortDirection?: never;\n defaultSortDirection?: never;\n}\n\n/** The 0.5 sort API, controlled: `sort` + `onSortChange(sort, details)`. */\nexport interface DataGridControlledSortProps extends NoDeprecatedSortProps {\n /** The controlled sort, or `null` for an unsorted grid. */\n sort: DataGridSort | null;\n /** Initial sort while `sort` is not given yet. */\n defaultSort?: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated, then `details` (`{ event }`).\n * With `items`, the grid orders its rows by the sorted column's `compare` (see\n * `DataGridColumn.compare`), also while `sort` is controlled; otherwise the consumer orders them.\n */\n onSortChange?: (sort: DataGridSort, details?: DataGridSortChangeDetails) => void;\n}\n\n/** The 0.5 sort API, uncontrolled: `defaultSort` (`null` for none) + `onSortChange(sort, details)`. */\nexport interface DataGridUncontrolledSortProps extends NoDeprecatedSortProps {\n sort?: undefined;\n /** The initial sort, or `null` for an initially unsorted grid. */\n defaultSort: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated, then `details` (`{ event }`).\n * With `items`, the grid orders its rows by the sorted column's `compare` (see\n * `DataGridColumn.compare`); otherwise the consumer orders them.\n */\n onSortChange?: (sort: DataGridSort, details?: DataGridSortChangeDetails) => void;\n}\n\n/**\n * The sort props of a grid with `items`: the 0.5 sort API, whether or not `sort` or `defaultSort`\n * is given (unsorted at first without them). The 0.4 positional `onSortChange` and the deprecated\n * sort props do not apply to such a grid.\n */\nexport interface DataGridItemsSortProps<T = unknown>\n extends DataGridItemsProps<T>, NoDeprecatedSortProps {\n /** The grid's data (see `DataGridItemsProps.items`). */\n items: readonly T[];\n /** The controlled sort, or `null` for an unsorted grid; `undefined` leaves the sort to the grid. */\n sort?: DataGridSort | null;\n /** The initial sort while `sort` is not given. */\n defaultSort?: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated, then `details` (`{ event }`).\n * The grid orders its rows by the sorted column's `compare` (see `DataGridColumn.compare`).\n */\n onSortChange?: (sort: DataGridSort, details?: DataGridSortChangeDetails) => void;\n}\n\n/**\n * The 0.4 sort API: `onSortChange(columnId, direction)` and the deprecated `sortColumn`/\n * `sortDirection` props. It applies whenever none of `items`, `sort` and `defaultSort` is given.\n * As in 0.4, the column and the direction can be controlled independently: the half that is not\n * controlled is kept internally and follows every sort request (mixed control, warned in\n * development).\n */\nexport interface DataGridLegacySortProps {\n /** A grid with `items` uses the 0.5 sort API (`DataGridItemsSortProps`). */\n items?: undefined;\n sort?: undefined;\n defaultSort?: undefined;\n /**\n * @deprecated Use `sort` (`{ columnId, direction }` or `null`). Without `sortDirection`, the\n * direction is kept internally (it toggles on repeated clicks).\n */\n sortColumn?: string;\n /** @deprecated Use `defaultSort`. */\n defaultSortColumn?: string;\n /**\n * @deprecated Use `sort`. Without `sortColumn`, the column is kept internally (it follows the\n * clicked header, starting from `defaultSortColumn`).\n */\n sortDirection?: SortDirection;\n /** @deprecated Use `defaultSort`. */\n defaultSortDirection?: SortDirection;\n /**\n * Called when a sortable header is activated, with the 0.4 arguments. Pass `items`, `sort` or\n * `defaultSort` to receive a `DataGridSort` object (and `details`) instead:\n * `defaultSort={null}` turns the object form on for an initially unsorted grid. A `sort` that is\n * still `undefined` (e.g. while data loads) does not: pass `sort={sort ?? null}`.\n *\n * @example\n * <DataGrid defaultSort={null} onSortChange={(sort) => setSort(sort)}>…</DataGrid>\n */\n onSortChange?: (columnId: string, direction: SortDirection) => void;\n}\n\n/**\n * Properties for the DataGrid component, whose `items` are of type `T`. The sort props form a\n * union: `sort`/`defaultSort` with `onSortChange(sort, details)` (0.5, also the form of every grid\n * with `items`), or the 0.4 form `onSortChange(columnId, direction)` with the deprecated\n * `sortColumn`/`sortDirection`/`defaultSortColumn`/`defaultSortDirection`, for a grid without\n * `items`. The two cannot be mixed.\n */\nexport type DataGridProps<T = unknown> = DataGridBaseProps<T> &\n (\n | (DataGridItemsProps<T> & DataGridControlledSortProps)\n | (DataGridItemsProps<T> & DataGridUncontrolledSortProps)\n | DataGridItemsSortProps<T>\n | DataGridLegacySortProps\n );\n\n/** Properties for the DataGridHeader sub-component. */\nexport interface DataGridHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /**\n * Header row elements. Each `<tr>` child (also inside a Fragment) gets the selection column's\n * header cell prepended when the grid is selectable, unless the row holds a\n * `DataGrid.SelectionCell` (which then is that cell, where it stands); a header row rendered by\n * another component should be a `DataGrid.Row`, which adds the cell itself. With several header\n * rows (a grouped header), only the first one gets the \"Select all rows\" control; later rows get\n * an empty cell.\n */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridHeaderCell sub-component. */\nexport interface DataGridHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Column ID used for sort tracking. Required for `sortable`. */\n columnId?: string;\n /**\n * Whether this column can be sorted. The content is rendered inside a `<button>`; the header\n * cell carries `aria-sort`. Ignored (with a development warning) without `columnId`.\n * @default false\n */\n sortable?: boolean;\n /**\n * The glyph a sortable header shows after its content while its column is sorted, in place of\n * the default arrow (up for ascending, down for descending). It is decorative (`aria-hidden`:\n * `aria-sort` on the header tells the direction) and carries `data-direction` (`ascending` or\n * `descending`), so one glyph can be turned by a selector on it. `null` and `undefined` keep the\n * arrow; `false`, or any value that renders nothing, shows no glyph. A `<button>` or `Button`\n * element (or a slot object whose `as` is one) is not nested in the sort button: its children\n * become the glyph and its props are dropped, with a development warning.\n */\n sortIcon?: Slot<'span'>;\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Properties for the DataGridBody sub-component, in a grid whose `items` are of type `T`. */\nexport interface DataGridBodyProps<T = unknown> extends Omit<\n React.HTMLAttributes<HTMLTableSectionElement>,\n 'children'\n> {\n /**\n * The body rows: `DataGrid.Row` elements, or a render function called with each item of the\n * grid's `items` (in the grid's sort order) and the item's index in `items` (its position there,\n * whatever the sort), which returns the item's `DataGrid.Row`. The grid keys each returned row\n * by its row id and gives it that id as `rowId` (from `getRowId`), and renders it again only\n * when its item, its index or the function change (a sort moves the rows). Type the function\n * by annotating its item parameter (`(person: Person) => …`) or with `DataGrid.Body<Person>`.\n * Without children, a grid with `items` and `columns` renders the rows from the columns; empty\n * children are no rows.\n */\n children?: React.ReactNode | ((item: T, index: number) => React.ReactNode);\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridRow sub-component. */\nexport interface DataGridRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /**\n * Unique identifier for this row, used for selection (rows that share one are selected together;\n * a duplicate warns in development). A selectable grid renders no selection control (and warns\n * in development) for a row without it. A row rendered from the grid's `items` (by\n * `DataGrid.Body`'s render function or from `columns`) defaults to the item's row id\n * (`getRowId`).\n */\n rowId?: string;\n /**\n * Accessible name of the row's selection control. Defaults to the row's first child that is a\n * `DataGrid.Cell`, `<td>` or `<th>` element (`aria-labelledby`); a cell that another component\n * renders is not seen, so pass `selectionLabel` when the row's first cell is one. Without such a\n * child the control is named \"Select row\" (with a development warning). The selection cell's\n * `aria-label` (`selectionCellProps`, or a `DataGrid.SelectionCell` child's) wins over it.\n */\n selectionLabel?: string;\n /**\n * Props of the row's selection cell (`disabled`, `invisible`, `className`, `aria-label`): the\n * cell the row adds first in a selectable grid, or a `DataGrid.SelectionCell` child, whose own\n * props win (their classes are merged). In a header row they apply to the select-all cell.\n */\n selectionCellProps?: DataGridRowSelectionCellProps;\n /**\n * DataGrid cell elements. A `DataGrid.SelectionCell` child (also inside a Fragment) is the row's\n * selection cell, where it stands: the row then adds none.\n */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the DataGridCell sub-component. */\nexport interface DataGridCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Selection store\n// ---------------------------------------------------------------------------\n\ntype SelectAllState = 'all' | 'some' | 'none';\n\n/**\n * Selection state shared with the rows through `useSyncExternalStore`, so toggling one row\n * re-renders only that row (and the select-all header cell). The root pushes the committed\n * selection in a layout effect; rows register their ids. The effective selection is always\n * `selected ∩ registered`, derived on read (no pruning effect).\n *\n * @internal Not exported from the package (exported for its unit tests).\n */\nexport interface SelectionStore {\n /**\n * Row subscription: notified only when the selection changes. Rows registering or unregistering\n * notify no row, so adding or removing k of n rows costs O(k), not O(k·n); the one exception is\n * single mode with several selected ids, where a row registering can move the selected row.\n */\n subscribe(listener: () => void): () => void;\n /**\n * Select-all subscription: notified only when {@link getSelectAllState} changes (through the\n * selection or through rows registering and unregistering).\n */\n subscribeSelectAll(listener: () => void): () => void;\n /** Registers a rendered row id; returns the unregister function. */\n register(rowId: string): () => void;\n /**\n * Marks a row's selection disabled (`selectionCellProps.disabled`): select-all skips it and its\n * state counts only the other rows. Returns the function that undoes it. A row id is disabled\n * while any row registered with it is.\n */\n disable(rowId: string): () => void;\n /** Whether the row's selection is disabled (see {@link disable}). */\n isDisabled(rowId: string): boolean;\n /** How many rendered rows are registered with `rowId` (more than one: a duplicate). */\n countRegistrations(rowId: string): number;\n /** Sets the committed selection (layout effect of the root). */\n setSelected(items: readonly string[]): void;\n /**\n * Sets whether the grid is in single mode (layout effect of the root). Only then do rows\n * registering or unregistering re-check the one selected row of single mode and notify the rows.\n */\n setSingleMode(single: boolean): void;\n /**\n * Whether the row is selected. With `single`, only one row is: the first selected id (in\n * selection order) whose row is registered, else the first selected id (before any row\n * registered: the server render and the first client render).\n */\n isSelected(rowId: string, single?: boolean): boolean;\n /**\n * Whether all, some or none of the registered rows whose selection is not disabled are selected\n * (`'none'` without such rows). O(1).\n */\n getSelectAllState(): SelectAllState;\n /** Registered row ids in registration order. */\n getRegistered(): string[];\n /** `items` restricted to registered rows (order of `items`). */\n prune(items: readonly string[]): string[];\n}\n\n/**\n * Creates the {@link SelectionStore} of one DataGrid.\n *\n * @internal Not exported from the package (exported for its unit tests).\n */\nexport function createSelectionStore(\n initial: readonly string[],\n initialSingleMode = false,\n): SelectionStore {\n let selected: ReadonlySet<string> = new Set(initial);\n /** Registered row id -> number of rows registered with it. */\n const registered = new Map<string, number>();\n /** Row id -> number of `disable` calls in effect for it. */\n const disabled = new Map<string, number>();\n /** Registered row ids whose selection is not disabled: the rows select-all changes. */\n let enabledCount = 0;\n /** How many of those are selected (kept up to date, so select-all is O(1)). */\n let selectedEnabled = 0;\n let selectAll: SelectAllState = 'none';\n let singleMode = initialSingleMode;\n /** The one selected row of single mode (see `isSelected`); `undefined`: not computed yet. */\n let singleId: string | null | undefined;\n const rowListeners = new Set<() => void>();\n const selectAllListeners = new Set<() => void>();\n\n const notify = (listeners: Set<() => void>) => {\n for (const listener of Array.from(listeners)) listener();\n };\n\n /** Computed on read: O(selected ids) once per change, and only in single mode. */\n const getSingleId = (): string | null => {\n if (singleId !== undefined) return singleId;\n let first: string | null = null;\n for (const rowId of selected) {\n if (registered.has(rowId)) {\n first = rowId;\n break;\n }\n first ??= rowId;\n }\n singleId = first;\n return first;\n };\n\n /**\n * A row id registered or unregistered. With several selected ids, the one selected row of\n * single mode can move: in single mode it is re-checked and the rows are notified if it moved.\n */\n const onRegistrationChange = (rowId: string) => {\n if (selected.size < 2 || !selected.has(rowId)) return;\n const previous = singleId;\n singleId = undefined;\n if (singleMode && getSingleId() !== previous) notify(rowListeners);\n };\n\n const updateSelectAll = () => {\n const next: SelectAllState =\n selectedEnabled === 0 ? 'none' : selectedEnabled === enabledCount ? 'all' : 'some';\n if (next === selectAll) return;\n selectAll = next;\n notify(selectAllListeners);\n };\n\n const isEnabled = (rowId: string) => registered.has(rowId) && !disabled.has(rowId);\n\n /**\n * Runs `change` (a registration or a `disable` of `rowId`) and keeps the counts of select-all in\n * step with whether the row is enabled before and after it.\n */\n const changeRow = (rowId: string, change: () => void) => {\n const wasEnabled = isEnabled(rowId);\n change();\n const nowEnabled = isEnabled(rowId);\n if (wasEnabled === nowEnabled) return;\n const step = nowEnabled ? 1 : -1;\n enabledCount += step;\n if (selected.has(rowId)) selectedEnabled += step;\n };\n\n /** Adds `step` to the count of `rowId` in `counts`, deleting it at zero. */\n const count = (counts: Map<string, number>, rowId: string, step: 1 | -1) => {\n const next = (counts.get(rowId) ?? 0) + step;\n if (next > 0) counts.set(rowId, next);\n else counts.delete(rowId);\n };\n\n const subscribeTo = (listeners: Set<() => void>) => (listener: () => void) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n };\n\n return {\n subscribe: subscribeTo(rowListeners),\n subscribeSelectAll: subscribeTo(selectAllListeners),\n register(rowId) {\n const first = !registered.has(rowId);\n changeRow(rowId, () => count(registered, rowId, 1));\n updateSelectAll();\n if (first) onRegistrationChange(rowId);\n let done = false;\n return () => {\n if (done) return;\n done = true;\n changeRow(rowId, () => count(registered, rowId, -1));\n if (registered.has(rowId)) return;\n updateSelectAll();\n onRegistrationChange(rowId);\n };\n },\n disable(rowId) {\n changeRow(rowId, () => count(disabled, rowId, 1));\n updateSelectAll();\n let done = false;\n return () => {\n if (done) return;\n done = true;\n changeRow(rowId, () => count(disabled, rowId, -1));\n updateSelectAll();\n };\n },\n isDisabled(rowId) {\n return disabled.has(rowId);\n },\n setSelected(items) {\n const next = new Set(items);\n if (next.size === selected.size && items.every((item) => selected.has(item))) return;\n selected = next;\n singleId = undefined;\n selectedEnabled = 0;\n for (const rowId of next) if (isEnabled(rowId)) selectedEnabled += 1;\n notify(rowListeners);\n updateSelectAll();\n },\n setSingleMode(single) {\n singleMode = single;\n },\n isSelected(rowId, single = false) {\n return single ? getSingleId() === rowId : selected.has(rowId);\n },\n countRegistrations(rowId) {\n return registered.get(rowId) ?? 0;\n },\n getSelectAllState() {\n return selectAll;\n },\n getRegistered() {\n return Array.from(registered.keys());\n },\n prune(items) {\n return items.filter((item) => registered.has(item));\n },\n };\n}\n\n// ---------------------------------------------------------------------------\n// Header selection slots\n// ---------------------------------------------------------------------------\n\n/**\n * The selection column's header slots of one `DataGrid.Header`, one per header row. Only the first\n * slot in document order renders the \"Select all rows\" control (the \"Selection\" text in single\n * mode); the others render an empty cell, so a grouped header (several header rows) has one control\n * and every header row keeps the selection column.\n */\ninterface HeaderSlotRegistry {\n subscribe(listener: () => void): () => void;\n /** Registers a slot and a getter for its current cell; returns the unregister function. */\n register(slot: object, getCell: () => Element | null): () => void;\n /** The first slot in document order, or `null` while no slot is registered. */\n getFirst(): object | null;\n /** Re-checks the order: header rows can move without a slot mounting or unmounting. */\n refresh(): void;\n}\n\nfunction createHeaderSlotRegistry(): HeaderSlotRegistry {\n const slots = new Map<object, () => Element | null>();\n const listeners = new Set<() => void>();\n let first: object | null = null;\n\n const update = () => {\n let next: object | null = null;\n let nextCell: Element | null = null;\n for (const [slot, getCell] of slots) {\n const cell = getCell();\n if (!cell) {\n // A slot whose cell is being replaced (control <-> empty cell): keep the current order\n // until the next registration or header commit sees every cell again.\n if (first !== null && slots.has(first)) return;\n continue;\n }\n if (!nextCell || cell.compareDocumentPosition(nextCell) & Node.DOCUMENT_POSITION_FOLLOWING) {\n next = slot;\n nextCell = cell;\n }\n }\n if (next === null) next = slots.keys().next().value ?? null;\n if (next === first) return;\n first = next;\n for (const listener of Array.from(listeners)) listener();\n };\n\n return {\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n register(slot, getCell) {\n slots.set(slot, getCell);\n update();\n return () => {\n slots.delete(slot);\n update();\n };\n },\n getFirst: () => first,\n refresh: update,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Contexts\n// ---------------------------------------------------------------------------\n\ninterface DataGridContextValue {\n selectionMode: 'none' | SelectionMode;\n store: SelectionStore;\n /** Toggles one row (single mode: selects it alone, or clears it); `event` goes to `details`. */\n toggleRow: (rowId: string, event: Event) => void;\n /** Selects every rendered row, or clears the selection when all are selected. */\n toggleAll: (event: Event) => void;\n /** Shared `name` of the single-mode radios (they are kept out of any form with `form=\"\"`). */\n radioName: string;\n /** Name of the select-all checkbox (multiple mode). */\n selectAllLabel: string;\n /** Hidden header text of the selection column (single mode). */\n selectionHeaderLabel: string;\n /** `selectOnRowClick` of the grid. */\n selectOnRowClick: boolean;\n /** `selectionAppearance` of the grid. */\n selectionAppearance: DataGridSelectionAppearance;\n /** `subtleSelection` of the grid. */\n subtleSelection: boolean;\n}\n\n/** What a row tells its selection cell, the automatic one or a `DataGrid.SelectionCell` child. */\ninterface DataGridRowContextValue {\n /** The row's `selectionCellProps`. */\n selectionCellProps: DataGridRowSelectionCellProps | undefined;\n /** Whether a `DataGrid.SelectionCell` child was seen (then the row adds no cell of its own). */\n hasSelectionCell: boolean;\n /** The row's id; `undefined` for a header row, or a body row without one (no control). */\n rowId: string | undefined;\n isSelected: boolean;\n /** Resolved from the cell's own props and `selectionCellProps`. */\n disabled: boolean;\n /** Resolved from the cell's own props and `selectionCellProps`. */\n invisible: boolean;\n /** The control's `aria-label`. */\n ariaLabel: string | undefined;\n /** The control's `aria-labelledby`. */\n ariaLabelledBy: string | undefined;\n}\n\ninterface DataGridSortContextValue {\n sort: DataGridSort | null;\n /** Sorts by the column (toggling its direction); `event` goes to `details`. */\n requestSort: (columnId: string, event: Event) => void;\n}\n\ntype DataGridSection = 'header' | 'body';\n\nconst DataGridContext = React.createContext<DataGridContextValue | null>(null);\nconst DataGridSortContext = React.createContext<DataGridSortContextValue | null>(null);\n/** Whether a row is rendered in the header or the body (rows in a header get a header cell). */\nconst DataGridSectionContext = React.createContext<DataGridSection>('body');\n/** The header's selection slots (see {@link HeaderSlotRegistry}). */\nconst DataGridHeaderSlotsContext = React.createContext<HeaderSlotRegistry | null>(null);\n/**\n * Whether the header row below is the header's first row, as far as the header can tell from its\n * children. Only the initial (and server) render uses it; the slots then follow the DOM order.\n */\nconst DataGridHeaderRowHintContext = React.createContext(true);\n\n/** Renders the row of one item of `items` (a `DataGrid.Body` render function, or from `columns`). */\ntype DataGridRenderRow = (item: unknown, index: number) => React.ReactNode;\n\n/** One row of the grid's `items`. */\ninterface DataGridItemRowData {\n item: unknown;\n /** The item's index in `items`. */\n index: number;\n rowId: string;\n /** The row's React key: its row id, made unique when the id repeats. */\n key: string;\n}\n\ninterface DataGridItemsContextValue {\n /** The rows of `items`, in the order they are rendered; `null` without `items`. */\n rows: readonly DataGridItemRowData[] | null;\n /** Renders a row from `columns`; `null` without `items` and `columns`. */\n renderColumnsRow: DataGridRenderRow | null;\n}\n\n/** The grid's `items`, for `DataGrid.Body` (optional: a body of JSX rows needs none). */\nconst DataGridItemsContext = React.createContext<DataGridItemsContextValue | null>(null);\n/**\n * The row id of the item a body row is rendered for, the default `rowId` of `DataGrid.Row`. The\n * grid resets it, so the rows of a grid nested in a cell do not take the outer row's id.\n */\nconst DataGridRowIdContext = React.createContext<string | null>(null);\n/** The row around a selection cell (see {@link DataGridRowContextValue}). */\nconst DataGridRowContext = React.createContext<DataGridRowContextValue | null>(null);\n\nconst INERT_STORE = createSelectionStore([]);\nconst INERT_CONTEXT: DataGridContextValue = {\n selectionMode: 'none',\n store: INERT_STORE,\n toggleRow: () => {},\n toggleAll: () => {},\n radioName: '',\n selectAllLabel: DEFAULT_SELECT_ALL_LABEL,\n selectionHeaderLabel: DEFAULT_SELECTION_HEADER_LABEL,\n selectOnRowClick: false,\n selectionAppearance: 'brand',\n subtleSelection: false,\n};\nconst INERT_SORT_CONTEXT: DataGridSortContextValue = { sort: null, requestSort: () => {} };\nconst INERT_ROW_CONTEXT: DataGridRowContextValue = {\n selectionCellProps: undefined,\n hasSelectionCell: true,\n rowId: undefined,\n isSelected: false,\n disabled: false,\n invisible: false,\n ariaLabel: undefined,\n ariaLabelledBy: undefined,\n};\n\nfunction useDataGridContext(component: string): DataGridContextValue {\n const ctx = React.useContext(DataGridContext);\n if (ctx) return ctx;\n reportMissingContext(component, 'DataGrid');\n return INERT_CONTEXT;\n}\n\nfunction useDataGridRowContext(component: string): DataGridRowContextValue {\n const ctx = React.useContext(DataGridRowContext);\n if (ctx) return ctx;\n reportMissingContext(component, 'DataGrid.Row');\n return INERT_ROW_CONTEXT;\n}\n\nfunction useDataGridSortContext(component: string): DataGridSortContextValue {\n const ctx = React.useContext(DataGridSortContext);\n if (ctx) return ctx;\n reportMissingContext(component, 'DataGrid');\n return INERT_SORT_CONTEXT;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst EMPTY_ITEMS: readonly string[] = [];\n\nfunction toItems(\n keys: ReadonlySet<string> | readonly string[] | undefined,\n): readonly string[] | undefined {\n return keys === undefined ? undefined : Array.from(keys);\n}\n\nfunction sameItems(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((item, index) => item === b[index]);\n}\n\n/** A child of {@link flattenChildren} under its flattened key (unique across the flattened list). */\nfunction renderFlatChild({ key, node }: { key: string; node: React.ReactNode }): React.ReactNode {\n return <React.Fragment key={key}>{node}</React.Fragment>;\n}\n\n/** A column's id: `columnId`, else the deprecated `id` (warned once). */\nfunction columnIdOf<T>(column: DataGridColumn<T>): string | undefined {\n return resolveDeprecatedProp(\n 'DataGrid',\n column.columnId,\n column.id,\n 'columns[].id',\n 'columns[].columnId',\n );\n}\n\nfunction warnDuplicateRowId(rowId: string): void {\n warnOnce(\n `DataGrid:duplicate-rowId:${rowId}`,\n `DataGrid: several rows share the rowId \"${rowId}\". Row ids must be unique within a ` +\n 'DataGrid; rows with the same rowId are selected and deselected together.',\n );\n}\n\nconst cellBase = 'px-4 py-3 border-b border-border';\n\n/** A body row: its hover and, per `selectionAppearance`, the fill of a selected row. */\nconst BODY_ROW_CLASSES: Record<DataGridSelectionAppearance, string> = {\n brand:\n 'hover:bg-subtle-hover data-[selected]:bg-selected transition-colors motion-reduce:transition-none',\n neutral:\n 'hover:bg-subtle-hover data-[selected]:bg-subtle-selected transition-colors motion-reduce:transition-none',\n none: 'hover:bg-subtle-hover transition-colors motion-reduce:transition-none',\n};\n\n/** Whether `node` is an element of `DataGrid.SelectionCell` (lazy client references too). */\nfunction isSelectionCellElement(\n node: React.ReactNode,\n): node is React.ReactElement<DataGridSelectionCellProps> {\n return getTablePartKind(node) === 'dataGridSelectionCell';\n}\n\n// ---------------------------------------------------------------------------\n// DataGrid\n// ---------------------------------------------------------------------------\n\n// The component-level JSDoc sits on the exported `DataGrid` below.\n//\n// Two call signatures. The first takes only a grid with `items` (`DataGridItemsSortProps`), so an\n// inline `onSortChange={(sort, details) => …}` next to `items` has one contextual type: in the\n// union of the second, `items` cannot tell the members apart while `T` is still being inferred\n// from it. Every other grid, a generic wrapper's `DataGridProps<T>` included, takes the second.\nfunction DataGridRoot<T>(\n props: DataGridBaseProps<T> & DataGridItemsSortProps<T>,\n): React.JSX.Element;\nfunction DataGridRoot<T = unknown>(props: DataGridProps<T>): React.JSX.Element;\nfunction DataGridRoot<T>(props: DataGridProps<T>) {\n const {\n items,\n getRowId,\n sort: sortProp,\n defaultSort,\n sortColumn: sortColumnProp,\n defaultSortColumn,\n sortDirection: sortDirectionProp,\n defaultSortDirection,\n onSortChange,\n selectionMode = 'none',\n selectedItems: selectedItemsProp,\n defaultSelectedItems,\n onSelectedItemsChange,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n labels,\n selectOnRowClick = false,\n selectionAppearance = 'brand',\n subtleSelection = false,\n columns,\n containerProps,\n children,\n className,\n onKeyDown,\n onFocus,\n onBlur,\n ref,\n ...rest\n } = props;\n\n // --- sort -----------------------------------------------------------------\n const hasItems = items !== undefined;\n /** The 0.5 sort props, which win over the deprecated ones. */\n const usesSortApi = sortProp !== undefined || defaultSort !== undefined;\n /**\n * The 0.4 rules (the deprecated sort props, the positional callback) apply without `items`,\n * `sort` and `defaultSort`.\n */\n const legacySort = !usesSortApi && !hasItems;\n /** `onSortChange(sort, details)`; sticky, so the form never changes under the consumer. */\n const [objectMode, setObjectMode] = React.useState(!legacySort);\n if (!legacySort && !objectMode) setObjectMode(true);\n const objectCallbacks = objectMode || !legacySort;\n\n const legacySortControlled = sortColumnProp !== undefined || sortDirectionProp !== undefined;\n if (sortColumnProp !== undefined) warnDeprecated('DataGrid', 'sortColumn', 'sort');\n if (sortDirectionProp !== undefined) warnDeprecated('DataGrid', 'sortDirection', 'sort');\n if (defaultSortColumn !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortColumn', 'defaultSort');\n }\n if (defaultSortDirection !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortDirection', 'defaultSort');\n }\n const deprecatedSortProps =\n legacySortControlled || defaultSortColumn !== undefined || defaultSortDirection !== undefined;\n const mixedSortApi = usesSortApi && deprecatedSortProps;\n /** A grid with `items` (and no `sort`/`defaultSort`) ignores the deprecated sort props. */\n const ignoredSortProps = !legacySort && !usesSortApi && deprecatedSortProps;\n\n React.useEffect(() => {\n if (mixedSortApi) {\n warnOnce(\n 'DataGrid:mixed-sort',\n 'DataGrid: do not mix `sort`/`defaultSort` with the deprecated `sortColumn`/`sortDirection`/' +\n '`defaultSortColumn`/`defaultSortDirection`. `sort`/`defaultSort` win.',\n );\n } else if (ignoredSortProps) {\n warnOnce(\n 'DataGrid:items-deprecated-sort',\n 'DataGrid: the deprecated `sortColumn`/`sortDirection`/`defaultSortColumn`/' +\n '`defaultSortDirection` do not apply to a grid with `items` and are ignored. Pass `sort` ' +\n 'or `defaultSort`.',\n );\n }\n }, [mixedSortApi, ignoredSortProps]);\n // 0.4 mixed control: `sortColumn` and `sortDirection` are controlled independently. The half the\n // parent does not control is kept here (seeded from its default) and follows every sort request,\n // as 0.4 did, so repeated clicks still alternate and aria-sort shows what was reported.\n React.useEffect(() => {\n if (!legacySort) return;\n if (sortColumnProp !== undefined && sortDirectionProp === undefined) {\n warnOnce(\n 'DataGrid:sortColumn-without-sortDirection',\n 'DataGrid: `sortColumn` is controlled but `sortDirection` is not (mixed control). The ' +\n 'direction is kept internally and toggles on repeated clicks, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n } else if (sortDirectionProp !== undefined && sortColumnProp === undefined) {\n warnOnce(\n 'DataGrid:sortDirection-without-sortColumn',\n 'DataGrid: `sortDirection` is controlled but `sortColumn` is not (mixed control). The ' +\n 'column is kept internally and follows the clicked header, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n }\n }, [legacySort, sortColumnProp, sortDirectionProp]);\n\n /** The uncontrolled halves of the 0.4 sort props (used while the other half is controlled). */\n const [legacyHalves, setLegacyHalves] = React.useState<{\n column: string;\n direction: SortDirection;\n }>(() => ({\n column: defaultSortColumn ?? '',\n direction: defaultSortDirection ?? 'ascending',\n }));\n\n const legacyControlledSort = React.useMemo<DataGridSort | null | undefined>(() => {\n if (sortColumnProp === undefined && sortDirectionProp === undefined) return undefined;\n const column = sortColumnProp ?? legacyHalves.column;\n return column === ''\n ? null\n : { columnId: column, direction: sortDirectionProp ?? legacyHalves.direction };\n }, [sortColumnProp, sortDirectionProp, legacyHalves]);\n\n const legacyDefaultSort = React.useMemo<DataGridSort | null>(\n () =>\n defaultSortColumn\n ? { columnId: defaultSortColumn, direction: defaultSortDirection ?? 'ascending' }\n : null,\n [defaultSortColumn, defaultSortDirection],\n );\n\n const controlledSort = legacySort ? legacyControlledSort : sortProp;\n // A grid with `items` and no `defaultSort` starts unsorted: the deprecated defaults are ignored.\n let initialSort = legacyDefaultSort;\n if (defaultSort !== undefined) initialSort = defaultSort;\n else if (ignoredSortProps) initialSort = null;\n\n // The details of the sort being requested, set around the setter: useControllable calls its\n // onChange synchronously inside it, and only on change (the useCheckedValues pattern).\n const sortDetailsRef = React.useRef<DataGridSortChangeDetails | undefined>(undefined);\n\n const emitSortChange = (next: DataGridSort | null) => {\n if (!next) return;\n if (legacySort) {\n setLegacyHalves((previous) =>\n previous.column === next.columnId && previous.direction === next.direction\n ? previous\n : { column: next.columnId, direction: next.direction },\n );\n }\n if (!onSortChange) return;\n if (objectCallbacks) {\n const objectForm = onSortChange as NonNullable<DataGridItemsSortProps['onSortChange']>;\n objectForm(next, sortDetailsRef.current);\n } else {\n const legacy = onSortChange as (columnId: string, direction: SortDirection) => void;\n legacy(next.columnId, next.direction);\n }\n };\n\n const [sort, setSort] = useControllable<DataGridSort | null>(\n controlledSort,\n initialSort,\n emitSortChange,\n );\n\n const requestSort = React.useCallback(\n (columnId: string, event: Event) => {\n sortDetailsRef.current = { event };\n try {\n setSort((previous) => ({\n columnId,\n direction:\n previous?.columnId === columnId && previous.direction === 'ascending'\n ? 'descending'\n : 'ascending',\n }));\n } finally {\n sortDetailsRef.current = undefined;\n }\n },\n [setSort],\n );\n\n const sortContext = React.useMemo<DataGridSortContextValue>(\n () => ({ sort, requestSort }),\n [sort, requestSort],\n );\n\n // --- selection ------------------------------------------------------------\n if (onSelectionChange !== undefined) {\n warnDeprecated('DataGrid', 'onSelectionChange', 'onSelectedItemsChange');\n }\n const legacySelected = React.useMemo(() => toItems(selectedKeys), [selectedKeys]);\n const legacyDefaultSelected = React.useMemo(\n () => toItems(defaultSelectedKeys),\n [defaultSelectedKeys],\n );\n const controlledSelected = resolveDeprecatedProp(\n 'DataGrid',\n selectedItemsProp,\n legacySelected,\n 'selectedKeys',\n 'selectedItems',\n );\n const defaultSelected =\n resolveDeprecatedProp(\n 'DataGrid',\n defaultSelectedItems,\n legacyDefaultSelected,\n 'defaultSelectedKeys',\n 'defaultSelectedItems',\n ) ?? EMPTY_ITEMS;\n\n // The details of the change being made, set around the setter (as `sortDetailsRef`).\n const selectionDetailsRef = React.useRef<DataGridSelectedItemsChangeDetails | undefined>(\n undefined,\n );\n\n const emitSelectionChange = (next: readonly string[]) => {\n onSelectedItemsChange?.([...next], selectionDetailsRef.current);\n onSelectionChange?.(new Set(next));\n };\n\n const [selected, setSelectedValue] = useControllable<readonly string[]>(\n controlledSelected,\n defaultSelected,\n emitSelectionChange,\n );\n\n const setSelected = React.useCallback(\n (event: Event, update: (previous: readonly string[]) => readonly string[]) => {\n selectionDetailsRef.current = { event };\n try {\n setSelectedValue(update);\n } finally {\n selectionDetailsRef.current = undefined;\n }\n },\n [setSelectedValue],\n );\n\n const single = selectionMode === 'single';\n const [store] = React.useState(() => createSelectionStore(selected, single));\n React.useLayoutEffect(() => {\n store.setSelected(selected);\n }, [store, selected]);\n React.useLayoutEffect(() => {\n store.setSingleMode(single);\n }, [store, single]);\n\n const toggleRow = React.useCallback(\n (rowId: string, event: Event) => {\n setSelected(event, (previous) => {\n const effective = store.prune(previous);\n let next: string[];\n if (single) {\n // Single mode shows the first selected row that is rendered (see the store).\n next = effective[0] === rowId ? [] : [rowId];\n } else {\n next = effective.includes(rowId)\n ? effective.filter((item) => item !== rowId)\n : [...effective, rowId];\n }\n return sameItems(next, previous) ? previous : next;\n });\n },\n [single, setSelected, store],\n );\n\n const selectedCount = selected.length;\n React.useEffect(() => {\n if (single && selectedCount > 1) {\n warnOnce(\n 'DataGrid:single-several-selected',\n `DataGrid: a single-selection grid (selectionMode \"single\") has ${selectedCount} selected row ids; only the first one that is rendered is selected. Pass at most one id in \\`selectedItems\\`/\\`defaultSelectedItems\\`, or use selectionMode=\"multiple\".`,\n );\n }\n }, [single, selectedCount]);\n\n // Rows whose selection is disabled keep their state: select-all selects (or clears) the others.\n const toggleAll = React.useCallback(\n (event: Event) => {\n setSelected(event, (previous) => {\n const effective = new Set(store.prune(previous));\n const all = store.getRegistered();\n const enabled = all.filter((rowId) => !store.isDisabled(rowId));\n const allSelected = enabled.length > 0 && enabled.every((rowId) => effective.has(rowId));\n const next = allSelected\n ? all.filter((rowId) => store.isDisabled(rowId) && effective.has(rowId))\n : all.filter((rowId) => !store.isDisabled(rowId) || effective.has(rowId));\n return sameItems(next, previous) ? previous : next;\n });\n },\n [setSelected, store],\n );\n\n const radioName = useId('wave-datagrid-selection');\n const selectAllLabel = labels?.selectAll ?? DEFAULT_SELECT_ALL_LABEL;\n const selectionHeaderLabel = labels?.selectionHeader ?? DEFAULT_SELECTION_HEADER_LABEL;\n\n const context = React.useMemo<DataGridContextValue>(\n () => ({\n selectionMode,\n store,\n toggleRow,\n toggleAll,\n radioName,\n selectAllLabel,\n selectionHeaderLabel,\n selectOnRowClick,\n selectionAppearance,\n subtleSelection,\n }),\n [\n selectionMode,\n store,\n toggleRow,\n toggleAll,\n radioName,\n selectAllLabel,\n selectionHeaderLabel,\n selectOnRowClick,\n selectionAppearance,\n subtleSelection,\n ],\n );\n\n // --- keyboard -------------------------------------------------------------\n const { gridRef, gridProps } = useGridNavigation();\n const mergedRef = useMergedRefs<HTMLTableElement>(ref, gridRef);\n\n // --- items ------------------------------------------------------------------\n const itemRows = React.useMemo<readonly DataGridItemRowData[] | null>(() => {\n if (items === undefined) return null;\n const keys = new Set<string>();\n return items.map((item, index) => {\n const rowId = getRowId ? getRowId(item) : String(index);\n // A repeated id (the selection store warns about it) still gets a key of its own.\n const key = keys.has(rowId) ? `${rowId}\\u0000${index}` : rowId;\n keys.add(key);\n return { item, index, rowId, key };\n });\n }, [items, getRowId]);\n\n // Built-in sorting: by the `compare` of the sorted column (controlled `sort` included).\n const sortColumnId = sort?.columnId;\n const sortDirection = sort?.direction;\n const sortCompare = React.useMemo(() => {\n if (!hasItems || sortColumnId === undefined || !columns) return undefined;\n return columns.find((column) => columnIdOf(column) === sortColumnId)?.compare;\n }, [hasItems, sortColumnId, columns]);\n\n const sortedRows = React.useMemo(() => {\n if (itemRows === null || !sortCompare) return itemRows;\n // The rows hold the items as `unknown`; `compare` takes the grid's `T`.\n const compare = sortCompare as (a: unknown, b: unknown) => number;\n // A stable sort of a copy (never in place, never reversed): items that compare equal keep\n // their order in `items` in both directions, since descending negates `compare`.\n return itemRows\n .slice()\n .sort(\n sortDirection === 'descending'\n ? (a, b) => -compare(a.item, b.item)\n : (a, b) => compare(a.item, b.item),\n );\n }, [itemRows, sortCompare, sortDirection]);\n\n // Built only with `items`: the column ids are read (and the deprecated `id` warned) when used.\n const renderColumnsRow = React.useMemo<DataGridRenderRow | null>(() => {\n if (!columns || !hasItems) return null;\n const cellKeys = columns.map((column, index) => columnIdOf(column) ?? index);\n return (item) => (\n <DataGridRow>\n {columns.map((column, index) => (\n <DataGridCell key={cellKeys[index]}>{column.renderCell?.(item as T)}</DataGridCell>\n ))}\n </DataGridRow>\n );\n }, [columns, hasItems]);\n\n const itemsContext = React.useMemo<DataGridItemsContextValue>(\n () => ({ rows: sortedRows, renderColumnsRow }),\n [sortedRows, renderColumnsRow],\n );\n\n const columnWithoutId =\n columns?.some((column) => column.columnId === undefined && column.id === undefined) ?? false;\n React.useEffect(() => {\n if (columnWithoutId) {\n warnOnce(\n 'DataGrid:column-without-columnId',\n 'DataGrid: a column in `columns` has no `columnId` (nor the deprecated `id`), so its ' +\n 'header cannot sort. Give every column a unique `columnId`.',\n );\n }\n }, [columnWithoutId]);\n\n // --- header and body from columns -------------------------------------------\n let content: React.ReactNode = children;\n const flatChildren = columns ? flattenChildren(children) : [];\n const hasChild = (part: unknown) => flatChildren.some(({ node }) => isElementOfType(node, part));\n const generatedHeader =\n columns && !hasChild(DataGridHeader) ? (\n <DataGridHeader key=\"wave-generated-header\">\n <tr>\n {columns.map((column, index) => {\n const columnId = columnIdOf(column);\n return (\n <DataGridHeaderCell\n key={columnId ?? index}\n columnId={columnId}\n sortable={column.sortable ?? column.compare !== undefined}\n >\n {column.renderHeaderCell ? column.renderHeaderCell() : column.label}\n </DataGridHeaderCell>\n );\n })}\n </tr>\n </DataGridHeader>\n ) : null;\n // Without children, the body renders the rows from `columns` (see DataGrid.Body).\n const generatedBody =\n columns && hasItems && !hasChild(DataGridBody) ? (\n <DataGridBody key=\"wave-generated-body\" />\n ) : null;\n if (generatedHeader || generatedBody) {\n // A `<caption>` stays the table's first child, before the generated header; a generated body\n // goes before a `<tfoot>`, which ends the table.\n const isCaption = ({ node }: { node: React.ReactNode }) => isElementOfType(node, 'caption');\n const others = flatChildren.filter((child) => !isCaption(child));\n const footerIndex = generatedBody\n ? others.findIndex(({ node }) => isElementOfType(node, 'tfoot'))\n : -1;\n const bodyIndex = footerIndex >= 0 ? footerIndex : others.length;\n content = [\n ...flatChildren.filter(isCaption).map(renderFlatChild),\n generatedHeader,\n ...others.slice(0, bodyIndex).map(renderFlatChild),\n generatedBody,\n ...others.slice(bodyIndex).map(renderFlatChild),\n ];\n }\n\n const {\n className: containerClassName,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ...containerRest\n } = containerProps ?? {};\n // The wrapper has no role of its own, and a name is prohibited on a role-less `<div>`: the\n // consumer's name is kept only together with a role.\n const containerHasRole = containerRest.role !== undefined;\n const droppedContainerName =\n !containerHasRole && (containerLabel !== undefined || containerLabelledBy !== undefined);\n\n React.useEffect(() => {\n if (droppedContainerName) {\n warnOnce(\n 'DataGrid:container-name-without-role',\n 'DataGrid: `containerProps[\"aria-label\"]`/`[\"aria-labelledby\"]` is ignored because the ' +\n 'wrapper has no role. Name the grid itself (`aria-label` on DataGrid), or pass a ' +\n '`role` (e.g. \"region\") in `containerProps` too.',\n );\n }\n }, [droppedContainerName]);\n\n return (\n <DataGridContext.Provider value={context}>\n <DataGridSortContext.Provider value={sortContext}>\n <DataGridItemsContext.Provider value={itemsContext}>\n {/* Reset for a grid nested in a cell: its rows are not the outer row. */}\n <DataGridRowContext.Provider value={null}>\n <DataGridRowIdContext.Provider value={null}>\n <div\n {...containerRest}\n aria-label={containerHasRole ? containerLabel : undefined}\n aria-labelledby={containerHasRole ? containerLabelledBy : undefined}\n className={cn(\n dataGridClassNames.container,\n 'overflow-x-auto rounded-md border border-border',\n containerClassName,\n )}\n >\n <table\n ref={mergedRef}\n role=\"grid\"\n aria-multiselectable={selectionMode === 'multiple' || undefined}\n data-selection-appearance={selectionAppearance}\n data-subtle-selection={subtleSelection ? '' : undefined}\n className={cn(\n dataGridClassNames.root,\n 'w-full border-separate border-spacing-0',\n // The group whose hover or focus draws the subtle select-all checkbox.\n subtleSelection && 'group/grid',\n className,\n )}\n {...rest}\n onKeyDown={composeEventHandlers(onKeyDown, gridProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, gridProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, gridProps.onBlur, {\n checkDefaultPrevented: false,\n })}\n >\n {content}\n </table>\n </div>\n </DataGridRowIdContext.Provider>\n </DataGridRowContext.Provider>\n </DataGridItemsContext.Provider>\n </DataGridSortContext.Provider>\n </DataGridContext.Provider>\n );\n}\nDataGridRoot.displayName = 'DataGrid';\n\n// ---------------------------------------------------------------------------\n// Selection header cell (internal)\n// ---------------------------------------------------------------------------\n\n/**\n * The props of a header row's selection cell: the row's `selectionCellProps`, merged with a\n * `DataGrid.SelectionCell`'s own (whose `ref` is passed as `cellRef`).\n */\ntype HeaderSelectionCellProps = Omit<DataGridSelectionCellProps, 'ref'>;\n\ninterface DataGridSelectionHeaderCellProps {\n selectionMode: SelectionMode;\n /** The root class of `DataGrid.SelectionCell`, when the cell is one. */\n stableClassName?: string;\n cellProps?: HeaderSelectionCellProps;\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\nfunction DataGridSelectionHeaderCell({\n selectionMode,\n stableClassName,\n cellProps,\n ref,\n}: DataGridSelectionHeaderCellProps) {\n const { store, toggleAll, selectAllLabel, selectionHeaderLabel, subtleSelection } =\n useDataGridContext('DataGrid.Header');\n const state = React.useSyncExternalStore(\n store.subscribeSelectAll,\n store.getSelectAllState,\n store.getSelectAllState,\n );\n const {\n className,\n disabled,\n invisible,\n controlRef,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...rest\n } = cellProps ?? {};\n\n let checked: boolean | 'mixed' = false;\n if (state === 'all') checked = true;\n else if (state === 'some') checked = 'mixed';\n\n return (\n <th\n scope=\"col\"\n {...rest}\n ref={ref}\n data-selection-cell=\"\"\n className={cn(\n stableClassName,\n dataGridHeaderClassNames.selectionCell,\n SELECTION_CELL_CLASSES,\n 'text-start',\n focusRingInset,\n className,\n )}\n >\n {selectionMode === 'multiple' ? (\n <TableSelectionControl\n ref={controlRef}\n type=\"checkbox\"\n aria-label={ariaLabel ?? (ariaLabelledBy === undefined ? selectAllLabel : undefined)}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n checked={checked}\n disabled={disabled}\n invisible={invisible}\n subtle={subtleSelection}\n reveal=\"grid\"\n onChange={(event) => toggleAll(event.nativeEvent)}\n className={dataGridHeaderClassNames.selectAllCheckbox}\n />\n ) : (\n <span className=\"sr-only\">{selectionHeaderLabel}</span>\n )}\n </th>\n );\n}\n\nconst INERT_HEADER_SLOTS: HeaderSlotRegistry = {\n subscribe: () => () => {},\n register: () => () => {},\n getFirst: () => null,\n refresh: () => {},\n};\n\n/**\n * The selection column's cell of one header row: the select-all header cell in the header's first\n * row (document order), an empty cell in every later row. `initialFirst` is the header's guess from\n * its children, used until the slots are registered (the initial and the server render).\n */\nfunction DataGridSelectionHeaderSlot({\n selectionMode,\n initialFirst,\n stableClassName,\n cellProps,\n ref,\n}: DataGridSelectionHeaderCellProps & { initialFirst: boolean }) {\n const slots = React.useContext(DataGridHeaderSlotsContext) ?? INERT_HEADER_SLOTS;\n const [slot] = React.useState(() => ({}));\n const cellRef = React.useRef<HTMLTableCellElement | null>(null);\n const mergedRef = useMergedRefs<HTMLTableCellElement>(cellRef, ref);\n\n const getIsFirst = React.useCallback(() => {\n const first = slots.getFirst();\n return first === null ? initialFirst : first === slot;\n }, [slots, slot, initialFirst]);\n const getServerIsFirst = React.useCallback(() => initialFirst, [initialFirst]);\n const isFirst = React.useSyncExternalStore(slots.subscribe, getIsFirst, getServerIsFirst);\n\n React.useLayoutEffect(() => slots.register(slot, () => cellRef.current), [slots, slot]);\n\n if (isFirst) {\n return (\n <DataGridSelectionHeaderCell\n ref={mergedRef}\n selectionMode={selectionMode}\n stableClassName={stableClassName}\n cellProps={cellProps}\n />\n );\n }\n // A later header row's cell: none of the control's props apply.\n const {\n className,\n disabled: _disabled,\n invisible: _invisible,\n controlRef: _controlRef,\n 'aria-label': _ariaLabel,\n 'aria-labelledby': _ariaLabelledBy,\n 'aria-describedby': _ariaDescribedBy,\n ...rest\n } = cellProps ?? {};\n return (\n <td\n {...rest}\n ref={mergedRef}\n data-selection-cell=\"\"\n className={cn(\n stableClassName,\n dataGridHeaderClassNames.selectionCell,\n SELECTION_CELL_CLASSES,\n focusRingInset,\n className,\n )}\n />\n );\n}\n\n// ---------------------------------------------------------------------------\n// Sub-components\n// ---------------------------------------------------------------------------\n\n/**\n * Prepends the selection column's header slot (or `null`) to every `<tr>` in `children`, looking\n * inside Fragments, unless the row holds a `DataGrid.SelectionCell` (that cell is the slot), and\n * tells every row whether it is the header's first row: the cells of a `<tr>` and every other\n * element child (a `DataGrid.Row`, or a component that renders one). Every row gets the same child\n * shape in every selection mode, so switching `selectionMode` does not remount the header cells.\n */\nfunction withSelectionHeaderSlots(\n children: React.ReactNode,\n selectionMode: 'none' | SelectionMode,\n): React.ReactNode {\n let first = true;\n const visit = (nodes: React.ReactNode): React.ReactNode =>\n React.Children.map(nodes, (child) => {\n if (isElementOfType<{ children?: React.ReactNode }>(child, React.Fragment)) {\n return React.cloneElement(child, undefined, visit(child.props.children));\n }\n if (!React.isValidElement(child)) return child;\n const isFirst = first;\n first = false;\n if (isElementOfType<{ children?: React.ReactNode }>(child, 'tr')) {\n const cells = child.props.children;\n const slot =\n selectionMode === 'none' ||\n flattenChildren(cells).some(({ node }) => isSelectionCellElement(node)) ? null : (\n <DataGridSelectionHeaderSlot selectionMode={selectionMode} initialFirst={isFirst} />\n );\n return React.cloneElement(\n child,\n undefined,\n slot,\n <DataGridHeaderRowHintContext.Provider value={isFirst}>\n {cells}\n </DataGridHeaderRowHintContext.Provider>,\n );\n }\n return (\n <DataGridHeaderRowHintContext.Provider value={isFirst}>\n {child}\n </DataGridHeaderRowHintContext.Provider>\n );\n });\n return visit(children);\n}\n\n/**\n * The grid's `<thead>`. When the grid is selectable, it prepends the selection column's header\n * cell to each `<tr>` child, also inside a Fragment, unless the row holds a\n * `DataGrid.SelectionCell`: the first header row gets the \"Select all rows\" checkbox (multiple\n * mode) or the \"Selection\" header (single mode; DataGrid's `labels` localizes both), later rows of\n * a grouped header an empty cell. A header row rendered by another component cannot get it (a\n * development warning says so): use `DataGrid.Row` for such a row, which adds the cell itself.\n */\nconst DataGridHeader = ({ children, className, ref, ...rest }: DataGridHeaderProps) => {\n const { selectionMode } = useDataGridContext('DataGrid.Header');\n const [thead, setThead] = React.useState<HTMLTableSectionElement | null>(null);\n const mergedRef = useMergedRefs<HTMLTableSectionElement>(ref, setThead);\n const [slots] = React.useState(createHeaderSlotRegistry);\n const content = withSelectionHeaderSlots(children, selectionMode);\n\n // Every commit, after the rows' slots registered: header rows can move without a slot mounting.\n React.useLayoutEffect(() => {\n slots.refresh();\n });\n\n // Every commit: header rows can come from components the header cannot see into.\n React.useEffect(() => {\n if (!isDev || !thead || selectionMode === 'none') return;\n const selectionCells = Array.from(thead.rows, (row) =>\n Array.from(row.cells).filter((cell) => cell.hasAttribute('data-selection-cell')),\n );\n if (\n selectionCells.some(\n (cells, index) => cells.length === 0 && thead.rows[index].cells.length > 0,\n )\n ) {\n warnOnce(\n 'DataGrid.Header:missing-selection-cell',\n 'DataGrid.Header: a header row has no selection column header cell, so the header has one ' +\n 'column fewer than the selectable rows. Render header rows as `<tr>` children of ' +\n 'DataGrid.Header (a Fragment is fine), or use `DataGrid.Row` for a header row that ' +\n 'another component renders.',\n );\n }\n if (selectionCells.some((cells) => cells.length > 1)) {\n warnOnce(\n 'DataGrid.Header:several-selection-cells',\n 'DataGrid.Header: a header row has more than one selection cell. A DataGrid.SelectionCell ' +\n 'rendered by another component is not seen, so the row also gets the automatic cell: ' +\n 'render DataGrid.SelectionCell as a child of the row (a Fragment is fine).',\n );\n }\n });\n\n return (\n <DataGridSectionContext.Provider value=\"header\">\n <DataGridHeaderSlotsContext.Provider value={slots}>\n <thead\n ref={mergedRef}\n className={cn(dataGridHeaderClassNames.root, 'bg-card', className)}\n {...rest}\n >\n {content}\n </thead>\n </DataGridHeaderSlotsContext.Provider>\n </DataGridSectionContext.Provider>\n );\n};\nDataGridHeader.displayName = 'DataGridHeader';\n\n/**\n * A column header cell. A `sortable` header (with a `columnId`) renders its content inside a\n * `<button type=\"button\">` that toggles the sort, followed by the direction glyph (`sortIcon`)\n * while its column is sorted; the `<th>` carries `aria-sort`. A consumer `onClick` (on the `<th>`)\n * runs before the sort, and calling `preventDefault()` in it cancels the sort (also for\n * Enter/Space on the button, which click it).\n */\nconst DataGridHeaderCell = ({\n columnId,\n sortable = false,\n sortIcon,\n children,\n className,\n onClick,\n ref,\n ...rest\n}: DataGridHeaderCellProps) => {\n const { sort, requestSort } = useDataGridSortContext('DataGrid.HeaderCell');\n /** The column this header sorts, or `undefined` when it is not sortable. */\n const sortColumnId = sortable && columnId ? columnId : undefined;\n const sortedDirection =\n sortColumnId !== undefined && sort?.columnId === sortColumnId ? sort.direction : null;\n\n // The sort runs from the `<th>` once the button's click bubbled up to it, composed after the\n // consumer's `onClick` (C-COMPOSE): the consumer runs first and can cancel with preventDefault().\n // The sort button is the `<th>`'s only child; clicks elsewhere in the cell do not sort.\n const sortOnButtonClick = (event: React.MouseEvent<HTMLTableCellElement>) => {\n const button = event.currentTarget.firstElementChild;\n if (\n sortColumnId !== undefined &&\n button?.localName === 'button' &&\n button.contains(event.target as Node)\n ) {\n requestSort(sortColumnId, event.nativeEvent);\n }\n };\n\n React.useEffect(() => {\n if (sortable && !columnId) {\n warnOnce(\n 'DataGrid.HeaderCell:sortable-without-columnId',\n 'DataGrid.HeaderCell: `sortable` needs a `columnId`; the header is rendered as not sortable.',\n );\n }\n }, [sortable, columnId]);\n\n return (\n <th\n ref={ref}\n scope=\"col\"\n aria-sort={sortColumnId !== undefined ? (sortedDirection ?? 'none') : undefined}\n className={cn(\n dataGridHeaderCellClassNames.root,\n cellBase,\n 'text-start align-middle font-semibold text-caption-1 uppercase tracking-wider',\n focusRingInset,\n sortColumnId !== undefined && 'p-0 hover:bg-subtle-hover',\n className,\n )}\n {...rest}\n onClick={\n sortColumnId !== undefined ? composeEventHandlers(onClick, sortOnButtonClick) : onClick\n }\n >\n {sortColumnId !== undefined ? (\n <TableSortButton\n component=\"DataGrid.HeaderCell\"\n direction={sortedDirection}\n sortIcon={sortIcon}\n className={dataGridHeaderCellClassNames.button}\n iconClassName={dataGridHeaderCellClassNames.sortIcon}\n >\n {children}\n </TableSortButton>\n ) : (\n <span className=\"inline-flex items-center gap-1\">{children}</span>\n )}\n </th>\n );\n};\nDataGridHeaderCell.displayName = 'DataGridHeaderCell';\n\n/**\n * The row of one item of `items`, under its row id. Memoised, so a grid that renders again (a\n * sort, a parent update) renders the row again only when its item, its index or the render\n * function change.\n */\nconst DataGridItemRow = React.memo(function DataGridItemRow({\n item,\n index,\n rowId,\n render,\n}: {\n item: unknown;\n index: number;\n rowId: string;\n render: DataGridRenderRow;\n}) {\n return (\n <DataGridRowIdContext.Provider value={rowId}>\n {render(item, index)}\n </DataGridRowIdContext.Provider>\n );\n});\n\n/**\n * The grid's `<tbody>`. Its child can also be a render function, called with each item of the\n * grid's `items` (and its index there) to render the item's row; without children, a grid with\n * `items` and `columns` renders the rows from the columns.\n */\nconst DataGridBody = <T,>({ children, className, ref, ...rest }: DataGridBodyProps<T>) => {\n const itemsContext = React.useContext(DataGridItemsContext);\n const rows = itemsContext?.rows ?? null;\n const hasRenderFunction = typeof children === 'function';\n\n const renderWithoutItems = hasRenderFunction && rows === null;\n React.useEffect(() => {\n if (renderWithoutItems) {\n warnOnce(\n 'DataGrid.Body:render-without-items',\n \"DataGrid.Body: a render function child renders one row per item of the DataGrid's \" +\n '`items`, which is not set, so the body has no rows.',\n );\n }\n }, [renderWithoutItems]);\n\n const renderRows = (render: DataGridRenderRow | null) =>\n render &&\n rows?.map((row) => (\n <DataGridItemRow\n key={row.key}\n item={row.item}\n index={row.index}\n rowId={row.rowId}\n render={render}\n />\n ));\n\n let content: React.ReactNode;\n if (typeof children === 'function') {\n // The items are the grid's `T`, which the body cannot see: its own `T` types the function.\n content = renderRows(children as DataGridRenderRow);\n } else if (children === undefined) {\n content = renderRows(itemsContext?.renderColumnsRow ?? null);\n } else {\n content = children;\n }\n\n return (\n <DataGridSectionContext.Provider value=\"body\">\n <tbody ref={ref} className={cn(dataGridBodyClassNames.root, className)} {...rest}>\n {content}\n </tbody>\n </DataGridSectionContext.Provider>\n );\n};\nDataGridBody.displayName = 'DataGridBody';\n\n/**\n * A grid row. In a selectable grid it starts with a selection cell (checkbox or radio) named\n * after the row's first cell (or `selectionLabel`), unless a `DataGrid.SelectionCell` child is\n * its selection cell; Space on one of its cells toggles the row, and so does a click on the row\n * with the grid's `selectOnRowClick`.\n *\n * The row is the `group/table-row` group whose hover or focus draws a subtle selection control\n * (`subtleSelection`) and the `Table.CellActions` of its cells. A group is matched by any\n * ancestor, so the rows of a grid nested in a cell\n * share it: hovering the outer row also draws the subtle controls of the nested grid (a limit of\n * CSS groups). A Tree in a cell keeps its own rows' group.\n */\nconst DataGridRow = ({\n rowId: rowIdProp,\n selectionLabel,\n selectionCellProps,\n children,\n className,\n onClick,\n onKeyDown,\n ref,\n ...rest\n}: DataGridRowProps) => {\n const { selectionMode, store, toggleRow, selectOnRowClick, selectionAppearance } =\n useDataGridContext('DataGrid.Row');\n // A row rendered for an item of `items` defaults to the item's row id.\n const itemRowId = React.useContext(DataGridRowIdContext);\n const rowId = rowIdProp ?? itemRowId ?? undefined;\n const section = React.useContext(DataGridSectionContext);\n const firstHeaderRowHint = React.useContext(DataGridHeaderRowHintContext);\n const inHeader = section === 'header';\n const selectable = selectionMode !== 'none' && !inHeader;\n const labelId = useId('wave-datagrid-row-label');\n\n // The children are always flattened (Fragments too) and rendered under their flattened keys,\n // whatever the mode, so the keys stay the same when `selectionMode`, `selectionLabel` or `rowId`\n // change and the cells are not remounted.\n const flatChildren = flattenChildren(children);\n // A DataGrid.SelectionCell child is the row's selection cell; its own props win.\n let ownCellProps: DataGridSelectionCellProps | undefined;\n for (const { node } of flatChildren) {\n if (isSelectionCellElement(node)) {\n ownCellProps = node.props;\n break;\n }\n }\n const hasSelectionCell = ownCellProps !== undefined;\n const selectionDisabled = ownCellProps?.disabled ?? selectionCellProps?.disabled ?? false;\n const selectionInvisible = ownCellProps?.invisible ?? selectionCellProps?.invisible ?? false;\n const ownLabelledBy = ownCellProps?.['aria-labelledby'];\n const ownLabel =\n ownCellProps?.['aria-label'] ?? selectionCellProps?.['aria-label'] ?? selectionLabel;\n\n const single = selectionMode === 'single';\n const getSelected = React.useCallback(\n () => rowId !== undefined && store.isSelected(rowId, single),\n [rowId, store, single],\n );\n // Notified only when the selection changes (in multiple mode, rows registering notify no row).\n const isSelected = React.useSyncExternalStore(store.subscribe, getSelected, getSelected);\n\n React.useLayoutEffect(() => {\n if (rowId === undefined || inHeader) return;\n const unregister = store.register(rowId);\n if (isDev && store.countRegistrations(rowId) > 1) warnDuplicateRowId(rowId);\n return unregister;\n }, [store, rowId, inHeader]);\n\n // A row whose selection is disabled is left out of select-all.\n React.useLayoutEffect(() => {\n if (rowId === undefined || inHeader || !selectionDisabled) return;\n return store.disable(rowId);\n }, [store, rowId, inHeader, selectionDisabled]);\n\n React.useEffect(() => {\n if (selectable && rowId === undefined) {\n warnOnce(\n 'DataGrid.Row:missing-rowId',\n 'DataGrid.Row: a selectable grid needs a `rowId` on every row; this row has no selection control.',\n );\n }\n }, [selectable, rowId]);\n\n const unlabelled =\n selectable && rowId !== undefined && ownLabel === undefined && ownLabelledBy === undefined;\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (!selectable || rowId === undefined || event.key !== ' ') return;\n const target = event.target as Element;\n // Only keys pressed on the row itself or on one of its own cells, never on a nested widget.\n if (target !== event.currentTarget && target.parentElement !== event.currentTarget) return;\n // A row whose selection is disabled takes the key too (no page scroll), and stays as it is.\n event.preventDefault();\n if (!selectionDisabled) toggleRow(rowId, event.nativeEvent);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLTableRowElement>) => {\n if (!selectOnRowClick || !selectable || rowId === undefined || selectionDisabled) return;\n const row = event.currentTarget;\n // The row's own cells carry the grid's tabindex; they are not widgets nested in the row.\n const nested = isForeignEvent(event, { isOwnPart: (element) => element.parentElement === row });\n if (nested || endsTextSelection(event)) return;\n toggleRow(rowId, event.nativeEvent);\n };\n\n // Name the selection control after the first cell (its own id, or a generated one).\n let labelledBy: string | undefined;\n let idCellIndex = -1;\n if (unlabelled) {\n const firstCellIndex = flatChildren.findIndex(({ node }) =>\n isElementOfType(node, DataGridCell, 'td', 'th'),\n );\n if (firstCellIndex >= 0) {\n const firstCell = flatChildren[firstCellIndex].node as React.ReactElement<{ id?: string }>;\n labelledBy = firstCell.props.id ?? labelId;\n if (firstCell.props.id === undefined) idCellIndex = firstCellIndex;\n }\n }\n const content = flatChildren.map(({ key, node }, index) =>\n renderFlatChild({\n key,\n node:\n index === idCellIndex\n ? React.cloneElement(node as React.ReactElement<{ id?: string }>, { id: labelId })\n : node,\n }),\n );\n\n const needsLabel = unlabelled && labelledBy === undefined;\n React.useEffect(() => {\n if (needsLabel) {\n warnOnce(\n 'DataGrid.Row:selection-label',\n 'DataGrid.Row: no child is a `DataGrid.Cell`, `<td>` or `<th>` element, so the row selection control is named \"Select row\". Pass `selectionLabel` (a cell rendered by another component is not seen).',\n );\n }\n }, [needsLabel]);\n\n // The selection control's name: the cell's own, else the row's first cell, else \"Select row\".\n const controlLabelledBy = ownLabelledBy ?? labelledBy;\n const controlLabel = ownLabel ?? (controlLabelledBy === undefined ? 'Select row' : undefined);\n\n const rowContext = React.useMemo<DataGridRowContextValue>(\n () => ({\n selectionCellProps,\n hasSelectionCell,\n rowId: selectable ? rowId : undefined,\n isSelected,\n disabled: selectionDisabled,\n invisible: selectionInvisible,\n ariaLabel: controlLabel,\n ariaLabelledBy: controlLabelledBy,\n }),\n [\n selectionCellProps,\n hasSelectionCell,\n selectable,\n rowId,\n isSelected,\n selectionDisabled,\n selectionInvisible,\n controlLabel,\n controlLabelledBy,\n ],\n );\n\n // The automatic selection cell, first; a DataGrid.SelectionCell child renders it where it stands.\n let selectionCellElement: React.ReactNode = null;\n if (!hasSelectionCell && inHeader && selectionMode !== 'none') {\n selectionCellElement = (\n <DataGridSelectionHeaderSlot\n selectionMode={selectionMode}\n initialFirst={firstHeaderRowHint}\n cellProps={selectionCellProps}\n />\n );\n } else if (!hasSelectionCell && selectable) {\n selectionCellElement = <DataGridBodySelectionCell component=\"DataGrid.Row\" />;\n }\n\n return (\n <DataGridRowContext.Provider value={rowContext}>\n <tr\n ref={ref}\n className={cn(\n dataGridRowClassNames.root,\n // The group whose hover or focus draws a subtle selection control (its own name: a\n // Tree in a cell keys its actions on its rows' `group/row`).\n 'group/table-row',\n !inHeader && BODY_ROW_CLASSES[selectionAppearance],\n selectable && isSelected && forcedColors.selectedContainer,\n className,\n )}\n aria-selected={selectable ? isSelected : undefined}\n data-selected={selectable && isSelected ? '' : undefined}\n {...rest}\n onClick={composeEventHandlers(onClick, handleClick)}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n >\n {selectionCellElement}\n {content}\n </tr>\n </DataGridRowContext.Provider>\n );\n};\nDataGridRow.displayName = 'DataGridRow';\n\n/** Props of {@link DataGridBodySelectionCell}: the cell's own, without what the row resolved. */\ninterface DataGridBodySelectionCellProps extends Omit<\n DataGridSelectionCellProps,\n 'disabled' | 'invisible' | 'aria-label' | 'aria-labelledby'\n> {\n /** The public name of the part that renders the cell, for the context errors. */\n component: string;\n /** The root class of `DataGrid.SelectionCell`, when the cell is one. */\n stableClassName?: string;\n}\n\n/**\n * The selection cell of a body row (internal): the row's checkbox (multiple mode) or radio (single\n * mode), the automatic first cell or a `DataGrid.SelectionCell`. Its state, `disabled`,\n * `invisible` and name come from the row.\n */\nfunction DataGridBodySelectionCell({\n component,\n stableClassName,\n className,\n controlRef,\n 'aria-describedby': ariaDescribedBy,\n ref,\n ...rest\n}: DataGridBodySelectionCellProps) {\n const { selectionMode, toggleRow, radioName, subtleSelection } = useDataGridContext(component);\n const row = useDataGridRowContext(component);\n const { rowId } = row;\n const single = selectionMode === 'single';\n return (\n <td\n role=\"gridcell\"\n {...rest}\n ref={ref}\n data-selection-cell=\"\"\n className={cn(\n stableClassName,\n dataGridRowClassNames.selectionCell,\n SELECTION_CELL_CLASSES,\n focusRingInset,\n row.selectionCellProps?.className,\n className,\n )}\n >\n {rowId !== undefined && selectionMode !== 'none' && (\n <TableSelectionControl\n ref={controlRef}\n type={single ? 'radio' : 'checkbox'}\n name={single ? radioName : undefined}\n // The shared name groups the radios. `form=\"\"` matches no form, so they have no form\n // owner (still one group: same name, both ownerless) and never add a generated field\n // to an enclosing form's submission.\n form={single ? '' : undefined}\n checked={row.isSelected}\n disabled={row.disabled}\n invisible={row.invisible}\n subtle={subtleSelection}\n onChange={(event) => toggleRow(rowId, event.nativeEvent)}\n aria-label={row.ariaLabel}\n aria-labelledby={row.ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n className={dataGridRowClassNames.selectionControl}\n />\n )}\n </td>\n );\n}\n\n/**\n * The selection cell of a row, rendered where it stands among the row's cells (the row and the\n * header then add none of their own). In a header row it is the select-all checkbox (multiple\n * mode; the \"Selection\" header text in single mode), the first header row's only, as the\n * automatic cell; in a body row (a `DataGrid.Row`) the row's checkbox or radio. It takes the\n * selection cell props of its row (`selectionCellProps`), its own winning. `aria-label`,\n * `aria-labelledby` and `aria-describedby` go to the control; the other props, `className` and\n * `ref` to the cell. In a grid without selection it renders nothing (with a development warning).\n */\nconst DataGridSelectionCell = ({\n disabled,\n invisible,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n controlRef,\n ref,\n ...rest\n}: DataGridSelectionCellProps) => {\n const { selectionMode } = useDataGridContext('DataGrid.SelectionCell');\n const section = React.useContext(DataGridSectionContext);\n const firstHeaderRowHint = React.useContext(DataGridHeaderRowHintContext);\n const row = React.useContext(DataGridRowContext);\n const notSelectable = selectionMode === 'none';\n // A DataGrid.Row that did not see this cell among its children added its own cell too.\n const unseen = !notSelectable && row !== null && !row.hasSelectionCell;\n\n React.useEffect(() => {\n if (notSelectable) {\n warnOnce(\n 'DataGrid.SelectionCell:not-selectable',\n 'DataGrid.SelectionCell: the grid has no row selection (`selectionMode` is \"none\"), so the ' +\n 'cell renders nothing. Set `selectionMode` on the DataGrid, or remove the cell.',\n );\n }\n }, [notSelectable]);\n\n React.useEffect(() => {\n if (unseen) {\n warnOnce(\n 'DataGrid.SelectionCell:unseen',\n 'DataGrid.SelectionCell: rendered by another component, so its DataGrid.Row did not see ' +\n 'it and added its own selection cell. Render DataGrid.SelectionCell as a child of ' +\n 'DataGrid.Row (a Fragment is fine).',\n );\n }\n }, [unseen]);\n\n if (notSelectable) return null;\n if (section === 'header') {\n const rowProps = row?.selectionCellProps;\n return (\n <DataGridSelectionHeaderSlot\n ref={ref}\n selectionMode={selectionMode}\n initialFirst={firstHeaderRowHint}\n stableClassName={dataGridSelectionCellClassNames.root}\n cellProps={{\n ...rest,\n className: cn(rowProps?.className, className),\n disabled: disabled ?? rowProps?.disabled,\n invisible: invisible ?? rowProps?.invisible,\n 'aria-label': ariaLabel ?? rowProps?.['aria-label'],\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n controlRef,\n }}\n />\n );\n }\n return (\n <DataGridBodySelectionCell\n {...rest}\n ref={ref}\n component=\"DataGrid.SelectionCell\"\n stableClassName={dataGridSelectionCellClassNames.root}\n className={className}\n controlRef={controlRef}\n aria-describedby={ariaDescribedBy}\n />\n );\n};\nDataGridSelectionCell.displayName = 'DataGridSelectionCell';\nmarkTablePart(DataGridSelectionCell, 'dataGridSelectionCell');\n\n/**\n * A grid cell (`<td>`), focusable through the grid's keyboard navigation. It is the positioning\n * box of a `Table.CellActions` inside it.\n */\nconst DataGridCell = ({ children, className, ref, ...rest }: DataGridCellProps) => (\n <td\n ref={ref}\n role=\"gridcell\"\n className={cn(\n dataGridCellClassNames.root,\n cellBase,\n 'relative text-body-1',\n focusRingInset,\n className,\n )}\n {...rest}\n >\n {children}\n </td>\n);\nDataGridCell.displayName = 'DataGridCell';\n\nexport {\n DataGridHeader,\n DataGridHeaderCell,\n DataGridBody,\n DataGridRow,\n DataGridCell,\n DataGridSelectionCell,\n};\n\n/**\n * An interactive data table (`role=\"grid\"`) following the APG Grid pattern: one tab stop,\n * arrow-key navigation between cells (Home/End, Ctrl+Home/Ctrl+End, PageUp/PageDown; Up/Down keep\n * the visual column, so a grouped header with spanning cells works), Enter/F2 to interact with a\n * cell's widgets and Escape to return to the cell. A composite widget in a cell (a Toolbar,\n * RadioGroup, TabList, …) is entered with Enter/F2 like a text field; it manages its own tab\n * indexes, so it keeps its own Tab stop. Supports sortable columns (`onSortChange` reports the new\n * sort; a grid with `items` orders its rows by the sorted column's `compare`, otherwise the consumer\n * orders them) and single or multiple row selection with a select-all header checkbox.\n *\n * Selection is made with the row's control, Space on a cell, and, with `selectOnRowClick`, a\n * click on the row. `selectionAppearance` picks the fill of a selected row, `subtleSelection`\n * hides the unchecked controls until their row (or, for select-all, the grid) is hovered or holds\n * focus, and a row's `selectionCellProps` disables, hides or names its control. The selection\n * column comes first; a `DataGrid.SelectionCell` places it elsewhere in a row.\n *\n * The grid is composed from its parts, or rendered from data: with `items` and typed `columns`\n * (`DataGridColumn<T>`, see `createTableColumn`) it renders the header, the rows and the cells\n * itself, and `DataGrid.Body` also takes a render function that returns each item's row. Rows\n * rendered from `items` take their `rowId` from `getRowId` (by default the item's index).\n *\n * Sub-components are available as `DataGrid.Header`, `DataGrid.HeaderCell`, `DataGrid.Body`,\n * `DataGrid.Row`, `DataGrid.Cell` and `DataGrid.SelectionCell` in client components, and as the\n * flat exports `DataGridHeader`, `DataGridHeaderCell`, `DataGridBody`, `DataGridRow`,\n * `DataGridCell` and `DataGridSelectionCell` (the form React Server Components can import).\n */\nexport const DataGrid = /* @__PURE__ */ Object.assign(DataGridRoot, {\n Header: DataGridHeader,\n HeaderCell: DataGridHeaderCell,\n Body: DataGridBody,\n Row: DataGridRow,\n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ClE,QAAQ4F;CACR,YAAYC;CACZ,MAAME;CACN,KAAKf;CACL,MAAMC;CACN,eAAewH;AACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"DataGrid.mjs","names":["useId","useId$1","React","EMPTY_ITEMS","NO_COLUMN_IDS","toItems","keys","sameItems","a","b","item","index","toggleAllInUniverse","selectable","previous","current","next","summarizeSelection","clearIds","selectAllIds","inUniverse","universe","id","renderFlatChild","node","key","countHeaderRows","flattenChildren","children","columnIdOf","resolveDeprecatedProp","column","warnDuplicateRowId","rowId","BODY_ROW_CLASSES","DataGridRoot","sortProp","sortColumnProp","sortDirectionProp","selectedItemsProp","rest","props","hasItems","items","usesSortApi","defaultSort","legacySort","objectMode","setObjectMode","objectCallbacks","legacySortControlled","warnDeprecated","defaultSortColumn","defaultSortDirection","deprecatedSortProps","mixedSortApi","ignoredSortProps","warnOnce","legacyHalves","setLegacyHalves","legacyControlledSort","legacyDefaultSort","controlledSort","initialSort","sortDetailsRef","sort","setSort","useControllable","onSortChange","requestSort","columnId","sortContext","onSelectionChange","legacySelected","selectedKeys","legacyDefaultSelected","defaultSelectedKeys","controlledSelected","defaultSelected","defaultSelectedItems","selectionDetailsRef","selected","setSelectedValue","onSelectedItemsChange","setSelected","update","itemRows","getRowId","selectionMode","itemSelectionDisabled","isSelectionDisabled","row","selectionUniverse","disabledIds","single","store","createSelectionStore","toggleRow","event","toggleId","effective","selectedCount","toggleAll","all","enabled","radioName","selectAllLabel","labels","selectionHeaderLabel","context","selectOnRowClick","selectionAppearance","subtleSelection","sortColumnId","sortDirection","sortCompare","columns","sortedRows","compare","renderColumnsRow","cellKeys","DataGridRow","DataGridCell","itemsContext","columnWithoutId","flatChildren","childOf","isElementOfType","part","headerChild","DataGridHeader","bodyChild","DataGridBody","bodyChildren","activeWindow","virtualWindow","windowed","headerRowCount","rowCount","useGridNavigation","getWindowNavigationModel","windowState","useDataGridWindow","mergedRef","useMergedRefs","ref","gridRef","handleFocus","gridProps","handleBlur","sizingRequested","resizableColumns","columnSizingOptions","columnWidths","defaultColumnWidths","sizingIgnored","sizingEnabled","columnIds","sizing","useDataGridColumnSizing","content","generatedHeader","DataGridHeaderCell","generatedBody","isCaption","others","child","footerIndex","bodyIndex","containerClassName","containerLabel","containerLabelledBy","containerRefProp","containerRest","containerProps","containerRef","containerHasRole","droppedContainerName","DataGridContext","DataGridSortContext","DataGridItemsContext","DataGridRowContext","DataGridRowIdContext","DataGridItemSelectionDisabledContext","DataGridResizeContext","DataGridFixedLayoutContext","cn","dataGridClassNames","className","style","composeEventHandlers","onKeyDown","onFocus","onBlur","onPointerDownCapture","DataGridWindowContext","DataGridWindowRowContext","DataGridItemRow","windowRow","position","ariaRowIndex","height","selectionDisabled","render","windowContext","rows","renderWithoutItems","renderRows","renderWindowRows","DataGridSectionContext","dataGridBodyClassNames","rowIdProp","useDataGridContext","itemRowId","section","firstHeaderRowHint","DataGridHeaderRowHintContext","inHeader","labelId","ownCellProps","isSelectionCellElement","hasSelectionCell","cellDisabled","selectionCellProps","selectionInvisible","ownLabelledBy","ownLabel","selectionLabel","getSelected","isSelected","unregister","isDev","disabledMismatch","state","disabled","ownRowIdDiffers","unlabelled","handleKeyDown","target","handleClick","isForeignEvent","element","endsTextSelection","labelledBy","idCellIndex","firstCellIndex","firstCell","needsLabel","controlLabelledBy","controlLabel","rowContext","selectionCellElement","DataGridSelectionHeaderSlot","DataGridBodySelectionCell","dataGridRowClassNames","forcedColors","onClick","ariaDescribedBy","component","useDataGridRowContext","windowedRow","stableClassName","SELECTION_CELL_CLASSES","focusRingInset","TableSelectionControl","controlRef","DataGridSelectionCell","ariaLabel","ariaLabelledBy","notSelectable","unseen","rowProps","dataGridSelectionCellClassNames","invisible","markTablePart","fixedLayout","dataGridCellClassNames","cellBase","DataGrid"],"sources":["../../../src/components/table/DataGrid.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/cn';\nimport {\n dataGridBodyClassNames,\n dataGridCellClassNames,\n dataGridClassNames,\n dataGridRowClassNames,\n dataGridSelectionCellClassNames,\n} from '../../lib/classNames';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, resolveDeprecatedProp, warnDeprecated, warnOnce } from '../../lib/dev';\nimport type { ColumnSizingOption } from '../../lib/columnSizing';\nimport { endsTextSelection, isForeignEvent } from '../../lib/events';\nimport { clearIds, selectAllIds, summarizeSelection, toggleId } from '../../lib/selection';\nimport type { Slot } from '../../lib/slot';\nimport { focusRingInset, forcedColors } from '../../lib/styles';\nimport type { SelectionMode } from '../../lib/types';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport type { VirtualWindow } from '../../hooks/useVirtualWindow';\nimport { SELECTION_CELL_CLASSES, TableSelectionControl, markTablePart } from './Table.shared';\nimport type { SortDirection } from './Table.shared';\nimport {\n DataGridFixedLayoutContext,\n DataGridResizeContext,\n useDataGridColumnSizing,\n} from './DataGrid.sizing';\nimport {\n DataGridWindowContext,\n DataGridWindowRowContext,\n getWindowNavigationModel,\n renderWindowRows,\n useDataGridWindow,\n type DataGridWindowRow,\n} from './DataGrid.window';\nimport { useGridNavigation } from './useGridNavigation';\nimport type { TableColumnWidthsChangeDetails } from './useTableColumnSizing';\nimport {\n DEFAULT_SELECTION_HEADER_LABEL,\n DEFAULT_SELECT_ALL_LABEL,\n DataGridContext,\n DataGridHeaderRowHintContext,\n DataGridItemSelectionDisabledContext,\n DataGridItemsContext,\n DataGridRowContext,\n DataGridRowIdContext,\n DataGridSectionContext,\n DataGridSortContext,\n useDataGridContext,\n useDataGridRowContext,\n type DataGridContextValue,\n type DataGridItemRowData,\n type DataGridItemsContextValue,\n type DataGridRenderRow,\n type DataGridRowContextValue,\n type DataGridSortContextValue,\n} from './DataGrid.context';\nimport {\n DataGridHeader,\n DataGridHeaderCell,\n DataGridSelectionHeaderSlot,\n cellBase,\n isSelectionCellElement,\n} from './DataGrid.header';\nimport {\n createSelectionStore,\n type SelectionStore,\n type SelectionUniverse,\n} from './DataGrid.store';\n\nexport { createSelectionStore };\nexport type { SelectionStore, SelectionUniverse };\nexport type { SortDirection };\n\n/** The sort state of a DataGrid: the sorted column and its direction. */\nexport interface DataGridSort {\n /** The `columnId` of the sorted column. */\n columnId: string;\n /** The sort direction. */\n direction: SortDirection;\n}\n\n/** Second argument of `onSortChange` (the `DataGridSort` form): the event behind the sort. */\nexport interface DataGridSortChangeDetails {\n /** The DOM event behind the sort: the click of the sort button (Enter and Space click it). */\n event: Event;\n}\n\n/** Second argument of `onSelectedItemsChange`: the event behind the change. */\nexport interface DataGridSelectedItemsChangeDetails {\n /**\n * The DOM event behind the change: the click of a selection control (the select-all checkbox\n * included), or the key press of Space on a row.\n */\n event: Event;\n}\n\n/**\n * Defines a column of the DataGrid, typed by the grid's items (`T`): the header cell it renders\n * and, with `items`, the cell of each row. `createTableColumn` builds one with `sortable` resolved.\n * A column with functions (`compare`, `renderCell`, `renderHeaderCell`) cannot be passed from a\n * Server Component to the DataGrid, since functions are not serializable: define such columns in a\n * client component.\n */\nexport interface DataGridColumn<T = unknown> {\n /**\n * Unique identifier of the column: the `columnId` of its header cell (and of the grid's sort) and\n * the React key of its cells. Required in practice: a column without it (and without the\n * deprecated `id`) cannot sort, with a development warning.\n */\n columnId?: string;\n /**\n * @deprecated Use `columnId`. Read only when `columnId` is not given, with a development\n * warning.\n */\n id?: string;\n /** The header content (text or any React node), unless `renderHeaderCell` is given. */\n label: React.ReactNode;\n /**\n * Orders two items of the column, as for `Array.prototype.sort` (negative: `a` first). A column\n * with `compare` is sortable unless `sortable` is `false`. While the grid's sort names the column\n * (its own sort, or a controlled `sort`), a grid with `items` renders its rows in this order: a\n * stable sort of a copy of `items`, so items that compare equal keep their order in `items`,\n * in both directions (descending negates `compare`). Without `compare` the grid never reorders\n * the rows: leave it out when the rows arrive sorted (a server-sorted grid).\n */\n compare?: (a: T, b: T) => number;\n /**\n * Renders the content of the column's cell for one item (rows rendered from `items`). Without\n * it, the column's cells are empty.\n */\n renderCell?: (item: T) => React.ReactNode;\n /** Renders the header content, in place of `label`. */\n renderHeaderCell?: () => React.ReactNode;\n /**\n * Whether the column's header is a sort button (the header cell carries `aria-sort`).\n * @default compare !== undefined\n */\n sortable?: boolean;\n}\n\n/** The built-in text of a DataGrid, for localization (see `DataGridBaseProps.labels`). */\nexport interface DataGridLabels {\n /** Accessible name of the select-all checkbox in the header (`selectionMode=\"multiple\"`).\n * @default 'Select all rows'\n */\n selectAll?: string;\n /**\n * Visually hidden text of the selection column's header cell (`selectionMode=\"single\"`), which\n * names that column.\n * @default 'Selection'\n */\n selectionHeader?: string;\n /**\n * Accessible name of each column's resize handle (`resizableColumns`).\n * @default 'Resize column'\n */\n resizeColumn?: string;\n /**\n * Builds the value text of a resize handle (`aria-valuetext`) from the column's width in pixels.\n * @default (width) => `${width} pixels`\n */\n columnWidth?: (width: number) => string;\n}\n\n/**\n * How a selected row of a DataGrid is filled (`selectionAppearance`): `'brand'` with the selected\n * token, `'neutral'` with the subtle selected token, `'none'` not at all.\n */\nexport type DataGridSelectionAppearance = 'brand' | 'neutral' | 'none';\n\n/**\n * The props of a row's selection cell (`DataGrid.Row` `selectionCellProps`), the automatic cell or\n * a `DataGrid.SelectionCell` child (whose own props win).\n */\nexport interface DataGridRowSelectionCellProps {\n /**\n * Disables the row's selection control natively. The control is then no focus target of the grid\n * (the cell takes focus), and neither a row click (`selectOnRowClick`), Space on a cell nor\n * select-all changes the row's selection: select-all skips it, keeps it as it is, and tells its\n * state from the other rows. In a header row it disables the select-all checkbox.\n * @default false (in a row rendered from `items`: the grid's `isSelectionDisabled` for its item)\n */\n disabled?: boolean;\n /**\n * Hides the selection control (it keeps its space and cannot be focused). The row is still\n * selected by a row click and Space, and tells its state with `aria-selected`.\n * @default false\n */\n invisible?: boolean;\n /** Class of the selection cell (`<td>`, or the `<th>` of a header row). */\n className?: string;\n /**\n * Accessible name of the selection control, in place of `selectionLabel` and the name taken from\n * the row's first cell; in a header row, the name of the select-all checkbox.\n */\n 'aria-label'?: string;\n}\n\n/** Properties for the DataGridSelectionCell sub-component. */\nexport interface DataGridSelectionCellProps\n extends\n Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'children'>,\n DataGridRowSelectionCellProps {\n /**\n * The cell holds no content of its own: the grid renders the selection control (or, in a\n * single-mode header row, the hidden \"Selection\" header text).\n */\n children?: never;\n /**\n * Accessible name of the control, in place of `aria-label` and the row's `selectionLabel`.\n * Routed to the control, as `aria-label` and `aria-describedby` are.\n */\n 'aria-labelledby'?: string;\n /** Ref to the selection control (`<input type=\"checkbox\">` or `<input type=\"radio\">`). */\n controlRef?: React.Ref<HTMLInputElement>;\n /** Ref to the cell element (`<td>`, or the `<th>` of a header row's select-all). */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/**\n * The `items` prop of a DataGrid that renders its rows from data, part of every sort form of\n * `DataGridProps` but the 0.4 one. `T` is the type of the items.\n */\nexport interface DataGridItemsProps<T = unknown> {\n /**\n * The grid's data, one body row per item, in this order unless the sorted column has `compare`\n * (see `DataGridColumn.compare`). With `columns` and no `DataGrid.Body` child (or one without\n * children), the grid renders the rows and cells from the columns; a `DataGrid.Body` whose child\n * is a render function renders the row of each item. Each row's `rowId` comes from `getRowId`.\n * The grid reads the array and never changes it. With `items`, `onSortChange` receives a\n * `DataGridSort` object and `details`, never the 0.4 arguments. `items` may not be `undefined`\n * unless `sort` or `defaultSort` is given; pass `items={data ?? []}` while loading.\n */\n items?: readonly T[];\n}\n\n/** Props of every DataGrid, whatever sort API it uses. `T` is the type of its `items`. */\nexport interface DataGridBaseProps<T = unknown> extends React.HTMLAttributes<HTMLTableElement> {\n /**\n * The row id of an item: the `rowId` of its row (for selection), for rows rendered from `items`.\n * Select-all and its checkbox use these ids, whether the rows are rendered or not. A row's own\n * `rowId` wins for that row, but a row whose own id differs from its item's id is outside\n * select-all and its state, and select-all selects the item's id, which no row has (a\n * development warning says so): return the rows' ids here rather than setting `rowId`. Ids must\n * be unique (a duplicate warns in development). Define it outside the component, or memoise it:\n * a new function rebuilds the row of every item and the set of ids select-all works on (with a\n * `virtualWindow`, the component that holds the window renders at every row the view enters).\n * @default the item's index in `items`, as a string\n */\n getRowId?: (item: T) => string;\n /**\n * Whether the selection of an item of `items` is disabled (`index` is its index in `items`), so\n * select-all can skip items whose rows are not rendered. Select-all leaves such an item as it is,\n * selected or not, and its state counts only the other items. The item's row takes it as the\n * `disabled` of its selection cell (a disabled control; neither a row click nor Space changes\n * it), unless the cell sets `disabled` itself: the cell's value then applies to the control, a\n * value that disagrees warns in development, and select-all skips a row that either disables.\n * Without it, every item is selectable unless its rendered row disables its selection cell.\n * Ignored without `items`. Called for every item whenever `items`, `getRowId` or this function\n * change: define it outside the component, or memoise it.\n */\n isSelectionDisabled?: (item: T, index: number) => boolean;\n /**\n * Column definitions. When given and no `DataGrid.Header` child is present, the header row\n * (including the selection column) is rendered from them: `columnId` becomes the header cell's\n * `columnId`, `renderHeaderCell()` (else `label`) its content, and `sortable` (by default, having\n * `compare`) makes it a sort button. With `items` and no `DataGrid.Body` child, the body rows are\n * rendered from them too: one `DataGrid.Cell` per column, filled by `renderCell`. Those rows\n * render again whenever the array changes, so keep it stable (defined outside the component, or\n * memoised).\n */\n columns?: readonly DataGridColumn<T>[];\n /**\n * Gives the header cell of each column (of `columns`, by `columnId`; the last one included, the\n * selection column not) a resize handle: a focusable `role=\"separator\"` with the column's width\n * as `aria-valuenow`. A drag (mouse, touch or pen) moves the column's end edge, mirrored in\n * right-to-left grids. From the keyboard, F2 on a header cell (or on its sort button) moves focus\n * to its handle, which adds no Tab stop to the grid; there the arrow keys move the edge by 20\n * pixels (5 with Shift, mirrored in right-to-left grids), Home sets the minimum width, and Enter,\n * Space or Escape return focus to the header (its sort button, which Enter still activates\n * directly). A double click sets the column back to its initial width once a width is state.\n * The grid carries `data-resizing` while a handle drags. Needs `columns` and `items`, as every\n * column width prop does: without them they are all ignored, with a development warning.\n * Fluent's `resizableColumns`.\n * @default false\n */\n resizableColumns?: boolean;\n /**\n * The sizing of each column, by `columnId`: `minWidth` (`@default 80`), and the width it starts\n * at, `defaultWidth`, else `idealWidth`, else 150 (never below `minWidth`). With it, or with\n * `columnWidths` or `defaultColumnWidths`, the grid lays its columns out from these widths\n * (a `<colgroup>` and a fixed table layout) with or without `resizableColumns`, and its cells\n * truncate their text with an ellipsis unless a cell's class says otherwise. Until a width is\n * state the grid is 100% wide and at least as wide as its columns, so a wider container spreads\n * them (the selection column too); the first change takes the widths the columns are drawn at,\n * so nothing jumps, and from then on the grid is exactly as wide as its columns (slack shows\n * after the last one). There is no maximum width and no fitting to the container. Ids that are\n * not columns are ignored; it may be written inline. Fluent's `columnSizingOptions`.\n */\n columnSizingOptions?: Record<string, ColumnSizingOption>;\n /**\n * The column widths in pixels (controlled), by `columnId`; a column without an entry has its\n * initial width (see `columnSizingOptions`), and a width below the column's minimum is held at\n * it. The grid is exactly as wide as its columns. Pair it with `onColumnWidthsChange`; a parent\n * that ignores a change leaves the column where it is.\n */\n columnWidths?: Record<string, number>;\n /** The column widths in pixels at first render (uncontrolled; see `columnWidths`). */\n defaultColumnWidths?: Record<string, number>;\n /**\n * Called with the width of every column (by `columnId`) whenever a width changes, at every step\n * of a drag (at most once per animation frame) or key press, then `details`: `{ columnId,\n * width, event }`, the resized column, its new width and the event behind it. The grid always\n * passes `details`; it is typed optional through 0.x, as every `details` argument. Setting the\n * width a column already has does not call it once a width is state. Fluent's `onColumnResize`,\n * whose data is in `details`.\n */\n onColumnWidthsChange?: (\n widths: Record<string, number>,\n details?: TableColumnWidthsChangeDetails,\n ) => void;\n /**\n * Renders only the body rows in view, plus an overscan, of a grid with many `items`: pass the\n * result of `useVirtualWindow({ itemSize })` (or an object of your own that implements\n * `VirtualWindow`). The rows that are not rendered are replaced by spacer rows (`aria-hidden`,\n * `data-virtual-spacer`) of their height. Fluent has no counterpart in its DataGrid.\n *\n * The grid's scroll wrapper (the element of `containerProps`) becomes the window's scroller, so\n * give it a bounded height, a height or a maximum height in `containerProps`: without one the\n * window measures the whole list and renders every row (a development warning says so). Every\n * row has the window's `itemSize` as its height: the grid sets it on each body row, drops the\n * vertical padding of its cells and keeps their text on one line, so a cell's content must fit\n * in it. The columns are laid out from widths (as with `columnSizingOptions`), so they never\n * change width as rows come and go. The header stays at the top of the scroller: pass its height\n * as `scrollPaddingStart` to `useVirtualWindow`, so keyboard moves bring rows into the area below\n * it. The scroller is no tab stop of its own (`tabIndex` -1, as Firefox would stop on it; a\n * `tabIndex` in `containerProps` wins), and the browser's scroll anchoring is off on it (the\n * window lays the rows out).\n *\n * The keyboard moves by the data: ArrowUp/ArrowDown, PageUp/PageDown and Ctrl+Home/Ctrl+End\n * scroll a target row that is not rendered into the window, then focus it, and the focused row\n * stays rendered when it is scrolled away. When a data change (a sort, new `items`) makes the\n * browser drop focus from the moved row, focus returns to the same row, or to the row nearest\n * its place. Sorting, selection, select-all and column sizing work on every item, rendered or\n * not. The grid carries `aria-rowcount` (the items plus the header rows), every row\n * `aria-rowindex` (1-based, the header rows first, the body rows in the sorted order) and every\n * body row `data-row-index` (its 0-based position in the sorted order); a grid without a window\n * renders none of them.\n *\n * Needs `items` and `columns`, with the body rows rendered from them (no `DataGrid.Body` child,\n * or one whose child is a render function); otherwise it is ignored, with a development warning.\n * The component that calls `useVirtualWindow` renders again at every row the view enters: keep\n * `items`, `columns`, `getRowId` and `isSelectionDisabled` stable (defined outside it, or\n * memoised), or each of those renders rebuilds the rows of every item.\n */\n virtualWindow?: VirtualWindow;\n /**\n * Row selection mode. `'multiple'` adds a checkbox column with a \"Select all rows\" header\n * checkbox; `'single'` adds a radio column (its header reads \"Selection\" to assistive\n * technology). `labels` localizes both texts.\n * @default 'none'\n */\n selectionMode?: 'none' | SelectionMode;\n /**\n * The grid's built-in text, for localization: the name of the select-all checkbox\n * (`selectAll`), the header text of the selection column (`selectionHeader`), and, with\n * `resizableColumns`, the name of the resize handles (`resizeColumn`) and their value text\n * (`columnWidth`). Unset members keep their English defaults. Rows are named with their own\n * `selectionLabel`.\n */\n labels?: DataGridLabels;\n /**\n * Whether a click on a body row toggles its selection in a selectable grid (single mode: selects\n * the row alone, or clears it). The row's own `onClick` runs first; calling `preventDefault()`\n * in it keeps the selection. A click never toggles when it lands on an interactive element in\n * the row (a link, a button, an input, a label, an element with `tabindex` or a widget role, the\n * selection control included), comes from a popup portaled from the row (a Menu, a Popover), or\n * ends a text selection in the row (a drag across its text); nor does a click on a header row\n * or on a row whose selection is disabled (`selectionCellProps.disabled`). Space on a cell\n * toggles the row either way.\n * @default false\n */\n selectOnRowClick?: boolean;\n /**\n * How a selected row is filled: `'brand'` with the selected token, `'neutral'` with the subtle\n * selected token, `'none'` not at all (the selection control, `aria-selected` and, in forced\n * colors, the row's outline still show it). Rendered as `data-selection-appearance` on the grid.\n * @default 'brand'\n */\n selectionAppearance?: DataGridSelectionAppearance;\n /**\n * Subtle selection controls: a row's control is transparent while the row is not selected, until\n * the row is hovered or holds focus, and the select-all checkbox while no row is selected, until\n * the grid is hovered or holds focus. Forced colors and a coarse pointer (touch) always draw\n * them; they stay focusable and named. Rendered as `data-subtle-selection` on the grid.\n * @default false\n */\n subtleSelection?: boolean;\n /**\n * Controlled selected row ids (`DataGrid.Row` `rowId`; with `items`, the ids from `getRowId`).\n * With `items`, every id counts, whether its row is rendered, filtered out or on another page\n * (see `onSelectedItemsChange`). In single mode pass at most one id: with several, only the\n * first one is selected (without `items`, the first one whose row is rendered), and a\n * development warning says so.\n */\n selectedItems?: readonly string[];\n /** Initially selected row ids (uncontrolled). In single mode, at most one (see `selectedItems`). */\n defaultSelectedItems?: readonly string[];\n /**\n * Called with the new selected row ids when the selection changes, then `details` (`{ event }`,\n * the click or key press behind the change).\n *\n * With `items`, the selection follows the data: it reports every selected id, also ids whose\n * rows are not rendered or not in `items` (filtered out, on another page, restored by id), and no\n * change drops them. Select-all selects every item of `items` whose selection is not disabled\n * (`isSelectionDisabled`, or the selection cell of its rendered row) and keeps every other id;\n * when all of them are selected it removes only their ids. The select-all checkbox shows the\n * state of those items. Both use the ids from `getRowId` (by default the item's index): a row\n * that sets its own, different `rowId` (or a `DataGrid.Row` child whose `rowId` is no item's\n * id) is outside them, and select-all then selects ids that no row has, with a development\n * warning. Pass a `getRowId` that returns the rows' ids.\n *\n * Without `items` (rows written as `DataGrid.Row` children), ids of rows that are not rendered\n * are left out of the reported selection and of the select-all state, so the next change drops\n * them. Until that change an uncontrolled grid still holds such an id: a row re-added with the\n * same `rowId` before then is shown selected again.\n */\n onSelectedItemsChange?: (\n selectedItems: string[],\n details?: DataGridSelectedItemsChangeDetails,\n ) => void;\n /** @deprecated Use `selectedItems` (an array). A `Set` or an array is accepted. */\n selectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `defaultSelectedItems` (an array). A `Set` or an array is accepted. */\n defaultSelectedKeys?: ReadonlySet<string> | readonly string[];\n /** @deprecated Use `onSelectedItemsChange`, which receives an array. Both are called. */\n onSelectionChange?: (keys: Set<string>) => void;\n /**\n * Props for the wrapper `<div>` around the `<table>`: a horizontally scrollable container\n * (`overflow-x-auto`). Use it for its className, style (e.g. a max height) or ref. With a\n * `virtualWindow` it is the window's scroller, which needs a bounded height. The wrapper\n * is not a tab stop (the grid's own cell tab stop scrolls it) and has no role, so its\n * `aria-label`/`aria-labelledby` are applied only together with a `role` (e.g. `'region'`);\n * without one they are dropped with a development warning. Name the grid with `aria-label`.\n */\n containerProps?: Omit<React.ComponentPropsWithRef<'div'>, 'children'>;\n /**\n * DataGrid header, body, and row elements. Optional when `items` and `columns` render the grid;\n * a generated body is placed after the header and before a `<tfoot>` child.\n */\n children?: React.ReactNode;\n /** Ref to the `<table role=\"grid\">` element. */\n ref?: React.Ref<HTMLTableElement>;\n}\n\ninterface NoDeprecatedSortProps {\n sortColumn?: never;\n defaultSortColumn?: never;\n sortDirection?: never;\n defaultSortDirection?: never;\n}\n\n/** The 0.5 sort API, controlled: `sort` + `onSortChange(sort, details)`. */\nexport interface DataGridControlledSortProps extends NoDeprecatedSortProps {\n /** The controlled sort, or `null` for an unsorted grid. */\n sort: DataGridSort | null;\n /** Initial sort while `sort` is not given yet. */\n defaultSort?: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated, then `details` (`{ event }`).\n * With `items`, the grid orders its rows by the sorted column's `compare` (see\n * `DataGridColumn.compare`), also while `sort` is controlled; otherwise the consumer orders them.\n */\n onSortChange?: (sort: DataGridSort, details?: DataGridSortChangeDetails) => void;\n}\n\n/** The 0.5 sort API, uncontrolled: `defaultSort` (`null` for none) + `onSortChange(sort, details)`. */\nexport interface DataGridUncontrolledSortProps extends NoDeprecatedSortProps {\n sort?: undefined;\n /** The initial sort, or `null` for an initially unsorted grid. */\n defaultSort: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated, then `details` (`{ event }`).\n * With `items`, the grid orders its rows by the sorted column's `compare` (see\n * `DataGridColumn.compare`); otherwise the consumer orders them.\n */\n onSortChange?: (sort: DataGridSort, details?: DataGridSortChangeDetails) => void;\n}\n\n/**\n * The sort props of a grid with `items`: the 0.5 sort API, whether or not `sort` or `defaultSort`\n * is given (unsorted at first without them). The 0.4 positional `onSortChange` and the deprecated\n * sort props do not apply to such a grid.\n */\nexport interface DataGridItemsSortProps<T = unknown>\n extends DataGridItemsProps<T>, NoDeprecatedSortProps {\n /** The grid's data (see `DataGridItemsProps.items`). */\n items: readonly T[];\n /** The controlled sort, or `null` for an unsorted grid; `undefined` leaves the sort to the grid. */\n sort?: DataGridSort | null;\n /** The initial sort while `sort` is not given. */\n defaultSort?: DataGridSort | null;\n /**\n * Called with the new sort when a sortable header is activated, then `details` (`{ event }`).\n * The grid orders its rows by the sorted column's `compare` (see `DataGridColumn.compare`).\n */\n onSortChange?: (sort: DataGridSort, details?: DataGridSortChangeDetails) => void;\n}\n\n/**\n * The 0.4 sort API: `onSortChange(columnId, direction)` and the deprecated `sortColumn`/\n * `sortDirection` props. It applies whenever none of `items`, `sort` and `defaultSort` is given.\n * As in 0.4, the column and the direction can be controlled independently: the half that is not\n * controlled is kept internally and follows every sort request (mixed control, warned in\n * development).\n */\nexport interface DataGridLegacySortProps {\n /** A grid with `items` uses the 0.5 sort API (`DataGridItemsSortProps`). */\n items?: undefined;\n sort?: undefined;\n defaultSort?: undefined;\n /**\n * @deprecated Use `sort` (`{ columnId, direction }` or `null`). Without `sortDirection`, the\n * direction is kept internally (it toggles on repeated clicks).\n */\n sortColumn?: string;\n /** @deprecated Use `defaultSort`. */\n defaultSortColumn?: string;\n /**\n * @deprecated Use `sort`. Without `sortColumn`, the column is kept internally (it follows the\n * clicked header, starting from `defaultSortColumn`).\n */\n sortDirection?: SortDirection;\n /** @deprecated Use `defaultSort`. */\n defaultSortDirection?: SortDirection;\n /**\n * Called when a sortable header is activated, with the 0.4 arguments. Pass `items`, `sort` or\n * `defaultSort` to receive a `DataGridSort` object (and `details`) instead:\n * `defaultSort={null}` turns the object form on for an initially unsorted grid. A `sort` that is\n * still `undefined` (e.g. while data loads) does not: pass `sort={sort ?? null}`.\n *\n * @example\n * <DataGrid defaultSort={null} onSortChange={(sort) => setSort(sort)}>…</DataGrid>\n */\n onSortChange?: (columnId: string, direction: SortDirection) => void;\n}\n\n/**\n * Properties for the DataGrid component, whose `items` are of type `T`. The sort props form a\n * union: `sort`/`defaultSort` with `onSortChange(sort, details)` (0.5, also the form of every grid\n * with `items`), or the 0.4 form `onSortChange(columnId, direction)` with the deprecated\n * `sortColumn`/`sortDirection`/`defaultSortColumn`/`defaultSortDirection`, for a grid without\n * `items`. The two cannot be mixed.\n */\nexport type DataGridProps<T = unknown> = DataGridBaseProps<T> &\n (\n | (DataGridItemsProps<T> & DataGridControlledSortProps)\n | (DataGridItemsProps<T> & DataGridUncontrolledSortProps)\n | DataGridItemsSortProps<T>\n | DataGridLegacySortProps\n );\n\n/** Properties for the DataGridHeader sub-component. */\nexport interface DataGridHeaderProps extends React.HTMLAttributes<HTMLTableSectionElement> {\n /**\n * Header row elements. Each `<tr>` child (also inside a Fragment) gets the selection column's\n * header cell prepended when the grid is selectable, unless the row holds a\n * `DataGrid.SelectionCell` (which then is that cell, where it stands); a header row rendered by\n * another component should be a `DataGrid.Row`, which adds the cell itself. With several header\n * rows (a grouped header), only the first one gets the \"Select all rows\" control; later rows get\n * an empty cell.\n */\n children: React.ReactNode;\n /** Ref to the `<thead>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridHeaderCell sub-component. */\nexport interface DataGridHeaderCellProps extends React.ThHTMLAttributes<HTMLTableCellElement> {\n /** Column ID used for sort tracking. Required for `sortable`. */\n columnId?: string;\n /**\n * Whether this column can be sorted. The content is rendered inside a `<button>`; the header\n * cell carries `aria-sort`. Ignored (with a development warning) without `columnId`.\n * @default false\n */\n sortable?: boolean;\n /**\n * The glyph a sortable header shows after its content while its column is sorted, in place of\n * the default arrow (up for ascending, down for descending). It is decorative (`aria-hidden`:\n * `aria-sort` on the header tells the direction) and carries `data-direction` (`ascending` or\n * `descending`), so one glyph can be turned by a selector on it. `null` and `undefined` keep the\n * arrow; `false`, or any value that renders nothing, shows no glyph. A `<button>` or `Button`\n * element (or a slot object whose `as` is one) is not nested in the sort button: its children\n * become the glyph and its props are dropped, with a development warning.\n */\n sortIcon?: Slot<'span'>;\n /** Header cell content. */\n children: React.ReactNode;\n /** Ref to the `<th>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n/** Properties for the DataGridBody sub-component, in a grid whose `items` are of type `T`. */\nexport interface DataGridBodyProps<T = unknown> extends Omit<\n React.HTMLAttributes<HTMLTableSectionElement>,\n 'children'\n> {\n /**\n * The body rows: `DataGrid.Row` elements, or a render function called with each item of the\n * grid's `items` (in the grid's sort order) and the item's index in `items` (its position there,\n * whatever the sort), which returns the item's `DataGrid.Row`. The grid keys each returned row\n * by its row id and gives it that id as `rowId` (from `getRowId`), and renders it again only\n * when its item, its index or the function change (a sort moves the rows). Type the function\n * by annotating its item parameter (`(person: Person) => …`) or with `DataGrid.Body<Person>`.\n * Without children, a grid with `items` and `columns` renders the rows from the columns; empty\n * children are no rows.\n */\n children?: React.ReactNode | ((item: T, index: number) => React.ReactNode);\n /** Ref to the `<tbody>` element. */\n ref?: React.Ref<HTMLTableSectionElement>;\n}\n\n/** Properties for the DataGridRow sub-component. */\nexport interface DataGridRowProps extends React.HTMLAttributes<HTMLTableRowElement> {\n /**\n * Unique identifier for this row, used for selection (rows that share one are selected together;\n * a duplicate warns in development). A selectable grid renders no selection control (and warns\n * in development) for a row without it. A row rendered from the grid's `items` (by\n * `DataGrid.Body`'s render function or from `columns`) defaults to the item's row id\n * (`getRowId`). In a grid with `items`, select-all uses the ids from `getRowId`: a row whose\n * `rowId` differs from its item's id, or is no item's id, is outside it (a development warning\n * says so), so set `getRowId` rather than a different `rowId`.\n */\n rowId?: string;\n /**\n * Accessible name of the row's selection control. Defaults to the row's first child that is a\n * `DataGrid.Cell`, `<td>` or `<th>` element (`aria-labelledby`); a cell that another component\n * renders is not seen, so pass `selectionLabel` when the row's first cell is one. Without such a\n * child the control is named \"Select row\" (with a development warning). The selection cell's\n * `aria-label` (`selectionCellProps`, or a `DataGrid.SelectionCell` child's) wins over it.\n */\n selectionLabel?: string;\n /**\n * Props of the row's selection cell (`disabled`, `invisible`, `className`, `aria-label`): the\n * cell the row adds first in a selectable grid, or a `DataGrid.SelectionCell` child, whose own\n * props win (their classes are merged). In a header row they apply to the select-all cell.\n */\n selectionCellProps?: DataGridRowSelectionCellProps;\n /**\n * DataGrid cell elements. A `DataGrid.SelectionCell` child (also inside a Fragment) is the row's\n * selection cell, where it stands: the row then adds none.\n */\n children: React.ReactNode;\n /** Ref to the `<tr>` element. */\n ref?: React.Ref<HTMLTableRowElement>;\n}\n\n/** Properties for the DataGridCell sub-component. */\nexport interface DataGridCellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {\n /** Cell content. */\n children: React.ReactNode;\n /** Ref to the `<td>` element. */\n ref?: React.Ref<HTMLTableCellElement>;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nconst EMPTY_ITEMS: readonly string[] = [];\nconst NO_COLUMN_IDS: readonly (string | undefined)[] = [];\n\nfunction toItems(\n keys: ReadonlySet<string> | readonly string[] | undefined,\n): readonly string[] | undefined {\n return keys === undefined ? undefined : Array.from(keys);\n}\n\nfunction sameItems(a: readonly string[], b: readonly string[]): boolean {\n return a.length === b.length && a.every((item, index) => item === b[index]);\n}\n\n/**\n * Select-all of a grid with `items`: adds every selectable id of the universe, or removes them\n * when all are selected; every other id (a selected disabled row, ids outside `items`) keeps its\n * state. The ids outside the universe come first, in their order, then the universe's in its own.\n */\nfunction toggleAllInUniverse(\n previous: readonly string[],\n universe: readonly string[],\n selectable: readonly string[],\n): readonly string[] {\n if (selectable.length === 0) return previous;\n const current = new Set(previous);\n // The state counts the selectable ids only, as the select-all checkbox shows it.\n const next = summarizeSelection(current, selectable).all\n ? clearIds(current, selectable)\n : selectAllIds(current, selectable);\n const inUniverse = new Set(universe);\n return [\n ...Array.from(next).filter((id) => !inUniverse.has(id)),\n ...universe.filter((id) => next.has(id)),\n ];\n}\n\n/** A child of {@link flattenChildren} under its flattened key (unique across the flattened list). */\nfunction renderFlatChild({ key, node }: { key: string; node: React.ReactNode }): React.ReactNode {\n return <React.Fragment key={key}>{node}</React.Fragment>;\n}\n\n/**\n * The rows of a `DataGrid.Header`'s children as the header sees them: every element child, also\n * inside a Fragment (a `<tr>`, a `DataGrid.Row`, or a component that renders one row).\n */\nfunction countHeaderRows(children: React.ReactNode): number {\n return flattenChildren(children).filter(({ node }) => React.isValidElement(node)).length;\n}\n\n/** A column's id: `columnId`, else the deprecated `id` (warned once). */\nfunction columnIdOf<T>(column: DataGridColumn<T>): string | undefined {\n return resolveDeprecatedProp(\n 'DataGrid',\n column.columnId,\n column.id,\n 'columns[].id',\n 'columns[].columnId',\n );\n}\n\nfunction warnDuplicateRowId(rowId: string): void {\n warnOnce(\n `DataGrid:duplicate-rowId:${rowId}`,\n `DataGrid: several rows share the rowId \"${rowId}\". Row ids must be unique within a ` +\n 'DataGrid; rows with the same rowId are selected and deselected together.',\n );\n}\n\n/** A body row: its hover and, per `selectionAppearance`, the fill of a selected row. */\nconst BODY_ROW_CLASSES: Record<DataGridSelectionAppearance, string> = {\n brand:\n 'hover:bg-subtle-hover data-[selected]:bg-selected transition-colors motion-reduce:transition-none',\n neutral:\n 'hover:bg-subtle-hover data-[selected]:bg-subtle-selected transition-colors motion-reduce:transition-none',\n none: 'hover:bg-subtle-hover transition-colors motion-reduce:transition-none',\n};\n\n// ---------------------------------------------------------------------------\n// DataGrid\n// ---------------------------------------------------------------------------\n\n// The component-level JSDoc sits on the exported `DataGrid` below.\n//\n// Two call signatures. The first takes only a grid with `items` (`DataGridItemsSortProps`), so an\n// inline `onSortChange={(sort, details) => …}` next to `items` has one contextual type: in the\n// union of the second, `items` cannot tell the members apart while `T` is still being inferred\n// from it. Every other grid, a generic wrapper's `DataGridProps<T>` included, takes the second.\nfunction DataGridRoot<T>(\n props: DataGridBaseProps<T> & DataGridItemsSortProps<T>,\n): React.JSX.Element;\nfunction DataGridRoot<T = unknown>(props: DataGridProps<T>): React.JSX.Element;\nfunction DataGridRoot<T>(props: DataGridProps<T>) {\n const {\n items,\n getRowId,\n isSelectionDisabled,\n sort: sortProp,\n defaultSort,\n sortColumn: sortColumnProp,\n defaultSortColumn,\n sortDirection: sortDirectionProp,\n defaultSortDirection,\n onSortChange,\n selectionMode = 'none',\n selectedItems: selectedItemsProp,\n defaultSelectedItems,\n onSelectedItemsChange,\n selectedKeys,\n defaultSelectedKeys,\n onSelectionChange,\n labels,\n selectOnRowClick = false,\n selectionAppearance = 'brand',\n subtleSelection = false,\n columns,\n resizableColumns = false,\n columnSizingOptions,\n columnWidths,\n defaultColumnWidths,\n onColumnWidthsChange,\n virtualWindow,\n containerProps,\n children,\n className,\n style,\n onKeyDown,\n onFocus,\n onBlur,\n onPointerDownCapture,\n ref,\n ...rest\n } = props;\n\n // --- sort -----------------------------------------------------------------\n const hasItems = items !== undefined;\n /** The 0.5 sort props, which win over the deprecated ones. */\n const usesSortApi = sortProp !== undefined || defaultSort !== undefined;\n /**\n * The 0.4 rules (the deprecated sort props, the positional callback) apply without `items`,\n * `sort` and `defaultSort`.\n */\n const legacySort = !usesSortApi && !hasItems;\n /** `onSortChange(sort, details)`; sticky, so the form never changes under the consumer. */\n const [objectMode, setObjectMode] = React.useState(!legacySort);\n if (!legacySort && !objectMode) setObjectMode(true);\n const objectCallbacks = objectMode || !legacySort;\n\n const legacySortControlled = sortColumnProp !== undefined || sortDirectionProp !== undefined;\n if (sortColumnProp !== undefined) warnDeprecated('DataGrid', 'sortColumn', 'sort');\n if (sortDirectionProp !== undefined) warnDeprecated('DataGrid', 'sortDirection', 'sort');\n if (defaultSortColumn !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortColumn', 'defaultSort');\n }\n if (defaultSortDirection !== undefined) {\n warnDeprecated('DataGrid', 'defaultSortDirection', 'defaultSort');\n }\n const deprecatedSortProps =\n legacySortControlled || defaultSortColumn !== undefined || defaultSortDirection !== undefined;\n const mixedSortApi = usesSortApi && deprecatedSortProps;\n /** A grid with `items` (and no `sort`/`defaultSort`) ignores the deprecated sort props. */\n const ignoredSortProps = !legacySort && !usesSortApi && deprecatedSortProps;\n\n React.useEffect(() => {\n if (mixedSortApi) {\n warnOnce(\n 'DataGrid:mixed-sort',\n 'DataGrid: do not mix `sort`/`defaultSort` with the deprecated `sortColumn`/`sortDirection`/' +\n '`defaultSortColumn`/`defaultSortDirection`. `sort`/`defaultSort` win.',\n );\n } else if (ignoredSortProps) {\n warnOnce(\n 'DataGrid:items-deprecated-sort',\n 'DataGrid: the deprecated `sortColumn`/`sortDirection`/`defaultSortColumn`/' +\n '`defaultSortDirection` do not apply to a grid with `items` and are ignored. Pass `sort` ' +\n 'or `defaultSort`.',\n );\n }\n }, [mixedSortApi, ignoredSortProps]);\n // 0.4 mixed control: `sortColumn` and `sortDirection` are controlled independently. The half the\n // parent does not control is kept here (seeded from its default) and follows every sort request,\n // as 0.4 did, so repeated clicks still alternate and aria-sort shows what was reported.\n React.useEffect(() => {\n if (!legacySort) return;\n if (sortColumnProp !== undefined && sortDirectionProp === undefined) {\n warnOnce(\n 'DataGrid:sortColumn-without-sortDirection',\n 'DataGrid: `sortColumn` is controlled but `sortDirection` is not (mixed control). The ' +\n 'direction is kept internally and toggles on repeated clicks, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n } else if (sortDirectionProp !== undefined && sortColumnProp === undefined) {\n warnOnce(\n 'DataGrid:sortDirection-without-sortColumn',\n 'DataGrid: `sortDirection` is controlled but `sortColumn` is not (mixed control). The ' +\n 'column is kept internally and follows the clicked header, as in 0.4. Pass `sort` ' +\n '(`{ columnId, direction }`) to control both.',\n );\n }\n }, [legacySort, sortColumnProp, sortDirectionProp]);\n\n /** The uncontrolled halves of the 0.4 sort props (used while the other half is controlled). */\n const [legacyHalves, setLegacyHalves] = React.useState<{\n column: string;\n direction: SortDirection;\n }>(() => ({\n column: defaultSortColumn ?? '',\n direction: defaultSortDirection ?? 'ascending',\n }));\n\n const legacyControlledSort = React.useMemo<DataGridSort | null | undefined>(() => {\n if (sortColumnProp === undefined && sortDirectionProp === undefined) return undefined;\n const column = sortColumnProp ?? legacyHalves.column;\n return column === ''\n ? null\n : { columnId: column, direction: sortDirectionProp ?? legacyHalves.direction };\n }, [sortColumnProp, sortDirectionProp, legacyHalves]);\n\n const legacyDefaultSort = React.useMemo<DataGridSort | null>(\n () =>\n defaultSortColumn\n ? { columnId: defaultSortColumn, direction: defaultSortDirection ?? 'ascending' }\n : null,\n [defaultSortColumn, defaultSortDirection],\n );\n\n const controlledSort = legacySort ? legacyControlledSort : sortProp;\n // A grid with `items` and no `defaultSort` starts unsorted: the deprecated defaults are ignored.\n let initialSort = legacyDefaultSort;\n if (defaultSort !== undefined) initialSort = defaultSort;\n else if (ignoredSortProps) initialSort = null;\n\n // The details of the sort being requested, set around the setter: useControllable calls its\n // onChange synchronously inside it, and only on change (the useCheckedValues pattern).\n const sortDetailsRef = React.useRef<DataGridSortChangeDetails | undefined>(undefined);\n\n const emitSortChange = (next: DataGridSort | null) => {\n if (!next) return;\n if (legacySort) {\n setLegacyHalves((previous) =>\n previous.column === next.columnId && previous.direction === next.direction\n ? previous\n : { column: next.columnId, direction: next.direction },\n );\n }\n if (!onSortChange) return;\n if (objectCallbacks) {\n const objectForm = onSortChange as NonNullable<DataGridItemsSortProps['onSortChange']>;\n objectForm(next, sortDetailsRef.current);\n } else {\n const legacy = onSortChange as (columnId: string, direction: SortDirection) => void;\n legacy(next.columnId, next.direction);\n }\n };\n\n const [sort, setSort] = useControllable<DataGridSort | null>(\n controlledSort,\n initialSort,\n emitSortChange,\n );\n\n const requestSort = React.useCallback(\n (columnId: string, event: Event) => {\n sortDetailsRef.current = { event };\n try {\n setSort((previous) => ({\n columnId,\n direction:\n previous?.columnId === columnId && previous.direction === 'ascending'\n ? 'descending'\n : 'ascending',\n }));\n } finally {\n sortDetailsRef.current = undefined;\n }\n },\n [setSort],\n );\n\n const sortContext = React.useMemo<DataGridSortContextValue>(\n () => ({ sort, requestSort }),\n [sort, requestSort],\n );\n\n // --- selection ------------------------------------------------------------\n if (onSelectionChange !== undefined) {\n warnDeprecated('DataGrid', 'onSelectionChange', 'onSelectedItemsChange');\n }\n const legacySelected = React.useMemo(() => toItems(selectedKeys), [selectedKeys]);\n const legacyDefaultSelected = React.useMemo(\n () => toItems(defaultSelectedKeys),\n [defaultSelectedKeys],\n );\n const controlledSelected = resolveDeprecatedProp(\n 'DataGrid',\n selectedItemsProp,\n legacySelected,\n 'selectedKeys',\n 'selectedItems',\n );\n const defaultSelected =\n resolveDeprecatedProp(\n 'DataGrid',\n defaultSelectedItems,\n legacyDefaultSelected,\n 'defaultSelectedKeys',\n 'defaultSelectedItems',\n ) ?? EMPTY_ITEMS;\n\n // The details of the change being made, set around the setter (as `sortDetailsRef`).\n const selectionDetailsRef = React.useRef<DataGridSelectedItemsChangeDetails | undefined>(\n undefined,\n );\n\n const emitSelectionChange = (next: readonly string[]) => {\n onSelectedItemsChange?.([...next], selectionDetailsRef.current);\n onSelectionChange?.(new Set(next));\n };\n\n const [selected, setSelectedValue] = useControllable<readonly string[]>(\n controlledSelected,\n defaultSelected,\n emitSelectionChange,\n );\n\n const setSelected = React.useCallback(\n (event: Event, update: (previous: readonly string[]) => readonly string[]) => {\n selectionDetailsRef.current = { event };\n try {\n setSelectedValue(update);\n } finally {\n selectionDetailsRef.current = undefined;\n }\n },\n [setSelectedValue],\n );\n\n // The rows of `items` (with `items` the selection follows them, rendered or not).\n const itemRows = React.useMemo<readonly DataGridItemRowData[] | null>(() => {\n if (items === undefined) return null;\n const keys = new Set<string>();\n return items.map((item, index) => {\n const rowId = getRowId ? getRowId(item) : String(index);\n // A repeated id (the selection store warns about it) still gets a key of its own.\n const key = keys.has(rowId) ? `${rowId}\\u0000${index}` : rowId;\n keys.add(key);\n return { item, index, rowId, key };\n });\n }, [items, getRowId]);\n\n // A grid without selection reads no item's selection state: nothing per item at data scale.\n const selectable = selectionMode !== 'none';\n const itemSelectionDisabled = React.useMemo<readonly boolean[] | null>(() => {\n if (itemRows === null || !isSelectionDisabled || !selectable) return null;\n // The rows hold the items as `unknown`; `isSelectionDisabled` takes the grid's `T`.\n return itemRows.map((row) => isSelectionDisabled(row.item as T, row.index));\n }, [itemRows, isSelectionDisabled, selectable]);\n\n // Select-all covers every row id of `items`, rendered or not, but those `isSelectionDisabled`\n // disables (a rendered row's own `disabled` is added by the row).\n const selectionUniverse = React.useMemo<SelectionUniverse | null>(() => {\n if (itemRows === null || !selectable) return null;\n const disabledIds = new Set<string>();\n if (itemSelectionDisabled) {\n for (const row of itemRows) if (itemSelectionDisabled[row.index]) disabledIds.add(row.rowId);\n }\n return { ids: itemRows.map((row) => row.rowId), disabled: disabledIds };\n }, [itemRows, itemSelectionDisabled, selectable]);\n\n const single = selectionMode === 'single';\n const [store] = React.useState(() => createSelectionStore(selected, single, selectionUniverse));\n React.useLayoutEffect(() => {\n store.setUniverse(selectionUniverse);\n }, [store, selectionUniverse]);\n React.useLayoutEffect(() => {\n store.setSelected(selected);\n }, [store, selected]);\n React.useLayoutEffect(() => {\n store.setSingleMode(single);\n }, [store, single]);\n\n const toggleRow = React.useCallback(\n (rowId: string, event: Event) => {\n setSelected(event, (previous) => {\n let next: readonly string[];\n if (hasItems) {\n // With `items` a row changes its own id and keeps every other one, rendered or not.\n // Single mode toggles the one selected id, the first (see the store), and clears it.\n const current = new Set(single ? previous.slice(0, 1) : previous);\n next = Array.from(\n toggleId(current, rowId, single ? 'single' : 'multiple', { allowEmpty: true }),\n );\n } else {\n const effective = store.prune(previous);\n if (single) {\n // Single mode shows the first selected row that is rendered (see the store).\n next = effective[0] === rowId ? [] : [rowId];\n } else {\n next = effective.includes(rowId)\n ? effective.filter((item) => item !== rowId)\n : [...effective, rowId];\n }\n }\n return sameItems(next, previous) ? previous : next;\n });\n },\n [hasItems, single, setSelected, store],\n );\n\n const selectedCount = selected.length;\n React.useEffect(() => {\n if (single && selectedCount > 1) {\n const which = hasItems ? 'the first one' : 'the first one that is rendered';\n warnOnce(\n 'DataGrid:single-several-selected',\n `DataGrid: a single-selection grid (selectionMode \"single\") has ${selectedCount} selected row ids; only ${which} is selected. Pass at most one id in \\`selectedItems\\`/\\`defaultSelectedItems\\`, or use selectionMode=\"multiple\".`,\n );\n }\n }, [single, selectedCount, hasItems]);\n\n // Rows whose selection is disabled keep their state: select-all selects (or clears) the others.\n const toggleAll = React.useCallback(\n (event: Event) => {\n setSelected(event, (previous) => {\n let next: readonly string[];\n if (hasItems) {\n next = toggleAllInUniverse(previous, store.getUniverseIds(), store.getSelectableIds());\n } else {\n const effective = new Set(store.prune(previous));\n const all = store.getRegistered();\n const enabled = all.filter((rowId) => !store.isDisabled(rowId));\n const allSelected = enabled.length > 0 && enabled.every((rowId) => effective.has(rowId));\n next = allSelected\n ? all.filter((rowId) => store.isDisabled(rowId) && effective.has(rowId))\n : all.filter((rowId) => !store.isDisabled(rowId) || effective.has(rowId));\n }\n return sameItems(next, previous) ? previous : next;\n });\n },\n [hasItems, setSelected, store],\n );\n\n const radioName = useId('wave-datagrid-selection');\n const selectAllLabel = labels?.selectAll ?? DEFAULT_SELECT_ALL_LABEL;\n const selectionHeaderLabel = labels?.selectionHeader ?? DEFAULT_SELECTION_HEADER_LABEL;\n\n const context = React.useMemo<DataGridContextValue>(\n () => ({\n selectionMode,\n store,\n toggleRow,\n toggleAll,\n radioName,\n selectAllLabel,\n selectionHeaderLabel,\n selectOnRowClick,\n selectionAppearance,\n subtleSelection,\n }),\n [\n selectionMode,\n store,\n toggleRow,\n toggleAll,\n radioName,\n selectAllLabel,\n selectionHeaderLabel,\n selectOnRowClick,\n selectionAppearance,\n subtleSelection,\n ],\n );\n\n // --- items (the rows of `items` are built with the selection above) -------------\n // Built-in sorting: by the `compare` of the sorted column (controlled `sort` included).\n const sortColumnId = sort?.columnId;\n const sortDirection = sort?.direction;\n const sortCompare = React.useMemo(() => {\n if (!hasItems || sortColumnId === undefined || !columns) return undefined;\n return columns.find((column) => columnIdOf(column) === sortColumnId)?.compare;\n }, [hasItems, sortColumnId, columns]);\n\n const sortedRows = React.useMemo(() => {\n if (itemRows === null || !sortCompare) return itemRows;\n // The rows hold the items as `unknown`; `compare` takes the grid's `T`.\n const compare = sortCompare as (a: unknown, b: unknown) => number;\n // A stable sort of a copy (never in place, never reversed): items that compare equal keep\n // their order in `items` in both directions, since descending negates `compare`.\n return itemRows\n .slice()\n .sort(\n sortDirection === 'descending'\n ? (a, b) => -compare(a.item, b.item)\n : (a, b) => compare(a.item, b.item),\n );\n }, [itemRows, sortCompare, sortDirection]);\n\n // Built only with `items`: the column ids are read (and the deprecated `id` warned) when used.\n const renderColumnsRow = React.useMemo<DataGridRenderRow | null>(() => {\n if (!columns || !hasItems) return null;\n const cellKeys = columns.map((column, index) => columnIdOf(column) ?? index);\n return (item) => (\n <DataGridRow>\n {columns.map((column, index) => (\n <DataGridCell key={cellKeys[index]}>{column.renderCell?.(item as T)}</DataGridCell>\n ))}\n </DataGridRow>\n );\n }, [columns, hasItems]);\n\n const itemsContext = React.useMemo<DataGridItemsContextValue>(\n () => ({ rows: sortedRows, renderColumnsRow, selectionDisabled: itemSelectionDisabled }),\n [sortedRows, renderColumnsRow, itemSelectionDisabled],\n );\n\n const columnWithoutId =\n columns?.some((column) => column.columnId === undefined && column.id === undefined) ?? false;\n React.useEffect(() => {\n if (columnWithoutId) {\n warnOnce(\n 'DataGrid:column-without-columnId',\n 'DataGrid: a column in `columns` has no `columnId` (nor the deprecated `id`), so its ' +\n 'header cannot sort. Give every column a unique `columnId`.',\n );\n }\n }, [columnWithoutId]);\n\n // --- window (with `items`, `columns` and the body rows rendered from them) -------\n const flatChildren = columns ? flattenChildren(children) : [];\n const childOf = (part: unknown) =>\n flatChildren.find(({ node }) => isElementOfType(node, part))?.node;\n const headerChild = childOf(DataGridHeader);\n const bodyChild = childOf(DataGridBody);\n const bodyChildren = isElementOfType<DataGridBodyProps>(bodyChild, DataGridBody)\n ? bodyChild.props.children\n : undefined;\n /** The window while it applies: the body rows are rendered from `items` (columns, a function). */\n const activeWindow =\n virtualWindow !== undefined &&\n hasItems &&\n columns !== undefined &&\n (bodyChildren === undefined || typeof bodyChildren === 'function')\n ? virtualWindow\n : null;\n const windowed = activeWindow !== null;\n // A grid with `columns` has one generated header row unless a `DataGrid.Header` child is given.\n const headerRowCount = isElementOfType<DataGridHeaderProps>(headerChild, DataGridHeader)\n ? countHeaderRows(headerChild.props.children)\n : 1;\n const rowCount = items?.length ?? 0;\n\n // --- keyboard -------------------------------------------------------------\n // A windowed grid moves by the rows of the data: an unmounted target is scrolled in first.\n const { gridRef, gridProps, activeRowIndex, pendingRowIndex } = useGridNavigation({\n model: getWindowNavigationModel(activeWindow, rowCount, headerRowCount),\n });\n const windowState = useDataGridWindow({\n virtualWindow: activeWindow,\n ignored: virtualWindow !== undefined && !windowed,\n rows: sortedRows,\n headerRowCount,\n columnCount: (columns?.length ?? 0) + (selectable ? 1 : 0),\n activeRowIndex,\n pendingRowIndex,\n });\n const mergedRef = useMergedRefs<HTMLTableElement>(ref, gridRef, windowState.tableRef);\n const handleFocus = (event: React.FocusEvent<HTMLTableElement>) => {\n gridProps.onFocus(event);\n windowState.onFocus(event);\n };\n const handleBlur = (event: React.FocusEvent<HTMLTableElement>) => {\n gridProps.onBlur(event);\n windowState.onBlur(event);\n };\n\n // --- column widths (with `columns` and `items`) --------------------------------\n const sizingRequested =\n resizableColumns ||\n columnSizingOptions !== undefined ||\n columnWidths !== undefined ||\n defaultColumnWidths !== undefined;\n const sizingIgnored = sizingRequested && !(columns && hasItems);\n React.useEffect(() => {\n if (sizingIgnored) {\n warnOnce(\n 'DataGrid:resizable-columns-require-columns',\n 'DataGrid: `resizableColumns`, `columnSizingOptions`, `columnWidths` and ' +\n '`defaultColumnWidths` need the `columns` prop together with `items`, and are ignored ' +\n 'without them. Render the grid from `items` and `columns`.',\n );\n }\n }, [sizingIgnored]);\n // A windowed grid is laid out from widths too: its columns never follow the rendered rows.\n const sizingEnabled = (sizingRequested && !sizingIgnored) || windowed;\n // Read (and the deprecated `id` warned) only when the widths are used.\n const columnIds = React.useMemo(\n () => (sizingEnabled && columns ? columns.map(columnIdOf) : NO_COLUMN_IDS),\n [sizingEnabled, columns],\n );\n const sizing = useDataGridColumnSizing({\n enabled: sizingEnabled,\n resizable: resizableColumns,\n columnIds,\n selectionColumn: selectionMode !== 'none',\n columnSizingOptions,\n columnWidths,\n defaultColumnWidths,\n onColumnWidthsChange,\n resizeColumnLabel: labels?.resizeColumn,\n columnWidthText: labels?.columnWidth,\n });\n\n // --- header and body from columns -------------------------------------------\n let content: React.ReactNode = children;\n const generatedHeader =\n columns && headerChild === undefined ? (\n <DataGridHeader key=\"wave-generated-header\">\n <tr>\n {columns.map((column, index) => {\n const columnId = columnIdOf(column);\n return (\n <DataGridHeaderCell\n key={columnId ?? index}\n columnId={columnId}\n sortable={column.sortable ?? column.compare !== undefined}\n >\n {column.renderHeaderCell ? column.renderHeaderCell() : column.label}\n </DataGridHeaderCell>\n );\n })}\n </tr>\n </DataGridHeader>\n ) : null;\n // Without children, the body renders the rows from `columns` (see DataGrid.Body).\n const generatedBody =\n columns && hasItems && bodyChild === undefined ? (\n <DataGridBody key=\"wave-generated-body\" />\n ) : null;\n if (generatedHeader || generatedBody || sizing.colgroup) {\n // A `<caption>` stays the table's first child, before the column widths and the generated\n // header; a generated body goes before a `<tfoot>`, which ends the table.\n const isCaption = ({ node }: { node: React.ReactNode }) => isElementOfType(node, 'caption');\n const others = flatChildren.filter((child) => !isCaption(child));\n const footerIndex = generatedBody\n ? others.findIndex(({ node }) => isElementOfType(node, 'tfoot'))\n : -1;\n const bodyIndex = footerIndex >= 0 ? footerIndex : others.length;\n content = [\n ...flatChildren.filter(isCaption).map(renderFlatChild),\n sizing.colgroup,\n generatedHeader,\n ...others.slice(0, bodyIndex).map(renderFlatChild),\n generatedBody,\n ...others.slice(bodyIndex).map(renderFlatChild),\n ];\n }\n\n const {\n className: containerClassName,\n 'aria-label': containerLabel,\n 'aria-labelledby': containerLabelledBy,\n ref: containerRefProp,\n ...containerRest\n } = containerProps ?? {};\n // With a window, the wrapper is its scroller.\n const containerRef = useMergedRefs<HTMLDivElement>(\n containerRefProp,\n windowState.scrollerRef,\n activeWindow?.scrollRef,\n );\n // The wrapper has no role of its own, and a name is prohibited on a role-less `<div>`: the\n // consumer's name is kept only together with a role.\n const containerHasRole = containerRest.role !== undefined;\n const droppedContainerName =\n !containerHasRole && (containerLabel !== undefined || containerLabelledBy !== undefined);\n\n React.useEffect(() => {\n if (droppedContainerName) {\n warnOnce(\n 'DataGrid:container-name-without-role',\n 'DataGrid: `containerProps[\"aria-label\"]`/`[\"aria-labelledby\"]` is ignored because the ' +\n 'wrapper has no role. Name the grid itself (`aria-label` on DataGrid), or pass a ' +\n '`role` (e.g. \"region\") in `containerProps` too.',\n );\n }\n }, [droppedContainerName]);\n\n return (\n <DataGridContext.Provider value={context}>\n <DataGridSortContext.Provider value={sortContext}>\n <DataGridItemsContext.Provider value={itemsContext}>\n {/* Reset for a grid nested in a cell: its rows are not the outer row. */}\n <DataGridRowContext.Provider value={null}>\n <DataGridRowIdContext.Provider value={null}>\n <DataGridItemSelectionDisabledContext.Provider value={undefined}>\n <DataGridResizeContext.Provider value={sizing.resizeContext}>\n <DataGridFixedLayoutContext.Provider value={sizing.colgroup !== null}>\n <div\n // A windowed grid's tab stop is its cell: the scroller is none of its own\n // (Firefox makes a scroller a tab stop). `containerProps.tabIndex` wins.\n tabIndex={windowed ? -1 : undefined}\n {...containerRest}\n ref={containerRef}\n aria-label={containerHasRole ? containerLabel : undefined}\n aria-labelledby={containerHasRole ? containerLabelledBy : undefined}\n className={cn(\n dataGridClassNames.container,\n 'overflow-x-auto rounded-md border border-border',\n // The window lays the rows out: the browser's scroll anchoring only\n // fights it.\n windowed && '[overflow-anchor:none]',\n containerClassName,\n )}\n >\n <table\n ref={mergedRef}\n role=\"grid\"\n aria-multiselectable={selectionMode === 'multiple' || undefined}\n // With a window: every row of the data, rendered or not, and the header.\n aria-rowcount={windowed ? rowCount + headerRowCount : undefined}\n data-selection-appearance={selectionAppearance}\n data-subtle-selection={subtleSelection ? '' : undefined}\n data-resizing={sizing.resizing ? '' : undefined}\n className={cn(\n dataGridClassNames.root,\n 'w-full border-separate border-spacing-0',\n // The group whose hover or focus draws the subtle select-all checkbox.\n subtleSelection && 'group/grid',\n className,\n )}\n // The widths are runtime data: the layout and the width are inline.\n style={sizing.tableStyle ? { ...sizing.tableStyle, ...style } : style}\n {...rest}\n onKeyDown={composeEventHandlers(onKeyDown, gridProps.onKeyDown)}\n onFocus={composeEventHandlers(onFocus, handleFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, handleBlur, {\n checkDefaultPrevented: false,\n })}\n onPointerDownCapture={composeEventHandlers(\n onPointerDownCapture,\n windowState.onPointerDownCapture,\n )}\n >\n <DataGridWindowContext.Provider value={windowState.context}>\n <DataGridWindowRowContext.Provider value={null}>\n {content}\n </DataGridWindowRowContext.Provider>\n </DataGridWindowContext.Provider>\n </table>\n </div>\n </DataGridFixedLayoutContext.Provider>\n </DataGridResizeContext.Provider>\n </DataGridItemSelectionDisabledContext.Provider>\n </DataGridRowIdContext.Provider>\n </DataGridRowContext.Provider>\n </DataGridItemsContext.Provider>\n </DataGridSortContext.Provider>\n </DataGridContext.Provider>\n );\n}\nDataGridRoot.displayName = 'DataGrid';\n\n/**\n * The row of one item of `items`, under its row id. Memoised, so a grid that renders again (a\n * sort, a parent update) renders the row again only when its item, its index, its\n * `isSelectionDisabled`, the render function or, in a windowed grid, its place change.\n */\nconst DataGridItemRow = React.memo(function DataGridItemRow({\n item,\n index,\n rowId,\n selectionDisabled,\n render,\n position,\n ariaRowIndex,\n height,\n}: {\n item: unknown;\n index: number;\n rowId: string;\n /** `isSelectionDisabled` of the item; `undefined` without it. */\n selectionDisabled: boolean | undefined;\n render: DataGridRenderRow;\n /** In a windowed grid: the row's position in the sorted order (`undefined` without a window). */\n position?: number;\n /** In a windowed grid: the row's `aria-rowindex`. */\n ariaRowIndex?: number;\n /** In a windowed grid: the row's height (the window's `itemSize`). */\n height?: number;\n}) {\n const windowRow = React.useMemo<DataGridWindowRow | null>(\n () =>\n position === undefined || ariaRowIndex === undefined\n ? null\n : { index: position, ariaRowIndex, height },\n [position, ariaRowIndex, height],\n );\n return (\n <DataGridRowIdContext.Provider value={rowId}>\n <DataGridItemSelectionDisabledContext.Provider value={selectionDisabled}>\n <DataGridWindowRowContext.Provider value={windowRow}>\n {render(item, index)}\n </DataGridWindowRowContext.Provider>\n </DataGridItemSelectionDisabledContext.Provider>\n </DataGridRowIdContext.Provider>\n );\n});\n\n/**\n * The grid's `<tbody>`. Its child can also be a render function, called with each item of the\n * grid's `items` (and its index there) to render the item's row; without children, a grid with\n * `items` and `columns` renders the rows from the columns. In a grid with a `virtualWindow` it\n * renders the rows of the window, the function being called for those rows only, and a spacer\n * row for each run of rows it leaves out.\n */\nconst DataGridBody = <T,>({ children, className, ref, ...rest }: DataGridBodyProps<T>) => {\n const itemsContext = React.useContext(DataGridItemsContext);\n const windowContext = React.useContext(DataGridWindowContext);\n const rows = itemsContext?.rows ?? null;\n const hasRenderFunction = typeof children === 'function';\n\n const renderWithoutItems = hasRenderFunction && rows === null;\n React.useEffect(() => {\n if (renderWithoutItems) {\n warnOnce(\n 'DataGrid.Body:render-without-items',\n \"DataGrid.Body: a render function child renders one row per item of the DataGrid's \" +\n '`items`, which is not set, so the body has no rows.',\n );\n }\n }, [renderWithoutItems]);\n\n const selectionDisabled = itemsContext?.selectionDisabled ?? null;\n const renderRows = (render: DataGridRenderRow | null) => {\n if (!render || !rows) return null;\n if (windowContext) {\n // The rows of the window, at their place in the sorted order (after the header rows).\n const { headerRowCount, virtualWindow } = windowContext;\n return renderWindowRows(windowContext, rows.length, (position) => {\n const row = rows[position];\n return (\n <DataGridItemRow\n key={`row:${row.key}`}\n item={row.item}\n index={row.index}\n rowId={row.rowId}\n selectionDisabled={selectionDisabled?.[row.index]}\n render={render}\n position={position}\n ariaRowIndex={position + headerRowCount + 1}\n height={virtualWindow.itemSize}\n />\n );\n });\n }\n return rows.map((row) => (\n <DataGridItemRow\n key={row.key}\n item={row.item}\n index={row.index}\n rowId={row.rowId}\n selectionDisabled={selectionDisabled?.[row.index]}\n render={render}\n />\n ));\n };\n\n let content: React.ReactNode;\n if (typeof children === 'function') {\n // The items are the grid's `T`, which the body cannot see: its own `T` types the function.\n content = renderRows(children as DataGridRenderRow);\n } else if (children === undefined) {\n content = renderRows(itemsContext?.renderColumnsRow ?? null);\n } else {\n content = children;\n }\n\n return (\n <DataGridSectionContext.Provider value=\"body\">\n <tbody ref={ref} className={cn(dataGridBodyClassNames.root, className)} {...rest}>\n {content}\n </tbody>\n </DataGridSectionContext.Provider>\n );\n};\nDataGridBody.displayName = 'DataGridBody';\n\n/**\n * A grid row. In a selectable grid it starts with a selection cell (checkbox or radio) named\n * after the row's first cell (or `selectionLabel`), unless a `DataGrid.SelectionCell` child is\n * its selection cell; Space on one of its cells toggles the row, and so does a click on the row\n * with the grid's `selectOnRowClick`.\n *\n * The row is the `group/table-row` group whose hover or focus draws a subtle selection control\n * (`subtleSelection`) and the `Table.CellActions` of its cells. A group is matched by any\n * ancestor, so the rows of a grid nested in a cell\n * share it: hovering the outer row also draws the subtle controls of the nested grid (a limit of\n * CSS groups). A Tree in a cell keeps its own rows' group.\n *\n * In a grid with a `virtualWindow`, a row rendered for an item has the window's `itemSize` as its\n * height (its own `style` height loses) and carries `aria-rowindex` and `data-row-index`; a header\n * row carries `aria-rowindex`.\n */\nconst DataGridRow = ({\n rowId: rowIdProp,\n selectionLabel,\n selectionCellProps,\n children,\n className,\n style,\n onClick,\n onKeyDown,\n ref,\n ...rest\n}: DataGridRowProps) => {\n const { selectionMode, store, toggleRow, selectOnRowClick, selectionAppearance } =\n useDataGridContext('DataGrid.Row');\n // In a windowed grid: the row's place (and, for a body row, its fixed height).\n const windowRow = React.useContext(DataGridWindowRowContext);\n // A row rendered for an item of `items` defaults to the item's row id.\n const itemRowId = React.useContext(DataGridRowIdContext);\n const rowId = rowIdProp ?? itemRowId ?? undefined;\n const section = React.useContext(DataGridSectionContext);\n const firstHeaderRowHint = React.useContext(DataGridHeaderRowHintContext);\n const inHeader = section === 'header';\n const selectable = selectionMode !== 'none' && !inHeader;\n const labelId = useId('wave-datagrid-row-label');\n\n // The children are always flattened (Fragments too) and rendered under their flattened keys,\n // whatever the mode, so the keys stay the same when `selectionMode`, `selectionLabel` or `rowId`\n // change and the cells are not remounted.\n const flatChildren = flattenChildren(children);\n // A DataGrid.SelectionCell child is the row's selection cell; its own props win.\n let ownCellProps: DataGridSelectionCellProps | undefined;\n for (const { node } of flatChildren) {\n if (isSelectionCellElement(node)) {\n ownCellProps = node.props;\n break;\n }\n }\n const hasSelectionCell = ownCellProps !== undefined;\n // A row rendered for an item takes `isSelectionDisabled` of the item, unless its cell says.\n const itemSelectionDisabled = React.useContext(DataGridItemSelectionDisabledContext);\n const cellDisabled = ownCellProps?.disabled ?? selectionCellProps?.disabled;\n const selectionDisabled = cellDisabled ?? itemSelectionDisabled ?? false;\n const selectionInvisible = ownCellProps?.invisible ?? selectionCellProps?.invisible ?? false;\n const ownLabelledBy = ownCellProps?.['aria-labelledby'];\n const ownLabel =\n ownCellProps?.['aria-label'] ?? selectionCellProps?.['aria-label'] ?? selectionLabel;\n\n const single = selectionMode === 'single';\n const getSelected = React.useCallback(\n () => rowId !== undefined && store.isSelected(rowId, single),\n [rowId, store, single],\n );\n // Notified only when the selection changes (in multiple mode, rows registering notify no row).\n const isSelected = React.useSyncExternalStore(store.subscribe, getSelected, getSelected);\n\n React.useLayoutEffect(() => {\n if (rowId === undefined || inHeader) return;\n const unregister = store.register(rowId);\n if (isDev && store.countRegistrations(rowId) > 1) warnDuplicateRowId(rowId);\n return unregister;\n }, [store, rowId, inHeader]);\n\n // A row whose selection is disabled is left out of select-all.\n React.useLayoutEffect(() => {\n if (rowId === undefined || inHeader || !selectionDisabled) return;\n return store.disable(rowId);\n }, [store, rowId, inHeader, selectionDisabled]);\n\n React.useEffect(() => {\n if (selectable && rowId === undefined) {\n warnOnce(\n 'DataGrid.Row:missing-rowId',\n 'DataGrid.Row: a selectable grid needs a `rowId` on every row; this row has no selection control.',\n );\n }\n }, [selectable, rowId]);\n\n const disabledMismatch =\n selectable &&\n rowId !== undefined &&\n itemSelectionDisabled !== undefined &&\n cellDisabled !== undefined &&\n cellDisabled !== itemSelectionDisabled;\n React.useEffect(() => {\n if (!disabledMismatch) return;\n const state = (disabled: boolean) => (disabled ? 'disabled' : 'enabled');\n warnOnce(\n 'DataGrid:selection-disabled-mismatch',\n `DataGrid: the selection cell of row \"${rowId}\" is ${state(selectionDisabled)} (\\`DataGrid.SelectionCell disabled\\` or \\`selectionCellProps.disabled\\`), but \\`isSelectionDisabled\\` says its item is ${state(!selectionDisabled)}. Select-all skips a row that either one disables, and the row's control follows its cell: make them agree, or leave the cell's \\`disabled\\` unset to take it from \\`isSelectionDisabled\\`.`,\n );\n }, [disabledMismatch, rowId, selectionDisabled]);\n\n // With `items`, select-all uses the ids from `getRowId`: a row with another id is outside it.\n const ownRowIdDiffers =\n selectable && rowIdProp !== undefined && itemRowId !== null && rowIdProp !== itemRowId;\n React.useEffect(() => {\n if (ownRowIdDiffers) {\n warnOnce(\n 'DataGrid.Row:row-id-mismatch',\n \"DataGrid.Row: a row rendered from the grid's `items` sets its own `rowId`, which differs from its item's id (`getRowId`, by default the item's index). Select-all and its checkbox use the ids from `getRowId`, so the row is outside them and select-all selects ids that no row has. Pass a `getRowId` that returns the row's id, and leave out `rowId`.\",\n );\n } else if (\n selectable &&\n rowId !== undefined &&\n itemRowId === null &&\n store.isOutsideUniverse(rowId)\n ) {\n // A `DataGrid.Row` child of a grid with `items` (not rendered for an item).\n warnOnce(\n 'DataGrid.Row:row-id-outside-items',\n \"DataGrid.Row: a selectable row in a grid with `items` has a `rowId` that is no item's id (`getRowId`, by default the item's index). Select-all and its checkbox use the ids of `items`, so the row is outside them. Render the rows from `items` (a `DataGrid.Body` render function, or `columns`) with a `getRowId` that returns their ids.\",\n );\n }\n }, [ownRowIdDiffers, selectable, rowId, itemRowId, store]);\n\n const unlabelled =\n selectable && rowId !== undefined && ownLabel === undefined && ownLabelledBy === undefined;\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTableRowElement>) => {\n if (!selectable || rowId === undefined || event.key !== ' ') return;\n const target = event.target as Element;\n // Only keys pressed on the row itself or on one of its own cells, never on a nested widget.\n if (target !== event.currentTarget && target.parentElement !== event.currentTarget) return;\n // A row whose selection is disabled takes the key too (no page scroll), and stays as it is.\n event.preventDefault();\n if (!selectionDisabled) toggleRow(rowId, event.nativeEvent);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLTableRowElement>) => {\n if (!selectOnRowClick || !selectable || rowId === undefined || selectionDisabled) return;\n const row = event.currentTarget;\n // The row's own cells carry the grid's tabindex; they are not widgets nested in the row.\n const nested = isForeignEvent(event, { isOwnPart: (element) => element.parentElement === row });\n if (nested || endsTextSelection(event)) return;\n toggleRow(rowId, event.nativeEvent);\n };\n\n // Name the selection control after the first cell (its own id, or a generated one).\n let labelledBy: string | undefined;\n let idCellIndex = -1;\n if (unlabelled) {\n const firstCellIndex = flatChildren.findIndex(({ node }) =>\n isElementOfType(node, DataGridCell, 'td', 'th'),\n );\n if (firstCellIndex >= 0) {\n const firstCell = flatChildren[firstCellIndex].node as React.ReactElement<{ id?: string }>;\n labelledBy = firstCell.props.id ?? labelId;\n if (firstCell.props.id === undefined) idCellIndex = firstCellIndex;\n }\n }\n const content = flatChildren.map(({ key, node }, index) =>\n renderFlatChild({\n key,\n node:\n index === idCellIndex\n ? React.cloneElement(node as React.ReactElement<{ id?: string }>, { id: labelId })\n : node,\n }),\n );\n\n const needsLabel = unlabelled && labelledBy === undefined;\n React.useEffect(() => {\n if (needsLabel) {\n warnOnce(\n 'DataGrid.Row:selection-label',\n 'DataGrid.Row: no child is a `DataGrid.Cell`, `<td>` or `<th>` element, so the row selection control is named \"Select row\". Pass `selectionLabel` (a cell rendered by another component is not seen).',\n );\n }\n }, [needsLabel]);\n\n // The selection control's name: the cell's own, else the row's first cell, else \"Select row\".\n const controlLabelledBy = ownLabelledBy ?? labelledBy;\n const controlLabel = ownLabel ?? (controlLabelledBy === undefined ? 'Select row' : undefined);\n\n const rowContext = React.useMemo<DataGridRowContextValue>(\n () => ({\n selectionCellProps,\n hasSelectionCell,\n rowId: selectable ? rowId : undefined,\n isSelected,\n disabled: selectionDisabled,\n invisible: selectionInvisible,\n ariaLabel: controlLabel,\n ariaLabelledBy: controlLabelledBy,\n }),\n [\n selectionCellProps,\n hasSelectionCell,\n selectable,\n rowId,\n isSelected,\n selectionDisabled,\n selectionInvisible,\n controlLabel,\n controlLabelledBy,\n ],\n );\n\n // The automatic selection cell, first; a DataGrid.SelectionCell child renders it where it stands.\n let selectionCellElement: React.ReactNode = null;\n if (!hasSelectionCell && inHeader && selectionMode !== 'none') {\n selectionCellElement = (\n <DataGridSelectionHeaderSlot\n selectionMode={selectionMode}\n initialFirst={firstHeaderRowHint}\n cellProps={selectionCellProps}\n />\n );\n } else if (!hasSelectionCell && selectable) {\n selectionCellElement = <DataGridBodySelectionCell component=\"DataGrid.Row\" />;\n }\n\n return (\n <DataGridRowContext.Provider value={rowContext}>\n <tr\n ref={ref}\n className={cn(\n dataGridRowClassNames.root,\n // The group whose hover or focus draws a subtle selection control (its own name: a\n // Tree in a cell keys its actions on its rows' `group/row`).\n 'group/table-row',\n !inHeader && BODY_ROW_CLASSES[selectionAppearance],\n selectable && isSelected && forcedColors.selectedContainer,\n className,\n )}\n aria-selected={selectable ? isSelected : undefined}\n data-selected={selectable && isSelected ? '' : undefined}\n {...rest}\n // The window lays the rows out at its row height and finds them by their index.\n style={windowRow?.height === undefined ? style : { ...style, height: windowRow.height }}\n {...(windowRow && {\n 'aria-rowindex': windowRow.ariaRowIndex,\n 'data-row-index': windowRow.index,\n })}\n onClick={composeEventHandlers(onClick, handleClick)}\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n >\n {selectionCellElement}\n {content}\n </tr>\n </DataGridRowContext.Provider>\n );\n};\nDataGridRow.displayName = 'DataGridRow';\n\n/** Props of {@link DataGridBodySelectionCell}: the cell's own, without what the row resolved. */\ninterface DataGridBodySelectionCellProps extends Omit<\n DataGridSelectionCellProps,\n 'disabled' | 'invisible' | 'aria-label' | 'aria-labelledby'\n> {\n /** The public name of the part that renders the cell, for the context errors. */\n component: string;\n /** The root class of `DataGrid.SelectionCell`, when the cell is one. */\n stableClassName?: string;\n}\n\n/**\n * The selection cell of a body row (internal): the row's checkbox (multiple mode) or radio (single\n * mode), the automatic first cell or a `DataGrid.SelectionCell`. Its state, `disabled`,\n * `invisible` and name come from the row.\n */\nfunction DataGridBodySelectionCell({\n component,\n stableClassName,\n className,\n controlRef,\n 'aria-describedby': ariaDescribedBy,\n ref,\n ...rest\n}: DataGridBodySelectionCellProps) {\n const { selectionMode, toggleRow, radioName, subtleSelection } = useDataGridContext(component);\n const row = useDataGridRowContext(component);\n // A body row of a windowed grid has the window's height: no block padding, the control centred.\n const windowedRow = React.useContext(DataGridWindowRowContext)?.index !== undefined;\n const { rowId } = row;\n const single = selectionMode === 'single';\n return (\n <td\n role=\"gridcell\"\n {...rest}\n ref={ref}\n data-selection-cell=\"\"\n className={cn(\n stableClassName,\n dataGridRowClassNames.selectionCell,\n SELECTION_CELL_CLASSES,\n windowedRow && 'py-0 align-middle',\n focusRingInset,\n row.selectionCellProps?.className,\n className,\n )}\n >\n {rowId !== undefined && selectionMode !== 'none' && (\n <TableSelectionControl\n ref={controlRef}\n type={single ? 'radio' : 'checkbox'}\n name={single ? radioName : undefined}\n // The shared name groups the radios. `form=\"\"` matches no form, so they have no form\n // owner (still one group: same name, both ownerless) and never add a generated field\n // to an enclosing form's submission.\n form={single ? '' : undefined}\n checked={row.isSelected}\n disabled={row.disabled}\n invisible={row.invisible}\n subtle={subtleSelection}\n onChange={(event) => toggleRow(rowId, event.nativeEvent)}\n aria-label={row.ariaLabel}\n aria-labelledby={row.ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n className={dataGridRowClassNames.selectionControl}\n />\n )}\n </td>\n );\n}\n\n/**\n * The selection cell of a row, rendered where it stands among the row's cells (the row and the\n * header then add none of their own). In a header row it is the select-all checkbox (multiple\n * mode; the \"Selection\" header text in single mode), the first header row's only, as the\n * automatic cell; in a body row (a `DataGrid.Row`) the row's checkbox or radio. It takes the\n * selection cell props of its row (`selectionCellProps`), its own winning. `aria-label`,\n * `aria-labelledby` and `aria-describedby` go to the control; the other props, `className` and\n * `ref` to the cell. In a grid without selection it renders nothing (with a development warning).\n * In a body row of a grid with a `virtualWindow` it has no vertical padding (the row has the\n * window's height) and its control is centred.\n */\nconst DataGridSelectionCell = ({\n disabled,\n invisible,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n controlRef,\n ref,\n ...rest\n}: DataGridSelectionCellProps) => {\n const { selectionMode } = useDataGridContext('DataGrid.SelectionCell');\n const section = React.useContext(DataGridSectionContext);\n const firstHeaderRowHint = React.useContext(DataGridHeaderRowHintContext);\n const row = React.useContext(DataGridRowContext);\n const notSelectable = selectionMode === 'none';\n // A DataGrid.Row that did not see this cell among its children added its own cell too.\n const unseen = !notSelectable && row !== null && !row.hasSelectionCell;\n\n React.useEffect(() => {\n if (notSelectable) {\n warnOnce(\n 'DataGrid.SelectionCell:not-selectable',\n 'DataGrid.SelectionCell: the grid has no row selection (`selectionMode` is \"none\"), so the ' +\n 'cell renders nothing. Set `selectionMode` on the DataGrid, or remove the cell.',\n );\n }\n }, [notSelectable]);\n\n React.useEffect(() => {\n if (unseen) {\n warnOnce(\n 'DataGrid.SelectionCell:unseen',\n 'DataGrid.SelectionCell: rendered by another component, so its DataGrid.Row did not see ' +\n 'it and added its own selection cell. Render DataGrid.SelectionCell as a child of ' +\n 'DataGrid.Row (a Fragment is fine).',\n );\n }\n }, [unseen]);\n\n if (notSelectable) return null;\n if (section === 'header') {\n const rowProps = row?.selectionCellProps;\n return (\n <DataGridSelectionHeaderSlot\n ref={ref}\n selectionMode={selectionMode}\n initialFirst={firstHeaderRowHint}\n stableClassName={dataGridSelectionCellClassNames.root}\n cellProps={{\n ...rest,\n className: cn(rowProps?.className, className),\n disabled: disabled ?? rowProps?.disabled,\n invisible: invisible ?? rowProps?.invisible,\n 'aria-label': ariaLabel ?? rowProps?.['aria-label'],\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n controlRef,\n }}\n />\n );\n }\n return (\n <DataGridBodySelectionCell\n {...rest}\n ref={ref}\n component=\"DataGrid.SelectionCell\"\n stableClassName={dataGridSelectionCellClassNames.root}\n className={className}\n controlRef={controlRef}\n aria-describedby={ariaDescribedBy}\n />\n );\n};\nDataGridSelectionCell.displayName = 'DataGridSelectionCell';\nmarkTablePart(DataGridSelectionCell, 'dataGridSelectionCell');\n\n/**\n * A grid cell (`<td>`), focusable through the grid's keyboard navigation. It is the positioning\n * box of a `Table.CellActions` inside it. In a grid that lays its columns out from widths (column\n * sizing, a `virtualWindow`), its text stays on one line and is truncated with an ellipsis, unless\n * its class says otherwise. In a body row of a grid with a `virtualWindow` it has no vertical\n * padding: the row has the window's height, which its content must fit in.\n */\nconst DataGridCell = ({ children, className, ref, ...rest }: DataGridCellProps) => {\n const fixedLayout = React.useContext(DataGridFixedLayoutContext);\n // A body row of a windowed grid has the window's height: its cells add no vertical padding.\n const windowedRow = React.useContext(DataGridWindowRowContext)?.index !== undefined;\n return (\n <td\n ref={ref}\n role=\"gridcell\"\n className={cn(\n dataGridCellClassNames.root,\n cellBase,\n 'relative text-body-1',\n (fixedLayout || windowedRow) && 'overflow-hidden text-ellipsis whitespace-nowrap',\n windowedRow && 'py-0 align-middle',\n focusRingInset,\n className,\n )}\n {...rest}\n >\n {children}\n </td>\n );\n};\nDataGridCell.displayName = 'DataGridCell';\n\nexport {\n DataGridHeader,\n DataGridHeaderCell,\n DataGridBody,\n DataGridRow,\n DataGridCell,\n DataGridSelectionCell,\n};\n\n/**\n * An interactive data table (`role=\"grid\"`) following the APG Grid pattern: one tab stop,\n * arrow-key navigation between cells (Home/End, Ctrl+Home/Ctrl+End, PageUp/PageDown; Up/Down keep\n * the visual column, so a grouped header with spanning cells works), Enter/F2 to interact with a\n * cell's widgets and Escape to return to the cell. A composite widget in a cell (a Toolbar,\n * RadioGroup, TabList, …) is entered with Enter/F2 like a text field; it manages its own tab\n * indexes, so it keeps its own Tab stop. Supports sortable columns (`onSortChange` reports the new\n * sort; a grid with `items` orders its rows by the sorted column's `compare`, otherwise the consumer\n * orders them) and single or multiple row selection with a select-all header checkbox.\n *\n * Selection is made with the row's control, Space on a cell, and, with `selectOnRowClick`, a\n * click on the row. `selectionAppearance` picks the fill of a selected row, `subtleSelection`\n * hides the unchecked controls until their row (or, for select-all, the grid) is hovered or holds\n * focus, and a row's `selectionCellProps` disables, hides or names its control. The selection\n * column comes first; a `DataGrid.SelectionCell` places it elsewhere in a row.\n *\n * The grid is composed from its parts, or rendered from data: with `items` and typed `columns`\n * (`DataGridColumn<T>`, see `createTableColumn`) it renders the header, the rows and the cells\n * itself, and `DataGrid.Body` also takes a render function that returns each item's row. Rows\n * rendered from `items` take their `rowId` from `getRowId` (by default the item's index).\n *\n * With `items`, selection follows the data rather than the rendered rows: select-all and its\n * checkbox cover every item (`isSelectionDisabled` leaves items out), and ids of rows that are\n * filtered out, on another page or not rendered stay selected through row clicks, select-all and\n * sorting, and are reported by `onSelectedItemsChange`.\n *\n * With `items` and `columns`, the columns can be sized: `resizableColumns` gives each column\n * header a resize handle (a separator that a pointer drags and the arrow keys move, mirrored in\n * right-to-left grids; F2 on a column header moves focus to it, and Enter, Space or Escape back),\n * `columnSizingOptions` sets each column's initial and minimum width, and `columnWidths` or\n * `defaultColumnWidths` with `onColumnWidthsChange(widths, details)` hold the widths, for\n * instance to persist them (Fluent's `resizableColumns`, `columnSizingOptions` and\n * `onColumnResize`, whose data is in `details`). The grid then lays its columns out from the\n * widths and truncates its cells' text.\n *\n * With `items` and `columns`, a `virtualWindow` (from `useVirtualWindow`) renders only the rows in\n * view of a long list, with spacer rows for the others: the scroll wrapper (`containerProps`)\n * needs a bounded height, and every row has the window's fixed row height. The header stays at\n * the top of the wrapper, the keyboard moves by the data (a row that is not rendered is scrolled\n * in before it gets focus), the focused row stays rendered, and selection, select-all, sorting\n * and column sizing still cover every item. The grid then carries `aria-rowcount` and its rows\n * `aria-rowindex`, so assistive technology reads each row's place in the whole list. Fluent's\n * DataGrid has no built-in counterpart.\n *\n * Sub-components are available as `DataGrid.Header`, `DataGrid.HeaderCell`, `DataGrid.Body`,\n * `DataGrid.Row`, `DataGrid.Cell` and `DataGrid.SelectionCell` in client components, and as the\n * flat exports `DataGridHeader`, `DataGridHeaderCell`, `DataGridBody`, `DataGridRow`,\n * `DataGridCell` and `DataGridSelectionCell` (the form React Server Components can import).\n */\nexport const DataGrid = /* @__PURE__ */ Object.assign(DataGridRoot, {\n Header: DataGridHeader,\n HeaderCell: DataGridHeaderCell,\n Body: DataGridBody,\n Row: DataGridRow,\n Cell: DataGridCell,\n SelectionCell: DataGridSelectionCell,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiqBA,IAAMG,KAAiC,CAAC,GAClCC,KAAiD,CAAC;AAExD,SAASC,EACP,GAC+B;CAC/B,OAAOC,MAAS,KAAA,IAAY,KAAA,IAAY,MAAM,KAAKA,CAAI;AACzD;AAEA,SAASC,GAAU,GAAsB,GAA+B;CACtE,OAAOC,EAAE,WAAWC,EAAE,UAAUD,EAAE,OAAO,GAAM,MAAUE,MAASD,EAAEE,EAAM;AAC5E;AAOA,SAASC,GACP,GACA,GACA,GACmB;CACnB,IAAIC,EAAW,WAAW,GAAG,OAAOC;CACpC,IAAMC,IAAU,IAAI,IAAID,CAAQ,GAE1BE,IAAOC,EAAmBF,GAASF,CAAU,CAAC,CAAC,MACjDK,EAASH,GAASF,CAAU,IAC5BM,EAAaJ,GAASF,CAAU,GAC9BO,IAAa,IAAI,IAAIC,CAAQ;CACnC,OAAO,CACL,GAAG,MAAM,KAAKL,CAAI,CAAC,CAAC,QAAQ,MAAO,CAACI,EAAW,IAAIE,CAAE,CAAC,GACtD,GAAGD,EAAS,QAAQ,MAAOL,EAAK,IAAIM,CAAE,CAAC,CACzC;AACF;AAGA,SAASC,GAAgB,EAAE,QAAK,WAAiE;CAC/F,OAAO,kBAACrB,EAAM,UAAP,EAAA,UAA2BsB,EAAqB,GAA3BC,CAA2B;AACzD;AAMA,SAASC,GAAgB,GAAmC;CAC1D,OAAOC,EAAgBC,CAAQ,CAAC,CAAC,QAAQ,EAAE,cAAW1B,EAAM,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