@economic/taco 2.7.4 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/dist/components/Icon/components/CircleInformation.d.ts +3 -0
  2. package/dist/components/Icon/components/CircleQuestionmark.d.ts +3 -0
  3. package/dist/components/Icon/components/CircleWarning.d.ts +3 -0
  4. package/dist/components/Icon/components/index.d.ts +1 -1
  5. package/dist/components/Input/Input.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/Navigation2/components/Link.d.ts +1 -1
  9. package/dist/components/Select2/Select2.d.ts +1 -0
  10. package/dist/components/Select2/components/Option.d.ts +1 -1
  11. package/dist/components/Select2/components/Search.d.ts +1 -1
  12. package/dist/components/Select2/components/Trigger.d.ts +1 -0
  13. package/dist/components/Table3/components/columns/footer/Summary.d.ts +1 -0
  14. package/dist/components/Tag/Tag.d.ts +1 -1
  15. package/dist/esm/index.css +18 -3
  16. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +8 -1
  17. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  18. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +0 -9
  19. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Icon/components/CircleInformation.js +19 -0
  21. package/dist/esm/packages/taco/src/components/Icon/components/CircleInformation.js.map +1 -0
  22. package/dist/esm/packages/taco/src/components/Icon/components/CircleQuestionmark.js +19 -0
  23. package/dist/esm/packages/taco/src/components/Icon/components/CircleQuestionmark.js.map +1 -0
  24. package/dist/esm/packages/taco/src/components/Icon/components/CircleWarning.js +19 -0
  25. package/dist/esm/packages/taco/src/components/Icon/components/CircleWarning.js.map +1 -0
  26. package/dist/esm/packages/taco/src/components/Icon/components/index.js +6 -0
  27. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Provider/Localization.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Select2/Select2.js +4 -4
  31. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +28 -7
  33. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/Table3.js +8 -2
  35. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +3 -5
  37. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +15 -4
  39. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +35 -13
  41. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js +12 -2
  43. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +4 -1
  45. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/EditButton.js +0 -9
  47. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/EditButton.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +2 -1
  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/hooks/features/useEditing.js +15 -8
  51. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
  52. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js +2 -2
  53. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  54. package/dist/esm/packages/taco/src/index.js +1 -1
  55. package/dist/esm/packages/taco/src/primitives/Button.js +5 -0
  56. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  57. package/dist/esm/packages/taco/src/utils/keyboard.js +24 -19
  58. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  59. package/dist/index.css +18 -3
  60. package/dist/taco.cjs.development.js +212 -86
  61. package/dist/taco.cjs.development.js.map +1 -1
  62. package/dist/taco.cjs.production.min.js +1 -1
  63. package/dist/taco.cjs.production.min.js.map +1 -1
  64. package/dist/utils/keyboard.d.ts +2 -1
  65. package/package.json +2 -2
  66. package/types.json +17771 -11839
@@ -761,6 +761,21 @@ function IconCircleClose(props, svgRef) {
761
761
  }
762
762
  var CircleClose = /*#__PURE__*/React.forwardRef(IconCircleClose);
763
763
 
