@planningcenter/tapestry 4.4.1-rc.6 → 4.5.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DataTable/DataTable.d.ts +6 -1
- package/dist/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/DataTable/DataTable.js +8 -3
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/SelectAllBanner.d.ts +13 -0
- package/dist/components/DataTable/SelectAllBanner.d.ts.map +1 -0
- package/dist/components/DataTable/SelectAllBanner.js +40 -0
- package/dist/components/DataTable/SelectAllBanner.js.map +1 -0
- package/dist/components/DataTable/useDataTableSelection.d.ts +3 -0
- package/dist/components/DataTable/useDataTableSelection.d.ts.map +1 -1
- package/dist/components/DataTable/useDataTableSelection.js +15 -6
- package/dist/components/DataTable/useDataTableSelection.js.map +1 -1
- package/dist/components/dropdown/Dropdown.d.ts +19 -6
- package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/Dropdown.js +9 -2
- package/dist/components/dropdown/Dropdown.js.map +1 -1
- package/dist/reactRender.css +1179 -1160
- package/dist/reactRender.css.map +1 -1
- package/dist/reactRenderLegacy.css +1179 -1160
- package/dist/reactRenderLegacy.css.map +1 -1
- package/dist/unstable.css +19 -0
- package/dist/unstable.css.map +1 -1
- package/package.json +2 -2
|
@@ -128,7 +128,9 @@ interface DataTableBaseProps {
|
|
|
128
128
|
* uses the length of `data`. Use this when the table renders only part of
|
|
129
129
|
* the result set — a paginated or virtualized table — so the count reflects
|
|
130
130
|
* the whole set. It also sizes an all-pages selection when
|
|
131
|
-
* `canSelectAllPages` is true, including the count used by table actions
|
|
131
|
+
* `canSelectAllPages` is true, including the count used by table actions and
|
|
132
|
+
* the select-all banner. Without a result count, the banner isn't offered
|
|
133
|
+
* because the table can't accurately describe the all-pages selection.
|
|
132
134
|
* Otherwise, it has no effect unless `resultNoun` is set.
|
|
133
135
|
*/
|
|
134
136
|
resultCount?: number;
|
|
@@ -217,6 +219,9 @@ interface DataTableAllPagesSelectionProps {
|
|
|
217
219
|
/**
|
|
218
220
|
* Enables tagged selection values that can represent every page plus
|
|
219
221
|
* exclusions. Explicit arrays and the header checkbox remain page-scoped.
|
|
222
|
+
* When `resultCount` proves more selectable results exist, selecting the
|
|
223
|
+
* loaded page reveals a banner that widens the selection to every page or
|
|
224
|
+
* clears it again. This works with both paged and indexed pagination.
|
|
220
225
|
*/
|
|
221
226
|
canSelectAllPages: true;
|
|
222
227
|
/** Called with the current explicit or all-pages selection. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AACd,OAAO,EASL,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGxD,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAKpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AACd,OAAO,EASL,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAA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BAAiB,CAAC,EAAE,KAAK,CAAA;IACzB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,IAAI,CAAA;IACtD,6BAA6B;IAC7B,YAAY,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IAClC,mEAAmE;IACnE,YAAY,CAAC,EAAE,WAAW,EAAE,CAAA;CAC7B;AAED,UAAU,+BAA+B;IACvC;;;;;;OAMG;IACH,iBAAiB,EAAE,IAAI,CAAA;IACvB,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAC1D;;;;OAIG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAA;IACjC,mEAAmE;IACnE,YAAY,CAAC,EAAE,WAAW,CAAC,kBAAkB,CAAC,EAAE,CAAA;CACjD;AAED,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAC7C,CAAC,+BAA+B,GAAG,+BAA+B,CAAC,CAAA;AAIrE,KAAK,oBAAoB,GAAG,UAAU,GAAG,MAAM,CAAA;AAE/C,KAAK,uBAAuB,GAAG,KAAK,CAAA;AAEpC,MAAM,MAAM,qBAAqB,GAAG,+BAA+B,CACjE,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,uBAAuB,CACxB,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,SAAS;qiBAqCnB,qBAAqB;;CAqTvB,CAAA"}
|
|
@@ -10,6 +10,7 @@ import { prepareColumn } from './DataTableColumnTypes.js';
|
|
|
10
10
|
import { getRowKey } from './DataTableRow.js';
|
|
11
11
|
import { hasResultsCount, resolveResultNounLabel, ResultsCount } from './ResultsCount.js';
|
|
12
12
|
import { RowActions } from './RowActions.js';
|
|
13
|
+
import { SelectAllBanner } from './SelectAllBanner.js';
|
|
13
14
|
import { TableActions } from './TableActions.js';
|
|
14
15
|
import { useColumnVisibility } from './useColumnVisibility.js';
|
|
15
16
|
import { useDataTableSelection, DataTableSelectionContext } from './useDataTableSelection.js';
|
|
@@ -114,11 +115,12 @@ const DataTable = ({ className, canSelectAllPages, columns, currentPage = 1, dat
|
|
|
114
115
|
"tds-data-table--sticky-header": hasScrollContainer,
|
|
115
116
|
}) },
|
|
116
117
|
React__default.createElement("div", { className: "tds-data-table-frame" },
|
|
117
|
-
|
|
118
|
-
React__default.createElement("div", { className: "tds-data-table-frame-header" },
|
|
118
|
+
React__default.createElement(DataTableSelectionContext.Provider, { value: selectionModel },
|
|
119
|
+
showHeader && (React__default.createElement("div", { className: "tds-data-table-frame-header" },
|
|
119
120
|
React__default.createElement(ResultsCount, { id: resultsCountId, resultNoun: resultNoun, selectable: selectable, selectedCount: selectedCount, totalCount: totalCount }),
|
|
120
121
|
hasActions && (React__default.createElement(TableActions, { actions: tableActions, resultNoun: resultNoun })),
|
|
121
|
-
hasViewSettingsToggle && (React__default.createElement(ViewSettingsToggle, { columns: hideableColumns, onColumnVisibilityChange: onColumnVisibilityChange, visibleColumnNames: visibleHideableColumns }))))
|
|
122
|
+
hasViewSettingsToggle && (React__default.createElement(ViewSettingsToggle, { columns: hideableColumns, onColumnVisibilityChange: onColumnVisibilityChange, visibleColumnNames: visibleHideableColumns })))),
|
|
123
|
+
React__default.createElement(SelectAllBanner, { resultNoun: resultNoun })),
|
|
122
124
|
React__default.createElement("div", { ref: wrapperRef, className: "tds-data-table-scroll-wrapper" },
|
|
123
125
|
React__default.createElement("div", { ref: scrollRef, className: "tds-data-table-scroll" },
|
|
124
126
|
React__default.createElement(Table, { ...restProps, ...selectionProps, ...(ariaLabel ? { "aria-label": ariaLabel } : {}), ...(describedBy ? { "aria-describedby": describedBy } : {}), ...{ id: tableId }, className: combinedClassName,
|
|
@@ -227,6 +229,9 @@ function useStickyHeader(stickyHeader, scrollContainerRef, scrollContainerSelect
|
|
|
227
229
|
wrapper.style.setProperty("--_sticky-header-scroll-max", `${max}px`);
|
|
228
230
|
});
|
|
229
231
|
resizeObserver.observe(wrapper);
|
|
232
|
+
// The banner moves the wrapper without changing its size.
|
|
233
|
+
if (wrapper.parentElement)
|
|
234
|
+
resizeObserver.observe(wrapper.parentElement);
|
|
230
235
|
resizeObserver.observe(scrollContainer);
|
|
231
236
|
return () => {
|
|
232
237
|
resizeObserver.disconnect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.js","sources":["../../../src/components/DataTable/DataTable.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { LoadingSpinner } from \"@components/internal\"\nimport { Pagination } from \"@components/internal/pagination\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, {\n type ReactNode,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport {\n Cell,\n Checkbox,\n Column,\n Row,\n type SortDescriptor,\n Table,\n TableBody,\n TableHeader,\n type TableProps as AriaTableProps,\n} from \"react-aria-components/Table\"\n\nimport type { DataTableColumn } from \"./DataTableColumn\"\nimport { prepareColumn, type PreparedColumn } from \"./DataTableColumnTypes\"\nimport { getRowKey } from \"./DataTableRow\"\nimport {\n hasResultsCount,\n resolveResultNounLabel,\n type ResultNoun,\n ResultsCount,\n} from \"./ResultsCount\"\nimport { type RowAction, RowActions } from \"./RowActions\"\nimport { type TableAction, TableActions } from \"./TableActions\"\nimport { useColumnVisibility } from \"./useColumnVisibility\"\nimport {\n type DataTableSelection,\n DataTableSelectionContext,\n useDataTableSelection,\n} from \"./useDataTableSelection\"\nimport { useRowPressBoundary } from \"./useRowPressBoundary\"\nimport { ViewSettingsToggle } from \"./ViewSettingsToggle\"\n\nexport type { DataTableSelection, ResultNoun, RowAction, TableAction }\n\nexport type Sort = { column: string; direction: \"asc\" | \"desc\" }\n\nexport type DataTableLoadingState = \"error\" | \"idle\" | \"loading\"\n\ninterface DataTableBaseProps {\n /**\n * Columns define what data is displayed and how. Pass a stable reference\n * (e.g. a module constant or memoized value); columns are prepared per array\n * identity, so an inline array rebuilds each column's formatter every render.\n */\n columns: DataTableColumn[]\n /**\n * The 1-indexed current page. Only used by the default `\"paged\"` pagination,\n * where `totalPages` is set, and defaults to `1`.\n */\n currentPage?: number\n /** The array of rows to display. */\n data: unknown[]\n /**\n * Row keys that can't be selected. Keys are the values returned by `getRowId`\n * (or `row.id`, or the row's index) — the same keys used by `selectedKeys`.\n * Only selection is disabled: the row's checkbox renders disabled and \"select\n * all\" skips it, while the row itself stays clickable, navigable, and\n * focusable. Has no effect unless the table is `selectable`.\n */\n disabledKeys?: (number | string)[]\n /** Rendered in place of the table body when there is no data. */\n emptyState?: ReactNode\n /** Rendered in place of the table body when `loadingState` is `\"error\"`. */\n errorState?: ReactNode\n /** Returns a stable identity for each row. Defaults to `row.id`. */\n getRowId?: (row: unknown) => number | string\n /**\n * Returns a URL to navigate to when the row is clicked. Rows with a link\n * render as navigable elements (clickable, keyboard-focusable, and\n * openable in a new tab). Works alongside `onRowClick` and `selectable`.\n */\n getRowLink?: (row: unknown) => string\n /**\n * Whether a page exists after the current one. Only used by\n * `paginationType=\"indexed\"`, which has no page count to derive it from;\n * `false` (the default) disables the Next button.\n */\n hasNextPage?: boolean\n /**\n * Whether a page exists before the current one. Only used by\n * `paginationType=\"indexed\"`, which has no page count to derive it from;\n * `false` (the default) disables the Previous button.\n */\n hasPreviousPage?: boolean\n /**\n * An `id` for the table element. When omitted, a stable generated id is used\n * so the results count can be linked to the table via `aria-describedby`.\n */\n id?: string\n /**\n * Async loading state for the table body.\n * - `\"loading\"`: While `data` is empty, replaces the empty state with a\n * centered spinner.\n * - `\"error\"`: While `data` is empty, replaces the empty state with\n * `errorState` (or a default error message).\n * - `\"idle\"` (default): Normal rendering.\n */\n loadingState?: DataTableLoadingState\n /**\n * Called when the Next button is activated. Only used by\n * `paginationType=\"indexed\"`; load the following page's rows and pass them\n * back in through `data` in response.\n */\n onNextPageClick?: () => void\n /**\n * Called with the 1-indexed page the user navigated to. The table doesn't\n * page `data` itself — pass the rows for the new page back in through `data`\n * (and update `currentPage`) in response. Only used by the default `\"paged\"`\n * pagination; the indexed type has no page number to report.\n */\n onPageChange?: (page: number) => void\n /**\n * Called when the Previous button is activated. Only used by\n * `paginationType=\"indexed\"`; load the preceding page's rows and pass them\n * back in through `data` in response.\n */\n onPreviousPageClick?: () => void\n /**\n * Called with the row when it is clicked. Rows with a click handler render\n * as interactive elements (clickable and keyboard-focusable). When\n * `getRowLink` is also set, both run and the row navigates.\n */\n onRowClick?: (row: unknown) => void\n /** Callback invoked when the sort state changes. */\n onSortChange?: (sort: Sort) => void\n /**\n * Called with the full ordered list of visible column names when the\n * visibility toggle changes. Always-visible columns are included, so the\n * value can be passed straight back as `visibleColumnNames`. Column\n * visibility is controlled, so the table only updates once\n * `visibleColumnNames` changes.\n */\n onVisibleColumnNamesChange?: (visibleColumnNames: string[]) => void\n /**\n * Which shape the page controls take, forwarded to the `Pagination` control's\n * `type`.\n * - `\"paged\"` (the default): a numbered run of pages. Driven by `totalPages`,\n * `currentPage`, and `onPageChange`, and rendered only once `totalPages` is\n * set and greater than `1`.\n * - `\"indexed\"`: a labeled Previous/Next pair, for a result set that can only\n * be stepped through — a cursor-paged API, say, which reports whether a\n * neighboring page exists but not how many there are. Driven by\n * `hasPreviousPage`/`hasNextPage` and `onPreviousPageClick`/\n * `onNextPageClick`; `totalPages` and `currentPage` play no part. With no\n * page count there's no threshold to hide the controls below, so they\n * always render — a single page of results shows both buttons disabled.\n */\n paginationType?: \"indexed\" | \"paged\"\n /**\n * Overrides the number shown by the `resultNoun` count, which otherwise\n * uses the length of `data`. Use this when the table renders only part of\n * the result set — a paginated or virtualized table — so the count reflects\n * the whole set. It also sizes an all-pages selection when\n * `canSelectAllPages` is true, including the count used by table actions.\n * Otherwise, it has no effect unless `resultNoun` is set.\n */\n resultCount?: number\n /**\n * Displays the number of results (the length of `data`, or `resultCount`\n * when supplied) above the table, followed by a noun that matches the count.\n * Pass a string to use it as the singular noun and append `\"s\"` for the\n * plural (e.g. `\"result\"` → `\"results\"`), or a `[singular, plural]` tuple to\n * supply an irregular plural explicitly (e.g. `[\"person\", \"people\"]`). Pass\n * `true` to use `\"result\"`.\n * When `false` or omitted, no count is rendered. The count is formatted with\n * `Intl.NumberFormat` and the singular form is used only when the count is\n * exactly `1`. When the table is `selectable` and rows are selected, the\n * count instead reflects the selection as `\"{selected} of {total}\"`, e.g.\n * `\"2 of 100\"`, with a visually-hidden suffix naming the noun so assistive\n * tech reads the unambiguous `\"2 of 100 people selected\"`.\n * The count is linked to the table with `aria-describedby` so\n * screen readers announce it as a description of the table. When a string or\n * `[singular, plural]` tuple is provided, the noun also supplies the table's\n * `aria-label` in its plural form (e.g. `\"items\"` or `\"people\"`) unless an\n * `aria-label` is passed directly, which always takes precedence; `true`\n * never provides a label. The same plural noun also names the pagination\n * landmark (e.g. `\"people table pagination\"`), which otherwise falls back to\n * `\"Pagination\"`.\n */\n resultNoun?: ResultNoun\n /**\n * Displays a sticky column to the right that holds row-scoped actions.\n * Renders as a dropdown with 2+ actions or a single button with one. Each\n * action's `onAction` or `getHref` receives the row.\n */\n rowActions?: RowAction[]\n /** Ref to the scroll container the sticky header should track. Takes priority over `scrollContainerSelector`. Only used when `stickyHeader` is true. */\n scrollContainerRef?: React.RefObject<HTMLElement>\n /** CSS selector for the scroll container the sticky header should track. Only used when `stickyHeader` is true. Defaults to \".content-wrap\" */\n scrollContainerSelector?: string\n /**\n * Enables row selection via checkboxes, including a \"select all\" checkbox in\n * the header for the loaded page. Without a row action (`onRowClick` or\n * `getRowLink`), pressing anywhere in a row toggles the row selection.\n */\n selectable?: boolean\n /** The current sort state for the table. */\n sortBy?: Sort\n /** Enables a sticky header that tracks an outer scroll container. Progressive enhancement: Relies on `animation-timeline: scroll()`, which isn't supported in all browsers (e.g. Firefox) — the header scrolls with the table body instead of sticking in those cases. */\n stickyHeader?: boolean\n /**\n * The number of disabled rows across the whole result set. Used to size an\n * all-pages selection when disabled rows exist on unloaded pages. Replaces\n * the count inferred from `disabledKeys` rather than adding to it. Values are\n * clamped to the result count, and zero is used as supplied.\n */\n totalDisabledCount?: number\n /**\n * The total number of pages in the result set. Setting it renders the page\n * controls below the table; leaving it unset renders no pagination at all.\n * A single page has nothing to navigate to, so the controls only render once\n * there are two or more pages. Only used by the default `\"paged\"` pagination\n * — an indexed result set has no page count, which is the reason to reach for\n * `paginationType=\"indexed\"` in the first place.\n *\n * The table displays whatever rows it is given — paging is the caller's job.\n * `data` should hold only the current page's rows, `resultCount` the size of\n * the whole result set, and `onPageChange` should load the next page.\n */\n totalPages?: number\n /**\n * The names of the columns currently visible. Only columns marked `hideable`\n * are affected — every other column stays visible. Omitting this leaves all\n * columns visible. Unknown names are ignored and display order always\n * follows `columns`.\n */\n visibleColumnNames?: string[]\n}\n\ninterface DataTableExplicitSelectionProps {\n /** Keeps selection values as arrays of row keys. */\n canSelectAllPages?: false\n /** Called with the selected row keys whenever selection changes. */\n onSelectedChange?: (keys: (number | string)[]) => void\n /** The selected row keys. */\n selectedKeys?: (number | string)[]\n /** Table actions whose callbacks receive the selected row keys. */\n tableActions?: TableAction[]\n}\n\ninterface DataTableAllPagesSelectionProps {\n /**\n * Enables tagged selection values that can represent every page plus\n * exclusions. Explicit arrays and the header checkbox remain page-scoped.\n */\n canSelectAllPages: true\n /** Called with the current explicit or all-pages selection. */\n onSelectedChange?: (selection: DataTableSelection) => void\n /**\n * The current explicit or all-pages selection. Use\n * `{ keys: \"all\", excludedKeys: [] }` for every selectable result; a bare\n * `\"all\"` value is not accepted.\n */\n selectedKeys?: DataTableSelection\n /** Table actions whose callbacks receive the current selection. */\n tableActions?: TableAction<DataTableSelection>[]\n}\n\nexport type DataTableProps = DataTableBaseProps &\n (DataTableAllPagesSelectionProps | DataTableExplicitSelectionProps)\n\nconst DEFAULT_ERROR_STATE = \"Something went wrong.\"\n\ntype AriaTablePropsToOmit = \"children\" | \"slot\"\n\ntype AriaTablePropsToInclude = never\n\nexport type DataTableElementProps = CombineAriaPropsWithCustomProps<\n AriaTableProps,\n DataTableProps,\n AriaTablePropsToOmit,\n AriaTablePropsToInclude\n>\n\n/**\n * A table for displaying tabular data. Built on React Aria's `Table`.\n *\n * Each column declares a `type` that controls how its cell values are\n * formatted: `string`, `number`, `currency`, `date`, `datetime`, `boolean`,\n * `enum`, and `custom`. A column's `render` function always takes precedence\n * over the built-in type formatting.\n *\n * Setting `totalPages` renders page controls below the table; the table itself\n * never slices `data`, so `onPageChange` is where the caller loads the page.\n * `paginationType=\"indexed\"` swaps the numbered run for a labeled\n * Previous/Next pair, for a result set with no known page count.\n *\n * Filtering, presets, and other RFC features are not yet implemented.\n *\n * @component\n */\nexport const DataTable = ({\n className,\n canSelectAllPages,\n columns,\n currentPage = 1,\n data,\n disabledKeys,\n emptyState,\n errorState,\n getRowId,\n getRowLink,\n hasNextPage = false,\n hasPreviousPage = false,\n id,\n loadingState = \"idle\",\n paginationType = \"paged\",\n resultCount,\n resultNoun,\n scrollContainerRef,\n scrollContainerSelector = \".content-wrap\",\n rowActions,\n selectable,\n selectedKeys: controlledSelectedKeys,\n stickyHeader,\n sortBy,\n tableActions,\n totalDisabledCount,\n totalPages,\n visibleColumnNames,\n onNextPageClick,\n onPageChange,\n onPreviousPageClick,\n onRowClick,\n onSelectedChange,\n onSortChange,\n onVisibleColumnNamesChange,\n ...restProps\n}: DataTableElementProps) => {\n const hasRowPressAction = Boolean(onRowClick || getRowLink)\n const rowsAreInteractive = hasRowPressAction || Boolean(selectable)\n const combinedClassName = classNames(\"tds-data-table-grid\", className)\n const sortDescriptor = useSortDescriptor(sortBy)\n const { hasScrollContainer, wrapperRef } = useStickyHeader(\n stickyHeader,\n scrollContainerRef,\n scrollContainerSelector\n )\n const scrollRef = useRef<HTMLDivElement>(null)\n // A `Button` or `Link` in a cell keeps its presses to itself, so activating\n // one doesn't also press the row it's in.\n const cellBoundaryProps = useRowPressBoundary(scrollRef, rowsAreInteractive)\n\n // React Aria only invokes `renderEmptyState` when the collection is empty, so\n // the loading spinner and error message only take over the body while `data`\n // is empty; once rows exist they always render.\n const emptyStateContent = getEmptyStateContent({\n emptyState,\n errorState,\n loadingState,\n })\n const renderEmptyState = emptyStateContent\n ? () => emptyStateContent\n : undefined\n\n // Keyed on column names rather than the `columns` array identity so a fresh\n // `columns` literal each render doesn't rebuild every formatter. `columns` is\n // intentionally omitted from the deps.\n const columnKey = columns.map((c) => `${c.name}/${c.type}`).join(\"|\")\n const preparedColumns = useMemo<PreparedColumn[]>(\n () => columns.map(prepareColumn),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [columnKey]\n )\n\n const {\n hideableColumns,\n isColumnVisible,\n onColumnVisibilityChange,\n visibleHideableColumns,\n } = useColumnVisibility({\n columns,\n onVisibleColumnNamesChange,\n visibleColumnNames,\n })\n const visiblePreparedColumns = useMemo(\n () => preparedColumns.filter(({ column }) => isColumnVisible(column)),\n [preparedColumns, isColumnVisible]\n )\n\n const selectionModel = useDataTableSelection({\n canSelectAllPages,\n data,\n disabledKeys,\n getRowId,\n hasRowPressAction,\n onSelectedChange,\n resultCount,\n selectable,\n selectedKeys: controlledSelectedKeys,\n totalDisabledCount,\n })\n const {\n headerCheckboxProps,\n rowPressSelects,\n selectedCount,\n tableProps: selectionProps,\n totalCount,\n } = selectionModel\n\n // Associate the visible results count with the table so screen readers\n // announce it as a description of the table. `Table` doesn't support a real\n // `<caption>` (its children go through a collection builder), so we link the\n // count via `aria-describedby`, merging with any caller-supplied value.\n const stableId = useId()\n const tableId = id || `tds-data-table-${stableId}`\n const resultsCountId = `${tableId}-results-count`\n const describedBy = hasResultsCount(resultNoun)\n ? [restProps[\"aria-describedby\"], resultsCountId].filter(Boolean).join(\" \")\n : restProps[\"aria-describedby\"]\n\n // A caller-supplied `aria-label` always wins; otherwise the results noun\n // provides the table's accessible name so a label is present whenever a noun\n // is given. Array nouns are transformed to their plural form.\n const resultNounLabel = resolveResultNounLabel(resultNoun)\n const ariaLabel = restProps[\"aria-label\"] || resultNounLabel\n const paginationLabel = resultNounLabel\n ? `${resultNounLabel} table pagination`\n : undefined\n\n const hasActions = (tableActions?.length ?? 0) > 0\n const hasViewSettingsToggle = hideableColumns.length > 0\n const showHeader = Boolean(resultNoun || hasActions || hasViewSettingsToggle)\n const hasRowActions = (rowActions?.length ?? 0) > 0\n // A lone page has nothing to navigate to, so the paged controls stay out of\n // the frame entirely rather than rendering a single inert page marker. The\n // indexed type has no page count to measure against — stepping is the only\n // way through the set — so asking for it always renders the controls, and a\n // set that fits on one page shows both buttons disabled.\n const isIndexedPagination = paginationType === \"indexed\"\n const showPagination =\n isIndexedPagination || (totalPages !== undefined && totalPages > 1)\n\n return (\n <div\n className={classNames(\"tds-data-table\", {\n \"tds-data-table--sticky-header\": hasScrollContainer,\n })}\n >\n <div className=\"tds-data-table-frame\">\n {showHeader && (\n <DataTableSelectionContext.Provider value={selectionModel}>\n <div className=\"tds-data-table-frame-header\">\n <ResultsCount\n id={resultsCountId}\n resultNoun={resultNoun}\n selectable={selectable}\n selectedCount={selectedCount}\n totalCount={totalCount}\n />\n {hasActions && (\n <TableActions\n actions={tableActions as TableAction<DataTableSelection>[]}\n resultNoun={resultNoun}\n />\n )}\n {hasViewSettingsToggle && (\n <ViewSettingsToggle\n columns={hideableColumns}\n onColumnVisibilityChange={onColumnVisibilityChange}\n visibleColumnNames={visibleHideableColumns}\n />\n )}\n </div>\n </DataTableSelectionContext.Provider>\n )}\n <div ref={wrapperRef} className=\"tds-data-table-scroll-wrapper\">\n <div ref={scrollRef} className=\"tds-data-table-scroll\">\n <Table\n {...restProps}\n {...selectionProps}\n {...(ariaLabel ? { \"aria-label\": ariaLabel } : {})}\n {...(describedBy ? { \"aria-describedby\": describedBy } : {})}\n // RAC's `Table` forwards `id` to the underlying table element at\n // runtime (via `filterDOMProps({ global: true })`) but omits `id`\n // from its prop types, so spread it through a cast.\n {...({ id: tableId } as Partial<AriaTableProps>)}\n className={combinedClassName}\n // Pinned rather than exposed as a prop: `disabledKeys` only ever\n // turns off selection here, leaving the row clickable and\n // focusable. React Aria defaults this to \"all\", which would also\n // disable `onRowClick`/`getRowLink` and drop the row out of the\n // focus order, so it has to be set explicitly.\n disabledBehavior=\"selection\"\n disabledKeys={disabledKeys}\n sortDescriptor={sortDescriptor}\n onSortChange={(sort) => {\n onSortChange?.(serializeSort(sort))\n }}\n >\n <TableHeader className=\"tds-data-table-header\">\n {/*\n Rendered as a sibling before the `preparedColumns.map` below\n (not folded into it) so the map's `index` still starts at 0\n for the first *data* column — that's what keeps\n `isRowHeader={index === 0}` pointing at the first data\n column instead of this selection column.\n */}\n {selectable && (\n <Column className=\"tds-data-table-column tds-data-table-column--selectable\">\n {headerCheckboxProps ? (\n <Checkbox\n {...headerCheckboxProps}\n aria-label=\"Select all\"\n slot={null}\n className=\"tds-data-table-selectable-checkbox\"\n />\n ) : (\n <Checkbox\n slot=\"selection\"\n className=\"tds-data-table-selectable-checkbox\"\n />\n )}\n </Column>\n )}\n {visiblePreparedColumns.map(({ align, column }, index) => (\n <Column\n key={column.name}\n id={column.name}\n isRowHeader={index === 0}\n className={classNames(\"tds-data-table-column\", {\n [`tds-data-table-column--align-${align}`]:\n align !== \"start\",\n })}\n allowsSorting={column.sortable}\n >\n {column.hideLabel ? (\n <span className=\"tds-data-table-column-label--hidden\">\n {column.headerLabel}\n </span>\n ) : (\n column.headerLabel\n )}\n {column.sortable && (\n <Icon\n className=\"tds-data-table-column-icon tds-data-table-column-icon--sort\"\n symbol=\"general#up-caret\"\n aria-hidden={true}\n />\n )}\n </Column>\n ))}\n {hasRowActions && (\n <Column className=\"tds-data-table-column tds-data-table-column--actions\">\n <span className=\"tds-data-table-column-label--hidden\">\n Actions\n </span>\n </Column>\n )}\n </TableHeader>\n <TableBody\n className=\"tds-data-table-body\"\n renderEmptyState={renderEmptyState}\n >\n {data.map((row, rowIndex) => {\n const rowKey = getRowKey(row, rowIndex, getRowId)\n return (\n <Row\n key={rowKey}\n id={rowKey}\n href={getRowLink?.(row)}\n onAction={onRowClick ? () => onRowClick(row) : undefined}\n className={classNames(\"tds-data-table-row\", {\n \"tds-data-table-row--interactive\": rowsAreInteractive,\n \"tds-data-table-row--press-selects\": rowPressSelects,\n })}\n >\n {selectable && (\n <Cell className=\"tds-data-table-cell tds-data-table-cell--selectable\">\n <Checkbox\n slot=\"selection\"\n className=\"tds-data-table-selectable-checkbox\"\n />\n </Cell>\n )}\n {visiblePreparedColumns.map((prepared) => (\n <Cell\n key={prepared.column.name}\n {...cellBoundaryProps}\n data-pii={prepared.column.pii || undefined}\n className={classNames(\"tds-data-table-cell\", {\n [`tds-data-table-cell--align-${prepared.align}`]:\n prepared.align !== \"start\",\n \"tds-data-table-cell--numeric\": prepared.isNumeric,\n })}\n >\n {prepared.renderCell(row)}\n </Cell>\n ))}\n {hasRowActions && (\n <Cell\n {...cellBoundaryProps}\n className=\"tds-data-table-cell tds-data-table-cell--actions\"\n >\n <RowActions\n actions={rowActions!} // Safe to assert non-null here because of `hasRowActions`\n row={row}\n rowKey={rowKey}\n />\n </Cell>\n )}\n </Row>\n )\n })}\n </TableBody>\n </Table>\n </div>\n </div>\n {showPagination && (\n <div className=\"tds-data-table-frame-footer\">\n {/*\n `Pagination`'s two shapes are a discriminated union, so each is\n spelled out in full rather than assembled from one prop bag.\n */}\n {isIndexedPagination ? (\n <Pagination\n aria-label={paginationLabel}\n hasNextPage={hasNextPage}\n hasPreviousPage={hasPreviousPage}\n onNextPageClick={onNextPageClick}\n onPreviousPageClick={onPreviousPageClick}\n type=\"indexed\"\n />\n ) : (\n <Pagination\n aria-label={paginationLabel}\n currentPage={currentPage}\n onPageChange={onPageChange}\n totalPages={totalPages!}\n />\n )}\n </div>\n )}\n </div>\n </div>\n )\n}\n\nDataTable.displayName = \"DataTable\"\n\n/**\n * Resolves the content rendered in the table body's empty-state slot based on\n * `loadingState`, falling back to `emptyState`. Returns `null` when nothing\n * should render (idle with no `emptyState`).\n */\nfunction getEmptyStateContent({\n emptyState,\n errorState,\n loadingState,\n}: {\n emptyState: ReactNode\n errorState: ReactNode\n loadingState: DataTableLoadingState\n}): ReactNode {\n if (loadingState === \"loading\") {\n return (\n <div className=\"tds-data-table-loading\" role=\"status\">\n <span className=\"tds-data-table-cell-label--hidden\">Loading</span>\n <span className=\"tds-data-table-loading-spinner\" aria-hidden=\"true\">\n <LoadingSpinner />\n </span>\n </div>\n )\n }\n\n // Error and empty share the same container; they differ only in content.\n const content =\n loadingState === \"error\" ? (errorState ?? DEFAULT_ERROR_STATE) : emptyState\n if (content == null) return null\n\n return <div className=\"tds-data-table-empty\">{content}</div>\n}\n\nfunction useSortDescriptor(\n sortBy: Sort | undefined\n): SortDescriptor | undefined {\n return useMemo(() => {\n if (!sortBy) return undefined\n return deserializeSort(sortBy)\n }, [sortBy])\n}\n\nfunction deserializeSort(sort: Sort): SortDescriptor {\n if (sort.direction === \"desc\")\n return { column: sort.column, direction: \"descending\" }\n return { column: sort.column, direction: \"ascending\" }\n}\n\nfunction serializeSort(sort: SortDescriptor): Sort {\n if (sort.direction === \"descending\")\n return { column: sort.column as string, direction: \"desc\" }\n return { column: sort.column as string, direction: \"asc\" }\n}\n\nfunction useStickyHeader(\n stickyHeader: boolean | undefined,\n scrollContainerRef: React.RefObject<HTMLElement> | undefined,\n scrollContainerSelector: string | undefined\n) {\n const wrapperRef = useRef<HTMLDivElement>(null)\n const [hasScrollContainer, setHasScrollContainer] = useState(false)\n\n useLayoutEffect(() => {\n setHasScrollContainer(false)\n if (!stickyHeader) return\n if (typeof ResizeObserver === \"undefined\") return\n const wrapper = wrapperRef.current\n if (!wrapper) return\n\n const scrollContainer = getScrollContainer(\n scrollContainerRef,\n scrollContainerSelector,\n wrapper\n )\n if (!scrollContainer) return\n\n setHasScrollContainer(true)\n\n let thead: HTMLElement | null = null\n\n const resizeObserver = new ResizeObserver(() => {\n if (!thead) {\n thead = wrapper.querySelector<HTMLElement>(\".tds-data-table-header\")\n if (!thead) return\n scrollContainer.style.setProperty(\n \"scroll-timeline-name\",\n \"--_sticky-header-scroll\"\n )\n }\n\n const { top: wrapperTop, bottom: wrapperBottom } =\n wrapper.getBoundingClientRect()\n const { top: scrollContainerTop } =\n scrollContainer.getBoundingClientRect()\n // Derive headerTop from the untransformed wrapper to avoid reading the\n // scroll-driven translateY that getBoundingClientRect() includes on thead.\n const headerTop = wrapperTop + wrapper.clientTop\n const start = scrollContainer.scrollTop + (headerTop - scrollContainerTop)\n const max = Math.max(0, wrapperBottom - headerTop - thead.offsetHeight)\n wrapper.style.setProperty(\"--_sticky-header-scroll-start\", `${start}px`)\n wrapper.style.setProperty(\"--_sticky-header-scroll-max\", `${max}px`)\n })\n\n resizeObserver.observe(wrapper)\n resizeObserver.observe(scrollContainer)\n\n return () => {\n resizeObserver.disconnect()\n wrapper.style.removeProperty(\"--_sticky-header-scroll-start\")\n wrapper.style.removeProperty(\"--_sticky-header-scroll-max\")\n }\n }, [stickyHeader, scrollContainerRef, scrollContainerSelector])\n\n return { hasScrollContainer, wrapperRef }\n}\n\nfunction getScrollContainer(\n scrollContainerRef: React.RefObject<HTMLElement> | undefined,\n scrollContainerSelector: string | undefined,\n wrapper: HTMLElement\n): HTMLElement | undefined {\n const element =\n scrollContainerRef?.current ??\n getScrollContainerFromSelector(scrollContainerSelector, wrapper)\n if (element instanceof Window) return\n return element\n}\n\nfunction getScrollContainerFromSelector(\n scrollContainerSelector: string | undefined,\n wrapper: HTMLElement\n): HTMLElement | undefined {\n return scrollContainerSelector\n ? (wrapper.parentElement?.closest<HTMLElement>(scrollContainerSelector) ??\n undefined)\n : undefined\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;AAoRA,MAAM,mBAAmB,GAAG,uBAAuB;AAanD;;;;;;;;;;;;;;;;AAgBG;MACU,SAAS,GAAG,CAAC,EACxB,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,WAAW,GAAG,CAAC,EACf,IA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O,CAAC,eAAe,CAAC;AAEvC,QAAA,OAAO,MAAK;YACV,cAAc,CAAC,UAAU,EAAE;AAC3B,YAAA,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,+BAA+B,CAAC;AAC7D,YAAA,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,6BAA6B,CAAC;AAC7D,QAAA,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;AAE/D,IAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE;AAC3C;AAEA,SAAS,kBAAkB,CACzB,kBAA4D,EAC5D,uBAA2C,EAC3C,OAAoB,EAAA;AAEpB,IAAA,MAAM,OAAO,GACX,kBAAkB,EAAE,OAAO;AAC3B,QAAA,8BAA8B,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAClE,IAAI,OAAO,YAAY,MAAM;QAAE;AAC/B,IAAA,OAAO,OAAO;AAChB;AAEA,SAAS,8BAA8B,CACrC,uBAA2C,EAC3C,OAAoB,EAAA;AAEpB,IAAA,OAAO;WACF,OAAO,CAAC,aAAa,EAAE,OAAO,CAAc,uBAAuB,CAAC;AACnE,YAAA,SAAS;UACX,SAAS;AACf;;;;"}
|
|
1
|
+
{"version":3,"file":"DataTable.js","sources":["../../../src/components/DataTable/DataTable.tsx"],"sourcesContent":["import \"./index.css\"\n\nimport { LoadingSpinner } from \"@components/internal\"\nimport { Pagination } from \"@components/internal/pagination\"\nimport Icon from \"@utilities/Icon\"\nimport type { CombineAriaPropsWithCustomProps } from \"@utilities/reactAriaProps\"\nimport { useId } from \"@utilities/useId\"\nimport classNames from \"classnames\"\nimport React, {\n type ReactNode,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\"\nimport {\n Cell,\n Checkbox,\n Column,\n Row,\n type SortDescriptor,\n Table,\n TableBody,\n TableHeader,\n type TableProps as AriaTableProps,\n} from \"react-aria-components/Table\"\n\nimport type { DataTableColumn } from \"./DataTableColumn\"\nimport { prepareColumn, type PreparedColumn } from \"./DataTableColumnTypes\"\nimport { getRowKey } from \"./DataTableRow\"\nimport {\n hasResultsCount,\n resolveResultNounLabel,\n type ResultNoun,\n ResultsCount,\n} from \"./ResultsCount\"\nimport { type RowAction, RowActions } from \"./RowActions\"\nimport { SelectAllBanner } from \"./SelectAllBanner\"\nimport { type TableAction, TableActions } from \"./TableActions\"\nimport { useColumnVisibility } from \"./useColumnVisibility\"\nimport {\n type DataTableSelection,\n DataTableSelectionContext,\n useDataTableSelection,\n} from \"./useDataTableSelection\"\nimport { useRowPressBoundary } from \"./useRowPressBoundary\"\nimport { ViewSettingsToggle } from \"./ViewSettingsToggle\"\n\nexport type { DataTableSelection, ResultNoun, RowAction, TableAction }\n\nexport type Sort = { column: string; direction: \"asc\" | \"desc\" }\n\nexport type DataTableLoadingState = \"error\" | \"idle\" | \"loading\"\n\ninterface DataTableBaseProps {\n /**\n * Columns define what data is displayed and how. Pass a stable reference\n * (e.g. a module constant or memoized value); columns are prepared per array\n * identity, so an inline array rebuilds each column's formatter every render.\n */\n columns: DataTableColumn[]\n /**\n * The 1-indexed current page. Only used by the default `\"paged\"` pagination,\n * where `totalPages` is set, and defaults to `1`.\n */\n currentPage?: number\n /** The array of rows to display. */\n data: unknown[]\n /**\n * Row keys that can't be selected. Keys are the values returned by `getRowId`\n * (or `row.id`, or the row's index) — the same keys used by `selectedKeys`.\n * Only selection is disabled: the row's checkbox renders disabled and \"select\n * all\" skips it, while the row itself stays clickable, navigable, and\n * focusable. Has no effect unless the table is `selectable`.\n */\n disabledKeys?: (number | string)[]\n /** Rendered in place of the table body when there is no data. */\n emptyState?: ReactNode\n /** Rendered in place of the table body when `loadingState` is `\"error\"`. */\n errorState?: ReactNode\n /** Returns a stable identity for each row. Defaults to `row.id`. */\n getRowId?: (row: unknown) => number | string\n /**\n * Returns a URL to navigate to when the row is clicked. Rows with a link\n * render as navigable elements (clickable, keyboard-focusable, and\n * openable in a new tab). Works alongside `onRowClick` and `selectable`.\n */\n getRowLink?: (row: unknown) => string\n /**\n * Whether a page exists after the current one. Only used by\n * `paginationType=\"indexed\"`, which has no page count to derive it from;\n * `false` (the default) disables the Next button.\n */\n hasNextPage?: boolean\n /**\n * Whether a page exists before the current one. Only used by\n * `paginationType=\"indexed\"`, which has no page count to derive it from;\n * `false` (the default) disables the Previous button.\n */\n hasPreviousPage?: boolean\n /**\n * An `id` for the table element. When omitted, a stable generated id is used\n * so the results count can be linked to the table via `aria-describedby`.\n */\n id?: string\n /**\n * Async loading state for the table body.\n * - `\"loading\"`: While `data` is empty, replaces the empty state with a\n * centered spinner.\n * - `\"error\"`: While `data` is empty, replaces the empty state with\n * `errorState` (or a default error message).\n * - `\"idle\"` (default): Normal rendering.\n */\n loadingState?: DataTableLoadingState\n /**\n * Called when the Next button is activated. Only used by\n * `paginationType=\"indexed\"`; load the following page's rows and pass them\n * back in through `data` in response.\n */\n onNextPageClick?: () => void\n /**\n * Called with the 1-indexed page the user navigated to. The table doesn't\n * page `data` itself — pass the rows for the new page back in through `data`\n * (and update `currentPage`) in response. Only used by the default `\"paged\"`\n * pagination; the indexed type has no page number to report.\n */\n onPageChange?: (page: number) => void\n /**\n * Called when the Previous button is activated. Only used by\n * `paginationType=\"indexed\"`; load the preceding page's rows and pass them\n * back in through `data` in response.\n */\n onPreviousPageClick?: () => void\n /**\n * Called with the row when it is clicked. Rows with a click handler render\n * as interactive elements (clickable and keyboard-focusable). When\n * `getRowLink` is also set, both run and the row navigates.\n */\n onRowClick?: (row: unknown) => void\n /** Callback invoked when the sort state changes. */\n onSortChange?: (sort: Sort) => void\n /**\n * Called with the full ordered list of visible column names when the\n * visibility toggle changes. Always-visible columns are included, so the\n * value can be passed straight back as `visibleColumnNames`. Column\n * visibility is controlled, so the table only updates once\n * `visibleColumnNames` changes.\n */\n onVisibleColumnNamesChange?: (visibleColumnNames: string[]) => void\n /**\n * Which shape the page controls take, forwarded to the `Pagination` control's\n * `type`.\n * - `\"paged\"` (the default): a numbered run of pages. Driven by `totalPages`,\n * `currentPage`, and `onPageChange`, and rendered only once `totalPages` is\n * set and greater than `1`.\n * - `\"indexed\"`: a labeled Previous/Next pair, for a result set that can only\n * be stepped through — a cursor-paged API, say, which reports whether a\n * neighboring page exists but not how many there are. Driven by\n * `hasPreviousPage`/`hasNextPage` and `onPreviousPageClick`/\n * `onNextPageClick`; `totalPages` and `currentPage` play no part. With no\n * page count there's no threshold to hide the controls below, so they\n * always render — a single page of results shows both buttons disabled.\n */\n paginationType?: \"indexed\" | \"paged\"\n /**\n * Overrides the number shown by the `resultNoun` count, which otherwise\n * uses the length of `data`. Use this when the table renders only part of\n * the result set — a paginated or virtualized table — so the count reflects\n * the whole set. It also sizes an all-pages selection when\n * `canSelectAllPages` is true, including the count used by table actions and\n * the select-all banner. Without a result count, the banner isn't offered\n * because the table can't accurately describe the all-pages selection.\n * Otherwise, it has no effect unless `resultNoun` is set.\n */\n resultCount?: number\n /**\n * Displays the number of results (the length of `data`, or `resultCount`\n * when supplied) above the table, followed by a noun that matches the count.\n * Pass a string to use it as the singular noun and append `\"s\"` for the\n * plural (e.g. `\"result\"` → `\"results\"`), or a `[singular, plural]` tuple to\n * supply an irregular plural explicitly (e.g. `[\"person\", \"people\"]`). Pass\n * `true` to use `\"result\"`.\n * When `false` or omitted, no count is rendered. The count is formatted with\n * `Intl.NumberFormat` and the singular form is used only when the count is\n * exactly `1`. When the table is `selectable` and rows are selected, the\n * count instead reflects the selection as `\"{selected} of {total}\"`, e.g.\n * `\"2 of 100\"`, with a visually-hidden suffix naming the noun so assistive\n * tech reads the unambiguous `\"2 of 100 people selected\"`.\n * The count is linked to the table with `aria-describedby` so\n * screen readers announce it as a description of the table. When a string or\n * `[singular, plural]` tuple is provided, the noun also supplies the table's\n * `aria-label` in its plural form (e.g. `\"items\"` or `\"people\"`) unless an\n * `aria-label` is passed directly, which always takes precedence; `true`\n * never provides a label. The same plural noun also names the pagination\n * landmark (e.g. `\"people table pagination\"`), which otherwise falls back to\n * `\"Pagination\"`.\n */\n resultNoun?: ResultNoun\n /**\n * Displays a sticky column to the right that holds row-scoped actions.\n * Renders as a dropdown with 2+ actions or a single button with one. Each\n * action's `onAction` or `getHref` receives the row.\n */\n rowActions?: RowAction[]\n /** Ref to the scroll container the sticky header should track. Takes priority over `scrollContainerSelector`. Only used when `stickyHeader` is true. */\n scrollContainerRef?: React.RefObject<HTMLElement>\n /** CSS selector for the scroll container the sticky header should track. Only used when `stickyHeader` is true. Defaults to \".content-wrap\" */\n scrollContainerSelector?: string\n /**\n * Enables row selection via checkboxes, including a \"select all\" checkbox in\n * the header for the loaded page. Without a row action (`onRowClick` or\n * `getRowLink`), pressing anywhere in a row toggles the row selection.\n */\n selectable?: boolean\n /** The current sort state for the table. */\n sortBy?: Sort\n /** Enables a sticky header that tracks an outer scroll container. Progressive enhancement: Relies on `animation-timeline: scroll()`, which isn't supported in all browsers (e.g. Firefox) — the header scrolls with the table body instead of sticking in those cases. */\n stickyHeader?: boolean\n /**\n * The number of disabled rows across the whole result set. Used to size an\n * all-pages selection when disabled rows exist on unloaded pages. Replaces\n * the count inferred from `disabledKeys` rather than adding to it. Values are\n * clamped to the result count, and zero is used as supplied.\n */\n totalDisabledCount?: number\n /**\n * The total number of pages in the result set. Setting it renders the page\n * controls below the table; leaving it unset renders no pagination at all.\n * A single page has nothing to navigate to, so the controls only render once\n * there are two or more pages. Only used by the default `\"paged\"` pagination\n * — an indexed result set has no page count, which is the reason to reach for\n * `paginationType=\"indexed\"` in the first place.\n *\n * The table displays whatever rows it is given — paging is the caller's job.\n * `data` should hold only the current page's rows, `resultCount` the size of\n * the whole result set, and `onPageChange` should load the next page.\n */\n totalPages?: number\n /**\n * The names of the columns currently visible. Only columns marked `hideable`\n * are affected — every other column stays visible. Omitting this leaves all\n * columns visible. Unknown names are ignored and display order always\n * follows `columns`.\n */\n visibleColumnNames?: string[]\n}\n\ninterface DataTableExplicitSelectionProps {\n /** Keeps selection values as arrays of row keys. */\n canSelectAllPages?: false\n /** Called with the selected row keys whenever selection changes. */\n onSelectedChange?: (keys: (number | string)[]) => void\n /** The selected row keys. */\n selectedKeys?: (number | string)[]\n /** Table actions whose callbacks receive the selected row keys. */\n tableActions?: TableAction[]\n}\n\ninterface DataTableAllPagesSelectionProps {\n /**\n * Enables tagged selection values that can represent every page plus\n * exclusions. Explicit arrays and the header checkbox remain page-scoped.\n * When `resultCount` proves more selectable results exist, selecting the\n * loaded page reveals a banner that widens the selection to every page or\n * clears it again. This works with both paged and indexed pagination.\n */\n canSelectAllPages: true\n /** Called with the current explicit or all-pages selection. */\n onSelectedChange?: (selection: DataTableSelection) => void\n /**\n * The current explicit or all-pages selection. Use\n * `{ keys: \"all\", excludedKeys: [] }` for every selectable result; a bare\n * `\"all\"` value is not accepted.\n */\n selectedKeys?: DataTableSelection\n /** Table actions whose callbacks receive the current selection. */\n tableActions?: TableAction<DataTableSelection>[]\n}\n\nexport type DataTableProps = DataTableBaseProps &\n (DataTableAllPagesSelectionProps | DataTableExplicitSelectionProps)\n\nconst DEFAULT_ERROR_STATE = \"Something went wrong.\"\n\ntype AriaTablePropsToOmit = \"children\" | \"slot\"\n\ntype AriaTablePropsToInclude = never\n\nexport type DataTableElementProps = CombineAriaPropsWithCustomProps<\n AriaTableProps,\n DataTableProps,\n AriaTablePropsToOmit,\n AriaTablePropsToInclude\n>\n\n/**\n * A table for displaying tabular data. Built on React Aria's `Table`.\n *\n * Each column declares a `type` that controls how its cell values are\n * formatted: `string`, `number`, `currency`, `date`, `datetime`, `boolean`,\n * `enum`, and `custom`. A column's `render` function always takes precedence\n * over the built-in type formatting.\n *\n * Setting `totalPages` renders page controls below the table; the table itself\n * never slices `data`, so `onPageChange` is where the caller loads the page.\n * `paginationType=\"indexed\"` swaps the numbered run for a labeled\n * Previous/Next pair, for a result set with no known page count.\n *\n * Filtering, presets, and other RFC features are not yet implemented.\n *\n * @component\n */\nexport const DataTable = ({\n className,\n canSelectAllPages,\n columns,\n currentPage = 1,\n data,\n disabledKeys,\n emptyState,\n errorState,\n getRowId,\n getRowLink,\n hasNextPage = false,\n hasPreviousPage = false,\n id,\n loadingState = \"idle\",\n paginationType = \"paged\",\n resultCount,\n resultNoun,\n scrollContainerRef,\n scrollContainerSelector = \".content-wrap\",\n rowActions,\n selectable,\n selectedKeys: controlledSelectedKeys,\n stickyHeader,\n sortBy,\n tableActions,\n totalDisabledCount,\n totalPages,\n visibleColumnNames,\n onNextPageClick,\n onPageChange,\n onPreviousPageClick,\n onRowClick,\n onSelectedChange,\n onSortChange,\n onVisibleColumnNamesChange,\n ...restProps\n}: DataTableElementProps) => {\n const hasRowPressAction = Boolean(onRowClick || getRowLink)\n const rowsAreInteractive = hasRowPressAction || Boolean(selectable)\n const combinedClassName = classNames(\"tds-data-table-grid\", className)\n const sortDescriptor = useSortDescriptor(sortBy)\n const { hasScrollContainer, wrapperRef } = useStickyHeader(\n stickyHeader,\n scrollContainerRef,\n scrollContainerSelector\n )\n const scrollRef = useRef<HTMLDivElement>(null)\n // A `Button` or `Link` in a cell keeps its presses to itself, so activating\n // one doesn't also press the row it's in.\n const cellBoundaryProps = useRowPressBoundary(scrollRef, rowsAreInteractive)\n\n // React Aria only invokes `renderEmptyState` when the collection is empty, so\n // the loading spinner and error message only take over the body while `data`\n // is empty; once rows exist they always render.\n const emptyStateContent = getEmptyStateContent({\n emptyState,\n errorState,\n loadingState,\n })\n const renderEmptyState = emptyStateContent\n ? () => emptyStateContent\n : undefined\n\n // Keyed on column names rather than the `columns` array identity so a fresh\n // `columns` literal each render doesn't rebuild every formatter. `columns` is\n // intentionally omitted from the deps.\n const columnKey = columns.map((c) => `${c.name}/${c.type}`).join(\"|\")\n const preparedColumns = useMemo<PreparedColumn[]>(\n () => columns.map(prepareColumn),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [columnKey]\n )\n\n const {\n hideableColumns,\n isColumnVisible,\n onColumnVisibilityChange,\n visibleHideableColumns,\n } = useColumnVisibility({\n columns,\n onVisibleColumnNamesChange,\n visibleColumnNames,\n })\n const visiblePreparedColumns = useMemo(\n () => preparedColumns.filter(({ column }) => isColumnVisible(column)),\n [preparedColumns, isColumnVisible]\n )\n\n const selectionModel = useDataTableSelection({\n canSelectAllPages,\n data,\n disabledKeys,\n getRowId,\n hasRowPressAction,\n onSelectedChange,\n resultCount,\n selectable,\n selectedKeys: controlledSelectedKeys,\n totalDisabledCount,\n })\n const {\n headerCheckboxProps,\n rowPressSelects,\n selectedCount,\n tableProps: selectionProps,\n totalCount,\n } = selectionModel\n\n // Associate the visible results count with the table so screen readers\n // announce it as a description of the table. `Table` doesn't support a real\n // `<caption>` (its children go through a collection builder), so we link the\n // count via `aria-describedby`, merging with any caller-supplied value.\n const stableId = useId()\n const tableId = id || `tds-data-table-${stableId}`\n const resultsCountId = `${tableId}-results-count`\n const describedBy = hasResultsCount(resultNoun)\n ? [restProps[\"aria-describedby\"], resultsCountId].filter(Boolean).join(\" \")\n : restProps[\"aria-describedby\"]\n\n // A caller-supplied `aria-label` always wins; otherwise the results noun\n // provides the table's accessible name so a label is present whenever a noun\n // is given. Array nouns are transformed to their plural form.\n const resultNounLabel = resolveResultNounLabel(resultNoun)\n const ariaLabel = restProps[\"aria-label\"] || resultNounLabel\n const paginationLabel = resultNounLabel\n ? `${resultNounLabel} table pagination`\n : undefined\n\n const hasActions = (tableActions?.length ?? 0) > 0\n const hasViewSettingsToggle = hideableColumns.length > 0\n const showHeader = Boolean(resultNoun || hasActions || hasViewSettingsToggle)\n const hasRowActions = (rowActions?.length ?? 0) > 0\n // A lone page has nothing to navigate to, so the paged controls stay out of\n // the frame entirely rather than rendering a single inert page marker. The\n // indexed type has no page count to measure against — stepping is the only\n // way through the set — so asking for it always renders the controls, and a\n // set that fits on one page shows both buttons disabled.\n const isIndexedPagination = paginationType === \"indexed\"\n const showPagination =\n isIndexedPagination || (totalPages !== undefined && totalPages > 1)\n\n return (\n <div\n className={classNames(\"tds-data-table\", {\n \"tds-data-table--sticky-header\": hasScrollContainer,\n })}\n >\n <div className=\"tds-data-table-frame\">\n <DataTableSelectionContext.Provider value={selectionModel}>\n {showHeader && (\n <div className=\"tds-data-table-frame-header\">\n <ResultsCount\n id={resultsCountId}\n resultNoun={resultNoun}\n selectable={selectable}\n selectedCount={selectedCount}\n totalCount={totalCount}\n />\n {hasActions && (\n <TableActions\n actions={tableActions as TableAction<DataTableSelection>[]}\n resultNoun={resultNoun}\n />\n )}\n {hasViewSettingsToggle && (\n <ViewSettingsToggle\n columns={hideableColumns}\n onColumnVisibilityChange={onColumnVisibilityChange}\n visibleColumnNames={visibleHideableColumns}\n />\n )}\n </div>\n )}\n <SelectAllBanner resultNoun={resultNoun} />\n </DataTableSelectionContext.Provider>\n <div ref={wrapperRef} className=\"tds-data-table-scroll-wrapper\">\n <div ref={scrollRef} className=\"tds-data-table-scroll\">\n <Table\n {...restProps}\n {...selectionProps}\n {...(ariaLabel ? { \"aria-label\": ariaLabel } : {})}\n {...(describedBy ? { \"aria-describedby\": describedBy } : {})}\n // RAC's `Table` forwards `id` to the underlying table element at\n // runtime (via `filterDOMProps({ global: true })`) but omits `id`\n // from its prop types, so spread it through a cast.\n {...({ id: tableId } as Partial<AriaTableProps>)}\n className={combinedClassName}\n // Pinned rather than exposed as a prop: `disabledKeys` only ever\n // turns off selection here, leaving the row clickable and\n // focusable. React Aria defaults this to \"all\", which would also\n // disable `onRowClick`/`getRowLink` and drop the row out of the\n // focus order, so it has to be set explicitly.\n disabledBehavior=\"selection\"\n disabledKeys={disabledKeys}\n sortDescriptor={sortDescriptor}\n onSortChange={(sort) => {\n onSortChange?.(serializeSort(sort))\n }}\n >\n <TableHeader className=\"tds-data-table-header\">\n {/*\n Rendered as a sibling before the `preparedColumns.map` below\n (not folded into it) so the map's `index` still starts at 0\n for the first *data* column — that's what keeps\n `isRowHeader={index === 0}` pointing at the first data\n column instead of this selection column.\n */}\n {selectable && (\n <Column className=\"tds-data-table-column tds-data-table-column--selectable\">\n {headerCheckboxProps ? (\n <Checkbox\n {...headerCheckboxProps}\n aria-label=\"Select all\"\n slot={null}\n className=\"tds-data-table-selectable-checkbox\"\n />\n ) : (\n <Checkbox\n slot=\"selection\"\n className=\"tds-data-table-selectable-checkbox\"\n />\n )}\n </Column>\n )}\n {visiblePreparedColumns.map(({ align, column }, index) => (\n <Column\n key={column.name}\n id={column.name}\n isRowHeader={index === 0}\n className={classNames(\"tds-data-table-column\", {\n [`tds-data-table-column--align-${align}`]:\n align !== \"start\",\n })}\n allowsSorting={column.sortable}\n >\n {column.hideLabel ? (\n <span className=\"tds-data-table-column-label--hidden\">\n {column.headerLabel}\n </span>\n ) : (\n column.headerLabel\n )}\n {column.sortable && (\n <Icon\n className=\"tds-data-table-column-icon tds-data-table-column-icon--sort\"\n symbol=\"general#up-caret\"\n aria-hidden={true}\n />\n )}\n </Column>\n ))}\n {hasRowActions && (\n <Column className=\"tds-data-table-column tds-data-table-column--actions\">\n <span className=\"tds-data-table-column-label--hidden\">\n Actions\n </span>\n </Column>\n )}\n </TableHeader>\n <TableBody\n className=\"tds-data-table-body\"\n renderEmptyState={renderEmptyState}\n >\n {data.map((row, rowIndex) => {\n const rowKey = getRowKey(row, rowIndex, getRowId)\n return (\n <Row\n key={rowKey}\n id={rowKey}\n href={getRowLink?.(row)}\n onAction={onRowClick ? () => onRowClick(row) : undefined}\n className={classNames(\"tds-data-table-row\", {\n \"tds-data-table-row--interactive\": rowsAreInteractive,\n \"tds-data-table-row--press-selects\": rowPressSelects,\n })}\n >\n {selectable && (\n <Cell className=\"tds-data-table-cell tds-data-table-cell--selectable\">\n <Checkbox\n slot=\"selection\"\n className=\"tds-data-table-selectable-checkbox\"\n />\n </Cell>\n )}\n {visiblePreparedColumns.map((prepared) => (\n <Cell\n key={prepared.column.name}\n {...cellBoundaryProps}\n data-pii={prepared.column.pii || undefined}\n className={classNames(\"tds-data-table-cell\", {\n [`tds-data-table-cell--align-${prepared.align}`]:\n prepared.align !== \"start\",\n \"tds-data-table-cell--numeric\": prepared.isNumeric,\n })}\n >\n {prepared.renderCell(row)}\n </Cell>\n ))}\n {hasRowActions && (\n <Cell\n {...cellBoundaryProps}\n className=\"tds-data-table-cell tds-data-table-cell--actions\"\n >\n <RowActions\n actions={rowActions!} // Safe to assert non-null here because of `hasRowActions`\n row={row}\n rowKey={rowKey}\n />\n </Cell>\n )}\n </Row>\n )\n })}\n </TableBody>\n </Table>\n </div>\n </div>\n {showPagination && (\n <div className=\"tds-data-table-frame-footer\">\n {/*\n `Pagination`'s two shapes are a discriminated union, so each is\n spelled out in full rather than assembled from one prop bag.\n */}\n {isIndexedPagination ? (\n <Pagination\n aria-label={paginationLabel}\n hasNextPage={hasNextPage}\n hasPreviousPage={hasPreviousPage}\n onNextPageClick={onNextPageClick}\n onPreviousPageClick={onPreviousPageClick}\n type=\"indexed\"\n />\n ) : (\n <Pagination\n aria-label={paginationLabel}\n currentPage={currentPage}\n onPageChange={onPageChange}\n totalPages={totalPages!}\n />\n )}\n </div>\n )}\n </div>\n </div>\n )\n}\n\nDataTable.displayName = \"DataTable\"\n\n/**\n * Resolves the content rendered in the table body's empty-state slot based on\n * `loadingState`, falling back to `emptyState`. Returns `null` when nothing\n * should render (idle with no `emptyState`).\n */\nfunction getEmptyStateContent({\n emptyState,\n errorState,\n loadingState,\n}: {\n emptyState: ReactNode\n errorState: ReactNode\n loadingState: DataTableLoadingState\n}): ReactNode {\n if (loadingState === \"loading\") {\n return (\n <div className=\"tds-data-table-loading\" role=\"status\">\n <span className=\"tds-data-table-cell-label--hidden\">Loading</span>\n <span className=\"tds-data-table-loading-spinner\" aria-hidden=\"true\">\n <LoadingSpinner />\n </span>\n </div>\n )\n }\n\n // Error and empty share the same container; they differ only in content.\n const content =\n loadingState === \"error\" ? (errorState ?? DEFAULT_ERROR_STATE) : emptyState\n if (content == null) return null\n\n return <div className=\"tds-data-table-empty\">{content}</div>\n}\n\nfunction useSortDescriptor(\n sortBy: Sort | undefined\n): SortDescriptor | undefined {\n return useMemo(() => {\n if (!sortBy) return undefined\n return deserializeSort(sortBy)\n }, [sortBy])\n}\n\nfunction deserializeSort(sort: Sort): SortDescriptor {\n if (sort.direction === \"desc\")\n return { column: sort.column, direction: \"descending\" }\n return { column: sort.column, direction: \"ascending\" }\n}\n\nfunction serializeSort(sort: SortDescriptor): Sort {\n if (sort.direction === \"descending\")\n return { column: sort.column as string, direction: \"desc\" }\n return { column: sort.column as string, direction: \"asc\" }\n}\n\nfunction useStickyHeader(\n stickyHeader: boolean | undefined,\n scrollContainerRef: React.RefObject<HTMLElement> | undefined,\n scrollContainerSelector: string | undefined\n) {\n const wrapperRef = useRef<HTMLDivElement>(null)\n const [hasScrollContainer, setHasScrollContainer] = useState(false)\n\n useLayoutEffect(() => {\n setHasScrollContainer(false)\n if (!stickyHeader) return\n if (typeof ResizeObserver === \"undefined\") return\n const wrapper = wrapperRef.current\n if (!wrapper) return\n\n const scrollContainer = getScrollContainer(\n scrollContainerRef,\n scrollContainerSelector,\n wrapper\n )\n if (!scrollContainer) return\n\n setHasScrollContainer(true)\n\n let thead: HTMLElement | null = null\n\n const resizeObserver = new ResizeObserver(() => {\n if (!thead) {\n thead = wrapper.querySelector<HTMLElement>(\".tds-data-table-header\")\n if (!thead) return\n scrollContainer.style.setProperty(\n \"scroll-timeline-name\",\n \"--_sticky-header-scroll\"\n )\n }\n\n const { top: wrapperTop, bottom: wrapperBottom } =\n wrapper.getBoundingClientRect()\n const { top: scrollContainerTop } =\n scrollContainer.getBoundingClientRect()\n // Derive headerTop from the untransformed wrapper to avoid reading the\n // scroll-driven translateY that getBoundingClientRect() includes on thead.\n const headerTop = wrapperTop + wrapper.clientTop\n const start = scrollContainer.scrollTop + (headerTop - scrollContainerTop)\n const max = Math.max(0, wrapperBottom - headerTop - thead.offsetHeight)\n wrapper.style.setProperty(\"--_sticky-header-scroll-start\", `${start}px`)\n wrapper.style.setProperty(\"--_sticky-header-scroll-max\", `${max}px`)\n })\n\n resizeObserver.observe(wrapper)\n // The banner moves the wrapper without changing its size.\n if (wrapper.parentElement) resizeObserver.observe(wrapper.parentElement)\n resizeObserver.observe(scrollContainer)\n\n return () => {\n resizeObserver.disconnect()\n wrapper.style.removeProperty(\"--_sticky-header-scroll-start\")\n wrapper.style.removeProperty(\"--_sticky-header-scroll-max\")\n }\n }, [stickyHeader, scrollContainerRef, scrollContainerSelector])\n\n return { hasScrollContainer, wrapperRef }\n}\n\nfunction getScrollContainer(\n scrollContainerRef: React.RefObject<HTMLElement> | undefined,\n scrollContainerSelector: string | undefined,\n wrapper: HTMLElement\n): HTMLElement | undefined {\n const element =\n scrollContainerRef?.current ??\n getScrollContainerFromSelector(scrollContainerSelector, wrapper)\n if (element instanceof Window) return\n return element\n}\n\nfunction getScrollContainerFromSelector(\n scrollContainerSelector: string | undefined,\n wrapper: HTMLElement\n): HTMLElement | undefined {\n return scrollContainerSelector\n ? (wrapper.parentElement?.closest<HTMLElement>(scrollContainerSelector) ??\n undefined)\n : undefined\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;AA0RA,MAAM,mBAAmB,GAAG,uBAAuB;AAanD;;;;;;;;;;;;;;;;AAgBG;MACU,SAAS,GAAG,CAAC,EACxB,SAAS,EACT,iBAAiB,EACjB,OAAO,EACP,WAAW,GAAG,CAAC,EACf,IAAI,EACJ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,WAAW,GAAG,KAAK,EACnB,eAAe,GAAG,KAAK,EACvB,EAAE,EACF,YAAY,GAAG,MAAM,EACrB,cAAc,GAAG,OAAO,EACxB,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,uBAAuB,GAAG,eAAe,EACzC,UAAU,EACV,UAAU,EACV,YAAY,EAAE,sBAAsB,EACpC,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,0BAA0B,EAC1B,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EAAE,kBAAkB,EAAE,uBAAuB,CAAC,CAAC;AAE/D,IAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE;AAC3C;AAEA,SAAS,kBAAkB,CACzB,kBAA4D,EAC5D,uBAA2C,EAC3C,OAAoB,EAAA;AAEpB,IAAA,MAAM,OAAO,GACX,kBAAkB,EAAE,OAAO;AAC3B,QAAA,8BAA8B,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAClE,IAAI,OAAO,YAAY,MAAM;QAAE;AAC/B,IAAA,OAAO,OAAO;AAChB;AAEA,SAAS,8BAA8B,CACrC,uBAA2C,EAC3C,OAAoB,EAAA;AAEpB,IAAA,OAAO;WACF,OAAO,CAAC,aAAa,EAAE,OAAO,CAAc,uBAAuB,CAAC;AACnE,YAAA,SAAS;UACX,SAAS;AACf;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type ResultNoun } from "./ResultsCount";
|
|
3
|
+
interface SelectAllBannerProps {
|
|
4
|
+
/** The noun used to describe the rows. See {@link ResultNoun}. */
|
|
5
|
+
resultNoun?: ResultNoun;
|
|
6
|
+
}
|
|
7
|
+
/** Offers to widen a page selection to every result, or clear it again. */
|
|
8
|
+
export declare const SelectAllBanner: {
|
|
9
|
+
({ resultNoun }: SelectAllBannerProps): React.JSX.Element | null;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=SelectAllBanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAllBanner.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/SelectAllBanner.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAG1E,UAAU,oBAAoB;IAC5B,kEAAkE;IAClE,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB;AAED,2EAA2E;AAC3E,eAAO,MAAM,eAAe;qBAAoB,oBAAoB;;CA4CnE,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../button/ActionsDropdownIconButton.js';
|
|
2
|
+
import { Button } from '../button/Button.js';
|
|
3
|
+
import '../button/DropdownButton.js';
|
|
4
|
+
import '../button/DropdownIconButton.js';
|
|
5
|
+
import '../button/IconButton.js';
|
|
6
|
+
import '../button/LoadingButton.js';
|
|
7
|
+
import '../button/PageHeaderActionsDropdownButton.js';
|
|
8
|
+
import React__default from 'react';
|
|
9
|
+
import { formatCount, resolveNoun } from './ResultsCount.js';
|
|
10
|
+
import { useDataTableSelectionContext } from './useDataTableSelection.js';
|
|
11
|
+
|
|
12
|
+
/** Offers to widen a page selection to every result, or clear it again. */
|
|
13
|
+
const SelectAllBanner = ({ resultNoun }) => {
|
|
14
|
+
const { commitSelection, pageSelectableCount, selectableCount, selectedCount, selection, showSelectAllBanner, } = useDataTableSelectionContext();
|
|
15
|
+
if (!showSelectAllBanner)
|
|
16
|
+
return null;
|
|
17
|
+
const isAllPagesSelection = !Array.isArray(selection);
|
|
18
|
+
const noun = resultNoun || true;
|
|
19
|
+
const selectableLabel = `${formatCount(selectableCount)} ${resolveNoun(selectableCount, noun)}`;
|
|
20
|
+
const allPagesMessage = selectedCount === selectableCount
|
|
21
|
+
? `All ${selectableLabel} ${selectableCount === 1 ? "is" : "are"} selected.`
|
|
22
|
+
: `${formatCount(selectedCount)} of ${selectableLabel} ${selectedCount === 1 ? "is" : "are"} selected.`;
|
|
23
|
+
const message = isAllPagesSelection
|
|
24
|
+
? allPagesMessage
|
|
25
|
+
: `All ${formatCount(pageSelectableCount)} ${resolveNoun(pageSelectableCount, noun)} on this page ${pageSelectableCount === 1 ? "is" : "are"} selected.`;
|
|
26
|
+
return (React__default.createElement("div", { className: "tds-data-table-select-all-banner" },
|
|
27
|
+
React__default.createElement("p", { className: "tds-data-table-select-all-banner-message" }, message),
|
|
28
|
+
React__default.createElement(Button, { kind: "inline-text", label: isAllPagesSelection
|
|
29
|
+
? "Clear selection"
|
|
30
|
+
: `Select all ${selectableLabel}`, onClick: () => {
|
|
31
|
+
if (isAllPagesSelection)
|
|
32
|
+
commitSelection([]);
|
|
33
|
+
else
|
|
34
|
+
commitSelection({ excludedKeys: [], keys: "all" });
|
|
35
|
+
} })));
|
|
36
|
+
};
|
|
37
|
+
SelectAllBanner.displayName = "SelectAllBanner";
|
|
38
|
+
|
|
39
|
+
export { SelectAllBanner };
|
|
40
|
+
//# sourceMappingURL=SelectAllBanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectAllBanner.js","sources":["../../../src/components/DataTable/SelectAllBanner.tsx"],"sourcesContent":["import { Button } from \"@components/button\"\nimport React from \"react\"\n\nimport { formatCount, resolveNoun, type ResultNoun } from \"./ResultsCount\"\nimport { useDataTableSelectionContext } from \"./useDataTableSelection\"\n\ninterface SelectAllBannerProps {\n /** The noun used to describe the rows. See {@link ResultNoun}. */\n resultNoun?: ResultNoun\n}\n\n/** Offers to widen a page selection to every result, or clear it again. */\nexport const SelectAllBanner = ({ resultNoun }: SelectAllBannerProps) => {\n const {\n commitSelection,\n pageSelectableCount,\n selectableCount,\n selectedCount,\n selection,\n showSelectAllBanner,\n } = useDataTableSelectionContext()\n if (!showSelectAllBanner) return null\n\n const isAllPagesSelection = !Array.isArray(selection)\n const noun = resultNoun || true\n const selectableLabel = `${formatCount(selectableCount)} ${resolveNoun(\n selectableCount,\n noun\n )}`\n const allPagesMessage =\n selectedCount === selectableCount\n ? `All ${selectableLabel} ${selectableCount === 1 ? \"is\" : \"are\"} selected.`\n : `${formatCount(selectedCount)} of ${selectableLabel} ${selectedCount === 1 ? \"is\" : \"are\"} selected.`\n const message = isAllPagesSelection\n ? allPagesMessage\n : `All ${formatCount(pageSelectableCount)} ${resolveNoun(pageSelectableCount, noun)} on this page ${\n pageSelectableCount === 1 ? \"is\" : \"are\"\n } selected.`\n\n return (\n <div className=\"tds-data-table-select-all-banner\">\n <p className=\"tds-data-table-select-all-banner-message\">{message}</p>\n <Button\n kind=\"inline-text\"\n label={\n isAllPagesSelection\n ? \"Clear selection\"\n : `Select all ${selectableLabel}`\n }\n onClick={() => {\n if (isAllPagesSelection) commitSelection([])\n else commitSelection({ excludedKeys: [], keys: \"all\" })\n }}\n />\n </div>\n )\n}\n\nSelectAllBanner.displayName = \"SelectAllBanner\"\n"],"names":["React"],"mappings":";;;;;;;;;;;AAWA;MACa,eAAe,GAAG,CAAC,EAAE,UAAU,EAAwB,KAAI;AACtE,IAAA,MAAM,EACJ,eAAe,EACf,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,SAAS,EACT,mBAAmB,GACpB,GAAG,4BAA4B,EAAE;AAClC,IAAA,IAAI,CAAC,mBAAmB;AAAE,QAAA,OAAO,IAAI;IAErC,MAAM,mBAAmB,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AACrD,IAAA,MAAM,IAAI,GAAG,UAAU,IAAI,IAAI;AAC/B,IAAA,MAAM,eAAe,GAAG,CAAA,EAAG,WAAW,CAAC,eAAe,CAAC,CAAA,CAAA,EAAI,WAAW,CACpE,eAAe,EACf,IAAI,CACL,EAAE;AACH,IAAA,MAAM,eAAe,GACnB,aAAa,KAAK;AAChB,UAAE,CAAA,IAAA,EAAO,eAAe,CAAA,CAAA,EAAI,eAAe,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA,UAAA;UAC9D,GAAG,WAAW,CAAC,aAAa,CAAC,CAAA,IAAA,EAAO,eAAe,CAAA,CAAA,EAAI,aAAa,KAAK,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA,UAAA,CAAY;IAC3G,MAAM,OAAO,GAAG;AACd,UAAE;UACA,CAAA,IAAA,EAAO,WAAW,CAAC,mBAAmB,CAAC,CAAA,CAAA,EAAI,WAAW,CAAC,mBAAmB,EAAE,IAAI,CAAC,iBAC/E,mBAAmB,KAAK,CAAC,GAAG,IAAI,GAAG,KACrC,CAAA,UAAA,CAAY;AAEhB,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kCAAkC,EAAA;AAC/C,QAAAA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,0CAA0C,EAAA,EAAE,OAAO,CAAK;QACrEA,cAAA,CAAA,aAAA,CAAC,MAAM,IACL,IAAI,EAAC,aAAa,EAClB,KAAK,EACH;AACE,kBAAE;kBACA,cAAc,eAAe,CAAA,CAAE,EAErC,OAAO,EAAE,MAAK;AACZ,gBAAA,IAAI,mBAAmB;oBAAE,eAAe,CAAC,EAAE,CAAC;;oBACvC,eAAe,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YACzD,CAAC,EAAA,CACD,CACE;AAEV;AAEA,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;;"}
|
|
@@ -15,9 +15,12 @@ type HeaderCheckboxProps = {
|
|
|
15
15
|
export interface DataTableSelectionModel {
|
|
16
16
|
commitSelection: (selection: DataTableSelection) => void;
|
|
17
17
|
headerCheckboxProps?: HeaderCheckboxProps;
|
|
18
|
+
pageSelectableCount: number;
|
|
18
19
|
rowPressSelects: boolean;
|
|
20
|
+
selectableCount: number;
|
|
19
21
|
selectedCount: number;
|
|
20
22
|
selection: DataTableSelection;
|
|
23
|
+
showSelectAllBanner: boolean;
|
|
21
24
|
tableProps: Pick<AriaTableProps, "onSelectionChange" | "selectedKeys" | "selectionMode">;
|
|
22
25
|
totalCount: number;
|
|
23
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableSelection.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/useDataTableSelection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,UAAU,IAAI,cAAc,EAC7B,MAAM,6BAA6B,CAAA;AAIpC,KAAK,YAAY,GAAG,MAA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AAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,YAAY,CAAC,GAAG,SAAS,CAAA;IACtD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,gBAAgB,EAAE,sBAAsB,GAAG,SAAS,CAAA;IACpD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,YAAY,EAAE,kBAAkB,GAAG,SAAS,CAAA;IAC5C,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC,GAAG,uBAAuB,
|
|
1
|
+
{"version":3,"file":"useDataTableSelection.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/useDataTableSelection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAGV,UAAU,IAAI,cAAc,EAC7B,MAAM,6BAA6B,CAAA;AAIpC,KAAK,YAAY,GAAG,MAAM,GAAG,MAAM,CAAA;AAEnC,qEAAqE;AACrE,MAAM,MAAM,kBAAkB,GAC1B,YAAY,EAAE,GACd;IAAE,YAAY,EAAE,YAAY,EAAE,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,CAAA;AAEjD,KAAK,sBAAsB,GACvB,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC,GAChC,CAAC,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAC,CAAA;AAE7C,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,OAAO,CAAA;IACnB,eAAe,EAAE,OAAO,CAAA;IACxB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAA;CACxC,CAAA;AAED,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAA;IACxD,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;IACzC,mBAAmB,EAAE,MAAM,CAAA;IAC3B,eAAe,EAAE,OAAO,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,EAAE,kBAAkB,CAAA;IAC7B,mBAAmB,EAAE,OAAO,CAAA;IAC5B,UAAU,EAAE,IAAI,CACd,cAAc,EACd,mBAAmB,GAAG,cAAc,GAAG,eAAe,CACvD,CAAA;IACD,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,yBAAyB,yDACe,CAAA;AAErD,wBAAgB,4BAA4B,IAAI,uBAAuB,CAOtE;AAED,wBAAgB,qBAAqB,CAAC,EACpC,iBAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,kBAAkB,GACnB,EAAE;IACD,iBAAiB,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC,IAAI,EAAE,OAAO,EAAE,CAAA;IACf,YAAY,EAAE,YAAY,EAAE,GAAG,SAAS,CAAA;IACxC,QAAQ,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,YAAY,CAAC,GAAG,SAAS,CAAA;IACtD,iBAAiB,EAAE,OAAO,CAAA;IAC1B,gBAAgB,EAAE,sBAAsB,GAAG,SAAS,CAAA;IACpD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,YAAY,EAAE,kBAAkB,GAAG,SAAS,CAAA;IAC5C,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAA;CACvC,GAAG,uBAAuB,CAuJ1B"}
|
|
@@ -78,23 +78,32 @@ function useDataTableSelection({ canSelectAllPages, data, disabledKeys, getRowId
|
|
|
78
78
|
isSelected: selectablePageKeys.length > 0 &&
|
|
79
79
|
selectedPageCount === selectablePageKeys.length,
|
|
80
80
|
onChange: (isSelected) => {
|
|
81
|
-
if (!isSelected) {
|
|
82
|
-
commitSelection([]);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
81
|
const exclusions = new Set(selection.excludedKeys);
|
|
86
|
-
for (const key of selectablePageKeys)
|
|
87
|
-
|
|
82
|
+
for (const key of selectablePageKeys) {
|
|
83
|
+
if (isSelected)
|
|
84
|
+
exclusions.delete(key);
|
|
85
|
+
else
|
|
86
|
+
exclusions.add(key);
|
|
87
|
+
}
|
|
88
88
|
commitSelection({ excludedKeys: Array.from(exclusions), keys: "all" });
|
|
89
89
|
},
|
|
90
90
|
}
|
|
91
91
|
: undefined;
|
|
92
|
+
const pageIsSelected = selectablePageKeys.length > 0 &&
|
|
93
|
+
selectablePageKeys.every((key) => selectedKeysSet.has(key));
|
|
94
|
+
const showSelectAllBanner = resultCount !== undefined &&
|
|
95
|
+
Boolean(selectable && canSelectAllPages) &&
|
|
96
|
+
selectableCount > selectablePageKeys.length &&
|
|
97
|
+
(isAllSelection(selection) || pageIsSelected);
|
|
92
98
|
return {
|
|
93
99
|
commitSelection,
|
|
94
100
|
headerCheckboxProps,
|
|
101
|
+
pageSelectableCount: selectablePageKeys.length,
|
|
95
102
|
rowPressSelects: Boolean(selectable) && (!hasRowPressAction || selectedCount > 0),
|
|
103
|
+
selectableCount,
|
|
96
104
|
selectedCount,
|
|
97
105
|
selection,
|
|
106
|
+
showSelectAllBanner,
|
|
98
107
|
tableProps,
|
|
99
108
|
totalCount,
|
|
100
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataTableSelection.js","sources":["../../../src/components/DataTable/useDataTableSelection.ts"],"sourcesContent":["import { createContext, useContext, useMemo, useState } from \"react\"\nimport type {\n Key,\n Selection,\n TableProps as AriaTableProps,\n} from \"react-aria-components/Table\"\n\nimport { getRowKey } from \"./DataTableRow\"\n\ntype DataTableKey = number | string\n\n/** Explicit row keys, or every result except the listed row keys. */\nexport type DataTableSelection =\n | DataTableKey[]\n | { excludedKeys: DataTableKey[]; keys: \"all\" }\n\ntype SelectionChangeHandler =\n | ((keys: DataTableKey[]) => void)\n | ((selection: DataTableSelection) => void)\n\ntype HeaderCheckboxProps = {\n isDisabled: boolean\n isIndeterminate: boolean\n isSelected: boolean\n onChange: (isSelected: boolean) => void\n}\n\nexport interface DataTableSelectionModel {\n commitSelection: (selection: DataTableSelection) => void\n headerCheckboxProps?: HeaderCheckboxProps\n rowPressSelects: boolean\n selectedCount: number\n selection: DataTableSelection\n tableProps: Pick<\n AriaTableProps,\n \"onSelectionChange\" | \"selectedKeys\" | \"selectionMode\"\n >\n totalCount: number\n}\n\nexport const DataTableSelectionContext =\n createContext<DataTableSelectionModel | null>(null)\n\nexport function useDataTableSelectionContext(): DataTableSelectionModel {\n const model = useContext(DataTableSelectionContext)\n if (!model)\n throw new Error(\n \"DataTable selection components must be rendered inside a DataTable.\"\n )\n return model\n}\n\nexport function useDataTableSelection({\n canSelectAllPages,\n data,\n disabledKeys,\n getRowId,\n hasRowPressAction,\n onSelectedChange,\n resultCount,\n selectable,\n selectedKeys,\n totalDisabledCount,\n}: {\n canSelectAllPages: boolean | undefined\n data: unknown[]\n disabledKeys: DataTableKey[] | undefined\n getRowId: ((row: unknown) => DataTableKey) | undefined\n hasRowPressAction: boolean\n onSelectedChange: SelectionChangeHandler | undefined\n resultCount: number | undefined\n selectable: boolean | undefined\n selectedKeys: DataTableSelection | undefined\n totalDisabledCount: number | undefined\n}): DataTableSelectionModel {\n const isControlled = selectedKeys !== undefined\n const [internalSelection, setInternalSelection] =\n useState<DataTableSelection>([])\n const selection = useMemo(\n () =>\n normalizeSelection(\n selectedKeys ?? internalSelection,\n Boolean(canSelectAllPages)\n ),\n [canSelectAllPages, internalSelection, selectedKeys]\n )\n const reportSelection = onSelectedChange as\n | ((selection: DataTableSelection) => void)\n | undefined\n const commitSelection = (nextSelection: DataTableSelection) => {\n const normalized = normalizeSelection(\n nextSelection,\n Boolean(canSelectAllPages)\n )\n if (!isControlled) setInternalSelection(normalized)\n reportSelection?.(normalized)\n }\n\n const disabledKeySet = useMemo(\n () => new Set<DataTableKey>(disabledKeys),\n [disabledKeys]\n )\n const { rowKeys, rowOrder } = useMemo(() => {\n const keys = data.map((row, index) => getRowKey(row, index, getRowId))\n return {\n rowKeys: keys,\n rowOrder: new Map<Key, number>(keys.map((key, index) => [key, index])),\n }\n }, [data, getRowId])\n const selectablePageKeys = useMemo(\n () => rowKeys.filter((key) => !disabledKeySet.has(key)),\n [disabledKeySet, rowKeys]\n )\n const excludedKeySet = useMemo(\n () =>\n isAllSelection(selection)\n ? new Set<DataTableKey>(selection.excludedKeys)\n : undefined,\n [selection]\n )\n const selectedKeysSet = useMemo(\n () =>\n isAllSelection(selection)\n ? new Set<DataTableKey>(\n rowKeys.filter(\n (key) => !disabledKeySet.has(key) && !excludedKeySet?.has(key)\n )\n )\n : new Set<DataTableKey>(selection),\n [disabledKeySet, excludedKeySet, rowKeys, selection]\n )\n\n const tableProps: DataTableSelectionModel[\"tableProps\"] = selectable\n ? {\n onSelectionChange: (next: Selection) => {\n if (isAllSelection(selection)) {\n const nextPageKeys =\n next === \"all\" ? new Set<DataTableKey>(selectablePageKeys) : next\n const exclusions = new Set(selection.excludedKeys)\n for (const key of selectablePageKeys) {\n if (nextPageKeys.has(key)) exclusions.delete(key)\n else exclusions.add(key)\n }\n commitSelection({\n excludedKeys: Array.from(exclusions),\n keys: \"all\",\n })\n return\n }\n\n if (next === \"all\") {\n commitSelection(rowKeys.filter((key) => !disabledKeySet.has(key)))\n return\n }\n\n commitSelection(\n Array.from(next).sort(\n (a, b) =>\n (rowOrder.get(a) ?? Infinity) - (rowOrder.get(b) ?? Infinity)\n )\n )\n },\n selectedKeys: selectedKeysSet,\n selectionMode: \"multiple\",\n }\n : { selectionMode: \"none\" }\n\n const totalCount = resultCount ?? data.length\n const inferredDisabledCount = disabledKeySet.size\n const disabledCount = Math.min(\n Math.max(totalDisabledCount ?? inferredDisabledCount, 0),\n Math.max(totalCount, 0)\n )\n const selectableCount = Math.max(totalCount - disabledCount, 0)\n const selectedCount = isAllSelection(selection)\n ? getAllSelectedCount(\n selection.excludedKeys,\n selectableCount,\n disabledKeySet\n )\n : selection.length\n const selectedPageCount = isAllSelection(selection) ? selectedKeysSet.size : 0\n\n const headerCheckboxProps = isAllSelection(selection)\n ? {\n isDisabled: selectablePageKeys.length === 0,\n isIndeterminate:\n selectedPageCount > 0 &&\n selectedPageCount < selectablePageKeys.length,\n isSelected:\n selectablePageKeys.length > 0 &&\n selectedPageCount === selectablePageKeys.length,\n onChange: (isSelected: boolean) => {\n if (!isSelected) {\n commitSelection([])\n return\n }\n const exclusions = new Set(selection.excludedKeys)\n for (const key of selectablePageKeys) exclusions.delete(key)\n commitSelection({ excludedKeys: Array.from(exclusions), keys: \"all\" })\n },\n }\n : undefined\n\n return {\n commitSelection,\n headerCheckboxProps,\n rowPressSelects:\n Boolean(selectable) && (!hasRowPressAction || selectedCount > 0),\n selectedCount,\n selection,\n tableProps,\n totalCount,\n }\n}\n\nfunction isAllSelection(\n selection: DataTableSelection\n): selection is Extract<DataTableSelection, { keys: \"all\" }> {\n return !Array.isArray(selection)\n}\n\nfunction normalizeSelection(\n selection: unknown,\n canSelectAllPages: boolean\n): DataTableSelection {\n if (Array.isArray(selection))\n return Array.from(new Set(selection.filter(isDataTableKey)))\n if (\n !canSelectAllPages ||\n selection === null ||\n typeof selection !== \"object\" ||\n !(\"keys\" in selection) ||\n selection.keys !== \"all\" ||\n !(\"excludedKeys\" in selection) ||\n !Array.isArray(selection.excludedKeys)\n )\n return []\n return {\n excludedKeys: Array.from(\n new Set(selection.excludedKeys.filter(isDataTableKey))\n ),\n keys: \"all\",\n }\n}\n\nfunction isDataTableKey(value: unknown): value is DataTableKey {\n return typeof value === \"number\" || typeof value === \"string\"\n}\n\nfunction getAllSelectedCount(\n excludedKeys: DataTableKey[],\n selectableCount: number,\n disabledKeys: Set<DataTableKey>\n): number {\n let excludedCount = 0\n for (const key of excludedKeys) if (!disabledKeys.has(key)) excludedCount += 1\n return Math.max(selectableCount - excludedCount, 0)\n}\n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
+
{"version":3,"file":"useDataTableSelection.js","sources":["../../../src/components/DataTable/useDataTableSelection.ts"],"sourcesContent":["import { createContext, useContext, useMemo, useState } from \"react\"\nimport type {\n Key,\n Selection,\n TableProps as AriaTableProps,\n} from \"react-aria-components/Table\"\n\nimport { getRowKey } from \"./DataTableRow\"\n\ntype DataTableKey = number | string\n\n/** Explicit row keys, or every result except the listed row keys. */\nexport type DataTableSelection =\n | DataTableKey[]\n | { excludedKeys: DataTableKey[]; keys: \"all\" }\n\ntype SelectionChangeHandler =\n | ((keys: DataTableKey[]) => void)\n | ((selection: DataTableSelection) => void)\n\ntype HeaderCheckboxProps = {\n isDisabled: boolean\n isIndeterminate: boolean\n isSelected: boolean\n onChange: (isSelected: boolean) => void\n}\n\nexport interface DataTableSelectionModel {\n commitSelection: (selection: DataTableSelection) => void\n headerCheckboxProps?: HeaderCheckboxProps\n pageSelectableCount: number\n rowPressSelects: boolean\n selectableCount: number\n selectedCount: number\n selection: DataTableSelection\n showSelectAllBanner: boolean\n tableProps: Pick<\n AriaTableProps,\n \"onSelectionChange\" | \"selectedKeys\" | \"selectionMode\"\n >\n totalCount: number\n}\n\nexport const DataTableSelectionContext =\n createContext<DataTableSelectionModel | null>(null)\n\nexport function useDataTableSelectionContext(): DataTableSelectionModel {\n const model = useContext(DataTableSelectionContext)\n if (!model)\n throw new Error(\n \"DataTable selection components must be rendered inside a DataTable.\"\n )\n return model\n}\n\nexport function useDataTableSelection({\n canSelectAllPages,\n data,\n disabledKeys,\n getRowId,\n hasRowPressAction,\n onSelectedChange,\n resultCount,\n selectable,\n selectedKeys,\n totalDisabledCount,\n}: {\n canSelectAllPages: boolean | undefined\n data: unknown[]\n disabledKeys: DataTableKey[] | undefined\n getRowId: ((row: unknown) => DataTableKey) | undefined\n hasRowPressAction: boolean\n onSelectedChange: SelectionChangeHandler | undefined\n resultCount: number | undefined\n selectable: boolean | undefined\n selectedKeys: DataTableSelection | undefined\n totalDisabledCount: number | undefined\n}): DataTableSelectionModel {\n const isControlled = selectedKeys !== undefined\n const [internalSelection, setInternalSelection] =\n useState<DataTableSelection>([])\n const selection = useMemo(\n () =>\n normalizeSelection(\n selectedKeys ?? internalSelection,\n Boolean(canSelectAllPages)\n ),\n [canSelectAllPages, internalSelection, selectedKeys]\n )\n const reportSelection = onSelectedChange as\n | ((selection: DataTableSelection) => void)\n | undefined\n const commitSelection = (nextSelection: DataTableSelection) => {\n const normalized = normalizeSelection(\n nextSelection,\n Boolean(canSelectAllPages)\n )\n if (!isControlled) setInternalSelection(normalized)\n reportSelection?.(normalized)\n }\n\n const disabledKeySet = useMemo(\n () => new Set<DataTableKey>(disabledKeys),\n [disabledKeys]\n )\n const { rowKeys, rowOrder } = useMemo(() => {\n const keys = data.map((row, index) => getRowKey(row, index, getRowId))\n return {\n rowKeys: keys,\n rowOrder: new Map<Key, number>(keys.map((key, index) => [key, index])),\n }\n }, [data, getRowId])\n const selectablePageKeys = useMemo(\n () => rowKeys.filter((key) => !disabledKeySet.has(key)),\n [disabledKeySet, rowKeys]\n )\n const excludedKeySet = useMemo(\n () =>\n isAllSelection(selection)\n ? new Set<DataTableKey>(selection.excludedKeys)\n : undefined,\n [selection]\n )\n const selectedKeysSet = useMemo(\n () =>\n isAllSelection(selection)\n ? new Set<DataTableKey>(\n rowKeys.filter(\n (key) => !disabledKeySet.has(key) && !excludedKeySet?.has(key)\n )\n )\n : new Set<DataTableKey>(selection),\n [disabledKeySet, excludedKeySet, rowKeys, selection]\n )\n\n const tableProps: DataTableSelectionModel[\"tableProps\"] = selectable\n ? {\n onSelectionChange: (next: Selection) => {\n if (isAllSelection(selection)) {\n const nextPageKeys =\n next === \"all\" ? new Set<DataTableKey>(selectablePageKeys) : next\n const exclusions = new Set(selection.excludedKeys)\n for (const key of selectablePageKeys) {\n if (nextPageKeys.has(key)) exclusions.delete(key)\n else exclusions.add(key)\n }\n commitSelection({\n excludedKeys: Array.from(exclusions),\n keys: \"all\",\n })\n return\n }\n\n if (next === \"all\") {\n commitSelection(rowKeys.filter((key) => !disabledKeySet.has(key)))\n return\n }\n\n commitSelection(\n Array.from(next).sort(\n (a, b) =>\n (rowOrder.get(a) ?? Infinity) - (rowOrder.get(b) ?? Infinity)\n )\n )\n },\n selectedKeys: selectedKeysSet,\n selectionMode: \"multiple\",\n }\n : { selectionMode: \"none\" }\n\n const totalCount = resultCount ?? data.length\n const inferredDisabledCount = disabledKeySet.size\n const disabledCount = Math.min(\n Math.max(totalDisabledCount ?? inferredDisabledCount, 0),\n Math.max(totalCount, 0)\n )\n const selectableCount = Math.max(totalCount - disabledCount, 0)\n const selectedCount = isAllSelection(selection)\n ? getAllSelectedCount(\n selection.excludedKeys,\n selectableCount,\n disabledKeySet\n )\n : selection.length\n const selectedPageCount = isAllSelection(selection) ? selectedKeysSet.size : 0\n\n const headerCheckboxProps = isAllSelection(selection)\n ? {\n isDisabled: selectablePageKeys.length === 0,\n isIndeterminate:\n selectedPageCount > 0 &&\n selectedPageCount < selectablePageKeys.length,\n isSelected:\n selectablePageKeys.length > 0 &&\n selectedPageCount === selectablePageKeys.length,\n onChange: (isSelected: boolean) => {\n const exclusions = new Set(selection.excludedKeys)\n for (const key of selectablePageKeys) {\n if (isSelected) exclusions.delete(key)\n else exclusions.add(key)\n }\n commitSelection({ excludedKeys: Array.from(exclusions), keys: \"all\" })\n },\n }\n : undefined\n\n const pageIsSelected =\n selectablePageKeys.length > 0 &&\n selectablePageKeys.every((key) => selectedKeysSet.has(key))\n const showSelectAllBanner =\n resultCount !== undefined &&\n Boolean(selectable && canSelectAllPages) &&\n selectableCount > selectablePageKeys.length &&\n (isAllSelection(selection) || pageIsSelected)\n\n return {\n commitSelection,\n headerCheckboxProps,\n pageSelectableCount: selectablePageKeys.length,\n rowPressSelects:\n Boolean(selectable) && (!hasRowPressAction || selectedCount > 0),\n selectableCount,\n selectedCount,\n selection,\n showSelectAllBanner,\n tableProps,\n totalCount,\n }\n}\n\nfunction isAllSelection(\n selection: DataTableSelection\n): selection is Extract<DataTableSelection, { keys: \"all\" }> {\n return !Array.isArray(selection)\n}\n\nfunction normalizeSelection(\n selection: unknown,\n canSelectAllPages: boolean\n): DataTableSelection {\n if (Array.isArray(selection))\n return Array.from(new Set(selection.filter(isDataTableKey)))\n if (\n !canSelectAllPages ||\n selection === null ||\n typeof selection !== \"object\" ||\n !(\"keys\" in selection) ||\n selection.keys !== \"all\" ||\n !(\"excludedKeys\" in selection) ||\n !Array.isArray(selection.excludedKeys)\n )\n return []\n return {\n excludedKeys: Array.from(\n new Set(selection.excludedKeys.filter(isDataTableKey))\n ),\n keys: \"all\",\n }\n}\n\nfunction isDataTableKey(value: unknown): value is DataTableKey {\n return typeof value === \"number\" || typeof value === \"string\"\n}\n\nfunction getAllSelectedCount(\n excludedKeys: DataTableKey[],\n selectableCount: number,\n disabledKeys: Set<DataTableKey>\n): number {\n let excludedCount = 0\n for (const key of excludedKeys) if (!disabledKeys.has(key)) excludedCount += 1\n return Math.max(selectableCount - excludedCount, 0)\n}\n"],"names":[],"mappings":";;;MA2Ca,yBAAyB,GACpC,aAAa,CAAiC,IAAI;SAEpC,4BAA4B,GAAA;AAC1C,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,yBAAyB,CAAC;AACnD,IAAA,IAAI,CAAC,KAAK;AACR,QAAA,MAAM,IAAI,KAAK,CACb,qEAAqE,CACtE;AACH,IAAA,OAAO,KAAK;AACd;AAEM,SAAU,qBAAqB,CAAC,EACpC,iBAAiB,EACjB,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,kBAAkB,GAYnB,EAAA;AACC,IAAA,MAAM,YAAY,GAAG,YAAY,KAAK,SAAS;IAC/C,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAC7C,QAAQ,CAAqB,EAAE,CAAC;IAClC,MAAM,SAAS,GAAG,OAAO,CACvB,MACE,kBAAkB,CAChB,YAAY,IAAI,iBAAiB,E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IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC;AAC1B,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAC9D,IAAA,IACE,CAAC,iBAAiB;AAClB,QAAA,SAAS,KAAK,IAAI;QAClB,OAAO,SAAS,KAAK,QAAQ;AAC7B,QAAA,EAAE,MAAM,IAAI,SAAS,CAAC;QACtB,SAAS,CAAC,IAAI,KAAK,KAAK;AACxB,QAAA,EAAE,cAAc,IAAI,SAAS,CAAC;AAC9B,QAAA,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC;AAEtC,QAAA,OAAO,EAAE;IACX,OAAO;AACL,QAAA,YAAY,EAAE,KAAK,CAAC,IAAI,CACtB,IAAI,GAAG,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CACvD;AACD,QAAA,IAAI,EAAE,KAAK;KACZ;AACH;AAEA,SAAS,cAAc,CAAC,KAAc,EAAA;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ;AAC/D;AAEA,SAAS,mBAAmB,CAC1B,YAA4B,EAC5B,eAAuB,EACvB,YAA+B,EAAA;IAE/B,IAAI,aAAa,GAAG,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,YAAY;AAAE,QAAA,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,aAAa,IAAI,CAAC;IAC9E,OAAO,IAAI,CAAC,GAAG,CAAC,eAAe,GAAG,aAAa,EAAE,CAAC,CAAC;AACrD;;;;"}
|
|
@@ -114,19 +114,32 @@ export type DropdownActionElementProps<T extends object = object> = CombineAriaP
|
|
|
114
114
|
* @component
|
|
115
115
|
*/
|
|
116
116
|
export declare function DropdownAction<T extends object>({ className, destructive, disabled, staffOnly, ...restProps }: DropdownActionElementProps<T>): React.JSX.Element;
|
|
117
|
-
export interface
|
|
117
|
+
export interface DropdownLinkBaseProps extends DropdownItemBaseProps {
|
|
118
118
|
/** If `true`, sets `target="_blank"` and `rel="noreferrer noopener"`. */
|
|
119
119
|
external?: boolean;
|
|
120
|
-
/** Destination URL. */
|
|
121
|
-
href: string;
|
|
122
120
|
/**
|
|
123
121
|
* Stable identifier — required by React Aria's collection model for keying
|
|
124
122
|
* and focus tracking.
|
|
125
123
|
*/
|
|
126
124
|
id: Key;
|
|
127
125
|
}
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
export interface DropdownLinkAsChildProps extends DropdownLinkBaseProps {
|
|
127
|
+
/**
|
|
128
|
+
* Merge menu item behavior onto a single child element (e.g. a router
|
|
129
|
+
* `Link`) instead of rendering an `<a>`. When true, `href` must not be set.
|
|
130
|
+
* **Not supported in Rails.**
|
|
131
|
+
*/
|
|
132
|
+
asChild: true;
|
|
133
|
+
href?: never;
|
|
134
|
+
}
|
|
135
|
+
export interface DropdownLinkHrefProps extends DropdownLinkBaseProps {
|
|
136
|
+
asChild?: false;
|
|
137
|
+
/** Destination URL. */
|
|
138
|
+
href: string;
|
|
139
|
+
}
|
|
140
|
+
export type DropdownLinkProps = DropdownLinkAsChildProps | DropdownLinkHrefProps;
|
|
141
|
+
type AriaLinkPropsToOmit = "isDisabled" | "onAction" | "rel" | "render" | "target" | "value";
|
|
142
|
+
type AriaLinkPropsToInclude = "routerOptions" | "textValue";
|
|
130
143
|
export type DropdownLinkElementProps<T extends object = object> = CombineAriaPropsWithCustomProps<MenuItemProps<T>, DropdownLinkProps, AriaLinkPropsToOmit, AriaLinkPropsToInclude>;
|
|
131
144
|
/**
|
|
132
145
|
* A `<Dropdown>` item that navigates to a URL. Renders an RA `<MenuItem>` as
|
|
@@ -139,7 +152,7 @@ export type DropdownLinkElementProps<T extends object = object> = CombineAriaPro
|
|
|
139
152
|
*
|
|
140
153
|
* @component
|
|
141
154
|
*/
|
|
142
|
-
export declare function DropdownLink<T extends object>({ className, destructive, external, staffOnly, ...restProps }: DropdownLinkElementProps<T>): React.JSX.Element;
|
|
155
|
+
export declare function DropdownLink<T extends object>({ asChild, children, className, destructive, external, staffOnly, ...restProps }: DropdownLinkElementProps<T>): React.JSX.Element;
|
|
143
156
|
export interface DropdownSectionProps {
|
|
144
157
|
/** The items rendered within the section. */
|
|
145
158
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAGpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAEhF,OAAO,KAAK,EAAE,EAEZ,KAAK,YAAY,EACjB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EACV,GAAG,EACH,aAAa,EACb,gBAAgB,EAChB,YAAY,EACb,MAAM,uBAAuB,CAAA;AAe9B,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAA;AAEtE,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,oBAAoB,qBAO3E;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,EAAE,SA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,gBAAgB,CAAC,CAAC,CAAC,EACnB,oBAAoB,EACpB,OAAO,EACP,KAAK,CACN,CAAA;AAEH;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,EAChD,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,SAAS,EACb,EAAE,2BAA2B,CAAC,CAAC,CAAC,qBAUhC;AAED,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AAEjE;;;;;GAKG;AACH,wBAAgB,iBAAiB,sBAEhC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
1
2
|
import classNames from 'classnames';
|
|
2
3
|
import React, { useRef, useContext } from 'react';
|
|
3
4
|
import { useInteractOutside, usePreventScroll, FocusScope } from 'react-aria';
|
|
@@ -71,6 +72,10 @@ function DropdownAction({ className, destructive, disabled, staffOnly, ...restPr
|
|
|
71
72
|
"tds-dropdown-item--staff-only": staffOnly,
|
|
72
73
|
}, className), isDisabled: disabled }));
|
|
73
74
|
}
|
|
75
|
+
/** Strips RAC-injected `undefined` values (e.g. `href`) that would otherwise clobber a child's own prop of the same name via `Slot`. */
|
|
76
|
+
function omitUndefinedValues(props) {
|
|
77
|
+
return Object.fromEntries(Object.entries(props).filter(([, value]) => value !== undefined));
|
|
78
|
+
}
|
|
74
79
|
/**
|
|
75
80
|
* A `<Dropdown>` item that navigates to a URL. Renders an RA `<MenuItem>` as
|
|
76
81
|
* an anchor (`<a role="menuitem" href="…">`). Pass `external` to open in a
|
|
@@ -82,14 +87,16 @@ function DropdownAction({ className, destructive, disabled, staffOnly, ...restPr
|
|
|
82
87
|
*
|
|
83
88
|
* @component
|
|
84
89
|
*/
|
|
85
|
-
function DropdownLink({ className, destructive, external, staffOnly, ...restProps }) {
|
|
90
|
+
function DropdownLink({ asChild = false, children, className, destructive, external, staffOnly, ...restProps }) {
|
|
86
91
|
const externalProps = external
|
|
87
92
|
? { rel: "noreferrer noopener", target: "_blank" }
|
|
88
93
|
: null;
|
|
89
94
|
return (React.createElement(MenuItem, { ...restProps, ...externalProps, className: classNames("tds-dropdown-item", {
|
|
90
95
|
"tds-dropdown-item--destructive": destructive,
|
|
91
96
|
"tds-dropdown-item--staff-only": staffOnly,
|
|
92
|
-
}, className)
|
|
97
|
+
}, className), render: asChild
|
|
98
|
+
? (props) => (React.createElement(Slot, { ...omitUndefinedValues(props) }, children))
|
|
99
|
+
: undefined }, asChild ? undefined : children));
|
|
93
100
|
}
|
|
94
101
|
/**
|
|
95
102
|
* A grouped section within a `<Dropdown>`. Renders an RA `<MenuSection>`
|