@economic/taco 1.21.1 → 1.21.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.
Files changed (61) hide show
  1. package/dist/components/Provider/Localization.d.ts +70 -7
  2. package/dist/components/Table2/Table2.d.ts +74 -9
  3. package/dist/components/Table2/Table2.stories.d.ts +0 -1
  4. package/dist/components/Table2/components/EditModeButton.d.ts +1 -0
  5. package/dist/components/Table2/components/filters/components/InferredControl.d.ts +1 -1
  6. package/dist/components/Table2/types.d.ts +7 -4
  7. package/dist/components/Table2/utilities/columns.d.ts +5 -4
  8. package/dist/esm/packages/taco/src/components/Provider/Localization.js +70 -7
  9. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +1 -0
  11. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
  13. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Table2/Table2.js +16 -5
  15. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js +24 -22
  17. package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js +23 -4
  19. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js +6 -2
  21. package/dist/esm/packages/taco/src/components/Table2/components/RowDensityButton.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table2/components/Search.js +5 -0
  23. package/dist/esm/packages/taco/src/components/Table2/components/Search.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Table2/components/ShortcutsGuideButton.js +14 -16
  25. package/dist/esm/packages/taco/src/components/Table2/components/ShortcutsGuideButton.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +13 -4
  27. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js +6 -2
  29. package/dist/esm/packages/taco/src/components/Table2/components/column/Footer.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js +10 -12
  31. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +10 -5
  33. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js +5 -5
  35. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/ColumnFilter.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js +20 -12
  37. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/Comparator.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js +3 -0
  39. package/dist/esm/packages/taco/src/components/Table2/components/filters/components/InferredControl.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js +4 -3
  41. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +8 -4
  43. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js +1 -5
  45. package/dist/esm/packages/taco/src/components/Table2/hooks/useGridTemplate.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Table2/types.js +2 -0
  47. package/dist/esm/packages/taco/src/components/Table2/types.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js +1 -1
  49. package/dist/esm/packages/taco/src/components/Table2/utilities/cell.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +31 -37
  51. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js +4 -0
  53. package/dist/esm/packages/taco/src/components/Table2/utilities/filterFn.js.map +1 -1
  54. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +2 -1
  55. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  56. package/dist/taco.cjs.development.js +272 -148
  57. package/dist/taco.cjs.development.js.map +1 -1
  58. package/dist/taco.cjs.production.min.js +1 -1
  59. package/dist/taco.cjs.production.min.js.map +1 -1
  60. package/package.json +2 -2
  61. package/types.json +316 -9
@@ -3635,7 +3635,77 @@ const defaultLocalisationTexts = {
3635
3635
  loading: 'Loading...'
3636
3636
  },
3637
3637
  table2: {
3638
+ columns: {
3639
+ actions: {
3640
+ tooltip: 'Other actions'
3641
+ },
3642
+ drag: {
3643
+ tooltip: 'Drag row'
3644
+ },
3645
+ expansion: {
3646
+ collapse: 'Collapse row',
3647
+ collapseAll: 'Collapse all rows',
3648
+ expand: 'Expand row',
3649
+ expandAll: 'Expand all rows'
3650
+ },
3651
+ select: {
3652
+ deselect: 'Deselect row',
3653
+ deselectAll: 'Deselect all rows',
3654
+ select: 'Select row',
3655
+ selectAll: 'Select all rows'
3656
+ }
3657
+ },
3658
+ columnSettings: {
3659
+ columnsOther: 'Pinned columns',
3660
+ columnsOtherDrop: 'Drop column here to unpin',
3661
+ columnsPinned: 'Other columns',
3662
+ columnsPinnedDrop: 'Drop column here to pin',
3663
+ search: 'Search column...',
3664
+ tooltip: 'Column settings'
3665
+ },
3666
+ editing: {
3667
+ button: 'Edit',
3668
+ tooltip: 'Edit',
3669
+ tooltipDisabled: 'There are no visible columns that support editing',
3670
+ rowIndicator: {
3671
+ rowWillMove: 'Row will move due to sorting',
3672
+ rowWillBeHidden: 'Row will hide due to filtering',
3673
+ rowWillMoveReasonSearch: 'Due to a search filter applied to this table, this row will be hidden as soon as you select another row',
3674
+ rowWillMoveReasonFilter: "Due to a filter applied to the column '[COLUMN]', this row will be hidden as soon as you select another row",
3675
+ rowWillMoveReasonSorting: "Due to sorting applied to the column '[COLUMN]', this row will move position as soon as you select another row"
3676
+ }
3677
+ },
3678
+ filters: {
3679
+ button: 'Filters',
3680
+ buttons: {
3681
+ addFilter: 'Add Filter',
3682
+ clearFilters: 'Clear all filters'
3683
+ },
3684
+ comparators: {
3685
+ contains: 'Contains',
3686
+ doesNotContain: 'Does not contain',
3687
+ isEqualTo: 'Is',
3688
+ isNotEqualTo: 'Is not',
3689
+ isGreaterThan: 'Is greater than',
3690
+ isLessThan: 'Is less than',
3691
+ isBetween: 'Is between',
3692
+ isOneOf: 'Is one of',
3693
+ isNoneOf: 'Is none of',
3694
+ isAllOf: 'Is all of',
3695
+ isEmpty: 'Is empty',
3696
+ isNotEmpty: 'Is not empty'
3697
+ },
3698
+ tooltip: 'Apply filters',
3699
+ total: 'Viewing [CURRENT] of [TOTAL]'
3700
+ },
3701
+ rowDensity: {
3702
+ tooltip: 'Row density'
3703
+ },
3704
+ search: {
3705
+ placeholder: 'Search...'
3706
+ },
3638
3707
  shortcuts: {
3708
+ tooltip: 'View keyboard shortcuts',
3639
3709
  search: 'Search',
3640
3710
  filter: 'Filter',
3641
3711
  previousRow: 'Previous row',
@@ -3648,13 +3718,6 @@ const defaultLocalisationTexts = {
3648
3718
  selectAllRows: 'Select all rows',
3649
3719
  expandRow: 'Expand current row',
3650
3720
  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
3721
  }
3659
3722
  },
3660
3723
  select: {
@@ -5782,6 +5845,7 @@ const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
5782
5845
  className: "group-peer-focus:!border-transparent group-peer-focus:group-peer-active:!border-transparent -mr-2 !border-transparent !bg-transparent focus:!border-transparent",
5783
5846
  disabled: props.disabled || props.readOnly,
5784
5847
  onClick: handleClick,
5848
+ tabIndex: -1,
5785
5849
  tooltip: texts.searchInput.button
5786
5850
  })),
5787
5851
  ref: internalRef,
@@ -7594,9 +7658,10 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
7594
7658
  const options = getOptionsFromCollection(event.currentTarget, querySelector);
