@planningcenter/tapestry 4.0.0-rc.22 → 4.0.0-rc.23

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.
@@ -3,9 +3,9 @@ import type { CombineAriaPropsWithCustomProps } from "../../utilities/reactAriaP
3
3
  import React, { type ReactNode } from "react";
4
4
  import { type TableProps as AriaTableProps } from "react-aria-components/Table";
5
5
  import type { DataTableColumn } from "./DataTableColumn";
6
- import { type ResultsNoun } from "./ResultsCount";
6
+ import { type ResultNoun } from "./ResultsCount";
7
7
  import { type TableAction } from "./TableActions";
8
- export type { ResultsNoun, TableAction };
8
+ export type { ResultNoun, TableAction };
9
9
  export type Sort = {
10
10
  column: string;
11
11
  direction: "asc" | "desc";
@@ -61,10 +61,10 @@ export interface DataTableProps {
61
61
  /** Callback invoked when the sort state changes. */
62
62
  onSortChange?: (sort: Sort) => void;
63
63
  /**
64
- * Overrides the number shown by the `resultsNoun` count, which otherwise
64
+ * Overrides the number shown by the `resultNoun` count, which otherwise
65
65
  * uses the length of `data`. Use this when the table renders only part of
66
66
  * the result set — a paginated or virtualized table — so the count reflects
67
- * the whole set. Has no effect unless `resultsNoun` is set.
67
+ * the whole set. Has no effect unless `resultNoun` is set.
68
68
  */
69
69
  resultCount?: number;
70
70
  /**
@@ -84,7 +84,7 @@ export interface DataTableProps {
84
84
  * plural form (e.g. `"items"` or `"people"`) unless an `aria-label` is passed
85
85
  * directly, which always takes precedence; `true` never provides a label.
86
86
  */
87
- resultsNoun?: ResultsNoun;
87
+ resultNoun?: ResultNoun;
88
88
  /** Ref to the scroll container the sticky header should track. Takes priority over `scrollContainerSelector`. Only used when `stickyHeader` is true. */
89
89
  scrollContainerRef?: React.RefObject<HTMLElement>;
90
90
  /** CSS selector for the scroll container the sticky header should track. Only used when `stickyHeader` is true. Defaults to ".content-wrap" */
@@ -123,7 +123,7 @@ export type DataTableElementProps = CombineAriaPropsWithCustomProps<AriaTablePro
123
123
  * @component
124
124
  */
125
125
  export declare const DataTable: {
126
- ({ className, columns, data, emptyState, errorState, getRowId, getRowLink, id, loadingState, resultCount, resultsNoun, scrollContainerRef, scrollContainerSelector, selectable, selectedKeys: controlledSelectedKeys, stickyHeader, sortBy, tableActions, onRowClick, onSelectedChange, onSortChange, ...restProps }: DataTableElementProps): React.JSX.Element;
126
+ ({ className, columns, data, emptyState, errorState, getRowId, getRowLink, id, loadingState, resultCount, resultNoun, scrollContainerRef, scrollContainerSelector, selectable, selectedKeys: controlledSelectedKeys, stickyHeader, sortBy, tableActions, onRowClick, onSelectedChange, onSortChange, ...restProps }: DataTableElementProps): React.JSX.Element;
127
127
  displayName: string;
128
128
  };
129
129
  //# sourceMappingURL=DataTable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAIpB,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAA;AAGhF,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AACd,OAAO,EAWL,KAAK,UAAU,IAAI,cAAc,EAClC,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAGxD,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,gBAAgB,CAAA;AAE/D,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,CAAA;AAExC,MAAM,MAAM,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,CAAA;AAEhE,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAEhE,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,OAAO,E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B,GAAG,KAAK,CAAA;AAEpC,MAAM,MAAM,qBAAqB,GAAG,+BAA+B,CACjE,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,uBAAuB,CACxB,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS;yTAuBnB,qBAAqB;;CAgNvB,CAAA"}
@@ -11,7 +11,7 @@ import { useId } from '../../utilities/useId.js';
11
11
  import { Table, TableHeader, Column, Checkbox, TableBody, Row, Cell } from 'react-aria-components/Table';
12
12
  import { prepareColumn } from './DataTableColumnTypes.js';
13
13
  import { getRowKey } from './DataTableRow.js';
14
- import { hasResultsCount, resolveResultsNounLabel, ResultsCount } from './ResultsCount.js';
14
+ import { hasResultsCount, resolveResultNounLabel, ResultsCount } from './ResultsCount.js';
15
15
  import { TableActions } from './TableActions.js';
16
16
 
17
17
  const DEFAULT_ERROR_STATE = "Something went wrong.";
@@ -28,7 +28,7 @@ const DEFAULT_ERROR_STATE = "Something went wrong.";
28
28
  *
29
29
  * @component
30
30
  */
31
- const DataTable = ({ className, columns, data, emptyState, errorState, getRowId, getRowLink, id, loadingState = "idle", resultCount, resultsNoun, scrollContainerRef, scrollContainerSelector = ".content-wrap", selectable, selectedKeys: controlledSelectedKeys, stickyHeader, sortBy, tableActions, onRowClick, onSelectedChange, onSortChange, ...restProps }) => {
31
+ const DataTable = ({ className, columns, data, emptyState, errorState, getRowId, getRowLink, id, loadingState = "idle", resultCount, resultNoun, scrollContainerRef, scrollContainerSelector = ".content-wrap", selectable, selectedKeys: controlledSelectedKeys, stickyHeader, sortBy, tableActions, onRowClick, onSelectedChange, onSortChange, ...restProps }) => {
32
32
  const rowsAreInteractive = Boolean(onRowClick || getRowLink || selectable);
33
33
  const combinedClassName = classNames("tds-data-table-grid", className);
34
34
  const sortDescriptor = useSortDescriptor(sortBy);
@@ -76,25 +76,25 @@ const DataTable = ({ className, columns, data, emptyState, errorState, getRowId,
76
76
  const stableId = useId();
77
77
  const tableId = id || `tds-data-table-${stableId}`;
78
78
  const resultsCountId = `${tableId}-results-count`;
79
- const describedBy = hasResultsCount(resultsNoun)
79
+ const describedBy = hasResultsCount(resultNoun)
80
80
  ? [restProps["aria-describedby"], resultsCountId].filter(Boolean).join(" ")
81
81
  : restProps["aria-describedby"];
82
82
  // A caller-supplied `aria-label` always wins; otherwise the results noun
83
83
  // provides the table's accessible name so a label is present whenever a noun
84
84
  // is given. Array nouns are transformed to their plural form.
85
- const ariaLabel = restProps["aria-label"] || resolveResultsNounLabel(resultsNoun);
85
+ const ariaLabel = restProps["aria-label"] || resolveResultNounLabel(resultNoun);
86
86
  const hasActions = (tableActions?.length ?? 0) > 0;
87
- const showHeader = Boolean(resultsNoun || hasActions);
87
+ const showHeader = Boolean(resultNoun || hasActions);
88
88
  return (React__default.createElement("div", { className: classNames("tds-data-table", {
89
89
  "tds-data-table--sticky-header": hasScrollContainer,
90
90
  }) },
91
91
  React__default.createElement("div", { className: "tds-data-table-frame" },
92
92
  showHeader && (React__default.createElement("div", { className: "tds-data-table-frame-header" },
93
- React__default.createElement(ResultsCount, { id: resultsCountId, resultsNoun: resultsNoun, selectable: selectable, selectedCount: selectedKeys.length,
93
+ React__default.createElement(ResultsCount, { id: resultsCountId, resultNoun: resultNoun, selectable: selectable, selectedCount: selectedKeys.length,
94
94
  // An explicit `resultCount` covers the whole result set, which a
95
95
  // paginated table's `data` doesn't.
96
96
  totalCount: resultCount ?? data.length }),
97
- hasActions && (React__default.createElement(TableActions, { actions: tableActions, resultsNoun: resultsNoun, selectedKeys: selectedKeys })))),
97
+ hasActions && (React__default.createElement(TableActions, { actions: tableActions, resultNoun: resultNoun, selectedKeys: selectedKeys })))),
98
98
  React__default.createElement("div", { ref: wrapperRef, className: "tds-data-table-scroll-wrapper" },
99
99
  React__default.createElement("div", { className: "tds-data-table-scroll" },
100
100
  React__default.createElement(Table, { ...restProps, ...selectableProps, ...(ariaLabel ? { "aria-label": ariaLabel } : {}), ...(describedBy ? { "aria-describedby": describedBy } : {}), ...{ id: tableId }, className: combinedClassName, sortDescriptor: sortDescriptor, onSortChange: (sort) => {
@@ -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 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 type Key,\n Row,\n type Selection,\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 resolveResultsNounLabel,\n ResultsCount,\n type ResultsNoun,\n} from \"./ResultsCount\"\nimport { type TableAction, TableActions } from \"./TableActions\"\n\nexport type { ResultsNoun, TableAction }\n\nexport type Sort = { column: string; direction: \"asc\" | \"desc\" }\n\nexport type DataTableLoadingState = \"error\" | \"idle\" | \"loading\"\n\nexport interface DataTableProps {\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 /** The array of rows to display. */\n data: unknown[]\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 * 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 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 /**\n * Called when the set of selected rows changes. Always receives a plain\n * array of row keys — never React Aria's `\"all\"` sentinel, which is\n * resolved to the concrete keys of the loaded rows.\n */\n onSelectedChange?: (keys: (number | string)[]) => void\n /** Callback invoked when the sort state changes. */\n onSortChange?: (sort: Sort) => void\n /**\n * Overrides the number shown by the `resultsNoun` 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. Has no effect unless `resultsNoun` 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, e.g. `\"2 people selected\"`. The count\n * is linked to the table with `aria-describedby` so screen readers announce\n * it as a description of the table. When a string or `[singular, plural]`\n * tuple is provided, the noun also supplies the table's `aria-label` in its\n * plural form (e.g. `\"items\"` or `\"people\"`) unless an `aria-label` is passed\n * directly, which always takes precedence; `true` never provides a label.\n */\n resultsNoun?: ResultsNoun\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 /** Enables row selection via checkboxes, including a \"select all\" checkbox in the header. */\n selectable?: boolean\n /** The selected row keys. Keys are the values returned by `getRowId` (or `row.id`, or the row's index). */\n selectedKeys?: (number | string)[]\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 * Table actions rendered as an `IconButton` group directly after the results\n * count, above the table. Each entry becomes an icon button whose `callback`\n * receives the ids of the currently selected rows. Unlike the original RFC,\n * these are not gated on `selectable` — actions such as print or export can\n * operate without a row selection.\n */\n tableActions?: TableAction[]\n}\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 * Sorting, filtering, pagination, and other RFC features are not yet\n * implemented.\n *\n * @component\n */\nexport const DataTable = ({\n className,\n columns,\n data,\n emptyState,\n errorState,\n getRowId,\n getRowLink,\n id,\n loadingState = \"idle\",\n resultCount,\n resultsNoun,\n scrollContainerRef,\n scrollContainerSelector = \".content-wrap\",\n selectable,\n selectedKeys: controlledSelectedKeys,\n stickyHeader,\n sortBy,\n tableActions,\n onRowClick,\n onSelectedChange,\n onSortChange,\n ...restProps\n}: DataTableElementProps) => {\n const rowsAreInteractive = Boolean(onRowClick || getRowLink || 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\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 // Selection is controlled when `selectedKeys` is provided; otherwise it's\n // tracked internally so the results count and table actions still reflect it.\n const isControlled = controlledSelectedKeys !== undefined\n const [internalSelectedKeys, setInternalSelectedKeys] = useState<\n (number | string)[]\n >([])\n const selectedKeys = isControlled\n ? controlledSelectedKeys\n : internalSelectedKeys\n\n const selectableProps = useSelectableProps({\n data,\n getRowId,\n onSelectedChange: (keys) => {\n if (!isControlled) setInternalSelectedKeys(keys)\n onSelectedChange?.(keys)\n },\n selectable,\n selectedKeys,\n })\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(resultsNoun)\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 ariaLabel =\n restProps[\"aria-label\"] || resolveResultsNounLabel(resultsNoun)\n\n const hasActions = (tableActions?.length ?? 0) > 0\n const showHeader = Boolean(resultsNoun || hasActions)\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 <div className=\"tds-data-table-frame-header\">\n <ResultsCount\n id={resultsCountId}\n resultsNoun={resultsNoun}\n selectable={selectable}\n selectedCount={selectedKeys.length}\n // An explicit `resultCount` covers the whole result set, which a\n // paginated table's `data` doesn't.\n totalCount={resultCount ?? data.length}\n />\n {hasActions && (\n <TableActions\n actions={tableActions!} // Safe to assert non-null here because of `hasActions`\n resultsNoun={resultsNoun}\n selectedKeys={selectedKeys}\n />\n )}\n </div>\n )}\n <div ref={wrapperRef} className=\"tds-data-table-scroll-wrapper\">\n <div className=\"tds-data-table-scroll\">\n <Table\n {...restProps}\n {...selectableProps}\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 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 <Checkbox\n slot=\"selection\"\n className=\"tds-data-table-selectable-checkbox\"\n />\n </Column>\n )}\n {preparedColumns.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 </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 })}\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 {preparedColumns.map((prepared) => (\n <Cell\n key={prepared.column.name}\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 </Row>\n )\n })}\n </TableBody>\n </Table>\n </div>\n </div>\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\n/**\n * Resolves the `<Table>` selection props, driving React Aria's `<Table>` off\n * the component's selection state. `onSelectedChange` always receives a plain\n * array of keys: React Aria's `\"all\"` selection sentinel (used for\n * infinite-loading collections, which this component doesn't have) is resolved\n * to the concrete keys of the currently loaded rows.\n */\nfunction useSelectableProps({\n data,\n getRowId,\n onSelectedChange,\n selectable,\n selectedKeys,\n}: {\n data: unknown[]\n getRowId: ((row: unknown) => number | string) | undefined\n onSelectedChange: (keys: (number | string)[]) => void\n selectable: boolean | undefined\n selectedKeys: (number | string)[]\n}): Pick<\n AriaTableProps,\n \"onSelectionChange\" | \"selectedKeys\" | \"selectionMode\"\n> {\n const selectedKeysSet = useMemo(\n () => new Set<Key>(selectedKeys),\n [selectedKeys]\n )\n const { rowKeys, rowOrder } = useMemo(() => {\n const rowKeys = data.map((row, index) => getRowKey(row, index, getRowId))\n return {\n rowKeys,\n rowOrder: new Map<Key, number>(rowKeys.map((key, index) => [key, index])),\n }\n }, [data, getRowId])\n\n if (!selectable) return { selectionMode: \"none\" }\n\n return {\n onSelectionChange: (keys: Selection) => {\n // Keys not found in `rowOrder` (e.g. a previously selected row no longer\n // in `data`) sort to the end rather than being dropped.\n const resolvedKeys =\n keys === \"all\"\n ? [...rowKeys]\n : Array.from(keys).sort(\n (a, b) =>\n (rowOrder.get(a) ?? Infinity) - (rowOrder.get(b) ?? Infinity)\n )\n onSelectedChange(resolvedKeys)\n },\n selectedKeys: selectedKeysSet,\n selectionMode: \"multiple\",\n }\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":";;;;;;;;;;;;;;;;AA6IA,MAAM,mBAAmB,GAAG,uBAAuB;AAanD;;;;;;;;;;;;AAYG;AACI,MAAM,SAAS,GAAG,CAAC,EACxB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,EAAE,EACF,YAAY,GAAG,MAAM,EACrB,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,uBAAuB,GAAG,eAAe,EACzC,UAAU,EACV,YAAY,EAAE,sBAAsB,EACpC,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,GAAG,SAAS,EACU,KAAI;IAC1B,MAAM,kBAAkB,GAAG,OAAO,CAAC,UAAU,IAAI,UAAU,IAAI,UAAU,CAAC;IAC1E,MAAM,iBAAiB,GAAG,UAAU,CAAC,qBAAqB,EAAE,SAAS,CA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AAC,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 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 type Key,\n Row,\n type Selection,\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 TableAction, TableActions } from \"./TableActions\"\n\nexport type { ResultNoun, TableAction }\n\nexport type Sort = { column: string; direction: \"asc\" | \"desc\" }\n\nexport type DataTableLoadingState = \"error\" | \"idle\" | \"loading\"\n\nexport interface DataTableProps {\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 /** The array of rows to display. */\n data: unknown[]\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 * 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 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 /**\n * Called when the set of selected rows changes. Always receives a plain\n * array of row keys — never React Aria's `\"all\"` sentinel, which is\n * resolved to the concrete keys of the loaded rows.\n */\n onSelectedChange?: (keys: (number | string)[]) => void\n /** Callback invoked when the sort state changes. */\n onSortChange?: (sort: Sort) => void\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. 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, e.g. `\"2 people selected\"`. The count\n * is linked to the table with `aria-describedby` so screen readers announce\n * it as a description of the table. When a string or `[singular, plural]`\n * tuple is provided, the noun also supplies the table's `aria-label` in its\n * plural form (e.g. `\"items\"` or `\"people\"`) unless an `aria-label` is passed\n * directly, which always takes precedence; `true` never provides a label.\n */\n resultNoun?: ResultNoun\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 /** Enables row selection via checkboxes, including a \"select all\" checkbox in the header. */\n selectable?: boolean\n /** The selected row keys. Keys are the values returned by `getRowId` (or `row.id`, or the row's index). */\n selectedKeys?: (number | string)[]\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 * Table actions rendered as an `IconButton` group directly after the results\n * count, above the table. Each entry becomes an icon button whose `callback`\n * receives the ids of the currently selected rows. Unlike the original RFC,\n * these are not gated on `selectable` — actions such as print or export can\n * operate without a row selection.\n */\n tableActions?: TableAction[]\n}\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 * Sorting, filtering, pagination, and other RFC features are not yet\n * implemented.\n *\n * @component\n */\nexport const DataTable = ({\n className,\n columns,\n data,\n emptyState,\n errorState,\n getRowId,\n getRowLink,\n id,\n loadingState = \"idle\",\n resultCount,\n resultNoun,\n scrollContainerRef,\n scrollContainerSelector = \".content-wrap\",\n selectable,\n selectedKeys: controlledSelectedKeys,\n stickyHeader,\n sortBy,\n tableActions,\n onRowClick,\n onSelectedChange,\n onSortChange,\n ...restProps\n}: DataTableElementProps) => {\n const rowsAreInteractive = Boolean(onRowClick || getRowLink || 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\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 // Selection is controlled when `selectedKeys` is provided; otherwise it's\n // tracked internally so the results count and table actions still reflect it.\n const isControlled = controlledSelectedKeys !== undefined\n const [internalSelectedKeys, setInternalSelectedKeys] = useState<\n (number | string)[]\n >([])\n const selectedKeys = isControlled\n ? controlledSelectedKeys\n : internalSelectedKeys\n\n const selectableProps = useSelectableProps({\n data,\n getRowId,\n onSelectedChange: (keys) => {\n if (!isControlled) setInternalSelectedKeys(keys)\n onSelectedChange?.(keys)\n },\n selectable,\n selectedKeys,\n })\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 ariaLabel =\n restProps[\"aria-label\"] || resolveResultNounLabel(resultNoun)\n\n const hasActions = (tableActions?.length ?? 0) > 0\n const showHeader = Boolean(resultNoun || hasActions)\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 <div className=\"tds-data-table-frame-header\">\n <ResultsCount\n id={resultsCountId}\n resultNoun={resultNoun}\n selectable={selectable}\n selectedCount={selectedKeys.length}\n // An explicit `resultCount` covers the whole result set, which a\n // paginated table's `data` doesn't.\n totalCount={resultCount ?? data.length}\n />\n {hasActions && (\n <TableActions\n actions={tableActions!} // Safe to assert non-null here because of `hasActions`\n resultNoun={resultNoun}\n selectedKeys={selectedKeys}\n />\n )}\n </div>\n )}\n <div ref={wrapperRef} className=\"tds-data-table-scroll-wrapper\">\n <div className=\"tds-data-table-scroll\">\n <Table\n {...restProps}\n {...selectableProps}\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 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 <Checkbox\n slot=\"selection\"\n className=\"tds-data-table-selectable-checkbox\"\n />\n </Column>\n )}\n {preparedColumns.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 </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 })}\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 {preparedColumns.map((prepared) => (\n <Cell\n key={prepared.column.name}\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 </Row>\n )\n })}\n </TableBody>\n </Table>\n </div>\n </div>\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\n/**\n * Resolves the `<Table>` selection props, driving React Aria's `<Table>` off\n * the component's selection state. `onSelectedChange` always receives a plain\n * array of keys: React Aria's `\"all\"` selection sentinel (used for\n * infinite-loading collections, which this component doesn't have) is resolved\n * to the concrete keys of the currently loaded rows.\n */\nfunction useSelectableProps({\n data,\n getRowId,\n onSelectedChange,\n selectable,\n selectedKeys,\n}: {\n data: unknown[]\n getRowId: ((row: unknown) => number | string) | undefined\n onSelectedChange: (keys: (number | string)[]) => void\n selectable: boolean | undefined\n selectedKeys: (number | string)[]\n}): Pick<\n AriaTableProps,\n \"onSelectionChange\" | \"selectedKeys\" | \"selectionMode\"\n> {\n const selectedKeysSet = useMemo(\n () => new Set<Key>(selectedKeys),\n [selectedKeys]\n )\n const { rowKeys, rowOrder } = useMemo(() => {\n const rowKeys = data.map((row, index) => getRowKey(row, index, getRowId))\n return {\n rowKeys,\n rowOrder: new Map<Key, number>(rowKeys.map((key, index) => [key, index])),\n }\n }, [data, getRowId])\n\n if (!selectable) return { selectionMode: \"none\" }\n\n return {\n onSelectionChange: (keys: Selection) => {\n // Keys not found in `rowOrder` (e.g. a previously selected row no longer\n // in `data`) sort to the end rather than being dropped.\n const resolvedKeys =\n keys === \"all\"\n ? [...rowKeys]\n : Array.from(keys).sort(\n (a, b) =>\n (rowOrder.get(a) ?? Infinity) - (rowOrder.get(b) ?? Infinity)\n )\n onSelectedChange(resolvedKeys)\n },\n selectedKeys: selectedKeysSet,\n selectionMode: \"multiple\",\n }\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":";;;;;;;;;;;;;;;;AA6IA,MAAM,mBAAmB,GAAG,uBAAuB;AAanD;;;;;;;;;;;;AAYG;AACI,MAAM,SAAS,GAAG,CAAC,EACxB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,EACV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CAAI,CAAC;AACtE,QAAA,CAAC,CAAC;AAEF,QAAA,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC;AAC/B,QAAA,cAAc,CAAC,OAAO,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;;;;"}
@@ -4,15 +4,15 @@ import React from "react";
4
4
  * `"s"` for the plural; a `[singular, plural]` tuple supplies an irregular
5
5
  * plural; `true` defaults the noun to `"result"`; `false` renders no count.
6
6
  */
7
- export type ResultsNoun = boolean | string | [singular: string, plural: string];
7
+ export type ResultNoun = boolean | string | [singular: string, plural: string];
8
8
  export interface ResultsCountProps {
9
9
  /** An `id` for the rendered element so the table can link it via `aria-describedby`. */
10
10
  id: string;
11
11
  /**
12
- * The noun (and whether to render a count at all). See {@link ResultsNoun}.
12
+ * The noun (and whether to render a count at all). See {@link ResultNoun}.
13
13
  * When `false` or omitted, nothing renders.
14
14
  */
15
- resultsNoun?: ResultsNoun;
15
+ resultNoun?: ResultNoun;
16
16
  /** Whether the table is selectable. */
17
17
  selectable?: boolean;
18
18
  /** The number of currently selected rows. */
@@ -25,28 +25,28 @@ export interface ResultsCountProps {
25
25
  }
26
26
  /**
27
27
  * Whether a {@link ResultsCount} will render anything for the given
28
- * `resultsNoun`. A count is shown only when a noun is supplied, so callers can
28
+ * `resultNoun`. A count is shown only when a noun is supplied, so callers can
29
29
  * use this to decide whether to link the count via `aria-describedby`.
30
30
  */
31
- export declare function hasResultsCount(resultsNoun: ResultsNoun | undefined): boolean;
31
+ export declare function hasResultsCount(resultNoun: ResultNoun | undefined): boolean;
32
32
  /**
33
- * Resolves a {@link ResultsNoun} to a plain string usable as the table's
33
+ * Resolves a {@link ResultNoun} to a plain string usable as the table's
34
34
  * `aria-label`, e.g. `"people"` or `"items"`. Uses the plural form — appending
35
35
  * `"s"` to a string noun and taking the second element of a `[singular,
36
36
  * plural]` tuple — to match the count label. Returns `undefined` when no
37
37
  * meaningful noun is supplied — including the `true` default, which carries no
38
38
  * caller-provided label — so callers can fall back to their own `aria-label`.
39
39
  */
40
- export declare function resolveResultsNounLabel(resultsNoun: ResultsNoun | undefined): string | undefined;
40
+ export declare function resolveResultNounLabel(resultNoun: ResultNoun | undefined): string | undefined;
41
41
  /**
42
42
  * Renders the results count displayed above the table, e.g. `"1 result"`,
43
43
  * `"1,234 results"`, or `"2 people"`. When the table is `selectable` and rows
44
44
  * are selected, the count reflects the selection instead of the total, e.g.
45
- * `"2 people selected"`. Renders nothing when `resultsNoun` is `false` or
45
+ * `"2 people selected"`. Renders nothing when `resultNoun` is `false` or
46
46
  * omitted.
47
47
  */
48
48
  export declare const ResultsCount: {
49
- ({ id, resultsNoun, selectable, selectedCount, totalCount, }: ResultsCountProps): React.JSX.Element | null;
49
+ ({ id, resultNoun, selectable, selectedCount, totalCount, }: ResultsCountProps): React.JSX.Element | null;
50
50
  displayName: string;
51
51
  };
52
52
  //# sourceMappingURL=ResultsCount.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResultsCount.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/ResultsCount.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAE/E,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,EAAE,EAAE,MAAM,CAAA;IACV;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,SAAS,GAAG,OAAO,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,WAAW,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAIpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;kEAMtB,iBAAiB;;CAenB,CAAA"}
1
+ {"version":3,"file":"ResultsCount.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/ResultsCount.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAE9E,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,EAAE,EAAE,MAAM,CAAA;IACV;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAE3E;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,UAAU,GAAG,SAAS,GACjC,MAAM,GAAG,SAAS,CAIpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;iEAMtB,iBAAiB;;CAenB,CAAA"}
@@ -2,42 +2,42 @@ import React__default from 'react';
2
2
 
3
3
  /**
4
4
  * Whether a {@link ResultsCount} will render anything for the given
5
- * `resultsNoun`. A count is shown only when a noun is supplied, so callers can
5
+ * `resultNoun`. A count is shown only when a noun is supplied, so callers can
6
6
  * use this to decide whether to link the count via `aria-describedby`.
7
7
  */
8
- function hasResultsCount(resultsNoun) {
9
- return Boolean(resultsNoun);
8
+ function hasResultsCount(resultNoun) {
9
+ return Boolean(resultNoun);
10
10
  }
11
11
  /**
12
- * Resolves a {@link ResultsNoun} to a plain string usable as the table's
12
+ * Resolves a {@link ResultNoun} to a plain string usable as the table's
13
13
  * `aria-label`, e.g. `"people"` or `"items"`. Uses the plural form — appending
14
14
  * `"s"` to a string noun and taking the second element of a `[singular,
15
15
  * plural]` tuple — to match the count label. Returns `undefined` when no
16
16
  * meaningful noun is supplied — including the `true` default, which carries no
17
17
  * caller-provided label — so callers can fall back to their own `aria-label`.
18
18
  */
19
- function resolveResultsNounLabel(resultsNoun) {
20
- if (!resultsNoun || resultsNoun === true)
19
+ function resolveResultNounLabel(resultNoun) {
20
+ if (!resultNoun || resultNoun === true)
21
21
  return undefined;
22
22
  // A count other than 1 selects the plural form.
23
- return resolveNoun(2, resultsNoun);
23
+ return resolveNoun(2, resultNoun);
24
24
  }
25
25
  /**
26
26
  * Renders the results count displayed above the table, e.g. `"1 result"`,
27
27
  * `"1,234 results"`, or `"2 people"`. When the table is `selectable` and rows
28
28
  * are selected, the count reflects the selection instead of the total, e.g.
29
- * `"2 people selected"`. Renders nothing when `resultsNoun` is `false` or
29
+ * `"2 people selected"`. Renders nothing when `resultNoun` is `false` or
30
30
  * omitted.
31
31
  */
32
- const ResultsCount = ({ id, resultsNoun, selectable, selectedCount = 0, totalCount, }) => {
33
- if (!resultsNoun)
32
+ const ResultsCount = ({ id, resultNoun, selectable, selectedCount = 0, totalCount, }) => {
33
+ if (!resultNoun)
34
34
  return null;
35
35
  // When the table is selectable and rows are selected, the count reflects the
36
36
  // selection (e.g. `"2 people selected"`) rather than the total row count.
37
37
  const hasSelection = Boolean(selectable && selectedCount);
38
38
  const label = hasSelection
39
- ? getResultsCountLabel(selectedCount, resultsNoun, { selected: true })
40
- : getResultsCountLabel(totalCount, resultsNoun);
39
+ ? getResultsCountLabel(selectedCount, resultNoun, { selected: true })
40
+ : getResultsCountLabel(totalCount, resultNoun);
41
41
  return (React__default.createElement("p", { id: id, className: "tds-data-table-results-count" }, label));
42
42
  };
43
43
  ResultsCount.displayName = "ResultsCount";
@@ -46,31 +46,31 @@ const numberFormatter = new Intl.NumberFormat();
46
46
  * Builds the results-count label, e.g. `"1 result"`, `"1,234 results"`, or
47
47
  * `"2 people"`. The count is formatted with `Intl.NumberFormat` and the
48
48
  * singular noun is used only when the count is 1, every other count uses the
49
- * plural. `resultsNoun` may be a string (the plural appends `"s"`), a
49
+ * plural. `resultNoun` may be a string (the plural appends `"s"`), a
50
50
  * `[singular, plural]` tuple (the plural is supplied explicitly), or `true`
51
51
  * (the noun defaults to `"result"`). When `selected` is set the count reflects
52
52
  * the current selection and a `"selected"` suffix is appended, e.g.
53
53
  * `"2 people selected"`.
54
54
  */
55
- function getResultsCountLabel(count, resultsNoun, { selected = false } = {}) {
56
- const noun = resolveNoun(count, resultsNoun);
55
+ function getResultsCountLabel(count, resultNoun, { selected = false } = {}) {
56
+ const noun = resolveNoun(count, resultNoun);
57
57
  const formattedCount = numberFormatter.format(count);
58
58
  return `${formattedCount} ${noun}${selected ? " selected" : ""}`;
59
59
  }
60
60
  /**
61
61
  * Picks the singular or plural noun for `count` (singular only when `count` is
62
62
  * 1, matching English pluralization).
63
- * `resultsNoun` may be a string (the plural appends `"s"`), a
63
+ * `resultNoun` may be a string (the plural appends `"s"`), a
64
64
  * `[singular, plural]` tuple, or `true` (the noun defaults to `"result"`).
65
65
  */
66
- function resolveNoun(count, resultsNoun) {
67
- const [singular, plural] = Array.isArray(resultsNoun)
68
- ? resultsNoun
69
- : resultsNoun === true
66
+ function resolveNoun(count, resultNoun) {
67
+ const [singular, plural] = Array.isArray(resultNoun)
68
+ ? resultNoun
69
+ : resultNoun === true
70
70
  ? ["result", "results"]
71
- : [resultsNoun, `${resultsNoun}s`];
71
+ : [resultNoun, `${resultNoun}s`];
72
72
  return count === 1 ? singular : plural;
73
73
  }
74
74
 
75
- export { ResultsCount, hasResultsCount, resolveResultsNounLabel };
75
+ export { ResultsCount, hasResultsCount, resolveResultNounLabel };
76
76
  //# sourceMappingURL=ResultsCount.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ResultsCount.js","sources":["../../../src/components/DataTable/ResultsCount.tsx"],"sourcesContent":["import React from \"react\"\n\n/**\n * A noun for the results count. A string uses it as the singular and appends\n * `\"s\"` for the plural; a `[singular, plural]` tuple supplies an irregular\n * plural; `true` defaults the noun to `\"result\"`; `false` renders no count.\n */\nexport type ResultsNoun = boolean | string | [singular: string, plural: string]\n\nexport interface ResultsCountProps {\n /** An `id` for the rendered element so the table can link it via `aria-describedby`. */\n id: string\n /**\n * The noun (and whether to render a count at all). See {@link ResultsNoun}.\n * When `false` or omitted, nothing renders.\n */\n resultsNoun?: ResultsNoun\n /** Whether the table is selectable. */\n selectable?: boolean\n /** The number of currently selected rows. */\n selectedCount?: number\n /**\n * The total number of results: the caller's explicit `resultCount` when\n * supplied, otherwise `data.length`.\n */\n totalCount: number\n}\n\n/**\n * Whether a {@link ResultsCount} will render anything for the given\n * `resultsNoun`. A count is shown only when a noun is supplied, so callers can\n * use this to decide whether to link the count via `aria-describedby`.\n */\nexport function hasResultsCount(resultsNoun: ResultsNoun | undefined): boolean {\n return Boolean(resultsNoun)\n}\n\n/**\n * Resolves a {@link ResultsNoun} to a plain string usable as the table's\n * `aria-label`, e.g. `\"people\"` or `\"items\"`. Uses the plural form — appending\n * `\"s\"` to a string noun and taking the second element of a `[singular,\n * plural]` tuple — to match the count label. Returns `undefined` when no\n * meaningful noun is supplied — including the `true` default, which carries no\n * caller-provided label — so callers can fall back to their own `aria-label`.\n */\nexport function resolveResultsNounLabel(\n resultsNoun: ResultsNoun | undefined\n): string | undefined {\n if (!resultsNoun || resultsNoun === true) return undefined\n // A count other than 1 selects the plural form.\n return resolveNoun(2, resultsNoun)\n}\n\n/**\n * Renders the results count displayed above the table, e.g. `\"1 result\"`,\n * `\"1,234 results\"`, or `\"2 people\"`. When the table is `selectable` and rows\n * are selected, the count reflects the selection instead of the total, e.g.\n * `\"2 people selected\"`. Renders nothing when `resultsNoun` is `false` or\n * omitted.\n */\nexport const ResultsCount = ({\n id,\n resultsNoun,\n selectable,\n selectedCount = 0,\n totalCount,\n}: ResultsCountProps) => {\n if (!resultsNoun) return null\n\n // When the table is selectable and rows are selected, the count reflects the\n // selection (e.g. `\"2 people selected\"`) rather than the total row count.\n const hasSelection = Boolean(selectable && selectedCount)\n const label = hasSelection\n ? getResultsCountLabel(selectedCount, resultsNoun, { selected: true })\n : getResultsCountLabel(totalCount, resultsNoun)\n\n return (\n <p id={id} className=\"tds-data-table-results-count\">\n {label}\n </p>\n )\n}\n\nResultsCount.displayName = \"ResultsCount\"\n\nconst numberFormatter = new Intl.NumberFormat()\n\n/**\n * Builds the results-count label, e.g. `\"1 result\"`, `\"1,234 results\"`, or\n * `\"2 people\"`. The count is formatted with `Intl.NumberFormat` and the\n * singular noun is used only when the count is 1, every other count uses the\n * plural. `resultsNoun` may be a string (the plural appends `\"s\"`), a\n * `[singular, plural]` tuple (the plural is supplied explicitly), or `true`\n * (the noun defaults to `\"result\"`). When `selected` is set the count reflects\n * the current selection and a `\"selected\"` suffix is appended, e.g.\n * `\"2 people selected\"`.\n */\nfunction getResultsCountLabel(\n count: number,\n resultsNoun: Exclude<ResultsNoun, false>,\n { selected = false }: { selected?: boolean } = {}\n): string {\n const noun = resolveNoun(count, resultsNoun)\n const formattedCount = numberFormatter.format(count)\n return `${formattedCount} ${noun}${selected ? \" selected\" : \"\"}`\n}\n\n/**\n * Picks the singular or plural noun for `count` (singular only when `count` is\n * 1, matching English pluralization).\n * `resultsNoun` may be a string (the plural appends `\"s\"`), a\n * `[singular, plural]` tuple, or `true` (the noun defaults to `\"result\"`).\n */\nfunction resolveNoun(\n count: number,\n resultsNoun: Exclude<ResultsNoun, false>\n): string {\n const [singular, plural] = Array.isArray(resultsNoun)\n ? resultsNoun\n : resultsNoun === true\n ? [\"result\", \"results\"]\n : [resultsNoun, `${resultsNoun}s`]\n return count === 1 ? singular : plural\n}\n"],"names":["React"],"mappings":";;AA4BA;;;;AAIG;AACG,SAAU,eAAe,CAAC,WAAoC,EAAA;AAClE,IAAA,OAAO,OAAO,CAAC,WAAW,CAAC;AAC7B;AAEA;;;;;;;AAOG;AACG,SAAU,uBAAuB,CACrC,WAAoC,EAAA;AAEpC,IAAA,IAAI,CAAC,WAAW,IAAI,WAAW,KAAK,IAAI;AAAE,QAAA,OAAO,SAAS;;AAE1D,IAAA,OAAO,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC;AACpC;AAEA;;;;;;AAMG;AACI,MAAM,YAAY,GAAG,CAAC,EAC3B,EAAE,EACF,WAAW,EACX,UAAU,EACV,aAAa,GAAG,CAAC,EACjB,UAAU,GACQ,KAAI;AACtB,IAAA,IAAI,CAAC,WAAW;AAAE,QAAA,OAAO,IAAI;;;IAI7B,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,IAAI,aAAa,CAAC;IACzD,MAAM,KAAK,GAAG;AACZ,UAAE,oBAAoB,CAAC,aAAa,EAAE,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;AACrE,UAAE,oBAAoB,CAAC,UAAU,EAAE,WAAW,CAAC;AAEjD,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAG,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,8BAA8B,EAAA,EAChD,KAAK,CACJ;AAER;AAEA,YAAY,CAAC,WAAW,GAAG,cAAc;AAEzC,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE;AAE/C;;;;;;;;;AASG;AACH,SAAS,oBAAoB,CAC3B,KAAa,EACb,WAAwC,EACxC,EAAE,QAAQ,GAAG,KAAK,EAAA,GAA6B,EAAE,EAAA;IAEjD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5C,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;AACpD,IAAA,OAAO,CAAA,EAAG,cAAc,CAAA,CAAA,EAAI,IAAI,GAAG,QAAQ,GAAG,WAAW,GAAG,EAAE,EAAE;AAClE;AAEA;;;;;AAKG;AACH,SAAS,WAAW,CAClB,KAAa,EACb,WAAwC,EAAA;IAExC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW;AAClD,UAAE;UACA,WAAW,KAAK;AAChB,cAAE,CAAC,QAAQ,EAAE,SAAS;cACpB,CAAC,WAAW,EAAE,GAAG,WAAW,CAAA,CAAA,CAAG,CAAC;IACtC,OAAO,KAAK,KAAK,CAAC,GAAG,QAAQ,GAAG,MAAM;AACxC;;;;"}
1
+ {"version":3,"file":"ResultsCount.js","sources":["../../../src/components/DataTable/ResultsCount.tsx"],"sourcesContent":["import React from \"react\"\n\n/**\n * A noun for the results count. A string uses it as the singular and appends\n * `\"s\"` for the plural; a `[singular, plural]` tuple supplies an irregular\n * plural; `true` defaults the noun to `\"result\"`; `false` renders no count.\n */\nexport type ResultNoun = boolean | string | [singular: string, plural: string]\n\nexport interface ResultsCountProps {\n /** An `id` for the rendered element so the table can link it via `aria-describedby`. */\n id: string\n /**\n * The noun (and whether to render a count at all). See {@link ResultNoun}.\n * When `false` or omitted, nothing renders.\n */\n resultNoun?: ResultNoun\n /** Whether the table is selectable. */\n selectable?: boolean\n /** The number of currently selected rows. */\n selectedCount?: number\n /**\n * The total number of results: the caller's explicit `resultCount` when\n * supplied, otherwise `data.length`.\n */\n totalCount: number\n}\n\n/**\n * Whether a {@link ResultsCount} will render anything for the given\n * `resultNoun`. A count is shown only when a noun is supplied, so callers can\n * use this to decide whether to link the count via `aria-describedby`.\n */\nexport function hasResultsCount(resultNoun: ResultNoun | undefined): boolean {\n return Boolean(resultNoun)\n}\n\n/**\n * Resolves a {@link ResultNoun} to a plain string usable as the table's\n * `aria-label`, e.g. `\"people\"` or `\"items\"`. Uses the plural form — appending\n * `\"s\"` to a string noun and taking the second element of a `[singular,\n * plural]` tuple — to match the count label. Returns `undefined` when no\n * meaningful noun is supplied — including the `true` default, which carries no\n * caller-provided label — so callers can fall back to their own `aria-label`.\n */\nexport function resolveResultNounLabel(\n resultNoun: ResultNoun | undefined\n): string | undefined {\n if (!resultNoun || resultNoun === true) return undefined\n // A count other than 1 selects the plural form.\n return resolveNoun(2, resultNoun)\n}\n\n/**\n * Renders the results count displayed above the table, e.g. `\"1 result\"`,\n * `\"1,234 results\"`, or `\"2 people\"`. When the table is `selectable` and rows\n * are selected, the count reflects the selection instead of the total, e.g.\n * `\"2 people selected\"`. Renders nothing when `resultNoun` is `false` or\n * omitted.\n */\nexport const ResultsCount = ({\n id,\n resultNoun,\n selectable,\n selectedCount = 0,\n totalCount,\n}: ResultsCountProps) => {\n if (!resultNoun) return null\n\n // When the table is selectable and rows are selected, the count reflects the\n // selection (e.g. `\"2 people selected\"`) rather than the total row count.\n const hasSelection = Boolean(selectable && selectedCount)\n const label = hasSelection\n ? getResultsCountLabel(selectedCount, resultNoun, { selected: true })\n : getResultsCountLabel(totalCount, resultNoun)\n\n return (\n <p id={id} className=\"tds-data-table-results-count\">\n {label}\n </p>\n )\n}\n\nResultsCount.displayName = \"ResultsCount\"\n\nconst numberFormatter = new Intl.NumberFormat()\n\n/**\n * Builds the results-count label, e.g. `\"1 result\"`, `\"1,234 results\"`, or\n * `\"2 people\"`. The count is formatted with `Intl.NumberFormat` and the\n * singular noun is used only when the count is 1, every other count uses the\n * plural. `resultNoun` may be a string (the plural appends `\"s\"`), a\n * `[singular, plural]` tuple (the plural is supplied explicitly), or `true`\n * (the noun defaults to `\"result\"`). When `selected` is set the count reflects\n * the current selection and a `\"selected\"` suffix is appended, e.g.\n * `\"2 people selected\"`.\n */\nfunction getResultsCountLabel(\n count: number,\n resultNoun: Exclude<ResultNoun, false>,\n { selected = false }: { selected?: boolean } = {}\n): string {\n const noun = resolveNoun(count, resultNoun)\n const formattedCount = numberFormatter.format(count)\n return `${formattedCount} ${noun}${selected ? \" selected\" : \"\"}`\n}\n\n/**\n * Picks the singular or plural noun for `count` (singular only when `count` is\n * 1, matching English pluralization).\n * `resultNoun` may be a string (the plural appends `\"s\"`), a\n * `[singular, plural]` tuple, or `true` (the noun defaults to `\"result\"`).\n */\nfunction resolveNoun(\n count: number,\n resultNoun: Exclude<ResultNoun, false>\n): string {\n const [singular, plural] = Array.isArray(resultNoun)\n ? resultNoun\n : resultNoun === true\n ? [\"result\", \"results\"]\n : [resultNoun, `${resultNoun}s`]\n return count === 1 ? singular : plural\n}\n"],"names":["React"],"mappings":";;AA4BA;;;;AAIG;AACG,SAAU,eAAe,CAAC,UAAkC,EAAA;AAChE,IAAA,OAAO,OAAO,CAAC,UAAU,CAAC;AAC5B;AAEA;;;;;;;AAOG;AACG,SAAU,sBAAsB,CACpC,UAAkC,EAAA;AAElC,IAAA,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,IAAI;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AAU,KAAK;AACf,cAAE,CAAC,QAAQ,EAAE,SAAS;cACpB,CAAC,UAAU,EAAE,GAAG,UAAU,CAAA,CAAA,CAAG,CAAC;IACpC,OAAO,KAAK,KAAK,CAAC,GAAG,QAAQ,GAAG,MAAM;AACxC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React, { type ReactNode } from "react";
2
- import type { ResultsNoun } from "./ResultsCount";
2
+ import type { ResultNoun } from "./ResultsCount";
3
3
  /**
4
4
  * A table action rendered as an `IconButton` in the button group above the
5
5
  * table. Replaces the original RFC's `{ buttonProps; callback }` shape with a
@@ -23,9 +23,9 @@ export interface TableActionsProps {
23
23
  actions: TableAction[];
24
24
  /**
25
25
  * The noun used to describe the selection in each action's `aria-label`.
26
- * See {@link ResultsNoun}.
26
+ * See {@link ResultNoun}.
27
27
  */
28
- resultsNoun?: ResultsNoun;
28
+ resultNoun?: ResultNoun;
29
29
  /** The keys of the currently selected rows, passed to each action's `callback`. */
30
30
  selectedKeys: (number | string)[];
31
31
  }
@@ -35,7 +35,7 @@ export interface TableActionsProps {
35
35
  * `callback` receives the keys of the currently selected rows.
36
36
  */
37
37
  export declare const TableActions: {
38
- ({ actions, resultsNoun, selectedKeys, }: TableActionsProps): React.JSX.Element;
38
+ ({ actions, resultNoun, selectedKeys, }: TableActionsProps): React.JSX.Element;
39
39
  displayName: string;
40
40
  };
41
41
  //# sourceMappingURL=TableActions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/TableActions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,IAAI,CAAA;IACtD,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yDAAyD;IACzD,IAAI,EAAE,SAAS,CAAA;IACf,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;CACrD,CAAA;AAED,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,mFAAmF;IACnF,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY;8CAItB,iBAAiB;;CAwBnB,CAAA"}
1
+ {"version":3,"file":"TableActions.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/TableActions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KAAK,IAAI,CAAA;IACtD,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,yDAAyD;IACzD,IAAI,EAAE,SAAS,CAAA;IACf,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;CACrD,CAAA;AAED,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,mFAAmF;IACnF,YAAY,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;CAClC;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY;6CAItB,iBAAiB;;CAqBnB,CAAA"}
@@ -12,10 +12,10 @@ import React__default from 'react';
12
12
  * the results count, above the table. Each entry becomes an icon button whose
13
13
  * `callback` receives the keys of the currently selected rows.
14
14
  */
15
- const TableActions = ({ actions, resultsNoun, selectedKeys, }) => {
15
+ const TableActions = ({ actions, resultNoun, selectedKeys, }) => {
16
16
  // The count/noun suffix is the same for every table action, so compute it once
17
17
  // here rather than per-button inside the map below.
18
- const countSuffix = getTableActionCountSuffix(selectedKeys.length, resultsNoun);
18
+ const countSuffix = getTableActionCountSuffix(selectedKeys.length, resultNoun);
19
19
  return (React__default.createElement(ButtonGroup, { "aria-label": "Table actions" }, actions.map(({ callback, disabled, icon, label, onClick }) => (React__default.createElement(IconButton, { key: label, "aria-label": `${label}${countSuffix}`, disabled: disabled, icon: icon, onClick: (event) => {
20
20
  onClick?.(event);
21
21
  callback?.(selectedKeys);
@@ -27,16 +27,16 @@ const numberFormatter = new Intl.NumberFormat();
27
27
  * The count/noun suffix appended to each table action's `aria-label` when rows
28
28
  * are selected, e.g. `" (2 selected people)"` — so `"Email"` reads as
29
29
  * `"Email (2 selected people)"`. Empty when nothing is selected. Falls back to
30
- * the default `"result"` noun when `resultsNoun` isn't provided. Shared across
30
+ * the default `"result"` noun when `resultNoun` isn't provided. Shared across
31
31
  * every action, so it's computed once rather than per-button.
32
32
  */
33
- function getTableActionCountSuffix(count, resultsNoun) {
33
+ function getTableActionCountSuffix(count, resultNoun) {
34
34
  if (!count)
35
35
  return "";
36
- const [singular, plural] = Array.isArray(resultsNoun)
37
- ? resultsNoun
38
- : typeof resultsNoun === "string"
39
- ? [resultsNoun, `${resultsNoun}s`]
36
+ const [singular, plural] = Array.isArray(resultNoun)
37
+ ? resultNoun
38
+ : typeof resultNoun === "string"
39
+ ? [resultNoun, `${resultNoun}s`]
40
40
  : ["result", "results"];
41
41
  const noun = count === 1 ? singular : plural;
42
42
  const formattedCount = numberFormatter.format(count);
@@ -1 +1 @@
1
- {"version":3,"file":"TableActions.js","sources":["../../../src/components/DataTable/TableActions.tsx"],"sourcesContent":["import { IconButton } from \"@components/button\"\nimport { ButtonGroup } from \"@components/button-group\"\nimport React, { type ReactNode } from \"react\"\n\nimport type { ResultsNoun } from \"./ResultsCount\"\n\n/**\n * A table action rendered as an `IconButton` in the button group above the\n * table. Replaces the original RFC's `{ buttonProps; callback }` shape with a\n * narrower, more controllable API so the design can evolve without exposing the\n * full button surface.\n */\nexport type TableAction = {\n /** Called with the keys of the currently selected rows when the action is triggered. */\n callback?: (selectedKeys: (number | string)[]) => void\n /** Whether the action's button is disabled. */\n disabled?: boolean\n /** The icon rendered inside the action's icon button. */\n icon: ReactNode\n /** Accessible label for the icon-only action button. */\n label: string\n /** Standard click handler, invoked with the click event before `callback`. */\n onClick?: React.MouseEventHandler<HTMLButtonElement>\n}\n\nexport interface TableActionsProps {\n /** The table actions to render as an `IconButton` group. */\n actions: TableAction[]\n /**\n * The noun used to describe the selection in each action's `aria-label`.\n * See {@link ResultsNoun}.\n */\n resultsNoun?: ResultsNoun\n /** The keys of the currently selected rows, passed to each action's `callback`. */\n selectedKeys: (number | string)[]\n}\n\n/**\n * Renders the table actions as an `IconButton` group displayed directly after\n * the results count, above the table. Each entry becomes an icon button whose\n * `callback` receives the keys of the currently selected rows.\n */\nexport const TableActions = ({\n actions,\n resultsNoun,\n selectedKeys,\n}: TableActionsProps) => {\n // The count/noun suffix is the same for every table action, so compute it once\n // here rather than per-button inside the map below.\n const countSuffix = getTableActionCountSuffix(\n selectedKeys.length,\n resultsNoun\n )\n\n return (\n <ButtonGroup aria-label=\"Table actions\">\n {actions.map(({ callback, disabled, icon, label, onClick }) => (\n <IconButton\n key={label}\n aria-label={`${label}${countSuffix}`}\n disabled={disabled}\n icon={icon}\n onClick={(event) => {\n onClick?.(event)\n callback?.(selectedKeys)\n }}\n />\n ))}\n </ButtonGroup>\n )\n}\n\nTableActions.displayName = \"TableActions\"\n\nconst numberFormatter = new Intl.NumberFormat()\n\n/**\n * The count/noun suffix appended to each table action's `aria-label` when rows\n * are selected, e.g. `\" (2 selected people)\"` — so `\"Email\"` reads as\n * `\"Email (2 selected people)\"`. Empty when nothing is selected. Falls back to\n * the default `\"result\"` noun when `resultsNoun` isn't provided. Shared across\n * every action, so it's computed once rather than per-button.\n */\nfunction getTableActionCountSuffix(\n count: number,\n resultsNoun: ResultsNoun | undefined\n): string {\n if (!count) return \"\"\n const [singular, plural] = Array.isArray(resultsNoun)\n ? resultsNoun\n : typeof resultsNoun === \"string\"\n ? [resultsNoun, `${resultsNoun}s`]\n : [\"result\", \"results\"]\n const noun = count === 1 ? singular : plural\n const formattedCount = numberFormatter.format(count)\n return ` (${formattedCount} selected ${noun})`\n}\n"],"names":["React"],"mappings":";;;;;;;;;AAqCA;;;;AAIG;AACI,MAAM,YAAY,GAAG,CAAC,EAC3B,OAAO,EACP,WAAW,EACX,YAAY,GACM,KAAI;;;IAGtB,MAAM,WAAW,GAAG,yBAAyB,CAC3C,YAAY,CAAC,MAAM,EACnB,WAAW,CACZ;IAED,QACEA,cAAA,CAAA,aAAA,CAAC,WAAW,EAAA,EAAA,YAAA,EAAY,eAAe,IACpC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MACxDA,6BAAC,UAAU,EAAA,EACT,GAAG,EAAE,KAAK,EAAA,YAAA,EACE,GAAG,KAAK,CAAA,EAAG,WAAW,CAAA,CAAE,EACpC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,CAAC,KAAK,KAAI;AACjB,YAAA,OAAO,GAAG,KAAK,CAAC;AAChB,YAAA,QAAQ,GAAG,YAAY,CAAC;AAC1B,QAAA,CAAC,EAAA,CACD,CACH,CAAC,CACU;AAElB;AAEA,YAAY,CAAC,WAAW,GAAG,cAAc;AAEzC,MAAM,eAAe,GAAG,IAAI,IAAI,CAAC,YAAY,EAAE;AAE/C;;;;;;AAMG;AACH,SAAS,yBAAyB,CAChC,KAAa,EACb,WAAoC,EAAA;AAEpC,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,OAAO,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW;AAClD,UAAE;AACF,UAAE,OAAO,WAAW,KAAK;AACvB,cAAE,CAAC,WAAW,EAAE,CAAA,EAAG,WAAW,GAAG;AACjC,cAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;AAC3B,IAAA,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,GAAG,QAAQ,GAAG,MAAM;IAC5C,MAAM,cAAc,GAAG,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;AACpD,IAAA,OAAO,CAAA,EAAA,EAAK,cAAc,CAAA,UAAA,EAAa,IAAI,GAAG;AAChD;;;;"}
1
+ {"version":3,"file":"TableActions.js","sources":["../../../src/components/DataTable/TableActions.tsx"],"sourcesContent":["import { IconButton } from \"@components/button\"\nimport { ButtonGroup } from \"@components/button-group\"\nimport React, { type ReactNode } from \"react\"\n\nimport type { ResultNoun } from \"./ResultsCount\"\n\n/**\n * A table action rendered as an `IconButton` in the button group above the\n * table. Replaces the original RFC's `{ buttonProps; callback }` shape with a\n * narrower, more controllable API so the design can evolve without exposing the\n * full button surface.\n */\nexport type TableAction = {\n /** Called with the keys of the currently selected rows when the action is triggered. */\n callback?: (selectedKeys: (number | string)[]) => void\n /** Whether the action's button is disabled. */\n disabled?: boolean\n /** The icon rendered inside the action's icon button. */\n icon: ReactNode\n /** Accessible label for the icon-only action button. */\n label: string\n /** Standard click handler, invoked with the click event before `callback`. */\n onClick?: React.MouseEventHandler<HTMLButtonElement>\n}\n\nexport interface TableActionsProps {\n /** The table actions to render as an `IconButton` group. */\n actions: TableAction[]\n /**\n * The noun used to describe the selection in each action's `aria-label`.\n * See {@link ResultNoun}.\n */\n resultNoun?: ResultNoun\n /** The keys of the currently selected rows, passed to each action's `callback`. */\n selectedKeys: (number | string)[]\n}\n\n/**\n * Renders the table actions as an `IconButton` group displayed directly after\n * the results count, above the table. Each entry becomes an icon button whose\n * `callback` receives the keys of the currently selected rows.\n */\nexport const TableActions = ({\n actions,\n resultNoun,\n selectedKeys,\n}: TableActionsProps) => {\n // The count/noun suffix is the same for every table action, so compute it once\n // here rather than per-button inside the map below.\n const countSuffix = getTableActionCountSuffix(selectedKeys.length, resultNoun)\n\n return (\n <ButtonGroup aria-label=\"Table actions\">\n {actions.map(({ callback, disabled, icon, label, onClick }) => (\n <IconButton\n key={label}\n aria-label={`${label}${countSuffix}`}\n disabled={disabled}\n icon={icon}\n onClick={(event) => {\n onClick?.(event)\n callback?.(selectedKeys)\n }}\n />\n ))}\n </ButtonGroup>\n )\n}\n\nTableActions.displayName = \"TableActions\"\n\nconst numberFormatter = new Intl.NumberFormat()\n\n/**\n * The count/noun suffix appended to each table action's `aria-label` when rows\n * are selected, e.g. `\" (2 selected people)\"` — so `\"Email\"` reads as\n * `\"Email (2 selected people)\"`. Empty when nothing is selected. Falls back to\n * the default `\"result\"` noun when `resultNoun` isn't provided. Shared across\n * every action, so it's computed once rather than per-button.\n */\nfunction getTableActionCountSuffix(\n count: number,\n resultNoun: ResultNoun | undefined\n): string {\n if (!count) return \"\"\n const [singular, plural] = Array.isArray(resultNoun)\n ? resultNoun\n : typeof resultNoun === \"string\"\n ? [resultNoun, `${resultNoun}s`]\n : [\"result\", \"results\"]\n const noun = count === 1 ? singular : plural\n const formattedCount = numberFormatter.format(count)\n return ` (${formattedCount} selected ${noun})`\n}\n"],"names":["React"],"mappings":";;;;;;;;;AAqCA;;;;AAIG;AACI,MAAM,YAAY,GAAG,CAAC,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