@economic/taco 2.35.1 → 2.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. package/dist/components/Dialog/components/Content.d.ts +5 -0
  2. package/dist/components/Icon/components/index.d.ts +1 -1
  3. package/dist/components/Input/Input.d.ts +1 -1
  4. package/dist/components/Menu/Menu.d.ts +2 -1
  5. package/dist/components/Menu/components/Item.d.ts +1 -1
  6. package/dist/components/Menu/components/Link.d.ts +1 -1
  7. package/dist/components/Menu/components/Separator.d.ts +3 -2
  8. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  9. package/dist/components/Provider/Localization.d.ts +6 -0
  10. package/dist/components/Report/Report.d.ts +1 -1
  11. package/dist/components/Select2/components/Option.d.ts +2 -2
  12. package/dist/components/Select2/components/Search.d.ts +1 -7
  13. package/dist/components/Table3/Table3.d.ts +29 -1
  14. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +11 -0
  15. package/dist/components/Table3/features/useTableEditing.d.ts +1 -0
  16. package/dist/components/Table3/types.d.ts +16 -1
  17. package/dist/components/Table3/util/editing.d.ts +1 -0
  18. package/dist/components/Tag/Tag.d.ts +1 -1
  19. package/dist/esm/index.css +41 -21
  20. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +161 -1
  21. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
  23. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Icon/components/{ESignature.js → DocumentSignedSolid.js} +4 -4
  26. package/dist/esm/packages/taco/src/components/Icon/components/DocumentSignedSolid.js.map +1 -0
  27. package/dist/esm/packages/taco/src/components/Icon/components/{Home2.js → House.js} +4 -4
  28. package/dist/esm/packages/taco/src/components/Icon/components/{Home2.js.map → House.js.map} +1 -1
  29. package/dist/esm/packages/taco/src/components/Icon/components/{Home.js → HouseSolid.js} +4 -4
  30. package/dist/esm/packages/taco/src/components/Icon/components/HouseSolid.js.map +1 -0
  31. package/dist/esm/packages/taco/src/components/Icon/components/index.js +6 -6
  32. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +7 -5
  35. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Provider/Localization.js +7 -1
  37. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -16
  39. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +2 -12
  41. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Table3/Table3.js +8 -1
  43. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +3 -2
  45. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +24 -3
  47. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +90 -0
  49. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -0
  50. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +53 -15
  51. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +2 -1
  53. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +20 -1
  55. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  56. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +5 -2
  57. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  58. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +2 -1
  59. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  60. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +2 -4
  61. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  62. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +2 -3
  63. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  64. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +5 -4
  65. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  66. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +3 -2
  67. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  68. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +1 -1
  69. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  70. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  71. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +6 -1
  72. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  73. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js +11 -8
  74. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js.map +1 -1
  75. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +2 -1
  76. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  77. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +3 -1
  78. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  79. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +9 -0
  80. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  81. package/dist/esm/packages/taco/src/utils/dom.js +2 -2
  82. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  83. package/dist/index.css +41 -21
  84. package/dist/primitives/Table/Core/components/Header/components/Menu.d.ts +1 -0
  85. package/dist/primitives/Table/types.d.ts +8 -6
  86. package/dist/primitives/Table/useTableManager/features/useTableRowClick.d.ts +4 -4
  87. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
  88. package/dist/primitives/Table/useTableManager/util/presets.d.ts +1 -1
  89. package/dist/primitives/Table/useTableManager/util/setup.d.ts +2 -2
  90. package/dist/taco.cjs.development.js +454 -113
  91. package/dist/taco.cjs.development.js.map +1 -1
  92. package/dist/taco.cjs.production.min.js +1 -1
  93. package/dist/taco.cjs.production.min.js.map +1 -1
  94. package/dist/utils/dom.d.ts +1 -1
  95. package/package.json +2 -2
  96. package/dist/components/Table/Table.storyexample.d.ts +0 -9
  97. package/dist/esm/packages/taco/src/components/Icon/components/ESignature.js.map +0 -1
  98. package/dist/esm/packages/taco/src/components/Icon/components/Home.js.map +0 -1
  99. /package/dist/components/Icon/components/{ESignature.d.ts → DocumentSignedSolid.d.ts} +0 -0
  100. /package/dist/components/Icon/components/{Home.d.ts → House.d.ts} +0 -0
  101. /package/dist/components/Icon/components/{Home2.d.ts → HouseSolid.d.ts} +0 -0
@@ -1239,6 +1239,19 @@ function IconDocumentRejectedRequest(props, svgRef) {
1239
1239
  }
1240
1240
  var DocumentRejectedRequest = /*#__PURE__*/React.forwardRef(IconDocumentRejectedRequest);
1241
1241
 