764
+ function IconCircleInformation(props, svgRef) {
765
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
766
+ fill: "none",
767
+ xmlns: "http://www.w3.org/2000/svg",
768
+ viewBox: "0 0 24 24",
769
+ ref: svgRef
770
+ }, props), /*#__PURE__*/React.createElement("path", {
771
+ fillRule: "evenodd",
772
+ clipRule: "evenodd",
773
+ d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm0 1.5a8.5 8.5 0 100 17 8.5 8.5 0 000-17zm-.267 5.753a1 1 0 10-.001-2.001 1 1 0 00.001 2.001zM14 16.754a.75.75 0 000-1.502h-1.267V11.5a.752.752 0 00-.75-.751H10a.75.75 0 000 1.502h1.233v3H10a.75.75 0 000 1.503h4z",
774
+ fill: "currentColor"
775
+ }));
776
+ }
777
+ var CircleInformation = /*#__PURE__*/React.forwardRef(IconCircleInformation);
778
+
764
779
  function IconCircleMinus(props, svgRef) {
765
780
  return /*#__PURE__*/React.createElement("svg", Object.assign({
766
781
  xmlns: "http://www.w3.org/2000/svg",
@@ -787,6 +802,21 @@ function IconCirclePlus(props, svgRef) {
787
802
  }
788
803
  var CirclePlus = /*#__PURE__*/React.forwardRef(IconCirclePlus);
789
804
 
805
+ function IconCircleQuestionmark(props, svgRef) {
806
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
807
+ fill: "none",
808
+ xmlns: "http://www.w3.org/2000/svg",
809
+ viewBox: "0 0 24 24",
810
+ ref: svgRef
811
+ }, props), /*#__PURE__*/React.createElement("path", {
812
+ fillRule: "evenodd",
813
+ clipRule: "evenodd",
814
+ d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm0 1.5a8.5 8.5 0 100 17 8.5 8.5 0 000-17zm.58 10.15a.71.71 0 00.226-.543v-1.272a.306.306 0 01.045-.143.522.522 0 01.136-.133 3.91 3.91 0 01.285-.18l.028-.016c.112-.066.242-.143.387-.237.706-.454 1.156-1.012 1.156-1.838 0-.673-.37-1.19-.887-1.53-.513-.336-1.183-.508-1.845-.508-.552 0-1.234.096-1.79.317a2.441 2.441 0 00-.574.315c-.09.069-.174.146-.245.232a1.15 1.15 0 00-.154.238 1.474 1.474 0 00-.148.625c0 .075.01.118.02.167.036.159.12.3.254.401a.77.77 0 00.47.147.768.768 0 00.745-.517l.004-.013c.053-.17.226-.306.517-.4.282-.09.611-.116.852-.116.267 0 .575.078.809.213.241.139.345.298.345.44 0 .188-.051.32-.152.444-.11.136-.285.27-.55.444h-.002l-.136.091h-.001c-.232.153-.49.322-.695.513-.252.234-.467.537-.467.938v1.38c0 .226.087.421.248.556.155.13.357.185.56.185.21 0 .41-.064.558-.2zm-.559 3.1c.504 0 .924-.4.924-.904 0-.512-.423-.9-.924-.9a.908.908 0 00-.92.9c0 .504.42.904.92.904z",
815
+ fill: "currentColor"
816
+ }));
817
+ }
818
+ var CircleQuestionmark = /*#__PURE__*/React.forwardRef(IconCircleQuestionmark);
819
+
790
820
  function IconCircleTick(props, svgRef) {
791
821
  return /*#__PURE__*/React.createElement("svg", Object.assign({
792
822
  xmlns: "http://www.w3.org/2000/svg",
@@ -800,6 +830,21 @@ function IconCircleTick(props, svgRef) {
800
830
  }
801
831
  var CircleTick = /*#__PURE__*/React.forwardRef(IconCircleTick);
802
832
 
833
+ function IconCircleWarning(props, svgRef) {
834
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
835
+ fill: "none",
836
+ xmlns: "http://www.w3.org/2000/svg",
837
+ viewBox: "0 0 24 24",
838
+ ref: svgRef
839
+ }, props), /*#__PURE__*/React.createElement("path", {
840
+ fillRule: "evenodd",
841
+ clipRule: "evenodd",
842
+ d: "M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2zm0 1.5a8.5 8.5 0 100 17 8.5 8.5 0 000-17zm0 3.75a.97.97 0 00-.974.989L11.2 12.5c.01.417.352.749.771.749a.768.768 0 00.77-.74l.23-4.26a.97.97 0 00-.97-1zm0 9.5a1 1 0 100-2 1 1 0 000 2z",
843
+ fill: "currentColor"
844
+ }));
845
+ }
846
+ var CircleWarning = /*#__PURE__*/React.forwardRef(IconCircleWarning);
847
+
803
848
  function IconClampOpen(props, svgRef) {
804
849
  return /*#__PURE__*/React.createElement("svg", Object.assign({
805
850
  xmlns: "http://www.w3.org/2000/svg",
@@ -3249,9 +3294,12 @@ const icons = {
3249
3294
  'chevron-up-solid': ChevronUpSolid,
3250
3295
  'chevron-up': ChevronUp,
3251
3296
  'circle-close': CircleClose,
3297
+ 'circle-information': CircleInformation,
3252
3298
  'circle-minus': CircleMinus,
3253
3299
  'circle-plus': CirclePlus,
3300
+ 'circle-questionmark': CircleQuestionmark,
3254
3301
  'circle-tick': CircleTick,
3302
+ 'circle-warning': CircleWarning,
3255
3303
  'clamp-open': ClampOpen,
3256
3304
  clamp: Clamp,
3257
3305
  close: Close,
@@ -3837,29 +3885,34 @@ function isEventTriggeredOnInteractiveElement(eventTarget) {
3837
3885
  const element = eventTarget;
3838
3886
  return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
3839
3887
  }
3840
- function createShortcutKeyDownHandler(key, handler) {
3888
+ function shouldTriggerShortcut(event, key) {
3889
+ const keyOptions = typeof key === 'string' ? {
3890
+ key,
3891
+ meta: false,
3892
+ shift: false
3893
+ } : key;
3894
+ if (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey) || !keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey)) {
3895
+ return false;
3896
+ }
3897
+ if (keyOptions.shift && !event.shiftKey || keyOptions.shift === false && event.shiftKey) {
3898
+ return false;
3899
+ }
3900
+ return event.key.toLowerCase() === keyOptions.key.toLowerCase();
3901
+ }
3902
+ function createShortcutKeyDownHandler(key, handler, stopPropagation = true) {
3841
3903
  return function (event) {
3842
- const keyOptions = typeof key === 'string' ? {
3843
- key,
3844
- meta: false,
3845
- shift: false
3846
- } : key;
3847
3904
  if (event.target !== event.currentTarget && isEventTriggeredOnInteractiveElement(event.target)) {
3848
3905
  return;
3849
3906
  }
3850
- if (keyOptions.meta && (isMacOs() ? !event.metaKey : !event.ctrlKey) || !keyOptions.meta && (isMacOs() ? event.metaKey : event.ctrlKey)) {
3851
- return;
3852
- }
3853
- if (keyOptions.shift && !event.shiftKey || keyOptions.shift === false && event.shiftKey) {
3854
- return;
3855
- }
3856
- const condition = event.key.toLowerCase() === keyOptions.key.toLowerCase();
3907
+ const condition = shouldTriggerShortcut(event, key);
3857
3908
  if (condition) {
3858
- var _event$stopImmediateP;
3859
- // stops react handlers bubbling up to global
3860
- event.stopPropagation();
3861
- // stops global handlers bubbling up to other global
3862
- (_event$stopImmediateP = event.stopImmediatePropagation) === null || _event$stopImmediateP === void 0 ? void 0 : _event$stopImmediateP.call(event);
3909
+ if (stopPropagation) {
3910
+ var _event$stopImmediateP;
3911
+ // stops react handlers bubbling up to global
3912
+ event.stopPropagation();
3913
+ // stops global handlers bubbling up to other global
3914
+ (_event$stopImmediateP = event.stopImmediatePropagation) === null || _event$stopImmediateP === void 0 ? void 0 : _event$stopImmediateP.call(event);
3915
+ }
3863
3916
  handler(event);
3864
3917
  }
3865
3918
  };
@@ -3873,7 +3926,7 @@ const useGlobalKeyDown = (shortcut, handler) => {
3873
3926
  React__default.useEffect(() => {
3874
3927
  let handleKeyDown;
3875
3928
  if (shortcut) {
3876
- handleKeyDown = createShortcutKeyDownHandler(shortcut, handler);
3929
+ handleKeyDown = createShortcutKeyDownHandler(shortcut, handler, false);
3877
3930
  document.addEventListener('keydown', handleKeyDown);
3878
3931
  }
3879
3932
  return () => {
@@ -3881,7 +3934,7 @@ const useGlobalKeyDown = (shortcut, handler) => {
3881
3934
  document.removeEventListener('keydown', handleKeyDown);
3882
3935
  }
3883
3936
  };
3884
- }, [shortcut]);
3937
+ }, [shortcut, handler]);
3885
3938
  };
3886
3939
 
3887
3940
  const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
@@ -3895,6 +3948,11 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
3895
3948
  const internalRef = useMergedRef(ref);
3896
3949
  useGlobalKeyDown(shortcut, () => {
3897
3950
  var _internalRef$current;
3951
+ const dialog = document.querySelector('[role="dialog"]');
3952
+ // Don't trigger the click on the button if it is outside of the dialog
3953
+ if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
3954
+ return;
3955
+ }
3898
3956
  (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.click();
3899
3957
  });
3900
3958
  const Tag = props.href ? 'a' : 'button';
@@ -4367,7 +4425,7 @@ const defaultLocalisationTexts = {
4367
4425
  }
4368
4426
  },
4369
4427
  search: {
4370
- excludeUnmatchedResults: 'Hide unmatched records',
4428
+ excludeUnmatchedResults: 'Show only search results',
4371
4429
  placeholder: 'Search...'
4372
4430
  },
4373
4431
  shortcuts: {
@@ -5630,6 +5688,12 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5630
5688
  const className = cn('inline-flex relative', {
5631
5689
  'yt-combobox--inline': props.inline
5632
5690
  }, 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
+ };
5633
5697
  return /*#__PURE__*/React.createElement("span", {
5634
5698
  className: className,
5635
5699
  "data-taco": "combobox",
@@ -5639,7 +5703,8 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
5639
5703
  ref: internalRef
5640
5704
  }, /*#__PURE__*/React.createElement("div", Object.assign({}, combobox, {
5641
5705
  className: "inline w-full",
5642
- ref: ref
5706
+ ref: ref,
5707
+ onKeyDown: handleKeydown
5643
5708
  }), /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
5644
5709
  autoComplete: "off",
5645
5710
  button: props.inline ? /*#__PURE__*/React.createElement(IconButton
@@ -6151,8 +6216,6 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
6151
6216
  } else if (dialog.onClose) {
6152
6217
  dialog.onClose();
6153
6218
  }
6154
- // Stops event from propogating outside the dialog.
6155
- event.stopPropagation();
6156
6219
  };
6157
6220
  // the chosen behaviour in taco is that outside clicks do not close the dialog
6158
6221
  const handleInteractOutside = event => event.preventDefault();
@@ -6166,19 +6229,12 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
6166
6229
  } else {
6167
6230
  output = props.children;
6168
6231
  }
6169
- const onKeyDown = event => {
6170
- if (event.key !== 'Escape') {
6171
- // Stops event from propogating outside the dialog.
6172
- event.stopPropagation();
6173
- }
6174
- };
6175
6232
  return /*#__PURE__*/React.createElement(DialogPrimitive.Portal, null, /*#__PURE__*/React.createElement(DialogPrimitive.Overlay, {
6176
6233
  asChild: true
6177
6234
  }, /*#__PURE__*/React.createElement(Backdrop, null, /*#__PURE__*/React.createElement(DialogPrimitive.Content, Object.assign({}, props, {
6178
6235
  className: className,
6179
6236
  onEscapeKeyDown: handleEscapeKeyDown,
6180
6237
  onInteractOutside: handleInteractOutside,
6181
- onKeyDown: onKeyDown,
6182
6238
  ref: internalRef,
6183
6239
  style: {
6184
6240
  ...props.style,
@@ -9925,6 +9981,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
9925
9981
  children,
9926
9982
  emptyValue,
9927
9983
  value,
9984
+ placeholder,
9928
9985
  ...buttonProps
9929
9986
  } = props;
9930
9987
  const {
@@ -9935,7 +9992,14 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
9935
9992
  const contentClassName = cn('truncate items-center gap-1');
9936
9993
  const currentValue = children.find(matchesValue(value));
9937
9994
  let output;
9938
- if (currentValue) {
9995
+ if (placeholder && currentValue === undefined) {
9996
+ output = /*#__PURE__*/React__default.createElement("div", {
9997
+ className: cn({
9998
+ 'text-grey-700': disabled,
9999
+ 'text-grey-500': !disabled
10000
+ })
10001
+ }, placeholder);
10002
+ } else if (currentValue) {
9939
10003
  if (tags && emptyValue !== undefined && emptyValue !== value) {
9940
10004
  output = /*#__PURE__*/React__default.createElement(Tag$1, {
9941
10005
  className: "truncate",
@@ -9962,6 +10026,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
9962
10026
  children,
9963
10027
  emptyValue: _,
9964
10028
  values = [],
10029
+ placeholder,
9965
10030
  ...buttonProps
9966
10031
  } = props;
9967
10032
  const {
@@ -9983,7 +10048,12 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
9983
10048
  className: "my-1 flex max-h-[5.5rem] flex-col"
9984
10049
  }, /*#__PURE__*/React__default.createElement("div", {
9985
10050
  className: "flex flex-wrap gap-1"
9986
- }, valuesAsChildren.map(child => /*#__PURE__*/React__default.createElement(Tag$1, {
10051
+ }, valuesAsChildren.length === 0 ? /*#__PURE__*/React__default.createElement("div", {
10052
+ className: cn({
10053
+ 'text-grey-700': disabled,
10054
+ 'text-grey-500': !disabled
10055
+ })
10056
+ }, placeholder) : valuesAsChildren.map(child => /*#__PURE__*/React__default.createElement(Tag$1, {
9987
10057
  key: String(child.props.value),
9988
10058
  className: "truncate",
9989
10059
  color: tags ? child.props.color : undefined,
@@ -10001,7 +10071,8 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
10001
10071
  } else {
10002
10072
  content = /*#__PURE__*/React__default.createElement(MultipleValue, {
10003
10073
  key: String(open),
10004
- valuesAsChildren: valuesAsChildren
10074
+ valuesAsChildren: valuesAsChildren,
10075
+ placeholder: placeholder
10005
10076
  });
10006
10077
  }
10007
10078
  return /*#__PURE__*/React__default.createElement("div", {
@@ -10017,7 +10088,8 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
10017
10088
  }), content));
10018
10089
  });
10019
10090
  const MultipleValue = ({
10020
- valuesAsChildren
10091
+ valuesAsChildren,
10092
+ placeholder
10021
10093
  }) => {
10022
10094
  const {
10023
10095
  disabled,
@@ -10040,9 +10112,14 @@ const MultipleValue = ({
10040
10112
  }, /*#__PURE__*/React__default.createElement("div", {
10041
10113
  className: "flex gap-1 truncate",
10042
10114
  ref: el => setContentRef(el)
10043
- }, valuesAsChildren.map((child, index) => {
10115
+ }, valuesAsChildren.length === 0 ? /*#__PURE__*/React__default.createElement("div", {
10116
+ className: cn({
10117
+ 'text-grey-700': disabled,
10118
+ 'text-grey-500': !disabled
10119
+ })
10120
+ }, placeholder) : valuesAsChildren.map((child, index) => {
10044
10121
  const tag = /*#__PURE__*/React__default.createElement(Tag$1, {
10045
- key: child.props.value,
10122
+ key: String(child.props.value),
10046
10123
  className: cn('cursor-pointer', {
10047
10124
  truncate: index === boundaryIndex,
10048
10125
  hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
@@ -10055,7 +10132,7 @@ const MultipleValue = ({
10055
10132
  }, child.props.children);
10056
10133
  if (index === boundaryIndex) {
10057
10134
  return /*#__PURE__*/React__default.createElement(Tooltip, {
10058
- key: child.props.value,
10135
+ key: String(child.props.value),
10059
10136
  title: String(child.props.children)
10060
10137
  }, tag);
10061
10138
  }
@@ -10382,6 +10459,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
10382
10459
  defaultValue: defaultProp,
10383
10460
  disabled = false,
10384
10461
  emptyValue = undefined,
10462
+ placeholder,
10385
10463
  highlighted = false,
10386
10464
  invalid = false,
10387
10465
  multiple = false,
@@ -10527,14 +10605,13 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
10527
10605
  emptyValue: emptyValue,
10528
10606
  onBlur: handleBlur,
10529
10607
  onKeyDown: handleKeyDown,
10530
- ref: internalRef
10608
+ ref: internalRef,
10609
+ placeholder: placeholder
10531
10610
  }), flattenedChildren)), /*#__PURE__*/React__default.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Content, {
10532
10611
  asChild: true,
10533
10612
  align: "start",
10534
- onOpenAutoFocus: event => {
10613
+ onOpenAutoFocus: () => {
10535
10614
  var _internalRef$current;
10536
- event.preventDefault();
10537
- event.stopPropagation();
10538
10615
  (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
10539
10616
  },
10540
10617
  onCloseAutoFocus: event => {
@@ -16141,7 +16218,10 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
16141
16218
  }) : null, hasMenu ? /*#__PURE__*/React__default.createElement(Menu$3, {
16142
16219
  canFreeze: canFreeze,
16143
16220
  canHide: canHide,
16144
- className: "ml-auto hidden group-hover/column:flex aria-expanded:!flex",
16221
+ className: cn('hidden group-hover/column:flex aria-expanded:!flex', {
16222
+ 'ml-auto': align !== 'right',
16223
+ 'ml-2': align === 'right'
16224
+ }),
16145
16225
  index: index,
16146
16226
  menu: meta.menu,
16147
16227
  onGoto: handleGoto,
@@ -17180,14 +17260,20 @@ function useEditing(isEnabled, onSave) {
17180
17260
  if (event.defaultPrevented) {
17181
17261
  return;
17182
17262
  }
17183
- if (event.ctrlKey || event.metaKey) {
17184
- if (event.key === 'e') {
17185
- setIsEditing(editing => !editing);
17186
- } else if (event.key === 's') {
17187
- // Prevent default browser save
17188
- event.preventDefault();
17189
- saveChangesIfNeeded();
17190
- }
17263
+ if (shouldTriggerShortcut(event, {
17264
+ key: 'e',
17265
+ meta: true,
17266
+ shift: false
17267
+ })) {
17268
+ setIsEditing(editing => !editing);
17269
+ } else if (shouldTriggerShortcut(event, {
17270
+ key: 's',
17271
+ meta: true,
17272
+ shift: false
17273
+ })) {
17274
+ // Prevent default browser save
17275
+ event.preventDefault();
17276
+ saveChangesIfNeeded();
17191
17277
  }
17192
17278
  }, [isEditing]);
17193
17279
  const handleBlur = React__default.useCallback(event => {
@@ -17604,6 +17690,22 @@ const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
17604
17690
  }));
17605
17691
  });
17606
17692
 
17693
+ // By UX design, textarea should fold to min size when blured and extend to max 5 lines height when edited in enableTruncate mode,
17694
+ // for this reason we need to set min/max height limits for each font size value.
17695
+ const heights = {
17696
+ small: {
17697
+ min: 24,
17698
+ max: 86
17699
+ },
17700
+ medium: {
17701
+ min: 34,
17702
+ max: 100
17703
+ },
17704
+ large: {
17705
+ min: 40,
17706
+ max: 140
17707
+ }
17708
+ };
17607
17709
  const TextareaControl = /*#__PURE__*/React__default.forwardRef(function TextareaControl(props, externalRef) {
17608
17710
  const {
17609
17711
  onKeyDown: handleKeyDown,
@@ -17613,19 +17715,25 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
17613
17715
  align,
17614
17716
  isCurrentRow,
17615
17717
  value,
17718
+ fontSize,
17616
17719
  ...attributes
17617
17720
  } = props;
17618
- const textareaMaxHeight = 120;
17619
- const textareaMinHeight = 32;
17721
+ const minMaxHeight = heights[fontSize];
17620
17722
  const columnMeta = column.columnDef.meta;
17621
17723
  const ref = useMergedRef(externalRef);
17622
17724
  React__default.useEffect(() => {
17623
- // If truncation is not enabled, then textarea should re-calculate it's height to fit with it's own content, when initialized.
17624
- if (ref !== null && ref !== void 0 && ref.current && !(columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate)) {
17625
- const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
17626
- resizeTextArea(textareaElement);
17725
+ if (ref !== null && ref !== void 0 && ref.current) {
17726
+ // Need to reset textarea to min height when font size got changed and if column in enable truncate mode.
17727
+ if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
17728
+ const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
17729
+ textareaElement.style.height = `${minMaxHeight.min}px`;
17730
+ // If truncation is not enabled, then textarea should re-calculate it's height to fit with it's own content, when initialized or fonsSize got changed.
17731
+ } else {
17732
+ const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
17733
+ resizeTextArea(textareaElement);
17734
+ }
17627
17735
  }
17628
- }, []);
17736
+ }, [fontSize]);
17629
17737
  React__default.useEffect(() => {
17630
17738
  // If truncation is enabled, then textarea should only adjust to it's own content, when in detail mode.
17631
17739
  // Otherwise it should collapse to minimal height.
@@ -17634,7 +17742,7 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
17634
17742
  if (isCellInDetailMode) {
17635
17743
  resizeTextArea(textareaElement);
17636
17744
  } else {
17637
- textareaElement.style.height = `${textareaMinHeight}px`;
17745
+ textareaElement.style.height = `${minMaxHeight.min}px`;
17638
17746
  }
17639
17747
  }
17640
17748
  }, [isCellInDetailMode]);
@@ -17644,9 +17752,9 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
17644
17752
  const textareaRect = textareaElement.getBoundingClientRect();
17645
17753
  const prevHeight = textareaRect.height;
17646
17754
  if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
17647
- if (prevHeight < textareaMaxHeight) {
17755
+ if (prevHeight < minMaxHeight.max) {
17648
17756
  textareaElement.style.height = 'inherit';
17649
- textareaElement.style.height = `${Math.min(textareaElement.scrollHeight, textareaMaxHeight)}px`;
17757
+ textareaElement.style.height = `${Math.min(textareaElement.scrollHeight, minMaxHeight.max)}px`;
17650
17758
  }
17651
17759
  } else {
17652
17760
  textareaElement.style.height = 'inherit';
@@ -17683,13 +17791,13 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
17683
17791
  // If truncation is enabled, then textarea should shring back to min height, when loosing focus.
17684
17792
  if (columnMeta !== null && columnMeta !== void 0 && columnMeta.enableTruncate) {
17685
17793
  const textareaElement = event.currentTarget;
17686
- textareaElement.style.height = `${textareaMinHeight}px`;
17794
+ textareaElement.style.height = `${minMaxHeight.min}px`;
17687
17795
  }
17688
17796
  },
17689
17797
  className: cn(getCellAlignmentClasses$1(align), `z-20 h-fit resize-none`, {
17690
- [`!min-h-[${textareaMinHeight}px]`]: columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate,
17798
+ [`!min-h-[${minMaxHeight.min}px]`]: columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate,
17691
17799
  '!yt-focus-dark': isCellInDetailMode,
17692
- [`h-[${textareaMinHeight}px]`]: !isCellInDetailMode && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate),
17800
+ [`h-[${minMaxHeight.min}px]`]: !isCellInDetailMode && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate),
17693
17801
  // Only allow resizing when focused and truncation enabled
17694
17802
  'focus:resize-y': isCurrentRow && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate)
17695
17803
  }),
@@ -17719,16 +17827,26 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
17719
17827
  const columnMeta = column.columnDef.meta;
17720
17828
  const controlRenderer = columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.control;
17721
17829
  const isCellInDetailMode = tableMeta.editing.detailModeEditing && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.contains(document.activeElement));
17722
- // Revert to initial value if escape was pressed
17723
17830
  const handleKeyDown = event => {
17831
+ // For some reason keydown event handler is not propogated to the table when input or other control element is
17832
+ // in focus so we need to check for shortcut that toggles the editing.
17833
+ if (shouldTriggerShortcut(event, {
17834
+ key: 'e',
17835
+ meta: true,
17836
+ shift: false
17837
+ })) {
17838
+ tableMeta.editing.toggleEditing(false);
17839
+ return;
17840
+ }
17724
17841
  const target = event.target;
17725
17842
  if (target.readOnly) {
17726
17843
  return;
17727
17844
  }
17728
- // prevent row arrow shortcuts triggering when in detail mode
17845
+ // Prevent row arrow shortcuts triggering when in detail mode
17729
17846
  if (tableMeta.editing.detailModeEditing && (event.key === 'ArrowUp' || event.key === 'ArrowDown')) {
17730
17847
  event.stopPropagation();
17731
17848
  }
17849
+ // Revert to initial value if escape was pressed
17732
17850
  if (event.key === 'Escape') {
17733
17851
  event.preventDefault();
17734
17852
  if (tableMeta.editing.detailModeEditing) {
@@ -17774,7 +17892,6 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
17774
17892
  // Switching to editing mode, when key pressed any alphabetical character or number
17775
17893
  if (/^[a-z0-9]$/i.test(event.key)) {
17776
17894
  tableMeta.editing.setDetailModeEditing(true);
17777
- return;
17778
17895
  }
17779
17896
  };
17780
17897
  const handleDatepickerChange = event => {
@@ -17825,7 +17942,8 @@ const EditingControl = /*#__PURE__*/React__default.forwardRef(function Control(p
17825
17942
  return /*#__PURE__*/React__default.createElement(TextareaControl, Object.assign({}, props, {
17826
17943
  isCellInDetailMode: isCellInDetailMode,
17827
17944
  onKeyDown: handleInputKeyDown,
17828
- ref: refCallback
17945
+ ref: refCallback,
17946
+ fontSize: tableMeta.fontSize.size
17829
17947
  }));
17830
17948
  }
17831
17949
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
@@ -17936,11 +18054,9 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
17936
18054
  const controlRenderer = (_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.control;
17937
18055
  const className = cn('!px-[0.4375rem] py-[calc(var(--table3-row-padding)_-_0.06rem)]', {
17938
18056
  relative: (isCurrentRow || isHovered) && controlRenderer === 'textarea',
17939
- // Need to set higher z-index, so that the current row textarea (in expanded state) overlaps rows below
17940
- 'z-10': isCurrentRow,
17941
- // When row is hovered and located below, then the hovered textarea overlaps the current row textarea(if the current row textarea is expanded to support multiple lines),
17942
- // as result we need to set lower z-index for the hovered row -> cell.
17943
- 'z-0': isHovered
18057
+ // Need to set higher z-index, so that the current row textarea (in expanded state, when positioned absolute) overlaps rows below,
18058
+ // but at the same time it should not overlap the table headers which has z-10.
18059
+ 'z-[9]': isCurrentRow && controlRenderer === 'textarea'
17944
18060
  },
17945
18061
  // component overrides - grayscale for editing hover
17946
18062
  '[[role="row"][data-current="false"]:hover_&>*]:!grayscale [[role="row"][data-current="false"]:hover_&_.bg-white]:!bg-grey-100',
@@ -19729,6 +19845,7 @@ function Filters(props) {
19729
19845
  table
19730
19846
  } = props;
19731
19847
  const {
19848
+ locale,
19732
19849
  texts
19733
19850
  } = useLocalization();
19734
19851
  const ref = React__default.useRef(null);
@@ -19809,7 +19926,7 @@ function Filters(props) {
19809
19926
  className: "mb-0 inline-flex"
19810
19927
  }, texts.table3.filters.button), /*#__PURE__*/React__default.createElement("p", {
19811
19928
  className: "text-grey-700 mb-0 mr-auto mt-px inline-flex"
19812
- }, texts.table3.filters.total.replace('[CURRENT]', String(table.getFilteredRowModel().rows.length)).replace('[TOTAL]', String(total))))), /*#__PURE__*/React__default.createElement("div", {
19929
+ }, texts.table3.filters.total.replace('[CURRENT]', new Intl.NumberFormat(locale).format(table.getFilteredRowModel().rows.length)).replace('[TOTAL]', new Intl.NumberFormat(locale).format(total))))), /*#__PURE__*/React__default.createElement("div", {
19813
19930
  className: "flex flex-col gap-2"
19814
19931
  }, filters.map((filter, index) => /*#__PURE__*/React__default.createElement(Filter$1, {
19815
19932
  key: `filter_${index}`,
@@ -19950,14 +20067,6 @@ function EditButton(props) {
19950
20067
  '!wcag-blue-100': tableMeta.editing.isEditing
19951
20068
  });
19952
20069
  const handleClick = () => tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing);
19953
- useGlobalKeyDown({
19954
- key: 'e',
19955
- meta: true,
19956
- shift: false
19957
- }, event => {
19958
- event.preventDefault();
19959
- tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing);
19960
- });
19961
20070
  return /*#__PURE__*/React__default.createElement(Button$1, {
19962
20071
  "aria-pressed": tableMeta.editing.isEditing,
19963
20072
  className: className,
@@ -20491,10 +20600,13 @@ function useTableRefInstanceSetup(table, ref) {
20491
20600
  }
20492
20601
 
20493
20602
  function Summary$1(props) {
20603
+ var _table$getState$colum;
20494
20604
  const {
20605
+ currentLength,
20495
20606
  length,
20496
20607
  table
20497
20608
  } = props;
20609
+ const tableMeta = table.options.meta;
20498
20610
  const {
20499
20611
  locale,
20500
20612
  texts
@@ -20505,13 +20617,20 @@ function Summary$1(props) {
20505
20617
  const rowsSelectedLength = table.getIsAllRowsSelected() ? length : table.getSelectedRowModel().rows.length;
20506
20618
  if (rowsSelectedLength > 0) {
20507
20619
  label = texts.table3.footer.summary.selected;
20508
- count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table3.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, length));
20620
+ count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table3.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
20621
+ } else if ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
20622
+ // filtered data
20623
+ !!table.getState().globalFilter && tableMeta.search.excludeUnmatchedResults // search with hide enabled
20624
+ ) {
20625
+ label = texts.table3.footer.summary.records;
20626
+ count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, currentLength), "\u00A0", texts.table3.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
20509
20627
  } else {
20510
20628
  label = texts.table3.footer.summary.records;
20511
20629
  count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
20512
20630
  }
20513
20631
  return /*#__PURE__*/React__default.createElement("div", {
20514
- className: "sticky bottom-0 left-0 z-40 -mt-10 flex h-10 w-fit items-center whitespace-nowrap bg-white px-4 !pr-3 shadow-[6px_0px_6px_theme(colors.white)]"
20632
+ className: "sticky bottom-0 left-0 z-40 -mt-10 flex h-10 w-fit items-center whitespace-nowrap bg-white px-4 !pr-3 shadow-[6px_0px_6px_theme(colors.white)]",
20633
+ "data-taco": "table2-footer-summary"
20515
20634
  }, label, "\u00A0", count);
20516
20635
  }
20517
20636
 
@@ -20731,6 +20850,11 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
20731
20850
  const bodyRef = React__default.useRef(null);
20732
20851
  React__default.useEffect(() => {
20733
20852
  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))) {
20856
+ return;
20857
+ }
20734
20858
  tableMeta.hoverState.handleKeyDown(event);
20735
20859
  tableMeta.currentRow.handleKeyDown(event, table.getRowModel().rows.length, scrollToIndex);
20736
20860
  tableMeta.rowClick.handleKeyDown(event, table);
@@ -20745,7 +20869,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
20745
20869
  // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143
20746
20870
  // scrollToIndex function changes when row count changes, so it is important to update handlers with new
20747
20871
  // scrollToIndex function.
20748
- [scrollToIndex]);
20872
+ [scrollToIndex, internalRef.current]);
20749
20873
  const handleBlur = event => {
20750
20874
  tableMeta.editing.handleBlur(event);
20751
20875
  };
@@ -20819,7 +20943,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
20819
20943
  role: "rowgroup",
20820
20944
  ref: bodyRef
20821
20945
  }, renderBody())), /*#__PURE__*/React__default.createElement("div", {
20822
- className: "border-grey-300 col-span-full -mt-px border-t"
20946
+ className: "border-grey-300 col-span-full translate-y-px border-t"
20823
20947
  }), tableMeta.enableFooter ? /*#__PURE__*/React__default.createElement("div", {
20824
20948
  className: "group/footer contents",
20825
20949
  "data-taco": "table2-footer",
@@ -20831,6 +20955,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
20831
20955
  }, footerGroup.headers.map(footer => /*#__PURE__*/React__default.createElement(React__default.Fragment, {
20832
20956
  key: footer.id
20833
20957
  }, reactTable$1.flexRender(footer.column.columnDef.footer, footer.getContext()))))), length ? /*#__PURE__*/React__default.createElement(Summary$1, {
20958
+ currentLength: table.getRowModel().rows.length,
20834
20959
  length: length,
20835
20960
  table: table
20836
20961
  }) : null) : null) : /*#__PURE__*/React__default.createElement("div", {
@@ -21888,6 +22013,7 @@ exports.parseFromCustomString = parseFromCustomString;
21888
22013
  exports.parseFromISOString = parseFromISOString;
21889
22014
  exports.removeChildTableRow = removeChildTableRow;
21890
22015
  exports.setByRowIndexPath = setByRowIndexPath;
22016
+ exports.shouldTriggerShortcut = shouldTriggerShortcut;
21891
22017
  exports.useBoundaryOverflowDetection = useBoundaryOverflowDetection;
21892
22018
  exports.useBoundingClientRectListener = useBoundingClientRectListener;
21893
22019
  exports.useDropTarget = useDropTarget;