@economic/taco 1.20.0 → 1.21.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 (37) hide show
  1. package/dist/components/Provider/Localization.d.ts +21 -5
  2. package/dist/components/Table2/Table2.d.ts +21 -5
  3. package/dist/components/Table2/components/row/Context.d.ts +3 -2
  4. package/dist/components/Table2/hooks/useTable.d.ts +2 -1
  5. package/dist/components/Table2/types.d.ts +2 -1
  6. package/dist/esm/packages/taco/src/components/Provider/Localization.js +21 -5
  7. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/Table2/components/ShortcutsGuideButton.js +20 -14
  10. package/dist/esm/packages/taco/src/components/Table2/components/ShortcutsGuideButton.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +60 -42
  12. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js +3 -3
  14. package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js +7 -7
  16. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js +2 -2
  18. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js +3 -3
  20. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +4 -1
  22. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js +5 -1
  24. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Table2/hooks/useSeparatedChildren.js +2 -1
  26. package/dist/esm/packages/taco/src/components/Table2/hooks/useSeparatedChildren.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +4 -2
  28. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Table2/types.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +15 -13
  31. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +1 -1
  32. package/dist/taco.cjs.development.js +145 -94
  33. package/dist/taco.cjs.development.js.map +1 -1
  34. package/dist/taco.cjs.production.min.js +1 -1
  35. package/dist/taco.cjs.production.min.js.map +1 -1
  36. package/package.json +2 -2
  37. package/types.json +99 -22
@@ -3635,11 +3635,27 @@ const defaultLocalisationTexts = {
3635
3635
  loading: 'Loading...'
3636
3636
  },
3637
3637
  table2: {
3638
- rowWillMove: 'Row will move',
3639
- rowWillBeFiltered: 'Row will be filtered',
3640
- searchFilterMovementReason: 'Due to global search filter applied on the table, this row will be hidden after editing',
3641
- tableFilterMovementReason: 'Due to a filter applied on the [COLUMN] column, this row will be hidden after editing',
3642
- sortingMovementReason: 'Due to sorting applied on the [COLUMN] column, this row will move position after editing'
3638
+ shortcuts: {
3639
+ search: 'Search',
3640
+ filter: 'Filter',
3641
+ previousRow: 'Previous row',
3642
+ nextRow: 'Next row',
3643
+ editCell: 'Edit cell',
3644
+ previousColumn: 'Previous column',
3645
+ nextColumn: 'Next column',
3646
+ rowClick: 'Activate current row',
3647
+ selectRow: 'Select current row',
3648
+ selectAllRows: 'Select all rows',
3649
+ expandRow: 'Expand current row',
3650
+ collapseRow: 'Collapse current row'
3651
+ },
3652
+ rowIndicator: {
3653
+ rowWillMove: 'Row will move due to sorting',
3654
+ rowWillBeFiltered: 'Row will hide due to filtering',
3655
+ searchFilterMovementReason: 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',
3656
+ tableFilterMovementReason: "Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row",
3657
+ sortingMovementReason: "Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row"
3658
+ }
3643
3659
  },
