@economic/taco 1.30.1 → 1.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/dist/components/Button/Button.d.ts +1 -0
  2. package/dist/components/Header/components/Button.d.ts +1 -1
  3. package/dist/components/IconButton/IconButton.d.ts +2 -2
  4. package/dist/components/Menu/components/Item.d.ts +0 -1
  5. package/dist/components/Shortcut/Shortcut.d.ts +2 -1
  6. package/dist/components/Table2/Table2.d.ts +1 -1
  7. package/dist/components/Table2/hooks/listeners/useFilterStateListener.d.ts +3 -0
  8. package/dist/components/Table2/hooks/useColumnDefinitions.d.ts +3 -2
  9. package/dist/components/Table2/types.d.ts +3 -10
  10. package/dist/components/Table2/utilities/columns.d.ts +1 -1
  11. package/dist/esm/packages/taco/src/components/Button/Button.js +2 -1
  12. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
  14. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +1 -1
  15. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +3 -7
  17. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +1 -1
  19. package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
  20. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
  21. package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +1 -1
  22. package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +1 -1
  23. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +9 -8
  24. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
  26. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +1 -1
  27. package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
  28. package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
  30. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +32 -2
  31. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
  33. package/dist/esm/packages/taco/src/components/Table2/Table2.js +3 -6
  34. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js +13 -9
  36. package/dist/esm/packages/taco/src/components/Table2/components/EditModeButton.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Table2/components/Search.js +10 -8
  38. package/dist/esm/packages/taco/src/components/Table2/components/Search.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +14 -8
  40. package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js +12 -0
  42. package/dist/esm/packages/taco/src/components/Table2/hooks/listeners/useFilterStateListener.js.map +1 -0
  43. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js +1 -1
  44. package/dist/esm/packages/taco/src/components/Table2/hooks/useColumnDefinitions.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +5 -0
  46. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Table2/types.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +36 -49
  49. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +1 -1
  50. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js +15 -0
  51. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -0
  52. package/dist/esm/packages/taco/src/index.js +3 -2
  53. package/dist/esm/packages/taco/src/index.js.map +1 -1
  54. package/dist/esm/packages/taco/src/primitives/Button.js +21 -2
  55. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  56. package/dist/esm/packages/taco/src/utils/keyboard.js +35 -0
  57. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -0
  58. package/dist/hooks/useGlobalKeyDown.d.ts +2 -0
  59. package/dist/index.d.ts +1 -0
  60. package/dist/primitives/Button.d.ts +3 -0
  61. package/dist/taco.cjs.development.js +220 -133
  62. package/dist/taco.cjs.development.js.map +1 -1
  63. package/dist/taco.cjs.production.min.js +1 -1
  64. package/dist/taco.cjs.production.min.js.map +1 -1
  65. package/dist/utils/keyboard.d.ts +8 -0
  66. package/package.json +2 -2
  67. package/types.json +20 -118
  68. package/dist/esm/packages/taco/src/hooks/useGlobalKeyboardShortcut.js +0 -13
  69. package/dist/esm/packages/taco/src/hooks/useGlobalKeyboardShortcut.js.map +0 -1
  70. package/dist/hooks/useGlobalKeyboardShortcut.d.ts +0 -1
@@ -3642,20 +3642,85 @@ const getBannerIcon = type => {
3642
3642
  })());
3643
3643
  };
3644
3644
 
