@eifi1/ui-kit 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.md +11 -7
  2. package/dist/admin/user-roster.d.ts +16 -10
  3. package/dist/admin/user-roster.js +7 -3
  4. package/dist/admin/user-roster.js.map +1 -1
  5. package/dist/auth/verify-email.d.ts +9 -1
  6. package/dist/auth/verify-email.js +3 -1
  7. package/dist/auth/verify-email.js.map +1 -1
  8. package/dist/components/amount-input.d.ts +2 -1
  9. package/dist/components/amount-input.js +3 -2
  10. package/dist/components/amount-input.js.map +1 -1
  11. package/dist/components/autocomplete.js +1 -0
  12. package/dist/components/autocomplete.js.map +1 -1
  13. package/dist/components/combobox-core.js +1 -0
  14. package/dist/components/combobox-core.js.map +1 -1
  15. package/dist/components/combobox-suggestions.js +1 -0
  16. package/dist/components/combobox-suggestions.js.map +1 -1
  17. package/dist/components/currency-select.d.ts +28 -2
  18. package/dist/components/currency-select.js +56 -10
  19. package/dist/components/currency-select.js.map +1 -1
  20. package/dist/components/data-table-mobile.d.ts +11 -2
  21. package/dist/components/data-table-mobile.js +62 -8
  22. package/dist/components/data-table-mobile.js.map +1 -1
  23. package/dist/components/data-table-row.d.ts +1 -1
  24. package/dist/components/data-table-row.js.map +1 -1
  25. package/dist/components/data-table.js +3 -1
  26. package/dist/components/data-table.js.map +1 -1
  27. package/dist/components/dropdown.js +1 -0
  28. package/dist/components/dropdown.js.map +1 -1
  29. package/dist/components/full-bleed-dialog.js +1 -0
  30. package/dist/components/full-bleed-dialog.js.map +1 -1
  31. package/dist/components/modal.js +1 -0
  32. package/dist/components/modal.js.map +1 -1
  33. package/dist/components/number-input.d.ts +2 -1
  34. package/dist/components/number-input.js +6 -2
  35. package/dist/components/number-input.js.map +1 -1
  36. package/dist/components/numpad-sheet.js +2 -0
  37. package/dist/components/numpad-sheet.js.map +1 -1
  38. package/dist/components/picker-sheet.js +2 -0
  39. package/dist/components/picker-sheet.js.map +1 -1
  40. package/dist/components/popover.js +1 -0
  41. package/dist/components/popover.js.map +1 -1
  42. package/dist/eslint/index.js +1 -1
  43. package/dist/i18n/defaults.js +2 -0
  44. package/dist/i18n/defaults.js.map +1 -1
  45. package/dist/i18n/german.js +14 -1
  46. package/dist/i18n/german.js.map +1 -1
  47. package/dist/i18n/kit-labels.d.ts +3 -0
  48. package/dist/i18n/kit-labels.js.map +1 -1
  49. package/dist/i18n/locales/en.js +16 -1
  50. package/dist/i18n/locales/en.js.map +3 -3
  51. package/dist/i18n/locales/es.js +14 -1
  52. package/dist/i18n/locales/es.js.map +1 -1
  53. package/dist/i18n/locales/fr.js +14 -1
  54. package/dist/i18n/locales/fr.js.map +1 -1
  55. package/dist/i18n/locales/hu.js +14 -1
  56. package/dist/i18n/locales/hu.js.map +1 -1
  57. package/dist/i18n/locales/it.js +14 -1
  58. package/dist/i18n/locales/it.js.map +1 -1
  59. package/dist/i18n/locales/zh.js +14 -1
  60. package/dist/i18n/locales/zh.js.map +1 -1
  61. package/dist/i18n/review.js +1 -0
  62. package/dist/i18n/review.js.map +1 -1
  63. package/dist/lib/data-attributes.d.ts +11 -0
  64. package/dist/lib/data-attributes.js +10 -0
  65. package/dist/lib/data-attributes.js.map +1 -0
  66. package/dist/lib/format.d.ts +1 -0
  67. package/dist/lib/format.js +2 -0
  68. package/dist/lib/format.js.map +1 -1
  69. package/dist/lib/minus.d.ts +10 -0
  70. package/dist/lib/minus.js.map +1 -1
  71. package/dist/testing/react.d.ts +25 -0
  72. package/dist/testing/react.js +19 -0
  73. package/dist/testing/react.js.map +1 -0
  74. package/dist/tour/tour-dock.d.ts +42 -0
  75. package/dist/tour/tour-dock.js +80 -0
  76. package/dist/tour/tour-dock.js.map +1 -0
  77. package/dist/tour/tour-gates.d.ts +71 -0
  78. package/dist/tour/tour-gates.js +114 -0
  79. package/dist/tour/tour-gates.js.map +1 -0
  80. package/dist/tour/tour-guide-button.d.ts +27 -0
  81. package/dist/tour/tour-guide-button.js +45 -0
  82. package/dist/tour/tour-guide-button.js.map +1 -0
  83. package/dist/tour/tour-guide-labels.d.ts +8 -0
  84. package/dist/tour/tour-guide-labels.js +9 -0
  85. package/dist/tour/tour-guide-labels.js.map +1 -0
  86. package/dist/tour/tour-labels.js +9 -1
  87. package/dist/tour/tour-labels.js.map +1 -1
  88. package/dist/tour/tour.d.ts +133 -9
  89. package/dist/tour/tour.js +594 -70
  90. package/dist/tour/tour.js.map +1 -1
  91. package/dist/tour/use-tour-url-sync.d.ts +5 -2
  92. package/dist/tour/use-tour-url-sync.js +7 -1
  93. package/dist/tour/use-tour-url-sync.js.map +1 -1
  94. package/dist/tour.d.ts +2 -0
  95. package/dist/tour.js +3 -0
  96. package/dist/tour.js.map +1 -1
  97. package/dist/wizard/stepper-nav.js +15 -2
  98. package/dist/wizard/stepper-nav.js.map +1 -1
  99. package/dist/wizard/types.d.ts +11 -0
  100. package/dist/wizard/types.js.map +1 -1
  101. package/dist/wizard/use-wizard.js +11 -5
  102. package/dist/wizard/use-wizard.js.map +1 -1
  103. package/package.json +9 -1
  104. package/src/admin/user-roster.tsx +22 -12
  105. package/src/auth/verify-email.tsx +10 -0
  106. package/src/components/amount-input.tsx +5 -4
  107. package/src/components/autocomplete.tsx +2 -0
  108. package/src/components/combobox-core.tsx +2 -0
  109. package/src/components/combobox-suggestions.tsx +2 -0
  110. package/src/components/currency-select.tsx +95 -6
  111. package/src/components/data-table-mobile.tsx +99 -8
  112. package/src/components/data-table-row.tsx +1 -0
  113. package/src/components/data-table.tsx +9 -1
  114. package/src/components/dropdown.tsx +2 -0
  115. package/src/components/full-bleed-dialog.tsx +3 -0
  116. package/src/components/modal.tsx +3 -0
  117. package/src/components/number-input.tsx +8 -3
  118. package/src/components/numpad-sheet.tsx +4 -0
  119. package/src/components/picker-sheet.tsx +4 -0
  120. package/src/components/popover.tsx +2 -0
  121. package/src/i18n/defaults.ts +2 -0
  122. package/src/i18n/german.ts +13 -0
  123. package/src/i18n/kit-labels.tsx +3 -0
  124. package/src/i18n/locales/es.ts +13 -0
  125. package/src/i18n/locales/fr.ts +13 -0
  126. package/src/i18n/locales/hu.ts +13 -0
  127. package/src/i18n/locales/it.ts +13 -0
  128. package/src/i18n/locales/zh.ts +13 -0
  129. package/src/i18n/review.ts +1 -0
  130. package/src/lib/data-attributes.ts +14 -0
  131. package/src/lib/format.ts +2 -0
  132. package/src/lib/minus.ts +10 -0
  133. package/src/testing/react.ts +59 -0
  134. package/src/tour/tour-dock.ts +132 -0
  135. package/src/tour/tour-gates.ts +195 -0
  136. package/src/tour/tour-guide-button.tsx +64 -0
  137. package/src/tour/tour-guide-labels.ts +15 -0
  138. package/src/tour/tour-labels.ts +8 -0
  139. package/src/tour/tour.tsx +949 -86
  140. package/src/tour/use-tour-url-sync.ts +14 -4
  141. package/src/tour.ts +3 -0
  142. package/src/wizard/stepper-nav.tsx +23 -3
  143. package/src/wizard/types.ts +12 -0
  144. package/src/wizard/use-wizard.ts +16 -9
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/data-table-row.tsx"],"sourcesContent":["import { Fragment, memo } from \"react\";\nimport type { MouseEvent as ReactMouseEvent, ReactNode, RefObject } from \"react\";\nimport { RowLink, cleanAttrs, fromOutside, fromOwnControl, logicalAlign, splitCellProps } from \"./data-table-shared\";\nimport { GROW_CELL_CLASS, GROW_PEER_CELL_CLASS } from \"./data-table-fit\";\nimport { MobileRow, type MobileRowProps } from \"./data-table-mobile\";\nimport type { DataTableColumn, MobileSwipeActions } from \"./data-table\";\nimport { cn } from \"../lib/cn\";\n\n// DataTable's rows as memoised components (0.48.2, keksdose K-052-2, dev #632 — Marcel:\n// \"The table is extremely slow. Is it virtualised or is everytime the whole table\n// rendered?\"). The owner's selection, expansion and the roving focus all live ABOVE the\n// rows, so every tick re-rendered the whole table: on keksdose's register one checkbox\n// cost 430–1200 ms of INP at 271 rows. A row now bails out unless one of its own inputs\n// changed.\n//\n// What a row compares, and so the contract a call site keeps:\n// * the row object, its index and its key;\n// * what the table derived for it from the caller's functions, as PRIMITIVES — selected,\n// selectable, expanded, its tab stop, its `rowClassName` string, its `rowHref`, and\n// its `rowAttributes` compared key by key. The functions themselves may be inline;\n// * the column definitions BY IDENTITY: a cell is the caller's render function, and\n// what it reads is the caller's to say. A page that memoises its columns (keksdose's\n// `useTransactionColumns`) gets the bail-out; one that writes them inline gets a new\n// array every render and the full re-render it always had — never a stale cell;\n// * an OPEN row's detail (`expandedRow`) is called on every render, so it re-renders\n// with the table as before, and an editor inside it keeps its live inputs.\n// The handlers do not take part: they read the table's latest props through `ctx`, a\n// ref the table refreshes each commit, so a row that bailed out still acts on the\n// current selection and the current `onRowClick`.\n\n/** What a row's handlers read at event time — DataTable's latest props and helpers. */\nexport interface DataTableRowCtx<T> {\n onRowClick: ((row: T) => void) | undefined;\n onToggle: ((row: T, checked: boolean) => void) | undefined;\n isSelected: (row: T) => boolean;\n canSelect: (row: T) => boolean;\n selectRange: (toIndex: number) => boolean;\n /** Anchor the next Shift+click range on this row's key. */\n setAnchor: (key: string | number) => void;\n /** Remember the checkbox click that drew a range… */\n markRangeClick: (e: Event) => void;\n /** …and drop that click's own change event (true once for it). */\n takeRangeClick: (e: Event) => boolean;\n setFocusRowKey: (key: string | number) => void;\n /** The phone card's long press: enter selection mode with this row selected. */\n onLongPress: (row: T) => void;\n /** Under `virtualize` (0.48.2): Arrow/Home/End over every row, rendered or not. True\n * when the key was one of them. Without it the roving walks the rendered rows. */\n moveFocus?: (fromIndex: number, key: string) => boolean;\n}\n\n/** `rowAttributes`' result compared key by key: a call site returns a fresh object (or\n * `undefined`) per call, and its values are strings. */\nfunction sameAttrs(\n a: Record<string, string | undefined> | undefined,\n b: Record<string, string | undefined> | undefined,\n): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n const ak = Object.keys(a);\n if (ak.length !== Object.keys(b).length) return false;\n for (const k of ak) if (a[k] !== b[k]) return false;\n return true;\n}\n\nfunction sameProps<P extends { attrs?: Record<string, string | undefined> }>(prev: P, next: P): boolean {\n for (const k of Object.keys(next) as (keyof P)[]) {\n if (k === \"attrs\") continue;\n if (!Object.is(prev[k], next[k])) return false;\n }\n return sameAttrs(prev.attrs, next.attrs);\n}\n\n/** Arrow/Home/End between the focusable rows of the table's bodies — the roving half of\n * the keyboard-activatable rows (see the row's `onKeyDown`). */\nfunction moveRowFocus(from: HTMLElement, key: string): boolean {\n if (!(key in ROW_NAV_KEYS)) return false;\n // Every body of the table: a grouped table (`groupBy`, 0.48) has one per group.\n const table = from.closest(\"table\");\n if (!table) return false;\n const rows = Array.from(table.tBodies).flatMap((body) =>\n Array.from(body.children).filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.hasAttribute(\"data-row-nav\"),\n ),\n );\n const i = rows.indexOf(from);\n const target =\n key === \"ArrowDown\"\n ? rows[i + 1]\n : key === \"ArrowUp\"\n ? rows[i - 1]\n : key === \"Home\"\n ? rows[0]\n : key === \"End\"\n ? rows[rows.length - 1]\n : undefined;\n // At either end the key is still consumed, or ArrowDown on the last row would\n // scroll the page out from under a focused row.\n target?.focus();\n return true;\n}\nconst ROW_NAV_KEYS = { ArrowDown: 1, ArrowUp: 1, Home: 1, End: 1 } as const;\n\n// ---------- Desktop row ----------\n\nexport interface DataTableRowProps<T> {\n row: T;\n rowIndex: number;\n rowKey: string | number;\n ctx: RefObject<DataTableRowCtx<T>>;\n columns: DataTableColumn<T>[];\n widths: Record<string, number>;\n growDrawn: boolean;\n linkColumn: DataTableColumn<T> | undefined;\n href: string | undefined;\n /** The selection column is drawn (DataTable's `selection`). */\n selectionColumn: boolean;\n selectable: boolean;\n selected: boolean;\n expanded: boolean;\n /** The open row's detail; `null` on a closed row. */\n expansion: ReactNode;\n /** The row carries the visually hidden disclosure button (focusable rows that expand). */\n disclosure: boolean;\n detailId: string;\n rowsFocusable: boolean;\n rowInteractive: boolean;\n tabbable: boolean;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n compact: boolean;\n totalColSpan: number;\n rowDetailsLabel: string;\n selectRowLabel: string;\n /** Under `virtualize` (0.48.2): the row's `aria-rowindex` (its open detail row is the\n * next), and the row is marked with its index for the window's measuring. */\n ariaRowIndex?: number;\n}\n\nfunction DataTableRowImpl<T>({\n row,\n rowIndex,\n rowKey: key,\n ctx,\n columns,\n widths,\n growDrawn,\n linkColumn,\n href,\n selectionColumn,\n selectable,\n selected,\n expanded,\n expansion,\n disclosure: hasDisclosure,\n detailId,\n rowsFocusable,\n rowInteractive,\n tabbable,\n className,\n attrs,\n compact,\n totalColSpan,\n rowDetailsLabel,\n selectRowLabel,\n ariaRowIndex,\n}: DataTableRowProps<T>) {\n const windowed = ariaRowIndex !== undefined;\n // Whether the row is open, said where ARIA allows it (round 0.34, the\n // showcase's axe check): `aria-expanded` belongs to a treegrid's row, not a\n // table's, and the <tr> wore it. A disclosure button in the first cell carries\n // it now, with `aria-controls` on the detail row while that is there.\n // Visually hidden and not a tab stop: the row stays the one roving stop, with\n // Enter/Space and the whole-row click — this is the screen reader cursor's\n // way in, and where it hears the state. Named by `aria-label`, so the cell's\n // text stays the cell's own.\n const disclosure = hasDisclosure ? (\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"sr-only-fixed\"\n aria-label={rowDetailsLabel}\n aria-expanded={expanded}\n aria-controls={expansion ? detailId : undefined}\n // The row's own handler leaves a click on a control inside it alone.\n onClick={() => ctx.current.onRowClick!(row)}\n />\n ) : null;\n return (\n <Fragment>\n <tr\n {...cleanAttrs(attrs)}\n aria-rowindex={ariaRowIndex}\n data-row-index={windowed ? rowIndex : undefined}\n data-row-nav={rowsFocusable ? \"\" : undefined}\n tabIndex={rowsFocusable ? (tabbable ? 0 : -1) : undefined}\n onFocus={\n rowsFocusable\n ? (e) => {\n if (e.target === e.currentTarget) ctx.current.setFocusRowKey(key);\n }\n : undefined\n }\n onKeyDown={\n rowsFocusable\n ? (e) => {\n // Only the row's own key presses: Enter on a nested button\n // or link is that control's, and Space in a nested input\n // is a space.\n if (e.target !== e.currentTarget) return;\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n // Space would otherwise scroll the table.\n e.preventDefault();\n ctx.current.onRowClick!(row);\n return;\n }\n if (e.shiftKey) return;\n const move = ctx.current.moveFocus;\n if (move ? move(rowIndex, e.key) : moveRowFocus(e.currentTarget, e.key)) e.preventDefault();\n }\n : undefined\n }\n className={cn(\n \"border-t border-subtle\",\n rowInteractive && \"cursor-pointer hover:bg-hover\",\n // The kit's focus frame width (§5, `--focus-ring-width`), drawn as an\n // OUTLINE rather than FOCUS_RING's box-shadow: a shadow on a `<tr>`\n // is not painted by every engine, an outline is.\n rowsFocusable &&\n \"focus-visible:bg-hover focus-visible:outline-focus focus-visible:-outline-offset-2 focus-visible:outline-brand\",\n className,\n )}\n onClick={\n rowInteractive\n ? (e: ReactMouseEvent<HTMLTableRowElement>) => {\n const c = ctx.current;\n // A click on a control inside the row (a button, a link,\n // an input the cell renders) is that control's — it must\n // not also open the row. Cells no longer have to\n // `stopPropagation` to get that.\n if (fromOwnControl(e.target, e.currentTarget)) return;\n if (fromOutside(e.target, e.currentTarget)) return;\n // Modifier-clicks anywhere in the row drive\n // selection instead of expanding it (feedback #289):\n // Ctrl/Cmd toggles a single row, Shift selects the\n // range from the last-toggled row (inclusive of this\n // one) — the same as the checkbox, but for the whole\n // row, which is what the checkbox-only version was\n // missing.\n if (c.onToggle && c.canSelect(row)) {\n if (e.shiftKey) {\n // Drop the text selection a shift-click would\n // otherwise smear across the rows.\n window.getSelection?.()?.removeAllRanges();\n if (c.selectRange(rowIndex)) return;\n // No anchor yet: treat it as the first pick.\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n if (e.metaKey || e.ctrlKey) {\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n }\n c.onRowClick?.(row);\n }\n : undefined\n }\n >\n {selectionColumn && (\n <td\n className={cn(\"align-top\", compact ? \"w-8 px-2 py-1\" : \"w-10 px-3 py-2\")}\n // Don't let selecting a row also trigger the row click\n // (which expands/edits it).\n onClick={(e) => e.stopPropagation()}\n >\n {selectable && (\n <input\n type=\"checkbox\"\n className={cn(\"accent-indigo-600\", compact ? \"size-3.5\" : \"size-4\")}\n checked={selected}\n // Shift+click selects the range from the last toggled\n // row. `preventDefault` puts the box back, but it does NOT\n // stop React's `onChange`: React derives a checkbox's\n // change from the `click` itself, after the browser has\n // already flipped `checked` and before the cancellation\n // reverts it — so the same click also reported itself as\n // a single toggle, and the owner got `onToggleMany` and\n // then `onToggle` for the clicked row. The click is\n // remembered by identity and its change is dropped; a\n // boolean flag would outlive a click whose change never\n // came and swallow the user's next real one.\n onClick={(e) => {\n if (e.shiftKey && ctx.current.selectRange(rowIndex)) {\n e.preventDefault();\n ctx.current.markRangeClick(e.nativeEvent);\n }\n }}\n onChange={(e) => {\n const c = ctx.current;\n if (c.takeRangeClick(e.nativeEvent)) return;\n c.setAnchor(key);\n c.onToggle?.(row, e.target.checked);\n }}\n aria-label={selectRowLabel}\n />\n )}\n </td>\n )}\n {columns.map((col, colIndex) => {\n const width = widths[col.key];\n // The caller's first, the table's over it — see `cellProps`.\n const own = splitCellProps(col.cellProps?.(row));\n const pinned = width ? { width, minWidth: width, maxWidth: width } : undefined;\n return (\n <td\n {...own.attrs}\n key={col.key}\n data-col={col.key}\n style={own.style || pinned ? { ...own.style, ...pinned } : undefined}\n className={cn(\n \"align-top\",\n compact ? \"px-2 py-1\" : \"px-3 py-2\",\n width && \"overflow-hidden text-ellipsis\",\n col.grow ? GROW_CELL_CLASS : growDrawn && GROW_PEER_CELL_CLASS,\n logicalAlign(own.className),\n logicalAlign(col.className),\n )}\n >\n {colIndex === 0 && disclosure}\n {col === linkColumn && href ? (\n // No `onActivate`: the click is left to bubble to the\n // <tr> handler above, which already owns expand-vs-select.\n // Calling it here as well would toggle the row twice.\n <RowLink href={href} className=\"block\" data-row-link=\"\">\n {col.cell(row)}\n </RowLink>\n ) : (\n col.cell(row)\n )}\n </td>\n );\n })}\n </tr>\n {expansion && (\n <tr\n id={hasDisclosure ? detailId : undefined}\n aria-rowindex={windowed ? ariaRowIndex + 1 : undefined}\n data-row-detail={windowed ? rowIndex : undefined}\n className=\"bg-surface-2 border-t border-subtle\"\n >\n {/* The detail panel spans every column. In an `auto` table\n layout (the default here — columns only get fixed style\n widths once the user resizes/auto-sizes them) the cell's\n content preferred-width is redistributed across the\n spanned columns, so a long expansion visibly re-sizes the\n columns above it — and one-line content does not, since\n its preferred width is small (feedback #104). Wrapping the\n content in `w-0 min-w-full` pins the cell's preferred\n width to ~0 (the explicit width:0 child), so it can never\n perturb the columns; the div then fills to the full row\n width only at paint time, and long text wraps within it.\n Inside it the content is pinned to what the scroller SHOWS\n (0.47, keksdose S4): on a table wider than its scroller a\n table-wide panel put an inline editor's Save/Cancel off-screen.\n `sticky start-0` holds it at the scroller's start edge (the\n right one in RTL) as the row scrolls sideways, and\n `--dt-visible-w` (the scroller's clientWidth, measured above)\n sizes it; before the first measure, and in a table no wider\n than its scroller, it is the full width as before. */}\n <td colSpan={totalColSpan} className=\"p-0\">\n <div className=\"w-0 min-w-full\">\n <div\n className={cn(\n \"sticky start-0 w-[var(--dt-visible-w,100%)] max-w-full\",\n compact ? \"px-2 py-2\" : \"px-3 py-3\",\n )}\n >\n {expansion}\n </div>\n </div>\n </td>\n </tr>\n )}\n </Fragment>\n );\n}\n\n/** One desktop row (its `<tr>` and, while open, its detail row), memoised — see the\n * file's note for what it compares. */\nexport const DataTableRow = memo(DataTableRowImpl, sameProps) as <T>(\n props: DataTableRowProps<T> & { key?: string | number },\n) => ReactNode;\n\n// ---------- Phone card ----------\n\nexport interface DataTableMobileRowProps<T>\n extends Pick<\n MobileRowProps<T>,\n | \"row\"\n | \"opensRow\"\n | \"mobileDir\"\n | \"mobileCardLinkable\"\n | \"mobileCard\"\n | \"mobilePrimaryCol\"\n | \"mobileStatusColumns\"\n | \"mobileSecondaryColumns\"\n | \"mobileActionColumns\"\n | \"mobileExpandAsDialog\"\n | \"compact\"\n | \"large\"\n > {\n ctx: RefObject<DataTableRowCtx<T>>;\n rowKey: string | number;\n expanded: boolean;\n /** The opened row's content (`openedRowContent`); `null` on a closed card. */\n expansion: ReactNode;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n /** The table has `onRowClick`. */\n interactive: boolean;\n href: string | undefined;\n /** `mobileSwipeActions`, or the swipes derived from `rowActions` — by identity. */\n swipeActionsFor: ((row: T) => MobileSwipeActions | null) | undefined;\n /** The table has `selection`. */\n selectionOn: boolean;\n selectActive: boolean;\n selectable: boolean;\n selected: boolean;\n}\n\nconst yes = () => true;\n\nfunction DataTableMobileRowImpl<T>({\n ctx,\n rowKey: key,\n expanded,\n expansion,\n className,\n attrs,\n interactive,\n href,\n selectionOn,\n selectActive,\n selectable,\n selected,\n ...rest\n}: DataTableMobileRowProps<T>) {\n const { row } = rest;\n // `MobileRow` keeps its own shape (functions of the row); these hand it the values the\n // table derived, and the handlers read the latest props through `ctx`.\n return (\n <MobileRow\n {...rest}\n isExpanded={expanded ? yes : undefined}\n openedRowContent={() => expansion}\n rowClassName={() => className}\n rowAttributes={() => attrs}\n onRowClick={interactive ? (r) => ctx.current.onRowClick!(r) : undefined}\n rowHref={href !== undefined ? () => href : undefined}\n select={\n selectionOn\n ? {\n active: selectActive,\n selectable,\n selected,\n onToggle: (checked) => {\n ctx.current.setAnchor(key);\n ctx.current.onToggle?.(row, checked);\n },\n onLongPress: () => ctx.current.onLongPress(row),\n }\n : null\n }\n />\n );\n}\n\n/** One phone card, memoised like {@link DataTableRow}. */\nexport const DataTableMobileRow = memo(DataTableMobileRowImpl, sameProps) as <T>(\n props: DataTableMobileRowProps<T> & { key?: string | number },\n) => ReactNode;\n"],"mappings":";AAiLI,cAaE,YAbF;AA6IQ;AA9TZ,SAAS,UAAU,YAAY;AAE/B,SAAS,SAAS,YAAY,aAAa,gBAAgB,cAAc,sBAAsB;AAC/F,SAAS,iB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,SAAI,WAAU,kBACb;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,UAAU,cAAc;AAAA,YAC1B;AAAA,YAEC;AAAA;AAAA,QACH,GACF,GACF;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;AAIO,MAAM,eAAe,KAAK,kBAAkB,SAAS;AAyC5D,MAAM,MAAM,MAAM;AAElB,SAAS,uBAA0B;AAAA,EACjC;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAA+B;AAC7B,QAAM,EAAE,IAAI,IAAI;AAGhB,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,YAAY,WAAW,MAAM;AAAA,MAC7B,kBAAkB,MAAM;AAAA,MACxB,cAAc,MAAM;AAAA,MACpB,eAAe,MAAM;AAAA,MACrB,YAAY,cAAc,CAAC,MAAM,IAAI,QAAQ,WAAY,CAAC,IAAI;AAAA,MAC9D,SAAS,SAAS,SAAY,MAAM,OAAO;AAAA,MAC3C,QACE,cACI;AAAA,QACE,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA,UAAU,CAAC,YAAY;AACrB,cAAI,QAAQ,UAAU,GAAG;AACzB,cAAI,QAAQ,WAAW,KAAK,OAAO;AAAA,QACrC;AAAA,QACA,aAAa,MAAM,IAAI,QAAQ,YAAY,GAAG;AAAA,MAChD,IACA;AAAA;AAAA,EAER;AAEJ;AAGO,MAAM,qBAAqB,KAAK,wBAAwB,SAAS;","names":[]}
1
+ {"version":3,"sources":["../../src/components/data-table-row.tsx"],"sourcesContent":["import { Fragment, memo } from \"react\";\nimport type { MouseEvent as ReactMouseEvent, ReactNode, RefObject } from \"react\";\nimport { RowLink, cleanAttrs, fromOutside, fromOwnControl, logicalAlign, splitCellProps } from \"./data-table-shared\";\nimport { GROW_CELL_CLASS, GROW_PEER_CELL_CLASS } from \"./data-table-fit\";\nimport { MobileRow, type MobileRowProps } from \"./data-table-mobile\";\nimport type { DataTableColumn, MobileSwipeActions } from \"./data-table\";\nimport { cn } from \"../lib/cn\";\n\n// DataTable's rows as memoised components (0.48.2, keksdose K-052-2, dev #632 — Marcel:\n// \"The table is extremely slow. Is it virtualised or is everytime the whole table\n// rendered?\"). The owner's selection, expansion and the roving focus all live ABOVE the\n// rows, so every tick re-rendered the whole table: on keksdose's register one checkbox\n// cost 430–1200 ms of INP at 271 rows. A row now bails out unless one of its own inputs\n// changed.\n//\n// What a row compares, and so the contract a call site keeps:\n// * the row object, its index and its key;\n// * what the table derived for it from the caller's functions, as PRIMITIVES — selected,\n// selectable, expanded, its tab stop, its `rowClassName` string, its `rowHref`, and\n// its `rowAttributes` compared key by key. The functions themselves may be inline;\n// * the column definitions BY IDENTITY: a cell is the caller's render function, and\n// what it reads is the caller's to say. A page that memoises its columns (keksdose's\n// `useTransactionColumns`) gets the bail-out; one that writes them inline gets a new\n// array every render and the full re-render it always had — never a stale cell;\n// * an OPEN row's detail (`expandedRow`) is called on every render, so it re-renders\n// with the table as before, and an editor inside it keeps its live inputs.\n// The handlers do not take part: they read the table's latest props through `ctx`, a\n// ref the table refreshes each commit, so a row that bailed out still acts on the\n// current selection and the current `onRowClick`.\n\n/** What a row's handlers read at event time — DataTable's latest props and helpers. */\nexport interface DataTableRowCtx<T> {\n onRowClick: ((row: T) => void) | undefined;\n onToggle: ((row: T, checked: boolean) => void) | undefined;\n isSelected: (row: T) => boolean;\n canSelect: (row: T) => boolean;\n selectRange: (toIndex: number) => boolean;\n /** Anchor the next Shift+click range on this row's key. */\n setAnchor: (key: string | number) => void;\n /** Remember the checkbox click that drew a range… */\n markRangeClick: (e: Event) => void;\n /** …and drop that click's own change event (true once for it). */\n takeRangeClick: (e: Event) => boolean;\n setFocusRowKey: (key: string | number) => void;\n /** The phone card's long press: enter selection mode with this row selected. */\n onLongPress: (row: T) => void;\n /** Under `virtualize` (0.48.2): Arrow/Home/End over every row, rendered or not. True\n * when the key was one of them. Without it the roving walks the rendered rows. */\n moveFocus?: (fromIndex: number, key: string) => boolean;\n}\n\n/** `rowAttributes`' result compared key by key: a call site returns a fresh object (or\n * `undefined`) per call, and its values are strings. */\nfunction sameAttrs(\n a: Record<string, string | undefined> | undefined,\n b: Record<string, string | undefined> | undefined,\n): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n const ak = Object.keys(a);\n if (ak.length !== Object.keys(b).length) return false;\n for (const k of ak) if (a[k] !== b[k]) return false;\n return true;\n}\n\nfunction sameProps<P extends { attrs?: Record<string, string | undefined> }>(prev: P, next: P): boolean {\n for (const k of Object.keys(next) as (keyof P)[]) {\n if (k === \"attrs\") continue;\n if (!Object.is(prev[k], next[k])) return false;\n }\n return sameAttrs(prev.attrs, next.attrs);\n}\n\n/** Arrow/Home/End between the focusable rows of the table's bodies — the roving half of\n * the keyboard-activatable rows (see the row's `onKeyDown`). */\nfunction moveRowFocus(from: HTMLElement, key: string): boolean {\n if (!(key in ROW_NAV_KEYS)) return false;\n // Every body of the table: a grouped table (`groupBy`, 0.48) has one per group.\n const table = from.closest(\"table\");\n if (!table) return false;\n const rows = Array.from(table.tBodies).flatMap((body) =>\n Array.from(body.children).filter(\n (el): el is HTMLElement => el instanceof HTMLElement && el.hasAttribute(\"data-row-nav\"),\n ),\n );\n const i = rows.indexOf(from);\n const target =\n key === \"ArrowDown\"\n ? rows[i + 1]\n : key === \"ArrowUp\"\n ? rows[i - 1]\n : key === \"Home\"\n ? rows[0]\n : key === \"End\"\n ? rows[rows.length - 1]\n : undefined;\n // At either end the key is still consumed, or ArrowDown on the last row would\n // scroll the page out from under a focused row.\n target?.focus();\n return true;\n}\nconst ROW_NAV_KEYS = { ArrowDown: 1, ArrowUp: 1, Home: 1, End: 1 } as const;\n\n// ---------- Desktop row ----------\n\nexport interface DataTableRowProps<T> {\n row: T;\n rowIndex: number;\n rowKey: string | number;\n ctx: RefObject<DataTableRowCtx<T>>;\n columns: DataTableColumn<T>[];\n widths: Record<string, number>;\n growDrawn: boolean;\n linkColumn: DataTableColumn<T> | undefined;\n href: string | undefined;\n /** The selection column is drawn (DataTable's `selection`). */\n selectionColumn: boolean;\n selectable: boolean;\n selected: boolean;\n expanded: boolean;\n /** The open row's detail; `null` on a closed row. */\n expansion: ReactNode;\n /** The row carries the visually hidden disclosure button (focusable rows that expand). */\n disclosure: boolean;\n detailId: string;\n rowsFocusable: boolean;\n rowInteractive: boolean;\n tabbable: boolean;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n compact: boolean;\n totalColSpan: number;\n rowDetailsLabel: string;\n selectRowLabel: string;\n /** Under `virtualize` (0.48.2): the row's `aria-rowindex` (its open detail row is the\n * next), and the row is marked with its index for the window's measuring. */\n ariaRowIndex?: number;\n}\n\nfunction DataTableRowImpl<T>({\n row,\n rowIndex,\n rowKey: key,\n ctx,\n columns,\n widths,\n growDrawn,\n linkColumn,\n href,\n selectionColumn,\n selectable,\n selected,\n expanded,\n expansion,\n disclosure: hasDisclosure,\n detailId,\n rowsFocusable,\n rowInteractive,\n tabbable,\n className,\n attrs,\n compact,\n totalColSpan,\n rowDetailsLabel,\n selectRowLabel,\n ariaRowIndex,\n}: DataTableRowProps<T>) {\n const windowed = ariaRowIndex !== undefined;\n // Whether the row is open, said where ARIA allows it (round 0.34, the\n // showcase's axe check): `aria-expanded` belongs to a treegrid's row, not a\n // table's, and the <tr> wore it. A disclosure button in the first cell carries\n // it now, with `aria-controls` on the detail row while that is there.\n // Visually hidden and not a tab stop: the row stays the one roving stop, with\n // Enter/Space and the whole-row click — this is the screen reader cursor's\n // way in, and where it hears the state. Named by `aria-label`, so the cell's\n // text stays the cell's own.\n const disclosure = hasDisclosure ? (\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"sr-only-fixed\"\n aria-label={rowDetailsLabel}\n aria-expanded={expanded}\n aria-controls={expansion ? detailId : undefined}\n // The row's own handler leaves a click on a control inside it alone.\n onClick={() => ctx.current.onRowClick!(row)}\n />\n ) : null;\n return (\n <Fragment>\n <tr\n {...cleanAttrs(attrs)}\n aria-rowindex={ariaRowIndex}\n data-row-index={windowed ? rowIndex : undefined}\n data-row-nav={rowsFocusable ? \"\" : undefined}\n tabIndex={rowsFocusable ? (tabbable ? 0 : -1) : undefined}\n onFocus={\n rowsFocusable\n ? (e) => {\n if (e.target === e.currentTarget) ctx.current.setFocusRowKey(key);\n }\n : undefined\n }\n onKeyDown={\n rowsFocusable\n ? (e) => {\n // Only the row's own key presses: Enter on a nested button\n // or link is that control's, and Space in a nested input\n // is a space.\n if (e.target !== e.currentTarget) return;\n if (e.altKey || e.ctrlKey || e.metaKey) return;\n if (e.key === \"Enter\" || e.key === \" \") {\n // Space would otherwise scroll the table.\n e.preventDefault();\n ctx.current.onRowClick!(row);\n return;\n }\n if (e.shiftKey) return;\n const move = ctx.current.moveFocus;\n if (move ? move(rowIndex, e.key) : moveRowFocus(e.currentTarget, e.key)) e.preventDefault();\n }\n : undefined\n }\n className={cn(\n \"border-t border-subtle\",\n rowInteractive && \"cursor-pointer hover:bg-hover\",\n // The kit's focus frame width (§5, `--focus-ring-width`), drawn as an\n // OUTLINE rather than FOCUS_RING's box-shadow: a shadow on a `<tr>`\n // is not painted by every engine, an outline is.\n rowsFocusable &&\n \"focus-visible:bg-hover focus-visible:outline-focus focus-visible:-outline-offset-2 focus-visible:outline-brand\",\n className,\n )}\n onClick={\n rowInteractive\n ? (e: ReactMouseEvent<HTMLTableRowElement>) => {\n const c = ctx.current;\n // A click on a control inside the row (a button, a link,\n // an input the cell renders) is that control's — it must\n // not also open the row. Cells no longer have to\n // `stopPropagation` to get that.\n if (fromOwnControl(e.target, e.currentTarget)) return;\n if (fromOutside(e.target, e.currentTarget)) return;\n // Modifier-clicks anywhere in the row drive\n // selection instead of expanding it (feedback #289):\n // Ctrl/Cmd toggles a single row, Shift selects the\n // range from the last-toggled row (inclusive of this\n // one) — the same as the checkbox, but for the whole\n // row, which is what the checkbox-only version was\n // missing.\n if (c.onToggle && c.canSelect(row)) {\n if (e.shiftKey) {\n // Drop the text selection a shift-click would\n // otherwise smear across the rows.\n window.getSelection?.()?.removeAllRanges();\n if (c.selectRange(rowIndex)) return;\n // No anchor yet: treat it as the first pick.\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n if (e.metaKey || e.ctrlKey) {\n c.setAnchor(key);\n c.onToggle(row, !c.isSelected(row));\n return;\n }\n }\n c.onRowClick?.(row);\n }\n : undefined\n }\n >\n {selectionColumn && (\n <td\n className={cn(\"align-top\", compact ? \"w-8 px-2 py-1\" : \"w-10 px-3 py-2\")}\n // Don't let selecting a row also trigger the row click\n // (which expands/edits it).\n onClick={(e) => e.stopPropagation()}\n >\n {selectable && (\n <input\n type=\"checkbox\"\n className={cn(\"accent-indigo-600\", compact ? \"size-3.5\" : \"size-4\")}\n checked={selected}\n // Shift+click selects the range from the last toggled\n // row. `preventDefault` puts the box back, but it does NOT\n // stop React's `onChange`: React derives a checkbox's\n // change from the `click` itself, after the browser has\n // already flipped `checked` and before the cancellation\n // reverts it — so the same click also reported itself as\n // a single toggle, and the owner got `onToggleMany` and\n // then `onToggle` for the clicked row. The click is\n // remembered by identity and its change is dropped; a\n // boolean flag would outlive a click whose change never\n // came and swallow the user's next real one.\n onClick={(e) => {\n if (e.shiftKey && ctx.current.selectRange(rowIndex)) {\n e.preventDefault();\n ctx.current.markRangeClick(e.nativeEvent);\n }\n }}\n onChange={(e) => {\n const c = ctx.current;\n if (c.takeRangeClick(e.nativeEvent)) return;\n c.setAnchor(key);\n c.onToggle?.(row, e.target.checked);\n }}\n aria-label={selectRowLabel}\n />\n )}\n </td>\n )}\n {columns.map((col, colIndex) => {\n const width = widths[col.key];\n // The caller's first, the table's over it — see `cellProps`.\n const own = splitCellProps(col.cellProps?.(row));\n const pinned = width ? { width, minWidth: width, maxWidth: width } : undefined;\n return (\n <td\n {...own.attrs}\n key={col.key}\n data-col={col.key}\n style={own.style || pinned ? { ...own.style, ...pinned } : undefined}\n className={cn(\n \"align-top\",\n compact ? \"px-2 py-1\" : \"px-3 py-2\",\n width && \"overflow-hidden text-ellipsis\",\n col.grow ? GROW_CELL_CLASS : growDrawn && GROW_PEER_CELL_CLASS,\n logicalAlign(own.className),\n logicalAlign(col.className),\n )}\n >\n {colIndex === 0 && disclosure}\n {col === linkColumn && href ? (\n // No `onActivate`: the click is left to bubble to the\n // <tr> handler above, which already owns expand-vs-select.\n // Calling it here as well would toggle the row twice.\n <RowLink href={href} className=\"block\" data-row-link=\"\">\n {col.cell(row)}\n </RowLink>\n ) : (\n col.cell(row)\n )}\n </td>\n );\n })}\n </tr>\n {expansion && (\n <tr\n id={hasDisclosure ? detailId : undefined}\n aria-rowindex={windowed ? ariaRowIndex + 1 : undefined}\n data-row-detail={windowed ? rowIndex : undefined}\n className=\"bg-surface-2 border-t border-subtle\"\n >\n {/* The detail panel spans every column. In an `auto` table\n layout (the default here — columns only get fixed style\n widths once the user resizes/auto-sizes them) the cell's\n content preferred-width is redistributed across the\n spanned columns, so a long expansion visibly re-sizes the\n columns above it — and one-line content does not, since\n its preferred width is small (feedback #104). Wrapping the\n content in `w-0 min-w-full` pins the cell's preferred\n width to ~0 (the explicit width:0 child), so it can never\n perturb the columns; the div then fills to the full row\n width only at paint time, and long text wraps within it.\n Inside it the content is pinned to what the scroller SHOWS\n (0.47, keksdose S4): on a table wider than its scroller a\n table-wide panel put an inline editor's Save/Cancel off-screen.\n `sticky start-0` holds it at the scroller's start edge (the\n right one in RTL) as the row scrolls sideways, and\n `--dt-visible-w` (the scroller's clientWidth, measured above)\n sizes it; before the first measure, and in a table no wider\n than its scroller, it is the full width as before. */}\n <td colSpan={totalColSpan} className=\"p-0\">\n <div className=\"w-0 min-w-full\">\n <div\n className={cn(\n \"sticky start-0 w-[var(--dt-visible-w,100%)] max-w-full\",\n compact ? \"px-2 py-2\" : \"px-3 py-3\",\n )}\n >\n {expansion}\n </div>\n </div>\n </td>\n </tr>\n )}\n </Fragment>\n );\n}\n\n/** One desktop row (its `<tr>` and, while open, its detail row), memoised — see the\n * file's note for what it compares. */\nexport const DataTableRow = memo(DataTableRowImpl, sameProps) as <T>(\n props: DataTableRowProps<T> & { key?: string | number },\n) => ReactNode;\n\n// ---------- Phone card ----------\n\nexport interface DataTableMobileRowProps<T>\n extends Pick<\n MobileRowProps<T>,\n | \"row\"\n | \"opensRow\"\n | \"mobileDir\"\n | \"mobileCardLinkable\"\n | \"mobileCardStretched\"\n | \"mobileCard\"\n | \"mobilePrimaryCol\"\n | \"mobileStatusColumns\"\n | \"mobileSecondaryColumns\"\n | \"mobileActionColumns\"\n | \"mobileExpandAsDialog\"\n | \"compact\"\n | \"large\"\n > {\n ctx: RefObject<DataTableRowCtx<T>>;\n rowKey: string | number;\n expanded: boolean;\n /** The opened row's content (`openedRowContent`); `null` on a closed card. */\n expansion: ReactNode;\n className: string | undefined;\n attrs: Record<string, string | undefined> | undefined;\n /** The table has `onRowClick`. */\n interactive: boolean;\n href: string | undefined;\n /** `mobileSwipeActions`, or the swipes derived from `rowActions` — by identity. */\n swipeActionsFor: ((row: T) => MobileSwipeActions | null) | undefined;\n /** The table has `selection`. */\n selectionOn: boolean;\n selectActive: boolean;\n selectable: boolean;\n selected: boolean;\n}\n\nconst yes = () => true;\n\nfunction DataTableMobileRowImpl<T>({\n ctx,\n rowKey: key,\n expanded,\n expansion,\n className,\n attrs,\n interactive,\n href,\n selectionOn,\n selectActive,\n selectable,\n selected,\n ...rest\n}: DataTableMobileRowProps<T>) {\n const { row } = rest;\n // `MobileRow` keeps its own shape (functions of the row); these hand it the values the\n // table derived, and the handlers read the latest props through `ctx`.\n return (\n <MobileRow\n {...rest}\n isExpanded={expanded ? yes : undefined}\n openedRowContent={() => expansion}\n rowClassName={() => className}\n rowAttributes={() => attrs}\n onRowClick={interactive ? (r) => ctx.current.onRowClick!(r) : undefined}\n rowHref={href !== undefined ? () => href : undefined}\n select={\n selectionOn\n ? {\n active: selectActive,\n selectable,\n selected,\n onToggle: (checked) => {\n ctx.current.setAnchor(key);\n ctx.current.onToggle?.(row, checked);\n },\n onLongPress: () => ctx.current.onLongPress(row),\n }\n : null\n }\n />\n );\n}\n\n/** One phone card, memoised like {@link DataTableRow}. */\nexport const DataTableMobileRow = memo(DataTableMobileRowImpl, sameProps) as <T>(\n props: DataTableMobileRowProps<T> & { key?: string | number },\n) => ReactNode;\n"],"mappings":";AAiLI,cAaE,YAbF;AA6IQ;AA9TZ,SAAS,UAAU,YAAY;AAE/B,SAAS,SAAS,YAAY,aAAa,gBAAgB,cAAc,sBAAsB;AAC/F,SAAS,iBAAiB,4BAA4B;AACtD,SAAS,iBAAsC;AAE/C,SAAS,UAAU;AA+CnB,SAAS,UACP,GACA,GACS;AACT,MAAI,MAAM,EAAG,QAAO;AACpB,MAAI,CAAC,KAAK,CAAC,EAAG,QAAO;AACrB,QAAM,KAAK,OAAO,KAAK,CAAC;AACxB,MAAI,GAAG,WAAW,OAAO,KAAK,CAAC,EAAE,OAAQ,QAAO;AAChD,aAAW,KAAK,GAAI,KAAI,EAAE,CAAC,MAAM,EAAE,CAAC,EAAG,QAAO;AAC9C,SAAO;AACT;AAEA,SAAS,UAAoE,MAAS,MAAkB;AACtG,aAAW,KAAK,OAAO,KAAK,IAAI,GAAkB;AAChD,QAAI,MAAM,QAAS;AACnB,QAAI,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,EAAG,QAAO;AAAA,EAC3C;AACA,SAAO,UAAU,KAAK,OAAO,KAAK,KAAK;AACzC;AAIA,SAAS,aAAa,MAAmB,KAAsB;AAC7D,MAAI,EAAE,OAAO,cAAe,QAAO;AAEnC,QAAM,QAAQ,KAAK,QAAQ,OAAO;AAClC,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,OAAO,MAAM,KAAK,MAAM,OAAO,EAAE;AAAA,IAAQ,CAAC,SAC9C,MAAM,KAAK,KAAK,QAAQ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rB,cAAI,QAAQ,UAAU,GAAG;AACzB,cAAI,QAAQ,WAAW,KAAK,OAAO;AAAA,QACrC;AAAA,QACA,aAAa,MAAM,IAAI,QAAQ,YAAY,GAAG;AAAA,MAChD,IACA;AAAA;AAAA,EAER;AAEJ;AAGO,MAAM,qBAAqB,KAAK,wBAAwB,SAAS;","names":[]}
@@ -390,6 +390,7 @@ function DataTable({
390
390
  ] });
391
391
  };
392
392
  const mobileCardLinkable = (mobileCard ? mobileColumns : [...onCard]).every((c) => !keepsOwnClicks(c));
393
+ const mobileCardStretched = !mobileCard && !mobileCardLinkable && !!mobilePrimaryCol && !keepsOwnClicks(mobilePrimaryCol);
393
394
  const [mobileDir, setMobileDir] = useState("ltr");
394
395
  const mobileRootRef = (el) => {
395
396
  if (!el) return;
@@ -485,10 +486,11 @@ function DataTable({
485
486
  className: rowClassName?.(row),
486
487
  attrs: rowAttributes?.(row),
487
488
  interactive: !!onRowClick,
488
- href: mobileCardLinkable ? rowHref?.(row) : void 0,
489
+ href: mobileCardLinkable || mobileCardStretched ? rowHref?.(row) : void 0,
489
490
  swipeActionsFor,
490
491
  mobileDir,
491
492
  mobileCardLinkable,
493
+ mobileCardStretched,
492
494
  mobileCard,
493
495
  mobilePrimaryCol,
494
496
  mobileStatusColumns,