@economic/taco 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. package/dist/components/Icon/components/Lock.d.ts +3 -0
  2. package/dist/components/Icon/components/index.d.ts +1 -1
  3. package/dist/components/Input/Input.d.ts +1 -1
  4. package/dist/components/Menu/Menu.d.ts +2 -1
  5. package/dist/components/Menu/components/Content.d.ts +1 -1
  6. package/dist/components/Menu/components/Item.d.ts +1 -1
  7. package/dist/components/Menu/components/Link.d.ts +1 -1
  8. package/dist/components/Menu/components/Separator.d.ts +4 -2
  9. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  10. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  11. package/dist/components/Select2/components/Option.d.ts +1 -1
  12. package/dist/components/Select2/components/Search.d.ts +1 -1
  13. package/dist/components/Table3/components/columns/styles.d.ts +1 -0
  14. package/dist/components/Table3/components/toolbar/ColumnSettings.d.ts +3 -2
  15. package/dist/components/Table3/components/toolbar/Filter/filters/Filters.d.ts +1 -1
  16. package/dist/components/Table3/components/toolbar/PrintButton/WarningDialog.d.ts +2 -1
  17. package/dist/components/Table3/components/toolbar/Settings.d.ts +6 -0
  18. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +3 -3
  19. package/dist/components/Table3/hooks/useCssGrid.d.ts +1 -1
  20. package/dist/components/Tag/Tag.d.ts +1 -1
  21. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +1 -8
  22. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +1 -1
  24. package/dist/esm/packages/taco/src/components/Icon/components/Lock.js +19 -0
  25. package/dist/esm/packages/taco/src/components/Icon/components/Lock.js.map +1 -0
  26. package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
  27. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +7 -6
  31. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -3
  33. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +1 -1
  35. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js +2 -2
  37. package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Table3/Table3.js +9 -4
  39. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +3 -2
  41. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +3 -2
  43. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +2 -1
  45. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +34 -35
  47. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +19 -7
  49. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +66 -18
  51. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +12 -8
  53. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/WarningDialog.js +5 -1
  55. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/WarningDialog.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +2 -2
  57. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js +61 -0
  59. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Settings.js.map +1 -0
  60. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js +8 -35
  61. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Toolbar.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js +3 -2
  63. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +1 -1
  65. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +1 -1
  67. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +5 -2
  69. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +2 -1
  71. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +8 -4
  73. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js +1 -1
  75. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +7 -3
  77. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +9 -4
  79. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +10 -12
  81. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  82. package/dist/esm/packages/taco/src/index.js +2 -2
  83. package/dist/taco.cjs.development.js +377 -247
  84. package/dist/taco.cjs.development.js.map +1 -1
  85. package/dist/taco.cjs.production.min.js +1 -1
  86. package/dist/taco.cjs.production.min.js.map +1 -1
  87. package/package.json +14 -14
  88. package/types.json +14107 -11816
@@ -2107,6 +2107,21 @@ function IconLockOpen(props, svgRef) {
2107
2107
  }
2108
2108
  var LockOpen = /*#__PURE__*/React.forwardRef(IconLockOpen);
2109
2109
 
2110
+ function IconLock(props, svgRef) {
2111
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
2112
+ fill: "none",
2113
+ xmlns: "http://www.w3.org/2000/svg",
2114
+ viewBox: "0 0 24 24",
2115
+ ref: svgRef
2116
+ }, props), /*#__PURE__*/React.createElement("path", {
2117
+ fillRule: "evenodd",
2118
+ clipRule: "evenodd",
2119
+ d: "M12 1a5 5 0 015 5v2h1.25c.966 0 1.75.784 1.75 1.75v10.5A1.75 1.75 0 0118.25 22H5.75A1.75 1.75 0 014 20.25V9.75C4 8.784 4.784 8 5.75 8H7V6a5 5 0 015-5zm6.25 8.5H5.75a.25.25 0 00-.243.193L5.5 9.75v10.5a.25.25 0 00.193.243l.057.007h12.5a.25.25 0 00.243-.193l.007-.057V9.75a.25.25 0 00-.193-.243L18.25 9.5zM12 13a1.5 1.5 0 01.751 2.799l-.001.951a.75.75 0 01-1.5 0v-.95A1.5 1.5 0 0112 13zm0-10.5a3.5 3.5 0 00-3.495 3.308L8.5 6v2h7V6a3.5 3.5 0 00-3.308-3.495L12 2.5z",
2120
+ fill: "currentColor"
2121
+ }));
2122
+ }
2123
+ var Lock = /*#__PURE__*/React.forwardRef(IconLock);
2124
+
2110
2125
  function IconLogOut(props, svgRef) {
2111
2126
  return /*#__PURE__*/React.createElement("svg", Object.assign({
2112
2127
  fill: "none",
@@ -3395,6 +3410,7 @@ const icons = {
3395
3410
  'list-search': ListSearch,
3396
3411
  list: List,
3397
3412
  'lock-open': LockOpen,
3413
+ lock: Lock,
3398
3414
  'log-out': LogOut,
3399
3415
  log: Log,
3400
3416
  market: Market,
@@ -3967,31 +3983,29 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
3967
3983
 
3968
3984
  const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
3969
3985
  const {
3970
- title,
3971
3986
  children,
3972
3987
  placement,
3988
+ title,
3973
3989
  ...otherProps
3974
3990
  } = props;
3975
- const className = cn(otherProps.className);
3991
+ const className = cn('xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white', otherProps.className);
3992
+ const style = {
3993
+ transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
3994
+ };
3976
3995
  return /*#__PURE__*/React.createElement(TooltipPrimitive.Root, {
3977
3996
  delayDuration: 250
3978
3997
  }, /*#__PURE__*/React.createElement(TooltipPrimitive.Trigger, {
3979
3998
  asChild: true,
3980
3999
  ref: ref
3981
4000
  }, children), /*#__PURE__*/React.createElement(TooltipPrimitive.Portal, null, /*#__PURE__*/React.createElement(TooltipPrimitive.Content, Object.assign({}, otherProps, {
3982
- asChild: true,
3983
4001
  className: className,
3984
- side: placement,
3985
- sideOffset: 3
3986
- }), /*#__PURE__*/React.createElement("div", {
3987
- className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white",
3988
4002
  "data-taco": "tooltip",
3989
- style: {
3990
- transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
3991
- }
3992
- }, /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
4003
+ side: placement,
4004
+ sideOffset: 3,
4005
+ style: style
4006
+ }), /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
3993
4007
  className: "-mt-px fill-blue-900/90 stroke-blue-900/90"
3994
- }), title))));
4008
+ }), title)));
3995
4009
  });
3996
4010
 