3645
+ const WHITELISTED_ELEMENTS = ['INPUT', 'TEXTAREA', 'SELECT'];
3646
+ function createShortcutKeyDownHandler(key, handler) {
3647
+ return function (event) {
3648
+ let condition = false;
3649
+ if (event.target !== event.currentTarget && WHITELISTED_ELEMENTS.includes(event.target.tagName)) {
3650
+ return;
3651
+ }
3652
+ if (typeof key === 'string') {
3653
+ condition = event.key.toLowerCase() === key.toLowerCase();
3654
+ } else {
3655
+ if (key.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey) || key.meta === false && key.meta && (isMacOs() ? event.metaKey : event.ctrlKey)) {
3656
+ return;
3657
+ }
3658
+ if (key.shift && !event.shiftKey || key.shift === false && event.shiftKey) {
3659
+ return;
3660
+ }
3661
+ condition = event.key.toLowerCase() === key.key.toLowerCase();
3662
+ }
3663
+ if (condition) {
3664
+ var _event$stopImmediateP;
3665
+ // stops react handlers bubbling up to global
3666
+ event.stopPropagation();
3667
+ // stops global handlers bubbling up to other global
3668
+ (_event$stopImmediateP = event.stopImmediatePropagation) === null || _event$stopImmediateP === void 0 ? void 0 : _event$stopImmediateP.call(event);
3669
+ handler(event);
3670
+ }
3671
+ };
3672
+ }
3673
+ const isMacOs = () => {
3674
+ var _window;
3675
+ return (_window = window) === null || _window === void 0 ? void 0 : _window.navigator.userAgent.includes('Mac');
3676
+ };
3677
+
3678
+ // merges an external ref (optional) with an internal ref (required)
3679
+ const useMergedRef = ref => {
3680
+ const internalRef = React__default.useRef(null);
3681
+ React__default.useEffect(() => {
3682
+ if (ref) {
3683
+ if (typeof ref === 'function') {
3684
+ ref(internalRef.current);
3685
+ } else {
3686
+ ref.current = internalRef.current;
3687
+ }
3688
+ }
3689
+ }, [ref]);
3690
+ return internalRef;
3691
+ };
3692
+
3645
3693
  const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
3646
3694
  const {
3647
3695
  disabled,
3696
+ shortcut,
3648
3697
  target,
3649
3698
  type = 'button',
3650
3699
  ...otherProps
3651
3700
  } = props;
3701
+ const internalRef = useMergedRef(ref);
3702
+ React.useEffect(() => {
3703
+ let handleKeyDown;
3704
+ if (shortcut) {
3705
+ handleKeyDown = createShortcutKeyDownHandler(shortcut, () => {
3706
+ var _internalRef$current;
3707
+ (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
3708
+ });
3709
+ document.addEventListener('keydown', handleKeyDown);
3710
+ }
3711
+ return () => {
3712
+ if (handleKeyDown) {
3713
+ document.removeEventListener('keydown', handleKeyDown);
3714
+ }
3715
+ };
3716
+ }, [shortcut]);
3652
3717
  const Tag = props.href ? 'a' : 'button';
3653
3718
  return /*#__PURE__*/React.createElement(Tag, Object.assign({}, otherProps, {
3654
3719
  "aria-disabled": disabled ? 'true' : undefined,
3655
3720
  disabled: disabled,
3656
3721
  target: Tag === 'a' ? target : undefined,
3657
3722
  type: Tag !== 'a' ? type : undefined,
3658
- ref: ref
3723
+ ref: internalRef
3659
3724
  }), React.Children.count(props.children) > 1 ? React.Children.map(props.children, child => typeof child === 'string' ? /*#__PURE__*/React.createElement("span", null, child) : child) : props.children);
3660
3725
  });
3661
3726
 
@@ -4041,10 +4106,11 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
4041
4106
 
4042
4107
  const Base$1 = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
4043
4108
  const {
4109
+ appearance,
4044
4110
  fluid,
4045
4111
  ...otherProps
4046
4112
  } = props;
