@semcore/data-table 17.0.0-prerelease.36 → 17.0.0-prerelease.39

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 (84) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/lib/cjs/components/DataTable/DataTable.js +14 -40
  3. package/lib/cjs/components/DataTable/DataTable.js.map +1 -1
  4. package/lib/cjs/components/Head/Head.js +6 -1
  5. package/lib/cjs/components/Head/Head.js.map +1 -1
  6. package/lib/cjs/components/RowSelector/RowsSelector.js +1 -1
  7. package/lib/cjs/components/RowSelector/RowsSelector.js.map +1 -1
  8. package/lib/cjs/components/RowSelector/SRAnnouncer.js +49 -0
  9. package/lib/cjs/components/RowSelector/SRAnnouncer.js.map +1 -0
  10. package/lib/cjs/components/RowSelector/SRReactiveAnnouncer.js +31 -0
  11. package/lib/cjs/components/RowSelector/SRReactiveAnnouncer.js.map +1 -0
  12. package/lib/cjs/store/SelectableRows.js +6 -5
  13. package/lib/cjs/store/SelectableRows.js.map +1 -1
  14. package/lib/cjs/translations/de.json +6 -1
  15. package/lib/cjs/translations/es.json +6 -1
  16. package/lib/cjs/translations/fr.json +6 -1
  17. package/lib/cjs/translations/it.json +6 -1
  18. package/lib/cjs/translations/ja.json +6 -1
  19. package/lib/cjs/translations/ko.json +6 -1
  20. package/lib/cjs/translations/nl.json +6 -1
  21. package/lib/cjs/translations/pl.json +6 -1
  22. package/lib/cjs/translations/pt.json +6 -1
  23. package/lib/cjs/translations/sv.json +6 -1
  24. package/lib/cjs/translations/tr.json +6 -1
  25. package/lib/cjs/translations/vi.json +6 -1
  26. package/lib/cjs/translations/zh.json +6 -1
  27. package/lib/es6/components/DataTable/DataTable.js +15 -41
  28. package/lib/es6/components/DataTable/DataTable.js.map +1 -1
  29. package/lib/es6/components/Head/Head.js +6 -1
  30. package/lib/es6/components/Head/Head.js.map +1 -1
  31. package/lib/es6/components/RowSelector/RowsSelector.js +1 -1
  32. package/lib/es6/components/RowSelector/RowsSelector.js.map +1 -1
  33. package/lib/es6/components/RowSelector/SRAnnouncer.js +42 -0
  34. package/lib/es6/components/RowSelector/SRAnnouncer.js.map +1 -0
  35. package/lib/es6/components/RowSelector/SRReactiveAnnouncer.js +24 -0
  36. package/lib/es6/components/RowSelector/SRReactiveAnnouncer.js.map +1 -0
  37. package/lib/es6/store/SelectableRows.js +6 -5
  38. package/lib/es6/store/SelectableRows.js.map +1 -1
  39. package/lib/es6/translations/de.json +6 -1
  40. package/lib/es6/translations/es.json +6 -1
  41. package/lib/es6/translations/fr.json +6 -1
  42. package/lib/es6/translations/it.json +6 -1
  43. package/lib/es6/translations/ja.json +6 -1
  44. package/lib/es6/translations/ko.json +6 -1
  45. package/lib/es6/translations/nl.json +6 -1
  46. package/lib/es6/translations/pl.json +6 -1
  47. package/lib/es6/translations/pt.json +6 -1
  48. package/lib/es6/translations/sv.json +6 -1
  49. package/lib/es6/translations/tr.json +6 -1
  50. package/lib/es6/translations/vi.json +6 -1
  51. package/lib/es6/translations/zh.json +6 -1
  52. package/lib/esm/components/AccordionRows/AccordionRows.mjs +0 -1
  53. package/lib/esm/components/Body/Body.mjs +19 -26
  54. package/lib/esm/components/Body/Cell.mjs +6 -9
  55. package/lib/esm/components/Body/LimitOverlay.mjs +2 -3
  56. package/lib/esm/components/Body/Row.mjs +18 -23
  57. package/lib/esm/components/Body/RowGroup.mjs +3 -3
  58. package/lib/esm/components/DataTable/DataTable.mjs +91 -134
  59. package/lib/esm/components/Head/Column.mjs +13 -19
  60. package/lib/esm/components/Head/Group.mjs +1 -2
  61. package/lib/esm/components/Head/Head.mjs +15 -15
  62. package/lib/esm/components/RowSelector/RowsSelector.mjs +6 -7
  63. package/lib/esm/components/RowSelector/SRAnnouncer.mjs +44 -0
  64. package/lib/esm/components/RowSelector/SRReactiveAnnouncer.mjs +26 -0
  65. package/lib/esm/enhancers/focusableCell.mjs +4 -5
  66. package/lib/esm/store/SelectableRows.mjs +6 -5
  67. package/lib/esm/translations/de.json.mjs +6 -1
  68. package/lib/esm/translations/es.json.mjs +6 -1
  69. package/lib/esm/translations/fr.json.mjs +6 -1
  70. package/lib/esm/translations/it.json.mjs +6 -1
  71. package/lib/esm/translations/ja.json.mjs +6 -1
  72. package/lib/esm/translations/ko.json.mjs +6 -1
  73. package/lib/esm/translations/nl.json.mjs +6 -1
  74. package/lib/esm/translations/pl.json.mjs +6 -1
  75. package/lib/esm/translations/pt.json.mjs +6 -1
  76. package/lib/esm/translations/sv.json.mjs +6 -1
  77. package/lib/esm/translations/tr.json.mjs +6 -1
  78. package/lib/esm/translations/vi.json.mjs +6 -1
  79. package/lib/esm/translations/zh.json.mjs +6 -1
  80. package/lib/types/components/RowSelector/SRAnnouncer.d.ts +10 -0
  81. package/lib/types/components/RowSelector/SRReactiveAnnouncer.d.ts +8 -0
  82. package/lib/types/store/SelectableRows.d.ts +5 -1
  83. package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +65 -0
  84. package/package.json +20 -20
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { createComponent, Component, lastInteraction, sstyled, assignProps } from "@semcore/core";
3
- import { ScrollArea, Box, ScreenReaderOnly } from "@semcore/base-components";
2
+ import { sstyled, Component, lastInteraction, assignProps, createComponent } from "@semcore/core";
3
+ import { Box, ScrollArea } from "@semcore/base-components";
4
4
  import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