3997
4011
  const getButtonClasses = () => {
@@ -4319,8 +4333,8 @@ const defaultLocalisationTexts = {
4319
4333
  },
4320
4334
  columnSettings: {
4321
4335
  search: 'Search column...',
4322
- tooltip: 'Columns',
4323
- button: 'Columns',
4336
+ tooltip: 'Column settings',
4337
+ button: 'Column settings',
4324
4338
  noResults: 'No results'
4325
4339
  },
4326
4340
  editing: {
@@ -4444,7 +4458,7 @@ const defaultLocalisationTexts = {
4444
4458
  collapseRow: 'Collapse current row'
4445
4459
  },
4446
4460
  otherOptions: {
4447
- tooltip: 'Other options'
4461
+ tooltip: 'Table settings'
4448
4462
  }
4449
4463
  },
4450
4464
  searchInput: {
@@ -5688,12 +5702,6 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5688
5702
  const className = cn('inline-flex relative', {
5689
5703
  'yt-combobox--inline': props.inline
5690
5704
  }, externalClassName);
5691
- const handleKeydown = event => {
5692
- const isInsideEditingCell = !!event.target.closest('[role="cell"]');
5693
- if (!isInsideEditingCell && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
5694
- event.stopPropagation();
5695
- }
5696
- };
5697
5705
  return /*#__PURE__*/React.createElement("span", {
5698
5706
  className: className,
5699
5707
  "data-taco": "combobox",
@@ -5703,8 +5711,7 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5703
5711
  ref: internalRef
5704
5712
  }, /*#__PURE__*/React.createElement("div", Object.assign({}, combobox, {
5705
5713
  className: "inline w-full",
5706
- ref: ref,
5707
- onKeyDown: handleKeydown
5714
+ ref: ref
5708
5715
  }), /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
5709
5716
  autoComplete: "off",
5710
5717
  button: props.inline ? /*#__PURE__*/React.createElement(IconButton
@@ -7845,11 +7852,12 @@ const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props,
7845
7852
  });
7846
7853
  RadioGroup$1.Item = RadioItem;
7847
7854
 
7848
- const Separator = () => {
7849
- return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
7850
- className: "bg-grey-300 my-1 h-px"
7851
- });
7852
- };
7855
+ const Separator = /*#__PURE__*/React.forwardRef((props, ref) => {
7856
+ return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, Object.assign({}, props, {
7857
+ className: "bg-grey-300 my-1 h-px",
7858
+ ref: ref
7859
+ }));
7860
+ });
7853
7861
 
7854
7862
  const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
7855
7863
  const menu = useCurrentMenu();
@@ -9079,7 +9087,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
9079
9087
  const handleClear = () => {
9080
9088
  requestAnimationFrame(() => {
9081
9089
  var _internalRef$current2;
9082
- return (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.focus();
9090
+ return (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.blur();
9083
9091
  });
9084
9092
  handleChange('');
9085
9093
  };
@@ -11288,9 +11296,9 @@ const useTableKeyboardNavigation = (props, rows, rowProps, ref) => {
11288
11296
  }
11289
11297
  });