4047
- const className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
4113
+ const className = cn(getButtonClasses(), getAppearanceClasses(appearance), 'rounded px-3', {
4048
4114
  'cursor-not-allowed opacity-50': props.disabled,
4049
4115
  'focus:yt-focus active:focus:yt-focus': !props.disabled,
4050
4116
  'w-full': fluid
@@ -4390,21 +4456,6 @@ const useBoundingClientRectListener = (ref, dependencies) => {
4390
4456
  return dimensions;
4391
4457
  };
4392
4458
 
4393
- // merges an external ref (optional) with an internal ref (required)
4394
- const useMergedRef = ref => {
4395
- const internalRef = React__default.useRef(null);
4396
- React__default.useEffect(() => {
4397
- if (ref) {
4398
- if (typeof ref === 'function') {
4399
- ref(internalRef.current);
4400
- } else {
4401
- ref.current = internalRef.current;
4402
- }
4403
- }
4404
- }, [ref]);
4405
- return internalRef;
4406
- };
4407
-
4408
4459
  const validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];
4409
4460
  const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function InputWithoutDeprecatedFeatures(props, ref) {
4410
4461
  const {
@@ -5936,15 +5987,6 @@ const getBackdropClassNames = open => {
5936
5987
  });
5937
5988
  };
5938
5989
 
5939
- const useGlobalKeyboardShortcut = handler => {
5940
- React__default.useEffect(() => {
5941
- document.addEventListener('keydown', handler);
5942
- return () => {
5943
- document.removeEventListener('keydown', handler);
5944
- };
5945
- }, [handler]);
5946
- };
5947
-
5948
5990
  const Bar = props => {
5949
5991
  const className = cn(`flex select-none touch-none transition-colors hover:bg-grey`, {
5950
5992
  'w-[7px] hover:w-[14px] mr-[2px] hover:px-[2px] hover:mr-0': props.orientation === 'vertical',
@@ -5976,6 +6018,16 @@ const ScrollArea = props => {
5976
6018
  }, /*#__PURE__*/React__default.createElement(Thumb, null)), /*#__PURE__*/React__default.createElement(Corner, null));
5977
6019
  };
5978
6020
 
6021
+ const useGlobalKeyDown = (key, handler) => {
6022
+ React__default.useEffect(() => {
6023
+ const handleKeyDown = createShortcutKeyDownHandler(key, handler);
6024
+ document.addEventListener('keydown', handleKeyDown);
6025
+ return () => {
6026
+ document.removeEventListener('keydown', handleKeyDown);
6027
+ };
6028
+ }, [handler]);
6029
+ };
6030
+
5979
6031
  const RESIZE_MIN = 360;
5980
6032
  const RESIZE_MAX = 1000;
5981
6033
  var DrawerAnimationDefinition;
@@ -6099,11 +6151,7 @@ const UntrappedFocusDrawerContent = /*#__PURE__*/React__default.forwardRef(funct
6099
6151
  children,
6100
6152
  ...otherProps
6101
6153
  } = props;
6102
- useGlobalKeyboardShortcut(event => {
6103
- if (event.key === 'Escape') {
6104
- onEscape(event);
6105
- }
6106
- });
6154
+ useGlobalKeyDown('Escape', onEscape);
6107
6155
  return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
6108
6156
  ref: ref
6109
6157
  }), /*#__PURE__*/React__default.createElement(focus.FocusScope, {
@@ -6957,6 +7005,48 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
6957
7005
  }), children));
6958
7006
  });
6959
7007
 