1242
+ function IconDocumentSignedSolid(props, svgRef) {
1243
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
1244
+ xmlns: "http://www.w3.org/2000/svg",
1245
+ viewBox: "0 0 24 24",
1246
+ ref: svgRef
1247
+ }, props), /*#__PURE__*/React.createElement("path", {
1248
+ d: "M13 2v5.25l.006.144a1.75 1.75 0 001.593 1.6L14.75 9H20v11.25A1.75 1.75 0 0118.25 22H5.75A1.75 1.75 0 014 20.25V3.75C4 2.784 4.784 2 5.75 2H13zm-3 7.75c-1.572 0-2.858 1.745-3.337 3.877l-.048.23-.039.217c-.138.832-.124 1.608.046 2.26l.07.238.055.148-.191.101c-.33.166-.672.305-1.025.413a.75.75 0 00.339 1.457l.1-.023.281-.092c.35-.122.691-.268 1.02-.435l.325-.174.098-.059.02.014c.302.18.66.293 1.074.32L9 18.25l.255-.004c1.076-.038 1.983-.315 2.706-.82l.193-.145.124-.104.014.052c.044.14.098.262.164.369l.069.102.086.107c.579.665 1.275.432 2.018-.32l.117-.122.102-.115.021.104c.043.2.09.356.163.512.209.456.598.755 1.132.708.582-.052 1.196-.55 2.042-1.612l.162-.206.32-.425.17-.23a.75.75 0 00-1.144-.965l-.071.085-.293.396-.28.362-.251.308-.22.256-.187.205-.11.112-.082-.493-.042-.199-.024-.09c-.083-.294-.201-.52-.436-.692-.598-.437-1.122-.163-1.695.514l-.258.312-.107.118-.007-.214a12.73 12.73 0 01.094-1.533c.1-.89-1.135-1.152-1.438-.372l-.033.103-.057.203c-.397 1.321-1.216 2.03-2.562 2.195l-.217.022-.176.009.199-.19a8.876 8.876 0 001.813-2.556c1.013-2.18.695-4.247-1.274-4.247zm0 1.5c.406 0 .531.695-.005 1.934l-.081.181-.116.237a7.434 7.434 0 01-1.401 1.893l-.25.236-.105.089-.032-.177c-.06-.406-.037-.911.077-1.5C8.402 12.53 9.306 11.25 10 11.25zm4.5-4V2L20 7.5h-5.25l-.057-.007a.25.25 0 01-.184-.175L14.5 7.25z",
1249
+ fill: "currentColor",
1250
+ fillRule: "evenodd"
1251
+ }));
1252
+ }
1253
+ var DocumentSignedSolid = /*#__PURE__*/React.forwardRef(IconDocumentSignedSolid);
1254
+
1242
1255
  function IconDocumentSigned(props, svgRef) {
1243
1256
  return /*#__PURE__*/React.createElement("svg", Object.assign({
1244
1257
  fill: "none",
@@ -1331,19 +1344,6 @@ function IconECopedia(props, svgRef) {
1331
1344
  }
1332
1345
  var ECopedia = /*#__PURE__*/React.forwardRef(IconECopedia);
1333
1346
 
1334
- function IconESignature(props, svgRef) {
1335
- return /*#__PURE__*/React.createElement("svg", Object.assign({
1336
- xmlns: "http://www.w3.org/2000/svg",
1337
- viewBox: "0 0 24 24",
1338
- ref: svgRef
1339
- }, props), /*#__PURE__*/React.createElement("path", {
1340
- d: "M13 2v5.25l.006.144a1.75 1.75 0 001.593 1.6L14.75 9H20v11.25A1.75 1.75 0 0118.25 22H5.75A1.75 1.75 0 014 20.25V3.75C4 2.784 4.784 2 5.75 2H13zm-3 7.75c-1.572 0-2.858 1.745-3.337 3.877l-.048.23-.039.217c-.138.832-.124 1.608.046 2.26l.07.238.055.148-.191.101c-.33.166-.672.305-1.025.413a.75.75 0 00.339 1.457l.1-.023.281-.092c.35-.122.691-.268 1.02-.435l.325-.174.098-.059.02.014c.302.18.66.293 1.074.32L9 18.25l.255-.004c1.076-.038 1.983-.315 2.706-.82l.193-.145.124-.104.014.052c.044.14.098.262.164.369l.069.102.086.107c.579.665 1.275.432 2.018-.32l.117-.122.102-.115.021.104c.043.2.09.356.163.512.209.456.598.755 1.132.708.582-.052 1.196-.55 2.042-1.612l.162-.206.32-.425.17-.23a.75.75 0 00-1.144-.965l-.071.085-.293.396-.28.362-.251.308-.22.256-.187.205-.11.112-.082-.493-.042-.199-.024-.09c-.083-.294-.201-.52-.436-.692-.598-.437-1.122-.163-1.695.514l-.258.312-.107.118-.007-.214a12.73 12.73 0 01.094-1.533c.1-.89-1.135-1.152-1.438-.372l-.033.103-.057.203c-.397 1.321-1.216 2.03-2.562 2.195l-.217.022-.176.009.199-.19a8.876 8.876 0 001.813-2.556c1.013-2.18.695-4.247-1.274-4.247zm0 1.5c.406 0 .531.695-.005 1.934l-.081.181-.116.237a7.434 7.434 0 01-1.401 1.893l-.25.236-.105.089-.032-.177c-.06-.406-.037-.911.077-1.5C8.402 12.53 9.306 11.25 10 11.25zm4.5-4V2L20 7.5h-5.25l-.057-.007a.25.25 0 01-.184-.175L14.5 7.25z",
1341
- fill: "currentColor",
1342
- fillRule: "evenodd"
1343
- }));
1344
- }
1345
- var ESignature = /*#__PURE__*/React.forwardRef(IconESignature);
1346
-
1347
1347
  function IconEditSimple(props, svgRef) {
1348
1348
  return /*#__PURE__*/React.createElement("svg", Object.assign({
1349
1349
  fill: "none",
@@ -1778,33 +1778,33 @@ function IconHeightTall(props, svgRef) {
1778
1778
  }
1779
1779
  var HeightTall = /*#__PURE__*/React.forwardRef(IconHeightTall);
1780
1780
 
1781
- function IconHome2(props, svgRef) {
1781
+ function IconHouseSolid(props, svgRef) {
1782
1782
  return /*#__PURE__*/React.createElement("svg", Object.assign({
1783
- fill: "none",
1784
1783
  xmlns: "http://www.w3.org/2000/svg",
1785
1784
  viewBox: "0 0 24 24",
1786
1785
  ref: svgRef
1787
1786
  }, props), /*#__PURE__*/React.createElement("path", {
1788
- fillRule: "evenodd",
1789
- clipRule: "evenodd",
1790
- d: "M11.116 2.823a1.25 1.25 0 011.768 0L17.25 7.19V6a.75.75 0 011.5 0v2.69l2.78 2.78a.75.75 0 01-1.06 1.06l-2.994-2.993-.013-.013L12 4.061l-8.47 8.47a.75.75 0 01-1.06-1.061l8.646-8.647zm1.768 3.25l7 7c.234.235.366.553.366.884v6.293c0 .69-.56 1.25-1.25 1.25h-4c-.69 0-1.25-.56-1.25-1.25V16.5h-3.5v3.75c0 .69-.56 1.25-1.25 1.25H5c-.69 0-1.25-.56-1.25-1.25v-6.293c0-.332.132-.65.366-.884l7-7a1.25 1.25 0 011.768 0zM12 7.311l-6.75 6.75V20h3.5v-3.75c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25V20h3.5v-5.94L12 7.31z",
1791
- fill: "currentColor"
1787
+ d: "M12 6l8 8v7a1 1 0 01-1 1h-5v-5a1 1 0 00-.883-.993L13 16h-2a1 1 0 00-.993.883L10 17v5H5a1 1 0 01-1-1v-7l8-8zm.613-3.79l.094.083L17 6.585V4.75a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.835l2.707 2.708a1 1 0 01-1.32 1.497l-.094-.083L12 4.415l-8.293 8.292a1 1 0 01-1.32.083l-.094-.083a1 1 0 01-.083-1.32l.083-.094 9-9a1 1 0 011.32-.083z",
1788
+ fill: "currentColor",
1789
+ fillRule: "evenodd"
1792
1790
  }));
1793
1791
  }
1794
- var Home2 = /*#__PURE__*/React.forwardRef(IconHome2);
1792
+ var HouseSolid = /*#__PURE__*/React.forwardRef(IconHouseSolid);
1795
1793
 
1796
- function IconHome(props, svgRef) {
1794
+ function IconHouse(props, svgRef) {
1797
1795
  return /*#__PURE__*/React.createElement("svg", Object.assign({
1796
+ fill: "none",
1798
1797
  xmlns: "http://www.w3.org/2000/svg",
1799
1798
  viewBox: "0 0 24 24",
1800
1799
  ref: svgRef
1801
1800
  }, props), /*#__PURE__*/React.createElement("path", {
1802
- d: "M12 6l8 8v7a1 1 0 01-1 1h-5v-5a1 1 0 00-.883-.993L13 16h-2a1 1 0 00-.993.883L10 17v5H5a1 1 0 01-1-1v-7l8-8zm.613-3.79l.094.083L17 6.585V4.75a.5.5 0 01.5-.5h1a.5.5 0 01.5.5v3.835l2.707 2.708a1 1 0 01-1.32 1.497l-.094-.083L12 4.415l-8.293 8.292a1 1 0 01-1.32.083l-.094-.083a1 1 0 01-.083-1.32l.083-.094 9-9a1 1 0 011.32-.083z",
1803
- fill: "currentColor",
1804
- fillRule: "evenodd"
1801
+ fillRule: "evenodd",
1802
+ clipRule: "evenodd",
1803
+ d: "M11.116 2.823a1.25 1.25 0 011.768 0L17.25 7.19V6a.75.75 0 011.5 0v2.69l2.78 2.78a.75.75 0 01-1.06 1.06l-2.994-2.993-.013-.013L12 4.061l-8.47 8.47a.75.75 0 01-1.06-1.061l8.646-8.647zm1.768 3.25l7 7c.234.235.366.553.366.884v6.293c0 .69-.56 1.25-1.25 1.25h-4c-.69 0-1.25-.56-1.25-1.25V16.5h-3.5v3.75c0 .69-.56 1.25-1.25 1.25H5c-.69 0-1.25-.56-1.25-1.25v-6.293c0-.332.132-.65.366-.884l7-7a1.25 1.25 0 011.768 0zM12 7.311l-6.75 6.75V20h3.5v-3.75c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25V20h3.5v-5.94L12 7.31z",
1804
+ fill: "currentColor"
1805
1805
  }));
1806
1806
  }
1807
- var Home = /*#__PURE__*/React.forwardRef(IconHome);
1807
+ var House = /*#__PURE__*/React.forwardRef(IconHouse);
1808
1808
 
1809
1809
  function IconId(props, svgRef) {
1810
1810
  return /*#__PURE__*/React.createElement("svg", Object.assign({
@@ -3566,6 +3566,7 @@ const icons = {
3566
3566
  'document-preview': DocumentPreview,
3567
3567
  'document-received': DocumentReceived,
3568
3568
  'document-rejected-request': DocumentRejectedRequest,
3569
+ 'document-signed-solid': DocumentSignedSolid,
3569
3570
  'document-signed': DocumentSigned,
3570
3571
  'document-split': DocumentSplit,
3571
3572
  'document-time': DocumentTime,
@@ -3573,7 +3574,6 @@ const icons = {
3573
3574
  download: Download,
3574
3575
  drag: Drag,
3575
3576
  'e-copedia': ECopedia,
3576
- 'e-signature': ESignature,
3577
3577
  'edit-simple': EditSimple,
3578
3578
  edit: Edit,
3579
3579
  'ellipsis-horizontal': EllipsisHorizontal,
@@ -3606,8 +3606,8 @@ const icons = {
3606
3606
  'height-medium': HeightMedium,
3607
3607
  'height-short': HeightShort,
3608
3608
  'height-tall': HeightTall,
3609
- home2: Home2,
3610
- home: Home,
3609
+ 'house-solid': HouseSolid,
3610
+ house: House,
3611
3611
  id: Id,
3612
3612
  images: Images,
3613
3613
  import: Import,
@@ -4156,7 +4156,7 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
4156
4156
  }
4157
4157
  return boundaryChildIndex;
4158
4158
  };
4159
- const getNextFocussableElement = currentElement => {
4159
+ const getNextFocussableElement = (currentElement, direction = 1) => {
4160
4160
  if (!currentElement) {
4161
4161
  return null;
4162
4162
  }
@@ -4166,7 +4166,7 @@ const getNextFocussableElement = currentElement => {
4166
4166
  if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {
4167
4167
  return null;
4168
4168
  }
4169
- return focussableElements[currentElementIndex + 1];
4169
+ return focussableElements[currentElementIndex + direction];
4170
4170
  };
4171
4171
  const getOverlaySelector = element => {
4172
4172
  switch (element === null || element === void 0 ? void 0 : element.getAttribute('role')) {
@@ -4563,7 +4563,10 @@ const defaultLocalisationTexts = {
4563
4563
  button: 'Filters',
4564
4564
  buttons: {
4565
4565
  addFilter: 'Add new filter',
4566
- clearFilters: 'Clear all filters'
4566
+ clearFilters: 'Clear all filters',
4567
+ cancel: 'Cancel',
4568
+ clear: 'Clear',
4569
+ apply: 'Apply'
4567
4570
  },
4568
4571
  comparators: {
4569
4572
  contains: 'Contains',
@@ -4673,6 +4676,9 @@ const defaultLocalisationTexts = {
4673
4676
  buttons: {
4674
4677
  edit: {
4675
4678
  tooltip: 'Edit table'
4679
+ },
4680
+ create: {
4681
+ label: 'New'
4676
4682
  }
4677
4683
  },
4678
4684
  clearChangesConfirmationDialog: {
@@ -5939,8 +5945,8 @@ const useCombobox = ({
5939
5945
  }
5940
5946
  case 'Enter':
5941
5947
  {
5948
+ event.preventDefault();
5942
5949
  if (isElementInsideTable3OrReport(event.currentTarget)) {
5943
- event.preventDefault();
5944
5950
  if (inline && !open) {
5945
5951
  setOpen(true);
5946
5952
  } else if (buttonRef.current && !open) {
@@ -8536,11 +8542,13 @@ const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props,
8536
8542
  });
8537
8543
  RadioGroup$1.Item = RadioItem;
8538
8544
 
8539
- const Separator = () => {
8540
- return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
8545
+ const Separator = /*#__PURE__*/React.forwardRef(function Separator(props, ref) {
8546
+ return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, Object.assign({
8541
8547
  className: "bg-grey-300 my-1 h-px"
8542
- });
8543
- };
8548
+ }, props, {
8549
+ ref: ref
8550
+ }));
8551
+ });
8544
8552
 
8545
8553
  const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
8546
8554
  const menu = useCurrentMenu();
@@ -10210,6 +10218,13 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
10210
10218
  function configureReactTableOptions(options, props) {
10211
10219
  var _options$enableFilter, _options$enableColumn, _options$enableRowExp, _options$enableColumn2, _options$enableColumn3, _options$enableSortin;
10212
10220
  const enableRowSelection = options.enableRowSelection || options.enableRowSelectionSingle;
10221
+ const getRowIdentityColumnAccessor = () => {
10222
+ if (!props.rowIdentityColumnAccessor) {
10223
+ return undefined;
10224
+ }
10225
+ const rowIdentityColumnAccessors = [props.rowIdentityColumnAccessor].flat();
10226
+ return originalRow => rowIdentityColumnAccessors.map(identityColumnAccessor => String(originalRow[identityColumnAccessor])).join('_');
10227
+ };
10213
10228
  const tableOptions = {
10214
10229
  defaultColumn: {
10215
10230
  enableColumnFilter: options.enableFiltering || true,
@@ -10234,6 +10249,8 @@ function configureReactTableOptions(options, props) {
10234
10249
  // models for default features
10235
10250
  getExpandedRowModel: reactTable.getExpandedRowModel(),
10236
10251
  getGroupedRowModel: reactTable.getGroupedRowModel(),
10252
+ // Use row indentity column values as id for each row
10253
+ getRowId: getRowIdentityColumnAccessor(),
10237
10254
  groupedColumnMode: false
10238
10255
  };
10239
10256
  if (tableOptions.enableColumnResizing) {
@@ -10438,7 +10455,9 @@ function getTableFeaturePreset(props) {
10438
10455
  enablePrinting: (_props$enablePrinting = props.enablePrinting) !== null && _props$enablePrinting !== void 0 ? _props$enablePrinting : presetOptions.enablePrinting,
10439
10456
  enableRowActive: (_props$enableRowActiv = props.enableRowActive) !== null && _props$enableRowActiv !== void 0 ? _props$enableRowActiv : presetOptions.enableRowActive,
10440
10457
  enableRowActions: enableRowActions && !!((_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length),
10441
- enableRowClick: enableRowClick && !!props.onRowClick,
10458
+ // enableRowClick can be either function or boolean, that is why we need to pass exactly enableRowClick,
10459
+ // and not just result of the condition
10460
+ enableRowClick: enableRowClick && !!props.onRowClick ? enableRowClick : false,
10442
10461
  enableRowDrag: enableRowDrag && !!props.onRowDrag,
10443
10462
  enableRowDrop: enableRowDrop && !!props.onRowDrop,
10444
10463
  enableRowGoto: enableRowGoto && !!props.onRowGoto,
@@ -10658,26 +10677,29 @@ function getNextIndex(direction, currentIndex, length) {
10658
10677
  }
10659
10678
 
10660
10679
  function useTableRowClick(isEnabled = false, onRowClick) {
10661
- const handleKeyDown = React__default.useCallback(function (event, data) {
10662
- if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {
10680
+ const isRowClickEnabled = React__default.useCallback(row => {
10681
+ return typeof isEnabled === 'boolean' ? isEnabled : isEnabled(row);
10682
+ }, [isEnabled]);
10683
+ const handleKeyDown = React__default.useCallback(function (event, rowData) {
10684
+ if (!isRowClickEnabled(rowData) || typeof onRowClick !== 'function' || event.defaultPrevented) {
10663
10685
  return;
10664
10686
  }
10665
- if (data && event.key === 'Enter') {
10687
+ if (rowData && event.key === 'Enter') {
10666
10688
  event.preventDefault();
10667
- onRowClick(data);
10689
+ onRowClick(rowData);
10668
10690
  return;
10669
10691
  }
10670
10692
  }, [isEnabled, onRowClick]);
10671
- const handleClick = React__default.useCallback(function (event, data) {
10672
- if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {
10693
+ const handleClick = React__default.useCallback(function (event, rowData) {
10694
+ if (!isRowClickEnabled(rowData) || typeof onRowClick !== 'function' || event.defaultPrevented) {
10673
10695
  return;
10674
10696
  }
10675
10697
  event.preventDefault();
10676
- onRowClick(data);
10698
+ onRowClick(rowData);
10677
10699
  return;
10678
10700
  }, [isEnabled, onRowClick]);
10679
10701
  return {
10680
- isEnabled,
10702
+ isEnabled: isRowClickEnabled,
10681
10703
  handleClick,
10682
10704
  handleKeyDown
10683
10705
  };
@@ -10777,7 +10799,167 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
10777
10799
  }
10778
10800
 
10779
10801
  // A type of promise-like that resolves synchronously and supports only one observer
10802
+ const _Pact = /*#__PURE__*/function () {
10803
+ function _Pact() {}
10804
+ _Pact.prototype.then = function (onFulfilled, onRejected) {
10805
+ const result = new _Pact();
10806
+ const state = this.s;
10807
+ if (state) {
10808
+ const callback = state & 1 ? onFulfilled : onRejected;
10809
+ if (callback) {
10810
+ try {
10811
+ _settle(result, 1, callback(this.v));
10812
+ } catch (e) {
10813
+ _settle(result, 2, e);
10814
+ }
10815
+ return result;
10816
+ } else {
10817
+ return this;
10818
+ }
10819
+ }
10820
+ this.o = function (_this) {
10821
+ try {
10822
+ const value = _this.v;
10823
+ if (_this.s & 1) {
10824
+ _settle(result, 1, onFulfilled ? onFulfilled(value) : value);
10825
+ } else if (onRejected) {
10826
+ _settle(result, 1, onRejected(value));
10827
+ } else {
10828
+ _settle(result, 2, value);
10829
+ }
10830
+ } catch (e) {
10831
+ _settle(result, 2, e);
10832
+ }
10833
+ };
10834
+ return result;
10835
+ };
10836
+ return _Pact;
10837
+ }();
10838
+
10839
+ // Settles a pact synchronously
10840
+ function _settle(pact, state, value) {
10841
+ if (!pact.s) {
10842
+ if (value instanceof _Pact) {
10843
+ if (value.s) {
10844
+ if (state & 1) {
10845
+ state = value.s;
10846
+ }
10847
+ value = value.v;
10848
+ } else {
10849
+ value.o = _settle.bind(null, pact, state);
10850
+ return;
10851
+ }
10852
+ }
10853
+ if (value && value.then) {
10854
+ value.then(_settle.bind(null, pact, state), _settle.bind(null, pact, 2));
10855
+ return;
10856
+ }
10857
+ pact.s = state;
10858
+ pact.v = value;
10859
+ const observer = pact.o;
10860
+ if (observer) {
10861
+ observer(pact);
10862
+ }
10863
+ }
10864
+ }
10865
+ function _isSettledPact(thenable) {
10866
+ return thenable instanceof _Pact && thenable.s & 1;
10867
+ }
10868
+
10869
+ // Asynchronously iterate through an object that has a length property, passing the index as the first argument to the callback (even as the length property changes)
10870
+ function _forTo(array, body, check) {
10871
+ var i = -1,
10872
+ pact,
10873
+ reject;
10874
+ function _cycle(result) {
10875
+ try {
10876
+ while (++i < array.length && (!check || !check())) {
10877
+ result = body(i);
10878
+ if (result && result.then) {
10879
+ if (_isSettledPact(result)) {
10880
+ result = result.v;
10881
+ } else {
10882
+ result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
10883
+ return;
10884
+ }
10885
+ }
10886
+ }
10887
+ if (pact) {
10888
+ _settle(pact, 1, result);
10889
+ } else {
10890
+ pact = result;
10891
+ }
10892
+ } catch (e) {
10893
+ _settle(pact || (pact = new _Pact()), 2, e);
10894
+ }
10895
+ }
10896
+ _cycle();
10897
+ return pact;
10898
+ }
10780
10899
  const _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /*#__PURE__*/Symbol("Symbol.iterator")) : "@@iterator";
10900
+
10901
+ // Asynchronously iterate through an object's values
10902
+ // Uses for...of if the runtime supports it, otherwise iterates until length on a copy
10903
+ function _forOf(target, body, check) {
10904
+ if (typeof target[_iteratorSymbol] === "function") {
10905
+ var iterator = target[_iteratorSymbol](),
10906
+ step,
10907
+ pact,
10908
+ reject;
10909
+ function _cycle(result) {
10910
+ try {
10911
+ while (!(step = iterator.next()).done && (!check || !check())) {
10912
+ result = body(step.value);
10913
+ if (result && result.then) {
10914
+ if (_isSettledPact(result)) {
10915
+ result = result.v;
10916
+ } else {
10917
+ result.then(_cycle, reject || (reject = _settle.bind(null, pact = new _Pact(), 2)));
10918
+ return;
10919
+ }
10920
+ }
10921
+ }
10922
+ if (pact) {
10923
+ _settle(pact, 1, result);
10924
+ } else {
10925
+ pact = result;
10926
+ }
10927
+ } catch (e) {
10928
+ _settle(pact || (pact = new _Pact()), 2, e);
10929
+ }
10930
+ }
10931
+ _cycle();
10932
+ if (iterator.return) {
10933
+ var _fixup = function (value) {
10934
+ try {
10935
+ if (!step.done) {
10936
+ iterator.return();
10937
+ }
10938
+ } catch (e) {}
10939
+ return value;
10940
+ };
10941
+ if (pact && pact.then) {
10942
+ return pact.then(_fixup, function (e) {
10943
+ throw _fixup(e);
10944
+ });
10945
+ }
10946
+ _fixup();
10947
+ }
10948
+ return pact;
10949
+ }
10950
+ // No support for Symbol.iterator
10951
+ if (!("length" in target)) {
10952
+ throw new TypeError("Object is not iterable");
10953
+ }
10954
+ // Handle live collections properly
10955
+ var values = [];
10956
+ for (var i = 0; i < target.length; i++) {
10957
+ values.push(target[i]);
10958
+ }
10959
+ return _forTo(values, function (i) {
10960
+ return body(values[i]);
10961
+ }, check);
10962
+ }
10781
10963
  const _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /*#__PURE__*/Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
10782
10964
 
10783
10965
  // Asynchronously call a function and send errors to recovery continuation
@@ -10903,7 +11085,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
10903
11085
  const invalidate = function () {
10904
11086
  try {
10905
11087
  _forceReset.current = true;
10906
- return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
11088
+ if (_lastUsedSearch.current) {
11089
+ // we're searching, which means we need to refetch all with the correct sorting applied
11090
+ return loadAll(_lastUsedSorting.current, _lastUsedFilters.current);
11091
+ } else {
11092
+ return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
11093
+ }
10907
11094
  } catch (e) {
10908
11095
  return Promise.reject(e);
10909
11096
  }
@@ -11405,6 +11592,7 @@ function useTableManager(props, meta, internalColumns) {
11405
11592
  // ensure data is always valid
11406
11593
  const data = (_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : [];
11407
11594
  const length = (_props$length = props.length) !== null && _props$length !== void 0 ? _props$length : data.length;
11595
+ const rowIdentityColumnAccessor = props.rowIdentityColumnAccessor !== undefined ? [props.rowIdentityColumnAccessor].flat() : [];
11408
11596
  // create a react-table instance
11409
11597
  const instance = reactTable.useReactTable({
11410
11598
  data,
@@ -11432,7 +11620,7 @@ function useTableManager(props, meta, internalColumns) {
11432
11620
  rowDrag,
11433
11621
  rowDrop: rowDrop,
11434
11622
  rowExpansion: rowExpansion,
11435
- rowIdentityColumnId: props.rowIdentityColumnId,
11623
+ rowIdentityColumnAccessor,
11436
11624
  rowGoto,
11437
11625
  rowGroups: rowGroups,
11438
11626
  rowHeight,
@@ -11865,7 +12053,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11865
12053
  let content = null;
11866
12054
  if (rows.length) {
11867
12055
  style = {
11868
- height: `${totalSize}px`,
12056
+ height: totalSize,
11869
12057
  paddingBottom,
11870
12058
  paddingTop
11871
12059
  };
@@ -12565,8 +12753,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12565
12753
  tableMeta.rowClick.handleClick(event, row.original);
12566
12754
  }, [row.original]);
12567
12755
  const handleClickCapture = React__default.useCallback(() => {
12568
- // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable
12569
- requestAnimationFrame(() => tableMeta.rowActive.setRowActiveIndex(index));
12756
+ tableMeta.rowActive.setRowActiveIndex(index);
12570
12757
  }, [index]);
12571
12758
  // row active
12572
12759
  if (tableMeta.rowActive.isEnabled) {
@@ -12575,7 +12762,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12575
12762
  attributes.onClickCapture = handleClickCapture;
12576
12763
  }
12577
12764
  // row click
12578
- if (tableMeta.rowClick.isEnabled) {
12765
+ if (tableMeta.rowClick.isEnabled(row.original)) {
12579
12766
  attributes.onClick = handleClick;
12580
12767
  }
12581
12768
  // row drag
@@ -12872,6 +13059,7 @@ function HeaderMenu(props) {
12872
13059
  canHide,
12873
13060
  canPin,
12874
13061
  canSort,
13062
+ columnId,
12875
13063
  customMenu,
12876
13064
  index,
12877
13065
  isFiltered,
@@ -12975,10 +13163,7 @@ function HeaderMenu(props) {
12975
13163
  }, isFiltered ? texts.table.columns.menu.editFilter : texts.table.columns.menu.filter));
12976
13164
  }
12977
13165
  if (customMenu) {
12978
- const menu = customMenu({
12979
- trigger: undefined
12980
- });
12981
- const customItems = React__default.Children.toArray(menu.props.children.props.children);
13166
+ const customItems = customMenu.map(menuItem => menuItem(columnId)).filter(action => !!action);
12982
13167
  if (customItems.length) {
12983
13168
  if (menuItems.length) {
12984
13169
  menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Separator, null));
@@ -13240,7 +13425,8 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
13240
13425
  onSortToggle: handleSortToggle,
13241
13426
  scrollToIndex: scrollToIndex,
13242
13427
  setRowActiveIndex: setRowActiveIndex,
13243
- sortDirection: sortDirection
13428
+ sortDirection: sortDirection,
13429
+ columnId: id
13244
13430
  })) : null, canResize ? ( /*#__PURE__*/React__default.createElement(Resizer, {
13245
13431
  headerRef: ref,
13246
13432
  id: id,
@@ -15093,17 +15279,12 @@ const BubbleSelect = props => {
15093
15279
  };
15094
15280
 
15095
15281
  const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(props, ref) {
15096
- const {
15097
- onTabKeyPress,
15098
- ...otherProps
15099
- } = props;
15100
15282
  const {
15101
15283
  listboxRef,
15102
15284
  searchQuery,
15103
15285
  setSearchQuery,
15104
15286
  setValidationError,
15105
- validationError,
15106
- setOpen
15287
+ validationError
15107
15288
  } = useSelect2Context();
15108
15289
  const handleChange = event => {
15109
15290
  if (validationError) {
@@ -15116,11 +15297,6 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
15116
15297
  if (event.key === ' ') {
15117
15298
  return;
15118
15299
  }
15119
- // Select2 should close dropdown and receive focus, when user press Tab while searching (UX requirement to support better keyboard navigation)
15120
- if (event.key === 'Tab') {
15121
- setOpen(false);
15122
- onTabKeyPress();
15123
- }
15124
15300
  if (isAriaSelectionKey(event) || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
15125
15301
  var _listboxRef$current;
15126
15302
  event.preventDefault();
@@ -15135,7 +15311,7 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
15135
15311
  }),
15136
15312
  invalid: !!validationError,
15137
15313
  message: validationError === null || validationError === void 0 ? void 0 : validationError.message
15138
- }, /*#__PURE__*/React__default.createElement(Input, Object.assign({}, otherProps, {
15314
+ }, /*#__PURE__*/React__default.createElement(Input, Object.assign({}, props, {
15139
15315
  "aria-hidden": true,
15140
15316
  autoFocus: true,
15141
15317
  invalid: !!validationError,
@@ -15346,7 +15522,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15346
15522
  // align the listbox min width with the width of the input - it should never be smaller
15347
15523
  const dimensions = useBoundingClientRectListener(internalRef);
15348
15524
  // state
15349
- const [tabTriggeredClose, setTabTriggeredClose] = React__default.useState(false);
15350
15525
  const [open, setOpen] = React__default.useState(false);
15351
15526
  const [value, _setValue] = reactUseControllableState.useControllableState({
15352
15527
  // uncontrolled
@@ -15432,20 +15607,13 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15432
15607
  setShouldPauseHoverState(true);
15433
15608
  }
15434
15609
  };
15435
- const handleCloseAutoFocus = event => {
15436
- event.preventDefault();
15437
- event.stopPropagation();
15438
- if (tabTriggeredClose) {
15439
- const nextFocussableElement = getNextFocussableElement(internalRef.current);
15610
+ const handleTab = event => {
15611
+ if (event.key === 'Tab') {
15612
+ const nextFocussableElement = getNextFocussableElement(internalRef.current, event.shiftKey ? -1 : +1);
15440
15613
  if (nextFocussableElement) {
15441
15614
  // UX requirement: move focus to the next focussable element when tab key is pressed to select the value
15442
15615
  nextFocussableElement.focus();
15443
- // Reset the tabTriggeredClose state
15444
- setTabTriggeredClose(false);
15445
15616
  }
15446
- } else {
15447
- var _internalRef$current;
15448
- (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
15449
15617
  }
15450
15618
  };
15451
15619
  const selectOptions = searchQuery === '' ? flattenedChildren.map(child => child.props.value) : filteredChildren.map(child => isGroup(child) ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value) : child.props.value).flatMap(c => c) || [];
@@ -15500,10 +15668,10 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15500
15668
  asChild: true,
15501
15669
  align: "start",
15502
15670
  onOpenAutoFocus: () => {
15503
- var _internalRef$current2;
15504
- (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.focus();
15671
+ var _internalRef$current;
15672
+ (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
15505
15673
  },
15506
- onCloseAutoFocus: handleCloseAutoFocus,
15674
+ onKeyDown: handleTab,
15507
15675
  sideOffset: 4,
15508
15676
  tabIndex: -1
15509
15677
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -15513,8 +15681,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15513
15681
  }
15514
15682
  }, flattenedChildren.length > 0 || onCreate ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Search$2, {
15515
15683
  placeholder: onCreate ? texts.select2.searchOrCreate : texts.select2.search,
15516
- ref: searchRef,
15517
- onTabKeyPress: () => setTabTriggeredClose(true)
15684
+ ref: searchRef
15518
15685
  }), multiple && selectOptions.length > 1 && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button$1, {
15519
15686
  className: "!justify-start",
15520
15687
  appearance: "discrete",
@@ -16037,10 +16204,11 @@ function Control(props) {
16037
16204
  const controlRenderer = column === null || column === void 0 ? void 0 : (_column$columnDef$met2 = column.columnDef.meta) === null || _column$columnDef$met2 === void 0 ? void 0 : _column$columnDef$met2.control;
16038
16205
  const dataType = column === null || column === void 0 ? void 0 : (_column$columnDef$met3 = column.columnDef.meta) === null || _column$columnDef$met3 === void 0 ? void 0 : _column$columnDef$met3.dataType;
16039
16206
  React.useEffect(() => {
16040
- if (controlRenderer === 'switch') {
16207
+ // Set value to false only after first render of the control (when it's undefined) after setting the FilterColumn value, because we don't want to change then the value every time filter is opened
16208
+ if (controlRenderer === 'switch' && value === undefined) {
16041
16209
  onChange(false);
16042
16210
  }
16043
- }, []);
16211
+ }, [controlRenderer]);
16044
16212
  if (typeof controlRenderer === 'function') {
16045
16213
  return /*#__PURE__*/React__default.cloneElement(controlRenderer({
16046
16214
  ...attributes,
@@ -16242,7 +16410,8 @@ function ManageFiltersPopover(props) {
16242
16410
  if (f.value.comparator === exports.TableFilterComparator.IsEmpty || f.value.comparator === exports.TableFilterComparator.IsNotEmpty || controlRenderer === 'switch') {
16243
16411
  return true;
16244
16412
  }
16245
- return !!f.value.value;
16413
+ const value = f.value.value;
16414
+ return value !== undefined && value !== null && value !== '';
16246
16415
  });
16247
16416
  return newFilters;
16248
16417
  });
@@ -16287,12 +16456,12 @@ function ManageFiltersPopover(props) {
16287
16456
  onClick: handleCreate
16288
16457
  }, "+ ", texts.table.filters.buttons.addFilter))), /*#__PURE__*/React__default.createElement(Group, {
16289
16458
  className: "ml-auto"
16290
- }, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button$1, null, "Cancel")), /*#__PURE__*/React__default.createElement(Button$1, {
16459
+ }, /*#__PURE__*/React__default.createElement(Popover.Close, null, /*#__PURE__*/React__default.createElement(Button$1, null, texts.table.filters.buttons.cancel)), /*#__PURE__*/React__default.createElement(Button$1, {
16291
16460
  onClick: handleClear
16292
- }, "Clear"), /*#__PURE__*/React__default.createElement(Button$1, {
16461
+ }, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
16293
16462
  appearance: "primary",
16294
16463
  onClick: handleApply
16295
- }, "Apply")))));
16464
+ }, texts.table.filters.buttons.apply)))));
16296
16465
  }
16297
16466
 
16298
16467
  function Filters(props) {
@@ -16430,8 +16599,11 @@ function TableGrid(props) {
16430
16599
  table: table.instance,
16431
16600
  tableElement: table.ref.current,
16432
16601
  scrollToIndex: table.renderer.scrollToIndex,
16433
- style: table.renderer.style
16434
- }, table.renderer.rows), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
16602
+ style: props.children ? {
16603
+ ...table.renderer.style,
16604
+ height: table.renderer.style.height + 41
16605
+ } : table.renderer.style
16606
+ }, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
16435
16607
  table: table.instance
16436
16608
  }) : null)) : ( /*#__PURE__*/React__default.createElement(EmptyStateBody, {
16437
16609
  emptyState: table.props.emptyState
@@ -18058,6 +18230,25 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
18058
18230
  }
18059
18231
  return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
18060
18232
  }
18233
+ function animateCreateRow(id) {
18234
+ const templateRow = document.querySelector(`[data-row-id="${id}"]`);
18235
+ if (templateRow) {
18236
+ var _templateRow$querySel;
18237
+ (_templateRow$querySel = templateRow.querySelector(':first-child')) === null || _templateRow$querySel === void 0 ? void 0 : _templateRow$querySel.focus();
18238
+ templateRow.scrollIntoView();
18239
+ const keyframes = [{
18240
+ background: '#b2c7ef'
18241
+ }, {
18242
+ background: '#ebebeb'
18243
+ }];
18244
+ for (const child of templateRow.children) {
18245
+ child.animate(keyframes, {
18246
+ duration: 1000,
18247
+ easing: 'ease-out'
18248
+ });
18249
+ }
18250
+ }
18251
+ }
18061
18252
 
18062
18253
  function useTableEditing(isEnabled = false, handleSave, validator) {
18063
18254
  // used to switch the table into editing mode
@@ -18092,6 +18283,7 @@ function useTableEditing(isEnabled = false, handleSave, validator) {
18092
18283
  function usePendingChanges(isEnabled, handleSave, validator) {
18093
18284
  const saveChanges = function (rowId = undefined) {
18094
18285
  try {
18286
+ let _exit = false;
18095
18287
  if (!handleSave) {
18096
18288
  console.warn('Tried to save, but Table has no onSave handler');
18097
18289
  return Promise.resolve();
@@ -18103,13 +18295,12 @@ function usePendingChanges(isEnabled, handleSave, validator) {
18103
18295
  ...pendingChanges
18104
18296
  };
18105
18297
  const changes = Object.keys(changesToSave);
18106
- if (changes.length) {
18107
- changes.map(function (rowId) {
18108
- try {
18109
- let _exit = false;
18298
+ return Promise.resolve(function () {
18299
+ if (changes.length) {
18300
+ return _forOf(changes, function (rowId) {
18110
18301
  const pendingChange = changesToSave[rowId];
18111
18302
  const changeSet = getChangesetFromChanges(pendingChange);
18112
- return Promise.resolve(_catch(function () {
18303
+ return _catch(function () {
18113
18304
  function _temp3(_result) {
18114
18305
  return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
18115
18306
  // cleanup changes, we don't need them after saving
@@ -18117,6 +18308,10 @@ function usePendingChanges(isEnabled, handleSave, validator) {
18117
18308
  setRowSaveStatus(rowId, 'complete');
18118
18309
  });
18119
18310
  }
18311
+ if (getRowSaveStatus(rowId) === 'pending') {
18312
+ _exit = true;
18313
+ return;
18314
+ }
18120
18315
  // set saving = true
18121
18316
  setRowSaveStatus(rowId, 'pending');
18122
18317
  // re-run validation, maybe a cell is already invalid but has never been blurred
@@ -18163,13 +18358,12 @@ function usePendingChanges(isEnabled, handleSave, validator) {
18163
18358
  });
18164
18359
  }
18165
18360
  setRowSaveStatus(rowId, undefined);
18166
- }));
18167
- } catch (e) {
18168
- return Promise.reject(e);
18169
- }
18170
- });
18171
- }
18172
- return Promise.resolve();
18361
+ });
18362
+ }, function () {
18363
+ return _exit;
18364
+ });
18365
+ }
18366
+ }());
18173
18367
  } catch (e) {
18174
18368
  return Promise.reject(e);
18175
18369
  }
@@ -18206,6 +18400,40 @@ function usePendingChanges(isEnabled, handleSave, validator) {
18206
18400
  return Promise.reject(e);
18207
18401
  }
18208
18402
  };
18403
+ const addCreatedRowChangeset = function (row) {
18404
+ try {
18405
+ const cells = row.getAllCells();
18406
+ setPendingChanges(currentChanges => {
18407
+ return cells.reduce((changes, cell) => {
18408
+ if (cell.getValue()) {
18409
+ var _currentChanges$cell$4, _currentChanges$cell$5, _currentChanges$cell$6;
18410
+ return {
18411
+ ...changes,
18412
+ [cell.row.id]: {
18413
+ ...changes[cell.row.id],
18414
+ [cell.column.id]: cell.getValue(),
18415
+ _meta: {
18416
+ ...((_currentChanges$cell$4 = currentChanges[cell.row.id]) === null || _currentChanges$cell$4 === void 0 ? void 0 : _currentChanges$cell$4._meta),
18417
+ original: cell.row.original,
18418
+ moveReason: {
18419
+ ...((_currentChanges$cell$5 = currentChanges[cell.row.id]) === null || _currentChanges$cell$5 === void 0 ? void 0 : _currentChanges$cell$5._meta.moveReason)
18420
+ },
18421
+ errors: {
18422
+ ...((_currentChanges$cell$6 = currentChanges[cell.row.id]) === null || _currentChanges$cell$6 === void 0 ? void 0 : _currentChanges$cell$6._meta.errors)
18423
+ }
18424
+ }
18425
+ }
18426
+ };
18427
+ } else {
18428
+ return changes;
18429
+ }
18430
+ }, currentChanges);
18431
+ });
18432
+ return Promise.resolve();
18433
+ } catch (e) {
18434
+ return Promise.reject(e);
18435
+ }
18436
+ };
18209
18437
  const [pendingChanges, setPendingChanges] = React__default.useState({});
18210
18438
  // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted
18211
18439
  const [saveStates, setSaveState] = React__default.useState({});
@@ -18332,8 +18560,8 @@ function usePendingChanges(isEnabled, handleSave, validator) {
18332
18560
  return Object.keys(getErrors().filter(error => {
18333
18561
  var _activeRow;
18334
18562
  if ((_activeRow = activeRow) !== null && _activeRow !== void 0 && _activeRow.id && focusIsInsideTable) {
18335
- var _activeRow2;
18336
- return error.rowId === ((_activeRow2 = activeRow) === null || _activeRow2 === void 0 ? void 0 : _activeRow2.id) ? error.pendingChange._meta.errors.hasShownErrorAlert : true;
18563
+ var _activeRow2, _error$pendingChange$;
18564
+ return error.rowId === ((_activeRow2 = activeRow) === null || _activeRow2 === void 0 ? void 0 : _activeRow2.id) ? (_error$pendingChange$ = error.pendingChange._meta.errors) === null || _error$pendingChange$ === void 0 ? void 0 : _error$pendingChange$.hasShownErrorAlert : true;
18337
18565
  }
18338
18566
  return true;
18339
18567
  })).length;
@@ -18358,6 +18586,7 @@ function usePendingChanges(isEnabled, handleSave, validator) {
18358
18586
  getCellError,
18359
18587
  setCellValue,
18360
18588
  validateCell,
18589
+ addCreatedRowChangeset,
18361
18590
  hasChanges,
18362
18591
  hasErrors,
18363
18592
  getErrors,
@@ -18583,10 +18812,11 @@ function useEditingCellAutofocus(props) {
18583
18812
  // focus the cell so that we trigger it's handle focus
18584
18813
  React__default.useEffect(() => {
18585
18814
  if (props.cellRef.current) {
18586
- var _props$cellRef$curren, _document$activeEleme;
18815
+ var _props$cellRef$curren, _document$activeEleme, _document$activeEleme2;
18587
18816
  const isFocusedElementInCurrentRow = (_props$cellRef$curren = props.cellRef.current.closest('tr')) === null || _props$cellRef$curren === void 0 ? void 0 : _props$cellRef$curren.contains(document.activeElement);
18588
18817
  const isFocusedElementSearch = ((_document$activeEleme = document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.getAttribute('name')) === 'table-search';
18589
- if (autoFocus && !isFocusedElementInCurrentRow && !isFocusedElementSearch) {
18818
+ const isFocusedElementMenu = ((_document$activeEleme2 = document.activeElement) === null || _document$activeEleme2 === void 0 ? void 0 : _document$activeEleme2.getAttribute('role')) === 'menu';
18819
+ if (autoFocus && !isFocusedElementInCurrentRow && !isFocusedElementSearch && !isFocusedElementMenu) {
18590
18820
  var _props$cellRef$curren2;
18591
18821
  (_props$cellRef$curren2 = props.cellRef.current) === null || _props$cellRef$curren2 === void 0 ? void 0 : _props$cellRef$curren2.focus();
18592
18822
  }
@@ -19002,6 +19232,7 @@ const RENDERERS$1 = {
19002
19232
  };
19003
19233
  function useTable3(props, ref) {
19004
19234
  const editing = useTableEditing(props.enableEditing, props.onSave, props.validator);
19235
+ const creationEnabled = editing.isEnabled && !!props.enableCreation;
19005
19236
  const extendedProps = {
19006
19237
  ...props,
19007
19238
  enableRowActions: editing.isEditing ? true : props.enableRowActions,
@@ -19011,7 +19242,7 @@ function useTable3(props, ref) {
19011
19242
  onClear: () => editing.resetChanges(rowId),
19012
19243
  onSave: () => editing.saveChanges(rowId),
19013
19244
  onExit: () => editing.toggleEditing(false),
19014
- isLastRow: table.meta.rowActive.rowActiveIndex === table.meta.length - 1
19245
+ isLastRow: !creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1
19015
19246
  }))] : props.rowActions
19016
19247
  };
19017
19248
  const meta = {
@@ -19042,6 +19273,22 @@ function Alert$1(props) {
19042
19273
  const tableMeta = table.options.meta;
19043
19274
  const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
19044
19275
  const pendingChangesWithErrors = tableMeta.editing.getErrors();
19276
+ const resetPendingChanges = tableMeta.editing.resetChanges;
19277
+ const allRows = table.getPreFilteredRowModel().rows;
19278
+ // This effect deletes error in the alert if the row that has the error is deleted.
19279
+ React__default.useEffect(() => {
19280
+ pendingChangesWithErrors.forEach(errorRow => {
19281
+ const errorRowId = errorRow.rowId;
19282
+ try {
19283
+ // getRow throws error if it fails to find the row
19284
+ if (!table.getRow(errorRowId)) {
19285
+ resetPendingChanges(errorRowId);
19286
+ }
19287
+ } catch {
19288
+ resetPendingChanges(errorRowId);
19289
+ }
19290
+ });
19291
+ }, [allRows.length]);
19045
19292
  const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
19046
19293
  // mark errors being rendered as seen
19047
19294
  React__default.useEffect(() => {
@@ -19070,18 +19317,23 @@ function Alert$1(props) {
19070
19317
  const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
19071
19318
  // generate links to each invalid row, to go into the error message
19072
19319
  const links = [];
19073
- const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;
19320
+ const rowIdentityColumn = tableMeta.rowIdentityColumnAccessor ?
19321
+ // Since rowIdentityColumnAccessor can have multiple ids, we use the first id to refer to the row in Alert
19322
+ table.getColumn(String(tableMeta.rowIdentityColumnAccessor[0])) : undefined;
19074
19323
  pendingChangesWithErrors.forEach((error, index) => {
19075
19324
  // if appropriate, concatenate the item with the text "and"
19076
19325
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
19077
19326
  // Add space before and after `messageAnd` text
19078
19327
  links.push(` ${validationTexts.alert.messageAnd} `);
19079
19328
  }
19080
- const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
19329
+ const rowIndex = table.getFilteredRowModel().rows.findIndex(row => row.id === error.rowId);
19081
19330
  const handleClick = () => {
19331
+ // if row is visible
19082
19332
  if (rowIndex > -1) {
19083
19333
  scrollToRow(rowIndex);
19084
- } else {
19334
+ }
19335
+ // if row is filtered out
19336
+ else {
19085
19337
  setShowFilterResetDialog(error.rowId);
19086
19338
  }
19087
19339
  };
@@ -19157,6 +19409,89 @@ function FilterResetDialog(props) {
19157
19409
  }, texts.table3.editing.validation.resetFiltersDialog.confirm)))));
19158
19410
  }
19159
19411
 
19412
+ function CreateNewRowButton(props) {
19413
+ const {
19414
+ onCreate,
19415
+ scrollToIndex,
19416
+ table,
19417
+ tableMeta
19418
+ } = props;
19419
+ const {
19420
+ texts
19421
+ } = useLocalization();
19422
+ const rows = table.getCoreRowModel().rows;
19423
+ const [rowCreated, setRowCreated] = React__default.useState({
19424
+ rowFinder: undefined
19425
+ });
19426
+ const handleKeyDown = event => {
19427
+ if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
19428
+ !tableMeta.editing.saveChanges();
19429
+ }
19430
+ };
19431
+ const handleCreate = function () {
19432
+ try {
19433
+ if (!onCreate) {
19434
+ return Promise.resolve();
19435
+ }
19436
+ const createdRow = rows.find(row => {
19437
+ var _rowCreated$rowFinder;
19438
+ return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder = rowCreated.rowFinder) === null || _rowCreated$rowFinder === void 0 ? void 0 : _rowCreated$rowFinder.call(rowCreated, row.original);
19439
+ });
19440
+ const _temp = function () {
19441
+ if (createdRow) {
19442
+ return Promise.resolve(tableMeta.editing.saveChanges()).then(function () {
19443
+ if (!tableMeta.editing.hasRowErrors(createdRow.id)) {
19444
+ const rowFinder = onCreate();
19445
+ setRowCreated({
19446
+ rowFinder
19447
+ });
19448
+ }
19449
+ });
19450
+ } else {
19451
+ const rowFinder = onCreate();
19452
+ setRowCreated({
19453
+ rowFinder
19454
+ });
19455
+ }
19456
+ }();
19457
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
19458
+ } catch (e) {
19459
+ return Promise.reject(e);
19460
+ }
19461
+ };
19462
+ React__default.useEffect(() => {
19463
+ if (typeof (rowCreated === null || rowCreated === void 0 ? void 0 : rowCreated.rowFinder) === 'function') {
19464
+ const createdRow = rows.find(row => {
19465
+ var _rowCreated$rowFinder2;
19466
+ return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder2 = rowCreated.rowFinder) === null || _rowCreated$rowFinder2 === void 0 ? void 0 : _rowCreated$rowFinder2.call(rowCreated, row.original);
19467
+ });
19468
+ if (createdRow) {
19469
+ const rowInTable = table.getRowModel().rows.find(row => {
19470
+ var _rowCreated$rowFinder3;
19471
+ return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder3 = rowCreated.rowFinder) === null || _rowCreated$rowFinder3 === void 0 ? void 0 : _rowCreated$rowFinder3.call(rowCreated, row.original);
19472
+ });
19473
+ if (rowInTable) {
19474
+ tableMeta.editing.toggleEditing(true);
19475
+ tableMeta.rowActive.setRowActiveIndex(createdRow.index);
19476
+ scrollToIndex(createdRow.index);
19477
+ requestAnimationFrame(() => animateCreateRow(createdRow.id));
19478
+ }
19479
+ requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow));
19480
+ }
19481
+ }
19482
+ }, [rowCreated]);
19483
+ return /*#__PURE__*/React__default.createElement("tr", {
19484
+ onClick: handleCreate,
19485
+ className: "border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t"
19486
+ }, /*#__PURE__*/React__default.createElement("td", {
19487
+ className: "!border-t-0 !bg-transparent"
19488
+ }, /*#__PURE__*/React__default.createElement(Button$1, {
19489
+ onKeyDown: handleKeyDown,
19490
+ className: "group-hover:bg-grey-200 sticky left-0",
19491
+ appearance: "transparent"
19492
+ }, "+ ", texts.table3.editing.buttons.create.label)));
19493
+ }
19494
+
19160
19495
  function Editing(props) {
19161
19496
  const {
19162
19497
  scrollToIndex,
@@ -19213,6 +19548,7 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
19213
19548
  enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
19214
19549
  };
19215
19550
  const hasValidationErrors = table3.meta.editing.hasErrors(table3.instance, table3.ref);
19551
+ const showCreateRowButton = table3.meta.editing.isEnabled && props.enableCreation && props.onCreate;
19216
19552
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
19217
19553
  table: table3
19218
19554
  }, table3.meta.editing.isEnabled ? ( /*#__PURE__*/React__default.createElement(Editing, {
@@ -19226,7 +19562,12 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
19226
19562
  })) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
19227
19563
  "data-taco": "table3",
19228
19564
  table: table3
19229
- })));
19565
+ }), showCreateRowButton && ( /*#__PURE__*/React__default.createElement(CreateNewRowButton, {
19566
+ table: table3.instance,
19567
+ tableMeta: table3.meta,
19568
+ onCreate: props.onCreate,
19569
+ scrollToIndex: table3.renderer.scrollToIndex
19570
+ }))));
19230
19571
  });
19231
19572
  const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
19232
19573
  const stringifiedChildren = String(props.children);