@entifix/react-controls 0.22.2 → 0.22.4

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.
Files changed (28) hide show
  1. package/dist/i18n/catalog/en.d.ts.map +1 -1
  2. package/dist/i18n/catalog/en.js +2 -1
  3. package/dist/i18n/catalog/en.js.map +1 -1
  4. package/dist/i18n/catalog/es.d.ts +1 -0
  5. package/dist/i18n/catalog/es.d.ts.map +1 -1
  6. package/dist/i18n/catalog/es.js +2 -1
  7. package/dist/i18n/catalog/es.js.map +1 -1
  8. package/dist/i18n/catalog/index.d.ts +2 -0
  9. package/dist/i18n/catalog/index.d.ts.map +1 -1
  10. package/dist/ui/molecules/summary-tile/summary-tile.d.ts +18 -1
  11. package/dist/ui/molecules/summary-tile/summary-tile.d.ts.map +1 -1
  12. package/dist/ui/molecules/summary-tile/summary-tile.js +83 -24
  13. package/dist/ui/molecules/summary-tile/summary-tile.js.map +1 -1
  14. package/dist/ui/organisms/entity-table/entity-table-slots.d.ts +6 -1
  15. package/dist/ui/organisms/entity-table/entity-table-slots.d.ts.map +1 -1
  16. package/dist/ui/organisms/entity-table/entity-table-slots.js.map +1 -1
  17. package/dist/ui/organisms/entity-table/entity-table.d.ts +1 -1
  18. package/dist/ui/organisms/entity-table/entity-table.d.ts.map +1 -1
  19. package/dist/ui/organisms/entity-table/entity-table.js +73 -37
  20. package/dist/ui/organisms/entity-table/entity-table.js.map +1 -1
  21. package/dist/ui/organisms/entity-table/entity-table.types.d.ts +7 -0
  22. package/dist/ui/organisms/entity-table/entity-table.types.d.ts.map +1 -1
  23. package/dist/ui/organisms/entity-table/entity-table.types.js.map +1 -1
  24. package/dist/ui/organisms/entity-table/use-entity-table-columns.d.ts +4 -3
  25. package/dist/ui/organisms/entity-table/use-entity-table-columns.d.ts.map +1 -1
  26. package/dist/ui/organisms/entity-table/use-entity-table-columns.js +15 -5
  27. package/dist/ui/organisms/entity-table/use-entity-table-columns.js.map +1 -1
  28. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { canNameRecord, emptySelection, extractMetaEntity, hierarchyOf, isSelected, queryPropertyFor, recordLabel, selectionSize, toggleSelected } from '@entifix/core';
3
+ import { canNameRecord, emptySelection, extractMetaEntity, hierarchyOf, isSelected, isTextMember, queryPropertyFor, recordLabel, selectionSize, toggleSelected } from '@entifix/core';
4
4
  import { Fragment, useId, useMemo, useRef, useState } from 'react';
5
5
  import { useEntityNoun, useLocale, useT, useTranslateKey } from '../../../i18n/index.js';
6
6
  import { availableUseCases, renderAnchor, useCasesForSurface } from '../../actions/index.js';
@@ -40,8 +40,12 @@ import { useResultAnnouncement } from './use-result-announcement.js';
40
40
  * content that arrives below the fold anyway.
41
41
  */ const SKELETON_ROW_CAP = 5;
42
42
  /** How many members a card shows as meta when none declares a `card` role. */ const UNDECLARED_META_CAP = 3;