7008
+ const replaceWithShortform = key => {
7009
+ switch (key) {
7010
+ case 'Delete':
7011
+ return 'Del';
7012
+ case 'Space':
7013
+ case ' ':
7014
+ return '␣';
7015
+ default:
7016
+ return key;
7017
+ }
7018
+ };
7019
+ const getShortcutText = key => {
7020
+ if (!key) {
7021
+ return [];
7022
+ }
7023
+ if (typeof key === 'string') {
7024
+ return [replaceWithShortform(key)];
7025
+ }
7026
+ const keys = [];
7027
+ if (key.shift) {
7028
+ keys.push(isMacOs() ? '⇧' : 'Shift');
7029
+ }
7030
+ if (key.meta) {
7031
+ keys.push(isMacOs() ? '⌘' : 'Ctrl');
7032
+ }
7033
+ keys.push(replaceWithShortform(key.key));
7034
+ return keys;
7035
+ };
7036
+ const Shortcut = ({
7037
+ keys,
7038
+ ...props
7039
+ }) => {
7040
+ const className = cn('inline-flex gap-0.5', props.className);
7041
+ const texts = getShortcutText(keys);
7042
+ return /*#__PURE__*/React__default.createElement("span", Object.assign({}, props, {
7043
+ className: className
7044
+ }), texts.map(key => /*#__PURE__*/React__default.createElement("kbd", {
7045
+ key: key,
7046
+ className: "font-display bg-grey-300/[0.25] rounded px-1 text-center"
7047
+ }, key)));
7048
+ };
7049
+
6960
7050
  const Icon$1 = ({
6961
7051
  name
6962
7052
  }) => /*#__PURE__*/React.createElement("span", {
@@ -6983,11 +7073,6 @@ const useItemStyling = ({
6983
7073
  'cursor-not-allowed hover:bg-white text-grey-300': disabled
6984
7074
  }, className);
6985
7075
  };
6986
- const Shortcut = props => {
6987
- return /*#__PURE__*/React.createElement("span", Object.assign({}, props, {
6988
- className: "text-grey-700 ml-auto pl-3"
6989
- }));
6990
- };
6991
7076
  const Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
6992
7077
  var _props$disabled;
6993
7078
  const {
@@ -7025,9 +7110,14 @@ const Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
7025
7110
  onClick: handleClick,
7026
7111
  onSelect: handleSelect,
7027
7112
  ref: ref
7028
- }), icon && /*#__PURE__*/React.createElement(Icon$1, {
7113
+ }), icon ? /*#__PURE__*/React.createElement(Icon$1, {
7029
7114
  name: icon
7030
- }), props.children, shortcut && /*#__PURE__*/React.createElement(Shortcut, null, shortcut));
7115
+ }) : null, props.children, shortcut ? /*#__PURE__*/React.createElement("span", {
7116
+ className: "ml-auto pl-5"
7117
+ }, /*#__PURE__*/React.createElement(Shortcut, {
7118
+ keys: shortcut,
7119
+ className: "text-grey-700"
7120
+ })) : null);
7031
7121
  if (typeof dialog === 'function') {
7032
7122
  button = dialog({
7033
7123
  trigger: button,
@@ -9827,19 +9917,6 @@ const ControlledHiddenField = props => {
9827
9917
  };
9828
9918
  Select2.displayName = 'Select2';
9829
9919
 
9830
- const Shortcut$1 = ({
9831
- keys,
9832
- ...props
9833
- }) => {
9834
- const className = cn('inline-flex gap-0.5', props.className);
9835
- return /*#__PURE__*/React__default.createElement("span", Object.assign({}, props, {
9836
- className: className
9837
- }), keys.map(key => /*#__PURE__*/React__default.createElement("kbd", {
9838
- key: key,
9839
- className: "wcag-blue-900 inline-flex h-4 items-center rounded px-1 font-mono text-xs font-normal"
9840
- }, key)));
9841
- };
9842
-
9843
9920
  const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
9844
9921
  const {
9845
9922
  label,
@@ -11495,9 +11572,9 @@ const SelectCell = /*#__PURE__*/React__default.memo(({
11495
11572
  (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.focus();
11496
11573
  };
11497
11574
  return /*#__PURE__*/React__default.createElement(Tooltip, {
11498
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect, /*#__PURE__*/React__default.createElement(Shortcut$1, {
11575
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect, /*#__PURE__*/React__default.createElement(Shortcut, {
11499
11576
  className: "ml-2",
11500
- keys: ['Space']
11577
+ keys: "Space"
11501
11578
  }))
11502
11579
  }, /*#__PURE__*/React__default.createElement(Checkbox, {
11503
11580
  "aria-label": isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect,
@@ -11516,9 +11593,12 @@ function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowInd
11516
11593
  header = ({
11517
11594
  table
11518
11595
  }) => /*#__PURE__*/React__default.createElement(Tooltip, {
11519
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll, /*#__PURE__*/React__default.createElement(Shortcut$1, {
11596
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll, /*#__PURE__*/React__default.createElement(Shortcut, {
11520
11597
  className: "ml-2",
11521
- keys: ['Ctrl', 'A']
11598
+ keys: {
11599
+ key: 'a',
11600
+ meta: true
11601
+ }
11522
11602
  }))
11523
11603
  }, /*#__PURE__*/React__default.createElement(Checkbox, {
11524
11604
  "aria-label": table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll,
@@ -11595,9 +11675,12 @@ const ExpandCell = /*#__PURE__*/React__default.memo(({
11595
11675
  return null;
11596
11676
  }
11597
11677
  return /*#__PURE__*/React__default.createElement(Tooltip, {
11598
- title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isExpanded ? texts.table2.columns.expansion.collapse : texts.table2.columns.expansion.expand, /*#__PURE__*/React__default.createElement(Shortcut$1, {
11678
+ title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, isExpanded ? texts.table2.columns.expansion.collapse : texts.table2.columns.expansion.expand, /*#__PURE__*/React__default.createElement(Shortcut, {
11599
11679
  className: "ml-2",
11600
- keys: ['Ctrl', isExpanded ? '←' : '→']
11680
+ keys: {
11681
+ key: isExpanded ? 'ArrowLeft' : 'ArrowRight',
11682
+ meta: true
11683
+ }
11601
11684
  }))
11602
11685
  }, /*#__PURE__*/React__default.createElement(IconButton, {
11603
11686
  title: isExpanded ? texts.table2.columns.expansion.collapse : texts.table2.columns.expansion.expand,
@@ -11650,11 +11733,10 @@ function createRowExpansionColumn(expandedRowRenderer, texts) {
11650
11733
  size: 36
11651
11734
  };
11652
11735
  }
11653
- const getActionPropertyValue = (property, row) => typeof property === 'function' ? property(row) : property;
11654
11736
  const RowActionsCell = /*#__PURE__*/React__default.memo(({
11655
11737
  row,
11656
11738
  actions,
11657
- moreActions,
11739
+ actionsLength,
11658
11740
  isEditing,
11659
11741
  shouldPauseHoverState,
11660
11742
  table,
@@ -11662,64 +11744,46 @@ const RowActionsCell = /*#__PURE__*/React__default.memo(({
11662
11744
  }) => {
11663
11745
  const {
11664
11746
  isActive,
11665
- isHovered,
11666
- rowIndex
11747
+ isHovered
11667
11748
  } = useRowContext();
11668
11749
  if (!isActive && (!isHovered || shouldPauseHoverState) || isEditing) {
11669
11750
  return null;
11670
11751
  }
11671
- const isVisible = action => typeof action.visible !== 'undefined' ? typeof action.visible === 'function' ? action.visible(row.original) : action.visible : true;
11672
- const visibleActions = actions.filter(isVisible);
11673
- const visibleMoreActions = moreActions.filter(isVisible);
11752
+ const visibleActions = actions.map(action => action(row.original)).filter(action => !!action);
11753
+ const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
11754
+ const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
11674
11755
  // If the row is not the active row or the hovered row then actions are hidden.
11675
11756
  const actionClassName = 'group-hover/row:flex group-[[aria-current]]/row:flex hidden';
11676
11757
  // only actions in the active row should be tabbable
11677
11758
  const tabIndex = table.options.meta.activeRowIndex === row.index ? 0 : -1;
11678
11759
  return /*#__PURE__*/React__default.createElement("span", {
11679
11760
  className: "-mb-2 -mt-2 flex justify-end text-right"
11680
- }, visibleActions.map((action, i) => /*#__PURE__*/React__default.createElement(IconButton, {
11681
- key: i,
11682
- className: actionClassName,
11683
- "aria-label": getActionPropertyValue(action.ariaLabel, row.original),
11761
+ }, actionsOnRow.map((button, index) => {
11762
+ var _button$props$tooltip, _button$props$tooltip2;
11763
+ return /*#__PURE__*/React__default.cloneElement(button, {
11764
+ appearance: 'discrete',
11765
+ className: cn(actionClassName, button.props.className),
11766
+ key: index,
11767
+ tabIndex,
11768
+ tooltip: button.props.shortcut ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, (_button$props$tooltip = button.props.tooltip) !== null && _button$props$tooltip !== void 0 ? _button$props$tooltip : button.props['aria-label'], /*#__PURE__*/React__default.createElement(Shortcut, {
11769
+ className: "ml-2",
11770
+ keys: button.props.shortcut
11771
+ })) : (_button$props$tooltip2 = button.props.tooltip) !== null && _button$props$tooltip2 !== void 0 ? _button$props$tooltip2 : button.props['aria-label']
11772
+ });
11773
+ }), actionsInMenu.length ? /*#__PURE__*/React__default.createElement(IconButton, {
11684
11774
  appearance: "discrete",
11685
- dialog: action.dialog ? action.dialog(row.original) : undefined,
11686
- disabled: getActionPropertyValue(action.disabled, row.original),
11687
- icon: getActionPropertyValue(action.icon, row.original),
11688
- onClick: event => {
11689
- event.stopPropagation();
11690
- if (action.onClick) {
11691
- action.onClick(row.original);
11692
- }
11693
- },
11694
- tabIndex: tabIndex,
11695
- tooltip: getActionPropertyValue(action.text, row.original)
11696
- })), visibleMoreActions.length ? /*#__PURE__*/React__default.createElement(IconButton, {
11697
- className: actionClassName,
11698
11775
  "aria-label": texts.table2.columns.actions.tooltip,
11699
- appearance: "discrete",
11700
11776
  icon: "more",
11701
- onClick: event => {
11702
- event.preventDefault();
11703
- table.options.meta.setActiveRowIndex(rowIndex);
11704
- },
11705
11777
  tabIndex: tabIndex,
11706
- menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, visibleMoreActions.map((action, i) => /*#__PURE__*/React__default.createElement(Menu$1.Item, {
11707
- key: i,
11708
- dialog: action.dialog ? action.dialog(row.original) : undefined,
11709
- disabled: getActionPropertyValue(action.disabled, row.original),
11710
- icon: getActionPropertyValue(action.icon, row.original),
11711
- onClick: () => {
11712
- if (action.onClick) {
11713
- action.onClick(row.original);
11714
- }
11715
- }
11716
- }, getActionPropertyValue(action.text, row.original))))),
11778
+ menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, actionsInMenu.map((action, i) => /*#__PURE__*/React__default.createElement(Menu$1.Item, Object.assign({
11779
+ key: i
11780
+ }, action.props, {
11781
+ shortcut: action.props.shortcut
11782
+ }), action.props['aria-label'])))),
11717
11783
  tooltip: texts.table2.columns.actions.tooltip
11718
11784
  }) : null);
11719
11785
  });
11720
- function createRowActionsColumn(rowActions, texts) {
11721
- const actions = rowActions.length === 4 ? rowActions : rowActions.slice(0, 3);
11722
- const moreActions = rowActions.slice(rowActions.length === 4 ? 4 : 3);
11786
+ function createRowActionsColumn(rowActions, rowActionsLength, texts) {
11723
11787
  return {
11724
11788
  id: COLUMN_ID_FOR_ACTIONS,
11725
11789
  cell: ({
@@ -11729,8 +11793,8 @@ function createRowActionsColumn(rowActions, texts) {
11729
11793
  var _table$options$meta, _table$options$meta2;
11730
11794
  return /*#__PURE__*/React__default.createElement(RowActionsCell, {
11731
11795
  row: row,
11732
- actions: actions,
11733
- moreActions: moreActions,
11796
+ actions: rowActions,
11797
+ actionsLength: rowActionsLength,
11734
11798
  texts: texts,
11735
11799
  table: table,
11736
11800
  isEditing: !!((_table$options$meta = table.options.meta) !== null && _table$options$meta !== void 0 && _table$options$meta.editMode.isEditing),
@@ -13068,7 +13132,7 @@ function useColumnDefinitions(children, options, tableRef) {
13068
13132
  internalFrozenColumnCount++;
13069
13133
  }
13070
13134
  if ((_options$actionsForRo = options.actionsForRow) !== null && _options$actionsForRo !== void 0 && _options$actionsForRo.length) {
13071
- columns.push(columnHelper.display(createRowActionsColumn(options.actionsForRow, texts)));
13135
+ columns.push(columnHelper.display(createRowActionsColumn(options.actionsForRow, options.actionsForRowLength, texts)));
13072
13136
  }
13073
13137
  return {
13074
13138
  columns,
@@ -13188,10 +13252,20 @@ const useActiveRowStateListener = (table, rows, activeRowIndex) => {
13188
13252
  }, [table.getState().columnFilters, rows.length]);
13189
13253
  };
13190
13254
 
13255
+ const useFilterStateListener = (table, onRowSelect) => {
13256
+ React__default.useEffect(() => {
13257
+ if (onRowSelect) {
13258
+ table.resetRowSelection();
13259
+ }
13260
+ }, [table.getState().columnFilters, table.getState().globalFilter]);
13261
+ };
13262
+
13263
+ const ACTIONS_ON_ROW_LENGTH = 4;
13191
13264
  function useTable$1(children, props, ref) {
13192
13265
  var _settings$frozenColum, _settings$columnOrder, _settings$columnSizin, _settings$columnVisib, _settings$rowDensity;
13193
13266
  const {
13194
13267
  actionsForRow = [],
13268
+ actionsForRowLength = ACTIONS_ON_ROW_LENGTH,
13195
13269
  data,
13196
13270
  defaultActiveRowIndex,
13197
13271
  disableColumnFiltering = false,
@@ -13230,6 +13304,7 @@ function useTable$1(children, props, ref) {
13230
13304
  footers
13231
13305
  } = useColumnDefinitions(children, {
13232
13306
  actionsForRow,
13307
+ actionsForRowLength,
13233
13308
  enableColumnFiltering: !disableColumnFiltering,
13234
13309
  enableColumnHiding: !disableColumnHiding,
13235
13310
  enableColumnFreezing: !disableColumnFreezing,
@@ -13378,6 +13453,7 @@ function useTable$1(children, props, ref) {
13378
13453
  // state listeners
13379
13454
  useActiveRowStateListener(table, rows, activeRow);
13380
13455
  useColumnOffsetStateListener(table, setColumnOffsets);
13456
+ useFilterStateListener(table, onRowSelect);
13381
13457
  useRowSelectionListener(table, onRowSelect);
13382
13458
  useSettingsStateListener(table, onChangeSettings);
13383
13459
  return {
@@ -14460,12 +14536,14 @@ const FiltersButton = ({
14460
14536
  const handleReset = () => {
14461
14537
  table.resetColumnFilters();
14462
14538
  };
14463
- useGlobalKeyboardShortcut(event => {
14464
- if (event.key === 'f' && (event.ctrlKey || event.metaKey) && event.shiftKey) {
14465
- var _ref$current;
14466
- event.preventDefault();
14467
- (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
14468
- }
14539
+ useGlobalKeyDown({
14540
+ key: 'f',
14541
+ meta: true,
14542
+ shift: true
14543
+ }, event => {
14544
+ var _ref$current;
14545
+ event.preventDefault();
14546
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
14469
14547
  });
14470
14548
  return /*#__PURE__*/React__default.createElement(Button$1, {
14471
14549
  "aria-label": texts.table2.filters.tooltip,
@@ -14499,9 +14577,13 @@ const FiltersButton = ({
14499
14577
  onClick: handleReset
14500
14578
  }, texts.table2.filters.buttons.clearFilters) : null)))),
14501
14579
  ref: ref,
14502
- tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut$1, {
14580
+ tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.filters.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
14503
14581
  className: "ml-2",
14504
- keys: ['Ctrl', 'Shift', 'F']
14582
+ keys: {
14583
+ key: 'f',
14584
+ meta: true,
14585
+ shift: true
14586
+ }
14505
14587
  }))
14506
14588
  }, /*#__PURE__*/React__default.createElement(Icon, {
14507
14589
  name: columnFilters.length ? 'filter-solid' : 'filter'
@@ -14538,13 +14620,15 @@ const Search$2 = props => {
14538
14620
  const value = event.target.value;
14539
14621
  (_props$onSearch3 = props.onSearch) === null || _props$onSearch3 === void 0 ? void 0 : _props$onSearch3.call(props, value);
14540
14622
  };
14541
- useGlobalKeyboardShortcut(event => {
14542
- if (event.key === 'f' && (event.ctrlKey || event.metaKey) && !event.shiftKey) {
14543
- if (document.activeElement !== ref.current) {
14544
- var _ref$current;
14545
- event.preventDefault();
14546
- (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
14547
- }
14623
+ useGlobalKeyDown({
14624
+ key: 'f',
14625
+ meta: true,
14626
+ shift: false
14627
+ }, event => {
14628
+ if (document.activeElement !== ref.current) {
14629
+ var _ref$current;
14630
+ event.preventDefault();
14631
+ (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
14548
14632
  }
14549
14633
  });
14550
14634
  const className = cn('w-48', {
@@ -14581,12 +14665,13 @@ const EditModeButton = /*#__PURE__*/React__default.forwardRef(function EditModeB
14581
14665
  }
14582
14666
  return false;
14583
14667
  }, [isEditing]);
14584
- useGlobalKeyboardShortcut(event => {
14585
- if (event.key === 'e' && (event.ctrlKey || event.metaKey)) {
14586
- var _internalRef$current;
14587
- event.preventDefault();
14588
- (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
14589
- }
14668
+ useGlobalKeyDown({
14669
+ key: 'e',
14670
+ meta: true
14671
+ }, event => {
14672
+ var _internalRef$current;
14673
+ event.preventDefault();
14674
+ (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
14590
14675
  });
14591
14676
  React__default.useEffect(() => {
14592
14677
  window.addEventListener('beforeunload', showWarning);
@@ -14617,9 +14702,12 @@ const EditModeButton = /*#__PURE__*/React__default.forwardRef(function EditModeB
14617
14702
  }),
14618
14703
  disabled: !hasVisibleEditableColumns,
14619
14704
  ref: internalRef,
14620
- tooltip: hasVisibleEditableColumns ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.editing.tooltip, /*#__PURE__*/React__default.createElement(Shortcut$1, {
14705
+ tooltip: hasVisibleEditableColumns ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table2.editing.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
14621
14706
  className: "ml-2",
14622
- keys: ['Ctrl', 'E']
14707
+ keys: {
14708
+ key: 'e',
14709
+ meta: true
14710
+ }
14623
14711
  })) : texts.table2.editing.tooltipDisabled
14624
14712
  }, /*#__PURE__*/React__default.createElement(Icon, {
14625
14713
  name: "edit"
@@ -14817,14 +14905,11 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
14817
14905
  const _temp3 = function () {
14818
14906
  if (typeof loadMore === 'function') {
14819
14907
  const scrollY = event.currentTarget.scrollTop;
14820
- const isVerticalScrolling = scrollY !== prevScrollY.current;
14908
+ const isScrollingDown = scrollY > prevScrollY.current;
14821
14909
  prevScrollY.current = scrollY;
14910
+ const scrolledPercentage = Math.round(100 / event.currentTarget.scrollHeight * scrollY);
14822
14911
  const _temp2 = function () {
14823
- if (
14824
- // This condition will also prevent triggering of loadMore function when scrolled upwards
14825
- event.currentTarget.scrollHeight - event.currentTarget.scrollTop - event.currentTarget.clientHeight < 600 && !loadingRef.current &&
14826
- // We don't want to trigger loadMore function on horizontal scrolling
14827
- isVerticalScrolling) {
14912
+ if (isScrollingDown && !loadingRef.current && scrolledPercentage >= 80) {
14828
14913
  const _temp = _finallyRethrows(function () {
14829
14914
  return _catch(function () {
14830
14915
  const isAllRowsSelected = table.getIsAllRowsSelected();
@@ -16003,7 +16088,7 @@ exports.RadioGroup = RadioGroup;
16003
16088
  exports.SearchInput = SearchInput;
16004
16089
  exports.Select = Select;
16005
16090
  exports.Select2 = Select2;
16006
- exports.Shortcut = Shortcut$1;
16091
+ exports.Shortcut = Shortcut;
16007
16092
  exports.Spinner = Spinner;
16008
16093
  exports.Switch = Switch;
16009
16094
  exports.Table = Table;
@@ -16020,6 +16105,7 @@ exports.Treeview = Treeview;
16020
16105
  exports.VisuallyHidden = VisuallyHidden;
16021
16106
  exports.WindowedTable = WindowedTable;
16022
16107
  exports.convertRowIndexPathToNumberArray = convertRowIndexPathToNumberArray;
16108
+ exports.createShortcutKeyDownHandler = createShortcutKeyDownHandler;
16023
16109
  exports.defaultLocalisationTexts = defaultLocalisationTexts;
16024
16110
  exports.defaultLocalizationContext = defaultLocalizationContext;
16025
16111
  exports.findByValue = findByValue$1;
@@ -16031,6 +16117,7 @@ exports.getParentRowIndexPath = getParentRowIndexPath;
16031
16117
  exports.getRadioGroupItemValueAsString = getRadioGroupItemValueAsString;
16032
16118
  exports.icons = icons;
16033
16119
  exports.insertChildTableRow = insertChildTableRow;
16120
+ exports.isMacOs = isMacOs;
16034
16121
  exports.isWeakEqual = isWeakEqual;
16035
16122
  exports.mergeRefs = mergeRefs;
16036
16123
  exports.parseFromCustomString = parseFromCustomString;