5
5
  import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
6
6
  import findComponent from "@semcore/core/lib/utils/findComponent";
@@ -16,7 +16,8 @@ import { localizedMessages } from "../../translations/__intergalactic-dynamic-lo
16
16
  import { Body } from "../Body/Body.mjs";
17
17
  import { MergedRowsCell, MergedColumnsCell } from "../Body/MergedCells.mjs";
18
18
  import { Head } from "../Head/Head.mjs";
19
- /*!__reshadow-styles__:"./dataTable.shadow.css"*/
19
+ import { SRAnnouncer } from "../RowSelector/SRAnnouncer.mjs";
20
+ import { SRReactiveAnnouncer } from "../RowSelector/SRReactiveAnnouncer.mjs";
20
21
  const style = (
21
22
  /*__reshadow_css_start__*/
22
23
  (sstyled.insert(
@@ -36,7 +37,6 @@ const style = (
36
37
  "--gridTemplateRows": "--gridTemplateRows_wo0cb"
37
38
  })
38
39
  );
39
- /*!__reshadow-styles__:"../../style/scroll-shadows.shadow.css"*/
40
40
  const scrollStyles = (
41
41
  /*__reshadow_css_start__*/
42
42
  (sstyled.insert(
@@ -64,13 +64,13 @@ const scrollStyles = (
64
64
  "_rightOffset": "__rightOffset_j4820_gg_"
65
65
  })
66
66
  );
67
- const ACCORDION = Symbol("accordion");
68
- const ROW_GROUP = Symbol("ROW_GROUP");
69
- const UNIQ_ROW_KEY = Symbol("UNIQ_ROW_KEY");
70
- const IS_EMPTY_DATA_ROW = Symbol("IS_EMPTY_DATA_ROW");
71
- const SELECT_ALL = Symbol("SELECT_ALL");
72
- const ROW_INDEX = Symbol("ROW_INDEX");
73
- const GRID_ROW_INDEX = Symbol("GRID_ROW_INDEX");
67
+ const ACCORDION = /* @__PURE__ */ Symbol("accordion");
68
+ const ROW_GROUP = /* @__PURE__ */ Symbol("ROW_GROUP");
69
+ const UNIQ_ROW_KEY = /* @__PURE__ */ Symbol("UNIQ_ROW_KEY");
70
+ const IS_EMPTY_DATA_ROW = /* @__PURE__ */ Symbol("IS_EMPTY_DATA_ROW");
71
+ const SELECT_ALL = /* @__PURE__ */ Symbol("SELECT_ALL");
72
+ const ROW_INDEX = /* @__PURE__ */ Symbol("ROW_INDEX");
73
+ const GRID_ROW_INDEX = /* @__PURE__ */ Symbol("GRID_ROW_INDEX");
74
74
  const SCROLL_BAR_HEIGHT = 12;
75
75
  class DataTableRoot extends Component {
76
76
  static getDerivedStateFromProps(props, state) {
@@ -103,7 +103,6 @@ class DataTableRoot extends Component {
103
103
  gridTemplateColumns: [],
104
104
  gridTemplateAreas: []
105
105
  });
106
- _defineProperty(this, "selectAllMessageTimer", 0);
107
106
  _defineProperty(this, "headerNodesMap", /* @__PURE__ */ new Map());
108
107
  _defineProperty(this, "selectedRowsContainer", void 0);
109
108
  _defineProperty(this, "lastSelectedRowKey", void 0);
@@ -115,7 +114,6 @@ class DataTableRoot extends Component {
115
114
  expandedRows: /* @__PURE__ */ new Set()
116
115
  });
117
116
  _defineProperty(this, "handleDocumentScroll", trottle(() => {
118
- var _a;
119
117
  const tableContainer = this.tableContainerRef.current;
120
118
  if (!tableContainer) return;
121
119
  const tableContainerTop = tableContainer.getBoundingClientRect().top;
@@ -123,12 +121,12 @@ class DataTableRoot extends Component {
123
121
  headerProps
124
122
  } = this.asProps;
125
123
  const headerContainer = this.headerRef.current;
126
- const elements = headerContainer == null ? void 0 : headerContainer.querySelectorAll('[role="columnheader"], [data-ui-name="Head.Group"]');
127
- const top = tableContainerTop - ((headerProps == null ? void 0 : headerProps.top) ?? 0);
128
- const headerScrollBar = (headerProps == null ? void 0 : headerProps.withScrollBar) ? (_a = this.scrollAreaRef.current) == null ? void 0 : _a.querySelector(`[role=scrollbar][aria-orientation=horizontal]`) : void 0;
124
+ const elements = headerContainer?.querySelectorAll('[role="columnheader"], [data-ui-name="Head.Group"]');
125
+ const top = tableContainerTop - (headerProps?.top ?? 0);
126
+ const headerScrollBar = headerProps?.withScrollBar ? this.scrollAreaRef.current?.querySelector(`[role=scrollbar][aria-orientation=horizontal]`) : void 0;
129
127
  if (top && top < 0) {
130
128
  const translate = `translateY(${Math.abs(top)}px)`;
131
- elements == null ? void 0 : elements.forEach((column) => {
129
+ elements?.forEach((column) => {
132
130
  if (column instanceof HTMLElement) {
133
131
  column.style.setProperty("transform", translate);
134
132
  }
@@ -137,7 +135,7 @@ class DataTableRoot extends Component {
137
135
  headerScrollBar.style.setProperty("transform", translate);
138
136
  }
139
137
  } else {
140
- elements == null ? void 0 : elements.forEach((column) => {
138
+ elements?.forEach((column) => {
141
139
  if (column instanceof HTMLElement) {
142
140
  column.style.removeProperty("transform");
143
141
  }
@@ -205,26 +203,8 @@ class DataTableRoot extends Component {
205
203
  row
206
204
  });
207
205
  });
208
- _defineProperty(this, "setSelectAllMessage", (selectedAll) => {
209
- if (this.selectAllMessageTimer) {
210
- clearTimeout(this.selectAllMessageTimer);
211
- }
212
- const {
213
- getI18nText
214
- } = this.asProps;
215
- const message = getI18nText(selectedAll ? "DataTable.allItemsSelected:aria-live" : "DataTable.allItemsDeselected:aria-live");
216
- this.setState({
217
- selectAllMessage: message
218
- });
219
- this.selectAllMessageTimer = window.setTimeout(() => {
220
- this.setState({
221
- selectAllMessage: ""
222
- });
223
- }, 5e3);
224
- });
225
206
  _defineProperty(this, "getRow", (index) => {
226
- var _a;
227
- return (_a = this.tableRef.current) == null ? void 0 : _a.querySelector(`:scope [aria-rowindex="${index + 1}"]:not([aria-hidden="true"]):not(:scope [data-ui-name="DataTable"] [aria-rowindex="${index + 1}"]:not([aria-hidden="true"])`);
207
+ return this.tableRef.current?.querySelector(`:scope [aria-rowindex="${index + 1}"]:not([aria-hidden="true"]):not(:scope [data-ui-name="DataTable"] [aria-rowindex="${index + 1}"]:not([aria-hidden="true"])`);
228
208
  });
229
209
  _defineProperty(this, "hasFocusableInHeader", () => {
230
210
  return this.headerRef.current && hasFocusableIn(this.headerRef.current) || this.columns.some((column) => column.sortable);
@@ -237,10 +217,10 @@ class DataTableRoot extends Component {
237
217
  const expandedRows = this.state.expandedRows;
238
218
  if (expandedRows.has(expandedRow[UNIQ_ROW_KEY])) {
239
219
  expandedRows.delete(expandedRow[UNIQ_ROW_KEY]);
240
- onAccordionToggle == null ? void 0 : onAccordionToggle("close", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
220
+ onAccordionToggle?.("close", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
241
221
  } else {
242
222
  expandedRows.add(expandedRow[UNIQ_ROW_KEY]);
243
- onAccordionToggle == null ? void 0 : onAccordionToggle("open", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
223
+ onAccordionToggle?.("open", expandedRow[UNIQ_ROW_KEY], expandedRow[ROW_INDEX]);
244
224
  if (accordionMode === "toggle") {
245
225
  const rowIndex = expandedRow[ROW_INDEX];
246
226
  const colIndex = this.focusedCell[1];
@@ -249,17 +229,16 @@ class DataTableRoot extends Component {
249
229
  }
250
230
  });
251
231
  _defineProperty(this, "changeFocusCell", (rowIndex, colIndex, direction) => {
252
- var _a, _b, _c, _d;
253
232
  const {
254
233
  limit
255
234
  } = this.asProps;
256
235
  const hasFocusable = this.hasFocusableInHeader();
257
236
  const maxCol = this.columns.length - 1;
258
237
  const maxRow = this.totalRows || 1;
259
- const currentRow = (_a = this.tableRef.current) == null ? void 0 : _a.querySelector(`[aria-rowindex="${this.focusedCell[0] + 1}"]`);
260
- const headerCells = (_b = this.tableRef.current) == null ? void 0 : _b.querySelectorAll("[role=columnheader]");
261
- const currentCell = currentRow == null ? void 0 : currentRow.querySelector(`[role=gridcell][aria-colindex='${this.focusedCell[1] + 1}']`);
262
- const currentHeaderCell = headerCells == null ? void 0 : headerCells.item(this.focusedCell[1]);
238
+ const currentRow = this.tableRef.current?.querySelector(`[aria-rowindex="${this.focusedCell[0] + 1}"]`);
239
+ const headerCells = this.tableRef.current?.querySelectorAll("[role=columnheader]");
240
+ const currentCell = currentRow?.querySelector(`[role=gridcell][aria-colindex='${this.focusedCell[1] + 1}']`);
241
+ const currentHeaderCell = headerCells?.item(this.focusedCell[1]);
263
242
  let changed = true;
264
243
  const newRow = this.focusedCell[0] + rowIndex;
265
244
  const newCol = this.focusedCell[1] + colIndex;
@@ -271,26 +250,26 @@ class DataTableRoot extends Component {
271
250
  }
272
251
  if (!changed) return;
273
252
  const row = this.getRow(newRow);
274
- const cell = row == null ? void 0 : row.querySelector(`:scope > div > [role=gridcell][aria-colindex="${newCol + 1}"]:not([aria-hidden="true"]), :scope > [role=columnheader][aria-colindex="${newCol + 1}"]:not([aria-hidden="true"]), :scope > div > [role=columnheader][aria-colindex="${newCol + 1}"]:not([aria-hidden="true"])`);
253
+ const cell = row?.querySelector(`:scope > div > [role=gridcell][aria-colindex="${newCol + 1}"]:not([aria-hidden="true"]), :scope > [role=columnheader][aria-colindex="${newCol + 1}"]:not([aria-hidden="true"]), :scope > div > [role=columnheader][aria-colindex="${newCol + 1}"]:not([aria-hidden="true"])`);
275
254
  if (cell instanceof HTMLElement && currentCell !== cell) {
276
255
  this.focusedCell = [newRow, newCol];
277
- currentCell == null ? void 0 : currentCell.setAttribute("inert", "");
256
+ currentCell?.setAttribute("inert", "");
278
257
  if (currentCell !== currentHeaderCell) {
279
- currentCell == null ? void 0 : currentCell.removeAttribute("aria-describedby");
258
+ currentCell?.removeAttribute("aria-describedby");
280
259
  }
281
- const headerCell = headerCells == null ? void 0 : headerCells.item(newCol);
282
- const describedBy = headerCell == null ? void 0 : headerCell.getAttribute("aria-describedby");
260
+ const headerCell = headerCells?.item(newCol);
261
+ const describedBy = headerCell?.getAttribute("aria-describedby");
283
262
  cell.removeAttribute("inert");
284
263
  if (headerCell !== cell && describedBy) {
285
264
  cell.setAttribute("aria-describedby", describedBy);
286
265
  }
287
- cell == null ? void 0 : cell.focus({
266
+ cell?.focus({
288
267
  focusVisible: true
289
268
  });
290
269
  if (newRow !== 0) {
291
- currentHeaderCell == null ? void 0 : currentHeaderCell.setAttribute("inert", "");
292
- const headerCell2 = headerCells == null ? void 0 : headerCells.item(newCol);
293
- headerCell2 == null ? void 0 : headerCell2.removeAttribute("inert");
270
+ currentHeaderCell?.setAttribute("inert", "");
271
+ const headerCell2 = headerCells?.item(newCol);
272
+ headerCell2?.removeAttribute("inert");
294
273
  }
295
274
  } else if (cell === null && currentCell instanceof HTMLElement) {
296
275
  let rowI = rowIndex;
@@ -298,20 +277,20 @@ class DataTableRoot extends Component {
298
277
  const colspan = Number(currentCell.getAttribute("aria-colspan"));
299
278
  const rowspan = Number(currentCell.getAttribute("aria-rowspan"));
300
279
  if (direction === "left" || direction === "right") {
301
- if (((_d = (_c = currentCell.parentElement) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.dataset.uiName) === "Collapse") {
280
+ if (currentCell.parentElement?.parentElement?.dataset.uiName === "Collapse") {
302
281
  return;
303
282
  }
304
- if ((limit == null ? void 0 : limit.fromRow) !== void 0 && limit.fromColumn === void 0 && newCol === limit.fromRow) {
283
+ if (limit?.fromRow !== void 0 && limit.fromColumn === void 0 && newCol === limit.fromRow) {
305
284
  return;
306
285
  }
307
286
  const hasRowSpanUpper = row instanceof HTMLElement && Number(row.dataset.filledColumns) < this.columns.length;
308
287
  if (colspan > 0) {
309
- if (direction === "right" && (limit == null ? void 0 : limit.fromColumn) !== void 0 && newCol === limit.fromColumn) {
288
+ if (direction === "right" && limit?.fromColumn !== void 0 && newCol === limit.fromColumn) {
310
289
  rowI = rowI - 1;
311
290
  } else {
312
291
  colI = direction === "left" ? colI - colspan + 1 : colI + colspan - 1;
313
292
  }
314
- } else if (hasRowSpanUpper || direction === "right" && ((limit == null ? void 0 : limit.fromColumn) !== void 0 || (limit == null ? void 0 : limit.fromRow) !== void 0)) {
293
+ } else if (hasRowSpanUpper || direction === "right" && (limit?.fromColumn !== void 0 || limit?.fromRow !== void 0)) {
315
294
  rowI = rowI - 1;
316
295
  } else {
317
296
  colI = direction === "left" ? colI - 1 : colI + 1;
@@ -322,8 +301,8 @@ class DataTableRoot extends Component {
322
301
  } else if (Number(currentCell.getAttribute("aria-colindex")) === 1) {
323
302
  rowI = direction === "up" ? rowI - 1 : rowI + 1;
324
303
  } else {
325
- const areLimitsDefined = (limit == null ? void 0 : limit.fromRow) !== void 0 || (limit == null ? void 0 : limit.fromColumn) !== void 0;
326
- if (areLimitsDefined && newRow > ((limit == null ? void 0 : limit.fromRow) ?? 0) + 1) {
304
+ const areLimitsDefined = limit?.fromRow !== void 0 || limit?.fromColumn !== void 0;
305
+ if (areLimitsDefined && newRow > (limit?.fromRow ?? 0) + 1) {
327
306
  return;
328
307
  }
329
308
  const hasRowSpanUpper = row instanceof HTMLElement && currentRow instanceof HTMLElement && row.dataset.filledColumns !== currentRow.dataset.filledColumns;
@@ -402,8 +381,8 @@ class DataTableRoot extends Component {
402
381
  const roundedScroll = Math.round(scrollLeft);
403
382
  const roundedMaxScroll = Math.round(maxScrollRight);
404
383
  let shadow = "";
405
- if (roundedMaxScroll <= 0) ;
406
- else if (roundedScroll <= 0) {
384
+ if (roundedMaxScroll <= 0) {
385
+ } else if (roundedScroll <= 0) {
407
386
  shadow = "end";
408
387
  } else if (roundedScroll >= roundedMaxScroll) {
409
388
  shadow = "start";
@@ -415,12 +394,11 @@ class DataTableRoot extends Component {
415
394
  });
416
395
  });
417
396
  _defineProperty(this, "handleFocus", (e) => {
418
- var _a, _b, _c, _d, _e;
419
397
  if (this.asProps.loading) {
420
- (_a = this.spinnerRef.current) == null ? void 0 : _a.focus();
398
+ this.spinnerRef.current?.focus();
421
399
  e.currentTarget.setAttribute("tabIndex", "-1");
422
400
  if (this.isDataEmpty) {
423
- (_b = this.headerRef.current) == null ? void 0 : _b.setAttribute("tabIndex", "-1");
401
+ this.headerRef.current?.setAttribute("tabIndex", "-1");
424
402
  }
425
403
  } else if ((!e.relatedTarget || !isFocusInside(e.currentTarget, e.relatedTarget)) && lastInteraction.isKeyboard()) {
426
404
  if (this.focusedCell[0] === -1 && this.focusedCell[1] === -1) {
@@ -433,8 +411,8 @@ class DataTableRoot extends Component {
433
411
  row = this.getRow(this.focusedCell[0]);
434
412
  }
435
413
  if (!row && this.asProps.virtualScroll) {
436
- const firstAvailableCell = (_c = this.tableRef.current) == null ? void 0 : _c.querySelector(`[role="gridcell"]`);
437
- const firstAvailableRow = (_d = firstAvailableCell == null ? void 0 : firstAvailableCell.parentElement) == null ? void 0 : _d.parentElement;
414
+ const firstAvailableCell = this.tableRef.current?.querySelector(`[role="gridcell"]`);
415
+ const firstAvailableRow = firstAvailableCell?.parentElement?.parentElement;
438
416
  if (firstAvailableCell && firstAvailableRow) {
439
417
  const colIndex = Number(firstAvailableCell.getAttribute("aria-colindex") ?? 1) - 1;
440
418
  const rowIndex = Number(firstAvailableRow.getAttribute("aria-rowindex") ?? 1) - 1;
@@ -444,8 +422,8 @@ class DataTableRoot extends Component {
444
422
  }
445
423
  }
446
424
  const colindex = this.focusedCell[1];
447
- const cell = colindex > -1 ? row == null ? void 0 : row.querySelector(`[role=gridcell][aria-colindex="${colindex + 1}"]:not([aria-hidden="true"]), [role=columnheader][aria-colindex="${colindex + 1}"]:not([aria-hidden="true"])`) : void 0;
448
- cell == null ? void 0 : cell.removeAttribute("inert");
425
+ const cell = colindex > -1 ? row?.querySelector(`[role=gridcell][aria-colindex="${colindex + 1}"]:not([aria-hidden="true"]), [role=columnheader][aria-colindex="${colindex + 1}"]:not([aria-hidden="true"])`) : void 0;
426
+ cell?.removeAttribute("inert");
449
427
  if (cell instanceof HTMLElement) {
450
428
  if (hasParent(e.target, cell) && !e.target.dataset.skipTargetFocus) {
451
429
  e.target.focus({
@@ -458,20 +436,19 @@ class DataTableRoot extends Component {
458
436
  }
459
437
  }
460
438
  if (this.isDataEmpty) {
461
- (_e = this.headerRef.current) == null ? void 0 : _e.setAttribute("tabIndex", "-1");
439
+ this.headerRef.current?.setAttribute("tabIndex", "-1");
462
440
  }
463
441
  e.currentTarget.setAttribute("tabIndex", "-1");
464
442
  }
465
443
  });
466
444
  _defineProperty(this, "handleBlur", (e) => {
467
- var _a;
468
445
  const relatedTarget = e.relatedTarget;
469
446
  const tableElement = this.tableRef.current;
470
447
  if (tableElement && (!relatedTarget || !isFocusInside(tableElement, relatedTarget) || !lastInteraction.isKeyboard())) {
471
448
  this.setInert(false);
472
449
  tableElement.setAttribute("tabIndex", "0");
473
450
  if (this.isDataEmpty) {
474
- (_a = this.headerRef.current) == null ? void 0 : _a.setAttribute("tabIndex", "0");
451
+ this.headerRef.current?.setAttribute("tabIndex", "0");
475
452
  }
476
453
  }
477
454
  });
@@ -483,12 +460,11 @@ class DataTableRoot extends Component {
483
460
  this.changeFocusCell(-1, cellIndex === -1 ? 0 : cellIndex, "up");
484
461
  });
485
462
  _defineProperty(this, "handleContainerResizeEnd", (entries, observer) => {
486
- var _a, _b;
487
463
  if (this.containerResizeEndTimeoutId) {
488
464
  clearTimeout(this.containerResizeEndTimeoutId);
489
465
  }
490
466
  this.containerResizeEndTimeoutId = setTimeout(this.calculateVerticalShadow, 0);
491
- (_b = (_a = this.asProps).onResize) == null ? void 0 : _b.call(_a, entries, observer);
467
+ this.asProps.onResize?.(entries, observer);
492
468
  });
493
469
  _defineProperty(this, "getScrollOffsetValue", () => {
494
470
  if (!this.headerRef.current) {
@@ -516,12 +492,11 @@ class DataTableRoot extends Component {
516
492
  }
517
493
  });
518
494
  return this.columns.reduce((acc, column) => {
519
- var _a, _b;
520
495
  if (column.fixed === "left") {
521
- acc[0] += ((_a = this.headerNodesMap.get(column.name)) == null ? void 0 : _a.getBoundingClientRect().width) ?? 0;
496
+ acc[0] += this.headerNodesMap.get(column.name)?.getBoundingClientRect().width ?? 0;
522
497
  }
523
498
  if (column.fixed === "right") {
524
- acc[1] += ((_b = this.headerNodesMap.get(column.name)) == null ? void 0 : _b.getBoundingClientRect().width) ?? 0;
499
+ acc[1] += this.headerNodesMap.get(column.name)?.getBoundingClientRect().width ?? 0;
525
500
  }
526
501
  return acc;
527
502
  }, [0, 0]);
@@ -547,10 +522,7 @@ class DataTableRoot extends Component {
547
522
  };
548
523
  const columnsFixed = this.columns.slice(startIndexSideMap[side], endIndexSideMap[side]);
549
524
  if (columnsFixed.length < 1) return [side, 0];
550
- const sum = columnsFixed.reduce((acc, column) => {
551
- var _a;
552
- return acc + ((_a = this.headerNodesMap.get(column.name)) == null ? void 0 : _a.getBoundingClientRect().width);
553
- }, 0);
525
+ const sum = columnsFixed.reduce((acc, column) => acc + this.headerNodesMap.get(column.name)?.getBoundingClientRect().width, 0);
554
526
  return [side, `${sum}px`];
555
527
  });
556
528
  const cols = this.calculateColumnsFromConfig();
@@ -570,13 +542,13 @@ class DataTableRoot extends Component {
570
542
  headerProps,
571
543
  loading
572
544
  } = this.asProps;
573
- if ((headerProps == null ? void 0 : headerProps.sticky) && !headerProps.h || loading || this.hasFixedColumn) {
545
+ if (headerProps?.sticky && !headerProps.h || loading || this.hasFixedColumn) {
574
546
  requestAnimationFrame(() => {
575
547
  this.forceUpdate();
576
548
  this.calculateVerticalShadow();
577
549
  });
578
550
  }
579
- if ((headerProps == null ? void 0 : headerProps.sticky) && canUseDOM() && this.scrollDirection === "horizontal") {
551
+ if (headerProps?.sticky && canUseDOM() && this.scrollDirection === "horizontal") {
580
552
  document.addEventListener("scroll", this.handleDocumentScroll);
581
553
  }
582
554
  }
@@ -597,33 +569,15 @@ class DataTableRoot extends Component {
597
569
  this.calculateVerticalShadow();
598
570
  }
599
571
  }
600
- if (prevProps.selectedRows !== selectedRows && selectedRows !== void 0 && Array.isArray(selectedRows)) {
601
- const selectedRowsSet = new Set(selectedRows);
602
- const allChecked = [];
603
- const allUnchecked = [];
604
- this.flatRows.forEach((row) => {
605
- if (selectedRowsSet.has(row[UNIQ_ROW_KEY])) {
606
- allChecked.push(row[UNIQ_ROW_KEY]);
607
- } else {
608
- allUnchecked.push(row[UNIQ_ROW_KEY]);
609
- }
610
- });
611
- if (allChecked.length === data.length) {
612
- this.setSelectAllMessage(true);
613
- } else if (allUnchecked.length === data.length) {
614
- this.setSelectAllMessage(false);
615
- }
616
- }
617
572
  if (prevProps.selectedRows !== selectedRows && selectedRows !== void 0 && !Array.isArray(selectedRows)) {
618
573
  this.selectedRowsContainer = selectedRows;
619
574
  }
620
575
  }
621
576
  componentWillUnmount() {
622
- var _a;
623
577
  if (canUseDOM()) {
624
578
  document.removeEventListener("scroll", this.handleDocumentScroll);
625
579
  }
626
- (_a = this.state.expandedRows) == null ? void 0 : _a.clear();
580
+ this.state.expandedRows?.clear();
627
581
  }
628
582
  get totalRows() {
629
583
  const {
@@ -710,7 +664,7 @@ class DataTableRoot extends Component {
710
664
  onSortChange,
711
665
  getI18nText,
712
666
  uid,
713
- ref: (headerProps == null ? void 0 : headerProps.ref) ? forkRef(this.headerRef, headerProps.ref) : this.headerRef,
667
+ ref: headerProps?.ref ? forkRef(this.headerRef, headerProps.ref) : this.headerRef,
714
668
  gridAreaGroupMap: this.gridAreaGroupMap,
715
669
  gridTemplateColumns,
716
670
  gridTemplateAreas,
@@ -769,7 +723,7 @@ class DataTableRoot extends Component {
769
723
  gridTemplateAreas,
770
724
  loading,
771
725
  headerHeight: this.getHeaderHeight(),
772
- stickyHeader: headerProps == null ? void 0 : headerProps.sticky,
726
+ stickyHeader: headerProps?.sticky,
773
727
  getI18nText,
774
728
  expandedRows: this.state.expandedRows,
775
729
  onExpandRow: this.onExpandRow,
@@ -800,9 +754,8 @@ class DataTableRoot extends Component {
800
754
  };
801
755
  }
802
756
  setInert(value) {
803
- var _a;
804
- const cells = (_a = this.tableRef.current) == null ? void 0 : _a.querySelectorAll("[role=gridcell], [role=columnheader]");
805
- cells == null ? void 0 : cells.forEach((cell) => {
757
+ const cells = this.tableRef.current?.querySelectorAll("[role=gridcell], [role=columnheader]");
758
+ cells?.forEach((cell) => {
806
759
  if (value === true) {
807
760
  cell.setAttribute("inert", "");
808
761
  } else {
@@ -812,8 +765,8 @@ class DataTableRoot extends Component {
812
765
  }
813
766
  initFocusableCell(initCell) {
814
767
  const hasFocusable = this.hasFocusableInHeader();
815
- const initRow = (initCell == null ? void 0 : initCell[0]) ?? 0;
816
- const initCol = (initCell == null ? void 0 : initCell[1]) ?? 0;
768
+ const initRow = initCell?.[0] ?? 0;
769
+ const initCol = initCell?.[1] ?? 0;
817
770
  if (hasFocusable) {
818
771
  this.focusedCell = [initRow, initCol];
819
772
  } else {
@@ -836,7 +789,9 @@ class DataTableRoot extends Component {
836
789
  children,
837
790
  headerProps,
838
791
  loading,
839
- selectedRows
792
+ selectedRows,
793
+ getI18nText,
794
+ data
840
795
  } = this.asProps;
841
796
  const [offsetLeftSum, offsetRightSum] = this.getScrollOffsetValue();
842
797
  const {
@@ -844,9 +799,9 @@ class DataTableRoot extends Component {
844
799
  gridTemplateAreas
845
800
  } = this.gridSettings;
846
801
  const Head2 = findComponent(Children, ["DataTable.Head"]);
847
- const headerPropsToCheck = headerProps ?? (Head2 == null ? void 0 : Head2.props);
848
- const headerHeight = (headerProps == null ? void 0 : headerProps.h) || this.getHeaderHeight();
849
- const topOffset = (headerPropsToCheck == null ? void 0 : headerPropsToCheck.sticky) || (headerPropsToCheck == null ? void 0 : headerPropsToCheck.withScrollBar) ? headerHeight : void 0;
802
+ const headerPropsToCheck = headerProps ?? Head2?.props;
803
+ const headerHeight = headerProps?.h || this.getHeaderHeight();
804
+ const topOffset = headerPropsToCheck?.sticky || headerPropsToCheck?.withScrollBar ? headerHeight : void 0;
850
805
  const width = w ?? (this.columns.some((c) => c.gtcWidth === "auto" || c.gtcWidth === "1fr") ? "100%" : void 0);
851
806
  let gridTemplateRows = void 0;
852
807
  if (virtualScroll && typeof virtualScroll !== "boolean" && "rowHeight" in virtualScroll) {
@@ -901,7 +856,7 @@ class DataTableRoot extends Component {
901
856
  "use:hMax": void 0,
902
857
  "use:hMin": void 0
903
858
  }, _ref)
904
- }), children ? /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DataTable.Head, null), /* @__PURE__ */ React.createElement(DataTable.Body, null)))), (headerPropsToCheck == null ? void 0 : headerPropsToCheck.withScrollBar) && topOffset && !loading && /* @__PURE__ */ React.createElement(ScrollArea.Bar, {
859
+ }), children ? /* @__PURE__ */ React.createElement(Children, _ref2.cn("Children", {})) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DataTable.Head, null), /* @__PURE__ */ React.createElement(DataTable.Body, null)))), headerPropsToCheck?.withScrollBar && topOffset && !loading && /* @__PURE__ */ React.createElement(ScrollArea.Bar, {
905
860
  orientation: "horizontal",
906
861
  top: topOffset - SCROLL_BAR_HEIGHT,
907
862
  zIndex: 20
@@ -911,10 +866,15 @@ class DataTableRoot extends Component {
911
866
  }), /* @__PURE__ */ React.createElement(ScrollArea.Bar, {
912
867
  orientation: "vertical",
913
868
  zIndex: 20
914
- })), selectedRows !== void 0 && /* @__PURE__ */ React.createElement(ScreenReaderOnly, _ref2.cn("ScreenReaderOnly", {
915
- "aria-live": "polite",
916
- "role": "status"
917
- }), this.state.selectAllMessage));
869
+ })), selectedRows !== void 0 && !Array.isArray(selectedRows) && /* @__PURE__ */ React.createElement(SRReactiveAnnouncer, _ref2.cn("SRReactiveAnnouncer", {
870
+ "selectedRows": selectedRows,
871
+ "getI18nText": getI18nText
872
+ })), selectedRows !== void 0 && Array.isArray(selectedRows) && /* @__PURE__ */ React.createElement(SRAnnouncer, _ref2.cn("SRAnnouncer", {
873
+ "selectedRows": selectedRows,
874
+ "getI18nText": getI18nText,
875
+ "data": data,
876
+ "flatRows": this.flatRows
877
+ })));
918
878
  }
919
879
  calculateColumnsFromConfig() {
920
880
  const {
@@ -942,13 +902,13 @@ class DataTableRoot extends Component {
942
902
  calculatedColumns.push(column);
943
903
  }
944
904
  const makeColumn = (columnElement, parent, isFirst, isLast, hasGroups) => {
945
- const leftBordersFromParent = isFirst && ((parent == null ? void 0 : parent.borders) === "both" || (parent == null ? void 0 : parent.borders) === "left") ? "left" : void 0;
946
- const rightBordersFromParent = isLast && ((parent == null ? void 0 : parent.borders) === "both" || (parent == null ? void 0 : parent.borders) === "right") ? "right" : void 0;
905
+ const leftBordersFromParent = isFirst && (parent?.borders === "both" || parent?.borders === "left") ? "left" : void 0;
906
+ const rightBordersFromParent = isLast && (parent?.borders === "both" || parent?.borders === "right") ? "right" : void 0;
947
907
  const column = {
948
908
  ...columnElement,
949
909
  name: childIsColumn(columnElement) ? columnElement.name : "",
950
910
  gtcWidth: childIsColumn(columnElement) ? calculateGridTemplateColumn(columnElement) : "",
951
- fixed: columnElement.fixed ?? (hasGroups ? parent == null ? void 0 : parent.fixed : void 0),
911
+ fixed: columnElement.fixed ?? (hasGroups ? parent?.fixed : void 0),
952
912
  borders: columnElement.borders ?? leftBordersFromParent ?? rightBordersFromParent,
953
913
  parent
954
914
  };
@@ -992,7 +952,6 @@ class DataTableRoot extends Component {
992
952
  Group.columns = [];
993
953
  Group.children = child.children;
994
954
  child.columns.forEach((child2, j) => {
995
- var _a;
996
955
  const isFirst = j === 0;
997
956
  const isLast = j === childCount - 1;
998
957
  const col = makeColumn(child2, Group, isFirst, isLast, this.hasGroups);
@@ -1008,7 +967,7 @@ class DataTableRoot extends Component {
1008
967
  if (isFirst && i > 0) {
1009
968
  setShowShadows(col, i);
1010
969
  }
1011
- (_a = Group.columns) == null ? void 0 : _a.push(col);
970
+ Group.columns?.push(col);
1012
971
  });
1013
972
  treeColumns.push(Group);
1014
973
  this.gridAreaGroupMap.set(groupIndex, `1 / ${initGridColumn} / 2 / ${gridColumnIndex}`);
@@ -1091,7 +1050,7 @@ class DataTableRoot extends Component {
1091
1050
  columns2.delete(value2);
1092
1051
  });
1093
1052
  }
1094
- if (value == null ? void 0 : value[ACCORDION]) {
1053
+ if (value?.[ACCORDION]) {
1095
1054
  accordionInCell = value[ACCORDION];
1096
1055
  }
1097
1056
  return acc;
@@ -1107,7 +1066,7 @@ class DataTableRoot extends Component {
1107
1066
  } else if (accordionInCell) {
1108
1067
  gridRowIndex++;
1109
1068
  }
1110
- excludeColumns == null ? void 0 : excludeColumns.forEach((value) => {
1069
+ excludeColumns?.forEach((value) => {
1111
1070
  columns2.delete(value);
1112
1071
  });
1113
1072
  if (columns2.size > 0) {
@@ -1141,7 +1100,6 @@ class DataTableRoot extends Component {
1141
1100
  [ROW_INDEX]: -1
1142
1101
  });
1143
1102
  groupedRows.forEach((childRow, index) => {
1144
- var _a, _b;
1145
1103
  let dtRow;
1146
1104
  if (index === 0) {
1147
1105
  const rowData = {
@@ -1152,7 +1110,7 @@ class DataTableRoot extends Component {
1152
1110
  dtRow[ROW_GROUP] = /* @__PURE__ */ new Set();
1153
1111
  } else {
1154
1112
  dtRow = makeDtRow(childRow, groupedKeys);
1155
- (_b = (_a = innerRows[0]) == null ? void 0 : _a[ROW_GROUP]) == null ? void 0 : _b.add(dtRow[UNIQ_ROW_KEY]);
1113
+ innerRows[0]?.[ROW_GROUP]?.add(dtRow[UNIQ_ROW_KEY]);
1156
1114
  }
1157
1115
  innerRows.push(dtRow);
1158
1116
  if (index === groupedRows.length - 1 && row[ACCORDION]) {
@@ -1161,7 +1119,7 @@ class DataTableRoot extends Component {
1161
1119
  rowIndex++;
1162
1120
  });
1163
1121
  rows.push(innerRows);
1164
- } else if ((groupedRows == null ? void 0 : groupedRows.length) === 1) {
1122
+ } else if (groupedRows?.length === 1) {
1165
1123
  const dtRow = makeDtRow({
1166
1124
  ...groupedRows[0],
1167
1125
  ...row
@@ -1184,15 +1142,14 @@ class DataTableRoot extends Component {
1184
1142
  return (/* @__PURE__ */ React.isValidElement(c) ? c.props.gtcWidth : c.gtcWidth) ?? this.props.defaultGridTemplateColumnWidth;
1185
1143
  }
1186
1144
  getHeaderHeight() {
1187
- var _a, _b, _c;
1188
- const header = (_a = this.headerRef.current) == null ? void 0 : _a.children;
1145
+ const header = this.headerRef.current?.children;
1189
1146
  let height = 0;
1190
- for (let i = 0; i < ((header == null ? void 0 : header.length) ?? 0); i++) {
1191
- const item = header == null ? void 0 : header.item(i);
1192
- let columnHeight = item == null ? void 0 : item.getBoundingClientRect().height;
1147
+ for (let i = 0; i < (header?.length ?? 0); i++) {
1148
+ const item = header?.item(i);
1149
+ let columnHeight = item?.getBoundingClientRect().height;
1193
1150
  if (item instanceof HTMLElement && item.dataset.groupContainer) {
1194
- const groupHeight = ((_b = item.children.item(0)) == null ? void 0 : _b.getBoundingClientRect().height) ?? 0;
1195
- const cellHeight = ((_c = item.children.item(1)) == null ? void 0 : _c.getBoundingClientRect().height) ?? 0;
1151
+ const groupHeight = item.children.item(0)?.getBoundingClientRect().height ?? 0;
1152
+ const cellHeight = item.children.item(1)?.getBoundingClientRect().height ?? 0;
1196
1153
  columnHeight = groupHeight + cellHeight;
1197
1154
  }
1198
1155
  if (columnHeight) {