7595
7659
  if (options) {
7596
7660
  if (isAriaDirectionKey(event)) {
7661
+ event.preventDefault();
7662
+ event.stopPropagation();
7597
7663
  const nextActiveIndex = getNextEnabledItem$1(event, options, activeIndex);
7598
7664
  if (nextActiveIndex !== undefined && nextActiveIndex !== activeIndex) {
7599
- event.preventDefault();
7600
7665
  setActiveOption(nextActiveIndex, event.currentTarget, options.item(nextActiveIndex));
7601
7666
  }
7602
7667
  } else if (activeIndex !== undefined) {
@@ -8754,7 +8819,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
8754
8819
  var _listboxRef$current;
8755
8820
  if (open) {
8756
8821
  event.preventDefault();
8757
- } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
8822
+ } else if (event.key === 'ArrowDown') {
8758
8823
  setOpen(true);
8759
8824
  }
8760
8825
  // the focus should always remain on the input, so we forward events on to the listbox
@@ -10377,7 +10442,7 @@ const toggleBetween$1 = (fromRowIndex, toRowIndex) => {
10377
10442
  const toIndex = toRowIndex > fromRowIndex ? toRowIndex : fromRowIndex;
10378
10443
  return [fromIndex, toIndex];
10379
10444
  };
10380
- function createRowDraggableColumn(onRowDrag) {
10445
+ function createRowDraggableColumn(onRowDrag, texts) {
10381
10446
  return {
10382
10447
  id: COLUMN_ID_FOR_DRAGGABLE,
10383
10448
  cell: ({
@@ -10416,7 +10481,7 @@ function createRowDraggableColumn(onRowDrag) {
10416
10481
  onDragStart: onDragStart,
10417
10482
  onDragEnd: onDragEnd
10418
10483
  }, /*#__PURE__*/React__default.createElement(Icon, {
10419
- "aria-label": "Drag row",
10484
+ "aria-label": texts.table2.columns.drag.tooltip,
10420
10485
  name: "drag",
10421
10486
  className: "text-grey-darkest invisible w-[20px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed]]/row:text-white"
10422
10487
  }));
@@ -10432,19 +10497,19 @@ function createRowDraggableColumn(onRowDrag) {
10432
10497
  size: 10
10433
10498
  };
10434
10499
  }
10435
- function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowIndex, onRowDrag, tableRef) {
10500
+ function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowIndex, onRowDrag, tableRef, texts) {
10436
10501
  let header;
10437
10502
  let cell;
10438
10503
  if (enableMultipleRowSelection) {
10439
10504
  header = ({
10440
10505
  table
10441
10506
  }) => /*#__PURE__*/React__default.createElement(Tooltip, {
10442
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getIsAllPageRowsSelected() ? 'Deselect all' : 'Select all', /*#__PURE__*/React__default.createElement(Shortcut$1, {
10507
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll, /*#__PURE__*/React__default.createElement(Shortcut$1, {
10443
10508
  className: "ml-2",
10444
10509
  keys: ['Ctrl', 'A']
10445
10510
  }))
10446
10511
  }, /*#__PURE__*/React__default.createElement(Checkbox, {
10447
- "aria-label": table.getIsAllPageRowsSelected() ? 'Deselect all rows' : 'Select all rows',
10512
+ "aria-label": table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll,
10448
10513
  className: "hover:border-blue !mt-0",
10449
10514
  checked: table.getIsAllPageRowsSelected(),
10450
10515
  indeterminate: table.getIsSomePageRowsSelected(),
@@ -10474,12 +10539,12 @@ function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowInd
10474
10539
  (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.focus();
10475
10540
  };
10476
10541
  return /*#__PURE__*/React__default.createElement(Tooltip, {
10477
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getIsAllPageRowsSelected() ? 'Deselect' : 'Select', /*#__PURE__*/React__default.createElement(Shortcut$1, {
10542
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, row.getIsSelected() ? texts.table2.columns.select.select : texts.table2.columns.select.deselect, /*#__PURE__*/React__default.createElement(Shortcut$1, {
10478
10543
  className: "ml-2",
10479
10544
  keys: ['Space']
10480
10545
  }))
10481
10546
  }, /*#__PURE__*/React__default.createElement(Checkbox, {
10482
- "aria-label": row.getIsSelected() ? 'Deselect row' : 'Select row',
10547
+ "aria-label": row.getIsSelected() ? texts.table2.columns.select.select : texts.table2.columns.select.deselect,
10483
10548
  className: "hover:border-blue !mt-[0.45rem]",
10484
10549
  checked: row.getIsSelected(),
10485
10550
  onClick: handleClick,
@@ -10529,15 +10594,15 @@ function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowInd
10529
10594
  size: 46
10530
10595
  };
10531
10596
  }
10532
- function createRowExpansionColumn() {
10597
+ function createRowExpansionColumn(texts) {
10533
10598
  return {
10534
10599
  id: COLUMN_ID_FOR_EXPANSION,
10535
10600
  header: ({
10536
10601
  table
10537
10602
  }) => /*#__PURE__*/React__default.createElement(Tooltip, {
10538
- title: table.getIsSomeRowsExpanded() ? 'Collapse all' : 'Expand all'
10603
+ title: table.getIsSomeRowsExpanded() ? texts.table2.columns.expansion.collapseAll : texts.table2.columns.expansion.expandAll
10539
10604
  }, /*#__PURE__*/React__default.createElement(IconButton, {
10540
- title: table.getIsSomeRowsExpanded() ? 'Collapse all rows' : 'Expand all rows',
10605
+ title: table.getIsSomeRowsExpanded() ? texts.table2.columns.expansion.collapseAll : texts.table2.columns.expansion.expandAll,
10541
10606
  appearance: "discrete",
10542
10607
  className: "-mb-2 -mt-1.5",
10543
10608
  icon: table.getIsSomeRowsExpanded() ? 'chevron-down-double' : 'chevron-right-double',
@@ -10550,12 +10615,12 @@ function createRowExpansionColumn() {
10550
10615
  cell: ({
10551
10616
  row
10552
10617
  }) => /*#__PURE__*/React__default.createElement(Tooltip, {
10553
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, row.getIsExpanded() ? 'Collapse' : 'Expand', /*#__PURE__*/React__default.createElement(Shortcut$1, {
10618
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, row.getIsExpanded() ? texts.table2.columns.expansion.collapse : texts.table2.columns.expansion.expand, /*#__PURE__*/React__default.createElement(Shortcut$1, {
10554
10619
  className: "ml-2",
10555
10620
  keys: ['Ctrl', row.getIsExpanded() ? '←' : '→']
10556
10621
  }))
10557
10622
  }, /*#__PURE__*/React__default.createElement(IconButton, {
10558
- title: row.getIsExpanded() ? 'Collapse row' : 'Expand row',
10623
+ title: row.getIsExpanded() ? texts.table2.columns.expansion.collapse : texts.table2.columns.expansion.expand,
10559
10624
  appearance: "discrete",
10560
10625
  icon: row.getIsExpanded() ? 'chevron-down' : 'chevron-right',
10561
10626
  onClick: event => {
@@ -10579,30 +10644,19 @@ const getActionPropertyValue = (property, row) => typeof property === 'function'
10579
10644
  function RowActionCell({
10580
10645
  row,
10581
10646
  actions,
10582
- moreActions
10647
+ moreActions,
10648
+ table,
10649
+ texts
10583
10650
  }) {
10584
10651
  const isVisible = action => typeof action.visible !== 'undefined' ? typeof action.visible === 'function' ? action.visible(row.original) : action.visible : true;
10585
10652
  const visibleActions = actions.filter(isVisible);
10586
10653
  const visibleMoreActions = moreActions.filter(isVisible);
10587
- const rowActionCellWidth = React__default.useMemo(() => {
10588
- const totalButtons = visibleActions.length + (visibleMoreActions.length ? 1 : 0);
10589
- // this is necessary because row actions is has this mount hover delay, which makes the
10590
- // size calculation in the header get set before rendering - meaning the size doesn't include the buttons
10591
- // when we cache icons this can go
10592
- const paddingSize = 8;
10593
- const buttonSize = 32;
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
10654
  // If the row is not the active row or the hovered row then actions are hidden.
10600
10655
  const actionClassName = 'group-hover/row:flex group-[[aria-current]]/row:flex hidden';
10656
+ // only actions in the active row should be tabbable
10657
+ const tabIndex = table.options.meta.activeRowIndex === row.index ? 0 : -1;
10601
10658
  return /*#__PURE__*/React__default.createElement("span", {
10602
- className: "-mb-2 -mt-1.5 flex justify-end text-right",
10603
- style: {
10604
- width: rowActionCellWidth
10605
- }
10659
+ className: "-mb-2 -mt-1.5 flex justify-end text-right"
10606
10660
  }, visibleActions.map((action, i) => /*#__PURE__*/React__default.createElement(IconButton, {
10607
10661
  key: i,
10608
10662
  className: actionClassName,
@@ -10617,15 +10671,17 @@ function RowActionCell({
10617
10671
  action.onClick(row.original);
10618
10672
  }
10619
10673
  },
10674
+ tabIndex: tabIndex,
10620
10675
  tooltip: getActionPropertyValue(action.text, row.original)
10621
10676
  })), visibleMoreActions.length ? /*#__PURE__*/React__default.createElement(IconButton, {
10622
10677
  className: actionClassName,
10623
- "aria-label": "View other actions",
10678
+ "aria-label": texts.table2.columns.actions.tooltip,
10624
10679
  appearance: "discrete",
10625
10680
  icon: "more",
10626
10681
  onClick: event => {
10627
10682
  event.preventDefault();
10628
10683
  },
10684
+ tabIndex: tabIndex,
10629
10685
  menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, visibleMoreActions.map((action, i) => /*#__PURE__*/React__default.createElement(Menu$1.Item, {
10630
10686
  key: i,
10631
10687
  dialog: action.dialog ? action.dialog(row.original) : undefined,
@@ -10637,25 +10693,28 @@ function RowActionCell({
10637
10693
  }
10638
10694
  }
10639
10695
  }, getActionPropertyValue(action.text, row.original))))),
10640
- tooltip: "Other actions..."
10696
+ tooltip: texts.table2.columns.actions.tooltip
10641
10697
  }) : null);
10642
10698
  }
10643
- function createRowActionsColumn(rowActions) {
10644
- const actions = rowActions.slice(0, 3);
10645
- const moreActions = rowActions.slice(3);
10699
+ function createRowActionsColumn(rowActions, texts) {
10700
+ const actions = rowActions.length === 4 ? rowActions : rowActions.slice(0, 3);
10701
+ const moreActions = rowActions.slice(rowActions.length === 4 ? 4 : 3);
10646
10702
  return {
10647
10703
  id: COLUMN_ID_FOR_ACTIONS,
10648
10704
  cell: ({
10649
- row
10705
+ row,
10706
+ table
10650
10707
  }) => /*#__PURE__*/React__default.createElement(RowActionCell, {
10651
10708
  row: row,
10652
10709
  actions: actions,
10653
- moreActions: moreActions
10710
+ moreActions: moreActions,
10711
+ texts: texts,
10712
+ table: table
10654
10713
  }),
10655
10714
  meta: {
10656
10715
  align: 'right',
10657
10716
  className: row => cn('items-center print:opacity-0 group-[[aria-current]]/row:sticky group-hover/row:sticky right-0 bg-transparent !px-1', {
10658
- 'group-hover/row:!shadow-[-6px_0px_6px_theme(colors.grey.100)] group-[[aria-current]]/row:!shadow-[-6px_0px_6px_theme(colors.grey.100)]': !row.getIsSelected(),
10717
+ 'group-[[aria-current]]/row:!shadow-[-6px_0px_6px_theme(colors.grey.200)]': !row.getIsSelected(),
10659
10718
  'shadow-[-6px_0px_6px_theme(colors.blue.100)]': row.getIsSelected()
10660
10719
  }),
10661
10720
  disableTruncation: true,
@@ -10679,7 +10738,7 @@ const getDensityPadding = (density, editing = false) => {
10679
10738
  }
10680
10739
  };
10681
10740
  const getCellSizingClasses = (density = 'normal', editing = false) => {
10682
- return cn('flex items-center', getDensityPadding(density, editing), editing ? 'px-[7px]' : 'px-4');
10741
+ return cn('flex items-start', getDensityPadding(density, editing), editing ? 'px-[7px]' : 'px-4');
10683
10742
  };
10684
10743
  const getCellAlignmentClasses = (alignment = 'left') => ({
10685
10744
  'justify-start text-left': alignment === 'left',
@@ -10781,6 +10840,8 @@ var Table2FilterComparator;
10781
10840
  Table2FilterComparator[Table2FilterComparator["IsOneOf"] = 7] = "IsOneOf";
10782
10841
  Table2FilterComparator[Table2FilterComparator["IsNoneOf"] = 8] = "IsNoneOf";
10783
10842
  Table2FilterComparator[Table2FilterComparator["IsAllOf"] = 9] = "IsAllOf";
10843
+ Table2FilterComparator[Table2FilterComparator["IsEmpty"] = 10] = "IsEmpty";
10844
+ Table2FilterComparator[Table2FilterComparator["IsNotEmpty"] = 11] = "IsNotEmpty";
10784
10845
  })(Table2FilterComparator || (Table2FilterComparator = {}));
10785
10846
 
10786
10847
  const toLowerCase = value => String(value !== null && value !== void 0 ? value : '').toLocaleLowerCase();
@@ -10792,6 +10853,10 @@ const globalFilterFn = (value, query) => isWeakContains(value, query);
10792
10853
  // before we filter - that's why this custom filter function exists
10793
10854
  const columnFilterFn = (value, filter) => {
10794
10855
  try {
10856
+ if (filter.comparator === Table2FilterComparator.IsEmpty || filter.comparator === Table2FilterComparator.IsNotEmpty) {
10857
+ const isEmpty = value === undefined || value === null || value === '';
10858
+ return filter.comparator === Table2FilterComparator.IsEmpty ? isEmpty : !isEmpty;
10859
+ }
10795
10860
  if (filter.value === undefined || filter.value === null || filter.value === '') {
10796
10861
  return true;
10797
10862
  }
@@ -11013,22 +11078,20 @@ const useIndicatorText = reason => {
11013
11078
  let title = '';
11014
11079
  let description = '';
11015
11080
  const {
11016
- texts: {
11017
- table2: tableTexts
11018
- }
11081
+ texts
11019
11082
  } = useLocalization();
11020
11083
  switch (reason) {
11084
+ case IndicatorReason.FILTER:
11085
+ title = texts.table2.editing.rowIndicator.rowWillBeHidden;
11086
+ description = texts.table2.editing.rowIndicator.rowWillMoveReasonFilter;
11087
+ break;
11021
11088
  case IndicatorReason.SEARCH:
11022
- title = tableTexts.rowIndicator.rowWillBeFiltered;
11023
- description = tableTexts.rowIndicator.searchFilterMovementReason;
11089
+ title = texts.table2.editing.rowIndicator.rowWillBeHidden;
11090
+ description = texts.table2.editing.rowIndicator.rowWillMoveReasonSearch;
11024
11091
  break;
11025
11092
  case IndicatorReason.SORTING:
11026
- title = tableTexts.rowIndicator.rowWillMove;
11027
- description = tableTexts.rowIndicator.sortingMovementReason;
11028
- break;
11029
- case IndicatorReason.FILTER:
11030
- title = tableTexts.rowIndicator.rowWillBeFiltered;
11031
- description = tableTexts.rowIndicator.tableFilterMovementReason;
11093
+ title = texts.table2.editing.rowIndicator.rowWillMove;
11094
+ description = texts.table2.editing.rowIndicator.rowWillMoveReasonSorting;
11032
11095
  break;
11033
11096
  }
11034
11097
  return {
@@ -11043,7 +11106,7 @@ const Indicator = ({
11043
11106
  }) => {
11044
11107
  const container = React__default.useMemo(() => {
11045
11108
  const element = document.createElement('div');
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';
11109
+ element.className += 'z-[3] rounded-b-md 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';
11047
11110
  return element;
11048
11111
  }, []);
11049
11112
  const indicatorText = useIndicatorText(reason);
@@ -11420,8 +11483,11 @@ const Cell = function Cell(props) {
11420
11483
  }));
11421
11484
  } else {
11422
11485
  if (meta.onRowClick) {
11423
- attributes.onClick = () => {
11486
+ attributes.onClick = event => {
11424
11487
  var _meta$onRowClick;
11488
+ if (event.target !== internalRef.current) {
11489
+ return;
11490
+ }
11425
11491
  (_meta$onRowClick = meta.onRowClick) === null || _meta$onRowClick === void 0 ? void 0 : _meta$onRowClick.call(meta, cell.row.original);
11426
11492
  };
11427
11493
  }
@@ -11460,7 +11526,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11460
11526
  } = table.getState();
11461
11527
  const [state, setState] = React__default.useState(value);
11462
11528
  const isHoveringAnotherRowWhileEditing = meta.editMode.isEditing && meta.activeRowIndex !== rowIndex && meta.hoveredRowIndex === rowIndex;
11463
- const showValidationError = !isHoveringAnotherRowWhileEditing && !!cellValidationError;
11529
+ const hasValidationError = !isHoveringAnotherRowWhileEditing && !!cellValidationError;
11464
11530
  // On each save, the initialValue will be set to the new value of the cell
11465
11531
  const initialValue = React__default.useRef(value);
11466
11532
  // It is important that we let consumers pass a newValue as an argument because when setState is called before
@@ -11494,7 +11560,10 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11494
11560
  setValidationErrors(null);
11495
11561
  });
11496
11562
  }, function (error) {
11497
- setValidationErrors(error);
11563
+ setValidationErrors({
11564
+ ...validationErrors,
11565
+ ...error
11566
+ });
11498
11567
  });
11499
11568
  if (_temp && _temp.then) return _temp.then(function () {});
11500
11569
  }
@@ -11585,6 +11654,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11585
11654
  if (cellControl) {
11586
11655
  if (typeof cellControl === 'function') {
11587
11656
  controlComponent = cellControl({
11657
+ invalid: hasValidationError,
11588
11658
  onBlur: saveIfChanged,
11589
11659
  onFocus: handleFocus,
11590
11660
  ref: controlRef,
@@ -11598,6 +11668,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11598
11668
  case 'datepicker':
11599
11669
  controlComponent = /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, attributes, {
11600
11670
  className: detailModeClassName,
11671
+ invalid: hasValidationError,
11601
11672
  onBlur: event => {
11602
11673
  const newDate = event.detail;
11603
11674
  saveIfChanged(newDate);
@@ -11620,6 +11691,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11620
11691
  default:
11621
11692
  controlComponent = /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
11622
11693
  className: cn(className, detailModeClassName),
11694
+ invalid: hasValidationError,
11623
11695
  onChange: event => {
11624
11696
  setState(event.target.value);
11625
11697
  },
@@ -11637,7 +11709,7 @@ const EditingCell = /*#__PURE__*/React__default.memo( /*#__PURE__*/React__defaul
11637
11709
  mountNode: indicatorMountNode
11638
11710
  }), /*#__PURE__*/React__default.createElement("span", {
11639
11711
  className: "relative flex-grow"
11640
- }, controlComponent, showValidationError && /*#__PURE__*/React__default.createElement(ValidationError, null, String(cellValidationError))));
11712
+ }, controlComponent, hasValidationError && /*#__PURE__*/React__default.createElement(ValidationError, null, String(cellValidationError))));
11641
11713
  }));
11642
11714
 
11643
11715
  const Header$1 = function Header(props) {
@@ -11788,13 +11860,14 @@ const HeaderMenu = ({
11788
11860
 
11789
11861
  const Footer$2 = function Footer(props) {
11790
11862
  const {
11863
+ children,
11791
11864
  footer,
11792
11865
  index,
11793
11866
  table,
11794
11867
  ...columnProps
11795
11868
  } = props;
11796
11869
  const isPinned = !!footer.column.getIsPinned();
11797
- const className = cn('group/header sticky bottom-0 bg-white border-t-2 relative ', {
11870
+ const className = cn('group/header sticky bottom-0 bg-white border-t-2 relative', getCellSizingClasses('normal'), {
11798
11871
  'z-[1]': isPinned
11799
11872
  }, props.className);
11800
11873
  return /*#__PURE__*/React__default.createElement(ColumnBase, Object.assign({}, columnProps, {
@@ -11804,10 +11877,15 @@ const Footer$2 = function Footer(props) {
11804
11877
  className: className,
11805
11878
  role: "cell",
11806
11879
  "data-column-index": index
11807
- }));
11880
+ }), /*#__PURE__*/React__default.createElement("span", {
11881
+ className: "truncate"
11882
+ }, children));
11808
11883
  };
11809
11884
 
11810
11885
  function useColumnDefinitions(children, options, tableRef) {
11886
+ const {
11887
+ texts
11888
+ } = useLocalization();
11811
11889
  const lastSelectedRowIndex = React__default.useRef();
11812
11890
  const columnHelper = reactTable$1.createColumnHelper();
11813
11891
  return React__default.useMemo(() => {
@@ -11879,19 +11957,19 @@ function useColumnDefinitions(children, options, tableRef) {
11879
11957
  }
11880
11958
  });
11881
11959
  if (options.enableRowExpansion) {
11882
- columns.unshift(columnHelper.display(createRowExpansionColumn()));
11960
+ columns.unshift(columnHelper.display(createRowExpansionColumn(texts)));
11883
11961
  defaultColumnPinning.unshift(COLUMN_ID_FOR_EXPANSION);
11884
11962
  }
11885
11963
  if (options.enableRowSelection) {
11886
- columns.unshift(columnHelper.display(createRowSelectionColumn(options.enableMultipleRowSelection, lastSelectedRowIndex, options.onRowDrag, tableRef)));
11964
+ columns.unshift(columnHelper.display(createRowSelectionColumn(options.enableMultipleRowSelection, lastSelectedRowIndex, options.onRowDrag, tableRef, texts)));
11887
11965
  defaultColumnPinning.unshift(COLUMN_ID_FOR_SELECTION);
11888
11966
  }
11889
11967
  if (options.onRowDrag) {
11890
- columns.unshift(columnHelper.display(createRowDraggableColumn(options.onRowDrag)));
11968
+ columns.unshift(columnHelper.display(createRowDraggableColumn(options.onRowDrag, texts)));
11891
11969
  defaultColumnPinning.unshift(COLUMN_ID_FOR_DRAGGABLE);
11892
11970
  }
11893
11971
  if ((_options$actionsForRo = options.actionsForRow) !== null && _options$actionsForRo !== void 0 && _options$actionsForRo.length) {
11894
- columns.push(columnHelper.display(createRowActionsColumn(options.actionsForRow)));
11972
+ columns.push(columnHelper.display(createRowActionsColumn(options.actionsForRow, texts)));
11895
11973
  }
11896
11974
  return {
11897
11975
  columns,
@@ -12262,10 +12340,7 @@ const useVirtualiser = ({
12262
12340
  };
12263
12341
 
12264
12342
  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$;
12266
12343
  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;
12269
12344
  return allVisibleColumns.reduce((accum, column, index) => {
12270
12345
  let size;
12271
12346
  const isLastColumn = index === allVisibleColumns.length - 1;
@@ -12276,8 +12351,7 @@ const useGridTemplate = table => {
12276
12351
  size = `${column.getSize()}px`;
12277
12352
  } else if (width) {
12278
12353
  if (isLastColumn) {
12279
- // Remove the scrollbar width from the last column
12280
- size = `minmax(${width - scrollbarWidth}px, auto)`;
12354
+ size = `minmax(${width}px, auto)`;
12281
12355
  } else if (column.columnDef.minSize && width < column.columnDef.minSize) {
12282
12356
  // react-table is supposed to handle minSize itself but it is really buggy
12283
12357
  size = `${column.columnDef.minSize}px`;
@@ -12296,9 +12370,12 @@ const useGridTemplate = table => {
12296
12370
  const RowDensityButton = ({
12297
12371
  table
12298
12372
  }) => {
12373
+ const {
12374
+ texts
12375
+ } = useLocalization();
12299
12376
  const meta = table.options.meta;
12300
12377
  return /*#__PURE__*/React__default.createElement(IconButton, {
12301
- "aria-label": "Change row density",
12378
+ "aria-label": texts.table2.rowDensity.tooltip,
12302
12379
  icon: `density-${meta.rowDensity}`,
12303
12380
  menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
12304
12381
  align: "end"
@@ -12314,7 +12391,7 @@ const RowDensityButton = ({
12314
12391
  }, "Comfortable"), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
12315
12392
  value: "spacious"
12316
12393
  }, "Spacious")))),
12317
- tooltip: "Row density"
12394
+ tooltip: texts.table2.rowDensity.tooltip
12318
12395
  });
12319
12396
  };
12320
12397
 
@@ -12479,6 +12556,9 @@ const SortableColumnContainer = ({
12479
12556
  table
12480
12557
  }) => {
12481
12558
  var _ref;
12559
+ const {
12560
+ texts
12561
+ } = useLocalization();
12482
12562
  const meta = table.options.meta;
12483
12563
  const reorder = (activeId, overId, listId) => {
12484
12564
  const draggedColumn = state[listId].find(c => c.id === activeId);
@@ -12493,6 +12573,10 @@ const SortableColumnContainer = ({
12493
12573
  moveColumn(column);
12494
12574
  }
12495
12575
  };
12576
+ const handleDoubleClick = (id, status) => table.options.enablePinning ? event => {
12577
+ event.stopPropagation();
12578
+ move(id, status);
12579
+ } : undefined;
12496
12580
  const isReorderingAllowed = (_ref = meta.enableColumnReordering || table.options.enablePinning) !== null && _ref !== void 0 ? _ref : false;
12497
12581
  if (!table.options.enablePinning) {
12498
12582
  return /*#__PURE__*/React__default.createElement(Container, {
@@ -12500,7 +12584,7 @@ const SortableColumnContainer = ({
12500
12584
  move: move
12501
12585
  }, /*#__PURE__*/React__default.createElement(List$1, {
12502
12586
  id: "other",
12503
- className: "flex min-h-[theme(spacing.8)] flex-col gap-y-px px-2"
12587
+ className: "flex min-h-[theme(spacing.8)] flex-col gap-y-px overflow-x-hidden px-2"
12504
12588
  }, state.other.map(column => {
12505
12589
  var _column$columnDef$met2;
12506
12590
  const canBeReordered = isOrderingAllowed(table, column);
@@ -12513,10 +12597,7 @@ const SortableColumnContainer = ({
12513
12597
  canBeReordered: canBeReordered,
12514
12598
  column: column,
12515
12599
  isReorderingAllowed: isReorderingAllowed,
12516
- onDoubleClick: event => {
12517
- event.stopPropagation();
12518
- move(column.id, 'other');
12519
- }
12600
+ onDoubleClick: handleDoubleClick(column.id, 'other')
12520
12601
  }));
12521
12602
  })));
12522
12603
  }
@@ -12525,9 +12606,9 @@ const SortableColumnContainer = ({
12525
12606
  move: move
12526
12607
  }, /*#__PURE__*/React__default.createElement("h5", {
12527
12608
  className: "mx-4"
12528
- }, "Pinned columns"), /*#__PURE__*/React__default.createElement(List$1, {
12609
+ }, texts.table2.columnSettings.columnsPinned), /*#__PURE__*/React__default.createElement(List$1, {
12529
12610
  id: "pinned",
12530
- className: "flex min-h-[theme(spacing.8)] flex-col gap-y-px px-2"
12611
+ className: "flex min-h-[theme(spacing.8)] flex-col gap-y-px overflow-x-hidden px-2"
12531
12612
  }, state.pinned.length ? state.pinned.map(column => {
12532
12613
  var _column$columnDef$met3;
12533
12614
  const canBeReordered = isOrderingAllowed(table, column);
@@ -12540,18 +12621,15 @@ const SortableColumnContainer = ({
12540
12621
  canBeReordered: canBeReordered,
12541
12622
  column: column,
12542
12623
  isReorderingAllowed: isReorderingAllowed,
12543
- onDoubleClick: event => {
12544
- event.stopPropagation();
12545
- move(column.id, 'pinned');
12546
- }
12624
+ onDoubleClick: handleDoubleClick(column.id, 'pinned')
12547
12625
  }));
12548
12626
  }) : /*#__PURE__*/React__default.createElement("p", {
12549
12627
  className: "text-grey-500 mb-0 flex h-8 items-center px-2"
12550
- }, "Drop column here to pin")), /*#__PURE__*/React__default.createElement("h5", {
12628
+ }, texts.table2.columnSettings.columnsPinnedDrop)), /*#__PURE__*/React__default.createElement("h5", {
12551
12629
  className: "mx-4"
12552
- }, "Other columns"), /*#__PURE__*/React__default.createElement(List$1, {
12630
+ }, texts.table2.columnSettings.columnsOther), /*#__PURE__*/React__default.createElement(List$1, {
12553
12631
  id: "other",
12554
- className: "flex min-h-[theme(spacing.8)] flex-col gap-y-px px-2"
12632
+ className: "flex min-h-[theme(spacing.8)] flex-col gap-y-px overflow-x-hidden px-2"
12555
12633
  }, state.other.length ? state.other.map(column => {
12556
12634
  var _column$columnDef$met4;
12557
12635
  const canBeReordered = isOrderingAllowed(table, column);
@@ -12564,14 +12642,11 @@ const SortableColumnContainer = ({
12564
12642
  canBeReordered: canBeReordered,
12565
12643
  column: column,
12566
12644
  isReorderingAllowed: isReorderingAllowed,
12567
- onDoubleClick: event => {
12568
- event.stopPropagation();
12569
- move(column.id, 'other');
12570
- }
12645
+ onDoubleClick: handleDoubleClick(column.id, 'other')
12571
12646
  }));
12572
12647
  }) : /*#__PURE__*/React__default.createElement("p", {
12573
12648
  className: "text-grey-500 mb-0 flex h-8 items-center px-2"
12574
- }, "Drop column here to unpin")));
12649
+ }, texts.table2.columnSettings.columnsOtherDrop)));
12575
12650
  };
12576
12651
  const reorder = (draggedColumnId, targetColumnId, list = []) => {
12577
12652
  const nextColumnOrder = [...list];
@@ -12581,6 +12656,9 @@ const reorder = (draggedColumnId, targetColumnId, list = []) => {
12581
12656
  const ColumnSettingsButton = ({
12582
12657
  table
12583
12658
  }) => {
12659
+ const {
12660
+ texts
12661
+ } = useLocalization();
12584
12662
  const [query, setQuery] = React__default.useState('');
12585
12663
  const columns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id));
12586
12664
  const [state, setState] = React__default.useState({
@@ -12629,7 +12707,7 @@ const ColumnSettingsButton = ({
12629
12707
  table.setColumnOrder(internals.concat([...state.pinned, ...state.other].map(c => c.id)));
12630
12708
  }, [state]);
12631
12709
  return /*#__PURE__*/React__default.createElement(IconButton, {
12632
- "aria-label": "Change column settings",
12710
+ "aria-label": texts.table2.columnSettings.tooltip,
12633
12711
  icon: "columns",
12634
12712
  popover: popoverProps => /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps), /*#__PURE__*/React__default.createElement(Popover.Content, {
12635
12713
  align: "end"
@@ -12637,7 +12715,7 @@ const ColumnSettingsButton = ({
12637
12715
  className: "flex w-60 flex-col gap-2"
12638
12716
  }, /*#__PURE__*/React__default.createElement(Input, {
12639
12717
  onChange: event => setQuery(event.target.value),
12640
- placeholder: "Search column...",
12718
+ placeholder: texts.table2.columnSettings.search,
12641
12719
  value: query
12642
12720
  }), /*#__PURE__*/React__default.createElement("div", {
12643
12721
  className: "-ml-4 -mb-2 max-h-64 w-[calc(100%_+_theme(spacing.8))] overflow-auto"
@@ -12655,7 +12733,7 @@ const ColumnSettingsButton = ({
12655
12733
  reorderColumn: reorderColumn,
12656
12734
  table: table
12657
12735
  }))))),
12658
- tooltip: "Column settings"
12736
+ tooltip: texts.table2.columnSettings.tooltip
12659
12737
  });
12660
12738
  };
12661
12739
 
@@ -12833,12 +12911,13 @@ const Row$1 = ({
12833
12911
  rowMoveReason: rowMoveReason,
12834
12912
  setRowMoveReason: setRowMoveReason
12835
12913
  }, /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
12836
- role: "row",
12837
- draggable: true,
12838
12914
  "aria-current": isActiveRow ? 'true' : undefined,
12839
12915
  "aria-grabbed": isDragging ? 'true' : undefined,
12916
+ "data-row-index": rowIndex,
12917
+ draggable: true,
12840
12918
  onMouseEnter: handleEnter,
12841
- onMouseLeave: handleLeave
12919
+ onMouseLeave: handleLeave,
12920
+ role: "row"
12842
12921
  })));
12843
12922
  };
12844
12923
 
@@ -12874,6 +12953,9 @@ const Comparator = ({
12874
12953
  validComparators,
12875
12954
  ...props
12876
12955
  }) => {
12956
+ const {
12957
+ texts
12958
+ } = useLocalization();
12877
12959
  const handleChange = comparator => {
12878
12960
  column.setFilterValue(currentFilterValue => ({
12879
12961
  comparator,
@@ -12895,30 +12977,34 @@ const Comparator = ({
12895
12977
  }), validComparators.map(comp => /*#__PURE__*/React__default.createElement(Select2.Option, {
12896
12978
  key: comp,
12897
12979
  value: comp
12898
- }, getComparatorText(comp))));
12980
+ }, getComparatorText(comp, texts))));
12899
12981
  };
12900
- const getComparatorText = comparator => {
12982
+ const getComparatorText = (comparator, texts) => {
12901
12983
  switch (comparator) {
12902
12984
  case Table2FilterComparator.Contains:
12903
- return 'Contains';
12985
+ return texts.table2.filters.comparators.contains;
12904
12986
  case Table2FilterComparator.DoesNotContain:
12905
- return 'Does not contain';
12987
+ return texts.table2.filters.comparators.doesNotContain;
12906
12988
  case Table2FilterComparator.IsEqualTo:
12907
- return 'Is';
12989
+ return texts.table2.filters.comparators.isEqualTo;
12908
12990
  case Table2FilterComparator.IsNotEqualTo:
12909
- return 'Is not';
12991
+ return texts.table2.filters.comparators.isNotEqualTo;
12910
12992
  case Table2FilterComparator.IsGreaterThan:
12911
- return 'Is greater than';
12993
+ return texts.table2.filters.comparators.isGreaterThan;
12912
12994
  case Table2FilterComparator.IsLessThan:
12913
- return 'Is less than';
12995
+ return texts.table2.filters.comparators.isLessThan;
12914
12996
  case Table2FilterComparator.IsBetween:
12915
- return 'Is between';
12997
+ return texts.table2.filters.comparators.isBetween;
12916
12998
  case Table2FilterComparator.IsOneOf:
12917
- return 'Is one of';
12999
+ return texts.table2.filters.comparators.isOneOf;
12918
13000
  case Table2FilterComparator.IsNoneOf:
12919
- return 'Is none of';
13001
+ return texts.table2.filters.comparators.isNoneOf;
12920
13002
  case Table2FilterComparator.IsAllOf:
12921
- return 'Is all of';
13003
+ return texts.table2.filters.comparators.isAllOf;
13004
+ case Table2FilterComparator.IsEmpty:
13005
+ return texts.table2.filters.comparators.isEmpty;
13006
+ case Table2FilterComparator.IsNotEmpty:
13007
+ return texts.table2.filters.comparators.isNotEmpty;
12922
13008
  }
12923
13009
  };
12924
13010
 
@@ -12929,6 +13015,9 @@ const InferredControl = ({
12929
13015
  }) => {
12930
13016
  var _column$columnDef$met2, _column$columnDef$met3;
12931
13017
  const ariaLabel = column.columnDef.header;
13018
+ if (comparator === Table2FilterComparator.IsEmpty || comparator === Table2FilterComparator.IsNotEmpty) {
13019
+ return null;
13020
+ }
12932
13021
  if (comparator === Table2FilterComparator.IsBetween) {
12933
13022
  var _column$columnDef$met;
12934
13023
  const fromValue = Array.isArray(value) ? value[0] : undefined;
@@ -13011,7 +13100,7 @@ const InferredControl = ({
13011
13100
  };
13012
13101
 
13013
13102
  const ColumnFilter = props => {
13014
- var _column$columnDef$hea, _column$columnDef$met, _column$columnDef$met2, _control;
13103
+ var _column$columnDef$hea, _column$columnDef$met, _control;
13015
13104
  const {
13016
13105
  allColumns,
13017
13106
  column,
@@ -13025,7 +13114,7 @@ const ColumnFilter = props => {
13025
13114
  const ariaLabel = String((_column$columnDef$hea = column.columnDef.header) !== null && _column$columnDef$hea !== void 0 ? _column$columnDef$hea : '');
13026
13115
  const ref = React__default.useRef(null);
13027
13116
  let control;
13028
- const controlType = (_column$columnDef$met = (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control) !== null && _column$columnDef$met !== void 0 ? _column$columnDef$met : 'input';
13117
+ const controlType = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
13029
13118
  if (typeof controlType === 'function') {
13030
13119
  control = controlType({
13031
13120
  onBlur: () => Promise.resolve(),
@@ -13068,7 +13157,7 @@ const ColumnFilter = props => {
13068
13157
  });
13069
13158
  }
13070
13159
  const handleRemove = () => column.setFilterValue(undefined);
13071
- const comparators = guessComparatorsBasedOnControl(controlType, control);
13160
+ const comparators = guessComparatorsBasedOnControl(control, controlType);
13072
13161
  return /*#__PURE__*/React__default.createElement("div", {
13073
13162
  className: "mb-2 flex gap-2"
13074
13163
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -13096,7 +13185,7 @@ const ColumnFilter = props => {
13096
13185
  onClick: handleRemove
13097
13186
  }));
13098
13187
  };
13099
- const guessComparatorsBasedOnControl = (control, instance) => {
13188
+ const guessComparatorsBasedOnControl = (instance, control) => {
13100
13189
  if ( /*#__PURE__*/React__default.isValidElement(instance)) {
13101
13190
  const {
13102
13191
  props,
@@ -13115,7 +13204,7 @@ const guessComparatorsBasedOnControl = (control, instance) => {
13115
13204
  case 'switch':
13116
13205
  return [Table2FilterComparator.IsEqualTo];
13117
13206
  default:
13118
- return [Table2FilterComparator.Contains, Table2FilterComparator.DoesNotContain, Table2FilterComparator.IsEqualTo, Table2FilterComparator.IsNotEqualTo, Table2FilterComparator.IsGreaterThan, Table2FilterComparator.IsLessThan, Table2FilterComparator.IsBetween];
13207
+ return [Table2FilterComparator.Contains, Table2FilterComparator.DoesNotContain, Table2FilterComparator.IsEqualTo, Table2FilterComparator.IsNotEqualTo, Table2FilterComparator.IsEmpty, Table2FilterComparator.IsNotEmpty, Table2FilterComparator.IsGreaterThan, Table2FilterComparator.IsLessThan, Table2FilterComparator.IsBetween];
13119
13208
  }
13120
13209
  };
13121
13210
 
@@ -13132,6 +13221,9 @@ const FiltersButton = ({
13132
13221
  length,
13133
13222
  table
13134
13223
  }) => {
13224
+ const {
13225
+ texts
13226
+ } = useLocalization();
13135
13227
  const ref = React__default.useRef(null);
13136
13228
  const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn(column.id));
13137
13229
  const {
@@ -13165,6 +13257,7 @@ const FiltersButton = ({
13165
13257
  }
13166
13258
  });
13167
13259
  return /*#__PURE__*/React__default.createElement(Button$1, {
13260
+ "aria-label": texts.table2.filters.tooltip,
13168
13261
  appearance: columnFilters.length ? 'primary' : 'default',
13169
13262
  className: cn({
13170
13263
  '!wcag-blue-100': columnFilters.length
@@ -13178,7 +13271,7 @@ const FiltersButton = ({
13178
13271
  className: "mb-0 inline-flex"
13179
13272
  }, "Filter"), /*#__PURE__*/React__default.createElement("p", {
13180
13273
  className: "text-grey-700 mb-0 mr-auto mt-px inline-flex"
13181
- }, "Viewing ", table.getFilteredRowModel().rows.length, " of ", length)), /*#__PURE__*/React__default.createElement("div", {
13274
+ }, texts.table2.filters.total.replace('[CURRENT]', String(table.getFilteredRowModel().rows.length)).replace('[TOTAL]', String(length)))), /*#__PURE__*/React__default.createElement("div", {
13182
13275
  className: "flex flex-col gap-2"
13183
13276
  }, filteredColumns.map((column, index) => /*#__PURE__*/React__default.createElement(ColumnFilter, {
13184
13277
  key: `${column.id}_${index}`,
@@ -13191,17 +13284,17 @@ const FiltersButton = ({
13191
13284
  }, /*#__PURE__*/React__default.createElement(Button$1, {
13192
13285
  appearance: "discrete",
13193
13286
  onClick: handleAdd
13194
- }, "+ Add filter"), columnFilters.length ? /*#__PURE__*/React__default.createElement(Button$1, {
13287
+ }, "+ ", texts.table2.filters.buttons.addFilter), columnFilters.length ? /*#__PURE__*/React__default.createElement(Button$1, {
13195
13288
  onClick: handleReset
13196
- }, "Clear all filters") : null)))),
13289
+ }, texts.table2.filters.buttons.clearFilters) : null)))),
13197
13290
  ref: ref,
13198
- tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, columnFilters.length ? 'Change filters' : 'Apply filters', /*#__PURE__*/React__default.createElement(Shortcut$1, {
13291
+ tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut$1, {
13199
13292
  className: "ml-2",
13200
13293
  keys: ['Ctrl', 'Shift', 'F']
13201
13294
  }))
13202
13295
  }, /*#__PURE__*/React__default.createElement(Icon, {
13203
13296
  name: columnFilters.length ? 'filter-solid' : 'filter'
13204
- }), columnFilters.length ? `Filters (${columnFilters.length})` : 'Filters');
13297
+ }), texts.table2.filters.button, " ", columnFilters.length ? `(${columnFilters.length})` : '');
13205
13298
  };
13206
13299
 
13207
13300
  const Search$2 = props => {
@@ -13209,6 +13302,9 @@ const Search$2 = props => {
13209
13302
  value,
13210
13303
  ...attributes
13211
13304
  } = props;
13305
+ const {
13306
+ texts
13307
+ } = useLocalization();
13212
13308
  const ref = React__default.useRef(null);
13213
13309
  const handleKeyDown = event => {
13214
13310
  if (event.key === 'Escape') {
@@ -13248,6 +13344,7 @@ const Search$2 = props => {
13248
13344
  onBlur: handleBlur,
13249
13345
  onInput: handleInput,
13250
13346
  onKeyDown: handleKeyDown,
13347
+ placeholder: texts.table2.search.placeholder,
13251
13348
  ref: ref
13252
13349
  }));
13253
13350
  };
@@ -13257,72 +13354,70 @@ const ShortcutsGuideButton = ({
13257
13354
  }) => {
13258
13355
  const meta = table.options.meta;
13259
13356
  const {
13260
- texts: {
13261
- table2: tableTexts
13262
- }
13357
+ texts
13263
13358
  } = useLocalization();
13264
13359
  const shortcuts = [];
13265
13360
  if (table.options.enableGlobalFilter) {
13266
13361
  shortcuts.push({
13267
- feature: tableTexts.shortcuts.search,
13362
+ feature: texts.table2.shortcuts.search,
13268
13363
  keys: ['Ctrl', 'F']
13269
13364
  });
13270
13365
  }
13271
13366
  if (table.options.enableColumnFilters) {
13272
13367
  shortcuts.push({
13273
- feature: tableTexts.shortcuts.filter,
13368
+ feature: texts.table2.shortcuts.filter,
13274
13369
  keys: ['Ctrl', 'Shift', 'F']
13275
13370
  });
13276
13371
  }
13277
13372
  shortcuts.push({
13278
- feature: tableTexts.shortcuts.previousRow,
13373
+ feature: texts.table2.shortcuts.previousRow,
13279
13374
  keys: ['Up']
13280
13375
  });
13281
13376
  shortcuts.push({
13282
- feature: tableTexts.shortcuts.nextRow,
13377
+ feature: texts.table2.shortcuts.nextRow,
13283
13378
  keys: ['Down']
13284
13379
  });
13285
13380
  if (meta.editMode.enableEditMode) {
13286
13381
  shortcuts.push({
13287
- feature: tableTexts.shortcuts.editCell,
13382
+ feature: texts.table2.shortcuts.editCell,
13288
13383
  keys: ['Enter']
13289
13384
  });
13290
13385
  shortcuts.push({
13291
- feature: tableTexts.shortcuts.previousColumn,
13386
+ feature: texts.table2.shortcuts.previousColumn,
13292
13387
  keys: ['Arrow-Left']
13293
13388
  });
13294
13389
  shortcuts.push({
13295
- feature: tableTexts.shortcuts.nextColumn,
13390
+ feature: texts.table2.shortcuts.nextColumn,
13296
13391
  keys: ['Arrow-Right']
13297
13392
  });
13298
13393
  } else if (meta.onRowClick) {
13299
13394
  shortcuts.push({
13300
- feature: tableTexts.shortcuts.rowClick,
13395
+ feature: texts.table2.shortcuts.rowClick,
13301
13396
  keys: ['Enter']
13302
13397
  });
13303
13398
  }
13304
13399
  if (table.options.enableRowSelection) {
13305
13400
  shortcuts.push({
13306
- feature: tableTexts.shortcuts.selectRow,
13401
+ feature: texts.table2.shortcuts.selectRow,
13307
13402
  keys: ['Space']
13308
13403
  });
13309
13404
  shortcuts.push({
13310
- feature: tableTexts.shortcuts.selectAllRows,
13405
+ feature: texts.table2.shortcuts.selectAllRows,
13311
13406
  keys: ['Ctrl', 'A']
13312
13407
  });
13313
13408
  }
13314
13409
  if (table.options.enableExpanding) {
13315
13410
  shortcuts.push({
13316
- feature: tableTexts.shortcuts.expandRow,
13411
+ feature: texts.table2.shortcuts.expandRow,
13317
13412
  keys: ['Ctrl', 'Right']
13318
13413
  });
13319
13414
  shortcuts.push({
13320
- feature: tableTexts.shortcuts.collapseRow,
13415
+ feature: texts.table2.shortcuts.collapseRow,
13321
13416
  keys: ['Ctrl', 'Left']
13322
13417
  });
13323
13418
  }
13324
13419
  return /*#__PURE__*/React__default.createElement(IconButton, {
13325
- "aria-label": "View keyboard shortcuts",
13420
+ "aria-label": texts.table2.shortcuts.tooltip,
13326
13421
  icon: "shortcuts",
13327
13422
  popover: popoverProps => /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps), /*#__PURE__*/React__default.createElement(Popover.Content, {
13328
13423
  align: "end"
@@ -13340,9 +13435,13 @@ const ShortcutsGuideButton = ({
13340
13435
 
13341
13436
  const EditModeButton = /*#__PURE__*/React__default.forwardRef(function EditModeButton(props, ref) {
13342
13437
  const {
13438
+ scrollToIndex,
13343
13439
  table,
13344
13440
  tableRef
13345
13441
  } = props;
13442
+ const {
13443
+ texts
13444
+ } = useLocalization();
13346
13445
  const internalRef = useMergedRef(ref);
13347
13446
  const meta = table.options.meta;
13348
13447
  const {
@@ -13364,26 +13463,40 @@ const EditModeButton = /*#__PURE__*/React__default.forwardRef(function EditModeB
13364
13463
  });
13365
13464
  React__default.useEffect(() => {
13366
13465
  window.addEventListener('beforeunload', showWarning);
13367
- return () => window.removeEventListener('beforeunload', showWarning);
13466
+ return () => {
13467
+ window.removeEventListener('beforeunload', showWarning);
13468
+ };
13368
13469
  }, [showWarning]);
13369
13470
  const handleClick = () => {
13370
13471
  var _tableRef$current;
13371
13472
  meta.editMode.toggleEditing();
13372
13473
  (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.focus();
13474
+ scrollToIndex(meta.activeRowIndex + 1);
13373
13475
  };
13476
+ const hasVisibleEditableColumns = React__default.useMemo(() => {
13477
+ const hasColumns = table.getVisibleFlatColumns().some(column => {
13478
+ var _column$columnDef$met;
13479
+ return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control) !== undefined;
13480
+ });
13481
+ if (!hasColumns && isEditing) {
13482
+ handleClick();
13483
+ }
13484
+ return hasColumns;
13485
+ }, [table.getState().columnVisibility]);
13374
13486
  return /*#__PURE__*/React__default.createElement(Button$1, {
13375
13487
  onClick: handleClick,
13376
13488
  className: cn({
13377
13489
  '!wcag-blue-100': meta.editMode.isEditing
13378
13490
  }),
13491
+ disabled: !hasVisibleEditableColumns,
13379
13492
  ref: internalRef,
13380
- tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Edit", /*#__PURE__*/React__default.createElement(Shortcut$1, {
13493
+ tooltip: hasVisibleEditableColumns ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.editing.tooltip, /*#__PURE__*/React__default.createElement(Shortcut$1, {
13381
13494
  className: "ml-2",
13382
13495
  keys: ['Ctrl', 'E']
13383
- }))
13496
+ })) : texts.table2.editing.tooltipDisabled
13384
13497
  }, /*#__PURE__*/React__default.createElement(Icon, {
13385
13498
  name: "edit"
13386
- }), "Edit");
13499
+ }), texts.table2.editing.button);
13387
13500
  });
13388
13501
 
13389
13502
  function Column$2(_) {
@@ -13470,7 +13583,15 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
13470
13583
  meta.setActiveRowIndex(rows.length - 1);
13471
13584
  virtualiser.scrollToOffset(virtualiser.totalSize + 1);
13472
13585
  } else {
13473
- meta.moveToNextRow(rows, nextIndex => virtualiser.scrollToIndex(nextIndex + 2));
13586
+ meta.moveToNextRow(rows, nextIndex => {
13587
+ // the virtualiser doesn't always scroll right to the bottom for the last row
13588
+ if (nextIndex === rows.length - 1) {
13589
+ var _tableRef$current;
13590
+ (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.scrollTo(0, tableRef.current.scrollHeight);
13591
+ } else {
13592
+ virtualiser.scrollToIndex(nextIndex + 2);
13593
+ }
13594
+ });
13474
13595
  }
13475
13596
  return;
13476
13597
  }
@@ -13554,7 +13675,6 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
13554
13675
  }
13555
13676
  };
13556
13677
  }
13557
- // extract - infinite loading
13558
13678
  // TODO: this can probably be extracted into a hook
13559
13679
  // we only show the pinned shadow on display columns when scrolling is active
13560
13680
  const [scrolled, setScrolled] = React__default.useState(false);
@@ -13627,7 +13747,8 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
13627
13747
  }, meta.editMode.enableEditMode ? /*#__PURE__*/React__default.createElement(EditModeButton, {
13628
13748
  ref: editButtonRef,
13629
13749
  table: table,
13630
- tableRef: tableRef
13750
+ tableRef: tableRef,
13751
+ scrollToIndex: virtualiser.scrollToIndex
13631
13752
  }) : null, table.options.enableColumnFilters ? /*#__PURE__*/React__default.createElement(FiltersButton, {
13632
13753
  length: length,
13633
13754
  table: table
@@ -13638,12 +13759,12 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
13638
13759
  }) : null, table.options.enableGlobalFilter ? /*#__PURE__*/React__default.createElement(Search$2, {
13639
13760
  disabled: meta.shouldDisableTableActions,
13640
13761
  onSearch: table.setGlobalFilter,
13641
- placeholder: "Search...",
13642
13762
  value: globalFilter
13643
13763
  }) : null) : null, /*#__PURE__*/React__default.createElement(ShortcutsGuideButton, {
13644
13764
  table: table
13645
13765
  })) : null, /*#__PURE__*/React__default.createElement("div", {
13646
13766
  className: className,
13767
+ "data-taco": "table2",
13647
13768
  onBlur: handleBlur,
13648
13769
  onKeyDown: handleKeyDown,
13649
13770
  onMouseLeave: handleMouseLeave,
@@ -13660,6 +13781,7 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
13660
13781
  tabIndex: 0
13661
13782
  }, /*#__PURE__*/React__default.createElement("div", {
13662
13783
  className: "contents",
13784
+ "data-taco": "table2-header",
13663
13785
  role: "rowgroup"
13664
13786
  }, table.getHeaderGroups().map(headerGroup => /*#__PURE__*/React__default.createElement("div", {
13665
13787
  className: "contents",
@@ -13675,6 +13797,7 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
13675
13797
  tableRef: tableRef
13676
13798
  }))))), rows.length ? /*#__PURE__*/React__default.createElement("div", {
13677
13799
  className: "contents",
13800
+ "data-taco": "table2-body",
13678
13801
  role: "rowgroup"
13679
13802
  }, virtualiserOffsets.top ? /*#__PURE__*/React__default.createElement("div", {
13680
13803
  style: {
@@ -13715,7 +13838,8 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
13715
13838
  className: "col-span-full min-h-[theme(spacing.8)]"
13716
13839
  }, EmptyState ? /*#__PURE__*/React__default.createElement(EmptyState, null) : null), hasFooters ? /*#__PURE__*/React__default.createElement("div", {
13717
13840
  role: "rowgroup",
13718
- className: "contents"
13841
+ className: "contents",
13842
+ "data-taco": "table2-footer"
13719
13843
  }, table.getFooterGroups().map(footerGroup => /*#__PURE__*/React__default.createElement("div", {
13720
13844
  key: footerGroup.id,
13721
13845
  role: "row",