@economic/taco 2.9.1 → 2.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/dist/components/Button/Button.d.ts +1 -1
  2. package/dist/components/IconButton/IconButton.d.ts +2 -2
  3. package/dist/components/Provider/Localization.d.ts +6 -0
  4. package/dist/components/Table3/components/columns/header/Header.d.ts +6 -1
  5. package/dist/components/Table3/components/columns/header/Menu.d.ts +4 -0
  6. package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +1 -0
  7. package/dist/components/Table3/hooks/useCssVars.d.ts +2 -1
  8. package/dist/components/Table3/hooks/useTable.d.ts +1 -0
  9. package/dist/components/Table3/types.d.ts +7 -0
  10. package/dist/esm/index.css +92 -16
  11. package/dist/esm/packages/taco/src/components/Button/util.js +5 -1
  12. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
  14. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Provider/Localization.js +7 -1
  16. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/Table3.js +11 -4
  18. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +5 -3
  20. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +2 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +0 -1
  24. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +1 -1
  26. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +30 -6
  28. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +36 -10
  30. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +3 -3
  32. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +1 -1
  36. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +2 -2
  38. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
  40. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +100 -44
  42. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +10 -0
  44. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +14 -0
  46. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +2 -1
  48. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  49. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +15 -2
  50. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
  51. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +1 -0
  52. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  53. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  54. package/dist/index.css +92 -16
  55. package/dist/taco.cjs.development.js +246 -83
  56. package/dist/taco.cjs.development.js.map +1 -1
  57. package/dist/taco.cjs.production.min.js +1 -1
  58. package/dist/taco.cjs.production.min.js.map +1 -1
  59. package/dist/types.d.ts +1 -1
  60. package/package.json +2 -2
  61. package/types.json +5780 -5236
@@ -4024,10 +4024,14 @@ const getAppearanceClasses = (value, icon = false) => {
4024
4024
  case 'discrete':
4025
4025
  {
4026
4026
  if (icon) {
4027
- return `bg-transparent text-black enabled:hover:bg-grey-200/80 disabled:text-black/30`;
4027
+ return `bg-transparent text-black enabled:hover:bg-[#000]/[0.08] disabled:text-black/30`;
4028
4028
  }
4029
4029
  return `bg-transparent text-blue-500 enabled:hover:text-blue-700 disabled:text-blue-500/50`;
4030
4030
  }
4031
+ case 'transparent':
4032
+ {
4033
+ return `bg-transparent text-black enabled:hover:text-black enabled:hover:bg-[#000]/[0.08] disabled:text-black/30`;
4034
+ }
4031
4035
  default:
4032
4036
  return `wcag-grey-200 enabled:hover:wcag-grey-300 disabled:bg-grey-200/50 disabled:text-black/30`;
4033
4037
  }
@@ -4321,7 +4325,13 @@ const defaultLocalisationTexts = {
4321
4325
  freezeColumns: (count = 1) => count === 1 ? 'Freeze the first column' : `Freeze first ${count} columns`,
4322
4326
  gotoRow: 'Go to',
4323
4327
  hideColumn: 'Hide column',
4324
- unfreezeColumns: 'Unfreeze all columns'
4328
+ unfreezeColumns: 'Unfreeze all columns',
4329
+ sorting: 'Sorting',
4330
+ sortingOrder: {
4331
+ ascending: 'Ascending order',
4332
+ descending: 'Descending order',
4333
+ unsorted: 'No sorting'
4334
+ }
4325
4335
  },