11290
11298
  const onKeyDown = event => {
11291
- var _document$activeEleme;
11299
+ var _document$activeEleme, _document$activeEleme2;
11292
11300
  const isModifierKeyPressed = event.metaKey || event.ctrlKey || event.altKey || event.shiftKey;
11293
- if (useGlobalKeyboardNavigation && document.activeElement !== ref.current && ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('type')) !== 'search' && document.activeElement !== document.body) {
11301
+ if (useGlobalKeyboardNavigation && document.activeElement !== ref.current && ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('type')) !== 'search' && document.activeElement !== document.body && ((_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 ? void 0 : _document$activeEleme2.getAttribute('role')) !== 'dialog') {
11294
11302
  return;
11295
11303
  }
11296
11304
  // abort key handling if other elements inside table are focused and we don't use global keyboard navigation
@@ -16573,6 +16581,7 @@ function getCellValueAsString(value, dataType) {
16573
16581
  }
16574
16582
 
16575
16583
  const MIN_COLUMN_SIZE$1 = 80; // accounts for padding and sort controls
16584
+ const PRINT_MIN_COLUMN_SIZE = 20; // while printing, it accounts for minimum width each column can take
16576
16585
  const getCellAlignmentClasses$1 = (alignment = 'left') => {
16577
16586
  return cn({
16578
16587
  'justify-start text-left': alignment === 'left',
@@ -16585,7 +16594,7 @@ const getInputAppearanceClassnames = () => {
16585
16594
  return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
16586
16595
  };
16587
16596
 
16588
- const useCssGrid = table => {
16597
+ const useCssGrid = (table, isPrintTable = false) => {
16589
16598
  const allVisibleColumns = table.getVisibleLeafColumns();
16590
16599
  const columnSizing = table.getState().columnSizing;
16591
16600
  const rowsLength = table.getRowModel().rows.length;
@@ -16598,7 +16607,11 @@ const useCssGrid = table => {
16598
16607
  // column has a getSize function, but it always returns a default value (150), and we want the
16599
16608
  // first render to use auto layout - so we get the size directly from table state where it is undefined
16600
16609
  const width = columnSizing[column.id];
16601
- if (isInternalColumn$1(column.id)) {
16610
+ const isColumnInternal = isInternalColumn$1(column.id);
16611
+ if (isPrintTable) {
16612
+ const maxWidth = isColumnInternal ? `${column.getSize()}px` : '1fr';
16613
+ size = `minmax(${PRINT_MIN_COLUMN_SIZE}px, ${maxWidth})`;
16614
+ } else if (isColumnInternal) {
16602
16615
  if (column.id === COLUMN_ID) {
16603
16616
  size = 'minmax(max-content, auto)';
16604
16617
  } else {
@@ -16638,7 +16651,7 @@ const useCssGrid = table => {
16638
16651
  };
16639
16652
  };
16640
16653
 
16641
- function useCurrentRow(defaultCurrentRowIndex = 0) {
16654
+ function useCurrentRow(defaultCurrentRowIndex) {
16642
16655
  const [currentRowIndex, setCurrentRowIndex] = React__default.useState(defaultCurrentRowIndex);
16643
16656
  const move = (direction, length, scrollToIndex) => setCurrentRowIndex(currentIndex => {
16644
16657
  const nextIndex = currentIndex !== undefined ? getNextIndex$2(direction, currentIndex, length) : 0;
@@ -17058,7 +17071,8 @@ function useCurrentRowListener(table) {
17058
17071
  const meta = table.options.meta;
17059
17072
  const rows = table.getRowModel().rows;
17060
17073
  React__default.useEffect(() => {
17061
- if (meta.currentRow.currentRowIndex > rows.length) {
17074
+ const currentRowIndex = meta.currentRow.currentRowIndex;
17075
+ if (currentRowIndex !== undefined && currentRowIndex > rows.length) {
17062
17076
  meta.currentRow.setCurrentRowIndex(0);
17063
17077
  }
17064
17078
  }, [rows.length]);
@@ -17121,8 +17135,9 @@ function useColumnFreezingStyle(tableId, table) {
17121
17135
  if (tableMeta.columnFreezing.frozenInternalColumnCount > 0 || tableMeta.columnFreezing.isEnabled && frozenColumnIndex !== undefined) {
17122
17136
  var _visibleFrozenColumns;
17123
17137
  const visibleFrozenColumns = table.getVisibleLeafColumns().slice(0, frozenColumnIndex + 1);
17124
- // if all frozen columns haven't had their size set yet, then abort
17125
- if (visibleFrozenColumns.every(column => columnSizing[column.id] === undefined)) {
17138
+ const visibleExternalFrozenColumns = visibleFrozenColumns.filter(column => !isInternalColumn$1(column.id));
17139
+ // if all external frozen columns haven't had their size set yet, then abort
17140
+ if (visibleExternalFrozenColumns.length && visibleExternalFrozenColumns.every(column => columnSizing[column.id] === undefined)) {
17126
17141
  return undefined;
17127
17142
  }
17128
17143
  const offsets = {};
@@ -17168,9 +17183,12 @@ function useRowSelection() {
17168
17183
  const rows = table.getRowModel().rows;
17169
17184
  const tableMeta = table.options.meta;
17170
17185
  if (event.key === ' ') {
17171
- var _rows$tableMeta$curre;
17172
17186
  event.preventDefault();
17173
- (_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.toggleSelected();
17187
+ const currentRowIndex = tableMeta.currentRow.currentRowIndex;
17188
+ if (currentRowIndex !== undefined) {
17189
+ var _rows$currentRowIndex;
17190
+ (_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.toggleSelected();
17191
+ }
17174
17192
  return;
17175
17193
  } else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
17176
17194
  event.preventDefault();
@@ -17193,7 +17211,7 @@ function useRowClick(onRowClick) {
17193
17211
  const tableMeta = table.options.meta;
17194
17212
  if (event.key === 'Enter') {
17195
17213
  event.preventDefault();
17196
- if (onRowClick) {
17214
+ if (onRowClick && tableMeta.currentRow.currentRowIndex !== undefined) {
17197
17215
  onRowClick(rows[tableMeta.currentRow.currentRowIndex].original);
17198
17216
  }
17199
17217
  return;
@@ -17972,7 +17990,7 @@ function EditingCell$1(props) {
17972
17990
  }));
17973
17991
  }
17974
17992
  const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditingCell(props) {
17975
- var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$tableMeta$curre, _column$columnDef$met;
17993
+ var _tableMeta$editing$ge, _tableMeta$editing$ro, _rows$currentRowIndex, _column$columnDef$met;
17976
17994
  const {
17977
17995
  cell,
17978
17996
  column,
@@ -18024,7 +18042,8 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
18024
18042
  // row move indicator
18025
18043
  const moveReason = (_tableMeta$editing$ro = tableMeta.editing.rowMoveReason[cell.column.id]) !== null && _tableMeta$editing$ro !== void 0 ? _tableMeta$editing$ro : null;
18026
18044
  const rows = table.getRowModel().rows;
18027
- const isCurrentRow = ((_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.id) === row.id;
18045
+ const currentRowIndex = tableMeta.currentRow.currentRowIndex;
18046
+ const isCurrentRow = currentRowIndex !== undefined && ((_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.id) === row.id;
18028
18047
  const mountNode = React__default.useMemo(() => {
18029
18048
  if (moveReason) {
18030
18049
  var _cellRef$current2, _cellRef$current2$par;
@@ -18114,7 +18133,7 @@ function getRowMoveReason(table, rowIndex, rowValues, cell, newValue) {
18114
18133
  }
18115
18134
 
18116
18135
  function Cell$3(props) {
18117
- var _rows$tableMeta$curre;
18136
+ var _rows$currentRowIndex;
18118
18137
  const {
18119
18138
  column,
18120
18139
  row,
@@ -18126,7 +18145,8 @@ function Cell$3(props) {
18126
18145
  const rows = table.getRowModel().rows;
18127
18146
  const tableMeta = table.options.meta;
18128
18147
  const columnMeta = column.columnDef.meta;
18129
- const isCurrentRow = ((_rows$tableMeta$curre = rows[tableMeta.currentRow.currentRowIndex]) === null || _rows$tableMeta$curre === void 0 ? void 0 : _rows$tableMeta$curre.id) === row.id;
18148
+ const currentRowIndex = tableMeta.currentRow.currentRowIndex;
18149
+ const isCurrentRow = currentRowIndex !== undefined && ((_rows$currentRowIndex = rows[currentRowIndex]) === null || _rows$currentRowIndex === void 0 ? void 0 : _rows$currentRowIndex.id) === row.id;
18130
18150
  if (tableMeta.editing.isEditing && columnMeta.control && (isCurrentRow || isHoveredRow && !tableMeta.hoverState.isPaused)) {
18131
18151
  return /*#__PURE__*/React__default.createElement(EditingCell$1, Object.assign({}, props));
18132
18152
  }
@@ -18545,7 +18565,7 @@ function useShortcutsListener(table, shortcuts) {
18545
18565
  const shortcutKeys = Object.keys(shortcuts !== null && shortcuts !== void 0 ? shortcuts : {});
18546
18566
  const globalHandlers = [];
18547
18567
  // convert the shortcut into the correct format to register it
18548
- if (shortcuts && shortcutKeys.length) {
18568
+ if (shortcuts && shortcutKeys.length && meta.currentRow.currentRowIndex !== undefined) {
18549
18569
  const currentRow = rows[meta.currentRow.currentRowIndex];
18550
18570
  shortcutKeys.forEach(key => {
18551
18571
  const handler = shortcuts[key];
@@ -18613,10 +18633,14 @@ function useEditingStateListener(table) {
18613
18633
  }, [meta.currentRow.currentRowIndex]);
18614
18634
  // save if editing gets toggled off
18615
18635
  React__default.useEffect(() => {
18616
- if (meta.editing.isEnabled && !meta.editing.isEditing) {
18617
- requestAnimationFrame(() => {
18618
- meta.editing.saveChangesIfNeeded();
18619
- });
18636
+ if (meta.editing.isEnabled) {
18637
+ if (!meta.editing.isEditing) {
18638
+ requestAnimationFrame(() => {
18639
+ meta.editing.saveChangesIfNeeded();
18640
+ });
18641
+ } else if (meta.currentRow.currentRowIndex === undefined) {
18642
+ meta.currentRow.setCurrentRowIndex(0);
18643
+ }
18620
18644
  }
18621
18645
  }, [meta.editing.isEditing]);
18622
18646
  }
@@ -18748,10 +18772,15 @@ function useTable$2(props) {
18748
18772
  tableOptions.globalFilterFn = (row, columnId, searchQuery) => {
18749
18773
  try {
18750
18774
  if (row.original) {
18751
- var _row$_getAllCellsByCo, _row$_getAllCellsByCo2;
18752
- const dataType = (_row$_getAllCellsByCo = row._getAllCellsByColumnId()[columnId]) === null || _row$_getAllCellsByCo === void 0 ? void 0 : (_row$_getAllCellsByCo2 = _row$_getAllCellsByCo.column.columnDef.meta) === null || _row$_getAllCellsByCo2 === void 0 ? void 0 : _row$_getAllCellsByCo2.dataType;
18753
- const cellValue = getCellValueAsString(row.original[columnId], dataType);
18754
- return globalFilterFn$1(cellValue, searchQuery);
18775
+ const cell = row.getAllCells().find(cell => cell.column.id === columnId);
18776
+ const columnMeta = cell === null || cell === void 0 ? void 0 : cell.column.columnDef.meta;
18777
+ if (cell && cell.column.getIsVisible() && columnMeta !== null && columnMeta !== void 0 && columnMeta.enableSearch) {
18778
+ const cellValue = getCellValueAsString(row.original[columnId], columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.dataType);
18779
+ if (cellValue !== undefined) {
18780
+ return globalFilterFn$1(cellValue, searchQuery);
18781
+ }
18782
+ }
18783
+ return false;
18755
18784
  }
18756
18785
  } catch {
18757
18786
  //
@@ -19298,32 +19327,6 @@ function useTableRenderStrategy$1(props, table, ref) {
19298
19327
  return useTableRenderStrategy(props, table, ref);
19299
19328
  }
19300
19329
 
19301
- function RowHeight(props) {
19302
- const {
19303
- texts
19304
- } = useLocalization();
19305
- const meta = props.table.options.meta;
19306
- const handleChange = value => {
19307
- const height = value;
19308
- meta.rowHeight.setHeight(height);
19309
- if (height === 'short' && meta.fontSize.size === 'large') {
19310
- meta.fontSize.setSize('medium');
19311
- }
19312
- };
19313
- return /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
19314
- onChange: handleChange,
19315
- value: meta.rowHeight.height
19316
- }, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
19317
- value: "short"
19318
- }, texts.table3.rowHeight.sizes.short), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
19319
- value: "medium"
19320
- }, texts.table3.rowHeight.sizes.medium), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
19321
- value: "tall"
19322
- }, texts.table3.rowHeight.sizes.tall), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
19323
- value: "extra-tall"
19324
- }, texts.table3.rowHeight.sizes.extraTall)));
19325
- }
19326
-
19327
19330
  // augments useEffect to not run debounced
19328
19331
  function useDebouncedEffect(effect, deps, ms = 200) {
19329
19332
  const timeoutRef = React__default.useRef();
@@ -19465,10 +19468,10 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
19465
19468
  columns.forEach((column, columnIndex) => {
19466
19469
  try {
19467
19470
  var _column$columnDef$met;
19468
- if ((_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
19471
+ if (column.getIsVisible() && (_column$columnDef$met = column.columnDef.meta) !== null && _column$columnDef$met !== void 0 && _column$columnDef$met.enableSearch) {
19469
19472
  var _row$original, _column$columnDef$met2;
19470
19473
  const cellValue = getCellValueAsString((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[column.id], (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.dataType);
19471
- if (cellValue && globalFilterFn$1(cellValue, value)) {
19474
+ if (cellValue !== undefined && globalFilterFn$1(cellValue, value)) {
19472
19475
  indexes.push([rowIndex, columnIndex]);
19473
19476
  }
19474
19477
  }
@@ -19835,11 +19838,27 @@ function Filter$1(props) {
19835
19838
  }));
19836
19839
  }
19837
19840
 
19841
+ const useMatchMedia = (query, defaultMatches = false) => {
19842
+ const [matches, setMatches] = React__default.useState(defaultMatches);
19843
+ const handleChange = React__default.useCallback(event => setMatches(event.matches), []);
19844
+ React__default.useEffect(() => {
19845
+ const mediaQuery = window.matchMedia(query);
19846
+ setMatches(mediaQuery.matches);
19847
+ mediaQuery.addEventListener('change', handleChange);
19848
+ return () => {
19849
+ mediaQuery.removeEventListener('change', handleChange);
19850
+ };
19851
+ }, []);
19852
+ return matches;
19853
+ };
19854
+
19855
+ const useIsLargeScreen = () => useMatchMedia('(min-width: 1024px)', window.innerWidth > 1024);
19856
+
19838
19857
  function sortByHeader(a, b) {
19839
19858
  var _a$columnDef$meta, _a$columnDef$meta$hea, _a$columnDef$meta$hea2, _b$columnDef$meta;
19840
19859
  return (_a$columnDef$meta = a.columnDef.meta) === null || _a$columnDef$meta === void 0 ? void 0 : (_a$columnDef$meta$hea = _a$columnDef$meta.header) === null || _a$columnDef$meta$hea === void 0 ? void 0 : (_a$columnDef$meta$hea2 = _a$columnDef$meta$hea.localeCompare) === null || _a$columnDef$meta$hea2 === void 0 ? void 0 : _a$columnDef$meta$hea2.call(_a$columnDef$meta$hea, (_b$columnDef$meta = b.columnDef.meta) === null || _b$columnDef$meta === void 0 ? void 0 : _b$columnDef$meta.header);
19841
19860
  }
19842
- function Filters(props) {
19861
+ function FiltersButton$1(props) {
19843
19862
  const {
19844
19863
  total,
19845
19864
  table
@@ -19849,6 +19868,7 @@ function Filters(props) {
19849
19868
  texts
19850
19869
  } = useLocalization();
19851
19870
  const ref = React__default.useRef(null);
19871
+ const isLargeScreen = useIsLargeScreen();
19852
19872
  const allColumns = table.getAllLeafColumns().filter(column => !isInternalColumn$1(column.id)).sort(sortByHeader);
19853
19873
  const appliedFilters = table.getState().columnFilters;
19854
19874
  useGlobalKeyDown({
@@ -19911,8 +19931,8 @@ function Filters(props) {
19911
19931
  setFilters([]);
19912
19932
  setPlaceholderCount(1);
19913
19933
  };
19914
- return /*#__PURE__*/React__default.createElement(Button$1, {
19915
- "aria-label": texts.table3.filters.tooltip,
19934
+ const buttonProps = {
19935
+ 'aria-label': texts.table3.filters.tooltip,
19916
19936
  className: cn({
19917
19937
  '!wcag-blue-100': appliedFilters.length
19918
19938
  }),
@@ -19956,7 +19976,7 @@ function Filters(props) {
19956
19976
  appearance: "primary",
19957
19977
  onClick: handleApply
19958
19978
  }, "Apply"))))),
19959
- ref: ref,
19979
+ ref,
19960
19980
  tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
19961
19981
  className: "ml-2",
19962
19982
  keys: {
@@ -19965,97 +19985,18 @@ function Filters(props) {
19965
19985
  shift: true
19966
19986
  }
19967
19987
  }))
19968
- }, /*#__PURE__*/React__default.createElement(Icon, {
19969
- name: appliedFilters.length ? 'filter-solid' : 'filter'
19970
- }), texts.table3.filters.button, " ", appliedFilters.length ? `(${appliedFilters.length})` : '');
19971
- }
19972
-
19973
- const Column$4 = /*#__PURE__*/React__default.forwardRef(function Column(props, ref) {
19974
- var _column$columnDef$met;
19975
- const {
19976
- column,
19977
- draggable = false,
19978
- ...dragAttributes
19979
- } = props;
19980
- const canHide = column.getCanHide();
19981
- const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {
19982
- 'hover:bg-grey-200': canHide || draggable,
19983
- 'hover:cursor-pointer': canHide,
19984
- 'active:cursor-move active:bg-grey-300': draggable
19985
- });
19986
- const attributes = draggable ? dragAttributes : undefined;
19987
- const isVisible = column.getIsVisible();
19988
- return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
19989
- key: column.id,
19990
- className: className,
19991
- onClick: () => column.toggleVisibility(!isVisible),
19992
- ref: ref
19993
- }), draggable ? /*#__PURE__*/React__default.createElement(Icon, {
19994
- name: "drag",
19995
- className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5"
19996
- }) : null, /*#__PURE__*/React__default.createElement("span", {
19997
- className: "flex-grow truncate"
19998
- }, (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
19999
- checked: isVisible,
20000
- onChange: () => column.toggleVisibility(!isVisible)
20001
- }) : null);
20002
- });
20003
- function ColumnSettings(props) {
20004
- const {
20005
- table
20006
- } = props;
20007
- const {
20008
- texts
20009
- } = useLocalization();
20010
- const [query, setQuery] = React__default.useState('');
20011
- const allColumns = table.getAllLeafColumns();
20012
- const tableMeta = table.options.meta;
20013
- const columns = React__default.useMemo(() => allColumns.filter(column => !isInternalColumn$1(column.id)).filter(column => {
20014
- var _column$columnDef$met2;
20015
- return query !== null && query !== void 0 && query.length ? (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.header.toLowerCase().includes(query.toLowerCase()) : true;
20016
- }), [allColumns, query]);
20017
- const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';
20018
- const handleReorder = (activeId, overId) => {
20019
- if (columns.find(column => {
20020
- var _column$columnDef$met3;
20021
- return column.id === overId && ((_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.enableOrdering) === false;
20022
- })) {
20023
- return;
20024
- }
20025
- table.setColumnOrder(currentOrder => ensureOrdering$1(allColumns, SortablePrimitive.arrayMove(currentOrder, currentOrder.findIndex(c => c === activeId), currentOrder.findIndex(c => c === overId))));
20026
19988
  };
20027
- return /*#__PURE__*/React__default.createElement(Button$1, {
20028
- popover: popoverProps => /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
20029
- className: "flex w-60 flex-col gap-2"
20030
- }, table.options.enableHiding ? /*#__PURE__*/React__default.createElement(Input, {
20031
- onChange: event => setQuery(event.target.value),
20032
- placeholder: texts.table3.columnSettings.search,
20033
- value: query
20034
- }) : null, tableMeta.columnOrdering.isEnabled && columns.length && !(query !== null && query !== void 0 && query.length) ? /*#__PURE__*/React__default.createElement(Container, {
20035
- reorder: handleReorder
20036
- }, /*#__PURE__*/React__default.createElement(List$1, {
20037
- id: "columns",
20038
- className: listClassName
20039
- }, columns.map(column => {
20040
- var _column$columnDef$met4, _column$columnDef$met5;
20041
- return /*#__PURE__*/React__default.createElement(Item$3, {
20042
- key: column.id,
20043
- id: column.id,
20044
- disabled: !((_column$columnDef$met4 = column.columnDef.meta) !== null && _column$columnDef$met4 !== void 0 && _column$columnDef$met4.enableOrdering),
20045
- asChild: true
20046
- }, /*#__PURE__*/React__default.createElement(Column$4, {
20047
- column: column,
20048
- draggable: (_column$columnDef$met5 = column.columnDef.meta) === null || _column$columnDef$met5 === void 0 ? void 0 : _column$columnDef$met5.enableOrdering
20049
- }));
20050
- }))) : /*#__PURE__*/React__default.createElement("div", {
20051
- className: listClassName
20052
- }, columns.length ? columns.map(column => /*#__PURE__*/React__default.createElement(Column$4, {
20053
- column: column,
20054
- key: column.id
20055
- })) : texts.table3.columnSettings.noResults))))
20056
- }, /*#__PURE__*/React__default.createElement(Icon, {
20057
- name: "columns"
20058
- }), texts.table3.columnSettings.button);
19989
+ if (!isLargeScreen && !appliedFilters.length) {
19990
+ return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, buttonProps, {
19991
+ icon: "filter"
19992
+ }));
19993
+ }
19994
+ return /*#__PURE__*/React__default.createElement(Button$1, Object.assign({}, buttonProps), /*#__PURE__*/React__default.createElement(Icon, {
19995
+ className: cn({
19996
+ '-mr-1.5': !isLargeScreen
19997
+ }),
19998
+ name: appliedFilters.length ? 'filter-solid' : 'filter'
19999
+ }), isLargeScreen ? texts.table3.filters.button : '', appliedFilters.length ? `(${appliedFilters.length})` : '');
20059
20000
  }
20060
20001
 
20061
20002
  function EditButton(props) {
@@ -20185,6 +20126,7 @@ function PrintIFrame({
20185
20126
  const [contentRef, setContentRef] = React__default.useState(null);
20186
20127
  const [mountNode, setMountNode] = React__default.useState(null);
20187
20128
  const isFirefoxBrowser = React__default.useMemo(() => navigator.userAgent.toLowerCase().includes('firefox'), []);
20129
+ const isSafariBrowser = React__default.useMemo(() => navigator.userAgent.toLowerCase().includes('safari') && !navigator.userAgent.toLowerCase().includes('chrome'), []);
20188
20130
  const iframeWindow = contentRef === null || contentRef === void 0 ? void 0 : contentRef.contentWindow;
20189
20131
  const stylesReady = useParentStylesheets(iframeWindow);
20190
20132
  // Calls print method when table has loaded in the iframe.
@@ -20253,13 +20195,16 @@ function PrintIFrame({
20253
20195
  tableWrapper.classList.add('h-fit');
20254
20196
  tableWrapper.classList.add('[&>[role="table"]]:!h-fit');
20255
20197
  if (isFirefoxBrowser) {
20256
- // Fix for firefox bug which adds page-long whitespace between page's top content and table
20198
+ // Fix for firefox bug which adds page-long whitespace between page's top content and table.
20257
20199
  tableWrapper.classList.add('[&>[role="table"]]:!absolute');
20258
20200
  }
20259
- // Safari print preview assigns no width to the table when w-screen class is used.
20260
- // By assigning table a big static width and hiding the horizontal scrollbar, the table on chrome
20261
- // and safari will always take full page width.
20262
- tableWrapper.classList.add('w-[10000px]');
20201
+ // Makes sure table takes the full screen width.
20202
+ if (isSafariBrowser) {
20203
+ // Safari browser doesn't apply correct width to the columns when w-screen is used.
20204
+ tableWrapper.classList.add('w-full');
20205
+ } else {
20206
+ tableWrapper.classList.add('w-screen');
20207
+ }
20263
20208
  if (tableElement) {
20264
20209
  var _tableElement$parentN;
20265
20210
  (_tableElement$parentN = tableElement.parentNode) === null || _tableElement$parentN === void 0 ? void 0 : _tableElement$parentN.insertBefore(tableWrapper, tableElement);
@@ -20304,7 +20249,7 @@ function PrintIFrame({
20304
20249
  };
20305
20250
  // -top-60 -left-60 styles make sure that iframe is added outside of the viewport
20306
20251
  return /*#__PURE__*/React__default.createElement("iframe", {
20307
- className: "fixed -left-60 -top-60 !h-0 !w-0",
20252
+ className: "fixed -left-[6000px] -top-[6000px] -z-50 !h-0 !w-0",
20308
20253
  ref: setContentRef,
20309
20254
  // Temporary fix to support printing in firefox: Find another solution while upgrading React
20310
20255
  src: "javascript:void(0);"
@@ -20313,6 +20258,7 @@ function PrintIFrame({
20313
20258
 
20314
20259
  const WarningDialog = ({
20315
20260
  onAccept,
20261
+ onCancel,
20316
20262
  onClose,
20317
20263
  onVisibilityChange,
20318
20264
  ...props
@@ -20346,7 +20292,10 @@ const WarningDialog = ({
20346
20292
  checked: hideWarningDialog,
20347
20293
  onChange: setHideWarningDialog
20348
20294
  }), /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Button$1, {
20349
- onClick: handleClose
20295
+ onClick: () => {
20296
+ handleClose();
20297
+ onCancel();
20298
+ }
20350
20299
  }, texts.table3.print.warningDialog.cancelButtonText), /*#__PURE__*/React__default.createElement(Button$1, {
20351
20300
  appearance: "primary",
20352
20301
  autoFocus: true,
@@ -20376,20 +20325,23 @@ function PrintButton(props) {
20376
20325
  const {
20377
20326
  printWarningDialogVisibility
20378
20327
  } = tableMeta.printing;
20328
+ // When changing printTableId, update packages/taco/src/components/Table3/Table3.tsx file and other usages where
20329
+ // printTableId is used to figure out whether the table is a print table or not.
20379
20330
  const printTableId = `${tableProps.id}_print`;
20331
+ const excludeUnmatchedResults = tableMeta.search.excludeUnmatchedResults;
20380
20332
  const defaultSettings = React__default.useMemo(() => ({
20381
20333
  columnFreezingIndex: tableMeta.columnFreezing.frozenColumnIndex,
20382
20334
  columnOrder: state.columnOrder,
20383
20335
  columnSizing: state.columnSizing,
20384
20336
  columnVisibility: state.columnVisibility,
20385
- excludeUnmatchedRecordsInSearch: tableMeta.search.excludeUnmatchedResults,
20337
+ excludeUnmatchedRecordsInSearch: excludeUnmatchedResults,
20386
20338
  fontSize: tableMeta.fontSize.size,
20387
20339
  rowHeight: tableMeta.rowHeight.height,
20388
20340
  sorting: state.sorting,
20389
20341
  // we don't save these, but we must pass them to print
20390
20342
  columnFilters: state.columnFilters,
20391
20343
  globalFilter: state.globalFilter
20392
- }), [tableMeta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, tableMeta.search.excludeUnmatchedResults, tableMeta.fontSize.size, tableMeta.rowHeight.height, state.sorting, state.columnFilters, state.globalFilter]);
20344
+ }), [tableMeta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, excludeUnmatchedResults, tableMeta.fontSize.size, tableMeta.rowHeight.height, state.sorting, state.columnFilters, state.globalFilter]);
20393
20345
  const iframeTableProps = {
20394
20346
  ...tableProps,
20395
20347
  defaultSettings,
@@ -20405,20 +20357,51 @@ function PrintButton(props) {
20405
20357
  // Starts custom printing
20406
20358
  (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.click();
20407
20359
  });
20408
- const handleAfterPrint = () => {
20360
+ const handleLoadingError = error => {
20409
20361
  var _loadingToastRef$curr;
20410
- setIsPrinting(false);
20411
- (_loadingToastRef$curr = loadingToastRef.current) === null || _loadingToastRef$curr === void 0 ? void 0 : _loadingToastRef$curr.close();
20362
+ const errorMessage = `${texts.table3.print.error}: ${error}`;
20363
+ console.error(errorMessage);
20364
+ (_loadingToastRef$curr = loadingToastRef.current) === null || _loadingToastRef$curr === void 0 ? void 0 : _loadingToastRef$curr.error(errorMessage);
20365
+ };
20366
+ const restoreTableDataWithoutSearch = function () {
20367
+ try {
20368
+ const _temp = _catch(function () {
20369
+ var _tableMeta$printing$l, _tableMeta$printing;
20370
+ return Promise.resolve((_tableMeta$printing$l = (_tableMeta$printing = tableMeta.printing).loadAll) === null || _tableMeta$printing$l === void 0 ? void 0 : _tableMeta$printing$l.call(_tableMeta$printing, table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
20371
+ }, function (error) {
20372
+ handleLoadingError(error);
20373
+ });
20374
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
20375
+ } catch (e) {
20376
+ return Promise.reject(e);
20377
+ }
20378
+ };
20379
+ const handleAfterPrint = function () {
20380
+ try {
20381
+ function _temp3() {
20382
+ var _loadingToastRef$curr2;
20383
+ setIsPrinting(false);
20384
+ (_loadingToastRef$curr2 = loadingToastRef.current) === null || _loadingToastRef$curr2 === void 0 ? void 0 : _loadingToastRef$curr2.close();
20385
+ }
20386
+ const _temp2 = function () {
20387
+ if (tableMeta.printing.loadAll && excludeUnmatchedResults) {
20388
+ return Promise.resolve(restoreTableDataWithoutSearch()).then(function () {});
20389
+ }
20390
+ }();
20391
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
20392
+ } catch (e) {
20393
+ return Promise.reject(e);
20394
+ }
20412
20395
  };
20413
20396
  const handleBeforePrint = () => {
20414
- var _loadingToastRef$curr2;
20415
- (_loadingToastRef$curr2 = loadingToastRef.current) === null || _loadingToastRef$curr2 === void 0 ? void 0 : _loadingToastRef$curr2.close();
20397
+ var _loadingToastRef$curr3;
20398
+ (_loadingToastRef$curr3 = loadingToastRef.current) === null || _loadingToastRef$curr3 === void 0 ? void 0 : _loadingToastRef$curr3.close();
20416
20399
  };
20417
20400
  const handlePrint = function () {
20418
20401
  try {
20419
20402
  let _exit = false;
20420
- function _temp3(_result2) {
20421
- if (_exit) return _result2;
20403
+ function _temp6(_result3) {
20404
+ if (_exit) return _result3;
20422
20405
  if (hasNonSafeCellCount && printWarningDialogVisibility) {
20423
20406
  setShowWarningDialog(true);
20424
20407
  } else {
@@ -20431,7 +20414,7 @@ function PrintButton(props) {
20431
20414
  let hasNonSafeCellCount = false;
20432
20415
  // if loadAll is not defined, just print with what we've got
20433
20416
  // don't compare length to data.length because the api might be choosing not to return all for performance
20434
- const _temp2 = function () {
20417
+ const _temp5 = function () {
20435
20418
  if (!tableMeta.printing.loadAll) {
20436
20419
  const {
20437
20420
  data
@@ -20439,8 +20422,12 @@ function PrintButton(props) {
20439
20422
  const cellCount = getCellCount(data);
20440
20423
  hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;
20441
20424
  } else {
20442
- const _temp = _catch(function () {
20443
- return Promise.resolve(tableMeta.printing.loadAll(table.getState().sorting, table.getState().columnFilters, tableMeta.search.query)).then(function () {
20425
+ const _temp4 = _catch(function () {
20426
+ return Promise.resolve(tableMeta.printing.loadAll(table.getState().sorting, table.getState().columnFilters,
20427
+ // We need to pass search query to the server when printing, to be able to render correct data set in iFrame,
20428
+ // But in "display" table, search is performed only on client side, so we'll need to request data again without search query,
20429
+ // when printing will be finished.
20430
+ excludeUnmatchedResults ? tableMeta.search.query : undefined)).then(function () {
20444
20431
  // After the loadAll call above, the data changes. Hence, it becomes essential to acquire the data after
20445
20432
  // this call rather than before it.
20446
20433
  const {
@@ -20450,17 +20437,14 @@ function PrintButton(props) {
20450
20437
  hasNonSafeCellCount = cellCount > SAFE_PRINT_CELL_COUNT;
20451
20438
  });
20452
20439
  }, function (error) {
20453
- var _loadingToastRef$curr3;
20454
- const errorMessage = `${texts.table3.print.error}: ${error}`;
20455
- console.error(errorMessage);
20456
- (_loadingToastRef$curr3 = loadingToastRef.current) === null || _loadingToastRef$curr3 === void 0 ? void 0 : _loadingToastRef$curr3.error(errorMessage);
20440
+ handleLoadingError(error);
20457
20441
  // in case of error, we return early
20458
20442
  _exit = true;
20459
20443
  });
20460
- if (_temp && _temp.then) return _temp.then(function () {});
20444
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
20461
20445
  }
20462
20446
  }();
20463
- return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2));
20447
+ return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
20464
20448
  } catch (e) {
20465
20449
  return Promise.reject(e);
20466
20450
  }
@@ -20468,6 +20452,18 @@ function PrintButton(props) {
20468
20452
  const handleWarningDialogAccept = () => {
20469
20453
  setIsPrinting(true);
20470
20454
  };
20455
+ const handleWarningDialogCancel = function () {
20456
+ try {
20457
+ const _temp7 = function () {
20458
+ if (tableMeta.printing.loadAll && excludeUnmatchedResults) {
20459
+ return Promise.resolve(restoreTableDataWithoutSearch()).then(function () {});
20460
+ }
20461
+ }();
20462
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function () {}) : void 0);
20463
+ } catch (e) {
20464
+ return Promise.reject(e);
20465
+ }
20466
+ };
20471
20467
  const handleWarningDialogClose = () => {
20472
20468
  var _loadingToastRef$curr4;
20473
20469
  (_loadingToastRef$curr4 = loadingToastRef.current) === null || _loadingToastRef$curr4 === void 0 ? void 0 : _loadingToastRef$curr4.close();
@@ -20488,10 +20484,125 @@ function PrintButton(props) {
20488
20484
  open: showWarningDialog,
20489
20485
  onAccept: handleWarningDialogAccept,
20490
20486
  onClose: handleWarningDialogClose,
20487
+ onCancel: handleWarningDialogCancel,
20491
20488
  onVisibilityChange: tableMeta.printing.setPrintWarningDialogVisibility
20492
20489
  }));
20493
20490
  }
20494
20491
 
20492
+ function RowHeight(props) {
20493
+ const {
20494
+ texts
20495
+ } = useLocalization();
20496
+ const meta = props.table.options.meta;
20497
+ const handleChange = value => {
20498
+ const height = value;
20499
+ meta.rowHeight.setHeight(height);
20500
+ if (height === 'short' && meta.fontSize.size === 'large') {
20501
+ meta.fontSize.setSize('medium');
20502
+ }
20503
+ };
20504
+ return /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
20505
+ onChange: handleChange,
20506
+ value: meta.rowHeight.height
20507
+ }, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
20508
+ value: "short"
20509
+ }, texts.table3.rowHeight.sizes.short), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
20510
+ value: "medium"
20511
+ }, texts.table3.rowHeight.sizes.medium), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
20512
+ value: "tall"
20513
+ }, texts.table3.rowHeight.sizes.tall), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
20514
+ value: "extra-tall"
20515
+ }, texts.table3.rowHeight.sizes.extraTall)));
20516
+ }
20517
+
20518
+ const Column$4 = /*#__PURE__*/React__default.forwardRef(function Column(props, ref) {
20519
+ var _column$columnDef$met;
20520
+ const {
20521
+ column,
20522
+ draggable = false,
20523
+ ...dragAttributes
20524
+ } = props;
20525
+ const canHide = column.getCanHide();
20526
+ const className = cn('group/column flex items-center gap-x-2 rounded py-1 px-2', {
20527
+ 'hover:bg-grey-200': canHide || draggable,
20528
+ 'hover:cursor-pointer': canHide,
20529
+ 'active:cursor-move active:bg-grey-300': draggable
20530
+ });
20531
+ const attributes = draggable ? dragAttributes : undefined;
20532
+ const isVisible = column.getIsVisible();
20533
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
20534
+ key: column.id,
20535
+ className: className,
20536
+ onClick: () => column.toggleVisibility(!isVisible),
20537
+ ref: ref
20538
+ }), draggable ? /*#__PURE__*/React__default.createElement(Icon, {
20539
+ name: "drag",
20540
+ className: "text-grey-500 group-hover/column:text-grey-700 -mx-2 !h-5"
20541
+ }) : null, /*#__PURE__*/React__default.createElement("span", {
20542
+ className: "flex-grow truncate"
20543
+ }, (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.header), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
20544
+ checked: isVisible,
20545
+ onChange: () => column.toggleVisibility(!isVisible)
20546
+ }) : null);
20547
+ });
20548
+ function ColumnSettingsPopover(props) {
20549
+ const {
20550
+ table,
20551
+ trigger,
20552
+ ...popoverProps
20553
+ } = props;
20554
+ const {
20555
+ texts
20556
+ } = useLocalization();
20557
+ const [query, setQuery] = React__default.useState('');
20558
+ const allColumns = table.getAllLeafColumns();
20559
+ const tableMeta = table.options.meta;
20560
+ const columns = React__default.useMemo(() => allColumns.filter(column => !isInternalColumn$1(column.id)).filter(column => {
20561
+ var _column$columnDef$met2;
20562
+ return query !== null && query !== void 0 && query.length ? (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.header.toLowerCase().includes(query.toLowerCase()) : true;
20563
+ }), [allColumns, query]);
20564
+ const listClassName = 'flex max-h-64 flex-col gap-y-px overflow-auto';
20565
+ const handleReorder = (activeId, overId) => {
20566
+ if (columns.find(column => {
20567
+ var _column$columnDef$met3;
20568
+ return column.id === overId && ((_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.enableOrdering) === false;
20569
+ })) {
20570
+ return;
20571
+ }
20572
+ table.setColumnOrder(currentOrder => ensureOrdering$1(allColumns, SortablePrimitive.arrayMove(currentOrder, currentOrder.findIndex(c => c === activeId), currentOrder.findIndex(c => c === overId))));
20573
+ };
20574
+ return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
20575
+ anchor: trigger
20576
+ }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
20577
+ className: "flex w-60 flex-col gap-2"
20578
+ }, table.options.enableHiding ? /*#__PURE__*/React__default.createElement(Input, {
20579
+ onChange: event => setQuery(event.target.value),
20580
+ placeholder: texts.table3.columnSettings.search,
20581
+ value: query
20582
+ }) : null, tableMeta.columnOrdering.isEnabled && columns.length && !(query !== null && query !== void 0 && query.length) ? /*#__PURE__*/React__default.createElement(Container, {
20583
+ reorder: handleReorder
20584
+ }, /*#__PURE__*/React__default.createElement(List$1, {
20585
+ id: "columns",
20586
+ className: listClassName
20587
+ }, columns.map(column => {
20588
+ var _column$columnDef$met4, _column$columnDef$met5;
20589
+ return /*#__PURE__*/React__default.createElement(Item$3, {
20590
+ key: column.id,
20591
+ id: column.id,
20592
+ disabled: !((_column$columnDef$met4 = column.columnDef.meta) !== null && _column$columnDef$met4 !== void 0 && _column$columnDef$met4.enableOrdering),
20593
+ asChild: true
20594
+ }, /*#__PURE__*/React__default.createElement(Column$4, {
20595
+ column: column,
20596
+ draggable: (_column$columnDef$met5 = column.columnDef.meta) === null || _column$columnDef$met5 === void 0 ? void 0 : _column$columnDef$met5.enableOrdering
20597
+ }));
20598
+ }))) : /*#__PURE__*/React__default.createElement("div", {
20599
+ className: listClassName
20600
+ }, columns.length ? columns.map(column => /*#__PURE__*/React__default.createElement(Column$4, {
20601
+ column: column,
20602
+ key: column.id
20603
+ })) : texts.table3.columnSettings.noResults))));
20604
+ }
20605
+
20495
20606
  function FontSize$1(props) {
20496
20607
  const {
20497
20608
  texts
@@ -20511,6 +20622,57 @@ function FontSize$1(props) {
20511
20622
  }, texts.table3.fontSize.sizes.large)));
20512
20623
  }
20513
20624
 
20625
+ function SettingsButton(props) {
20626
+ const {
20627
+ table
20628
+ } = props;
20629
+ const {
20630
+ texts
20631
+ } = useLocalization();
20632
+ const [popover, setPopover] = React__default.useState(undefined);
20633
+ const tableMeta = table.options.meta;
20634
+ const hasColumnSettings = table.options.enableHiding || tableMeta.columnOrdering.isEnabled;
20635
+ let popoverElement;
20636
+ if (popover) {
20637
+ const handleClosePopover = () => setPopover(undefined);
20638
+ switch (popover) {
20639
+ case 'columnSettings':
20640
+ {
20641
+ if (hasColumnSettings) {
20642
+ popoverElement = props => /*#__PURE__*/React__default.createElement(ColumnSettingsPopover, Object.assign({}, props, {
20643
+ open: true,
20644
+ onChange: handleClosePopover,
20645
+ table: table
20646
+ }));
20647
+ }
20648
+ }
20649
+ }
20650
+ }
20651
+ return /*#__PURE__*/React__default.createElement(IconButton, {
20652
+ "aria-label": texts.table3.otherOptions.tooltip,
20653
+ icon: "sliders",
20654
+ menu: popoverElement ? undefined : menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
20655
+ align: "end"
20656
+ }, table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
20657
+ icon: "columns",
20658
+ onClick: () => setPopover('columnSettings')
20659
+ }, texts.table3.columnSettings.button), /*#__PURE__*/React__default.createElement(Menu$1.Separator, null)) : null, tableMeta.rowHeight.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
20660
+ icon: `height-${tableMeta.rowHeight.height}`,
20661
+ subMenu: () => /*#__PURE__*/React__default.createElement(RowHeight, {
20662
+ table: table
20663
+ })
20664
+ }, texts.table3.rowHeight.tooltip) : null, tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
20665
+ icon: "font-size",
20666
+ subMenu: () => /*#__PURE__*/React__default.createElement(FontSize$1, {
20667
+ table: table
20668
+ })
20669
+ }, texts.table3.fontSize.tooltip) : null)),
20670
+ popover: popoverElement,
20671
+ onClickCapture: event => event.preventDefault(),
20672
+ tooltip: texts.table3.otherOptions.tooltip
20673
+ });
20674
+ }
20675
+
20514
20676
  function Toolbar(props) {
20515
20677
  const {
20516
20678
  left,
@@ -20520,9 +20682,6 @@ function Toolbar(props) {
20520
20682
  tableProps,
20521
20683
  total
20522
20684
  } = props;
20523
- const {
20524
- texts
20525
- } = useLocalization();
20526
20685
  if (!isToolbarVisible(props)) {
20527
20686
  return null;
20528
20687
  }
@@ -20534,38 +20693,20 @@ function Toolbar(props) {
20534
20693
  className: "ml-auto flex-shrink-0 print:hidden"
20535
20694
  }, tableMeta.editing.isEnabled ? /*#__PURE__*/React__default.createElement(EditButton, {
20536
20695
  table: table
20537
- }) : null, table.options.enableColumnFilters ? /*#__PURE__*/React__default.createElement(Filters, {
20696
+ }) : null, table.options.enableColumnFilters ? /*#__PURE__*/React__default.createElement(FiltersButton$1, {
20538
20697
  table: table,
20539
20698
  total: total
20540
- }) : null, table.options.enableHiding || tableMeta.columnOrdering.isEnabled ? /*#__PURE__*/React__default.createElement(ColumnSettings, {
20541
- table: table
20542
- }) : null, tableMeta.printing.isEnabled ? /*#__PURE__*/React__default.createElement(PrintButton, {
20699
+ }) : null, right, tableMeta.printing.isEnabled ? /*#__PURE__*/React__default.createElement(PrintButton, {
20543
20700
  table: table,
20544
20701
  tableProps: tableProps
20545
- }) : null, right, isMoreVisible(props) ? /*#__PURE__*/React__default.createElement(Tooltip, {
20546
- title: texts.table3.otherOptions.tooltip
20547
- }, /*#__PURE__*/React__default.createElement(IconButton, {
20548
- "aria-label": texts.table3.otherOptions.tooltip,
20549
- icon: "more",
20550
- menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
20551
- align: "end"
20552
- }, tableMeta.rowHeight.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
20553
- icon: `height-${tableMeta.rowHeight.height}`,
20554
- subMenu: () => /*#__PURE__*/React__default.createElement(RowHeight, {
20555
- table: table
20556
- })
20557
- }, texts.table3.rowHeight.tooltip) : null, tableMeta.fontSize.isEnabled ? /*#__PURE__*/React__default.createElement(Menu$1.Item, {
20558
- icon: "font-size",
20559
- subMenu: () => /*#__PURE__*/React__default.createElement(FontSize$1, {
20560
- table: table
20561
- })
20562
- }, texts.table3.fontSize.tooltip) : null))
20563
- })) : null, tableMeta.search.isEnabled ? /*#__PURE__*/React__default.createElement(Search$3, {
20702
+ }) : null, isSettingsVisible(props) ? /*#__PURE__*/React__default.createElement(SettingsButton, {
20703
+ table: table
20704
+ }) : null, tableMeta.search.isEnabled ? /*#__PURE__*/React__default.createElement(Search$3, {
20564
20705
  scrollToIndex: scrollToIndex,
20565
20706
  table: table
20566
20707
  }) : null));
20567
20708
  }
20568
- function isMoreVisible(props) {
20709
+ function isSettingsVisible(props) {
20569
20710
  const {
20570
20711
  table
20571
20712
  } = props;
@@ -20850,9 +20991,12 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
20850
20991
  const bodyRef = React__default.useRef(null);
20851
20992
  React__default.useEffect(() => {
20852
20993
  const handleKeyDown = event => {
20853
- const dialog = document.querySelector('[role="dialog"]');
20854
- // Don't trigger global shortcuts on the table if it is outside of the dialog
20855
- if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
20994
+ const target = event.target;
20995
+ const dialog = target.closest('[role="dialog"]');
20996
+ const eventOriginatedFromCombobox = !!target.closest('[role="combobox"]');
20997
+ // Don't trigger global shortcuts on the table if event originated from a combobox or if table is
20998
+ // outside the dialog
20999
+ if (eventOriginatedFromCombobox || dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
20856
21000
  return;
20857
21001
  }
20858
21002
  tableMeta.hoverState.handleKeyDown(event);
@@ -20886,9 +21030,11 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
20886
21030
  'text-sm': tableMeta.fontSize.size === 'medium',
20887
21031
  'text-base': tableMeta.fontSize.size === 'large'
20888
21032
  });
21033
+ // Print tables have "_print" as the postfix for the table id, so we can use the it to determine
21034
+ // if the table is a print table or not.
20889
21035
  const {
20890
21036
  style: cssGridStyle
20891
- } = useCssGrid(table);
21037
+ } = useCssGrid(table, props.id.endsWith('_print'));
20892
21038
  const {
20893
21039
  style: cssVars
20894
21040
  } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);
@@ -21428,20 +21574,6 @@ const AgreementItem = props => {
21428
21574
  }))), children);
21429
21575
  };
21430
21576
 
21431
- const useMatchMedia = (query, defaultMatches = false) => {
21432
- const [matches, setMatches] = React__default.useState(defaultMatches);
21433
- const handleChange = React__default.useCallback(event => setMatches(event.matches), []);
21434
- React__default.useEffect(() => {
21435
- const mediaQuery = window.matchMedia(query);
21436
- setMatches(mediaQuery.matches);
21437
- mediaQuery.addEventListener('change', handleChange);
21438
- return () => {
21439
- mediaQuery.removeEventListener('change', handleChange);
21440
- };
21441
- }, []);
21442
- return matches;
21443
- };
21444
-
21445
21577
  const AgreementDisplay = props => {
21446
21578
  const {
21447
21579
  children,
@@ -21630,8 +21762,6 @@ const Content$9 = /*#__PURE__*/React__default.forwardRef(function LayoutContent(
21630
21762
  }));
21631
21763
  });
21632
21764
 
21633
- const useIsLargeScreen = () => useMatchMedia('(min-width: 1024px)', window.innerWidth > 1024);
21634
-
21635
21765
  const SidebarBackdrop = /*#__PURE__*/framerMotion.motion(Backdrop);
21636
21766
  const Sidebar = /*#__PURE__*/React__default.forwardRef(function LayoutSidebar(props, ref) {
21637
21767
  const {