43
- export function EntityTable({ entityConstructor, isLoading, skeleton = true, error, items, totalItems, currentPage, pageSize, onPageChange, onPageSizeChange, hrefFor, newHref, renderLink = renderAnchor, onSelect, preferencesKey, hiddenColumns, showControls = true, pivotBreakpoint, filtering, sorting, onFilteringChange, onSortingChange, facets, selection, onSelectionChange, metadata, isMetadataLoading = false, onBulkUseCase, onUseCase, onRetry, bulkOutcomes, onBulkDismiss, onBulkRetry, isBulkRunning = false, children }) {
44
- var _ref, _ref1, _visibleColumns_find, _ref2;
43
+ /**
44
+ * The name of the leading column a table adds when nothing on screen names a
45
+ * row. Not a member name an entity can declare, so it never collides.
46
+ */ const RECORD_COLUMN = '$record';
47
+ export function EntityTable({ entityConstructor, isLoading, skeleton = true, error, items, totalItems, currentPage, pageSize, onPageChange, onPageSizeChange, hrefFor, newHref, renderLink = renderAnchor, onSelect, preferencesKey, hiddenColumns, showKey = false, showControls = true, pivotBreakpoint, filtering, sorting, onFilteringChange, onSortingChange, facets, selection, onSelectionChange, metadata, isMetadataLoading = false, onBulkUseCase, onUseCase, onRetry, bulkOutcomes, onBulkDismiss, onBulkRetry, isBulkRunning = false, children }) {
48
+ var _ref, _ref1;
45
49
  const t = useT();
46
50
  // A descriptor's label is a runtime catalog key — the typed gate cannot see
47
51
  // it, which is why a host's catalog check is what catches a typo.
@@ -50,7 +54,55 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
50
54
  const metaEntity = extractMetaEntity(entityConstructor);
51
55
  const slots = readEntityTableSlots(children);
52
56
  const [panel, setPanel] = useState('none');
53
- const { columns, visibleColumns, hidden, setPersonalization } = useEntityTableColumns(entityConstructor, slots.columns, items[0], `entity-table:${(_ref = preferencesKey != null ? preferencesKey : metaEntity.key) != null ? _ref : metaEntity.name}`, hiddenColumns);
57
+ const { columns, visibleColumns: resolvedColumns, hidden, setPersonalization } = useEntityTableColumns(entityConstructor, slots.columns, items[0], `entity-table:${(_ref = preferencesKey != null ? preferencesKey : metaEntity.key) != null ? _ref : metaEntity.name}`, hiddenColumns, showKey);
58
+ const nameOf = useRecordLabel();
59
+ /**
60
+ * How a row names itself — to a screen reader on its checkbox, in a confirm
61
+ * dialog, a bulk result, a tree toggle: what the reader reads the row *as*
62
+ * ("Seleccionar Acme", never "Seleccionar fila 3" and never a whole id),
63
+ * through the one derivation every surface shares.
64
+ */ const rowLabel = (item)=>nameOf(entityConstructor, item);
65
+ /**
66
+ * The column every row reads as — the entity's `labelMember`, else its
67
+ * declared card title, else the first **text** member that is not a key. A
68
+ * status, a quantity or a date is a value the record holds, never what it is
69
+ * called, which is the rule `recordLabel()` names a record by.
70
+ */ const titleOf = (candidates)=>{
71
+ var _ref, _candidates_find;
72
+ return (_ref = (_candidates_find = candidates.find((column)=>column.name === metaEntity.labelMember)) != null ? _candidates_find : candidates.find((column)=>column.card === 'title')) != null ? _ref : candidates.find((column)=>canNameRecord(column) && isTextMember(column));
73
+ };
74
+ /**
75
+ * A record nothing on screen names — an order, a movement, a payout, or a
76
+ * row whose naming column the reader has hidden — gets a leading column of
77
+ * its own that reads as the record: its noun and short id, as every other
78
+ * surface names it. Without it the grid's link landed on a number or an
79
+ * enum, or on no cell at all.
80
+ */ const namedTitle = titleOf(resolvedColumns);
81
+ /**
82
+ * The title column, held in view at the inline start while a grid wider than
83
+ * its container scrolls — the naming column, or the record column above.
84
+ */ const stickyTitle = namedTitle != null ? namedTitle : {
85
+ name: RECORD_COLUMN,
86
+ key: RECORD_COLUMN,
87
+ label: entityNoun(metaEntity),
88
+ type: 'string',
89
+ sortable: false,
90
+ filterable: false,
91
+ order: -1,
92
+ readonly: false,
93
+ required: false,
94
+ linkLabelProperty: 'name',
95
+ linkSearchProperty: 'name',
96
+ linkSerialization: 'id',
97
+ resetOnClone: false,
98
+ card: 'title',
99
+ render: rowLabel,
100
+ virtual: true
101
+ };
102
+ const visibleColumns = namedTitle === undefined ? [
103
+ stickyTitle,
104
+ ...resolvedColumns
105
+ ] : resolvedColumns;
54
106
  // A picker's table is choosing *one* value; a multi-selection there would
55
107
  // offer a set to a form member that holds a single reference, and the two
56
108
  // controls would fight over the same row. This is a wiring mistake rather
@@ -95,12 +147,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
95
147
  * table's own box picks one — at the width its visible columns need. A
96
148
  * viewport breakpoint was wrong inside a split view, a drawer or a wizard
97
149
  * step, and a JS measurement would guess during SSR and correct after mount.
98
- */ /**
99
- * The column every row reads as — the entity's `labelMember`, else its
100
- * declared card title, else the first that can name a record — held in view
101
- * at the inline start while a grid wider than its container scrolls.
102
- */ const stickyTitle = (_ref1 = (_visibleColumns_find = visibleColumns.find((column)=>column.name === metaEntity.labelMember)) != null ? _visibleColumns_find : visibleColumns.find((column)=>column.card === 'title')) != null ? _ref1 : visibleColumns.find(canNameRecord);
103
- const widths = pivotWidths({
150
+ */ const widths = pivotWidths({
104
151
  columns: visibleColumns,
105
152
  title: stickyTitle,
106
153
  roleOf: cardRoles(visibleColumns),
@@ -129,21 +176,22 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
129
176
  * dimming them through opacity took the text under the contrast a reader
130
177
  * needs, on every page change.
131
178
  */ const busy = isLoading || undefined;
132
- const nameOf = useRecordLabel();
133
179
  /**
134
180
  * The column a row reads *as*: the member `recordLabel()` names it by, when
135
181
  * the reader has not hidden that column; else one declared `card: 'title'`;
136
- * else the first visible one it filled in that is not a key — an id, a
137
- * reference or a link names a row no better than its position does.
182
+ * else the first visible text one it filled in that is not a key; else the
183
+ * table's title column, whose empty cell then reads as the record's label.
184
+ * So every row has exactly one open link, and it is never a number or an
185
+ * enum.
138
186
  */ const declaredTitle = visibleColumns.find((column)=>column.card === 'title');
139
187
  const linkColumn = (item)=>{
140
- var _ref;
188
+ var _ref, _ref1;
141
189
  const label = recordLabel(entityConstructor, item);
142
190
  const named = label.kind === 'fallback' ? undefined : visibleColumns.find((column)=>column.name === label.member.name);
143
- return (_ref = named != null ? named : declaredTitle) != null ? _ref : visibleColumns.find((column)=>{
191
+ return (_ref = (_ref1 = named != null ? named : declaredTitle) != null ? _ref1 : visibleColumns.find((column)=>{
144
192
  const value = item[column.name];
145
- return canNameRecord(column) && value != null && String(value) !== '';
146
- });
193
+ return canNameRecord(column) && isTextMember(column) && value != null && String(value) !== '';
194
+ })) != null ? _ref : stickyTitle;
147
195
  };
148
196
  /**
149
197
  * What a record's card shows, by each member's declared `card` role or the
@@ -179,10 +227,12 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
179
227
  * down it heard "Open" once per row; the title says which record it opens.
180
228
  * A picker's rows are chosen, not opened, so they stay plain.
181
229
  */ const renderCell = (column, item)=>{
182
- var _linkColumn;
183
- const value = renderValue(column, item);
230
+ if (linkColumn(item).name !== column.name) return renderValue(column, item);
231
+ // The row's title cell left empty still reads as the record.
232
+ const raw = item[column.name];
233
+ const blank = column.render === undefined && (raw == null || raw === '');
234
+ const value = blank ? rowLabel(item) : renderValue(column, item);
184
235
  if (hrefFor === undefined || onSelect !== undefined) return value;
185
- if (((_linkColumn = linkColumn(item)) == null ? void 0 : _linkColumn.name) !== column.name) return value;
186
236
  return renderLink({
187
237
  href: hrefFor(item.id),
188
238
  className: linkClassName,
@@ -256,12 +306,6 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
256
306
  anchorIndex.current = undefined;
257
307
  setSelection(next);
258
308
  };
259
- /**
260
- * How a row names itself — to a screen reader on its checkbox, in a confirm
261
- * dialog, a bulk result, a tree toggle: what the reader reads the row *as*
262
- * ("Seleccionar Acme", never "Seleccionar fila 3" and never a whole id),
263
- * through the one derivation every surface shares.
264
- */ const rowLabel = (item)=>nameOf(entityConstructor, item);
265
309
  const selectionCell = (item, index, // Passed in rather than closed over: this is only ever called under
266
310
  // `selectable`, which already proves the selection exists, and reading the
267
311
  // optional prop here would add a fallback arm that nothing can reach.
@@ -378,7 +422,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
378
422
  const locale = useLocale();
379
423
  const panelId = useId();
380
424
  const keys = sortKeys(sorting, columns);
381
- const activeFilters = (_ref2 = filtering == null ? void 0 : filtering.values.length) != null ? _ref2 : 0;
425
+ const activeFilters = (_ref1 = filtering == null ? void 0 : filtering.values.length) != null ? _ref1 : 0;
382
426
  const results = t('table.results', {
383
427
  count: totalItems
384
428
  });
@@ -587,7 +631,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
587
631
  },
588
632
  // A focused cell scrolled sideways is never left under the
589
633
  // sticky title column (WCAG 2.4.11).
590
- containerStyle: stickyTitle === undefined ? undefined : {
634
+ containerStyle: {
591
635
  scrollPaddingInlineStart: `${columnWidth(stickyTitle)}rem`
592
636
  },
593
637
  children: [
@@ -713,15 +757,7 @@ export function EntityTable({ entityConstructor, isLoading, skeleton = true, err
713
757
  },
714
758
  children: /*#__PURE__*/ _jsx(EntityRecordCard, {
715
759
  // The same renderers as the grid, so the two layouts agree.
716
- title: parts.title === undefined ? hrefFor === undefined || onSelect !== undefined ? rowLabel(item) : renderLink({
717
- href: hrefFor(item.id),
718
- className: linkClassName,
719
- children: rowLabel(item),
720
- intent: {
721
- kind: 'open',
722
- id: item.id
723
- }
724
- }) : renderCell(parts.title, item),
760
+ title: renderCell(parts.title, item),
725
761
  subtitle: parts.subtitle === undefined ? undefined : renderCell(parts.subtitle, item),
726
762
  badges: parts.badges.map((column)=>({
727
763
  key: column.name,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/ui/organisms/entity-table/entity-table.tsx"],"sourcesContent":["'use client';\n\nimport {\n canNameRecord,\n emptySelection,\n type Entity,\n type EntityId,\n type EntitySelection,\n type EntitySorting,\n extractMetaEntity,\n type FilterGroup,\n hierarchyOf,\n isSelected,\n queryPropertyFor,\n recordLabel,\n selectionSize,\n toggleSelected,\n type UseCaseDescriptor,\n} from '@entifix/core';\nimport {\n Fragment,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n useEntityNoun,\n useLocale,\n useT,\n useTranslateKey,\n} from '../../../i18n/index.js';\nimport {\n availableUseCases,\n renderAnchor,\n useCasesForSurface,\n} from '../../actions/index.js';\nimport { useVerbInvoker } from '../../actions/use-verb-invoker.js';\nimport { Button, button } from '../../atoms/button/index.js';\nimport { CellValue, useRecordLabel } from '../../atoms/cell-value/index.js';\nimport { Checkbox } from '../../atoms/field/index.js';\nimport { Skeleton } from '../../atoms/skeleton/index.js';\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeaderCell,\n TableMessageRow,\n TableRow,\n} from '../../atoms/table/index.js';\nimport { linkClassName } from '../../atoms/text/index.js';\nimport {\n ActionBar,\n type ActionBarItem,\n itemsForUseCases,\n} from '../../molecules/action-bar/index.js';\nimport { BulkActionBar } from '../../molecules/bulk-action-bar/index.js';\nimport { BulkResult } from '../../molecules/bulk-result/index.js';\nimport { ColumnSettings } from '../../molecules/column-settings/index.js';\nimport { EntityRecordCard } from '../../molecules/entity-record-card/index.js';\nimport { FilterBuilder } from '../../molecules/filter-builder/index.js';\nimport { FilterChips } from '../../molecules/filter-chips/index.js';\nimport { LoadingBoundary } from '../../molecules/loading-boundary/index.js';\nimport { Pagination } from '../../molecules/pagination/index.js';\nimport { RegionState } from '../../molecules/region-state/index.js';\nimport { SortBuilder } from '../../molecules/sort-builder/index.js';\nimport { TableToolbar } from '../../molecules/table-toolbar/index.js';\nimport { useFocusOnLoss } from '../../utils/use-focus-on-arrival.js';\nimport { cardRoles } from './card-roles.js';\nimport type {\n EntityTableColumn,\n EntityTableProps,\n} from './entity-table.types.js';\nimport { readEntityTableSlots } from './entity-table-slots.js';\nimport { shownTreeRows, TreeCell, treeRows } from './entity-table-tree.js';\nimport { nextHeaderSorting, sortKeys } from './header-sort.js';\nimport {\n ACTIONS_WIDTH,\n columnWidth,\n pivotClasses,\n pivotWidths,\n SELECTION_WIDTH,\n} from './pivot.js';\nimport { useEntityTableColumns } from './use-entity-table-columns.js';\nimport { useResultAnnouncement } from './use-result-announcement.js';\n\ntype Panel = 'none' | 'filters' | 'sorting';\n\n/**\n * How many placeholder rows the built-in skeleton draws.\n *\n * The column count is taken from the real geometry, because that is the axis a\n * mismatch shifts; the row count is capped instead of tracking `pageSize`, since\n * a fifty-row page would otherwise paint fifty shimmer rows to stand in for\n * content that arrives below the fold anyway.\n */\nconst SKELETON_ROW_CAP = 5;\n\n/** How many members a card shows as meta when none declares a `card` role. */\nconst UNDECLARED_META_CAP = 3;\n\n/**\n * A table that builds itself from an entity's metadata: columns, labels, value\n * formatting and the filter/sort controls all come from `@accessor()`\n * declarations, so listing a new entity needs no bespoke table.\n *\n * Three things layer on top of that default:\n * - **personalization** — column order and visibility, persisted through the\n * UI-preferences port (so it survives reloads and can later move server-side);\n * - **responsiveness** — below `pivotBreakpoint` rows pivot into label/value\n * cards instead of scrolling sideways;\n * - **slots** — `<EntityColumn>` / `<EntityTableHeader>` / `<EntityTableRow>` /\n * `<EntityTableToolbar>` children override any part of the default rendering.\n */\n/**\n * What a pending verb will act on once it is confirmed.\n *\n * A form has one record; a table has a row or a selection, and those reach two\n * different handlers with two different payloads. Carrying the selection itself\n * rather than reading it back at confirm time also removes a branch that could\n * not happen: the bulk bar only renders inside a truthy selection.\n */\ntype PendingTarget<TEntity extends Entity> =\n | { kind: 'row'; item: TEntity }\n | { kind: 'selection'; selection: EntitySelection<TEntity> };\n\nexport function EntityTable<TEntity extends Entity>({\n entityConstructor,\n isLoading,\n skeleton = true,\n error,\n items,\n totalItems,\n currentPage,\n pageSize,\n onPageChange,\n onPageSizeChange,\n hrefFor,\n newHref,\n renderLink = renderAnchor,\n onSelect,\n preferencesKey,\n hiddenColumns,\n showControls = true,\n pivotBreakpoint,\n filtering,\n sorting,\n onFilteringChange,\n onSortingChange,\n facets,\n selection,\n onSelectionChange,\n metadata,\n isMetadataLoading = false,\n onBulkUseCase,\n onUseCase,\n onRetry,\n bulkOutcomes,\n onBulkDismiss,\n onBulkRetry,\n isBulkRunning = false,\n children,\n}: EntityTableProps<TEntity>) {\n const t = useT();\n // A descriptor's label is a runtime catalog key — the typed gate cannot see\n // it, which is why a host's catalog check is what catches a typo.\n const translateKey = useTranslateKey();\n const entityNoun = useEntityNoun();\n const metaEntity = extractMetaEntity(entityConstructor);\n const slots = readEntityTableSlots<TEntity>(children);\n const [panel, setPanel] = useState<Panel>('none');\n\n const { columns, visibleColumns, hidden, setPersonalization } =\n useEntityTableColumns<TEntity>(\n entityConstructor,\n slots.columns,\n items[0],\n `entity-table:${preferencesKey ?? metaEntity.key ?? metaEntity.name}`,\n hiddenColumns,\n );\n\n // A picker's table is choosing *one* value; a multi-selection there would\n // offer a set to a form member that holds a single reference, and the two\n // controls would fight over the same row. This is a wiring mistake rather\n // than a state, so it costs the render — the same call `EntityForm` makes\n // for a link source aimed at a member no picker can edit.\n if (onSelect !== undefined && selection !== undefined) {\n throw new Error(\n 'EntityTable was given both `onSelect` and `selection`. A picker picks one ' +\n 'row and a selection accumulates many, so the row control cannot be both. ' +\n 'Drop `selection` inside a picker, or drop `onSelect` outside one.',\n );\n }\n\n /**\n * The selection, or `undefined` when the table is not selectable at all.\n *\n * One value rather than a `selection` prop beside a `selectable` boolean:\n * two of them means every render site has to re-test both, and the second\n * test is unreachable — which reads as a defensive check and is really dead\n * code the coverage gate then cannot close.\n */\n const selectionState =\n selection !== undefined && onSelectionChange !== undefined\n ? selection\n : undefined;\n const selectable = selectionState !== undefined;\n const rowUseCases = useCasesForSurface('row-menu', metadata?.useCases);\n const bulkUseCases = useCasesForSurface('bulk-bar', metadata?.useCases);\n const toolbarUseCases = useCasesForSurface(\n 'table-toolbar',\n metadata?.useCases,\n );\n const hasRowMenu = rowUseCases.length > 0 && onUseCase !== undefined;\n\n /**\n * What a `context-independent` collection verb acts on: everything the\n * current filter matches.\n *\n * Not an empty `ids` selection, which would say \"no rows\" — the verb is\n * available *without* a selection precisely because its subject is the\n * collection, so the honest payload is the same filter the listing is\n * showing, and the same one a \"select all matching\" escalation would send.\n */\n const everythingMatching: EntitySelection<TEntity> = {\n mode: 'matching',\n filtering,\n total: totalItems,\n excluded: new Set<EntityId>(),\n };\n\n // Opening a record is its title's link, so a row needs an actions column\n // only to pick it or to run a verb on it.\n const hasRowAction = onSelect !== undefined || hasRowMenu;\n const columnCount =\n visibleColumns.length + (hasRowAction ? 1 : 0) + (selectable ? 1 : 0);\n\n /**\n * The grid and the cards are both rendered, and a container query on the\n * table's own box picks one — at the width its visible columns need. A\n * viewport breakpoint was wrong inside a split view, a drawer or a wizard\n * step, and a JS measurement would guess during SSR and correct after mount.\n */\n /**\n * The column every row reads as — the entity's `labelMember`, else its\n * declared card title, else the first that can name a record — held in view\n * at the inline start while a grid wider than its container scrolls.\n */\n const stickyTitle =\n visibleColumns.find(column => column.name === metaEntity.labelMember) ??\n visibleColumns.find(column => column.card === 'title') ??\n visibleColumns.find(canNameRecord);\n const widths = pivotWidths({\n columns: visibleColumns,\n title: stickyTitle,\n roleOf: cardRoles(visibleColumns),\n extra:\n (selectable ? SELECTION_WIDTH : 0) + (hasRowAction ? ACTIONS_WIDTH : 0),\n breakpoint: pivotBreakpoint,\n });\n const pivot = pivotClasses(widths.essential);\n /**\n * The sticky title's cells: opaque, so the columns scrolling under it never\n * show through — a header cell on the header's surface, a row's on the\n * row's, following its hover.\n */\n const stickyClass = (\n column: EntityTableColumn<TEntity>,\n part: 'header' | 'body',\n ) =>\n column !== stickyTitle\n ? undefined\n : part === 'header'\n ? 'sticky start-0 z-2 bg-surface'\n : 'sticky start-0 z-1 bg-surface-elevated group-hover/row:bg-surface';\n /**\n * The first load has nothing to show and is held with a skeleton; a refetch\n * already has rows, so it keeps them and only marks the region busy. Splitting\n * the two is what stops every pagination click flashing grey.\n */\n const isFirstLoad = isLoading && items.length === 0;\n /** Loaded, nothing came back, and nothing failed: there are no rows to lay out. */\n const settledEmpty = items.length === 0 && !isLoading && error === undefined;\n\n /** `true`/omitted → the built-in default; a node → that node; `false` → none. */\n const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;\n const showSkeleton = isFirstLoad && skeleton !== false;\n const skeletonRows = Array.from(\n { length: Math.min(pageSize, SKELETON_ROW_CAP) },\n (_, index) => index,\n );\n\n /**\n * A refetch keeps its rows at full contrast and marks them `aria-busy`:\n * dimming them through opacity took the text under the contrast a reader\n * needs, on every page change.\n */\n const busy = isLoading || undefined;\n\n const nameOf = useRecordLabel();\n\n /**\n * The column a row reads *as*: the member `recordLabel()` names it by, when\n * the reader has not hidden that column; else one declared `card: 'title'`;\n * else the first visible one it filled in that is not a key — an id, a\n * reference or a link names a row no better than its position does.\n */\n const declaredTitle = visibleColumns.find(column => column.card === 'title');\n const linkColumn = (item: TEntity) => {\n const label = recordLabel(entityConstructor, item);\n const named =\n label.kind === 'fallback'\n ? undefined\n : visibleColumns.find(column => column.name === label.member.name);\n return (\n named ??\n declaredTitle ??\n visibleColumns.find(column => {\n const value = (item as Record<string, unknown>)[column.name];\n return canNameRecord(column) && value != null && String(value) !== '';\n })\n );\n };\n\n /**\n * What a record's card shows, by each member's declared `card` role or the\n * default: an id is hidden, the first enum is the badge, and up to\n * {@link UNDECLARED_META_CAP} more members are meta — a card is a summary,\n * and the grid holds the rest.\n */\n const roleOf = cardRoles(visibleColumns);\n const cardParts = (item: TEntity) => {\n const title = linkColumn(item);\n const rest = visibleColumns.filter(column => column !== title);\n let undeclared = 0;\n return {\n title,\n subtitle: rest.find(column => roleOf(column) === 'subtitle'),\n badges: rest.filter(column => roleOf(column) === 'badge'),\n meta: rest.filter(column => {\n if (roleOf(column) !== 'meta') return false;\n if (column.card !== undefined) return true;\n undeclared += 1;\n return undeclared <= UNDECLARED_META_CAP;\n }),\n };\n };\n\n const renderValue = (\n column: EntityTableColumn<TEntity>,\n item: TEntity,\n ): ReactNode =>\n column.render ? (\n column.render(item)\n ) : (\n <CellValue\n value={(item as Record<string, unknown>)[column.name]}\n descriptor={column}\n record={item as Record<string, unknown>}\n />\n );\n\n /**\n * A cell, and the row's title cell is the record's link\n * ([ADR 0026](../../../../../../../docs/adr/0026-actions-hierarchy-overflow-and-destructive-verbs.md)).\n * A column of identical \"Open\" links named nothing, and a reader tabbing\n * down it heard \"Open\" once per row; the title says which record it opens.\n * A picker's rows are chosen, not opened, so they stay plain.\n */\n const renderCell = (\n column: EntityTableColumn<TEntity>,\n item: TEntity,\n ): ReactNode => {\n const value = renderValue(column, item);\n if (hrefFor === undefined || onSelect !== undefined) return value;\n if (linkColumn(item)?.name !== column.name) return value;\n return renderLink({\n href: hrefFor(item.id),\n className: linkClassName,\n children: value,\n intent: { kind: 'open', id: item.id },\n });\n };\n\n /**\n * The row a shift-click ranges *from* — the last box the user actually\n * toggled. Held in a ref rather than state because it changes nothing on\n * screen, and re-rendering the whole table on every click to remember an\n * anchor is a cost with no visible return.\n */\n const anchorIndex = useRef<number | undefined>(undefined);\n\n /**\n * An entity that declares a parent renders as a tree: the page arranged\n * depth first, its first column indented, and a subtree hidden while its\n * record is collapsed. Collapsing is view state, so it lives here and is\n * forgotten with the table, like the shift-click anchor above.\n */\n const treeKeys = useMemo(\n () => hierarchyOf(entityConstructor),\n [entityConstructor],\n );\n const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(\n () => new Set(),\n );\n const rows = useMemo(() => treeRows(items, treeKeys), [items, treeKeys]);\n const shown = shownTreeRows(rows, collapsed);\n const shownItems = shown.map(row => row.item);\n const toggleCollapsed = (key: string) =>\n setCollapsed(current => {\n const next = new Set(current);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n\n const setSelection = (next: EntitySelection<TEntity>) =>\n onSelectionChange?.(next);\n\n const toggleRow = (\n index: number,\n checked: boolean,\n shiftKey: boolean,\n current: EntitySelection<TEntity>,\n ) => {\n // A shift-click extends the last toggle across the rows *on this page*, in\n // the direction the user dragged, and applies the new state to all of them.\n const from = shiftKey ? (anchorIndex.current ?? index) : index;\n const [start, end] = from <= index ? [from, index] : [index, from];\n\n let next = current;\n // The rows as shown: in a tree the order on screen is not the load's.\n for (const row of shownItems.slice(start, end + 1)) {\n next = toggleSelected(next, row.id, checked);\n }\n\n anchorIndex.current = index;\n setSelection(next);\n };\n\n /**\n * The header box, and it has three states rather than two: none of this\n * page's rows selected, all of them, or some. Without the third the box\n * reads as \"nothing is selected\" while a bulk bar sits below it saying\n * otherwise.\n */\n const pageIds = items.map(item => item.id);\n const selectedOnPage = selectionState\n ? pageIds.filter(id => isSelected(selectionState, id)).length\n : 0;\n const allOnPageSelected =\n pageIds.length > 0 && selectedOnPage === pageIds.length;\n const someOnPageSelected = selectedOnPage > 0 && !allOnPageSelected;\n\n const toggleAllOnPage = (\n checked: boolean,\n current: EntitySelection<TEntity>,\n ) => {\n let next = current;\n for (const id of pageIds) next = toggleSelected(next, id, checked);\n anchorIndex.current = undefined;\n setSelection(next);\n };\n\n /**\n * How a row names itself — to a screen reader on its checkbox, in a confirm\n * dialog, a bulk result, a tree toggle: what the reader reads the row *as*\n * (\"Seleccionar Acme\", never \"Seleccionar fila 3\" and never a whole id),\n * through the one derivation every surface shares.\n */\n const rowLabel = (item: TEntity): string => nameOf(entityConstructor, item);\n\n const selectionCell = (\n item: TEntity,\n index: number,\n // Passed in rather than closed over: this is only ever called under\n // `selectable`, which already proves the selection exists, and reading the\n // optional prop here would add a fallback arm that nothing can reach.\n current: EntitySelection<TEntity>,\n ) => (\n <Checkbox\n // Deliberately no `id`: both pivots are always in the DOM, so an id here\n // would be emitted twice per row. `aria-label` names the control instead,\n // and it names the *record* rather than the position.\n aria-label={t('table.selectRow', { record: rowLabel(item) })}\n checked={isSelected(current, item.id)}\n disabled={isBulkRunning}\n onChange={event =>\n toggleRow(\n index,\n event.currentTarget.checked,\n (event.nativeEvent as MouseEvent).shiftKey === true,\n current,\n )\n }\n />\n );\n\n const runTarget = (key: string, target: PendingTarget<TEntity>) => {\n if (target.kind === 'row') onUseCase?.(key, target.item);\n else onBulkUseCase?.(key, target.selection);\n };\n\n /**\n * Every verb on the table goes through here — the row menu, the bulk bar and\n * the toolbar — so none reaches a destructive verb around its confirmation,\n * its typed check or its Undo.\n */\n const verbs = useVerbInvoker<PendingTarget<TEntity>>({\n run: runTarget,\n busy: isBulkRunning,\n served: metadata?.useCases,\n });\n\n // The row a verb last ran on. Its menu trigger unmounts when the verb moved\n // the record out of every state a row verb applies to, and focus then goes\n // to that row's own link or control rather than `<body>`.\n const rowScope = useId();\n const [lastRow, setLastRow] = useState<string | undefined>(undefined);\n useFocusOnLoss(\n () =>\n lastRow === undefined ? undefined : focusableIn(`${rowScope}${lastRow}`),\n shown\n .map(({ item }) =>\n availableUseCases(rowUseCases, item)\n .map(({ key }) => key)\n .join(','),\n )\n .join(' '),\n );\n\n const invoke = (\n useCase: UseCaseDescriptor,\n target: PendingTarget<TEntity>,\n ) => {\n if (target.kind === 'row') {\n setLastRow(String(target.item.id));\n verbs.invoke({\n descriptor: useCase,\n target,\n object: rowLabel(target.item),\n count: 1,\n });\n return;\n }\n const count = selectionSize(target.selection);\n verbs.invoke({\n descriptor: useCase,\n target,\n object: t('confirm.selection', {\n count,\n label: entityNoun(metaEntity),\n plural: entityNoun(metaEntity, 'plural'),\n }),\n count,\n matching: target.selection.mode === 'matching',\n });\n };\n\n const rowMenu = (item: TEntity) =>\n hasRowMenu ? (\n <ActionBar\n surface=\"row-menu\"\n menuLabel={t('actions.forRecord', { record: rowLabel(item) })}\n items={itemsForUseCases(\n availableUseCases(rowUseCases, item),\n translateKey,\n useCase => invoke(useCase, { kind: 'row', item }),\n )}\n />\n ) : undefined;\n\n /**\n * A picker's Select, then the row's verbs. Opening the record is not here:\n * it is the title's link.\n */\n const recordAction = (item: TEntity) => {\n const pick = onSelect ? (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => onSelect(item)}\n >\n {t('table.select')}\n </Button>\n ) : undefined;\n\n const menu = rowMenu(item);\n if (!menu) return pick;\n\n return (\n <span className=\"flex items-center gap-2xs\">\n {pick}\n {menu}\n </span>\n );\n };\n\n /**\n * \"New\" is the list's primary, and only where something can be created\n * here: the entity is not one only a flow writes (`creatable: false`), and\n * the caller may write it. A list that offered \"New\" to a reader who could\n * never save opened a form with no Save on it.\n */\n const mayCreate =\n newHref !== undefined &&\n metaEntity.creatable &&\n (metadata === undefined || metadata.actions.includes('write'));\n const toolbarItems: ActionBarItem[] = itemsForUseCases(\n toolbarUseCases,\n translateKey,\n useCase =>\n invoke(useCase, { kind: 'selection', selection: everythingMatching }),\n isBulkRunning,\n );\n const declaresToolbarPrimary = toolbarItems.some(\n item => item.emphasis === 'primary',\n );\n const toolbarActions: ActionBarItem[] = [\n ...(mayCreate\n ? [\n {\n key: 'new',\n label: t('table.new'),\n emphasis: declaresToolbarPrimary\n ? ('default' as const)\n : ('primary' as const),\n href: newHref,\n intent: { kind: 'new' as const },\n },\n ]\n : []),\n ...toolbarItems,\n ];\n\n const locale = useLocale();\n const panelId = useId();\n const keys = sortKeys(sorting, columns);\n const activeFilters = filtering?.values.length ?? 0;\n const results = t('table.results', { count: totalItems });\n\n /**\n * What the status region says once a filter, a sort or a page has settled —\n * debounced, and silent on the first load.\n */\n const announcement = useResultAnnouncement(\n !isLoading,\n totalItems === 0 && activeFilters > 0\n ? t('table.noResultsFiltered')\n : results,\n JSON.stringify([filtering, sorting, currentPage, pageSize]),\n );\n\n /** The caption: what the table holds, how many, and in what order. */\n const primaryKey = keys[0];\n const primaryColumn =\n primaryKey === undefined\n ? undefined\n : columns.find(column => column.name === primaryKey.member);\n const caption =\n primaryKey === undefined || primaryColumn === undefined\n ? t('table.caption', {\n entity: entityNoun(metaEntity, 'plural'),\n results,\n })\n : t('table.captionSorted', {\n entity: entityNoun(metaEntity, 'plural'),\n results,\n column: primaryColumn.label,\n direction: t(\n primaryKey.type === 'asc' ? 'sort.ascending' : 'sort.descending',\n ),\n });\n\n /**\n * A column's header: its name, and — for a sortable one — a button that\n * cycles it ascending → descending → unsorted, with Shift adding it as the\n * next key. Only the primary key carries `aria-sort`.\n */\n const headerCell = (column: EntityTableColumn<TEntity>) => {\n const label = column.header ?? column.label;\n if (!column.sortable || onSortingChange === undefined)\n return (\n <TableHeaderCell\n key={column.name}\n className={stickyClass(column, 'header')}\n >\n {label}\n </TableHeaderCell>\n );\n const position = keys.findIndex(key => key.member === column.name);\n const type = keys[position]?.type;\n return (\n <TableHeaderCell\n key={column.name}\n className={stickyClass(column, 'header')}\n aria-sort={\n position === 0\n ? type === 'asc'\n ? 'ascending'\n : 'descending'\n : undefined\n }\n >\n <button\n type=\"button\"\n className=\"inline-flex min-h-(--target-min) items-center gap-3xs rounded-sm focus-ring hover:text-content\"\n onClick={event =>\n onSortingChange(\n nextHeaderSorting<TEntity>(\n keys,\n {\n member: column.name,\n property: queryPropertyFor(column, locale),\n },\n event.shiftKey,\n ),\n )\n }\n >\n {label}\n <span aria-hidden=\"true\">\n {type === 'asc' ? '▲' : type === 'desc' ? '▼' : '↕'}\n </span>\n {keys.length > 1 && position >= 0 && (\n <span aria-hidden=\"true\" className=\"text-step-sm\">\n {position + 1}\n </span>\n )}\n </button>\n </TableHeaderCell>\n );\n };\n\n /** A panel toggle: its state said by `aria-expanded`, and its count shown. */\n const panelToggle = (which: Exclude<Panel, 'none'>, count: number) => (\n <Button\n type=\"button\"\n id={`${panelId}-${which}`}\n variant={panel === which ? 'primary' : 'secondary'}\n size=\"sm\"\n aria-expanded={panel === which}\n aria-controls={panelId}\n onClick={() => setPanel(current => (current === which ? 'none' : which))}\n >\n {t(which === 'filters' ? 'table.filters' : 'table.sorting')}\n {count > 0 && (\n // Its name stays \"Filters\": the chips say which filters, and a count\n // in the name would change it under the reader with every filter.\n <span\n aria-hidden=\"true\"\n className=\"ms-3xs rounded-full bg-surface px-3xs text-step-sm text-content\"\n >\n {count}\n </span>\n )}\n </Button>\n );\n\n return (\n <div className=\"@container/entity-table flex flex-col gap-s\">\n {/*\n One announcement for the whole table, not one per layout. Both the grid\n and the card list are always in the DOM — CSS picks which is visible —\n so a live region inside each meant assistive tech was told twice that\n the table was loading. The shimmer itself is aria-hidden, so this is the\n only thing that carries the news.\n */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {isFirstLoad ? t('table.loading') : announcement}\n </span>\n\n {showControls && (\n <TableToolbar\n start={\n <>\n {/* \"New\" and the collection-bound verbs that need no\n selection. They sit here rather than in the bulk bar,\n because the bulk bar only exists while rows are ticked and\n these are always available. */}\n <LoadingBoundary isLoading={isMetadataLoading} lines={0}>\n <>\n {toolbarActions.length > 0 && (\n <ActionBar\n surface=\"table-toolbar\"\n items={toolbarActions}\n renderLink={renderLink}\n />\n )}\n </>\n </LoadingBoundary>\n {slots.toolbar}\n </>\n }\n end={\n <>\n {panelToggle('filters', activeFilters)}\n {panelToggle('sorting', keys.length)}\n <ColumnSettings\n columns={columns}\n hidden={hidden}\n onChange={setPersonalization}\n />\n </>\n }\n panelId={panelId}\n panel={\n panel === 'filters' ? (\n <FilterBuilder<TEntity>\n // Remounted when the filtering changes from outside — a chip\n // removed — so its rows show what is in effect.\n key={JSON.stringify(filtering ?? null)}\n descriptors={columns.filter(column => column.filterable)}\n facets={facets}\n value={filtering}\n onChange={(applied: FilterGroup<TEntity>) =>\n onFilteringChange?.(applied)\n }\n />\n ) : panel === 'sorting' ? (\n <SortBuilder<TEntity>\n descriptors={columns.filter(column => column.sortable)}\n value={sorting}\n onChange={(applied: EntitySorting<TEntity>) =>\n onSortingChange?.(applied)\n }\n />\n ) : undefined\n }\n />\n )}\n\n {showControls && onFilteringChange !== undefined && (\n <FilterChips<TEntity>\n descriptors={columns.filter(column => column.filterable)}\n value={filtering}\n onChange={onFilteringChange}\n />\n )}\n\n {/*\n The bar appears when there is something selected and something to do\n with it. It sits above the rows rather than floating over them: a fixed\n overlay covers the last row of a short page, which is the row the user\n most likely just ticked.\n */}\n {selectionState && selectionSize(selectionState) > 0 && (\n <BulkActionBar\n count={selectionSize(selectionState)}\n useCases={bulkUseCases}\n busy={isBulkRunning}\n // Offered only when this page is fully ticked and the store holds\n // more than the page — the escalation has somewhere to escalate to.\n matchingTotal={\n selectionState.mode === 'ids' &&\n allOnPageSelected &&\n totalItems > items.length\n ? totalItems\n : undefined\n }\n onSelectAllMatching={() => setSelection(everythingMatching)}\n onClear={() => setSelection(emptySelection<TEntity>())}\n onUseCase={useCase =>\n invoke(useCase, { kind: 'selection', selection: selectionState })\n }\n />\n )}\n\n {verbs.dialog}\n\n {bulkOutcomes && bulkOutcomes.length > 0 && onBulkDismiss && (\n <BulkResult\n outcomes={bulkOutcomes}\n busy={isBulkRunning}\n labelFor={id => {\n const row = items.find(item => item.id === id);\n return row ? rowLabel(row) : undefined;\n }}\n onRetryFailed={onBulkRetry}\n onDismiss={onBulkDismiss}\n />\n )}\n\n {/*\n Rendered once, outside both layouts, and independently of whether there\n are rows: a refetch that fails leaves the previous page on screen, and\n without this the user would read stale data as current.\n */}\n {/*\n One state for the region, outside both layouts (ADR 0028): a failed\n load with Retry — and the rows from before it marked as possibly out of\n date — or an empty answer, which says whether a filter emptied it.\n */}\n <RegionState\n plural={entityNoun(metaEntity, 'plural')}\n isLoading={isLoading}\n error={error}\n onRetry={onRetry}\n hasStaleData={items.length > 0}\n isEmpty={items.length === 0}\n isFiltered={activeFilters > 0}\n onClearFilters={\n onFilteringChange === undefined\n ? undefined\n : () => {\n // The button goes with the empty state it sits in, so focus\n // moves first to the control that filters — still there, and\n // where a reader would go next — never to `<body>`.\n document.getElementById(`${panelId}-filters`)?.focus();\n onFilteringChange({\n // Only offered under a filter, so there is one to keep the\n // logic of.\n operator: (filtering as FilterGroup<TEntity>).operator,\n values: [],\n });\n }\n }\n emptyAction={\n mayCreate\n ? renderLink({\n href: newHref as string,\n className: button({ variant: 'primary' }),\n children: t('table.new'),\n intent: { kind: 'new' },\n })\n : undefined\n }\n />\n\n {/*\n A settled empty answer is the region's state alone: a grid's header\n over no rows, announced after \"nothing here\", told the reader there\n was a table to read (ADR 0028). Loading keeps the skeleton's geometry,\n and a failure keeps whatever rows it had, so nothing already on screen\n moves.\n */}\n {!settledEmpty && (\n <>\n {/* Wide viewports: a grid. */}\n <div className={pivot.grid} aria-busy={busy}>\n {/* Held to most of the viewport so the header can stick above the\n rows; the scroll padding keeps a focused row out from under it. */}\n <Table\n caption={caption}\n containerClassName=\"max-h-(--table-max-block) scroll-pt-12\"\n // Never narrower than its columns side by side: between the\n // essential width and that, the grid scrolls rather than crushing\n // every column into an unreadable sliver.\n style={{ minWidth: `${widths.full}rem` }}\n // A focused cell scrolled sideways is never left under the\n // sticky title column (WCAG 2.4.11).\n containerStyle={\n stickyTitle === undefined\n ? undefined\n : {\n scrollPaddingInlineStart: `${columnWidth(stickyTitle)}rem`,\n }\n }\n >\n <TableHead>\n {slots.header ? (\n slots.header.render(visibleColumns)\n ) : (\n <tr>\n {selectable && (\n <TableHeaderCell>\n <Checkbox\n aria-label={t('table.selectAllOnPage')}\n checked={allOnPageSelected}\n indeterminate={someOnPageSelected}\n disabled={isBulkRunning || items.length === 0}\n onChange={event =>\n toggleAllOnPage(\n event.currentTarget.checked,\n selectionState,\n )\n }\n />\n </TableHeaderCell>\n )}\n {visibleColumns.map(headerCell)}\n {hasRowAction && (\n <TableHeaderCell>{t('table.actions')}</TableHeaderCell>\n )}\n </tr>\n )}\n </TableHead>\n <TableBody>\n {/* Skeleton rows rather than the word \"Loading\", and one per column\n rather than a single full-width blob: the placeholder occupies\n the real grid, so the swap to rows shifts nothing sideways.\n `TableMessageRow` is deliberately bypassed — it is one centred\n full-span cell and cannot express the geometry. */}\n {showSkeleton &&\n (customSkeleton ? (\n <TableMessageRow colSpan={columnCount}>\n {customSkeleton}\n </TableMessageRow>\n ) : (\n skeletonRows.map(row => (\n <TableRow key={row}>\n {selectable && (\n <TableCell>\n <Skeleton shape=\"line\" className=\"w-4\" />\n </TableCell>\n )}\n {visibleColumns.map(column => (\n <TableCell key={column.name}>\n <Skeleton shape=\"line\" className=\"w-full\" />\n </TableCell>\n ))}\n {hasRowAction && (\n <TableCell>\n <Skeleton shape=\"line\" className=\"w-16\" />\n </TableCell>\n )}\n </TableRow>\n ))\n ))}\n {shown.map(({ item, depth, hasChildren }, index) =>\n slots.row ? (\n // A Fragment carries the key without wrapping the custom row in\n // an element `<tbody>` would reject.\n <Fragment key={String(item.id ?? index)}>\n {slots.row.render(item, visibleColumns)}\n </Fragment>\n ) : (\n <TableRow\n key={String(item.id ?? index)}\n data-record-id={`${rowScope}${String(item.id)}`}\n className=\"group/row\"\n >\n {selectionState && (\n <TableCell>\n {selectionCell(item, index, selectionState)}\n </TableCell>\n )}\n {visibleColumns.map((column, columnIndex) => (\n <TableCell\n key={column.name}\n className={stickyClass(column, 'body')}\n >\n {treeKeys !== undefined && columnIndex === 0 ? (\n <TreeCell\n depth={depth}\n hasChildren={hasChildren}\n expanded={!collapsed.has(treeKeys.idOf(item))}\n label={t(\n collapsed.has(treeKeys.idOf(item))\n ? 'table.expandRow'\n : 'table.collapseRow',\n { record: rowLabel(item) },\n )}\n onToggle={() =>\n toggleCollapsed(treeKeys.idOf(item))\n }\n >\n {renderCell(column, item)}\n </TreeCell>\n ) : (\n renderCell(column, item)\n )}\n </TableCell>\n ))}\n {hasRowAction && (\n <TableCell>{recordAction(item)}</TableCell>\n )}\n </TableRow>\n ),\n )}\n </TableBody>\n </Table>\n </div>\n\n {/* Narrow containers: the same columns pivoted into a list of cards. */}\n <div className={pivot.cards} aria-busy={busy}>\n {/* The card pivot gets card-shaped placeholders, not a bare shimmer\n block: the border, radius and padding are the geometry here. */}\n {showSkeleton &&\n (customSkeleton ?? (\n <ul\n role=\"list\"\n className=\"m-0 p-0 flex list-none flex-col gap-2xs\"\n >\n {skeletonRows.map(row => (\n <li key={row}>\n <EntityRecordCard\n title={<Skeleton shape=\"line\" className=\"w-32\" />}\n meta={visibleColumns.slice(1).map(column => ({\n key: column.name,\n label: column.label,\n value: <Skeleton shape=\"line\" className=\"w-24\" />,\n }))}\n />\n </li>\n ))}\n </ul>\n ))}\n {shown.length > 0 && (\n <ul\n role=\"list\"\n className=\"m-0 p-0 flex list-none flex-col gap-2xs\"\n >\n {shown.map(({ item, depth }, index) => {\n const parts = cardParts(item);\n return (\n <li\n key={String(item.id ?? index)}\n data-record-id={`${rowScope}${String(item.id)}`}\n // A tree's card says how deep it sits, as its row does.\n aria-level={\n treeKeys === undefined ? undefined : depth + 1\n }\n style={\n treeKeys === undefined\n ? undefined\n : { marginInlineStart: `${depth * 1.5}rem` }\n }\n >\n <EntityRecordCard\n // The same renderers as the grid, so the two layouts agree.\n title={\n parts.title === undefined\n ? hrefFor === undefined || onSelect !== undefined\n ? rowLabel(item)\n : renderLink({\n href: hrefFor(item.id),\n className: linkClassName,\n children: rowLabel(item),\n intent: { kind: 'open', id: item.id },\n })\n : renderCell(parts.title, item)\n }\n subtitle={\n parts.subtitle === undefined\n ? undefined\n : renderCell(parts.subtitle, item)\n }\n badges={parts.badges.map(column => ({\n key: column.name,\n value: renderCell(column, item),\n }))}\n meta={parts.meta.map(column => ({\n key: column.name,\n label: column.header ?? column.label,\n value: renderCell(column, item),\n }))}\n leading={\n selectionState\n ? selectionCell(item, index, selectionState)\n : undefined\n }\n actions={recordAction(item)}\n />\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </>\n )}\n\n <Pagination\n currentPage={currentPage}\n pageSize={pageSize}\n totalItems={totalItems}\n onPageChange={onPageChange}\n onPageSizeChange={onPageSizeChange}\n />\n\n {slots.rest}\n </div>\n );\n}\n\n/**\n * The first control in a record's row or card that the reader can see. Both\n * layouts are in the DOM and CSS shows one, so a control inside the hidden\n * one is skipped. `scoped` is the record's id under this table's own prefix,\n * so a second table on the page holding the same record is never reached.\n */\nfunction focusableIn(scoped: string): HTMLElement | undefined {\n return [\n ...document.querySelectorAll<HTMLElement>(\n `[data-record-id=\"${CSS.escape(scoped)}\"] :is(a[href], button)`,\n ),\n ].find(\n control =>\n // `checkVisibility` is recent; a browser without it is asked for the\n // boxes the control lays out, which a `display: none` layout has none of.\n control.checkVisibility?.() ?? control.getClientRects().length > 0,\n );\n}\n"],"names":["canNameRecord","emptySelection","extractMetaEntity","hierarchyOf","isSelected","queryPropertyFor","recordLabel","selectionSize","toggleSelected","Fragment","useId","useMemo","useRef","useState","useEntityNoun","useLocale","useT","useTranslateKey","availableUseCases","renderAnchor","useCasesForSurface","useVerbInvoker","Button","button","CellValue","useRecordLabel","Checkbox","Skeleton","Table","TableBody","TableCell","TableHead","TableHeaderCell","TableMessageRow","TableRow","linkClassName","ActionBar","itemsForUseCases","BulkActionBar","BulkResult","ColumnSettings","EntityRecordCard","FilterBuilder","FilterChips","LoadingBoundary","Pagination","RegionState","SortBuilder","TableToolbar","useFocusOnLoss","cardRoles","readEntityTableSlots","shownTreeRows","TreeCell","treeRows","nextHeaderSorting","sortKeys","ACTIONS_WIDTH","columnWidth","pivotClasses","pivotWidths","SELECTION_WIDTH","useEntityTableColumns","useResultAnnouncement","SKELETON_ROW_CAP","UNDECLARED_META_CAP","EntityTable","entityConstructor","isLoading","skeleton","error","items","totalItems","currentPage","pageSize","onPageChange","onPageSizeChange","hrefFor","newHref","renderLink","onSelect","preferencesKey","hiddenColumns","showControls","pivotBreakpoint","filtering","sorting","onFilteringChange","onSortingChange","facets","selection","onSelectionChange","metadata","isMetadataLoading","onBulkUseCase","onUseCase","onRetry","bulkOutcomes","onBulkDismiss","onBulkRetry","isBulkRunning","children","visibleColumns","t","translateKey","entityNoun","metaEntity","slots","panel","setPanel","columns","hidden","setPersonalization","key","name","undefined","Error","selectionState","selectable","rowUseCases","useCases","bulkUseCases","toolbarUseCases","hasRowMenu","length","everythingMatching","mode","total","excluded","Set","hasRowAction","columnCount","stickyTitle","find","column","labelMember","card","widths","title","roleOf","extra","breakpoint","pivot","essential","stickyClass","part","isFirstLoad","settledEmpty","customSkeleton","showSkeleton","skeletonRows","Array","from","Math","min","_","index","busy","nameOf","declaredTitle","linkColumn","item","named","label","kind","member","value","String","cardParts","rest","filter","undeclared","subtitle","badges","meta","renderValue","render","descriptor","record","renderCell","href","id","className","intent","anchorIndex","treeKeys","collapsed","setCollapsed","rows","shown","shownItems","map","row","toggleCollapsed","current","next","has","delete","add","setSelection","toggleRow","checked","shiftKey","start","end","slice","pageIds","selectedOnPage","allOnPageSelected","someOnPageSelected","toggleAllOnPage","rowLabel","selectionCell","aria-label","disabled","onChange","event","currentTarget","nativeEvent","runTarget","target","verbs","run","served","rowScope","lastRow","setLastRow","focusableIn","join","invoke","useCase","object","count","plural","matching","rowMenu","surface","menuLabel","recordAction","pick","type","variant","size","onClick","menu","span","mayCreate","creatable","actions","includes","toolbarItems","declaresToolbarPrimary","some","emphasis","toolbarActions","locale","panelId","keys","activeFilters","values","results","announcement","JSON","stringify","primaryKey","primaryColumn","caption","entity","direction","headerCell","header","sortable","position","findIndex","aria-sort","property","aria-hidden","panelToggle","which","aria-expanded","aria-controls","div","role","aria-live","lines","toolbar","descriptors","filterable","applied","matchingTotal","onSelectAllMatching","onClear","dialog","outcomes","labelFor","onRetryFailed","onDismiss","hasStaleData","isEmpty","isFiltered","onClearFilters","document","getElementById","focus","operator","emptyAction","grid","aria-busy","containerClassName","style","minWidth","full","containerStyle","scrollPaddingInlineStart","tr","indeterminate","colSpan","shape","depth","hasChildren","data-record-id","columnIndex","expanded","idOf","onToggle","cards","ul","li","parts","aria-level","marginInlineStart","leading","scoped","querySelectorAll","CSS","escape","control","checkVisibility","getClientRects"],"mappings":"AAAA;;AAEA,SACEA,aAAa,EACbC,cAAc,EAKdC,iBAAiB,EAEjBC,WAAW,EACXC,UAAU,EACVC,gBAAgB,EAChBC,WAAW,EACXC,aAAa,EACbC,cAAc,QAET,gBAAgB;AACvB,SACEC,QAAQ,EAERC,KAAK,EACLC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAQ;AAEf,SACEC,aAAa,EACbC,SAAS,EACTC,IAAI,EACJC,eAAe,QACV,yBAAyB;AAChC,SACEC,iBAAiB,EACjBC,YAAY,EACZC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SAASC,MAAM,EAAEC,MAAM,QAAQ,8BAA8B;AAC7D,SAASC,SAAS,EAAEC,cAAc,QAAQ,kCAAkC;AAC5E,SAASC,QAAQ,QAAQ,6BAA6B;AACtD,SAASC,QAAQ,QAAQ,gCAAgC;AACzD,SACEC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,QAAQ,QACH,6BAA6B;AACpC,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SACEC,SAAS,EAETC,gBAAgB,QACX,sCAAsC;AAC7C,SAASC,aAAa,QAAQ,2CAA2C;AACzE,SAASC,UAAU,QAAQ,uCAAuC;AAClE,SAASC,cAAc,QAAQ,2CAA2C;AAC1E,SAASC,gBAAgB,QAAQ,8CAA8C;AAC/E,SAASC,aAAa,QAAQ,0CAA0C;AACxE,SAASC,WAAW,QAAQ,wCAAwC;AACpE,SAASC,eAAe,QAAQ,4CAA4C;AAC5E,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,WAAW,QAAQ,wCAAwC;AACpE,SAASC,WAAW,QAAQ,wCAAwC;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GtN,MAAM,GAAG;;AAEvE"}
1
+ {"version":3,"sources":["../../../../src/ui/organisms/entity-table/entity-table.tsx"],"sourcesContent":["'use client';\n\nimport {\n canNameRecord,\n emptySelection,\n type Entity,\n type EntityId,\n type EntitySelection,\n type EntitySorting,\n extractMetaEntity,\n type FilterGroup,\n hierarchyOf,\n isSelected,\n isTextMember,\n queryPropertyFor,\n recordLabel,\n selectionSize,\n toggleSelected,\n type UseCaseDescriptor,\n} from '@entifix/core';\nimport {\n Fragment,\n type ReactNode,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport {\n useEntityNoun,\n useLocale,\n useT,\n useTranslateKey,\n} from '../../../i18n/index.js';\nimport {\n availableUseCases,\n renderAnchor,\n useCasesForSurface,\n} from '../../actions/index.js';\nimport { useVerbInvoker } from '../../actions/use-verb-invoker.js';\nimport { Button, button } from '../../atoms/button/index.js';\nimport { CellValue, useRecordLabel } from '../../atoms/cell-value/index.js';\nimport { Checkbox } from '../../atoms/field/index.js';\nimport { Skeleton } from '../../atoms/skeleton/index.js';\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeaderCell,\n TableMessageRow,\n TableRow,\n} from '../../atoms/table/index.js';\nimport { linkClassName } from '../../atoms/text/index.js';\nimport {\n ActionBar,\n type ActionBarItem,\n itemsForUseCases,\n} from '../../molecules/action-bar/index.js';\nimport { BulkActionBar } from '../../molecules/bulk-action-bar/index.js';\nimport { BulkResult } from '../../molecules/bulk-result/index.js';\nimport { ColumnSettings } from '../../molecules/column-settings/index.js';\nimport { EntityRecordCard } from '../../molecules/entity-record-card/index.js';\nimport { FilterBuilder } from '../../molecules/filter-builder/index.js';\nimport { FilterChips } from '../../molecules/filter-chips/index.js';\nimport { LoadingBoundary } from '../../molecules/loading-boundary/index.js';\nimport { Pagination } from '../../molecules/pagination/index.js';\nimport { RegionState } from '../../molecules/region-state/index.js';\nimport { SortBuilder } from '../../molecules/sort-builder/index.js';\nimport { TableToolbar } from '../../molecules/table-toolbar/index.js';\nimport { useFocusOnLoss } from '../../utils/use-focus-on-arrival.js';\nimport { cardRoles } from './card-roles.js';\nimport type {\n EntityTableColumn,\n EntityTableProps,\n} from './entity-table.types.js';\nimport { readEntityTableSlots } from './entity-table-slots.js';\nimport { shownTreeRows, TreeCell, treeRows } from './entity-table-tree.js';\nimport { nextHeaderSorting, sortKeys } from './header-sort.js';\nimport {\n ACTIONS_WIDTH,\n columnWidth,\n pivotClasses,\n pivotWidths,\n SELECTION_WIDTH,\n} from './pivot.js';\nimport { useEntityTableColumns } from './use-entity-table-columns.js';\nimport { useResultAnnouncement } from './use-result-announcement.js';\n\ntype Panel = 'none' | 'filters' | 'sorting';\n\n/**\n * How many placeholder rows the built-in skeleton draws.\n *\n * The column count is taken from the real geometry, because that is the axis a\n * mismatch shifts; the row count is capped instead of tracking `pageSize`, since\n * a fifty-row page would otherwise paint fifty shimmer rows to stand in for\n * content that arrives below the fold anyway.\n */\nconst SKELETON_ROW_CAP = 5;\n\n/** How many members a card shows as meta when none declares a `card` role. */\nconst UNDECLARED_META_CAP = 3;\n\n/**\n * The name of the leading column a table adds when nothing on screen names a\n * row. Not a member name an entity can declare, so it never collides.\n */\nconst RECORD_COLUMN = '$record';\n\n/**\n * A table that builds itself from an entity's metadata: columns, labels, value\n * formatting and the filter/sort controls all come from `@accessor()`\n * declarations, so listing a new entity needs no bespoke table.\n *\n * Three things layer on top of that default:\n * - **personalization** — column order and visibility, persisted through the\n * UI-preferences port (so it survives reloads and can later move server-side);\n * - **responsiveness** — below `pivotBreakpoint` rows pivot into label/value\n * cards instead of scrolling sideways;\n * - **slots** — `<EntityColumn>` / `<EntityTableHeader>` / `<EntityTableRow>` /\n * `<EntityTableToolbar>` children override any part of the default rendering.\n */\n/**\n * What a pending verb will act on once it is confirmed.\n *\n * A form has one record; a table has a row or a selection, and those reach two\n * different handlers with two different payloads. Carrying the selection itself\n * rather than reading it back at confirm time also removes a branch that could\n * not happen: the bulk bar only renders inside a truthy selection.\n */\ntype PendingTarget<TEntity extends Entity> =\n | { kind: 'row'; item: TEntity }\n | { kind: 'selection'; selection: EntitySelection<TEntity> };\n\nexport function EntityTable<TEntity extends Entity>({\n entityConstructor,\n isLoading,\n skeleton = true,\n error,\n items,\n totalItems,\n currentPage,\n pageSize,\n onPageChange,\n onPageSizeChange,\n hrefFor,\n newHref,\n renderLink = renderAnchor,\n onSelect,\n preferencesKey,\n hiddenColumns,\n showKey = false,\n showControls = true,\n pivotBreakpoint,\n filtering,\n sorting,\n onFilteringChange,\n onSortingChange,\n facets,\n selection,\n onSelectionChange,\n metadata,\n isMetadataLoading = false,\n onBulkUseCase,\n onUseCase,\n onRetry,\n bulkOutcomes,\n onBulkDismiss,\n onBulkRetry,\n isBulkRunning = false,\n children,\n}: EntityTableProps<TEntity>) {\n const t = useT();\n // A descriptor's label is a runtime catalog key — the typed gate cannot see\n // it, which is why a host's catalog check is what catches a typo.\n const translateKey = useTranslateKey();\n const entityNoun = useEntityNoun();\n const metaEntity = extractMetaEntity(entityConstructor);\n const slots = readEntityTableSlots<TEntity>(children);\n const [panel, setPanel] = useState<Panel>('none');\n\n const {\n columns,\n visibleColumns: resolvedColumns,\n hidden,\n setPersonalization,\n } = useEntityTableColumns<TEntity>(\n entityConstructor,\n slots.columns,\n items[0],\n `entity-table:${preferencesKey ?? metaEntity.key ?? metaEntity.name}`,\n hiddenColumns,\n showKey,\n );\n const nameOf = useRecordLabel();\n /**\n * How a row names itself — to a screen reader on its checkbox, in a confirm\n * dialog, a bulk result, a tree toggle: what the reader reads the row *as*\n * (\"Seleccionar Acme\", never \"Seleccionar fila 3\" and never a whole id),\n * through the one derivation every surface shares.\n */\n const rowLabel = (item: TEntity): string => nameOf(entityConstructor, item);\n\n /**\n * The column every row reads as — the entity's `labelMember`, else its\n * declared card title, else the first **text** member that is not a key. A\n * status, a quantity or a date is a value the record holds, never what it is\n * called, which is the rule `recordLabel()` names a record by.\n */\n const titleOf = (candidates: Array<EntityTableColumn<TEntity>>) =>\n candidates.find(column => column.name === metaEntity.labelMember) ??\n candidates.find(column => column.card === 'title') ??\n candidates.find(column => canNameRecord(column) && isTextMember(column));\n /**\n * A record nothing on screen names — an order, a movement, a payout, or a\n * row whose naming column the reader has hidden — gets a leading column of\n * its own that reads as the record: its noun and short id, as every other\n * surface names it. Without it the grid's link landed on a number or an\n * enum, or on no cell at all.\n */\n const namedTitle = titleOf(resolvedColumns);\n /**\n * The title column, held in view at the inline start while a grid wider than\n * its container scrolls — the naming column, or the record column above.\n */\n const stickyTitle: EntityTableColumn<TEntity> = namedTitle ?? {\n name: RECORD_COLUMN,\n key: RECORD_COLUMN,\n label: entityNoun(metaEntity),\n type: 'string',\n sortable: false,\n filterable: false,\n order: -1,\n readonly: false,\n required: false,\n linkLabelProperty: 'name',\n linkSearchProperty: 'name',\n linkSerialization: 'id',\n resetOnClone: false,\n card: 'title',\n render: rowLabel,\n virtual: true,\n };\n const visibleColumns =\n namedTitle === undefined\n ? [stickyTitle, ...resolvedColumns]\n : resolvedColumns;\n\n // A picker's table is choosing *one* value; a multi-selection there would\n // offer a set to a form member that holds a single reference, and the two\n // controls would fight over the same row. This is a wiring mistake rather\n // than a state, so it costs the render — the same call `EntityForm` makes\n // for a link source aimed at a member no picker can edit.\n if (onSelect !== undefined && selection !== undefined) {\n throw new Error(\n 'EntityTable was given both `onSelect` and `selection`. A picker picks one ' +\n 'row and a selection accumulates many, so the row control cannot be both. ' +\n 'Drop `selection` inside a picker, or drop `onSelect` outside one.',\n );\n }\n\n /**\n * The selection, or `undefined` when the table is not selectable at all.\n *\n * One value rather than a `selection` prop beside a `selectable` boolean:\n * two of them means every render site has to re-test both, and the second\n * test is unreachable — which reads as a defensive check and is really dead\n * code the coverage gate then cannot close.\n */\n const selectionState =\n selection !== undefined && onSelectionChange !== undefined\n ? selection\n : undefined;\n const selectable = selectionState !== undefined;\n const rowUseCases = useCasesForSurface('row-menu', metadata?.useCases);\n const bulkUseCases = useCasesForSurface('bulk-bar', metadata?.useCases);\n const toolbarUseCases = useCasesForSurface(\n 'table-toolbar',\n metadata?.useCases,\n );\n const hasRowMenu = rowUseCases.length > 0 && onUseCase !== undefined;\n\n /**\n * What a `context-independent` collection verb acts on: everything the\n * current filter matches.\n *\n * Not an empty `ids` selection, which would say \"no rows\" — the verb is\n * available *without* a selection precisely because its subject is the\n * collection, so the honest payload is the same filter the listing is\n * showing, and the same one a \"select all matching\" escalation would send.\n */\n const everythingMatching: EntitySelection<TEntity> = {\n mode: 'matching',\n filtering,\n total: totalItems,\n excluded: new Set<EntityId>(),\n };\n\n // Opening a record is its title's link, so a row needs an actions column\n // only to pick it or to run a verb on it.\n const hasRowAction = onSelect !== undefined || hasRowMenu;\n const columnCount =\n visibleColumns.length + (hasRowAction ? 1 : 0) + (selectable ? 1 : 0);\n\n /**\n * The grid and the cards are both rendered, and a container query on the\n * table's own box picks one — at the width its visible columns need. A\n * viewport breakpoint was wrong inside a split view, a drawer or a wizard\n * step, and a JS measurement would guess during SSR and correct after mount.\n */\n const widths = pivotWidths({\n columns: visibleColumns,\n title: stickyTitle,\n roleOf: cardRoles(visibleColumns),\n extra:\n (selectable ? SELECTION_WIDTH : 0) + (hasRowAction ? ACTIONS_WIDTH : 0),\n breakpoint: pivotBreakpoint,\n });\n const pivot = pivotClasses(widths.essential);\n /**\n * The sticky title's cells: opaque, so the columns scrolling under it never\n * show through — a header cell on the header's surface, a row's on the\n * row's, following its hover.\n */\n const stickyClass = (\n column: EntityTableColumn<TEntity>,\n part: 'header' | 'body',\n ) =>\n column !== stickyTitle\n ? undefined\n : part === 'header'\n ? 'sticky start-0 z-2 bg-surface'\n : 'sticky start-0 z-1 bg-surface-elevated group-hover/row:bg-surface';\n /**\n * The first load has nothing to show and is held with a skeleton; a refetch\n * already has rows, so it keeps them and only marks the region busy. Splitting\n * the two is what stops every pagination click flashing grey.\n */\n const isFirstLoad = isLoading && items.length === 0;\n /** Loaded, nothing came back, and nothing failed: there are no rows to lay out. */\n const settledEmpty = items.length === 0 && !isLoading && error === undefined;\n\n /** `true`/omitted → the built-in default; a node → that node; `false` → none. */\n const customSkeleton = typeof skeleton === 'boolean' ? undefined : skeleton;\n const showSkeleton = isFirstLoad && skeleton !== false;\n const skeletonRows = Array.from(\n { length: Math.min(pageSize, SKELETON_ROW_CAP) },\n (_, index) => index,\n );\n\n /**\n * A refetch keeps its rows at full contrast and marks them `aria-busy`:\n * dimming them through opacity took the text under the contrast a reader\n * needs, on every page change.\n */\n const busy = isLoading || undefined;\n\n /**\n * The column a row reads *as*: the member `recordLabel()` names it by, when\n * the reader has not hidden that column; else one declared `card: 'title'`;\n * else the first visible text one it filled in that is not a key; else the\n * table's title column, whose empty cell then reads as the record's label.\n * So every row has exactly one open link, and it is never a number or an\n * enum.\n */\n const declaredTitle = visibleColumns.find(column => column.card === 'title');\n const linkColumn = (item: TEntity) => {\n const label = recordLabel(entityConstructor, item);\n const named =\n label.kind === 'fallback'\n ? undefined\n : visibleColumns.find(column => column.name === label.member.name);\n return (\n named ??\n declaredTitle ??\n visibleColumns.find(column => {\n const value = (item as Record<string, unknown>)[column.name];\n return (\n canNameRecord(column) &&\n isTextMember(column) &&\n value != null &&\n String(value) !== ''\n );\n }) ??\n stickyTitle\n );\n };\n\n /**\n * What a record's card shows, by each member's declared `card` role or the\n * default: an id is hidden, the first enum is the badge, and up to\n * {@link UNDECLARED_META_CAP} more members are meta — a card is a summary,\n * and the grid holds the rest.\n */\n const roleOf = cardRoles(visibleColumns);\n const cardParts = (item: TEntity) => {\n const title = linkColumn(item);\n const rest = visibleColumns.filter(column => column !== title);\n let undeclared = 0;\n return {\n title,\n subtitle: rest.find(column => roleOf(column) === 'subtitle'),\n badges: rest.filter(column => roleOf(column) === 'badge'),\n meta: rest.filter(column => {\n if (roleOf(column) !== 'meta') return false;\n if (column.card !== undefined) return true;\n undeclared += 1;\n return undeclared <= UNDECLARED_META_CAP;\n }),\n };\n };\n\n const renderValue = (\n column: EntityTableColumn<TEntity>,\n item: TEntity,\n ): ReactNode =>\n column.render ? (\n column.render(item)\n ) : (\n <CellValue\n value={(item as Record<string, unknown>)[column.name]}\n descriptor={column}\n record={item as Record<string, unknown>}\n />\n );\n\n /**\n * A cell, and the row's title cell is the record's link\n * ([ADR 0026](../../../../../../../docs/adr/0026-actions-hierarchy-overflow-and-destructive-verbs.md)).\n * A column of identical \"Open\" links named nothing, and a reader tabbing\n * down it heard \"Open\" once per row; the title says which record it opens.\n * A picker's rows are chosen, not opened, so they stay plain.\n */\n const renderCell = (\n column: EntityTableColumn<TEntity>,\n item: TEntity,\n ): ReactNode => {\n if (linkColumn(item).name !== column.name) return renderValue(column, item);\n // The row's title cell left empty still reads as the record.\n const raw = (item as Record<string, unknown>)[column.name];\n const blank = column.render === undefined && (raw == null || raw === '');\n const value = blank ? rowLabel(item) : renderValue(column, item);\n if (hrefFor === undefined || onSelect !== undefined) return value;\n return renderLink({\n href: hrefFor(item.id),\n className: linkClassName,\n children: value,\n intent: { kind: 'open', id: item.id },\n });\n };\n\n /**\n * The row a shift-click ranges *from* — the last box the user actually\n * toggled. Held in a ref rather than state because it changes nothing on\n * screen, and re-rendering the whole table on every click to remember an\n * anchor is a cost with no visible return.\n */\n const anchorIndex = useRef<number | undefined>(undefined);\n\n /**\n * An entity that declares a parent renders as a tree: the page arranged\n * depth first, its first column indented, and a subtree hidden while its\n * record is collapsed. Collapsing is view state, so it lives here and is\n * forgotten with the table, like the shift-click anchor above.\n */\n const treeKeys = useMemo(\n () => hierarchyOf(entityConstructor),\n [entityConstructor],\n );\n const [collapsed, setCollapsed] = useState<ReadonlySet<string>>(\n () => new Set(),\n );\n const rows = useMemo(() => treeRows(items, treeKeys), [items, treeKeys]);\n const shown = shownTreeRows(rows, collapsed);\n const shownItems = shown.map(row => row.item);\n const toggleCollapsed = (key: string) =>\n setCollapsed(current => {\n const next = new Set(current);\n if (next.has(key)) next.delete(key);\n else next.add(key);\n return next;\n });\n\n const setSelection = (next: EntitySelection<TEntity>) =>\n onSelectionChange?.(next);\n\n const toggleRow = (\n index: number,\n checked: boolean,\n shiftKey: boolean,\n current: EntitySelection<TEntity>,\n ) => {\n // A shift-click extends the last toggle across the rows *on this page*, in\n // the direction the user dragged, and applies the new state to all of them.\n const from = shiftKey ? (anchorIndex.current ?? index) : index;\n const [start, end] = from <= index ? [from, index] : [index, from];\n\n let next = current;\n // The rows as shown: in a tree the order on screen is not the load's.\n for (const row of shownItems.slice(start, end + 1)) {\n next = toggleSelected(next, row.id, checked);\n }\n\n anchorIndex.current = index;\n setSelection(next);\n };\n\n /**\n * The header box, and it has three states rather than two: none of this\n * page's rows selected, all of them, or some. Without the third the box\n * reads as \"nothing is selected\" while a bulk bar sits below it saying\n * otherwise.\n */\n const pageIds = items.map(item => item.id);\n const selectedOnPage = selectionState\n ? pageIds.filter(id => isSelected(selectionState, id)).length\n : 0;\n const allOnPageSelected =\n pageIds.length > 0 && selectedOnPage === pageIds.length;\n const someOnPageSelected = selectedOnPage > 0 && !allOnPageSelected;\n\n const toggleAllOnPage = (\n checked: boolean,\n current: EntitySelection<TEntity>,\n ) => {\n let next = current;\n for (const id of pageIds) next = toggleSelected(next, id, checked);\n anchorIndex.current = undefined;\n setSelection(next);\n };\n\n const selectionCell = (\n item: TEntity,\n index: number,\n // Passed in rather than closed over: this is only ever called under\n // `selectable`, which already proves the selection exists, and reading the\n // optional prop here would add a fallback arm that nothing can reach.\n current: EntitySelection<TEntity>,\n ) => (\n <Checkbox\n // Deliberately no `id`: both pivots are always in the DOM, so an id here\n // would be emitted twice per row. `aria-label` names the control instead,\n // and it names the *record* rather than the position.\n aria-label={t('table.selectRow', { record: rowLabel(item) })}\n checked={isSelected(current, item.id)}\n disabled={isBulkRunning}\n onChange={event =>\n toggleRow(\n index,\n event.currentTarget.checked,\n (event.nativeEvent as MouseEvent).shiftKey === true,\n current,\n )\n }\n />\n );\n\n const runTarget = (key: string, target: PendingTarget<TEntity>) => {\n if (target.kind === 'row') onUseCase?.(key, target.item);\n else onBulkUseCase?.(key, target.selection);\n };\n\n /**\n * Every verb on the table goes through here — the row menu, the bulk bar and\n * the toolbar — so none reaches a destructive verb around its confirmation,\n * its typed check or its Undo.\n */\n const verbs = useVerbInvoker<PendingTarget<TEntity>>({\n run: runTarget,\n busy: isBulkRunning,\n served: metadata?.useCases,\n });\n\n // The row a verb last ran on. Its menu trigger unmounts when the verb moved\n // the record out of every state a row verb applies to, and focus then goes\n // to that row's own link or control rather than `<body>`.\n const rowScope = useId();\n const [lastRow, setLastRow] = useState<string | undefined>(undefined);\n useFocusOnLoss(\n () =>\n lastRow === undefined ? undefined : focusableIn(`${rowScope}${lastRow}`),\n shown\n .map(({ item }) =>\n availableUseCases(rowUseCases, item)\n .map(({ key }) => key)\n .join(','),\n )\n .join(' '),\n );\n\n const invoke = (\n useCase: UseCaseDescriptor,\n target: PendingTarget<TEntity>,\n ) => {\n if (target.kind === 'row') {\n setLastRow(String(target.item.id));\n verbs.invoke({\n descriptor: useCase,\n target,\n object: rowLabel(target.item),\n count: 1,\n });\n return;\n }\n const count = selectionSize(target.selection);\n verbs.invoke({\n descriptor: useCase,\n target,\n object: t('confirm.selection', {\n count,\n label: entityNoun(metaEntity),\n plural: entityNoun(metaEntity, 'plural'),\n }),\n count,\n matching: target.selection.mode === 'matching',\n });\n };\n\n const rowMenu = (item: TEntity) =>\n hasRowMenu ? (\n <ActionBar\n surface=\"row-menu\"\n menuLabel={t('actions.forRecord', { record: rowLabel(item) })}\n items={itemsForUseCases(\n availableUseCases(rowUseCases, item),\n translateKey,\n useCase => invoke(useCase, { kind: 'row', item }),\n )}\n />\n ) : undefined;\n\n /**\n * A picker's Select, then the row's verbs. Opening the record is not here:\n * it is the title's link.\n */\n const recordAction = (item: TEntity) => {\n const pick = onSelect ? (\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n onClick={() => onSelect(item)}\n >\n {t('table.select')}\n </Button>\n ) : undefined;\n\n const menu = rowMenu(item);\n if (!menu) return pick;\n\n return (\n <span className=\"flex items-center gap-2xs\">\n {pick}\n {menu}\n </span>\n );\n };\n\n /**\n * \"New\" is the list's primary, and only where something can be created\n * here: the entity is not one only a flow writes (`creatable: false`), and\n * the caller may write it. A list that offered \"New\" to a reader who could\n * never save opened a form with no Save on it.\n */\n const mayCreate =\n newHref !== undefined &&\n metaEntity.creatable &&\n (metadata === undefined || metadata.actions.includes('write'));\n const toolbarItems: ActionBarItem[] = itemsForUseCases(\n toolbarUseCases,\n translateKey,\n useCase =>\n invoke(useCase, { kind: 'selection', selection: everythingMatching }),\n isBulkRunning,\n );\n const declaresToolbarPrimary = toolbarItems.some(\n item => item.emphasis === 'primary',\n );\n const toolbarActions: ActionBarItem[] = [\n ...(mayCreate\n ? [\n {\n key: 'new',\n label: t('table.new'),\n emphasis: declaresToolbarPrimary\n ? ('default' as const)\n : ('primary' as const),\n href: newHref,\n intent: { kind: 'new' as const },\n },\n ]\n : []),\n ...toolbarItems,\n ];\n\n const locale = useLocale();\n const panelId = useId();\n const keys = sortKeys(sorting, columns);\n const activeFilters = filtering?.values.length ?? 0;\n const results = t('table.results', { count: totalItems });\n\n /**\n * What the status region says once a filter, a sort or a page has settled —\n * debounced, and silent on the first load.\n */\n const announcement = useResultAnnouncement(\n !isLoading,\n totalItems === 0 && activeFilters > 0\n ? t('table.noResultsFiltered')\n : results,\n JSON.stringify([filtering, sorting, currentPage, pageSize]),\n );\n\n /** The caption: what the table holds, how many, and in what order. */\n const primaryKey = keys[0];\n const primaryColumn =\n primaryKey === undefined\n ? undefined\n : columns.find(column => column.name === primaryKey.member);\n const caption =\n primaryKey === undefined || primaryColumn === undefined\n ? t('table.caption', {\n entity: entityNoun(metaEntity, 'plural'),\n results,\n })\n : t('table.captionSorted', {\n entity: entityNoun(metaEntity, 'plural'),\n results,\n column: primaryColumn.label,\n direction: t(\n primaryKey.type === 'asc' ? 'sort.ascending' : 'sort.descending',\n ),\n });\n\n /**\n * A column's header: its name, and — for a sortable one — a button that\n * cycles it ascending → descending → unsorted, with Shift adding it as the\n * next key. Only the primary key carries `aria-sort`.\n */\n const headerCell = (column: EntityTableColumn<TEntity>) => {\n const label = column.header ?? column.label;\n if (!column.sortable || onSortingChange === undefined)\n return (\n <TableHeaderCell\n key={column.name}\n className={stickyClass(column, 'header')}\n >\n {label}\n </TableHeaderCell>\n );\n const position = keys.findIndex(key => key.member === column.name);\n const type = keys[position]?.type;\n return (\n <TableHeaderCell\n key={column.name}\n className={stickyClass(column, 'header')}\n aria-sort={\n position === 0\n ? type === 'asc'\n ? 'ascending'\n : 'descending'\n : undefined\n }\n >\n <button\n type=\"button\"\n className=\"inline-flex min-h-(--target-min) items-center gap-3xs rounded-sm focus-ring hover:text-content\"\n onClick={event =>\n onSortingChange(\n nextHeaderSorting<TEntity>(\n keys,\n {\n member: column.name,\n property: queryPropertyFor(column, locale),\n },\n event.shiftKey,\n ),\n )\n }\n >\n {label}\n <span aria-hidden=\"true\">\n {type === 'asc' ? '▲' : type === 'desc' ? '▼' : '↕'}\n </span>\n {keys.length > 1 && position >= 0 && (\n <span aria-hidden=\"true\" className=\"text-step-sm\">\n {position + 1}\n </span>\n )}\n </button>\n </TableHeaderCell>\n );\n };\n\n /** A panel toggle: its state said by `aria-expanded`, and its count shown. */\n const panelToggle = (which: Exclude<Panel, 'none'>, count: number) => (\n <Button\n type=\"button\"\n id={`${panelId}-${which}`}\n variant={panel === which ? 'primary' : 'secondary'}\n size=\"sm\"\n aria-expanded={panel === which}\n aria-controls={panelId}\n onClick={() => setPanel(current => (current === which ? 'none' : which))}\n >\n {t(which === 'filters' ? 'table.filters' : 'table.sorting')}\n {count > 0 && (\n // Its name stays \"Filters\": the chips say which filters, and a count\n // in the name would change it under the reader with every filter.\n <span\n aria-hidden=\"true\"\n className=\"ms-3xs rounded-full bg-surface px-3xs text-step-sm text-content\"\n >\n {count}\n </span>\n )}\n </Button>\n );\n\n return (\n <div className=\"@container/entity-table flex flex-col gap-s\">\n {/*\n One announcement for the whole table, not one per layout. Both the grid\n and the card list are always in the DOM — CSS picks which is visible —\n so a live region inside each meant assistive tech was told twice that\n the table was loading. The shimmer itself is aria-hidden, so this is the\n only thing that carries the news.\n */}\n <span role=\"status\" aria-live=\"polite\" className=\"sr-only\">\n {isFirstLoad ? t('table.loading') : announcement}\n </span>\n\n {showControls && (\n <TableToolbar\n start={\n <>\n {/* \"New\" and the collection-bound verbs that need no\n selection. They sit here rather than in the bulk bar,\n because the bulk bar only exists while rows are ticked and\n these are always available. */}\n <LoadingBoundary isLoading={isMetadataLoading} lines={0}>\n <>\n {toolbarActions.length > 0 && (\n <ActionBar\n surface=\"table-toolbar\"\n items={toolbarActions}\n renderLink={renderLink}\n />\n )}\n </>\n </LoadingBoundary>\n {slots.toolbar}\n </>\n }\n end={\n <>\n {panelToggle('filters', activeFilters)}\n {panelToggle('sorting', keys.length)}\n <ColumnSettings\n columns={columns}\n hidden={hidden}\n onChange={setPersonalization}\n />\n </>\n }\n panelId={panelId}\n panel={\n panel === 'filters' ? (\n <FilterBuilder<TEntity>\n // Remounted when the filtering changes from outside — a chip\n // removed — so its rows show what is in effect.\n key={JSON.stringify(filtering ?? null)}\n descriptors={columns.filter(column => column.filterable)}\n facets={facets}\n value={filtering}\n onChange={(applied: FilterGroup<TEntity>) =>\n onFilteringChange?.(applied)\n }\n />\n ) : panel === 'sorting' ? (\n <SortBuilder<TEntity>\n descriptors={columns.filter(column => column.sortable)}\n value={sorting}\n onChange={(applied: EntitySorting<TEntity>) =>\n onSortingChange?.(applied)\n }\n />\n ) : undefined\n }\n />\n )}\n\n {showControls && onFilteringChange !== undefined && (\n <FilterChips<TEntity>\n descriptors={columns.filter(column => column.filterable)}\n value={filtering}\n onChange={onFilteringChange}\n />\n )}\n\n {/*\n The bar appears when there is something selected and something to do\n with it. It sits above the rows rather than floating over them: a fixed\n overlay covers the last row of a short page, which is the row the user\n most likely just ticked.\n */}\n {selectionState && selectionSize(selectionState) > 0 && (\n <BulkActionBar\n count={selectionSize(selectionState)}\n useCases={bulkUseCases}\n busy={isBulkRunning}\n // Offered only when this page is fully ticked and the store holds\n // more than the page — the escalation has somewhere to escalate to.\n matchingTotal={\n selectionState.mode === 'ids' &&\n allOnPageSelected &&\n totalItems > items.length\n ? totalItems\n : undefined\n }\n onSelectAllMatching={() => setSelection(everythingMatching)}\n onClear={() => setSelection(emptySelection<TEntity>())}\n onUseCase={useCase =>\n invoke(useCase, { kind: 'selection', selection: selectionState })\n }\n />\n )}\n\n {verbs.dialog}\n\n {bulkOutcomes && bulkOutcomes.length > 0 && onBulkDismiss && (\n <BulkResult\n outcomes={bulkOutcomes}\n busy={isBulkRunning}\n labelFor={id => {\n const row = items.find(item => item.id === id);\n return row ? rowLabel(row) : undefined;\n }}\n onRetryFailed={onBulkRetry}\n onDismiss={onBulkDismiss}\n />\n )}\n\n {/*\n Rendered once, outside both layouts, and independently of whether there\n are rows: a refetch that fails leaves the previous page on screen, and\n without this the user would read stale data as current.\n */}\n {/*\n One state for the region, outside both layouts (ADR 0028): a failed\n load with Retry — and the rows from before it marked as possibly out of\n date — or an empty answer, which says whether a filter emptied it.\n */}\n <RegionState\n plural={entityNoun(metaEntity, 'plural')}\n isLoading={isLoading}\n error={error}\n onRetry={onRetry}\n hasStaleData={items.length > 0}\n isEmpty={items.length === 0}\n isFiltered={activeFilters > 0}\n onClearFilters={\n onFilteringChange === undefined\n ? undefined\n : () => {\n // The button goes with the empty state it sits in, so focus\n // moves first to the control that filters — still there, and\n // where a reader would go next — never to `<body>`.\n document.getElementById(`${panelId}-filters`)?.focus();\n onFilteringChange({\n // Only offered under a filter, so there is one to keep the\n // logic of.\n operator: (filtering as FilterGroup<TEntity>).operator,\n values: [],\n });\n }\n }\n emptyAction={\n mayCreate\n ? renderLink({\n href: newHref as string,\n className: button({ variant: 'primary' }),\n children: t('table.new'),\n intent: { kind: 'new' },\n })\n : undefined\n }\n />\n\n {/*\n A settled empty answer is the region's state alone: a grid's header\n over no rows, announced after \"nothing here\", told the reader there\n was a table to read (ADR 0028). Loading keeps the skeleton's geometry,\n and a failure keeps whatever rows it had, so nothing already on screen\n moves.\n */}\n {!settledEmpty && (\n <>\n {/* Wide viewports: a grid. */}\n <div className={pivot.grid} aria-busy={busy}>\n {/* Held to most of the viewport so the header can stick above the\n rows; the scroll padding keeps a focused row out from under it. */}\n <Table\n caption={caption}\n containerClassName=\"max-h-(--table-max-block) scroll-pt-12\"\n // Never narrower than its columns side by side: between the\n // essential width and that, the grid scrolls rather than crushing\n // every column into an unreadable sliver.\n style={{ minWidth: `${widths.full}rem` }}\n // A focused cell scrolled sideways is never left under the\n // sticky title column (WCAG 2.4.11).\n containerStyle={{\n scrollPaddingInlineStart: `${columnWidth(stickyTitle)}rem`,\n }}\n >\n <TableHead>\n {slots.header ? (\n slots.header.render(visibleColumns)\n ) : (\n <tr>\n {selectable && (\n <TableHeaderCell>\n <Checkbox\n aria-label={t('table.selectAllOnPage')}\n checked={allOnPageSelected}\n indeterminate={someOnPageSelected}\n disabled={isBulkRunning || items.length === 0}\n onChange={event =>\n toggleAllOnPage(\n event.currentTarget.checked,\n selectionState,\n )\n }\n />\n </TableHeaderCell>\n )}\n {visibleColumns.map(headerCell)}\n {hasRowAction && (\n <TableHeaderCell>{t('table.actions')}</TableHeaderCell>\n )}\n </tr>\n )}\n </TableHead>\n <TableBody>\n {/* Skeleton rows rather than the word \"Loading\", and one per column\n rather than a single full-width blob: the placeholder occupies\n the real grid, so the swap to rows shifts nothing sideways.\n `TableMessageRow` is deliberately bypassed — it is one centred\n full-span cell and cannot express the geometry. */}\n {showSkeleton &&\n (customSkeleton ? (\n <TableMessageRow colSpan={columnCount}>\n {customSkeleton}\n </TableMessageRow>\n ) : (\n skeletonRows.map(row => (\n <TableRow key={row}>\n {selectable && (\n <TableCell>\n <Skeleton shape=\"line\" className=\"w-4\" />\n </TableCell>\n )}\n {visibleColumns.map(column => (\n <TableCell key={column.name}>\n <Skeleton shape=\"line\" className=\"w-full\" />\n </TableCell>\n ))}\n {hasRowAction && (\n <TableCell>\n <Skeleton shape=\"line\" className=\"w-16\" />\n </TableCell>\n )}\n </TableRow>\n ))\n ))}\n {shown.map(({ item, depth, hasChildren }, index) =>\n slots.row ? (\n // A Fragment carries the key without wrapping the custom row in\n // an element `<tbody>` would reject.\n <Fragment key={String(item.id ?? index)}>\n {slots.row.render(item, visibleColumns)}\n </Fragment>\n ) : (\n <TableRow\n key={String(item.id ?? index)}\n data-record-id={`${rowScope}${String(item.id)}`}\n className=\"group/row\"\n >\n {selectionState && (\n <TableCell>\n {selectionCell(item, index, selectionState)}\n </TableCell>\n )}\n {visibleColumns.map((column, columnIndex) => (\n <TableCell\n key={column.name}\n className={stickyClass(column, 'body')}\n >\n {treeKeys !== undefined && columnIndex === 0 ? (\n <TreeCell\n depth={depth}\n hasChildren={hasChildren}\n expanded={!collapsed.has(treeKeys.idOf(item))}\n label={t(\n collapsed.has(treeKeys.idOf(item))\n ? 'table.expandRow'\n : 'table.collapseRow',\n { record: rowLabel(item) },\n )}\n onToggle={() =>\n toggleCollapsed(treeKeys.idOf(item))\n }\n >\n {renderCell(column, item)}\n </TreeCell>\n ) : (\n renderCell(column, item)\n )}\n </TableCell>\n ))}\n {hasRowAction && (\n <TableCell>{recordAction(item)}</TableCell>\n )}\n </TableRow>\n ),\n )}\n </TableBody>\n </Table>\n </div>\n\n {/* Narrow containers: the same columns pivoted into a list of cards. */}\n <div className={pivot.cards} aria-busy={busy}>\n {/* The card pivot gets card-shaped placeholders, not a bare shimmer\n block: the border, radius and padding are the geometry here. */}\n {showSkeleton &&\n (customSkeleton ?? (\n <ul\n role=\"list\"\n className=\"m-0 p-0 flex list-none flex-col gap-2xs\"\n >\n {skeletonRows.map(row => (\n <li key={row}>\n <EntityRecordCard\n title={<Skeleton shape=\"line\" className=\"w-32\" />}\n meta={visibleColumns.slice(1).map(column => ({\n key: column.name,\n label: column.label,\n value: <Skeleton shape=\"line\" className=\"w-24\" />,\n }))}\n />\n </li>\n ))}\n </ul>\n ))}\n {shown.length > 0 && (\n <ul\n role=\"list\"\n className=\"m-0 p-0 flex list-none flex-col gap-2xs\"\n >\n {shown.map(({ item, depth }, index) => {\n const parts = cardParts(item);\n return (\n <li\n key={String(item.id ?? index)}\n data-record-id={`${rowScope}${String(item.id)}`}\n // A tree's card says how deep it sits, as its row does.\n aria-level={\n treeKeys === undefined ? undefined : depth + 1\n }\n style={\n treeKeys === undefined\n ? undefined\n : { marginInlineStart: `${depth * 1.5}rem` }\n }\n >\n <EntityRecordCard\n // The same renderers as the grid, so the two layouts agree.\n title={renderCell(parts.title, item)}\n subtitle={\n parts.subtitle === undefined\n ? undefined\n : renderCell(parts.subtitle, item)\n }\n badges={parts.badges.map(column => ({\n key: column.name,\n value: renderCell(column, item),\n }))}\n meta={parts.meta.map(column => ({\n key: column.name,\n label: column.header ?? column.label,\n value: renderCell(column, item),\n }))}\n leading={\n selectionState\n ? selectionCell(item, index, selectionState)\n : undefined\n }\n actions={recordAction(item)}\n />\n </li>\n );\n })}\n </ul>\n )}\n </div>\n </>\n )}\n\n <Pagination\n currentPage={currentPage}\n pageSize={pageSize}\n totalItems={totalItems}\n onPageChange={onPageChange}\n onPageSizeChange={onPageSizeChange}\n />\n\n {slots.rest}\n </div>\n );\n}\n\n/**\n * The first control in a record's row or card that the reader can see. Both\n * layouts are in the DOM and CSS shows one, so a control inside the hidden\n * one is skipped. `scoped` is the record's id under this table's own prefix,\n * so a second table on the page holding the same record is never reached.\n */\nfunction focusableIn(scoped: string): HTMLElement | undefined {\n return [\n ...document.querySelectorAll<HTMLElement>(\n `[data-record-id=\"${CSS.escape(scoped)}\"] :is(a[href], button)`,\n ),\n ].find(\n control =>\n // `checkVisibility` is recent; a browser without it is asked for the\n // boxes the control lays out, which a `display: none` layout has none of.\n control.checkVisibility?.() ?? control.getClientRects().length > 0,\n );\n}\n"],"names":["canNameRecord","emptySelection","extractMetaEntity","hierarchyOf","isSelected","isTextMember","queryPropertyFor","recordLabel","selectionSize","toggleSelected","Fragment","useId","useMemo","useRef","useState","useEntityNoun","useLocale","useT","useTranslateKey","availableUseCases","renderAnchor","useCasesForSurface","useVerbInvoker","Button","button","CellValue","useRecordLabel","Checkbox","Skeleton","Table","TableBody","TableCell","TableHead","TableHeaderCell","TableMessageRow","TableRow","linkClassName","ActionBar","itemsForUseCases","BulkActionBar","BulkResult","ColumnSettings","EntityRecordCard","FilterBuilder","FilterChips","LoadingBoundary","Pagination","RegionState","SortBuilder","TableToolbar","useFocusOnLoss","cardRoles","readEntityTableSlots","shownTreeRows","TreeCell","treeRows","nextHeaderSorting","sortKeys","ACTIONS_WIDTH","columnWidth","pivotClasses","pivotWidths","SELECTION_WIDTH","useEntityTableColumns","useResultAnnouncement","SKELETON_ROW_CAP","UNDECLARED_META_CAP","RECORD_COLUMN","EntityTable","entityConstructor","isLoading","skeleton","error","items","totalItems","currentPage","pageSize","onPageChange","onPageSizeChange","hrefFor","newHref","renderLink","onSelect","preferencesKey","hiddenColumns","showKey","showControls","pivotBreakpoint","filtering","sorting","onFilteringChange","onSortingChange","facets","selection","onSelectionChange","metadata","isMetadataLoading","onBulkUseCase","onUseCase","onRetry","bulkOutcomes","onBulkDismiss","onBulkRetry","isBulkRunning","children","t","translateKey","entityNoun","metaEntity","slots","panel","setPanel","columns","visibleColumns","resolvedColumns","hidden","setPersonalization","key","name","nameOf","rowLabel","item","titleOf","candidates","find","column","labelMember","card","namedTitle","stickyTitle","label","type","sortable","filterable","order","readonly","required","linkLabelProperty","linkSearchProperty","linkSerialization","resetOnClone","render","virtual","undefined","Error","selectionState","selectable","rowUseCases","useCases","bulkUseCases","toolbarUseCases","hasRowMenu","length","everythingMatching","mode","total","excluded","Set","hasRowAction","columnCount","widths","title","roleOf","extra","breakpoint","pivot","essential","stickyClass","part","isFirstLoad","settledEmpty","customSkeleton","showSkeleton","skeletonRows","Array","from","Math","min","_","index","busy","declaredTitle","linkColumn","named","kind","member","value","String","cardParts","rest","filter","undeclared","subtitle","badges","meta","renderValue","descriptor","record","renderCell","raw","blank","href","id","className","intent","anchorIndex","treeKeys","collapsed","setCollapsed","rows","shown","shownItems","map","row","toggleCollapsed","current","next","has","delete","add","setSelection","toggleRow","checked","shiftKey","start","end","slice","pageIds","selectedOnPage","allOnPageSelected","someOnPageSelected","toggleAllOnPage","selectionCell","aria-label","disabled","onChange","event","currentTarget","nativeEvent","runTarget","target","verbs","run","served","rowScope","lastRow","setLastRow","focusableIn","join","invoke","useCase","object","count","plural","matching","rowMenu","surface","menuLabel","recordAction","pick","variant","size","onClick","menu","span","mayCreate","creatable","actions","includes","toolbarItems","declaresToolbarPrimary","some","emphasis","toolbarActions","locale","panelId","keys","activeFilters","values","results","announcement","JSON","stringify","primaryKey","primaryColumn","caption","entity","direction","headerCell","header","position","findIndex","aria-sort","property","aria-hidden","panelToggle","which","aria-expanded","aria-controls","div","role","aria-live","lines","toolbar","descriptors","applied","matchingTotal","onSelectAllMatching","onClear","dialog","outcomes","labelFor","onRetryFailed","onDismiss","hasStaleData","isEmpty","isFiltered","onClearFilters","document","getElementById","focus","operator","emptyAction","grid","aria-busy","containerClassName","style","minWidth","full","containerStyle","scrollPaddingInlineStart","tr","indeterminate","colSpan","shape","depth","hasChildren","data-record-id","columnIndex","expanded","idOf","onToggle","cards","ul","li","parts","aria-level","marginInlineStart","leading","scoped","querySelectorAll","CSS","escape","control","checkVisibility","getClientRects"],"mappings":"AAAA;;AAEA,SACEA,aAAa,EACbC,cAAc,EAKdC,iBAAiB,EAEjBC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,gBAAgB,EAChBC,WAAW,EACXC,aAAa,EACbC,cAAc,QAET,gBAAgB;AACvB,SACEC,QAAQ,EAERC,KAAK,EACLC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAQ;AAEf,SACEC,aAAa,EACbC,SAAS,EACTC,IAAI,EACJC,eAAe,QACV,yBAAyB;AAChC,SACEC,iBAAiB,EACjBC,YAAY,EACZC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SAASC,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;AAEvE"}
@@ -87,6 +87,13 @@ export interface EntityTableProps<TEntity extends Entity> {
87
87
  * the reader cannot bring it back. A name that is not a column throws.
88
88
  */
89
89
  hiddenColumns?: readonly string[];
90
+ /**
91
+ * Shows the record's own key (its `id`) as a column. Off by default: an id
92
+ * is how a record is addressed, never how a person reads it, and a row
93
+ * already opens by its name — or by its noun and short id when it has none.
94
+ * A reference's id is unaffected, and `id=in=` still queries.
95
+ */
96
+ showKey?: boolean;
90
97
  /** Hide the toolbar (columns, filters, sorting) — a bare listing. */
91
98
  showControls?: boolean;
92
99
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"entity-table.types.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-table/entity-table.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,QAAQ,EACR,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAChC,OAAO,SAAS,MAAM,CACtB,SAAQ,qBAAqB;IAC7B,wCAAwC;IACxC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,kEAAkE;IAClE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,SAAS,CAAC;IACtC,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5D,MAAM,WAAW,gBAAgB,CAAC,OAAO,SAAS,MAAM;IACtD;oDACgD;IAChD,iBAAiB,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC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E;IAE9E,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC5D;;;OAGG;IACH,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAElE;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,6DAA6D;IAC7D,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3E,mEAAmE;IACnE,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEjD,0EAA0E;IAC1E,YAAY,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACxC,oEAAoE;IACpE,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,sDAAsD;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB"}
1
+ {"version":3,"file":"entity-table.types.d.ts","sourceRoot":"","sources":["../../../../src/ui/organisms/entity-table/entity-table.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,MAAM,EACN,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,QAAQ,EACR,sBAAsB,EACtB,eAAe,EACf,aAAa,EACb,WAAW,EACZ,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EA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