3644
3660
  select: {
3645
3661
  allOptionsSelected: 'All'
@@ -10562,31 +10578,34 @@ function createRowExpansionColumn() {
10562
10578
  const getActionPropertyValue = (property, row) => typeof property === 'function' ? property(row) : property;
10563
10579
  function RowActionCell({
10564
10580
  row,
10565
- table,
10566
10581
  actions,
10567
10582
  moreActions
10568
10583
  }) {
10569
10584
  const isVisible = action => typeof action.visible !== 'undefined' ? typeof action.visible === 'function' ? action.visible(row.original) : action.visible : true;
10570
10585
  const visibleActions = actions.filter(isVisible);
10571
10586
  const visibleMoreActions = moreActions.filter(isVisible);
10572
- if (table.options.meta.activeRowIndex !== row.index && table.options.meta.hoveredRowIndex !== row.index) {
10587
+ const rowActionCellWidth = React__default.useMemo(() => {
10573
10588
  const totalButtons = visibleActions.length + (visibleMoreActions.length ? 1 : 0);
10574
10589
  // this is necessary because row actions is has this mount hover delay, which makes the
10575
10590
  // size calculation in the header get set before rendering - meaning the size doesn't include the buttons
10576
10591
  // when we cache icons this can go
10577
10592
  const paddingSize = 8;
10578
10593
  const buttonSize = 32;
10579
- return /*#__PURE__*/React__default.createElement("span", {
10580
- className: "flex",
10581
- style: {
10582
- width: paddingSize + totalButtons * buttonSize
10583
- }
10584
- });
10585
- }
10594
+ return paddingSize + totalButtons * buttonSize;
10595
+ }, [visibleActions.length, visibleMoreActions.length]);
10596
+ // Instead of relying on row.index to figure out whether the row is being hovered or is active. We should rely on a
10597
+ // CSS fix. The reason behind this is that row data or index is the initial data or index that is passed to the
10598
+ // table on the first render, the indexes of row changes when sorting or filtering is applied.
10599
+ // If the row is not the active row or the hovered row then actions are hidden.
10600
+ const actionClassName = 'group-hover/row:flex group-[[aria-current]]/row:flex hidden';
10586
10601
  return /*#__PURE__*/React__default.createElement("span", {
10587
- className: "-mb-2 -mt-1.5 text-right"
10602
+ className: "-mb-2 -mt-1.5 flex justify-end text-right",
10603
+ style: {
10604
+ width: rowActionCellWidth
10605
+ }
10588
10606
  }, visibleActions.map((action, i) => /*#__PURE__*/React__default.createElement(IconButton, {
10589
10607
  key: i,
10608
+ className: actionClassName,
10590
10609
  "aria-label": getActionPropertyValue(action.ariaLabel, row.original),
10591
10610
  appearance: "discrete",
10592
10611
  dialog: action.dialog ? action.dialog(row.original) : undefined,
@@ -10600,6 +10619,7 @@ function RowActionCell({
10600
10619
  },
10601
10620
  tooltip: getActionPropertyValue(action.text, row.original)
10602
10621
  })), visibleMoreActions.length ? /*#__PURE__*/React__default.createElement(IconButton, {
10622
+ className: actionClassName,
10603
10623
  "aria-label": "View other actions",
10604
10624
  appearance: "discrete",
10605
10625
  icon: "more",
@@ -10626,11 +10646,9 @@ function createRowActionsColumn(rowActions) {
10626
10646
  return {
10627
10647
  id: COLUMN_ID_FOR_ACTIONS,
10628
10648
  cell: ({
10629
- row,
10630
- table
10649
+ row
10631
10650
  }) => /*#__PURE__*/React__default.createElement(RowActionCell, {
10632
10651
  row: row,
10633
- table: table,
10634
10652
  actions: actions,
10635
10653
  moreActions: moreActions
10636
10654
  }),
@@ -10966,8 +10984,8 @@ const getNextIndex = (direction, currentIndex, focussableColumnIndexes) => {
10966
10984
  const RowContext = /*#__PURE__*/React__default.createContext({
10967
10985
  validationErrors: null,
10968
10986
  setValidationErrors: () => undefined,
10969
- isRowIndicatorVisible: false,
10970
- setIsRowIndicatorVisible: () => undefined
10987
+ rowMoveReason: {},
10988
+ setRowMoveReason: () => undefined
10971
10989
  });
10972
10990
  const useRowContext = () => {
10973
10991
  const context = React__default.useContext(RowContext);
@@ -11001,16 +11019,16 @@ const useIndicatorText = reason => {
11001
11019
  } = useLocalization();
11002
11020
  switch (reason) {
11003
11021
  case IndicatorReason.SEARCH:
11004
- title = tableTexts.rowWillBeFiltered;
11005
- description = tableTexts.searchFilterMovementReason;
11022
+ title = tableTexts.rowIndicator.rowWillBeFiltered;
11023
+ description = tableTexts.rowIndicator.searchFilterMovementReason;
11006
11024
  break;
11007
11025
  case IndicatorReason.SORTING:
11008
- title = tableTexts.rowWillMove;
11009
- description = tableTexts.sortingMovementReason;
11026
+ title = tableTexts.rowIndicator.rowWillMove;
11027
+ description = tableTexts.rowIndicator.sortingMovementReason;
11010
11028
  break;
11011
11029
  case IndicatorReason.FILTER:
11012
- title = tableTexts.rowWillBeFiltered;
11013
- description = tableTexts.tableFilterMovementReason;
11030
+ title = tableTexts.rowIndicator.rowWillBeFiltered;
11031
+ description = tableTexts.rowIndicator.tableFilterMovementReason;
11014
11032
  break;
11015
11033
  }
11016
11034
  return {
@@ -11025,7 +11043,7 @@ const Indicator = ({
11025
11043
  }) => {
11026
11044
  const container = React__default.useMemo(() => {
11027
11045
  const element = document.createElement('div');
11028
- element.className += '-translate-y-1/2 z-[13] rounded-full items-center wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap px-1 py-0.5 text-xs font-bold shadow-sm';
11046
+ element.className += '-translate-y-1/2 z-[3] rounded-full items-center wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap px-1 py-0.5 text-xs font-bold shadow-sm';
11029
11047
  return element;
11030
11048
  }, []);
11031
11049
  const indicatorText = useIndicatorText(reason);
@@ -11147,7 +11165,7 @@ const Cell = function Cell(props) {
11147
11165
  } = meta;
11148
11166
  const {
11149
11167
  validationErrors,
11150
- isRowIndicatorVisible
11168
+ rowMoveReason
11151
11169
  } = useRowContext();
11152
11170
  const hasValidationErrorsInRow = !!validationErrors;
11153
11171
  const internalRef = React__default.useRef(null);
@@ -11168,19 +11186,10 @@ const Cell = function Cell(props) {
11168
11186
  const canEditThisCell = isEditingThisRow && isDataColumn;
11169
11187
  const isEditingThisCell = canEditThisCell && meta.editMode.columnIndex === index;
11170
11188
  const isHoveringThisRowWhileEditing = meta.editMode.isEditing && isHoveredRow;
11171
- // ensure the active row is always visible
11172
- React__default.useEffect(() => {
11173
- if (isActiveRow && internalRef.current) {
11174
- internalRef.current.scrollIntoView({
11175
- behavior: 'smooth',
11176
- block: 'nearest',
11177
- inline: 'nearest'
11178
- });
11179
- }
11180
- }, [isActiveRow, hasValidationErrorsInRow]);
11189
+ const isIndicatorVisible = Object.keys(rowMoveReason).length > 0;
11181
11190
  React__default.useEffect(() => {
11182
11191
  // Adds padding to the table so that indicator doesn't get cropped
11183
- if (isRowIndicatorVisible && meta.activeRowIndex === rows.length - 1) {
11192
+ if (isIndicatorVisible && isLastRow) {
11184
11193
  var _tableRef$current;
11185
11194
  (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.classList.add('pb-4');
11186
11195
  }
@@ -11188,10 +11197,10 @@ const Cell = function Cell(props) {
11188
11197
  var _tableRef$current2;
11189
11198
  return (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.classList.remove('pb-4');
11190
11199
  };
11191
- }, [isRowIndicatorVisible]);
11200
+ }, [isIndicatorVisible, isLastRow]);
11192
11201
  const className = cn({
11193
11202
  'border-b': !isLastRow,
11194
- 'sticky z-10': isPinned,
11203
+ 'sticky z-[1]': isPinned,
11195
11204
  // use isHoveredRow rather than css group-hover/row because we want to hide hover state when keyboard navigating
11196
11205
  'bg-white': !isActiveRow && !isSelected && !isHoveredRow,
11197
11206
  'bg-grey-100': !isActiveRow && !isSelected && isHoveredRow,
@@ -11200,11 +11209,13 @@ const Cell = function Cell(props) {
11200
11209
  '!wcag-blue-500': isDragging,
11201
11210
  '[&>*]:!grayscale [&_.bg-white]:!bg-grey-100': !isEditingThisRow && isHoveringThisRowWhileEditing,
11202
11211
  '!bg-red-100': hasValidationErrorsInRow,
11203
- 'z-[11]': isPinned && isActiveRow,
11204
- 'z-[12]': isPinned && isActiveRow && index === 0,
11205
- 'border-blue !border-y-2 border-x-0': isRowIndicatorVisible,
11206
- 'border-l-2 rounded-l': isRowIndicatorVisible && index === 0,
11207
- 'border-r-2 rounded-r': isRowIndicatorVisible && index === lastColumnIndex
11212
+ 'z-[1]': isPinned && isActiveRow,
11213
+ // First column should have higher z-index so that row indicator always show on top of the cell
11214
+ // control components.
11215
+ 'z-[2]': isPinned && isActiveRow && index === 0,
11216
+ 'border-blue !border-y-2 border-x-0': isIndicatorVisible,
11217
+ 'border-l-2 rounded-l': isIndicatorVisible && index === 0,
11218
+ 'border-r-2 rounded-r': isIndicatorVisible && index === lastColumnIndex
11208
11219
  }, getCellSizingClasses((_table$options$meta = table.options.meta) === null || _table$options$meta === void 0 ? void 0 : _table$options$meta.rowDensity, (isEditingThisRow || isHoveringThisRowWhileEditing) && hasCellControl), typeof cellClassName === 'function' ? cellClassName(cell.row) : cellClassName);
11209
11220
  const handleMouseDown = event => {
11210
11221
  // only detect left clicks
@@ -11241,6 +11252,9 @@ const Cell = function Cell(props) {
11241
11252
  role: 'cell'
11242
11253
  };
11243
11254
  const [detailModeEditing, setDetailModeEditing] = React__default.useState(false);
11255
+ const detailModeClassName = cn({
11256
+ '!shadow-[0_0_0_4px_rgba(0,99,255,0.25)]': detailModeEditing
11257
+ });
11244
11258
  // reset the editing state when we move column
11245
11259
  React__default.useEffect(() => {
11246
11260
  if (meta.editMode.columnIndex !== index) {
@@ -11295,11 +11309,7 @@ const Cell = function Cell(props) {
11295
11309
  if (event.key === 'Enter') {
11296
11310
  event.preventDefault();
11297
11311
  const input = control;
11298
- if (detailModeEditing) {
11299
- var _input$select;
11300
- input === null || input === void 0 ? void 0 : (_input$select = input.select) === null || _input$select === void 0 ? void 0 : _input$select.call(input);
11301
- setDetailModeEditing(false);
11302
- } else {
11312
+ if (!detailModeEditing) {
11303
11313
  var _input$setSelectionRa, _input$value, _input$value2;
11304
11314
  (_input$setSelectionRa = input.setSelectionRange) === null || _input$setSelectionRa === void 0 ? void 0 : _input$setSelectionRa.call(input, (_input$value = input.value) === null || _input$value === void 0 ? void 0 : _input$value.length, (_input$value2 = input.value) === null || _input$value2 === void 0 ? void 0 : _input$value2.length);
11305
11315
  setDetailModeEditing(true);
@@ -11309,10 +11319,17 @@ const Cell = function Cell(props) {
11309
11319
  }
11310
11320
  // Don't exit edit mode if the target of the escape isn't a child of the cell (e.g. if its a popover).
11311
11321
  if (event.key === 'Escape' && event.currentTarget.contains(control)) {
11312
- var _tableRef$current3;
11313
11322
  event.preventDefault();
11314
- meta.editMode.toggleEditing(false);
11315
- (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : _tableRef$current3.focus();
11323
+ const input = control;
11324
+ if (detailModeEditing) {
11325
+ var _input$select;
11326
+ input === null || input === void 0 ? void 0 : (_input$select = input.select) === null || _input$select === void 0 ? void 0 : _input$select.call(input);
11327
+ setDetailModeEditing(false);
11328
+ } else {
11329
+ var _tableRef$current3;
11330
+ meta.editMode.toggleEditing(false);
11331
+ (_tableRef$current3 = tableRef.current) === null || _tableRef$current3 === void 0 ? void 0 : _tableRef$current3.focus();
11332
+ }
11316
11333
  return;
11317
11334
  }
11318
11335
  if (!detailModeEditing && event.key === 'ArrowLeft' || event.key === 'Tab' && event.shiftKey) {
@@ -11337,7 +11354,6 @@ const Cell = function Cell(props) {
11337
11354
  }
11338
11355
  if (!detailModeEditing && event.key === 'ArrowRight' || event.key === 'Tab' && !event.shiftKey) {
11339
11356
  event.preventDefault();
11340
- const isLastRow = rowIndex === rows.length - 1;
11341
11357
  const isLastColumn = index === lastDataColumnIndex;
11342
11358
  if (event.ctrlKey || event.metaKey) {
11343
11359
  // If the current active column is the last column then we don't do any thing so that focus
@@ -11390,6 +11406,7 @@ const Cell = function Cell(props) {
11390
11406
  };
11391
11407
  }
11392
11408
  return /*#__PURE__*/React__default.createElement(ColumnBase, Object.assign({}, attributes), /*#__PURE__*/React__default.createElement(EditingCell, {
11409
+ detailModeClassName: detailModeClassName,
11393
11410
  cell: cell,
11394
11411
  cellRef: internalRef,
11395
11412
  columnIndex: index,
@@ -11414,11 +11431,12 @@ const Cell = function Cell(props) {
11414
11431
  }, reactTable$1.flexRender(cell.column.columnDef.cell, cell.getContext())));
11415
11432
  };
11416
11433
  const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__default.forwardRef((props, ref) => {
11417
- var _cell$column$columnDe4, _cell$column$columnDe5, _cellRef$current, _cellRef$current$pare;
11434
+ var _cell$column$columnDe4, _cell$column$columnDe5, _cellRef$current, _cellRef$current$pare, _rowMoveReason$cellId;
11418
11435
  const {
11419
11436
  cell,
11420
11437
  cellRef,
11421
11438
  columnIndex,
11439
+ detailModeClassName,
11422
11440
  isEditingThisCell = false,
11423
11441
  onSave: handleSave,
11424
11442
  rowIndex,
@@ -11428,7 +11446,8 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11428
11446
  const {
11429
11447
  validationErrors,
11430
11448
  setValidationErrors,
11431
- setIsRowIndicatorVisible
11449
+ rowMoveReason,
11450
+ setRowMoveReason
11432
11451
  } = useRowContext();
11433
11452
  const controlRef = useMergedRef(ref);
11434
11453
  const cellId = cell.column.id;
@@ -11440,7 +11459,6 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11440
11459
  globalFilter
11441
11460
  } = table.getState();
11442
11461
  const [state, setState] = React__default.useState(value);
11443
- const [rowMoveReason, setRowMoveReason] = React__default.useState(null);
11444
11462
  const isHoveringAnotherRowWhileEditing = meta.editMode.isEditing && meta.activeRowIndex !== rowIndex && meta.hoveredRowIndex === rowIndex;
11445
11463
  const showValidationError = !isHoveringAnotherRowWhileEditing && !!cellValidationError;
11446
11464
  // On each save, the initialValue will be set to the new value of the cell
@@ -11463,6 +11481,15 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11463
11481
  [cellId]: newValue
11464
11482
  };
11465
11483
  return Promise.resolve(handleSave(updatedRow, cellId)).then(function () {
11484
+ // If sorting is paused then update the last sorted or filtered rows to store the newly updated row
11485
+ if (meta.shouldPauseSortingAndFiltering) {
11486
+ meta.lastSortedOrFilteredRows.current = meta.lastSortedOrFilteredRows.current.map(row => {
11487
+ if (row.id === cell.row.id) {
11488
+ row.original = updatedRow;
11489
+ }
11490
+ return row;
11491
+ });
11492
+ }
11466
11493
  // Reset error if save was successful
11467
11494
  setValidationErrors(null);
11468
11495
  });
@@ -11509,7 +11536,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11509
11536
  }, [state]);
11510
11537
  const showIndicator = () => {
11511
11538
  var _table$getState$sorti;
11512
- let willRowMoveReason = undefined;
11539
+ let willRowMoveReason = null;
11513
11540
  const isFilteredByGlobalFilter = Object.values({
11514
11541
  ...rowValues,
11515
11542
  [cellId]: state
@@ -11524,15 +11551,21 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11524
11551
  } else if (!willRowMoveReason && cell.column.getIsSorted() && willRowMoveAfterSorting(state, cell, rowIndex, table.getRowModel().rows, !!((_table$getState$sorti = table.getState().sorting.find(s => s.id === cell.column.id)) !== null && _table$getState$sorti !== void 0 && _table$getState$sorti.desc))) {
11525
11552
  willRowMoveReason = IndicatorReason.SORTING;
11526
11553
  }
11527
- if (willRowMoveReason !== undefined) {
11554
+ if (willRowMoveReason !== null) {
11528
11555
  meta.setShouldPauseSortingAndFiltering(true);
11529
- setRowMoveReason(willRowMoveReason);
11530
- setIsRowIndicatorVisible(true);
11556
+ setRowMoveReason({
11557
+ [cellId]: willRowMoveReason
11558
+ });
11531
11559
  }
11532
11560
  };
11533
11561
  const hideIndicator = () => {
11534
- setRowMoveReason(null);
11535
- setIsRowIndicatorVisible(false);
11562
+ setRowMoveReason(prevState => {
11563
+ const newState = {
11564
+ ...prevState
11565
+ };
11566
+ delete newState[cellId];
11567
+ return newState;
11568
+ });
11536
11569
  };
11537
11570
  const cellControl = (_cell$column$columnDe4 = cell.column.columnDef.meta) === null || _cell$column$columnDe4 === void 0 ? void 0 : _cell$column$columnDe4.control;
11538
11571
  const attributes = {
@@ -11557,12 +11590,14 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11557
11590
  ref: controlRef,
11558
11591
  setValue: setState,
11559
11592
  value: state,
11560
- 'data-inline-editing-component': 'true'
11593
+ 'data-inline-editing-component': 'true',
11594
+ className: detailModeClassName
11561
11595
  }, cell.row.original);
11562
11596
  } else {
11563
11597
  switch (cellControl) {
11564
11598
  case 'datepicker':
11565
11599
  controlComponent = /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, attributes, {
11600
+ className: detailModeClassName,
11566
11601
  onBlur: event => {
11567
11602
  const newDate = event.detail;
11568
11603
  saveIfChanged(newDate);
@@ -11576,7 +11611,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11576
11611
  break;
11577
11612
  case 'switch':
11578
11613
  controlComponent = /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, attributes, {
11579
- className: "mx-2",
11614
+ className: cn('mx-2', detailModeClassName),
11580
11615
  checked: Boolean(state),
11581
11616
  onChange: setState,
11582
11617
  ref: controlRef
@@ -11584,7 +11619,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11584
11619
  break;
11585
11620
  default:
11586
11621
  controlComponent = /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
11587
- className: className,
11622
+ className: cn(className, detailModeClassName),
11588
11623
  onChange: event => {
11589
11624
  setState(event.target.value);
11590
11625
  },
@@ -11595,8 +11630,9 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11595
11630
  }
11596
11631
  }
11597
11632
  }
11598
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !!rowMoveReason && /*#__PURE__*/React__default.createElement(Indicator, {
11599
- reason: rowMoveReason,
11633
+ const indicatorReason = (_rowMoveReason$cellId = rowMoveReason[cellId]) !== null && _rowMoveReason$cellId !== void 0 ? _rowMoveReason$cellId : null;
11634
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, indicatorReason !== null && /*#__PURE__*/React__default.createElement(Indicator, {
11635
+ reason: indicatorReason,
11600
11636
  columnName: String(cell.column.columnDef.header),
11601
11637
  mountNode: indicatorMountNode
11602
11638
  }), /*#__PURE__*/React__default.createElement("span", {
@@ -11617,9 +11653,9 @@ const Header$1 = function Header(props) {
11617
11653
  const textRef = React__default.useRef(null);
11618
11654
  const pinned = !!header.column.getIsPinned();
11619
11655
  const isOtherColumnBeingResized = table.getState().columnSizingInfo.isResizingColumn && table.getState().columnSizingInfo.isResizingColumn !== header.id;
11620
- const className = cn('group/header sticky top-0 bg-white border-b-2 relative font-bold z-[15] hover:z-[16]', {
11621
- 'z-[16]': header.column.getIsResizing(),
11622
- 'z-[17]': pinned,
11656
+ const className = cn('group/header sticky top-0 bg-white border-b-2 relative font-bold z-[5] hover:z-[6]', {
11657
+ 'z-[6]': header.column.getIsResizing(),
11658
+ 'z-[7]': pinned,
11623
11659
  'cursor-pointer select-none': header.column.getCanSort(),
11624
11660
  'hover:bg-grey-100': header.column.getCanSort() || header.column.getCanResize() || ((_header$column$column = header.column.columnDef.meta) === null || _header$column$column === void 0 ? void 0 : _header$column$column.menu),
11625
11661
  'pointer-events-none': isOtherColumnBeingResized
@@ -11808,10 +11844,13 @@ function useColumnDefinitions(children, options, tableRef) {
11808
11844
  accessorKey: child.props.accessor,
11809
11845
  id: child.props.accessor,
11810
11846
  cell: props => {
11847
+ var _props$getValue;
11811
11848
  if (typeof child.props.renderer === 'function') {
11812
11849
  return child.props.renderer(props.getValue(), props.row.original);
11813
11850
  }
11814
- return props.getValue();
11851
+ // If value is undefined then return null because cell is a react component, and undefined is not
11852
+ // a valid child value.
11853
+ return (_props$getValue = props.getValue()) !== null && _props$getValue !== void 0 ? _props$getValue : null;
11815
11854
  },
11816
11855
  header: child.props.header,
11817
11856
  meta: {
@@ -12039,6 +12078,7 @@ function useTable$1(children, props, ref) {
12039
12078
  enableMultipleRowSelection,
12040
12079
  onRowDrag
12041
12080
  }, ref);
12081
+ const lastSortedOrFilteredRows = React__default.useRef(null);
12042
12082
  // defaults
12043
12083
  const initialState = {
12044
12084
  columnOrder: (_settings$columnOrder = settings === null || settings === void 0 ? void 0 : settings.columnOrder) !== null && _settings$columnOrder !== void 0 ? _settings$columnOrder : columns.map(column => column.id),
@@ -12155,11 +12195,12 @@ function useTable$1(children, props, ref) {
12155
12195
  focussableColumnIndexes.current = [];
12156
12196
  },
12157
12197
  // table ref
12158
- tableRef: ref
12198
+ tableRef: ref,
12199
+ // last sorted or filtered rows
12200
+ lastSortedOrFilteredRows
12159
12201
  }
12160
12202
  });
12161
12203
  const tableRows = table.getRowModel().rows;
12162
- const lastSortedOrFilteredRows = React__default.useRef(tableRows);
12163
12204
  if (!shouldPauseSortingAndFiltering) {
12164
12205
  lastSortedOrFilteredRows.current = tableRows;
12165
12206
  }
@@ -12221,7 +12262,10 @@ const useVirtualiser = ({
12221
12262
  };
12222
12263
 
12223
12264
  const useGridTemplate = table => {
12265
+ var _table$options$meta$t, _table$options$meta, _table$options$meta$t2, _table$options$meta$t3, _table$options$meta2, _table$options$meta2$;
12224
12266
  const allVisibleColumns = table.getVisibleLeafColumns();
12267
+ let scrollbarWidth = ((_table$options$meta$t = (_table$options$meta = table.options.meta) === null || _table$options$meta === void 0 ? void 0 : (_table$options$meta$t2 = _table$options$meta.tableRef.current) === null || _table$options$meta$t2 === void 0 ? void 0 : _table$options$meta$t2.offsetWidth) !== null && _table$options$meta$t !== void 0 ? _table$options$meta$t : 0) - ((_table$options$meta$t3 = (_table$options$meta2 = table.options.meta) === null || _table$options$meta2 === void 0 ? void 0 : (_table$options$meta2$ = _table$options$meta2.tableRef.current) === null || _table$options$meta2$ === void 0 ? void 0 : _table$options$meta2$.clientWidth) !== null && _table$options$meta$t3 !== void 0 ? _table$options$meta$t3 : 0);
12268
+ scrollbarWidth = scrollbarWidth < 0 ? 0 : scrollbarWidth;
12225
12269
  return allVisibleColumns.reduce((accum, column, index) => {
12226
12270
  let size;
12227
12271
  const isLastColumn = index === allVisibleColumns.length - 1;
@@ -12232,7 +12276,8 @@ const useGridTemplate = table => {
12232
12276
  size = `${column.getSize()}px`;
12233
12277
  } else if (width) {
12234
12278
  if (isLastColumn) {
12235
- size = `minmax(${width}px, auto)`;
12279
+ // Remove the scrollbar width from the last column
12280
+ size = `minmax(${width - scrollbarWidth}px, auto)`;
12236
12281
  } else if (column.columnDef.minSize && width < column.columnDef.minSize) {
12237
12282
  // react-table is supposed to handle minSize itself but it is really buggy
12238
12283
  size = `${column.columnDef.minSize}px`;
@@ -12647,7 +12692,8 @@ const useSeparatedChildren$1 = initialChildren => {
12647
12692
  return React__default.useMemo(() => {
12648
12693
  const columns = [];
12649
12694
  let toolbar;
12650
- React__default.Children.toArray(initialChildren).forEach(child => {
12695
+ React__default.Children.toArray(initialChildren).filter(child => !!child) // skip falsey columns
12696
+ .forEach(child => {
12651
12697
  var _child$type, _child$type2;
12652
12698
  if (((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === 'Table2Column') {
12653
12699
  columns.push(child);
@@ -12754,7 +12800,7 @@ const Row$1 = ({
12754
12800
  const isActiveRow = meta.activeRowIndex === rowIndex;
12755
12801
  const isDragging = meta.dragging[row.id];
12756
12802
  const [validationErrors, setValidationErrors] = React__default.useState(null);
12757
- const [isRowIndicatorVisible, setIsRowIndicatorVisible] = React__default.useState(false);
12803
+ const [rowMoveReason, setRowMoveReason] = React__default.useState({});
12758
12804
  // This effect aims to focus the first focussable cell when edit mode is turned on.
12759
12805
  React__default.useEffect(() => {
12760
12806
  var _meta$tableRef$curren;
@@ -12784,8 +12830,8 @@ const Row$1 = ({
12784
12830
  return /*#__PURE__*/React__default.createElement(RowProvider, {
12785
12831
  validationErrors: validationErrors,
12786
12832
  setValidationErrors: handleSetValidationErrors,
12787
- isRowIndicatorVisible: isRowIndicatorVisible,
12788
- setIsRowIndicatorVisible: setIsRowIndicatorVisible
12833
+ rowMoveReason: rowMoveReason,
12834
+ setRowMoveReason: setRowMoveReason
12789
12835
  }, /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
12790
12836
  role: "row",
12791
12837
  draggable: true,
@@ -13210,63 +13256,68 @@ const ShortcutsGuideButton = ({
13210
13256
  table
13211
13257
  }) => {
13212
13258
  const meta = table.options.meta;
13259
+ const {
13260
+ texts: {
13261
+ table2: tableTexts
13262
+ }
13263
+ } = useLocalization();
13213
13264
  const shortcuts = [];
13214
13265
  if (table.options.enableGlobalFilter) {
13215
13266
  shortcuts.push({
13216
- feature: 'Search',
13267
+ feature: tableTexts.shortcuts.search,
13217
13268
  keys: ['Ctrl', 'F']
13218
13269
  });
13219
13270
  }
13220
13271
  if (table.options.enableColumnFilters) {
13221
13272
  shortcuts.push({
13222
- feature: 'Filter',
13273
+ feature: tableTexts.shortcuts.filter,
13223
13274
  keys: ['Ctrl', 'Shift', 'F']
13224
13275
  });
13225
13276
  }
13226
13277
  shortcuts.push({
13227
- feature: 'Previous row',
13278
+ feature: tableTexts.shortcuts.previousRow,
13228
13279
  keys: ['Up']
13229
13280
  });
13230
13281
  shortcuts.push({
13231
- feature: 'Next row',
13282
+ feature: tableTexts.shortcuts.nextRow,
13232
13283
  keys: ['Down']
13233
13284
  });
13234
13285
  if (meta.editMode.enableEditMode) {
13235
13286
  shortcuts.push({
13236
- feature: 'Edit cell',
13287
+ feature: tableTexts.shortcuts.editCell,
13237
13288
  keys: ['Enter']
13238
13289
  });
13239
13290
  shortcuts.push({
13240
- feature: 'Previous column',
13241
- keys: ['Left']
13291
+ feature: tableTexts.shortcuts.previousColumn,
13292
+ keys: ['Arrow-Left']
13242
13293
  });
13243
13294
  shortcuts.push({
13244
- feature: 'Next column',
13245
- keys: ['Right']
13295
+ feature: tableTexts.shortcuts.nextColumn,
13296
+ keys: ['Arrow-Right']
13246
13297
  });
13247
13298
  } else if (meta.onRowClick) {
13248
13299
  shortcuts.push({
13249
- feature: 'Activate current row',
13300
+ feature: tableTexts.shortcuts.rowClick,
13250
13301
  keys: ['Enter']
13251
13302
  });
13252
13303
  }
13253
13304
  if (table.options.enableRowSelection) {
13254
13305
  shortcuts.push({
13255
- feature: 'Select current row',
13306
+ feature: tableTexts.shortcuts.selectRow,
13256
13307
  keys: ['Space']
13257
13308
  });
13258
13309
  shortcuts.push({
13259
- feature: 'Select all rows',
13310
+ feature: tableTexts.shortcuts.selectAllRows,
13260
13311
  keys: ['Ctrl', 'A']
13261
13312
  });
13262
13313
  }
13263
13314
  if (table.options.enableExpanding) {
13264
13315
  shortcuts.push({
13265
- feature: 'Expand current row',
13316
+ feature: tableTexts.shortcuts.expandRow,
13266
13317
  keys: ['Ctrl', 'Right']
13267
13318
  });
13268
13319
  shortcuts.push({
13269
- feature: 'Collapse current row',
13320
+ feature: tableTexts.shortcuts.collapseRow,
13270
13321
  keys: ['Ctrl', 'Left']
13271
13322
  });
13272
13323
  }