@wallarm-org/design-system 4.19.2 → 4.19.3-rc-fix-table-header-focus-scroll.2

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.
@@ -76,6 +76,9 @@ const StickyGroupParent = ({ tableWidth, headerHeight, windowScrollRoot, headerR
76
76
  stickyRow,
77
77
  containerRef
78
78
  ]);
79
+ useLayoutEffect(()=>{
80
+ for (const el of anchorRef.current?.querySelectorAll('a[href], button, input, select, textarea, [tabindex]') ?? [])el.tabIndex = -1;
81
+ });
79
82
  return /*#__PURE__*/ jsx("div", {
80
83
  ref: anchorRef,
81
84
  className: cn('pointer-events-none', !useWindowScroll && 'sticky z-[21] h-0 overflow-visible'),
@@ -6,12 +6,12 @@ import { useTestId } from "../../../utils/testId.js";
6
6
  import { Tooltip, TooltipContent, TooltipTrigger } from "../../Tooltip/index.js";
7
7
  import { DROP_INDICATOR_BASE } from "../classes.js";
8
8
  import { useMasterCell } from "../hooks/index.js";
9
- import { TABLE_EXPAND_COLUMN_ID, getAlignClass, getExpandBorderClass, useColumnDnd, useColumnPinning, useRenderEveryTime, useTableValue } from "../lib/index.js";
9
+ import { TABLE_EXPAND_COLUMN_ID, getAlignClass, getExpandBorderClass, useColumnDndStyle, useColumnPinning, useRenderEveryTime, useTableValue } from "../lib/index.js";
10
10
  import { Td } from "../primitives/index.js";
11
11
  import { useTableContext } from "../TableContext/index.js";
12
12
  import { TableMasterCellActions } from "../TableMasterCellActions.js";
13
13
  const TableBodyCell = (t0)=>{
14
- const $ = c(55);
14
+ const $ = c(54);
15
15
  const { cell, colSpan, className, disablePinnedShadow, lastRow, dragListeners, dragAttributes, dropIndicator, empty } = t0;
16
16
  const { masterColumnId } = useTableContext();
17
17
  const testId = useTestId("body-cell");
@@ -33,7 +33,7 @@ const TableBodyCell = (t0)=>{
33
33
  $[3] = t2;
34
34
  } else t2 = $[3];
35
35
  const size = useTableValue(t2);
36
- const { canDnd, setNodeRef, dndStyle } = useColumnDnd(column);
36
+ const dndStyle = useColumnDndStyle(column.id);
37
37
  const { isPinned, pinningStyles, lastPinnedLeft: lastLeft } = useColumnPinning(column);
38
38
  const { isMasterTrigger, handleClick, tooltipText } = useMasterCell(column.id, cell.row.id);
39
39
  const isCut = column.id === masterColumnId || meta?.resizeType === "cut";
@@ -121,80 +121,77 @@ const TableBodyCell = (t0)=>{
121
121
  } else t6 = $[27];
122
122
  const t7 = "start" === isPinned;
123
123
  const t8 = disablePinnedShadow ? false : lastLeft;
124
- const t9 = canDnd ? setNodeRef : void 0;
125
- const t10 = isMasterTrigger ? handleClick : void 0;
126
- let t11;
124
+ const t9 = isMasterTrigger ? handleClick : void 0;
125
+ let t10;
127
126
  if ($[28] !== isCut) {
128
- t11 = isCut && {
127
+ t10 = isCut && {
129
128
  overflow: "hidden"
130
129
  };
131
130
  $[28] = isCut;
132
- $[29] = t11;
133
- } else t11 = $[29];
134
- let t12;
131
+ $[29] = t10;
132
+ } else t10 = $[29];
133
+ let t11;
135
134
  if ($[30] !== dropIndicator) {
136
- t12 = dropIndicator && {
135
+ t11 = dropIndicator && {
137
136
  overflow: "visible"
138
137
  };
139
138
  $[30] = dropIndicator;
140
- $[31] = t12;
141
- } else t12 = $[31];
142
- let t13;
143
- if ($[32] !== dndStyle || $[33] !== pinningStyles || $[34] !== size || $[35] !== t11 || $[36] !== t12) {
144
- t13 = {
139
+ $[31] = t11;
140
+ } else t11 = $[31];
141
+ let t12;
142
+ if ($[32] !== dndStyle || $[33] !== pinningStyles || $[34] !== size || $[35] !== t10 || $[36] !== t11) {
143
+ t12 = {
145
144
  ...pinningStyles,
146
145
  width: size,
147
146
  ...dndStyle,
148
- ...t11,
149
- ...t12
147
+ ...t10,
148
+ ...t11
150
149
  };
151
150
  $[32] = dndStyle;
152
151
  $[33] = pinningStyles;
153
152
  $[34] = size;
154
- $[35] = t11;
155
- $[36] = t12;
156
- $[37] = t13;
157
- } else t13 = $[37];
158
- let t14;
153
+ $[35] = t10;
154
+ $[36] = t11;
155
+ $[37] = t12;
156
+ } else t12 = $[37];
157
+ let t13;
159
158
  if ($[38] !== empty || $[39] !== renderContent) {
160
- t14 = !empty && renderContent();
159
+ t13 = !empty && renderContent();
161
160
  $[38] = empty;
162
161
  $[39] = renderContent;
163
- $[40] = t14;
164
- } else t14 = $[40];
165
- let t15;
166
- if ($[41] !== colSpan || $[42] !== dragAttributes || $[43] !== dragListeners || $[44] !== isExpandedToggle || $[45] !== lastRow || $[46] !== t10 || $[47] !== t13 || $[48] !== t14 || $[49] !== t6 || $[50] !== t7 || $[51] !== t8 || $[52] !== t9 || $[53] !== testId) {
167
- t15 = /*#__PURE__*/ jsx(Td, {
162
+ $[40] = t13;
163
+ } else t13 = $[40];
164
+ let t14;
165
+ if ($[41] !== colSpan || $[42] !== dragAttributes || $[43] !== dragListeners || $[44] !== isExpandedToggle || $[45] !== lastRow || $[46] !== t12 || $[47] !== t13 || $[48] !== t6 || $[49] !== t7 || $[50] !== t8 || $[51] !== t9 || $[52] !== testId) {
166
+ t14 = /*#__PURE__*/ jsx(Td, {
168
167
  "data-testid": testId,
169
168
  className: t6,
170
169
  pinned: t7,
171
170
  lastPinnedLeft: t8,
172
171
  expanded: isExpandedToggle,
173
172
  lastRow: lastRow,
174
- ref: t9,
175
- onClick: t10,
176
- style: t13,
173
+ onClick: t9,
174
+ style: t12,
177
175
  colSpan: colSpan,
178
176
  ...dragListeners,
179
177
  ...dragAttributes,
180
- children: t14
178
+ children: t13
181
179
  });
182
180
  $[41] = colSpan;
183
181
  $[42] = dragAttributes;
184
182
  $[43] = dragListeners;
185
183
  $[44] = isExpandedToggle;
186
184
  $[45] = lastRow;
187
- $[46] = t10;
185
+ $[46] = t12;
188
186
  $[47] = t13;
189
- $[48] = t14;
190
- $[49] = t6;
191
- $[50] = t7;
192
- $[51] = t8;
193
- $[52] = t9;
194
- $[53] = testId;
195
- $[54] = t15;
196
- } else t15 = $[54];
197
- return t15;
187
+ $[48] = t6;
188
+ $[49] = t7;
189
+ $[50] = t8;
190
+ $[51] = t9;
191
+ $[52] = testId;
192
+ $[53] = t14;
193
+ } else t14 = $[53];
194
+ return t14;
198
195
  };
199
196
  TableBodyCell.displayName = "TableBodyCell";
200
197
  export { TableBodyCell };
@@ -48,8 +48,7 @@ const TableColumnMenuMoveLeftItem = (t0)=>{
48
48
  t3 = ()=>{
49
49
  onSelect?.();
50
50
  const allColumns = ctx.table.getAllLeafColumns();
51
- const columnOrderAtom = ctx.table.atoms.columnOrder.get();
52
- const currentOrder = columnOrderAtom.length ? columnOrderAtom : allColumns.map(_temp);
51
+ const currentOrder = allColumns.map(_temp);
53
52
  const fromIdx = currentOrder.indexOf(column.id);
54
53
  const toIdx = fromIdx - 1;
55
54
  if (toIdx < 0) return;
@@ -49,8 +49,7 @@ const TableColumnMenuMoveRightItem = (t0)=>{
49
49
  t3 = ()=>{
50
50
  onSelect?.();
51
51
  const allColumns = ctx.table.getAllLeafColumns();
52
- const columnOrderAtom = ctx.table.atoms.columnOrder.get();
53
- const currentOrder = columnOrderAtom.length ? columnOrderAtom : allColumns.map(_temp);
52
+ const currentOrder = allColumns.map(_temp);
54
53
  const fromIdx = currentOrder.indexOf(column.id);
55
54
  const toIdx = fromIdx + 1;
56
55
  if (toIdx >= currentOrder.length) return;
@@ -1,12 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c as compiler_runtime_c } from "react/compiler-runtime";
3
- import { useEffect, useRef } from "react";
3
+ import { useEffect, useRef, useState } from "react";
4
4
  import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
5
5
  import { SortableContext, arrayMove, horizontalListSortingStrategy, sortableKeyboardCoordinates } from "@dnd-kit/sortable";
6
6
  import { useTable } from "@tanstack/react-table";
7
7
  import { useControlled, useIsKeyPressed } from "../../../hooks/index.js";
8
8
  import { useTableState } from "../hooks/index.js";
9
- import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_MIN_COLUMN_WIDTH, TABLE_SELECT_COLUMN_ID, TABLE_SKELETON_ROWS, TABLE_VIRTUALIZATION_OVERSCAN, createDragHandleColumn, createExpandColumn, createSelectionColumn, dsTableFeatures } from "../lib/index.js";
9
+ import { TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_EXPAND_COLUMN_ID, TABLE_MIN_COLUMN_WIDTH, TABLE_SELECT_COLUMN_ID, TABLE_SKELETON_ROWS, TABLE_VIRTUALIZATION_OVERSCAN, createColumnDndStyles, createDragHandleColumn, createExpandColumn, createSelectionColumn, dsTableFeatures } from "../lib/index.js";
10
10
  import { TableContext } from "./TableContext.js";
11
11
  const toTanStackPinning = (p, pinnedLeft)=>({
12
12
  start: [
@@ -430,6 +430,7 @@ const TableProvider = (props)=>{
430
430
  const shiftKeyRef = useIsKeyPressed("Shift");
431
431
  const containerRef = useRef(null);
432
432
  const headerScrollRef = useRef(null);
433
+ const [columnDndStyles] = useState(createColumnDndStyles);
433
434
  const tbodyRef = useRef(null);
434
435
  const virtualizerRef = useRef(null);
435
436
  const t46 = !!getSubRows;
@@ -438,7 +439,7 @@ const TableProvider = (props)=>{
438
439
  const t49 = "full" === groupRowSpan ? renderGroupRow : void 0;
439
440
  const t50 = renderFullWidthRow;
440
441
  let t51;
441
- if ($[101] !== allLeafColumns || $[102] !== alwaysPinnedLeft || $[103] !== columnDndEnabled || $[104] !== columnGroups || $[105] !== defaultColumnOrder || $[106] !== defaultColumnVisibility || $[107] !== deferColumnVisibility || $[108] !== enableSelectAllRows || $[109] !== estimateRowHeight || $[110] !== expandingEnabled || $[111] !== groupingEnabled || $[112] !== initialScrollToRowId || $[113] !== isLoading || $[114] !== isLoadingPrevious || $[115] !== masterCellActiveRowId || $[116] !== masterColumnId || $[117] !== onEndReached || $[118] !== onEndReachedThreshold || $[119] !== onMasterCellClick || $[120] !== onRowReorder || $[121] !== onSelectAllRows || $[122] !== onSettingsOpenChange || $[123] !== onStartReached || $[124] !== onStartReachedThreshold || $[125] !== overscan || $[126] !== pinningEnabled || $[127] !== resizingEnabled || $[128] !== rowDndEnabled || $[129] !== selectionEnabled || $[130] !== setColumnOrder || $[131] !== shiftKeyRef || $[132] !== showEmptyGroups || $[133] !== skeletonCount || $[134] !== sortingEnabled || $[135] !== stretch || $[136] !== t46 || $[137] !== t47 || $[138] !== t48 || $[139] !== t49 || $[140] !== t50 || $[141] !== table || $[142] !== virtualized || $[143] !== visibilityEnabled) {
442
+ if ($[101] !== allLeafColumns || $[102] !== alwaysPinnedLeft || $[103] !== columnDndEnabled || $[104] !== columnDndStyles || $[105] !== columnGroups || $[106] !== defaultColumnOrder || $[107] !== defaultColumnVisibility || $[108] !== deferColumnVisibility || $[109] !== enableSelectAllRows || $[110] !== estimateRowHeight || $[111] !== expandingEnabled || $[112] !== groupingEnabled || $[113] !== initialScrollToRowId || $[114] !== isLoading || $[115] !== isLoadingPrevious || $[116] !== masterCellActiveRowId || $[117] !== masterColumnId || $[118] !== onEndReached || $[119] !== onEndReachedThreshold || $[120] !== onMasterCellClick || $[121] !== onRowReorder || $[122] !== onSelectAllRows || $[123] !== onSettingsOpenChange || $[124] !== onStartReached || $[125] !== onStartReachedThreshold || $[126] !== overscan || $[127] !== pinningEnabled || $[128] !== resizingEnabled || $[129] !== rowDndEnabled || $[130] !== selectionEnabled || $[131] !== setColumnOrder || $[132] !== shiftKeyRef || $[133] !== showEmptyGroups || $[134] !== skeletonCount || $[135] !== sortingEnabled || $[136] !== stretch || $[137] !== t46 || $[138] !== t47 || $[139] !== t48 || $[140] !== t49 || $[141] !== t50 || $[142] !== table || $[143] !== virtualized || $[144] !== visibilityEnabled) {
442
443
  t51 = {
443
444
  table,
444
445
  isLoading,
@@ -473,6 +474,7 @@ const TableProvider = (props)=>{
473
474
  onSelectAllRows,
474
475
  containerRef,
475
476
  headerScrollRef,
477
+ columnDndStyles,
476
478
  tbodyRef,
477
479
  virtualizerRef,
478
480
  onEndReached,
@@ -492,52 +494,53 @@ const TableProvider = (props)=>{
492
494
  $[101] = allLeafColumns;
493
495
  $[102] = alwaysPinnedLeft;
494
496
  $[103] = columnDndEnabled;
495
- $[104] = columnGroups;
496
- $[105] = defaultColumnOrder;
497
- $[106] = defaultColumnVisibility;
498
- $[107] = deferColumnVisibility;
499
- $[108] = enableSelectAllRows;
500
- $[109] = estimateRowHeight;
501
- $[110] = expandingEnabled;
502
- $[111] = groupingEnabled;
503
- $[112] = initialScrollToRowId;
504
- $[113] = isLoading;
505
- $[114] = isLoadingPrevious;
506
- $[115] = masterCellActiveRowId;
507
- $[116] = masterColumnId;
508
- $[117] = onEndReached;
509
- $[118] = onEndReachedThreshold;
510
- $[119] = onMasterCellClick;
511
- $[120] = onRowReorder;
512
- $[121] = onSelectAllRows;
513
- $[122] = onSettingsOpenChange;
514
- $[123] = onStartReached;
515
- $[124] = onStartReachedThreshold;
516
- $[125] = overscan;
517
- $[126] = pinningEnabled;
518
- $[127] = resizingEnabled;
519
- $[128] = rowDndEnabled;
520
- $[129] = selectionEnabled;
521
- $[130] = setColumnOrder;
522
- $[131] = shiftKeyRef;
523
- $[132] = showEmptyGroups;
524
- $[133] = skeletonCount;
525
- $[134] = sortingEnabled;
526
- $[135] = stretch;
527
- $[136] = t46;
528
- $[137] = t47;
529
- $[138] = t48;
530
- $[139] = t49;
531
- $[140] = t50;
532
- $[141] = table;
533
- $[142] = virtualized;
534
- $[143] = visibilityEnabled;
535
- $[144] = t51;
536
- } else t51 = $[144];
497
+ $[104] = columnDndStyles;
498
+ $[105] = columnGroups;
499
+ $[106] = defaultColumnOrder;
500
+ $[107] = defaultColumnVisibility;
501
+ $[108] = deferColumnVisibility;
502
+ $[109] = enableSelectAllRows;
503
+ $[110] = estimateRowHeight;
504
+ $[111] = expandingEnabled;
505
+ $[112] = groupingEnabled;
506
+ $[113] = initialScrollToRowId;
507
+ $[114] = isLoading;
508
+ $[115] = isLoadingPrevious;
509
+ $[116] = masterCellActiveRowId;
510
+ $[117] = masterColumnId;
511
+ $[118] = onEndReached;
512
+ $[119] = onEndReachedThreshold;
513
+ $[120] = onMasterCellClick;
514
+ $[121] = onRowReorder;
515
+ $[122] = onSelectAllRows;
516
+ $[123] = onSettingsOpenChange;
517
+ $[124] = onStartReached;
518
+ $[125] = onStartReachedThreshold;
519
+ $[126] = overscan;
520
+ $[127] = pinningEnabled;
521
+ $[128] = resizingEnabled;
522
+ $[129] = rowDndEnabled;
523
+ $[130] = selectionEnabled;
524
+ $[131] = setColumnOrder;
525
+ $[132] = shiftKeyRef;
526
+ $[133] = showEmptyGroups;
527
+ $[134] = skeletonCount;
528
+ $[135] = sortingEnabled;
529
+ $[136] = stretch;
530
+ $[137] = t46;
531
+ $[138] = t47;
532
+ $[139] = t48;
533
+ $[140] = t49;
534
+ $[141] = t50;
535
+ $[142] = table;
536
+ $[143] = virtualized;
537
+ $[144] = visibilityEnabled;
538
+ $[145] = t51;
539
+ } else t51 = $[145];
537
540
  const contextValue = t51;
538
541
  let t52;
539
542
  let t53;
540
- if ($[145] !== selectionEnabled || $[146] !== table) {
543
+ if ($[146] !== selectionEnabled || $[147] !== table) {
541
544
  t52 = ()=>{
542
545
  if (!selectionEnabled) return;
543
546
  const container = containerRef.current;
@@ -552,47 +555,45 @@ const TableProvider = (props)=>{
552
555
  selectionEnabled,
553
556
  table
554
557
  ];
555
- $[145] = selectionEnabled;
556
- $[146] = table;
557
- $[147] = t52;
558
- $[148] = t53;
558
+ $[146] = selectionEnabled;
559
+ $[147] = table;
560
+ $[148] = t52;
561
+ $[149] = t53;
559
562
  } else {
560
- t52 = $[147];
561
- t53 = $[148];
563
+ t52 = $[148];
564
+ t53 = $[149];
562
565
  }
563
566
  useEffect(t52, t53);
564
567
  let t54;
565
- if ($[149] === Symbol.for("react.memo_cache_sentinel")) {
568
+ if ($[150] === Symbol.for("react.memo_cache_sentinel")) {
566
569
  t54 = {
567
570
  activationConstraint: {
568
571
  distance: 5
569
572
  }
570
573
  };
571
- $[149] = t54;
572
- } else t54 = $[149];
574
+ $[150] = t54;
575
+ } else t54 = $[150];
573
576
  let t55;
574
- if ($[150] === Symbol.for("react.memo_cache_sentinel")) {
577
+ if ($[151] === Symbol.for("react.memo_cache_sentinel")) {
575
578
  t55 = {
576
579
  coordinateGetter: sortableKeyboardCoordinates
577
580
  };
578
- $[150] = t55;
579
- } else t55 = $[150];
581
+ $[151] = t55;
582
+ } else t55 = $[151];
580
583
  const sensors = useSensors(useSensor(PointerSensor, t54), useSensor(KeyboardSensor, t55));
581
584
  let t56;
582
- if ($[151] !== allLeafColumns || $[152] !== setColumnOrder || $[153] !== table.atoms) {
585
+ if ($[152] !== setColumnOrder || $[153] !== table) {
583
586
  t56 = (event)=>{
584
587
  const { active, over } = event;
585
588
  if (!over || active.id === over.id) return;
586
- const columnOrderAtom = table.atoms.columnOrder.get();
587
- const currentOrder = columnOrderAtom.length ? columnOrderAtom : allLeafColumns.map(_temp2);
589
+ const currentOrder = table.getAllLeafColumns().map(_temp2);
588
590
  const oldIndex = currentOrder.indexOf(String(active.id));
589
591
  const newIndex = currentOrder.indexOf(String(over.id));
590
592
  const newOrder_0 = arrayMove(currentOrder, oldIndex, newIndex);
591
593
  setColumnOrder(newOrder_0);
592
594
  };
593
- $[151] = allLeafColumns;
594
595
  $[152] = setColumnOrder;
595
- $[153] = table.atoms;
596
+ $[153] = table;
596
597
  $[154] = t56;
597
598
  } else t56 = $[154];
598
599
  const handleDragEnd = t56;
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode, RefObject } from 'react';
2
2
  import type { Column, ColumnVisibilityState, ReactTable, Row, RowData } from '@tanstack/react-table';
3
3
  import type { Virtualizer } from '@tanstack/react-virtual';
4
- import type { DSTableFeatures } from '../lib/index.js';
4
+ import type { ColumnDndStyles, DSTableFeatures } from '../lib/index.js';
5
5
  import type { TableColumnGroup, TableProps, TableRowReorderEvent, TableVirtualized } from '../types.js';
6
6
  /**
7
7
  * Union covers both virtualizer flavors used by the Table (`useVirtualizer`
@@ -43,6 +43,7 @@ export interface TableContextValue<T extends RowData> {
43
43
  masterColumnId: string | null;
44
44
  containerRef: RefObject<HTMLDivElement | null>;
45
45
  headerScrollRef: RefObject<HTMLDivElement | null>;
46
+ columnDndStyles: ColumnDndStyles;
46
47
  tbodyRef: RefObject<HTMLTableSectionElement | null>;
47
48
  virtualizerRef: RefObject<TableVirtualizerInstance | null>;
48
49
  onEndReached?: () => void;
@@ -297,6 +297,7 @@ const TableHeadCell = (t0)=>{
297
297
  colSpan: header.colSpan,
298
298
  "aria-sort": ariaSort,
299
299
  ...t18,
300
+ role: "columnheader",
300
301
  tabIndex: -1,
301
302
  children: [
302
303
  t19,
@@ -67,10 +67,20 @@ const TableInnerWindow = (t0)=>{
67
67
  if (headerScrollRef.current) headerScrollRef.current.scrollLeft = scrollEl.scrollLeft;
68
68
  if (groupScrollRef.current) groupScrollRef.current.scrollLeft = scrollEl.scrollLeft;
69
69
  };
70
+ const header = headerScrollRef.current;
71
+ const onHeaderScroll = ()=>{
72
+ if (header && scrollEl.scrollLeft !== header.scrollLeft) scrollEl.scrollLeft = header.scrollLeft;
73
+ };
70
74
  scrollEl.addEventListener("scroll", onScroll, {
71
75
  passive: true
72
76
  });
73
- return ()=>scrollEl.removeEventListener("scroll", onScroll);
77
+ header?.addEventListener("scroll", onHeaderScroll, {
78
+ passive: true
79
+ });
80
+ return ()=>{
81
+ scrollEl.removeEventListener("scroll", onScroll);
82
+ header?.removeEventListener("scroll", onHeaderScroll);
83
+ };
74
84
  };
75
85
  t5 = [
76
86
  containerRef,
@@ -137,7 +147,7 @@ const TableInnerWindow = (t0)=>{
137
147
  t12 = /*#__PURE__*/ jsxs("table", {
138
148
  className: "table-fixed border-separate border-spacing-0",
139
149
  style: t9,
140
- "aria-hidden": true,
150
+ role: "presentation",
141
151
  children: [
142
152
  t10,
143
153
  t11
@@ -238,24 +248,23 @@ const TableInnerWindow = (t0)=>{
238
248
  $[56] = t20;
239
249
  } else t20 = $[56];
240
250
  let t21;
241
- if ($[57] !== ariaLabel || $[58] !== t18 || $[59] !== t19 || $[60] !== t20) {
251
+ if ($[57] !== t18 || $[58] !== t19 || $[59] !== t20) {
242
252
  t21 = /*#__PURE__*/ jsxs("table", {
243
253
  className: "table-fixed border-separate border-spacing-0",
244
254
  style: t18,
245
- "aria-label": ariaLabel,
255
+ role: "presentation",
246
256
  children: [
247
257
  t19,
248
258
  t20
249
259
  ]
250
260
  });
251
- $[57] = ariaLabel;
252
- $[58] = t18;
253
- $[59] = t19;
254
- $[60] = t20;
255
- $[61] = t21;
256
- } else t21 = $[61];
261
+ $[57] = t18;
262
+ $[58] = t19;
263
+ $[59] = t20;
264
+ $[60] = t21;
265
+ } else t21 = $[60];
257
266
  let t22;
258
- if ($[62] !== children || $[63] !== containerRef || $[64] !== t21) {
267
+ if ($[61] !== children || $[62] !== containerRef || $[63] !== t21) {
259
268
  t22 = /*#__PURE__*/ jsxs(ScrollAreaViewport, {
260
269
  ref: containerRef,
261
270
  "data-table-scroll-container": true,
@@ -265,20 +274,20 @@ const TableInnerWindow = (t0)=>{
265
274
  children
266
275
  ]
267
276
  });
268
- $[62] = children;
269
- $[63] = containerRef;
270
- $[64] = t21;
271
- $[65] = t22;
272
- } else t22 = $[65];
277
+ $[61] = children;
278
+ $[62] = containerRef;
279
+ $[63] = t21;
280
+ $[64] = t22;
281
+ } else t22 = $[64];
273
282
  let t23;
274
- if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
283
+ if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
275
284
  t23 = /*#__PURE__*/ jsx(ScrollAreaScrollbar, {
276
285
  orientation: "horizontal"
277
286
  });
278
- $[66] = t23;
279
- } else t23 = $[66];
287
+ $[65] = t23;
288
+ } else t23 = $[65];
280
289
  let t24;
281
- if ($[67] !== t16 || $[68] !== t22) {
290
+ if ($[66] !== t16 || $[67] !== t22) {
282
291
  t24 = /*#__PURE__*/ jsxs(ScrollArea, {
283
292
  className: "group/scroll rounded-12 border border-border-primary-light",
284
293
  children: [
@@ -287,18 +296,21 @@ const TableInnerWindow = (t0)=>{
287
296
  t23
288
297
  ]
289
298
  });
290
- $[67] = t16;
291
- $[68] = t22;
292
- $[69] = t24;
293
- } else t24 = $[69];
299
+ $[66] = t16;
300
+ $[67] = t22;
301
+ $[68] = t24;
302
+ } else t24 = $[68];
294
303
  let t25;
295
- if ($[70] !== t24 || $[71] !== testId) {
304
+ if ($[69] !== ariaLabel || $[70] !== t24 || $[71] !== testId) {
296
305
  t25 = /*#__PURE__*/ jsx("div", {
297
306
  ref: rootRef,
298
307
  "data-testid": testId,
308
+ role: "table",
309
+ "aria-label": ariaLabel,
299
310
  className: "group/scroll relative outline-none",
300
311
  children: t24
301
312
  });
313
+ $[69] = ariaLabel;
302
314
  $[70] = t24;
303
315
  $[71] = testId;
304
316
  $[72] = t25;
@@ -136,8 +136,7 @@ const TableSettingsMenu = ({ 'data-testid': testIdProp, children, ...rest })=>{
136
136
  const handleDragEnd = (event)=>{
137
137
  const { active, over } = event;
138
138
  if (!over || active.id === over.id) return;
139
- const columnOrderAtom = table.atoms.columnOrder.get();
140
- const currentOrder = columnOrderAtom.length ? columnOrderAtom : allColumns.map((c)=>c.id);
139
+ const currentOrder = allColumns.map((c)=>c.id);
141
140
  const oldIndex = currentOrder.indexOf(String(active.id));
142
141
  const newIndex = currentOrder.indexOf(String(over.id));
143
142
  const newOrder = arrayMove(currentOrder, oldIndex, newIndex);
@@ -6,7 +6,7 @@ import { Button } from "../../Button/index.js";
6
6
  import { useTableContext } from "../TableContext/index.js";
7
7
  import { resolveVisibilityDraft, useTableSettingsMenuContentContext } from "./TableSettingsMenuContentContext.js";
8
8
  const TableSettingsMenuReset = (t0)=>{
9
- const $ = c(26);
9
+ const $ = c(29);
10
10
  let onClick;
11
11
  let rest;
12
12
  let testIdProp;
@@ -22,7 +22,7 @@ const TableSettingsMenuReset = (t0)=>{
22
22
  testIdProp = $[3];
23
23
  }
24
24
  const testId = useTestId("settings-menu-reset", testIdProp);
25
- const { table, visibilityEnabled, columnDndEnabled, defaultColumnVisibility, defaultColumnOrder, setColumnOrder, deferColumnVisibility } = useTableContext();
25
+ const { table, visibilityEnabled, columnDndEnabled, defaultColumnVisibility, defaultColumnOrder, setColumnOrder, alwaysPinnedLeft, deferColumnVisibility } = useTableContext();
26
26
  const { visibilityDraft, setVisibilityDraft } = useTableSettingsMenuContentContext();
27
27
  let t1;
28
28
  if ($[4] !== columnDndEnabled || $[5] !== defaultColumnOrder || $[6] !== defaultColumnVisibility || $[7] !== deferColumnVisibility || $[8] !== onClick || $[9] !== setColumnOrder || $[10] !== setVisibilityDraft || $[11] !== table || $[12] !== visibilityEnabled) {
@@ -60,17 +60,28 @@ const TableSettingsMenuReset = (t0)=>{
60
60
  } else t2 = $[17];
61
61
  const visibilityMatch = t2;
62
62
  let t3;
63
- if ($[18] !== defaultColumnOrder || $[19] !== effectiveOrder) {
64
- t3 = !defaultColumnOrder || isEqual(effectiveOrder, defaultColumnOrder);
65
- $[18] = defaultColumnOrder;
66
- $[19] = effectiveOrder;
67
- $[20] = t3;
68
- } else t3 = $[20];
69
- const orderMatch = t3;
70
- const isDefaultState = visibilityMatch && orderMatch;
63
+ if ($[18] !== alwaysPinnedLeft) {
64
+ t3 = (t4)=>{
65
+ const order = void 0 === t4 ? [] : t4;
66
+ return order.filter((id)=>!alwaysPinnedLeft.includes(id));
67
+ };
68
+ $[18] = alwaysPinnedLeft;
69
+ $[19] = t3;
70
+ } else t3 = $[19];
71
+ const movable = t3;
71
72
  let t4;
72
- if ($[21] !== handleClick || $[22] !== isDefaultState || $[23] !== rest || $[24] !== testId) {
73
- t4 = /*#__PURE__*/ jsx(Button, {
73
+ if ($[20] !== defaultColumnOrder || $[21] !== effectiveOrder || $[22] !== movable) {
74
+ t4 = !defaultColumnOrder || isEqual(movable(effectiveOrder), movable(defaultColumnOrder));
75
+ $[20] = defaultColumnOrder;
76
+ $[21] = effectiveOrder;
77
+ $[22] = movable;
78
+ $[23] = t4;
79
+ } else t4 = $[23];
80
+ const orderMatch = t4;
81
+ const isDefaultState = visibilityMatch && orderMatch;
82
+ let t5;
83
+ if ($[24] !== handleClick || $[25] !== isDefaultState || $[26] !== rest || $[27] !== testId) {
84
+ t5 = /*#__PURE__*/ jsx(Button, {
74
85
  ...rest,
75
86
  type: "button",
76
87
  "data-testid": testId,
@@ -82,13 +93,13 @@ const TableSettingsMenuReset = (t0)=>{
82
93
  fullWidth: true,
83
94
  children: "Reset to default"
84
95
  });
85
- $[21] = handleClick;
86
- $[22] = isDefaultState;
87
- $[23] = rest;
88
- $[24] = testId;
89
- $[25] = t4;
90
- } else t4 = $[25];
91
- return t4;
96
+ $[24] = handleClick;
97
+ $[25] = isDefaultState;
98
+ $[26] = rest;
99
+ $[27] = testId;
100
+ $[28] = t5;
101
+ } else t5 = $[28];
102
+ return t5;
92
103
  };
93
104
  TableSettingsMenuReset.displayName = "TableSettingsMenuReset";
94
105
  export { TableSettingsMenuReset };
@@ -0,0 +1,15 @@
1
+ import { type CSSProperties } from 'react';
2
+ /**
3
+ * A column's drag style, written by its header cell and read by its body
4
+ * cells. Only the header registers the column with dnd-kit: dnd-kit keeps one
5
+ * node per id, so a body cell registering the same id and then unmounting (a
6
+ * virtualized row, a refetched page) dropped the column, and it no longer moved.
7
+ */
8
+ export declare const createColumnDndStyles: () => {
9
+ get: (id: string) => CSSProperties;
10
+ set: (id: string, style: CSSProperties) => void;
11
+ subscribe: (listener: () => void) => () => void;
12
+ };
13
+ export type ColumnDndStyles = ReturnType<typeof createColumnDndStyles>;
14
+ /** The drag style of the column, as its header cell has it. */
15
+ export declare const useColumnDndStyle: (columnId: string) => CSSProperties;
@@ -0,0 +1,38 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import { useSyncExternalStore } from "react";
3
+ import { useTableContext } from "../TableContext/useTableContext.js";
4
+ const NONE = {};
5
+ const createColumnDndStyles = ()=>{
6
+ const styles = new Map();
7
+ const listeners = new Set();
8
+ return {
9
+ get: (id)=>styles.get(id) ?? NONE,
10
+ set: (id, style)=>{
11
+ if (JSON.stringify(styles.get(id) ?? NONE) === JSON.stringify(style)) return;
12
+ styles.set(id, style);
13
+ for (const listener of listeners)listener();
14
+ },
15
+ subscribe: (listener)=>{
16
+ listeners.add(listener);
17
+ return ()=>{
18
+ listeners.delete(listener);
19
+ };
20
+ }
21
+ };
22
+ };
23
+ const useColumnDndStyle = (columnId)=>{
24
+ const $ = c(3);
25
+ const { columnDndStyles } = useTableContext();
26
+ let t0;
27
+ if ($[0] !== columnDndStyles || $[1] !== columnId) {
28
+ t0 = ()=>columnDndStyles.get(columnId);
29
+ $[0] = columnDndStyles;
30
+ $[1] = columnId;
31
+ $[2] = t0;
32
+ } else t0 = $[2];
33
+ return useSyncExternalStore(columnDndStyles.subscribe, t0, _temp);
34
+ };
35
+ function _temp() {
36
+ return NONE;
37
+ }
38
+ export { createColumnDndStyles, useColumnDndStyle };
@@ -1,4 +1,5 @@
1
1
  export { collectDirectChildren } from './collectDirectChildren.js';
2
+ export { type ColumnDndStyles, createColumnDndStyles, useColumnDndStyle, } from './columnDndStyles.js';
2
3
  export { getAlignClass, getExpandBorderClass, SCROLL_EDGE_COOLDOWN_MS, SORT_LABELS, TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_DRAG_HANDLE_COLUMN_WIDTH, TABLE_END_REACHED_THRESHOLD, TABLE_EXPAND_COLUMN_ID, TABLE_EXPAND_COLUMN_WIDTH, TABLE_MIN_COLUMN_WIDTH, TABLE_PREPEND_SKELETON_ROWS, TABLE_SELECT_COLUMN_ID, TABLE_SELECT_COLUMN_WIDTH, TABLE_SKELETON_ROWS, TABLE_START_REACHED_THRESHOLD, TABLE_VIRTUALIZATION_OVERSCAN, } from './constants.js';
3
4
  export { containsDirectChild } from './containsDirectChild.js';
4
5
  export { createDragHandleColumn } from './createDragHandleColumn.js';
@@ -1,4 +1,5 @@
1
1
  export { collectDirectChildren } from "./collectDirectChildren.js";
2
+ export { createColumnDndStyles, useColumnDndStyle } from "./columnDndStyles.js";
2
3
  export { SCROLL_EDGE_COOLDOWN_MS, SORT_LABELS, TABLE_DRAG_HANDLE_COLUMN_ID, TABLE_DRAG_HANDLE_COLUMN_WIDTH, TABLE_END_REACHED_THRESHOLD, TABLE_EXPAND_COLUMN_ID, TABLE_EXPAND_COLUMN_WIDTH, TABLE_MIN_COLUMN_WIDTH, TABLE_PREPEND_SKELETON_ROWS, TABLE_SELECT_COLUMN_ID, TABLE_SELECT_COLUMN_WIDTH, TABLE_SKELETON_ROWS, TABLE_START_REACHED_THRESHOLD, TABLE_VIRTUALIZATION_OVERSCAN, getAlignClass, getExpandBorderClass } from "./constants.js";
3
4
  export { containsDirectChild } from "./containsDirectChild.js";
4
5
  export { createDragHandleColumn } from "./createDragHandleColumn.js";
@@ -1,4 +1,4 @@
1
- import type { CSSProperties } from 'react';
1
+ import { type CSSProperties } from 'react';
2
2
  import { useSortable } from '@dnd-kit/sortable';
3
3
  import type { Column, RowData } from '@tanstack/react-table';
4
4
  import type { DSTableFeatures } from './dsTableFeatures.js';
@@ -11,5 +11,6 @@ interface UseColumnDndResult {
11
11
  attributes: UseSortableReturn['attributes'];
12
12
  listeners: UseSortableReturn['listeners'];
13
13
  }
14
+ /** For the header cell only: it is the one node of the column dnd-kit knows. */
14
15
  export declare const useColumnDnd: <T extends RowData>(column: Column<DSTableFeatures, T, unknown>) => UseColumnDndResult;
15
16
  export {};
@@ -1,11 +1,12 @@
1
1
  import { c } from "react/compiler-runtime";
2
+ import { useLayoutEffect } from "react";
2
3
  import { useSortable } from "@dnd-kit/sortable";
3
4
  import { useTableContext } from "../TableContext/useTableContext.js";
4
5
  import { getDndStyles } from "./getDndStyles.js";
5
6
  import { useTableValue } from "./tableReactivity.js";
6
7
  const useColumnDnd = (column)=>{
7
- const $ = c(25);
8
- const { columnDndEnabled, alwaysPinnedLeft } = useTableContext();
8
+ const $ = c(29);
9
+ const { columnDndEnabled, alwaysPinnedLeft, columnDndStyles } = useTableContext();
9
10
  let t0;
10
11
  if ($[0] !== column) {
11
12
  t0 = ()=>column.getIsPinned();
@@ -59,8 +60,17 @@ const useColumnDnd = (column)=>{
59
60
  } else t5 = $[17];
60
61
  const dndStyle = t5;
61
62
  let t6;
62
- if ($[18] !== attributes || $[19] !== canDnd || $[20] !== dndStyle || $[21] !== isDragging || $[22] !== listeners || $[23] !== setNodeRef) {
63
- t6 = {
63
+ if ($[18] !== column.id || $[19] !== columnDndStyles || $[20] !== dndStyle) {
64
+ t6 = ()=>columnDndStyles.set(column.id, dndStyle);
65
+ $[18] = column.id;
66
+ $[19] = columnDndStyles;
67
+ $[20] = dndStyle;
68
+ $[21] = t6;
69
+ } else t6 = $[21];
70
+ useLayoutEffect(t6);
71
+ let t7;
72
+ if ($[22] !== attributes || $[23] !== canDnd || $[24] !== dndStyle || $[25] !== isDragging || $[26] !== listeners || $[27] !== setNodeRef) {
73
+ t7 = {
64
74
  canDnd,
65
75
  isDragging,
66
76
  setNodeRef,
@@ -68,14 +78,14 @@ const useColumnDnd = (column)=>{
68
78
  attributes,
69
79
  listeners
70
80
  };
71
- $[18] = attributes;
72
- $[19] = canDnd;
73
- $[20] = dndStyle;
74
- $[21] = isDragging;
75
- $[22] = listeners;
76
- $[23] = setNodeRef;
77
- $[24] = t6;
78
- } else t6 = $[24];
79
- return t6;
81
+ $[22] = attributes;
82
+ $[23] = canDnd;
83
+ $[24] = dndStyle;
84
+ $[25] = isDragging;
85
+ $[26] = listeners;
86
+ $[27] = setNodeRef;
87
+ $[28] = t7;
88
+ } else t7 = $[28];
89
+ return t7;
80
90
  };
81
91
  export { useColumnDnd };
@@ -27,6 +27,7 @@ const TBody = (t0)=>{
27
27
  if ($[6] !== props || $[7] !== ref || $[8] !== t1) {
28
28
  t2 = /*#__PURE__*/ jsx("tbody", {
29
29
  ref: ref,
30
+ role: "rowgroup",
30
31
  className: t1,
31
32
  ...props
32
33
  });
@@ -27,6 +27,7 @@ const THead = (t0)=>{
27
27
  if ($[6] !== props || $[7] !== ref || $[8] !== t1) {
28
28
  t2 = /*#__PURE__*/ jsx("thead", {
29
29
  ref: ref,
30
+ role: "rowgroup",
30
31
  className: t1,
31
32
  ...props
32
33
  });
@@ -51,6 +51,7 @@ const Td = (t0)=>{
51
51
  if ($[15] !== props || $[16] !== ref || $[17] !== t1) {
52
52
  t2 = /*#__PURE__*/ jsx("td", {
53
53
  ref: ref,
54
+ role: "cell",
54
55
  className: t1,
55
56
  ...props
56
57
  });
@@ -60,6 +60,7 @@ const Th = (t0)=>{
60
60
  t2 = /*#__PURE__*/ jsx("th", {
61
61
  ref: ref,
62
62
  scope: "col",
63
+ role: "columnheader",
63
64
  className: t1,
64
65
  ...props
65
66
  });
@@ -28,6 +28,7 @@ const Tr = (t0)=>{
28
28
  if ($[6] !== props || $[7] !== ref || $[8] !== t1) {
29
29
  t2 = /*#__PURE__*/ jsx("tr", {
30
30
  ref: ref,
31
+ role: "row",
31
32
  className: t1,
32
33
  ...props
33
34
  });
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "4.19.1",
3
- "generatedAt": "2026-11-17T08:53:17.637Z",
2
+ "version": "4.19.2",
3
+ "generatedAt": "2026-11-17T12:20:48.193Z",
4
4
  "components": [
5
5
  {
6
6
  "name": "Accordion",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.19.1",
2
+ "version": "4.19.2",
3
3
  "rules": "Every numeric utility is in px, not 4px steps: p-16 is 16px, p-4 is 4px. Translate Tailwind habits (p-4 → p-16, gap-6 → gap-24, w-64 → w-256).\n\nBefore composing a screen, call get_guideline for the pattern (app shell, list page, table, drawer, form, dialog, filters, empty state, settings, auth). Wrong → right:\n\n- p-5, gap-3, p-10 → stay on the scale: 1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32, 40, 48, 64…\n- space-y-4, margins per child → <VStack gap={16}>, <HStack gap={8}>\n- Padded page wrapper → PageHeader / PageToolbar / PageContent own the 24px gutter\n- p-* on Card, DrawerBody, DialogBody, PageToolbar, Table → none; they own their padding\n- className on Text, Heading, Field, Drawer/Dialog Header/Body/Footer → wrap in your own element\n- Raw <h1>, <p>, <label> → <Heading as=\"h2\" size=\"lg\">, <Text size=\"sm\">, Field\n- <Text> default (16px) for body → size=\"sm\"\n- leading-none (0px), leading-5 (5px) → leading-sm, leading-20\n- weight=\"semibold\" → weight is light|regular|medium|bold (medium = 450)\n- bg-primary, text-muted, bg-card, bg-white → bg-bg-primary, text-text-secondary, bg-bg-surface-1\n- text-error, bg-red-500 → danger tokens; categorical color → Badge color\n- dark: variant, setting data-theme → semantic tokens, useTheme().setTheme()\n- rounded-lg, rounded, rounded-[15px] → rounded-8 (controls), rounded-12 (panels)\n- shadow-* on DS components, z-* on overlays → never; they own both\n- focus:ring → focus-visible:ring-3 ring-focus-primary outline-none\n- size, DIALOG/DRAWER_SIZES → width: Dialog 400 confirm, 560 default, 960 picker; Drawer 640 default, 700 Timeline form\n- Dialog, useToast from the root → @wallarm-org/design-system/Dialog, /Toast\n- Field invalid → error on the control + FieldError\n- Table actions column → meta.renderMenuAction on the master column\n- Hand-built side menu → RemoteShell config={NavConfig}\n- ConfirmDialog, FilterBar, Combobox → compose Dialog parts, PageToolbar + FilterDropdown, Select + useSelectSearch\n- data-slot in tests → data-testid\n",
4
4
  "guidelines": [
5
5
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "4.19.2",
3
+ "version": "4.19.3-rc-fix-table-header-focus-scroll.2",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",