4326
4336
  resize: {
4327
4337
  tooltip: 'Resize column'
@@ -7474,7 +7484,7 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
7474
7484
  return () => {
7475
7485
  shortcuts.forEach(handler => document.removeEventListener('keydown', handler));
7476
7486
  };
7477
- }, []);
7487
+ }, [childrenWithRefs]);
7478
7488
  return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Portal, null, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Content, Object.assign({}, otherProps, {
7479
7489
  align: align,
7480
7490
  className: className,
@@ -15933,11 +15943,14 @@ function Menu$3(props) {
15933
15943
  const {
15934
15944
  canFreeze,
15935
15945
  canHide,
15946
+ canSort,
15936
15947
  index,
15937
15948
  menu,
15938
15949
  onGoto: handleGoto,
15939
15950
  onHide: handleHide,
15951
+ onSortToggle: handleSortToggle,
15940
15952
  scrollToIndex,
15953
+ sortDirection,
15941
15954
  table
15942
15955
  } = props;
15943
15956
  const tableMeta = table.options.meta;
@@ -15945,6 +15958,11 @@ function Menu$3(props) {
15945
15958
  texts
15946
15959
  } = useLocalization();
15947
15960
  const [popover, setPopover] = React__default.useState(undefined);
15961
+ const [sortDirectionState, setSortDirectionState] = React__default.useState(sortDirection);
15962
+ const handleSortMenuRadioGroupChange = newSortDirection => {
15963
+ setSortDirectionState(newSortDirection);
15964
+ handleSortToggle(newSortDirection);
15965
+ };
15948
15966
  let popoverElement;
15949
15967
  if (popover) {
15950
15968
  const handleClosePopover = () => setPopover(undefined);
@@ -15982,18 +16000,11 @@ function Menu$3(props) {
15982
16000
  }
15983
16001
  }
15984
16002
  }
15985
- const className = cn('-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] !w-6 !min-w-[theme(spacing.6)] flex-shrink-0 justify-end', {
15986
- '!flex': !!popoverElement
16003
+ const className = cn('-my-0.5 -mr-1 -ml-0.5 !h-6 !min-h-[theme(spacing.6)] flex-shrink-0 justify-end !w-0 !min-w-0 !overflow-hidden', 'aria-expanded:!min-w-[theme(spacing.6)] aria-expanded:!w-6 aria-expanded:!overflow-auto', 'focus:!min-w-[theme(spacing.6)] focus:!w-6 focus:!overflow-auto', 'group-hover/column:!min-w-[theme(spacing.6)] group-hover/column:!w-6 group-hover/column:!overflow-auto', {
16004
+ '!w-6 !min-w-[theme(spacing.6)] !overflow-auto': !!popoverElement
15987
16005
  }, props.className);
15988
16006
  const memoedMenuItems = React__default.useMemo(() => {
15989
16007
  const menuItems = [];
15990
- if (handleGoto) {
15991
- menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Item, {
15992
- icon: "move",
15993
- onClick: () => setPopover('goto'),
15994
- shortcut: "g"
15995
- }, texts.table3.columns.menu.gotoRow, "..."));
15996
- }
15997
16008
  if (canHide) {
15998
16009
  // we do this in the next tick, otherwise the menu closes and react throws a "state update on unmounted component" error
15999
16010
  const handleClick = event => setTimeout(() => handleHide(event), 1);
@@ -16002,6 +16013,30 @@ function Menu$3(props) {
16002
16013
  onClick: handleClick
16003
16014
  }, texts.table3.columns.menu.hideColumn));
16004
16015
  }
16016
+ // We rely on canSort value instead of onSort function's value because some columns might have sorting disabled,
16017
+ // so even though onSort is truthy, we don't want to show sorting menu.
16018
+ if (canSort) {
16019
+ menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Item, {
16020
+ icon: "sort-by",
16021
+ subMenu: () => /*#__PURE__*/React__default.createElement(Menu$1.SubMenu, null, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup, {
16022
+ onChange: handleSortMenuRadioGroupChange,
16023
+ value: sortDirectionState
16024
+ }, /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
16025
+ value: SORT_DIRECTION.ASC
16026
+ }, texts.table3.columns.menu.sortingOrder.ascending), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
16027
+ value: SORT_DIRECTION.DESC
16028
+ }, texts.table3.columns.menu.sortingOrder.descending), /*#__PURE__*/React__default.createElement(Menu$1.RadioGroup.Item, {
16029
+ value: false
16030
+ }, texts.table3.columns.menu.sortingOrder.unsorted)))
16031
+ }, texts.table3.columns.menu.sorting));
16032
+ }
16033
+ if (handleGoto) {
16034
+ menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Item, {
16035
+ icon: "move",
16036
+ onClick: () => setPopover('goto'),
16037
+ shortcut: "g"
16038
+ }, texts.table3.columns.menu.gotoRow, "..."));
16039
+ }
16005
16040
  if (canFreeze) {
16006
16041
  const frozenIndex = index - tableMeta.columnFreezing.frozenInternalColumnCount;
16007
16042
  const handleClick = () => tableMeta.columnFreezing.setFrozenColumnIndex(frozenIndex);
@@ -16034,7 +16069,7 @@ function Menu$3(props) {
16034
16069
  return menuItems.map((item, key) => /*#__PURE__*/React__default.cloneElement(item, {
16035
16070
  key
16036
16071
  }));
16037
- }, [menu, index, canFreeze, canHide, handleGoto, tableMeta.columnFreezing.frozenColumnIndex]);
16072
+ }, [menu, index, canFreeze, canHide, canSort, handleGoto, handleSortToggle, sortDirection, tableMeta.columnFreezing.frozenColumnIndex]);
16038
16073
  return /*#__PURE__*/React__default.createElement(IconButton, {
16039
16074
  className: className,
16040
16075
  icon: "more",
@@ -16112,6 +16147,10 @@ function getSortAttributes(toggleSorting, sortDirection) {
16112
16147
  };
16113
16148
  }
16114
16149
 
16150
+ const SORT_DIRECTION = {
16151
+ ASC: 'asc',
16152
+ DESC: 'desc'
16153
+ };
16115
16154
  function Header$2(props) {
16116
16155
  const {
16117
16156
  children,
@@ -16123,11 +16162,19 @@ function Header$2(props) {
16123
16162
  const tableMeta = table.options.meta;
16124
16163
  const columnMeta = React__default.useMemo(() => column.columnDef.meta, []);
16125
16164
  const canSort = column.getCanSort();
16165
+ const hasGoto = isGotoAvailable(table, header);
16126
16166
  // passing header or column results in re-renders on scroll, so anything from those objects as memoed props
16167
+ const handleHide = React__default.useMemo(() => header.column.getToggleVisibilityHandler(), []);
16127
16168
  const handleResize = React__default.useMemo(() => header.getResizeHandler(), []);
16128
16169
  const handleSort = React__default.useMemo(() => header.column.getToggleSortingHandler(), []);
16129
- const handleHide = React__default.useMemo(() => header.column.getToggleVisibilityHandler(), []);
16130
- const hasGoto = isGotoAvailable(table, header);
16170
+ const handleSortToggle = React__default.useCallback(sortDirection => {
16171
+ // When sorting is not applied, sortDirection is false.
16172
+ if (sortDirection === false) {
16173
+ header.column.clearSorting();
16174
+ } else {
16175
+ header.column.toggleSorting(sortDirection === SORT_DIRECTION.DESC);
16176
+ }
16177
+ }, []);
16131
16178
  const sorting = table.getState().sorting;
16132
16179
  const filters = table.getState().columnFilters;
16133
16180
  const search = table.getState().globalFilter;
@@ -16148,6 +16195,7 @@ function Header$2(props) {
16148
16195
  id: header.id,
16149
16196
  index: header.index,
16150
16197
  isFrozen: isFrozenColumn(header, table),
16198
+ isPrinting: tableMeta.isPrinting,
16151
16199
  isResizing: column.getIsResizing(),
16152
16200
  length: table.getRowModel().rows.length,
16153
16201
  meta: columnMeta,
@@ -16155,6 +16203,7 @@ function Header$2(props) {
16155
16203
  onHide: handleHide,
16156
16204
  onResize: handleResize,
16157
16205
  onSort: handleSort,
16206
+ onSortToggle: handleSortToggle,
16158
16207
  scrollToIndex,
16159
16208
  sortDirection: column.getIsSorted(),
16160
16209
  table
@@ -16174,6 +16223,7 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16174
16223
  id,
16175
16224
  index,
16176
16225
  isFrozen,
16226
+ isPrinting,
16177
16227
  isResizing,
16178
16228
  length,
16179
16229
  meta,
@@ -16181,13 +16231,17 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16181
16231
  onHide: handleHide,
16182
16232
  onResize: handleResize,
16183
16233
  onSort: handleSort,
16234
+ onSortToggle: handleSortToggle,
16184
16235
  scrollToIndex,
16185
16236
  sortDirection,
16186
16237
  table
16187
16238
  } = props;
16188
- const className = cn('sticky top-0 border-b-2 font-bold h-10 box-content items-center group/column relative', '[[role="table"][data-resizing="true"]_&]:pointer-events-none', {
16239
+ const className = cn('sticky top-0 border-b-2 font-bold box-content group/column relative', '[[role="table"][data-resizing="true"]_&]:pointer-events-none', 'px-[var(--table3-cell-padding-x)]', {
16240
+ 'h-10 items-center': !isPrinting,
16241
+ 'pb-2': isPrinting,
16189
16242
  'cursor-pointer select-none': canSort,
16190
16243
  'hover:bg-grey-100': canSort || canResize || hasMenu,
16244
+ 'focus-within:bg-grey-100': hasMenu,
16191
16245
  '!pointer-events-all !bg-grey-100': isResizing,
16192
16246
  // z-indexes
16193
16247
  'z-10 hover:z-20': !isFrozen && !isResizing,
@@ -16221,13 +16275,16 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16221
16275
  title: String((_meta$tooltip = meta === null || meta === void 0 ? void 0 : meta.tooltip) !== null && _meta$tooltip !== void 0 ? _meta$tooltip : children),
16222
16276
  placement: "top"
16223
16277
  }, /*#__PURE__*/React__default.createElement("span", {
16224
- className: "truncate"
16278
+ className: cn({
16279
+ truncate: !isPrinting
16280
+ })
16225
16281
  }, children)), canSort ? /*#__PURE__*/React__default.createElement(SortIndicator, {
16226
16282
  direction: sortDirection
16227
16283
  }) : null, hasMenu ? /*#__PURE__*/React__default.createElement(Menu$3, {
16228
16284
  canFreeze: canFreeze,
16229
16285
  canHide: canHide,
16230
- className: cn('hidden group-hover/column:flex aria-expanded:!flex', {
16286
+ canSort: canSort,
16287
+ className: cn({
16231
16288
  'ml-auto': align !== 'right',
16232
16289
  'ml-2': align === 'right'
16233
16290
  }),
@@ -16235,7 +16292,9 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16235
16292
  menu: meta.menu,
16236
16293
  onGoto: handleGoto,
16237
16294
  onHide: handleHide,
16295
+ onSortToggle: handleSortToggle,
16238
16296
  scrollToIndex: scrollToIndex,
16297
+ sortDirection: sortDirection,
16239
16298
  table: table
16240
16299
  }) : null, canResize ? /*#__PURE__*/React__default.createElement(Resizer, {
16241
16300
  isResizing: isResizing,
@@ -16328,7 +16387,7 @@ const MemoedDisplayCell = /*#__PURE__*/React__default.memo(function MemoedDispla
16328
16387
  index,
16329
16388
  tableRef
16330
16389
  } = props;
16331
- const layoutClassName = cn('py-[var(--table3-row-padding)]', customClassName);
16390
+ const layoutClassName = cn('py-[var(--table3-cell-padding-y)] px-[var(--table3-cell-padding-x)] focus:outline-none', customClassName);
16332
16391
  const className = highlighted ? undefined : layoutClassName;
16333
16392
  const content = enableTruncate ? /*#__PURE__*/React__default.createElement("span", {
16334
16393
  className: "truncate"
@@ -16341,7 +16400,9 @@ const MemoedDisplayCell = /*#__PURE__*/React__default.memo(function MemoedDispla
16341
16400
  "data-align": align,
16342
16401
  "data-column-index": index,
16343
16402
  "data-highlighted": highlighted,
16344
- role: "cell"
16403
+ role: "cell",
16404
+ // cells must be focusable (but not included in tabbing - hence -1)
16405
+ tabIndex: -1
16345
16406
  }, highlighted ? /*#__PURE__*/React__default.createElement(Highlight, {
16346
16407
  className: layoutClassName,
16347
16408
  current: highlightedAsCurrent,
@@ -16359,7 +16420,7 @@ const Highlight = props => {
16359
16420
  ...attributes
16360
16421
  } = props;
16361
16422
  const ref = React__default.useRef(null);
16362
- const className = cn('h-full flex px-4 [justify-content:inherit] [text-align:inherit]', props.className, {
16423
+ const className = cn('h-full flex [justify-content:inherit] [text-align:inherit]', props.className, {
16363
16424
  // normal row
16364
16425
  'bg-blue-200/25': !current,
16365
16426
  // current row
@@ -16472,7 +16533,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
16472
16533
  var _ref, _button$props$tooltip;
16473
16534
  const tooltip = String((_ref = (_button$props$tooltip = button.props.tooltip) !== null && _button$props$tooltip !== void 0 ? _button$props$tooltip : button.props['aria-label']) !== null && _ref !== void 0 ? _ref : '');
16474
16535
  return /*#__PURE__*/React__default.cloneElement(button, {
16475
- appearance: 'discrete',
16536
+ appearance: 'transparent',
16476
16537
  key: index,
16477
16538
  tabIndex: isCurrentRow ? 0 : -1,
16478
16539
  tooltip: button.props.shortcut ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
@@ -16481,7 +16542,7 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
16481
16542
  })) : tooltip
16482
16543
  });
16483
16544
  }), actionsInMenu.length ? /*#__PURE__*/React__default.createElement(IconButton, {
16484
- appearance: "discrete",
16545
+ appearance: "transparent",
16485
16546
  "aria-label": texts.table3.columns.actions.tooltip,
16486
16547
  icon: "more",
16487
16548
  tabIndex: isCurrentRow ? 0 : -1,
@@ -16517,7 +16578,7 @@ function createRowActionsColumn$1() {
16517
16578
  footer: Footer$4,
16518
16579
  meta: {
16519
16580
  align: 'right',
16520
- className: cn('!pt-[var(--table3-row-padding)] print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1', 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
16581
+ className: cn('!pt-[var(--table3-cell-padding-y)] print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1', 'shadow-[-6px_0px_6px_var(--table3-row-actions-shadow)]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
16521
16582
  enableOrdering: false,
16522
16583
  enableSearch: false,
16523
16584
  enableTruncate: false,
@@ -16687,9 +16748,23 @@ function useCurrentRow(defaultCurrentRowIndex) {
16687
16748
  return;
16688
16749
  }
16689
16750
  }, []);
16751
+ const onFocus = React__default.useCallback((event, length, scrollToIndex) => {
16752
+ if (event.isDefaultPrevented()) {
16753
+ return;
16754
+ }
16755
+ if (currentRowIndex === undefined && length > 0) {
16756
+ // do it in the next tick, otherwise it prevents internal focus from working
16757
+ // meaning you have to tab twice to get to the first focusable element
16758
+ setTimeout(() => {
16759
+ setCurrentRowIndex(0);
16760
+ scrollToIndex(0);
16761
+ }, 1);
16762
+ }
16763
+ }, [currentRowIndex, length]);
16690
16764
  return {
16691
16765
  currentRowIndex,
16692
16766
  setCurrentRowIndex,
16767
+ handleFocus: onFocus,
16693
16768
  handleKeyDown: onKeyDown
16694
16769
  };
16695
16770
  }
@@ -17466,7 +17541,7 @@ const MemoedCell$1 = /*#__PURE__*/React__default.memo(function MemoedCell(props)
17466
17541
  }
17467
17542
  if (isEditing && isCurrentRow) {
17468
17543
  content = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, content, /*#__PURE__*/React__default.createElement(IconButton, {
17469
- appearance: "discrete",
17544
+ appearance: "transparent",
17470
17545
  "aria-label": texts.table3.editing.actions.tooltip,
17471
17546
  icon: "more",
17472
17547
  menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
@@ -17784,7 +17859,7 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
17784
17859
  resizeTextArea(e.target);
17785
17860
  };
17786
17861
  const textareaContainerClassName = cn('w-full', {
17787
- 'focus-within:absolute focus-within:left-0 focus-within:top-0 focus-within:z-20 focus-within:px-2 focus-within:pt-[var(--table3-row-padding)]': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate
17862
+ 'focus-within:absolute focus-within:left-0 focus-within:top-0 focus-within:z-20 focus-within:px-[var(--table3-cell-padding-x)] focus-within:pt-[var(--table3-cell-padding-y)]': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate
17788
17863
  });
17789
17864
  const handleTextareaKeyDown = event => {
17790
17865
  // By default Shift + Enter in textarea makes a new line, we want to keep this behaviour
@@ -17952,7 +18027,6 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
17952
18027
  }));
17953
18028
  } else if (controlRenderer === 'switch') {
17954
18029
  return /*#__PURE__*/React__default.createElement(Switch, Object.assign({}, attributes, {
17955
- className: "mx-2 mt-1.5",
17956
18030
  checked: Boolean(value),
17957
18031
  onChange: handleChange,
17958
18032
  ref: refCallback
@@ -18072,7 +18146,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
18072
18146
  return removeMoveReason;
18073
18147
  }, [value]);
18074
18148
  const controlRenderer = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
18075
- const className = cn('!px-[0.4375rem] py-[calc(var(--table3-row-padding)_-_0.06rem)]', {
18149
+ const className = cn('py-[calc(var(--table3-cell-padding-y)_-_0.06rem)]', {
18076
18150
  relative: (isCurrentRow || isHovered) && controlRenderer === 'textarea',
18077
18151
  // Need to set higher z-index, so that the current row textarea (in expanded state, when positioned absolute) overlaps rows below,
18078
18152
  // but at the same time it should not overlap the table headers which has z-10.
@@ -18092,6 +18166,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
18092
18166
  className: className,
18093
18167
  "data-align": columnMeta.align,
18094
18168
  "data-column-index": index,
18169
+ "data-editable": true,
18095
18170
  role: "cell",
18096
18171
  ref: cellRef
18097
18172
  }, /*#__PURE__*/React__default.createElement(EditingControl, {
@@ -18255,7 +18330,7 @@ function createRowSelectionColumn$1(hasDrag, hasExpansion) {
18255
18330
  footer: Footer$4,
18256
18331
  meta: {
18257
18332
  align: 'center',
18258
- className: cn('!pt-[var(--table3-row-padding)] !justify-end !p-0', {
18333
+ className: cn('!pt-[var(--table3-cell-padding-y)] !justify-end !p-0', {
18259
18334
  '!pr-0.5': hasExpansion,
18260
18335
  '!pr-3': !hasExpansion
18261
18336
  }),
@@ -18289,7 +18364,7 @@ function Header$4(context) {
18289
18364
  return /*#__PURE__*/React__default.createElement(Header$2, Object.assign({}, context), /*#__PURE__*/React__default.createElement(Tooltip, {
18290
18365
  title: title
18291
18366
  }, /*#__PURE__*/React__default.createElement(IconButton, {
18292
- appearance: "discrete",
18367
+ appearance: "transparent",
18293
18368
  icon: isSomeRowsExpanded ? 'chevron-down-double' : 'chevron-right-double',
18294
18369
  onClick: handleClick,
18295
18370
  tabIndex: -1,
@@ -18355,7 +18430,7 @@ function createRowExpansionColumn$1(expandedRowRenderer) {
18355
18430
  footer: Footer$4,
18356
18431
  meta: {
18357
18432
  align: 'center',
18358
- className: '!p-0 !pt-[var(--table3-row-padding)]',
18433
+ className: '!p-0 !pt-[var(--table3-cell-padding-y)]',
18359
18434
  enableOrdering: false,
18360
18435
  enableSearch: false,
18361
18436
  enableTruncate: false,
@@ -18431,7 +18506,7 @@ function createRowDragColumn(onRowDrag) {
18431
18506
  footer: Footer$4,
18432
18507
  meta: {
18433
18508
  align: 'center',
18434
- className: '!p-0 !pt-[var(--table3-row-padding)]',
18509
+ className: '!p-0 !pt-[var(--table3-cell-padding-y)]',
18435
18510
  enableOrdering: false,
18436
18511
  enableSearch: false,
18437
18512
  enableTruncate: false,
@@ -18473,7 +18548,7 @@ function useConvertChildrenToColumns(props, options, editing) {
18473
18548
  React__default.Children.toArray(props.children).filter(child => !!child) // remove falsey children
18474
18549
  .forEach(child => {
18475
18550
  if ( /*#__PURE__*/React__default.isValidElement(child) && child.props.accessor) {
18476
- var _child$props$enableRe, _child$props$enableFi, _child$props$enableSo, _child$props$enableHi, _child$props$enableOr, _child$props$enableSe, _child$props$enableTr;
18551
+ var _child$props$enableRe, _child$props$enableFi, _child$props$enableSo, _child$props$enableHi, _child$props$enableOr, _child$props$enablePr, _child$props$enableSe, _child$props$enableTr;
18477
18552
  if (child.props.defaultWidth) {
18478
18553
  defaultColumnSizing[child.props.accessor] = child.props.defaultWidth === 'grow' ? '1fr' : child.props.defaultWidth;
18479
18554
  }
@@ -18512,6 +18587,7 @@ function useConvertChildrenToColumns(props, options, editing) {
18512
18587
  control: child.props.control,
18513
18588
  dataType: child.props.dataType,
18514
18589
  enableOrdering: (_child$props$enableOr = child.props.enableOrdering) !== null && _child$props$enableOr !== void 0 ? _child$props$enableOr : true,
18590
+ enablePrinting: (_child$props$enablePr = child.props.enablePrinting) !== null && _child$props$enablePr !== void 0 ? _child$props$enablePr : true,
18515
18591
  enableSearch: (_child$props$enableSe = child.props.enableSearch) !== null && _child$props$enableSe !== void 0 ? _child$props$enableSe : true,
18516
18592
  enableTruncate: (_child$props$enableTr = child.props.enableTruncate) !== null && _child$props$enableTr !== void 0 ? _child$props$enableTr : false,
18517
18593
  filters: child.props.filters,
@@ -18865,6 +18941,7 @@ function useTable$2(props) {
18865
18941
  enableFooter: options.enableFooter,
18866
18942
  fontSize,
18867
18943
  hoverState,
18944
+ isPrinting: props.id.endsWith('_print'),
18868
18945
  isUsingServer: !!props.loadPage,
18869
18946
  printing,
18870
18947
  rowActions: rowActions,
@@ -18892,12 +18969,56 @@ function useTable$2(props) {
18892
18969
  };
18893
18970
  }
18894
18971
 
18972
+ const FOCUS_MANAGER_OPTIONS = {
18973
+ tabbable: true
18974
+ };
18895
18975
  function Row$2(props) {
18976
+ const focusManager = focus.useFocusManager();
18896
18977
  const tableMeta = props.table.options.meta;
18897
18978
  const isCurrentRow = tableMeta.currentRow.currentRowIndex === props.index;
18898
18979
  const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];
18980
+ const isFirstRow = props.index === 0;
18899
18981
  // we use non-css hovered state to determine whether to render actions or not, for performance
18900
18982
  const [isHovered, setIsHovered] = React__default.useState(false);
18983
+ // tab behaviour is consistent across normal mode and edit mode, handle it here
18984
+ const handleKeyDown = event => {
18985
+ if (event.isDefaultPrevented() || event.isPropagationStopped()) {
18986
+ return;
18987
+ }
18988
+ if (event.key === 'Tab') {
18989
+ tableMeta.hoverState.pause(true);
18990
+ let focusedElement;
18991
+ if (event.shiftKey) {
18992
+ // looping backwards
18993
+ focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);
18994
+ if (focusedElement) {
18995
+ // override default behaviour, since we're handling focus internally now
18996
+ event.preventDefault();
18997
+ } else {
18998
+ // there are no previous elements to focus, go up a row or go outside the table
18999
+ if (!isFirstRow) {
19000
+ event.preventDefault();
19001
+ tableMeta.currentRow.setCurrentRowIndex(props.index - 1);
19002
+ setTimeout(() => focusManager.focusLast(FOCUS_MANAGER_OPTIONS), 1);
19003
+ }
19004
+ }
19005
+ } else {
19006
+ // looping forwards
19007
+ focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);
19008
+ if (focusedElement) {
19009
+ // override default behaviour, since we're handling focus internally now
19010
+ event.preventDefault();
19011
+ } else {
19012
+ // there are no next elements to focus, go down a row or go outside the table
19013
+ if (!props.isLastRow) {
19014
+ event.preventDefault();
19015
+ tableMeta.currentRow.setCurrentRowIndex(props.index + 1);
19016
+ setTimeout(() => focusManager.focusFirst(FOCUS_MANAGER_OPTIONS), 1);
19017
+ }
19018
+ }
19019
+ }
19020
+ }
19021
+ };
18901
19022
  // rows are heavily memoized because performance in our table is critical
18902
19023
  // be careful and selective about props that you pass to the row
18903
19024
  const memoedProps = {
@@ -18908,12 +19029,13 @@ function Row$2(props) {
18908
19029
  draggable: tableMeta.rowDrag.isEnabled,
18909
19030
  index: props.index,
18910
19031
  onClick: tableMeta.rowClick.handleClick,
18911
- onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined
19032
+ onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined,
19033
+ onKeyDown: handleKeyDown
18912
19034
  };
18913
19035
  let output = /*#__PURE__*/React__default.createElement(MemoedRow, Object.assign({}, props, memoedProps));
18914
19036
  if (tableMeta.editing.isEditing && (isCurrentRow || isHovered && !tableMeta.hoverState.isPaused)) {
18915
19037
  output = /*#__PURE__*/React__default.createElement(EditingRow, Object.assign({}, props, memoedProps, {
18916
- isLastRow: props.isLastRow,
19038
+ isFirstRow: isFirstRow,
18917
19039
  setCurrentRowIndex: tableMeta.currentRow.setCurrentRowIndex
18918
19040
  }));
18919
19041
  }
@@ -18953,79 +19075,80 @@ const unhoverPreviousRow = tableRef => {
18953
19075
  };
18954
19076
  function EditingRow(props) {
18955
19077
  const {
19078
+ isFirstRow,
18956
19079
  isLastRow,
19080
+ onKeyDown,
18957
19081
  setCurrentRowIndex,
18958
19082
  virtualiser,
18959
19083
  ...attributes
18960
19084
  } = props;
18961
19085
  const focusManager = focus.useFocusManager();
18962
- const focusManagerOptions = {
18963
- tabbable: true
18964
- };
18965
19086
  const tableMeta = props.table.options.meta;
18966
19087
  const handleClickCapture = event => {
18967
19088
  lastIndex = getColumnIndex(event.target);
18968
19089
  };
18969
19090
  const handleArrowLeftKey = event => {
18970
19091
  let focusedElement;
18971
- if (event.key === 'ArrowLeft' || event.key === 'Tab' && event.shiftKey) {
18972
- // Need to stop propagation because "Tab" will be handled twice(default browser and programmatic one)
18973
- // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,
19092
+ if (event.key === 'ArrowLeft') {
19093
+ // We need to perform special behaviour when focus reaches the end of the row,
18974
19094
  // so we don't need default browser behaviour.
18975
19095
  event.stopPropagation();
18976
19096
  event.preventDefault();
18977
19097
  // "CTRL + ArrowLeft" or "META + ArrowLeft" should focus first focusable element of the row
18978
19098
  if (event.ctrlKey || event.metaKey) {
18979
19099
  event.target.blur();
18980
- focusedElement = focusManager.focusFirst(focusManagerOptions);
19100
+ focusedElement = focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);
18981
19101
  lastIndex = getColumnIndex(focusedElement);
18982
19102
  } else {
18983
- // Should focus previous focusable element, if there is one
18984
- focusedElement = focusManager.focusPrevious(focusManagerOptions);
18985
- // Should move to prevoius row and select last focusable element in that row,
18986
- // if there is no previous focusable element in current row
18987
- if (props.index !== 0 && (!focusedElement || !event.currentTarget.contains(focusedElement))) {
18988
- tableMeta.hoverState.pause(true);
18989
- setCurrentRowIndex(props.index - 1);
18990
- setTimeout(() => {
18991
- focusedElement = focusManager.focusLast(focusManagerOptions);
18992
- // Need to update lastIndex when row got changed and last element got selected.
18993
- lastIndex = getColumnIndex(focusedElement);
18994
- }, 1);
18995
- } else {
19103
+ // looping backwards
19104
+ focusedElement = focusManager.focusPrevious(FOCUS_MANAGER_OPTIONS);
19105
+ if (focusedElement) {
18996
19106
  lastIndex = getColumnIndex(focusedElement);
19107
+ } else {
19108
+ // there are no previous elements to focus, go up a row (if there are rows above)
19109
+ if (!isFirstRow) {
19110
+ event.preventDefault();
19111
+ tableMeta.hoverState.pause(true);
19112
+ tableMeta.currentRow.setCurrentRowIndex(props.index - 1);
19113
+ setTimeout(() => {
19114
+ focusManager.focusLast(FOCUS_MANAGER_OPTIONS);
19115
+ // Need to update lastIndex when row got changed and last element got selected.
19116
+ lastIndex = getColumnIndex(focusedElement);
19117
+ }, 1);
19118
+ }
18997
19119
  }
18998
19120
  }
18999
19121
  }
19000
19122
  };
19001
19123
  const handleArrowRightKey = event => {
19002
19124
  let focusedElement;
19003
- if (event.key === 'ArrowRight' || event.key === 'Tab' && !event.shiftKey) {
19004
- // Need to stop propagation because "Tab" will be handled twice(default browser and programmatic one)
19005
- // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,
19125
+ if (event.key === 'ArrowRight') {
19126
+ // We need to perform special behaviour when focus reaches the end of the row,
19006
19127
  // so we don't need default browser behaviour.
19007
19128
  event.stopPropagation();
19008
19129
  event.preventDefault();
19009
19130
  // "CTRL + ArrowRight" or "META + ArrowRight" should focus last focusable element of the row
19010
19131
  if (event.ctrlKey || event.metaKey) {
19011
19132
  event.target.blur();
19012
- focusedElement = focusManager.focusLast(focusManagerOptions);
19133
+ focusedElement = focusManager.focusLast(FOCUS_MANAGER_OPTIONS);
19013
19134
  lastIndex = getColumnIndex(focusedElement);
19014
19135
  } else {
19015
- // Should focus next focusable element, if there is one
19016
- focusedElement = focusManager.focusNext(focusManagerOptions);
19017
- // Should move to next row and select first focusable element in that row,
19018
- // if there is no next focusable element in current row
19019
- if (!isLastRow && (!focusedElement || !event.currentTarget.contains(focusedElement))) {
19020
- tableMeta.hoverState.pause(true);
19021
- setCurrentRowIndex(props.index + 1);
19022
- setTimeout(() => {
19023
- focusedElement = focusManager.focusFirst(focusManagerOptions);
19024
- // Need to update lastIndex when row got changed and first element got selected.
19025
- lastIndex = getColumnIndex(focusedElement);
19026
- }, 1);
19027
- } else {
19136
+ // looping forwards
19137
+ focusedElement = focusManager.focusNext(FOCUS_MANAGER_OPTIONS);
19138
+ if (focusedElement) {
19028
19139
  lastIndex = getColumnIndex(focusedElement);
19140
+ } else {
19141
+ // there are no next elements to focus, go down a row or go outside the table
19142
+ if (!props.isLastRow) {
19143
+ event.preventDefault();
19144
+ tableMeta.hoverState.pause(true);
19145
+ tableMeta.currentRow.setCurrentRowIndex(props.index + 1);
19146
+ setTimeout(() => {
19147
+ focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);
19148
+ // Need to update lastIndex when row got changed and last element got selected.
19149
+ lastIndex = getColumnIndex(focusedElement);
19150
+ }, 1);
19151
+ }
19029
19152
  }
19030
19153
  }
19031
19154
  }
@@ -19040,6 +19163,7 @@ function EditingRow(props) {
19040
19163
  if (event.isDefaultPrevented() || event.isPropagationStopped() || tableMeta.editing.detailModeEditing) {
19041
19164
  return;
19042
19165
  }
19166
+ onKeyDown(event); // handles tab behaviour
19043
19167
  handleArrowLeftKey(event);
19044
19168
  handleArrowRightKey(event);
19045
19169
  };
@@ -19051,7 +19175,7 @@ function EditingRow(props) {
19051
19175
  const lastIndexCell = (_props$tableRef$curre = props.tableRef.current) === null || _props$tableRef$curre === void 0 ? void 0 : _props$tableRef$curre.querySelector(`[role="row"][data-current="true"] [data-column-index="${lastIndex}"]`);
19052
19176
  lastIndexCell === null || lastIndexCell === void 0 ? void 0 : (_lastIndexCell$queryS = lastIndexCell.querySelector(focusableSelector)) === null || _lastIndexCell$queryS === void 0 ? void 0 : _lastIndexCell$queryS.focus();
19053
19177
  } else {
19054
- focusManager.focusFirst(focusManagerOptions);
19178
+ focusManager.focusFirst(FOCUS_MANAGER_OPTIONS);
19055
19179
  }
19056
19180
  }
19057
19181
  // Need to subscribe to current row index and check is it a current row,
@@ -19082,10 +19206,19 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
19082
19206
  const {
19083
19207
  setIsHovered
19084
19208
  } = useRowContext$1();
19209
+ const isCurrentRow = Boolean(attributes['data-current']);
19210
+ // we want tabbing to "start" again at the start of the row each time, only after pressing tab though
19211
+ // so we focus the first cell so when tab is pressed it moves inside the row
19212
+ React__default.useEffect(() => {
19213
+ if (isCurrentRow) {
19214
+ var _ref$current, _ref$current$querySel;
19215
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$querySel = _ref$current.querySelector('[role="cell"]:first-child')) === null || _ref$current$querySel === void 0 ? void 0 : _ref$current$querySel.focus();
19216
+ }
19217
+ }, [isCurrentRow]);
19085
19218
  // we measure the first cell (since the row has display: contents) so that the virtualiser height is correct
19086
19219
  React__default.useEffect(() => {
19087
- var _ref$current;
19088
- const firstCell = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector('[role=cell]:first-child');
19220
+ var _ref$current2;
19221
+ const firstCell = (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.querySelector('[role=cell]:first-child');
19089
19222
  if (firstCell) {
19090
19223
  measureRef(firstCell);
19091
19224
  }
@@ -19100,9 +19233,9 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
19100
19233
  };
19101
19234
  const handleClick = event => {
19102
19235
  if (typeof onClick === 'function') {
19103
- var _ref$current2;
19236
+ var _ref$current3;
19104
19237
  const clickedElement = event.target;
19105
- if (!((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.contains(event.target)) || clickableElements.includes(clickedElement.tagName.toLowerCase()) || clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))) {
19238
+ if (!((_ref$current3 = ref.current) !== null && _ref$current3 !== void 0 && _ref$current3.contains(event.target)) || clickableElements.includes(clickedElement.tagName.toLowerCase()) || clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))) {
19106
19239
  return;
19107
19240
  }
19108
19241
  onClick(row.original);
@@ -20343,8 +20476,18 @@ function PrintButton(props) {
20343
20476
  columnFilters: state.columnFilters,
20344
20477
  globalFilter: state.globalFilter
20345
20478
  }), [tableMeta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnSizing, state.columnVisibility, excludeUnmatchedResults, tableMeta.fontSize.size, tableMeta.rowHeight.height, state.sorting, state.columnFilters, state.globalFilter]);
20479
+ const iframeTableChildren = React__default.useMemo(() => React__default.Children.toArray(tableProps.children).filter(child => {
20480
+ var _child$props;
20481
+ const enableColumnInPrinting = (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.enablePrinting;
20482
+ // For table children, only include columns doesn't have 'false' value for enablePrinting prop.
20483
+ if ( /*#__PURE__*/React__default.isValidElement(child) && enableColumnInPrinting === false) {
20484
+ return false;
20485
+ }
20486
+ return true;
20487
+ }), [tableProps.children]);
20346
20488
  const iframeTableProps = {
20347
20489
  ...tableProps,
20490
+ children: iframeTableChildren,
20348
20491
  defaultSettings,
20349
20492
  id: printTableId
20350
20493
  };
@@ -20777,7 +20920,7 @@ function Summary$1(props) {
20777
20920
  }
20778
20921
 
20779
20922
  // we cannot just use a fixed height because our rows need to grow in height (images, edit mode validation etc)
20780
- const getRowHeightSizing = (height, fontSize) => {
20923
+ const getCellHeightPadding = (height, fontSize) => {
20781
20924
  // TODO: can we get the rem values from tailwind
20782
20925
  switch (height) {
20783
20926
  case 'short':
@@ -20826,9 +20969,22 @@ const getRowHeightSizing = (height, fontSize) => {
20826
20969
  }
20827
20970
  }
20828
20971
  };
20972
+ const getCellWidthPadding = fontSize => {
20973
+ switch (fontSize) {
20974
+ case 'small':
20975
+ return '8px';
20976
+ case 'medium':
20977
+ return '12px';
20978
+ default:
20979
+ return '16px';
20980
+ // py-1.5
20981
+ }
20982
+ };
20983
+
20829
20984
  const useCssVars = (height, fontSize) => {
20830
20985
  const style = {
20831
- '--table3-row-padding': getRowHeightSizing(height, fontSize)
20986
+ '--table3-cell-padding-x': getCellWidthPadding(fontSize),
20987
+ '--table3-cell-padding-y': getCellHeightPadding(height, fontSize)
20832
20988
  };
20833
20989
  return {
20834
20990
  style
@@ -21018,6 +21174,9 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21018
21174
  const handleBlur = event => {
21019
21175
  tableMeta.editing.handleBlur(event);
21020
21176
  };
21177
+ const handleFocus = event => {
21178
+ tableMeta.currentRow.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);
21179
+ };
21021
21180
  const handleScroll = function (event) {
21022
21181
  try {
21023
21182
  tableMeta.columnFreezing.handleScroll(event);
@@ -21026,7 +21185,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21026
21185
  return Promise.reject(e);
21027
21186
  }
21028
21187
  };
21029
- const className = cn('border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px]', '[&[data-resizing="true"]]:select-none', {
21188
+ const className = cn('border-grey-300 relative grid h-full w-full flex-grow overflow-auto rounded border bg-white scroll-mt-[41px] focus-visible:outline-none', '[&[data-resizing="true"]]:select-none', {
21030
21189
  'text-xs': tableMeta.fontSize.size === 'small',
21031
21190
  'text-sm': tableMeta.fontSize.size === 'medium',
21032
21191
  'text-base': tableMeta.fontSize.size === 'large'
@@ -21035,7 +21194,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21035
21194
  // if the table is a print table or not.
21036
21195
  const {
21037
21196
  style: cssGridStyle
21038
- } = useCssGrid(table, props.id.endsWith('_print'));
21197
+ } = useCssGrid(table, tableMeta.isPrinting);
21039
21198
  const {
21040
21199
  style: cssVars
21041
21200
  } = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);
@@ -21067,10 +21226,12 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21067
21226
  "data-resizing": !!state.columnSizingInfo.isResizingColumn,
21068
21227
  "data-taco": "table2",
21069
21228
  onBlur: handleBlur,
21229
+ onFocus: handleFocus,
21070
21230
  onScroll: handleScroll,
21071
21231
  ref: internalRef,
21072
21232
  role: "table",
21073
- style: style
21233
+ style: style,
21234
+ tabIndex: -1
21074
21235
  }, isServerLoadingAndNotReady ? null : /*#__PURE__*/React__default.createElement("div", {
21075
21236
  className: "group/header contents",
21076
21237
  "data-taco": "table2-header",
@@ -21084,7 +21245,9 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
21084
21245
  }, reactTable$1.flexRender(header.column.columnDef.header, {
21085
21246
  ...header.getContext(),
21086
21247
  scrollToIndex
21087
- })))))), table.getRowModel().rows.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(focus.FocusScope, null, /*#__PURE__*/React__default.createElement("div", {
21248
+ })))))), table.getRowModel().rows.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(focus.FocusScope, {
21249
+ autoFocus: tableMeta.editing.isEditing
21250
+ }, /*#__PURE__*/React__default.createElement("div", {
21088
21251
  className: "group/body contents",
21089
21252
  "data-taco": "table2-body",
21090
21253
  role: "rowgroup",