@economic/taco 2.45.0-alpha.2 → 2.45.0-alpha.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. package/dist/charts/components/Area/AreaChart.d.ts +19 -0
  2. package/dist/charts/components/Bar/BarChart.d.ts +20 -0
  3. package/dist/charts/components/Donut/ActiveShape.d.ts +8 -0
  4. package/dist/charts/components/Donut/CenteredLabel.d.ts +11 -0
  5. package/dist/charts/components/Donut/DonutChart.d.ts +21 -0
  6. package/dist/charts/components/Donut/Legend.d.ts +13 -0
  7. package/dist/charts/components/Donut/util.d.ts +2 -0
  8. package/dist/charts/components/Legend.d.ts +16 -0
  9. package/dist/charts/components/Line/LineChart.d.ts +18 -0
  10. package/dist/charts/components/ResponsiveContainer.d.ts +5 -0
  11. package/dist/charts/components/Tooltip.d.ts +10 -0
  12. package/dist/charts/components/types.d.ts +5 -0
  13. package/dist/charts/utils/color.d.ts +3 -0
  14. package/dist/charts/utils/common.d.ts +37 -0
  15. package/dist/components/Alert/Alert.d.ts +1 -1
  16. package/dist/components/Banner/util.d.ts +0 -1
  17. package/dist/components/Combobox/Combobox.d.ts +1 -1
  18. package/dist/components/Hanger/Hanger.d.ts +1 -0
  19. package/dist/components/Icon/components/Autopay.d.ts +3 -0
  20. package/dist/components/Icon/components/AutopayPaused.d.ts +3 -0
  21. package/dist/components/Icon/components/Experiment.d.ts +3 -0
  22. package/dist/components/Icon/components/Person.d.ts +3 -0
  23. package/dist/components/Icon/components/PersonSolid.d.ts +3 -0
  24. package/dist/components/Icon/components/Wallet.d.ts +3 -0
  25. package/dist/components/Icon/components/index.d.ts +1 -1
  26. package/dist/components/Input/Input.d.ts +1 -1
  27. package/dist/components/Listbox/util.d.ts +1 -1
  28. package/dist/components/Menu/components/Item.d.ts +1 -1
  29. package/dist/components/Menu/components/Link.d.ts +1 -1
  30. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  31. package/dist/components/Pagination/PageNumbers.d.ts +0 -1
  32. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
  33. package/dist/components/Report/Report.d.ts +4 -2
  34. package/dist/components/SearchInput2/SearchInput2.d.ts +2 -0
  35. package/dist/components/Select/Select.d.ts +5 -19
  36. package/dist/components/Select2/components/Option.d.ts +4 -4
  37. package/dist/components/Select2/components/Search.d.ts +1 -1
  38. package/dist/components/Table3/Table3.d.ts +4 -5
  39. package/dist/components/Table3/components/Columns/Cell/EditingDisplayCell.d.ts +0 -1
  40. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +2 -2
  41. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +1 -3
  42. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +1 -0
  43. package/dist/components/Table3/features/useEditingState.d.ts +23 -18
  44. package/dist/components/Table3/features/useTableEditing.d.ts +24 -19
  45. package/dist/components/Table3/types.d.ts +2 -0
  46. package/dist/components/Table3/util/editing.d.ts +3 -0
  47. package/dist/components/Tag/Tag.d.ts +1 -1
  48. package/dist/esm/index.css +74 -12
  49. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js +67 -0
  50. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js.map +1 -0
  51. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js +120 -0
  52. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js.map +1 -0
  53. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js +47 -0
  54. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js.map +1 -0
  55. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js +27 -0
  56. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js.map +1 -0
  57. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js +170 -0
  58. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js.map +1 -0
  59. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +165 -0
  60. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -0
  61. package/dist/esm/packages/taco/src/charts/components/Donut/util.js +5 -0
  62. package/dist/esm/packages/taco/src/charts/components/Donut/util.js.map +1 -0
  63. package/dist/esm/packages/taco/src/charts/components/Legend.js +146 -0
  64. package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -0
  65. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js +65 -0
  66. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js.map +1 -0
  67. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js +10 -0
  68. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js.map +1 -0
  69. package/dist/esm/packages/taco/src/charts/components/Tooltip.js +44 -0
  70. package/dist/esm/packages/taco/src/charts/components/Tooltip.js.map +1 -0
  71. package/dist/esm/packages/taco/src/charts/utils/color.js +24 -0
  72. package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -0
  73. package/dist/esm/packages/taco/src/charts/utils/common.js +34 -0
  74. package/dist/esm/packages/taco/src/charts/utils/common.js.map +1 -0
  75. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +6 -14
  76. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Alert/Alert.js +2 -0
  78. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  79. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +1 -1
  80. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
  81. package/dist/esm/packages/taco/src/components/Badge/Badge.js +9 -6
  82. package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
  83. package/dist/esm/packages/taco/src/components/Banner/util.js +5 -0
  84. package/dist/esm/packages/taco/src/components/Banner/util.js.map +1 -1
  85. package/dist/esm/packages/taco/src/components/Button/Button.js +2 -1
  86. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  87. package/dist/esm/packages/taco/src/components/Button/util.js +1 -1
  88. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  89. package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
  90. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  91. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +3 -2
  92. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  93. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +18 -17
  95. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +13 -0
  97. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +10 -1
  99. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  101. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +4 -2
  102. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  103. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +2 -2
  104. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  105. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +4 -2
  106. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  107. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +2 -4
  108. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  109. package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js +19 -0
  110. package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js.map +1 -0
  111. package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js +19 -0
  112. package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js.map +1 -0
  113. package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js +20 -0
  114. package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js.map +1 -0
  115. package/dist/esm/packages/taco/src/components/Icon/components/Person.js +19 -0
  116. package/dist/esm/packages/taco/src/components/Icon/components/Person.js.map +1 -0
  117. package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js +19 -0
  118. package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js.map +1 -0
  119. package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js +19 -0
  120. package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js.map +1 -0
  121. package/dist/esm/packages/taco/src/components/Icon/components/index.js +12 -0
  122. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  123. package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
  124. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  125. package/dist/esm/packages/taco/src/components/Listbox/util.js +1 -7
  126. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  127. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +5 -0
  128. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  129. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Report/Report.js +2 -3
  131. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +6 -3
  133. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Select/Select.js +0 -9
  135. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  137. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +10 -11
  138. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  139. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +7 -5
  140. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  141. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +56 -19
  142. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  143. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
  144. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  145. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
  146. package/dist/esm/packages/taco/src/components/Table3/Table3.js +15 -11
  147. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  148. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +25 -9
  149. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  150. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +4 -3
  151. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  152. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +18 -10
  153. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  154. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +0 -1
  155. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -1
  156. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +6 -37
  157. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  158. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +7 -6
  159. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
  160. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +81 -81
  161. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
  162. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +70 -14
  163. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +24 -22
  165. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +15 -4
  167. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  168. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +9 -1
  169. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  170. package/dist/esm/packages/taco/src/components/Tag/Tag.js +6 -4
  171. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  172. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +2 -2
  173. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  174. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js +1 -1
  175. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js.map +1 -1
  176. package/dist/esm/packages/taco/src/index.js +6 -1
  177. package/dist/esm/packages/taco/src/index.js.map +1 -1
  178. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js +1 -1
  179. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
  180. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +5 -3
  181. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  182. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  183. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +7 -5
  184. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  185. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js +15 -2
  186. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js.map +1 -1
  187. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +23 -16
  188. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  189. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +4 -3
  190. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  191. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js +7 -0
  192. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map +1 -1
  193. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +11 -0
  194. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  195. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +10 -7
  196. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  197. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +7 -2
  198. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  199. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +7 -6
  200. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
  201. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +3 -1
  202. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  203. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +5 -2
  204. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  205. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +24 -22
  206. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  207. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +44 -5
  208. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
  209. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js +3 -2
  210. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js.map +1 -1
  211. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js +6 -0
  212. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js.map +1 -0
  213. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +5 -3
  214. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  215. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js +0 -2
  216. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  217. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +2 -1
  218. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  219. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +3 -1
  220. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  221. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +3 -1
  222. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  223. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +26 -4
  224. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  225. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +2 -2
  226. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
  227. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +43 -12
  228. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  229. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +1 -1
  230. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
  231. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +1 -1
  232. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  233. package/dist/esm/packages/taco/src/primitives/Table/types.js +1 -7
  234. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  235. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +13 -12
  236. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  237. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +224 -0
  238. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -0
  239. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +1 -1
  240. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  241. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
  242. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
  243. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -2
  244. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  245. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +18 -8
  246. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
  247. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js +3 -4
  248. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js.map +1 -1
  249. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -1
  250. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
  251. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +2 -1
  252. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  253. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +4 -4
  254. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
  255. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +14 -13
  256. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  257. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +7 -3
  258. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  259. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +5 -5
  260. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  261. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +4 -1
  262. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  263. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +6 -2
  264. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -1
  265. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
  266. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  267. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +7 -1
  268. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  269. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +16 -4
  270. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  271. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  272. package/dist/esm/packages/taco/src/types.js.map +1 -1
  273. package/dist/esm/packages/taco/src/utils/dom.js +12 -1
  274. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  275. package/dist/esm/packages/taco/src/utils/tailwind.js +2 -0
  276. package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -1
  277. package/dist/esm/packages/taco/tailwind.colors.js +122 -0
  278. package/dist/esm/packages/taco/tailwind.colors.js.map +1 -0
  279. package/dist/hooks/useLazyDebouncedEffect.d.ts +2 -0
  280. package/dist/index.css +74 -12
  281. package/dist/index.d.ts +6 -0
  282. package/dist/primitives/Table/Core/Table.d.ts +1 -0
  283. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -0
  284. package/dist/primitives/Table/Core/components/Body/util.d.ts +4 -4
  285. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +2 -2
  286. package/dist/primitives/Table/Core/components/Row/Row.d.ts +2 -0
  287. package/dist/primitives/Table/Core/components/Row/RowContext.d.ts +2 -1
  288. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.d.ts +3 -0
  289. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +0 -1
  290. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +0 -3
  291. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +1 -1
  292. package/dist/primitives/Table/Core/types.d.ts +1 -0
  293. package/dist/primitives/Table/types.d.ts +12 -12
  294. package/dist/primitives/Table/useTableDataLoader.d.ts +2 -2
  295. package/dist/primitives/Table/useTableDataLoader2.d.ts +23 -0
  296. package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
  297. package/dist/primitives/Table/useTableManager/features/useTableSearch.d.ts +4 -2
  298. package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +6 -3
  299. package/dist/primitives/Table/useTableManager/listeners/useTableDataListener.d.ts +1 -1
  300. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +1 -2
  301. package/dist/primitives/Table/useTableManager/types.d.ts +0 -1
  302. package/dist/primitives/Table/useTableManager/util/columns.d.ts +2 -1
  303. package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +1 -1
  304. package/dist/taco.cjs.development.js +1963 -508
  305. package/dist/taco.cjs.development.js.map +1 -1
  306. package/dist/taco.cjs.production.min.js +1 -1
  307. package/dist/taco.cjs.production.min.js.map +1 -1
  308. package/dist/types.d.ts +1 -1
  309. package/dist/utils/dom.d.ts +2 -2
  310. package/package.json +9 -8
  311. package/tailwind.colors.js +121 -0
  312. package/tailwind.config.js +3 -2
  313. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +0 -11
@@ -31,12 +31,12 @@ var reactPortal = require('@radix-ui/react-portal');
31
31
  var reactTable = require('@tanstack/react-table');
32
32
  var get = _interopDefault(require('lodash/get'));
33
33
  var reactVirtual = require('@tanstack/react-virtual');
34
- var reactIntersectionObserver = require('react-intersection-observer');
35
34
  var core = require('@dnd-kit/core');
36
35
  var modifiers = require('@dnd-kit/modifiers');
37
36
  var SortablePrimitive = require('@dnd-kit/sortable');
38
37
  var utilities = require('@dnd-kit/utilities');
39
38
  var reactTable$1 = require('react-table');
39
+ var reactIntersectionObserver = require('react-intersection-observer');
40
40
  var reactWindow = require('react-window');
41
41
  var InfiniteLoader = _interopDefault(require('react-window-infinite-loader'));
42
42
  var set = _interopDefault(require('lodash/set'));
@@ -48,6 +48,7 @@ var setWith = _interopDefault(require('lodash/setWith'));
48
48
  var TabsPrimitive = require('@radix-ui/react-tabs');
49
49
  var Joyride = require('react-joyride');
50
50
  var Joyride__default = _interopDefault(Joyride);
51
+ var Recharts = require('recharts');
51
52
 
52
53
  const AVAILABLE_COLORS = ['green', 'yellow', 'red', 'blue', 'purple', 'brown', 'pink', 'orange', 'grey', 'transparent'];
53
54
  const getColorByState = state => {
@@ -58,6 +59,8 @@ const getColorByState = state => {
58
59
  return 'yellow';
59
60
  case 'error':
60
61
  return 'red';
62
+ case 'experiment':
63
+ return 'purple';
61
64
  case 'success':
62
65
  return 'green';
63
66
  default:
@@ -390,6 +393,36 @@ function IconAttach(props, svgRef) {
390
393
  }
391
394
  var Attach = /*#__PURE__*/React.forwardRef(IconAttach);
392
395
 
396
+ function IconAutopayPaused(props, svgRef) {
397
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
398
+ fill: "none",
399
+ xmlns: "http://www.w3.org/2000/svg",
400
+ viewBox: "0 0 24 24",
401
+ ref: svgRef
402
+ }, props), /*#__PURE__*/React.createElement("path", {
403
+ fillRule: "evenodd",
404
+ clipRule: "evenodd",
405
+ d: "M9.356 2.503a.743.743 0 10.449 1.417 9.323 9.323 0 011.909-.391 8.998 8.998 0 011.883.013.743.743 0 10.168-1.476 10.484 10.484 0 00-2.195-.016 10.81 10.81 0 00-2.214.453zM7.46 5.037a.743.743 0 10-.817-1.241c-.628.413-1.215.893-1.747 1.433-.52.528-.978 1.103-1.366 1.712a.743.743 0 101.253.798 8.928 8.928 0 011.17-1.467A9.28 9.28 0 017.46 5.037zm9.14-2.22a.743.743 0 00-.59 1.363 7.904 7.904 0 011.611.935c.484.363.914.776 1.287 1.229a.743.743 0 001.147-.945 9.004 9.004 0 00-1.54-1.472 9.387 9.387 0 00-1.915-1.11zM3.767 10.008a.743.743 0 10-1.432-.396A9.316 9.316 0 002 11.795a.743.743 0 101.485.048 7.83 7.83 0 01.282-1.835zm17.716-2.152a.743.743 0 10-1.389.529c.21.549.353 1.126.425 1.723a.743.743 0 101.476-.18 8.81 8.81 0 00-.512-2.072zm-9.28-.732c-.26 0-.527.127-.527.505v.406c-1.567.145-2.577 1.085-2.577 2.426 0 1.125.639 1.862 1.907 2.182l1.296.285c.836.18 1.167.435 1.167.87 0 .558-.441.923-1.26.923-.586 0-1.154-.244-1.67-.714-.332-.278-.54-.36-.796-.36-.412 0-.743.256-.743.709 0 .348.186.684.51.98.482.447 1.26.72 2.143.796v.354c0 .371.272.505.533.505.262 0 .529-.134.529-.505v-.366c1.625-.191 2.64-1.143 2.64-2.519 0-1.133-.652-1.845-1.978-2.156l-1.3-.27c-.738-.145-1.075-.424-1.075-.859 0-.488.436-.876 1.12-.876.581 0 .999.185 1.492.655.29.25.528.36.842.36.366 0 .667-.267.667-.65 0-.325-.174-.667-.499-.975-.43-.418-1.12-.685-1.892-.783v-.418c0-.372-.267-.505-.528-.505zm8.802 8.025a.743.743 0 00-.946.457 7.718 7.718 0 01-2.763 3.704 8.23 8.23 0 01-4.48 1.548 8.628 8.628 0 01-4.69-1.152c-.906-.524-1.649-1.03-2.262-1.749l.79.276a.743.743 0 10.49-1.404l-2.732-.952a.743.743 0 00-.946.458l-.997 2.86a.743.743 0 101.403.49l.45-1.294c.84 1.193 1.88 1.918 3.06 2.601a10.114 10.114 0 005.5 1.35 9.715 9.715 0 005.287-1.83 9.204 9.204 0 003.293-4.417.743.743 0 00-.457-.946z",
406
+ fill: "currentColor"
407
+ }));
408
+ }
409
+ var AutopayPaused = /*#__PURE__*/React.forwardRef(IconAutopayPaused);
410
+
411
+ function IconAutopay(props, svgRef) {
412
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
413
+ fill: "none",
414
+ xmlns: "http://www.w3.org/2000/svg",
415
+ viewBox: "0 0 24 24",
416
+ ref: svgRef
417
+ }, props), /*#__PURE__*/React.createElement("path", {
418
+ fillRule: "evenodd",
419
+ clipRule: "evenodd",
420
+ d: "M1.367 6.142a.734.734 0 011.003.269l.83 1.438a9.885 9.885 0 017.774-5.769 9.993 9.993 0 015.73.975 10.135 10.135 0 014.249 4.002.734.734 0 01-1.272.734 8.667 8.667 0 00-3.633-3.422 8.525 8.525 0 00-4.888-.832 8.417 8.417 0 00-6.355 4.376l.749-.433a.734.734 0 01.734 1.271l-2.56 1.479a.734.734 0 01-1.004-.269L1.098 7.145a.734.734 0 01.27-1.003zm2.895 10.273a.734.734 0 011.003.269 7.627 7.627 0 003.384 3.09 8.195 8.195 0 004.668.668 8.64 8.64 0 004.376-2.005c.792-.684 1.427-1.318 1.895-2.138l-.731.422a.734.734 0 01-.734-1.27l2.495-1.442a.734.734 0 011.003.27l1.501 2.6a.734.734 0 01-1.271.734l-.683-1.183c-.6 1.326-1.485 2.229-2.516 3.118a10.107 10.107 0 01-5.122 2.346 9.664 9.664 0 01-5.504-.79 9.095 9.095 0 01-4.032-3.686.734.734 0 01.268-1.003zm7.382-8.75c0-.372.264-.498.522-.498s.521.132.521.499v.413c.763.097 1.446.361 1.87.774.321.304.493.642.493.963 0 .379-.298.643-.66.643-.309 0-.544-.11-.83-.356-.488-.464-.901-.648-1.475-.648-.676 0-1.107.384-1.107.866 0 .43.333.706 1.062.849l1.285.267c1.31.307 1.955 1.01 1.955 2.13 0 1.36-1.004 2.3-2.61 2.489v.361c0 .367-.264.5-.522.5s-.527-.133-.527-.5v-.35c-.872-.074-1.64-.344-2.116-.785-.322-.293-.505-.625-.505-.97 0-.447.327-.7.734-.7.252 0 .459.081.786.357.51.464 1.072.705 1.651.705.809 0 1.245-.361 1.245-.912 0-.43-.327-.682-1.153-.86l-1.281-.282c-1.253-.316-1.885-1.044-1.885-2.155 0-1.325.998-2.254 2.547-2.398v-.401z",
421
+ fill: "currentColor"
422
+ }));
423
+ }
424
+ var Autopay = /*#__PURE__*/React.forwardRef(IconAutopay);
425
+
393
426
  function IconAutotextInsert(props, svgRef) {
394
427
  return /*#__PURE__*/React.createElement("svg", Object.assign({
395
428
  xmlns: "http://www.w3.org/2000/svg",
@@ -1584,6 +1617,22 @@ function IconExpenses(props, svgRef) {
1584
1617
  }
1585
1618
  var Expenses = /*#__PURE__*/React.forwardRef(IconExpenses);
1586
1619
 
1620
+ function IconExperiment(props, svgRef) {
1621
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
1622
+ fill: "none",
1623
+ xmlns: "http://www.w3.org/2000/svg",
1624
+ viewBox: "0 0 20 20",
1625
+ ref: svgRef
1626
+ }, props), /*#__PURE__*/React.createElement("path", {
1627
+ fillRule: "evenodd",
1628
+ clipRule: "evenodd",
1629
+ d: "M8.962 9.26V5.313h2.843V9.28c0 .376.796 1.24 1.049 1.511L14.5 12.5c-.507.218-3.166-1.19-4.341-.211C7.159 14.789 6 13 6.5 12c.316-.632 2.462-1.803 2.462-2.74zm.24-4.469a.762.762 0 00-.752.772v3.696a.61.61 0 01-.177.43l-2.592 2.6c-.911.913-.281 2.502.992 2.502h7.154c1.25 0 1.89-1.538 1.027-2.466l-2.446-2.63a.61.61 0 01-.162-.415V5.563a.762.762 0 00-.752-.772H9.202z",
1630
+ fill: "currentColor",
1631
+ stroke: "currentColor"
1632
+ }));
1633
+ }
1634
+ var Experiment = /*#__PURE__*/React.forwardRef(IconExperiment);
1635
+
1587
1636
  function IconExportToExcel(props, svgRef) {
1588
1637
  return /*#__PURE__*/React.createElement("svg", Object.assign({
1589
1638
  xmlns: "http://www.w3.org/2000/svg",
@@ -2625,6 +2674,21 @@ function IconPersonPlus(props, svgRef) {
2625
2674
  }
2626
2675
  var PersonPlus = /*#__PURE__*/React.forwardRef(IconPersonPlus);
2627
2676
 
2677
+ function IconPersonSolid(props, svgRef) {
2678
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
2679
+ fill: "none",
2680
+ xmlns: "http://www.w3.org/2000/svg",
2681
+ viewBox: "0 0 24 24",
2682
+ ref: svgRef
2683
+ }, props), /*#__PURE__*/React.createElement("path", {
2684
+ fillRule: "evenodd",
2685
+ clipRule: "evenodd",
2686
+ d: "M12 11.5c4.553 0 7.21 2.43 7.969 7.29.24 1.537-.928 2.962-2.608 3.182-.144.018-.29.028-.435.028H7.074C5.376 22 4 20.74 4 19.187c0-.133.01-.266.03-.398C4.79 13.93 7.448 11.5 12 11.5zM12 2c2.112 0 3.825 1.903 3.825 4.25S14.112 10.5 12 10.5c-2.113 0-3.825-1.903-3.825-4.25S9.887 2 12 2z",
2687
+ fill: "currentColor"
2688
+ }));
2689
+ }
2690
+ var PersonSolid = /*#__PURE__*/React.forwardRef(IconPersonSolid);
2691
+
2628
2692
  function IconPersonTick(props, svgRef) {
2629
2693
  return /*#__PURE__*/React.createElement("svg", Object.assign({
2630
2694
  xmlns: "http://www.w3.org/2000/svg",
@@ -2638,6 +2702,21 @@ function IconPersonTick(props, svgRef) {
2638
2702
  }
2639
2703
  var PersonTick = /*#__PURE__*/React.forwardRef(IconPersonTick);
2640
2704
 
2705
+ function IconPerson(props, svgRef) {
2706
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
2707
+ fill: "none",
2708
+ xmlns: "http://www.w3.org/2000/svg",
2709
+ viewBox: "0 0 24 24",
2710
+ ref: svgRef
2711
+ }, props), /*#__PURE__*/React.createElement("path", {
2712
+ fillRule: "evenodd",
2713
+ clipRule: "evenodd",
2714
+ d: "M12 11.5c4.553 0 7.21 2.43 7.969 7.29.24 1.537-.928 2.962-2.608 3.182-.144.018-.29.028-.435.028H7.074C5.376 22 4 20.74 4 19.187c0-.133.01-.266.03-.398C4.79 13.93 7.448 11.5 12 11.5zm0 1.5c-3.684 0-5.696 1.84-6.346 6.002-.01.061-.015.123-.015.186 0 .68.565 1.238 1.288 1.305l.147.007h9.852c.068 0 .136-.004.203-.013.784-.103 1.329-.768 1.217-1.485C17.696 14.84 15.684 13 12 13zm0-11c2.112 0 3.825 1.903 3.825 4.25S14.112 10.5 12 10.5c-2.113 0-3.825-1.903-3.825-4.25S9.887 2 12 2zm0 1.5c-1.13 0-2.186 1.174-2.186 2.75S10.87 9 12 9s2.186-1.174 2.186-2.75S13.129 3.5 12 3.5z",
2715
+ fill: "currentColor"
2716
+ }));
2717
+ }
2718
+ var Person = /*#__PURE__*/React.forwardRef(IconPerson);
2719
+
2641
2720
  function IconPhoneSolid(props, svgRef) {
2642
2721
  return /*#__PURE__*/React.createElement("svg", Object.assign({
2643
2722
  fill: "none",
@@ -3407,6 +3486,21 @@ function IconUnreconciled(props, svgRef) {
3407
3486
  }
3408
3487
  var Unreconciled = /*#__PURE__*/React.forwardRef(IconUnreconciled);
3409
3488
 
3489
+ function IconWallet(props, svgRef) {
3490
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
3491
+ fill: "none",
3492
+ xmlns: "http://www.w3.org/2000/svg",
3493
+ viewBox: "0 0 24 24",
3494
+ ref: svgRef
3495
+ }, props), /*#__PURE__*/React.createElement("path", {
3496
+ fillRule: "evenodd",
3497
+ clipRule: "evenodd",
3498
+ d: "M4.75 4.5h14.5a.25.25 0 01.25.25V7H16a5 5 0 000 10h3.5v2.25a.25.25 0 01-.25.25H4.75a.25.25 0 01-.25-.25V4.75a.25.25 0 01.25-.25zM22 7h-1V4.75A1.75 1.75 0 0019.25 3H4.75A1.75 1.75 0 003 4.75v14.5c0 .966.784 1.75 1.75 1.75h14.5A1.75 1.75 0 0021 19.25V17h1a1 1 0 001-1V8a1 1 0 00-1-1zm-.5 1.5H16a3.5 3.5 0 100 7h5.5v-7zm-5.5 5a1.5 1.5 0 100-3 1.5 1.5 0 000 3z",
3499
+ fill: "currentColor"
3500
+ }));
3501
+ }
3502
+ var Wallet = /*#__PURE__*/React.forwardRef(IconWallet);
3503
+
3410
3504
  function IconWarning(props, svgRef) {
3411
3505
  return /*#__PURE__*/React.createElement("svg", Object.assign({
3412
3506
  fill: "none",
@@ -3504,6 +3598,8 @@ const icons = {
3504
3598
  'attach-cancel': AttachCancel,
3505
3599
  'attach-warning': AttachWarning,
3506
3600
  attach: Attach,
3601
+ 'autopay-paused': AutopayPaused,
3602
+ autopay: Autopay,
3507
3603
  'autotext-insert': AutotextInsert,
3508
3604
  autotext: Autotext,
3509
3605
  'basic-tabs': BasicTabs,
@@ -3594,6 +3690,7 @@ const icons = {
3594
3690
  envelope: Envelope,
3595
3691
  'expand-view': ExpandView,
3596
3692
  expenses: Expenses,
3693
+ experiment: Experiment,
3597
3694
  'export-to-excel': ExportToExcel,
3598
3695
  'export-to-pdf': ExportToPdf,
3599
3696
  export: Export,
@@ -3670,7 +3767,9 @@ const icons = {
3670
3767
  'person-change': PersonChange,
3671
3768
  'person-minus': PersonMinus,
3672
3769
  'person-plus': PersonPlus,
3770
+ 'person-solid': PersonSolid,
3673
3771
  'person-tick': PersonTick,
3772
+ person: Person,
3674
3773
  'phone-solid': PhoneSolid,
3675
3774
  phone: Phone,
3676
3775
  play: Play,
@@ -3729,6 +3828,7 @@ const icons = {
3729
3828
  undo: Undo,
3730
3829
  undock: Undock,
3731
3830
  unreconciled: Unreconciled,
3831
+ wallet: Wallet,
3732
3832
  warning: Warning,
3733
3833
  webshop: Webshop,
3734
3834
  website: Website,
@@ -3798,6 +3898,8 @@ const getIconName = state => {
3798
3898
  return 'warning';
3799
3899
  case 'error':
3800
3900
  return 'close';
3901
+ case 'experiment':
3902
+ return 'experiment';
3801
3903
  case 'success':
3802
3904
  return 'tick';
3803
3905
  default:
@@ -3887,7 +3989,7 @@ const Action = /*#__PURE__*/React.forwardRef(function AlertDialogAction(props, r
3887
3989
  });
3888
3990
 
3889
3991
  const Backdrop = /*#__PURE__*/React.forwardRef(function Backdrop(props, ref) {
3890
- const className = cn('fixed inset-0 cursor-default overflow-y-auto bg-blue-900/[0.3] aria-hidden:invisible print:overflow-visible print:absolute', props.className);
3992
+ const className = cn('fixed inset-0 cursor-default overflow-y-auto bg-blue-900/[0.3] aria-hidden:invisible print:overflow-visible print:absolute z-10', props.className);
3891
3993
  return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
3892
3994
  className: className,
3893
3995
  "data-taco": "backdrop",
@@ -4038,33 +4140,25 @@ const Accordion = props => {
4038
4140
  const context = React__default.useMemo(() => ({
4039
4141
  as
4040
4142
  }), [as]);
4041
- const type = typeof defaultId === 'string' || typeof id === 'string' ? 'single' : 'multiple';
4042
4143
  let valueProps;
4043
4144
  if (defaultId) {
4044
- valueProps = type === 'single' ? {
4045
- type: 'single',
4046
- defaultValue: defaultId
4047
- } : {
4048
- type: 'multiple',
4049
- defaultValue: defaultId
4145
+ valueProps = {
4146
+ defaultValue: defaultId || undefined
4050
4147
  };
4051
4148
  } else {
4052
- valueProps = type === 'single' ? {
4053
- type: 'single',
4054
- onValueChange: onChange,
4055
- value: id || undefined
4056
- } : {
4057
- type: 'multiple',
4149
+ valueProps = {
4058
4150
  onValueChange: onChange,
4059
4151
  value: id || undefined
4060
4152
  };
4061
4153
  }
4154
+ const type = typeof valueProps.defaultValue === 'string' || typeof valueProps.value === 'string' ? 'single' : 'multiple';
4062
4155
  const className = cn('divide-y divide-grey-200', props.className);
4063
4156
  return /*#__PURE__*/React__default.createElement(AccordionContext.Provider, {
4064
4157
  value: context
4065
4158
  }, /*#__PURE__*/React__default.createElement(AccordionPrimitive.Root, Object.assign({}, otherProps, valueProps, {
4066
4159
  "data-taco": "accordion",
4067
- className: className
4160
+ className: className,
4161
+ type: type
4068
4162
  })));
4069
4163
  };
4070
4164
  Accordion.Item = Item;
@@ -4090,10 +4184,10 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
4090
4184
  ...otherProps
4091
4185
  } = props;
4092
4186
  const isTransparent = color === 'transparent';
4093
- const className = cn('rounded-full border overflow-hidden whitespace-nowrap inline-flex items-center justify-center', {
4187
+ const className = cn('rounded-full border box-border overflow-hidden whitespace-nowrap inline-flex items-center justify-center', {
4094
4188
  [`border ${getOutlineColorShadeClasses(color)}`]: outline,
4095
- [`border-transparent font-normal ${getSubtleColorShadeClasses(color)}`]: subtle,
4096
- [`border-transparent ${getColorShadeClasses(color)}`]: !outline && !subtle,
4189
+ [`border-none font-normal ${getSubtleColorShadeClasses(color)}`]: subtle,
4190
+ [`border-none ${getColorShadeClasses(color)}`]: !outline && !subtle,
4097
4191
  'h-4 min-w-0 py-0 px-1 text-xs': small,
4098
4192
  'h-2 w-2 min-w-0': compact,
4099
4193
  'font-bold': outline || !subtle,
@@ -4105,12 +4199,15 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
4105
4199
  if (compact) {
4106
4200
  return /*#__PURE__*/React.createElement(VisuallyHidden, null, children);
4107
4201
  }
4202
+ const contentToRender = typeof children === 'string' ? /*#__PURE__*/React.createElement("span", {
4203
+ className: "items-center truncate"
4204
+ }, children) : children;
4108
4205
  if (status) {
4109
4206
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4110
- className: cn('mr-1 h-2 w-2 rounded-full', getColorShadeClasses(color))
4111
- }), children);
4207
+ className: cn('mr-1 h-2 w-2 shrink-0 rounded-full', getColorShadeClasses(color))
4208
+ }), contentToRender);
4112
4209
  }
4113
- return children;
4210
+ return contentToRender;
4114
4211
  };
4115
4212
  return /*#__PURE__*/React.createElement("span", Object.assign({}, otherProps, {
4116
4213
  "aria-atomic": "true",
@@ -4138,6 +4235,11 @@ const getBannerIcon = type => {
4138
4235
  icon: "close",
4139
4236
  color: "red"
4140
4237
  });
4238
+ case 'experiment':
4239
+ return /*#__PURE__*/React__default.createElement(BadgeIcon, {
4240
+ icon: "experiment",
4241
+ color: "purple"
4242
+ });
4141
4243
  case 'warning':
4142
4244
  return /*#__PURE__*/React__default.createElement(BadgeIcon, {
4143
4245
  icon: "warning",
@@ -4230,6 +4332,9 @@ function isElementTriggeredFromContainer(element, container) {
4230
4332
  return true;
4231
4333
  }
4232
4334
  const elementInDocument = document.querySelector(escapedSelector);
4335
+ if (elementInDocument === container) {
4336
+ return true;
4337
+ }
4233
4338
  // if the element does exist, see if it is itself connected to somethng that was triggered from the container
4234
4339
  if (elementInDocument) {
4235
4340
  return isElementTriggeredFromContainer(elementInDocument, container);
@@ -4252,7 +4357,15 @@ function isElementInteractive(element) {
4252
4357
  if (!element) {
4253
4358
  return false;
4254
4359
  }
4255
- return ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'].includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4360
+ const interactiveElements = ['A', 'BUTTON', 'INPUT', 'TEXTAREA', 'SELECT', 'LABEL', 'OPTION'];
4361
+ const isInteractive = interactiveElements.includes(element.tagName) && !element.hidden && !element.disabled && !element.readOnly;
4362
+ // sometimes buttons contain content like an icon, and we can't rely on pointer events being disabled
4363
+ // so search for a focusable parent
4364
+ if (!isInteractive) {
4365
+ const focusableParent = element.closest(FOCUSABLE_ELEMENTS.join(','));
4366
+ return focusableParent ? interactiveElements.includes(focusableParent.tagName) : false;
4367
+ }
4368
+ return isInteractive;
4256
4369
  }
4257
4370
  function isElementInsideTable3OrReport(element) {
4258
4371
  return !!(element !== null && element !== void 0 && element.closest('[data-taco^=table]'));
@@ -4374,18 +4487,18 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
4374
4487
  side: placement,
4375
4488
  sideOffset: 3
4376
4489
  }), /*#__PURE__*/React.createElement("div", {
4377
- className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white print:hidden",
4490
+ className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded bg-blue-900 px-2 py-1 text-xs text-white print:hidden",
4378
4491
  "data-taco": "tooltip",
4379
4492
  style: {
4380
4493
  transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
4381
4494
  }
4382
4495
  }, /*#__PURE__*/React.createElement(TooltipPrimitive.Arrow, {
4383
- className: "-mt-px fill-blue-900/90 stroke-blue-900/90"
4496
+ className: "-mt-px fill-blue-900 stroke-blue-900"
4384
4497
  }), title))));
4385
4498
  });
4386
4499
 
4387
4500
  const getButtonClasses = () => {
4388
- return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus aria-disabled:cursor-not-allowed';
4501
+ return 'flex-shrink-0 min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] gap-1 h-max leading-5 inline-flex items-center justify-center focus-visible:yt-focus data-[state=instant-open]:yt-focus aria-disabled:cursor-not-allowed';
4389
4502
  };
4390
4503
  const getAppearanceClasses = (value, icon = false) => {
4391
4504
  switch (value) {
@@ -4866,7 +4979,8 @@ const Base$1 = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
4866
4979
  }, props.className);
4867
4980
  return createButtonWithTooltip({
4868
4981
  ...otherProps,
4869
- 'data-taco': 'button'
4982
+ 'data-taco': 'button',
4983
+ 'data-appearance': appearance
4870
4984
  }, className, ref);
4871
4985
  });
4872
4986
  const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
@@ -5096,7 +5210,7 @@ const Content$2 = /*#__PURE__*/React.forwardRef(function CardContent(externalPro
5096
5210
  ...props
5097
5211
  } = externalProps;
5098
5212
  const className = cn('flex-grow overflow-auto', {
5099
- 'mx-4 mb-4': !noPadding
5213
+ 'px-4 pb-4': !noPadding
5100
5214
  }, props.className);
5101
5215
  return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
5102
5216
  className: className,
@@ -5118,7 +5232,7 @@ const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
5118
5232
  "data-taco": "card",
5119
5233
  ref: ref
5120
5234
  }), /*#__PURE__*/React.createElement("div", {
5121
- className: "mx-4 mb-2 mt-4 flex justify-between"
5235
+ className: "flex justify-between px-4 pb-2 pt-4"
5122
5236
  }, title && (/*#__PURE__*/React.createElement(Truncate, {
5123
5237
  tooltip: title
5124
5238
  }, /*#__PURE__*/React.createElement("h4", {
@@ -5187,8 +5301,9 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
5187
5301
  ...otherProps
5188
5302
  } = props;
5189
5303
  const id = useId(props.id);
5190
- const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus-visible:yt-focus disabled:cursor-not-allowed text-white', {
5191
- 'self-start': !!label
5304
+ const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 focus-visible:yt-focus disabled:cursor-not-allowed text-white', {
5305
+ 'self-start': !!label,
5306
+ 'mt-[0.1rem]': !label
5192
5307
  }, invalid ? {
5193
5308
  'border-red-500 hover:border-red-700 aria-checked:border-red-500 aria-checked-mixed:border-red-500 aria-checked:bg-red-500 aria-checked-mixed:bg-red-500 aria-checked:hover:border-red-700 aria-checked-mixed:hover:border-red-700 aria-checked:hover:bg-red-700 aria-checked-mixed:hover:bg-red-700': !props.disabled,
5194
5309
  'border-red-500/50 aria-checked:wcag-red-500/50 aria-checked-mixed:wcag-red-500/50': props.disabled
@@ -5254,7 +5369,7 @@ const getInputClasses = props => {
5254
5369
  const disabled = props.disabled || !!props['aria-disabled'];
5255
5370
  const readOnly = props.readOnly || !!props['aria-readonly'];
5256
5371
  const invalid = props.invalid || !!props['aria-invalid'];
5257
- return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus-visible:yt-focus',
5372
+ return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)] focus:yt-focus',
5258
5373
  // hide the arrow controls on input[type=number]
5259
5374
  '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none', {
5260
5375
  'bg-white': !props.highlighted && !readOnly,
@@ -5758,13 +5873,7 @@ const searchForString = (child, value, strategy = 'includes') => {
5758
5873
  }
5759
5874
  return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
5760
5875
  } else {
5761
- const childLowerCase = child.toString().toLowerCase();
5762
- const valueLowerCase = String(value).toLowerCase();
5763
- if (strategy === 'startsWith') {
5764
- return childLowerCase.startsWith(valueLowerCase);
5765
- } else {
5766
- return childLowerCase.includes(valueLowerCase);
5767
- }
5876
+ return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
5768
5877
  }
5769
5878
  } catch {
5770
5879
  return false;
@@ -5897,7 +6006,7 @@ const useCombobox = ({
5897
6006
  if (index !== undefined) {
5898
6007
  const option = data[index];
5899
6008
  if (option && !option.disabled) {
5900
- setInputValueByRef$1(inputRef.current, option.value, 'focusout');
6009
+ handleChange(option.value);
5901
6010
  }
5902
6011
  }
5903
6012
  };
@@ -5919,7 +6028,7 @@ const useCombobox = ({
5919
6028
  if (defaultValue && !value) {
5920
6029
  setInputValueByIndex(getIndexFromValue(data, defaultValue));
5921
6030
  }
5922
- }, [data]);
6031
+ }, [defaultValue]);
5923
6032
  // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc
5924
6033
  React.useEffect(() => {
5925
6034
  if (value !== undefined && value !== inputValue) {
@@ -5954,22 +6063,27 @@ const useCombobox = ({
5954
6063
  setCurrentIndex(undefined);
5955
6064
  }
5956
6065
  }, [open]);
6066
+ const handleChange = nextValue => {
6067
+ //const event = createCustomEvent('change');
6068
+ if (onChange && nextValue !== String(value)) {
6069
+ const item = findByValue(flattenedData, nextValue);
6070
+ const sanitizedItem = sanitizeItem(item);
6071
+ onChange(sanitizedItem === null || sanitizedItem === void 0 ? void 0 : sanitizedItem.value);
6072
+ }
6073
+ };
5957
6074
  // event handlers
5958
6075
  const handleInputBlur = event => {
5959
- event.persist();
5960
6076
  if (listRef.current && event.relatedTarget === listRef.current) {
5961
6077
  event.preventDefault();
5962
6078
  return;
5963
6079
  }
5964
- // event.target.value is always a string so it is important to cast value to a string before checking the equality
5965
- if (onChange && event.target.value !== String(value)) {
5966
- const item = findByValue(flattenedData, event.target.value);
5967
- event.detail = sanitizeItem(item);
5968
- const parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
5969
- if (parents !== null && parents.length > 0) {
5970
- event.detail.parents = parents;
5971
- }
5972
- onChange(event);
6080
+ // listbox is open
6081
+ if (currentIndex !== undefined) {
6082
+ setCurrentValue(currentIndex);
6083
+ } else if (inputValue !== value) {
6084
+ handleChange(inputValue);
6085
+ } else if (inputValue === '') {
6086
+ handleChange(undefined);
5973
6087
  }
5974
6088
  if (props.onBlur) {
5975
6089
  props.onBlur(event);
@@ -5983,12 +6097,10 @@ const useCombobox = ({
5983
6097
  setOpen(true);
5984
6098
  }
5985
6099
  if (onClick) {
5986
- event.persist();
5987
6100
  onClick(event);
5988
6101
  }
5989
6102
  };
5990
6103
  const handleInputKeyDown = event => {
5991
- event.persist();
5992
6104
  if (!event.ctrlKey && !event.metaKey) {
5993
6105
  switch (event.key) {
5994
6106
  case 'Backspace':
@@ -6004,7 +6116,6 @@ const useCombobox = ({
6004
6116
  }
6005
6117
  case 'Tab':
6006
6118
  {
6007
- setCurrentValue(currentIndex);
6008
6119
  setOpen(false);
6009
6120
  return;
6010
6121
  }
@@ -6057,7 +6168,6 @@ const useCombobox = ({
6057
6168
  }
6058
6169
  }
6059
6170
  if (!event.isDefaultPrevented() && onKeyDown) {
6060
- event.persist();
6061
6171
  onKeyDown(event);
6062
6172
  }
6063
6173
  };
@@ -6292,6 +6402,12 @@ const useDatepicker = ({
6292
6402
  setInternalValue(formattedValue !== null && formattedValue !== void 0 ? formattedValue : '');
6293
6403
  }
6294
6404
  }, [value]);
6405
+ const isDisabledDay = React.useMemo(() => {
6406
+ if (originalValueAsDate && calendar !== null && calendar !== void 0 && calendar.disabledDays) {
6407
+ return reactDayPicker.isMatch(originalValueAsDate, calendar === null || calendar === void 0 ? void 0 : calendar.disabledDays); // can happen if you type a disabled date in input.
6408
+ }
6409
+ return false;
6410
+ }, [originalValueAsDate]);
6295
6411
  // event handlers
6296
6412
  const handleInputBlur = event => {
6297
6413
  event.persist();
@@ -6313,6 +6429,7 @@ const useDatepicker = ({
6313
6429
  setInternalValue(event.target.value);
6314
6430
  };
6315
6431
  const handleChange = date => {
6432
+ // Update both the input value and calendar view date when selecting a date
6316
6433
  setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
6317
6434
  };
6318
6435
  const handleKeyDown = event => {
@@ -6328,6 +6445,7 @@ const useDatepicker = ({
6328
6445
  const inputProps = {
6329
6446
  ...props,
6330
6447
  autoComplete: 'off',
6448
+ invalid: props.invalid || isDisabledDay,
6331
6449
  onBlur: handleInputBlur,
6332
6450
  onChange: handleInputChange,
6333
6451
  onKeyDown: handleKeyDown,
@@ -6497,11 +6615,24 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
6497
6615
  e.preventDefault();
6498
6616
  (_input$ref$current = input.ref.current) === null || _input$ref$current === void 0 ? void 0 : _input$ref$current.focus();
6499
6617
  }, [input.ref]);
6618
+ // Allow preventing default keyDown behaviour if consumer (in our internal case it's Table3) wants to handle it.
6619
+ // We need to have this option for the situations, when Datepicker is used as inline edititng control in Table3,
6620
+ // without it, datepicker cannot be set into detailed editing mode by pressing "Enter",
6621
+ // because input.onKeydown is triggering 'focusout', which resets the detailed edititng mode.
6622
+ const handleInputKeyDown = event => {
6623
+ var _props$onKeyDown;
6624
+ (_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
6625
+ if (!event.defaultPrevented) {
6626
+ var _input$onKeyDown;
6627
+ (_input$onKeyDown = input.onKeyDown) === null || _input$onKeyDown === void 0 ? void 0 : _input$onKeyDown.call(input, event);
6628
+ }
6629
+ };
6500
6630
  return /*#__PURE__*/React.createElement("span", {
6501
6631
  className: className,
6502
6632
  "data-taco": "datepicker",
6503
6633
  style: style
6504
6634
  }, /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
6635
+ onKeyDown: handleInputKeyDown,
6505
6636
  button: input.readOnly ? undefined : (/*#__PURE__*/React.createElement(IconButton, {
6506
6637
  "aria-label": texts.datepicker.expand,
6507
6638
  disabled: input.disabled || input.readOnly,
@@ -6680,8 +6811,10 @@ const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, re
6680
6811
  const {
6681
6812
  texts
6682
6813
  } = useLocalization();
6683
- const className = cn('relative bg-white animate-[fade-in_150ms] rounded', getDialogPositionClassnames(), getDialogSizeClassnames(dialog.size), 'print:w-full print:h-full print:m-0 print:overflow-visible');
6684
- const containerClassName = cn('bg-white p-6 rounded relative z-10 shadow print:p-0 print:overflow-visible print:h-full', {
6814
+ const className = cn('relative bg-white animate-[fade-in_150ms] rounded print:!static', getDialogPositionClassnames(), getDialogSizeClassnames(dialog.size), 'print:w-full print:h-max print:m-0 print:overflow-visible');
6815
+ const containerClassName = cn('bg-white p-6 rounded relative z-10 shadow print:p-0',
6816
+ // The `!fixed` property is crucial to ensure that when a draggable dialog is moved, the printed document still displays its content across the full page.
6817
+ 'print:overflow-visible print:h-max print:!transform-none print:!inset-0 print:!m-0', {
6685
6818
  'rounded-b-none': !!dialog.elements.extra
6686
6819
  }, props.className);
6687
6820
  const handleEscapeKeyDown = event => {
@@ -7210,7 +7343,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
7210
7343
  ref: contentRef,
7211
7344
  "data-taco": "drawer",
7212
7345
  className: containerClassName
7213
- }, output, /*#__PURE__*/React__default.createElement("div", Object.assign({
7346
+ }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, output, /*#__PURE__*/React__default.createElement("div", Object.assign({
7214
7347
  className: dragHandlerClassName
7215
7348
  }, dragHandleProps, {
7216
7349
  "data-testid": "resize-handler",
@@ -7223,7 +7356,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
7223
7356
  "aria-label": texts.drawer.close,
7224
7357
  className: "absolute right-0 top-0 mr-2 mt-4",
7225
7358
  icon: "close"
7226
- }))) : null);
7359
+ }))) : null));
7227
7360
  const styleProp = {
7228
7361
  ...style,
7229
7362
  ...{
@@ -7440,7 +7573,8 @@ const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
7440
7573
  });
7441
7574
  const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
7442
7575
  const {
7443
- placement: side
7576
+ placement: side,
7577
+ hideWhenDetached = false
7444
7578
  } = props;
7445
7579
  const context = React.useContext(HangerContext);
7446
7580
  const {
@@ -7456,7 +7590,8 @@ const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, re
7456
7590
  onInteractOutside: handleInteractOutside,
7457
7591
  side: side,
7458
7592
  sideOffset: 1,
7459
- ref: ref
7593
+ ref: ref,
7594
+ hideWhenDetached: hideWhenDetached
7460
7595
  }, props.children, /*#__PURE__*/React.createElement(UnstyledArrow, {
7461
7596
  className: "text-blue-500"
7462
7597
  }), /*#__PURE__*/React.createElement(PopoverPrimitive.Close, {
@@ -8222,6 +8357,11 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
8222
8357
  if (child.props.shortcut) {
8223
8358
  shortcuts.push(createShortcutKeyDownHandler(child.props.shortcut, event => {
8224
8359
  event.preventDefault();
8360
+ const dialog = document.querySelector('[role="dialog"]');
8361
+ // Don't trigger the shortcut if it is outside of the dialog
8362
+ if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
8363
+ return;
8364
+ }
8225
8365
  menu === null || menu === void 0 ? void 0 : menu.open();
8226
8366
  setTimeout(() => {
8227
8367
  var _childrenRefs$current, _childrenRefs$current2;
@@ -8296,7 +8436,7 @@ const Shortcut = ({
8296
8436
  className: className
8297
8437
  }), texts.map(key => (/*#__PURE__*/React__default.createElement("kbd", {
8298
8438
  key: key,
8299
- className: "font-display text-grey-700 [[data-taco=tooltip]_&]:bg-grey-300/[0.25] rounded-sm bg-black/[0.09] px-1 text-center font-bold [[data-taco=tooltip]_&]:text-white"
8439
+ className: "font-display text-grey-700 [[data-taco=tooltip]_&]:bg-grey-300/[0.25] rounded-sm bg-black/[0.09] px-1 text-center font-bold [[data-appearance=danger]_&]:text-white [[data-appearance=primary]_&]:text-white [[data-taco=tooltip]_&]:text-white"
8300
8440
  }, key))));
8301
8441
  };
8302
8442
 
@@ -9364,16 +9504,8 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
9364
9504
  });
9365
9505
  const Select = /*#__PURE__*/React.forwardRef(function Select(props, ref) {
9366
9506
  const {
9367
- editable,
9368
9507
  ...otherProps
9369
9508
  } = props;
9370
- if (editable) {
9371
- return /*#__PURE__*/React.createElement(Combobox, Object.assign({}, otherProps, {
9372
- dialog: undefined,
9373
- inline: true,
9374
- ref: ref
9375
- }));
9376
- }
9377
9509
  return /*#__PURE__*/React.createElement(BaseSelect, Object.assign({}, otherProps, {
9378
9510
  ref: ref
9379
9511
  }));
@@ -9836,11 +9968,6 @@ const fixedForwardRef = React__default.forwardRef;
9836
9968
  TableFilterComparator[TableFilterComparator["HasAllOf"] = 12] = "HasAllOf";
9837
9969
  TableFilterComparator[TableFilterComparator["HasNoneOf"] = 13] = "HasNoneOf";
9838
9970
  })(exports.TableFilterComparator || (exports.TableFilterComparator = {}));
9839
- (function (TableServerLoadAllState) {
9840
- TableServerLoadAllState[TableServerLoadAllState["Incomplete"] = 0] = "Incomplete";
9841
- TableServerLoadAllState[TableServerLoadAllState["Loading"] = 1] = "Loading";
9842
- TableServerLoadAllState[TableServerLoadAllState["Completed"] = 2] = "Completed";
9843
- })(exports.TableServerLoadAllState || (exports.TableServerLoadAllState = {}));
9844
9971
 
9845
9972
  const dataTypes = {
9846
9973
  auto: {
@@ -9878,9 +10005,13 @@ const dataTypes = {
9878
10005
  if (value === undefined) {
9879
10006
  return '';
9880
10007
  }
9881
- return new Intl.NumberFormat(options === null || options === void 0 ? void 0 : (_options$localization2 = options.localization) === null || _options$localization2 === void 0 ? void 0 : _options$localization2.locale, {
10008
+ const formatter = new Intl.NumberFormat(options === null || options === void 0 ? void 0 : (_options$localization2 = options.localization) === null || _options$localization2 === void 0 ? void 0 : _options$localization2.locale, {
9882
10009
  minimumFractionDigits: 2
9883
- }).format(Number(value));
10010
+ });
10011
+ const decimalSeperator = formatter.format(1.1).substring(1, 2);
10012
+ const localisedValue = formatter.format(Number(value));
10013
+ const localisedValueWithoutThousandsSeperator = decimalSeperator === '.' ? localisedValue.replace(',', '') : localisedValue.replace('.', '');
10014
+ return [localisedValue, localisedValueWithoutThousandsSeperator];
9884
10015
  }
9885
10016
  }
9886
10017
  };
@@ -10028,7 +10159,13 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
10028
10159
  const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
10029
10160
  localization
10030
10161
  });
10031
- if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
10162
+ if (Array.isArray(cellDisplayValue)) {
10163
+ for (const displayValue of cellDisplayValue) {
10164
+ if (isWeakContains(displayValue, searchQuery)) {
10165
+ return true;
10166
+ }
10167
+ }
10168
+ } else if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
10032
10169
  return true;
10033
10170
  }
10034
10171
  }
@@ -10201,6 +10338,9 @@ function unfreezeAllExternalColumns(leftPinnedState) {
10201
10338
  function freezeUptoExternalColumn(index, columns) {
10202
10339
  return columns.slice(0, index + 1);
10203
10340
  }
10341
+ function getHiddenColumns(columnVisibility = {}) {
10342
+ return Object.keys(columnVisibility).filter(c => columnVisibility[c] === false);
10343
+ }
10204
10344
 
10205
10345
  function getSettings(table) {
10206
10346
  const meta = table.options.meta;
@@ -10326,10 +10466,15 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
10326
10466
  column.cell = info => renderer(info.getValue(), info.row.original);
10327
10467
  } else if (dataTypeProperties.getDisplayValue) {
10328
10468
  const dataTypeRenderer = value => {
10329
- var _dataTypeProperties$g, _dataTypeProperties$g2;
10330
- return (_dataTypeProperties$g = (_dataTypeProperties$g2 = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g2 === void 0 ? void 0 : _dataTypeProperties$g2.call(dataTypeProperties, value, {
10469
+ var _dataTypeProperties$g;
10470
+ const displayValue = (_dataTypeProperties$g = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g === void 0 ? void 0 : _dataTypeProperties$g.call(dataTypeProperties, value, {
10331
10471
  localization
10332
- })) !== null && _dataTypeProperties$g !== void 0 ? _dataTypeProperties$g : value;
10472
+ });
10473
+ if (Array.isArray(displayValue)) {
10474
+ var _displayValue$;
10475
+ return (_displayValue$ = displayValue[0]) !== null && _displayValue$ !== void 0 ? _displayValue$ : value;
10476
+ }
10477
+ return displayValue !== null && displayValue !== void 0 ? displayValue : value;
10333
10478
  };
10334
10479
  column.cell = info => dataTypeRenderer(info.getValue());
10335
10480
  column.meta.renderer = dataTypeRenderer;
@@ -10460,7 +10605,8 @@ function configureReactTableOptions(options, props, localization) {
10460
10605
  getExpandedRowModel: reactTable.getExpandedRowModel(),
10461
10606
  getGroupedRowModel: reactTable.getGroupedRowModel(),
10462
10607
  getRowId,
10463
- groupedColumnMode: false
10608
+ groupedColumnMode: false,
10609
+ keepPinnedRows: false
10464
10610
  };
10465
10611
  if (tableOptions.enableColumnResizing) {
10466
10612
  tableOptions.columnResizeMode = 'onChange';
@@ -10482,6 +10628,12 @@ function configureReactTableOptions(options, props, localization) {
10482
10628
  var _column$columnDef$met;
10483
10629
  return ((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enableSearch) !== false && column.getIsVisible();
10484
10630
  };
10631
+ // enter controlled search mode (controlled could be local state, but usually the server)
10632
+ if (props.onChangeSearch) {
10633
+ if (props._experimentalDataLoader2) {
10634
+ tableOptions.manualFiltering = true;
10635
+ }
10636
+ }
10485
10637
  }
10486
10638
  if (tableOptions.enableSorting) {
10487
10639
  // enter controlled sort mode (controlled could be local state, but usually the server)
@@ -10539,6 +10691,7 @@ const DEFAULT_PRESET = {
10539
10691
  enableColumnHiding: false,
10540
10692
  enableColumnResizing: false,
10541
10693
  enableRowExpansion: false,
10694
+ enableRowExpansionAll: true,
10542
10695
  enableRowSelection: false,
10543
10696
  // custom -- common between all table types
10544
10697
  enableColumnOrdering: false,
@@ -10565,6 +10718,7 @@ const presets = {
10565
10718
  enableColumnHiding: true,
10566
10719
  enableColumnResizing: true,
10567
10720
  enableRowExpansion: true,
10721
+ enableRowExpansionAll: true,
10568
10722
  enableRowSelection: true,
10569
10723
  // custom -- common between all table types
10570
10724
  enableColumnOrdering: true,
@@ -10590,6 +10744,7 @@ const presets = {
10590
10744
  enableColumnHiding: false,
10591
10745
  enableColumnResizing: false,
10592
10746
  enableRowExpansion: true,
10747
+ enableRowExpansionAll: true,
10593
10748
  enableRowSelection: true,
10594
10749
  // custom -- common between all table types
10595
10750
  enableColumnOrdering: false,
@@ -10615,6 +10770,7 @@ const presets = {
10615
10770
  enableColumnHiding: false,
10616
10771
  enableColumnResizing: false,
10617
10772
  enableRowExpansion: true,
10773
+ enableRowExpansionAll: true,
10618
10774
  enableRowSelection: false,
10619
10775
  // custom -- common between all table types
10620
10776
  enableColumnOrdering: false,
@@ -10632,7 +10788,7 @@ const presets = {
10632
10788
  }
10633
10789
  };
10634
10790
  function getTableFeaturePreset(props) {
10635
- var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowSelec, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions, _props$enableRowHeigh, _props$enableSaveSett;
10791
+ var _props$enableRowActio, _props$enableRowClick, _props$enableRowDrag, _props$enableRowDrop, _props$enableRowGoto, _props$enableRowExpan, _props$enableRowExpan2, _props$enableRowSelec, _props$enableFilterin, _props$enableSearch, _props$enableSorting, _props$enableColumnFr, _props$enableColumnHi, _props$enableColumnRe, _props$enableColumnOr, _props$enableFontSize, _props$enableFooter, _props$enablePrinting, _props$enableRowActiv, _props$rowActions, _props$enableRowHeigh, _props$enableSaveSett;
10636
10792
  const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
10637
10793
  const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
10638
10794
  const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
@@ -10640,6 +10796,7 @@ function getTableFeaturePreset(props) {
10640
10796
  const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
10641
10797
  const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
10642
10798
  const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
10799
+ const enableRowExpansionAll = (_props$enableRowExpan2 = props.enableRowExpansionAll) !== null && _props$enableRowExpan2 !== void 0 ? _props$enableRowExpan2 : presetOptions.enableRowExpansionAll;
10643
10800
  const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
10644
10801
  return {
10645
10802
  // react-table built-in
@@ -10664,6 +10821,7 @@ function getTableFeaturePreset(props) {
10664
10821
  enableRowDrag: enableRowDrag && !!props.onRowDrag,
10665
10822
  enableRowDrop: enableRowDrop && !!props.onRowDrop,
10666
10823
  enableRowGoto: enableRowGoto && !!props.onRowGoto,
10824
+ enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
10667
10825
  enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
10668
10826
  enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
10669
10827
  };
@@ -10859,7 +11017,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
10859
11017
  return index;
10860
11018
  });
10861
11019
  }
10862
- }, [rowActiveIndex, length, isEnabled]);
11020
+ }, [rowActiveIndex, isEnabled]);
10863
11021
  return {
10864
11022
  isEnabled,
10865
11023
  rowActiveIndex,
@@ -10908,9 +11066,10 @@ function useTableRowClick(isEnabled = false, onRowClick) {
10908
11066
  };
10909
11067
  }
10910
11068
 
10911
- function useTableRowExpansion(isEnabled = false, rowExpansionRenderer) {
11069
+ function useTableRowExpansion(isEnabled = false, canExpandAll = true, rowExpansionRenderer) {
10912
11070
  return {
10913
11071
  isEnabled,
11072
+ canExpandAll,
10914
11073
  rowExpansionRenderer: isEnabled ? rowExpansionRenderer : undefined
10915
11074
  };
10916
11075
  }
@@ -10974,7 +11133,7 @@ function useTableRowSelection(isEnabled = false) {
10974
11133
  - Highlighting search results, this is custom and only uses the state part of globalFilter (to store the search query)
10975
11134
  - Filtering of results, this is essentially the built in filtering, and relies on enableGlobalFilter being on or off
10976
11135
  */
10977
- function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
11136
+ function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
10978
11137
  const [enableGlobalFilter, _setEnableGlobalFilter] = React__default.useState(defaultEnableGlobalFilter);
10979
11138
  function setEnableGlobalFilter(enabled, instance) {
10980
11139
  _setEnableGlobalFilter(enabled);
@@ -10999,7 +11158,8 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
10999
11158
  highlightedColumnIndexes,
11000
11159
  setHighlightedColumnIndexes,
11001
11160
  currentHighlightColumnIndex,
11002
- setCurrentHighlightColumnIndex
11161
+ setCurrentHighlightColumnIndex,
11162
+ handleSearch: isEnabled && typeof onChangeSearch === 'function' ? onChangeSearch : undefined
11003
11163
  };
11004
11164
  }
11005
11165
 
@@ -11209,9 +11369,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11209
11369
  const _lastUsedSorting = React__default.useRef([]);
11210
11370
  const _lastUsedFilters = React__default.useRef([]);
11211
11371
  const _lastUsedSearch = React__default.useRef();
11372
+ const _lastUsedHiddenColumns = React__default.useRef([]);
11212
11373
  const _lastUsedPageIndex = React__default.useRef();
11213
11374
  const _forceReset = React__default.useRef(false);
11214
- const loadPage = function (pageIndex, sorting, filters) {
11375
+ const loadPage = function (pageIndex, sorting, filters, hiddenColumns) {
11215
11376
  try {
11216
11377
  let reset = false;
11217
11378
  // sorting or filters changed, reset everything
@@ -11233,9 +11394,10 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11233
11394
  _lastUsedSorting.current = sorting;
11234
11395
  // set the filters so we can track if it changed between loads
11235
11396
  _lastUsedFilters.current = filters;
11397
+ _lastUsedHiddenColumns.current = hiddenColumns;
11236
11398
  const _temp = _finallyRethrows(function () {
11237
11399
  return _catch(function () {
11238
- return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
11400
+ return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns)).then(function (response) {
11239
11401
  // update state, here we do some "magic" to support "load in place"
11240
11402
  setData(currentData => {
11241
11403
  let nextData;
@@ -11264,14 +11426,15 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11264
11426
  return Promise.reject(e);
11265
11427
  }
11266
11428
  };
11267
- const loadAll = function (sorting, filters) {
11429
+ const loadAll = function (sorting, filters, hiddenColumns) {
11268
11430
  try {
11269
11431
  // set the sorting so we can track if it changed between loads
11270
11432
  _lastUsedSorting.current = sorting;
11271
11433
  // set the filters so we can track if it changed between loads
11272
11434
  _lastUsedFilters.current = filters;
11435
+ _lastUsedHiddenColumns.current = hiddenColumns;
11273
11436
  const _temp2 = _catch(function () {
11274
- return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
11437
+ return Promise.resolve(fetchAll(sorting, filters, hiddenColumns)).then(function (response) {
11275
11438
  length.current = response.length;
11276
11439
  setData(() => {
11277
11440
  let nextData;
@@ -11296,11 +11459,11 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11296
11459
  _forceReset.current = true;
11297
11460
  if (_lastUsedSearch.current) {
11298
11461
  // we're searching, which means we need to refetch all with the correct sorting applied
11299
- return loadAll(_lastUsedSorting.current, _lastUsedFilters.current);
11462
+ return loadAll(_lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
11300
11463
  } else {
11301
11464
  var _lastUsedPageIndex$cu;
11302
11465
  // load the last page that we scrolled to
11303
- return loadPage((_lastUsedPageIndex$cu = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu !== void 0 ? _lastUsedPageIndex$cu : 0, _lastUsedSorting.current, _lastUsedFilters.current);
11466
+ return loadPage((_lastUsedPageIndex$cu = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu !== void 0 ? _lastUsedPageIndex$cu : 0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
11304
11467
  }
11305
11468
  } catch (e) {
11306
11469
  return Promise.reject(e);
@@ -11312,13 +11475,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11312
11475
  try {
11313
11476
  if (_lastUsedSearch.current) {
11314
11477
  // we're searching, which means we need to refetch all with the correct sorting applied
11315
- loadAll(sorting, _lastUsedFilters.current);
11478
+ return loadAll(sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
11316
11479
  } else {
11317
11480
  var _lastUsedPageIndex$cu2;
11318
11481
  // load the last page that we scrolled to
11319
- loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current);
11482
+ return loadPage((_lastUsedPageIndex$cu2 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu2 !== void 0 ? _lastUsedPageIndex$cu2 : 0, sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current);
11320
11483
  }
11321
- return Promise.resolve();
11322
11484
  } catch (e) {
11323
11485
  return Promise.reject(e);
11324
11486
  }
@@ -11327,13 +11489,12 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11327
11489
  try {
11328
11490
  if (_lastUsedSearch.current) {
11329
11491
  // we're searching, which means we need to refetch all with the correct sorting applied
11330
- loadAll(_lastUsedSorting.current, filters);
11492
+ return loadAll(_lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
11331
11493
  } else {
11332
11494
  var _lastUsedPageIndex$cu3;
11333
11495
  // load the last page that we scrolled to
11334
- loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters);
11496
+ return loadPage((_lastUsedPageIndex$cu3 = _lastUsedPageIndex.current) !== null && _lastUsedPageIndex$cu3 !== void 0 ? _lastUsedPageIndex$cu3 : 0, _lastUsedSorting.current, filters, _lastUsedHiddenColumns.current);
11335
11497
  }
11336
- return Promise.resolve();
11337
11498
  } catch (e) {
11338
11499
  return Promise.reject(e);
11339
11500
  }
@@ -11361,10 +11522,17 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11361
11522
  }, invalidate];
11362
11523
  }
11363
11524
 
11364
- function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
11525
+ function useTableServerLoading(length, data, loadPage, loadAll, pages, pageSize = DEFAULT_PAGE_SIZE, _experimentalDataLoader2 = false) {
11365
11526
  const isEnabled = !!loadPage && !!loadAll;
11366
11527
  const [isReady, setReady] = React__default.useState(false);
11367
- const [loadAllStatus, setLoadedStatus] = React__default.useState(exports.TableServerLoadAllState.Incomplete);
11528
+ const [loading, setLoading] = React__default.useState(false);
11529
+ const hasLoadedAll = React__default.useMemo(() => {
11530
+ var _data$some;
11531
+ if (data.length !== length || !!((_data$some = data.some) !== null && _data$some !== void 0 && _data$some.call(data, x => x === undefined))) {
11532
+ return false;
11533
+ }
11534
+ return true;
11535
+ }, [data, length]);
11368
11536
  let _loadPage;
11369
11537
  let _loadAll;
11370
11538
  let _loadAllIfNeeded;
@@ -11389,9 +11557,9 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
11389
11557
  try {
11390
11558
  const _temp2 = function () {
11391
11559
  if (typeof loadAll === 'function') {
11392
- setLoadedStatus(exports.TableServerLoadAllState.Loading);
11560
+ setLoading(true);
11393
11561
  return Promise.resolve(loadAll(...args)).then(function () {
11394
- setLoadedStatus(exports.TableServerLoadAllState.Completed);
11562
+ setLoading(false);
11395
11563
  setReady(true);
11396
11564
  });
11397
11565
  }
@@ -11404,7 +11572,7 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
11404
11572
  _loadAllIfNeeded = function (...args) {
11405
11573
  try {
11406
11574
  const _temp3 = function () {
11407
- if (loadAllStatus === exports.TableServerLoadAllState.Incomplete) {
11575
+ if (!hasLoadedAll) {
11408
11576
  var _loadAll2;
11409
11577
  return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
11410
11578
  }
@@ -11415,14 +11583,18 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
11415
11583
  }
11416
11584
  };
11417
11585
  }
11586
+ const pageCount = Math.ceil(length / pageSize);
11418
11587
  return {
11588
+ pages,
11419
11589
  isEnabled,
11420
11590
  isReady,
11421
11591
  loadPage: _loadPage,
11422
11592
  loadAll: _loadAll,
11423
11593
  loadAllIfNeeded: _loadAllIfNeeded,
11424
- loadAllStatus,
11425
- pageSize
11594
+ loading,
11595
+ pageSize,
11596
+ pageCount,
11597
+ _experimentalDataLoader2
11426
11598
  };
11427
11599
  }
11428
11600
 
@@ -11494,22 +11666,21 @@ function useLazyEffect(effect, deps) {
11494
11666
  const readyRef = React__default.useRef(false);
11495
11667
  React__default.useEffect(() => {
11496
11668
  if (readyRef.current) {
11497
- effect();
11669
+ return effect();
11498
11670
  } else {
11499
11671
  readyRef.current = true;
11500
11672
  }
11501
11673
  }, deps);
11502
11674
  }
11503
11675
 
11504
- function useTableDataListener(table) {
11676
+ function useTableDataListener(table, length) {
11505
11677
  const meta = table.options.meta;
11506
- const rows = table.getRowModel().rows;
11507
11678
  useLazyEffect(() => {
11508
11679
  const rowActiveIndex = meta.rowActive.rowActiveIndex;
11509
- if (rowActiveIndex !== undefined && rowActiveIndex > rows.length) {
11680
+ if (rowActiveIndex !== undefined && rowActiveIndex > length) {
11510
11681
  meta.rowActive.setRowActiveIndex(0);
11511
11682
  }
11512
- }, [rows.length]);
11683
+ }, [length]);
11513
11684
  }
11514
11685
 
11515
11686
  // we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
@@ -11519,7 +11690,8 @@ function useTableFilterListener(table, onFilter) {
11519
11690
  const columnFilters = table.getState().columnFilters;
11520
11691
  useLazyEffect(() => {
11521
11692
  if (table.options.enableColumnFilters && typeof onFilter === 'function') {
11522
- onFilter(columnFilters);
11693
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
11694
+ onFilter(columnFilters, hiddenColumns);
11523
11695
  if (table.options.enableRowSelection) {
11524
11696
  table.resetRowSelection();
11525
11697
  }
@@ -11536,7 +11708,8 @@ function useTableFontSizeListener(table) {
11536
11708
  table.setColumnSizing(sizes => {
11537
11709
  return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
11538
11710
  var _column$columnDef$min;
11539
- const column = table.getColumn(columnName);
11711
+ // table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
11712
+ const column = table.getAllColumns().find(x => x.id === columnName);
11540
11713
  if (isInternalColumn(columnName)) {
11541
11714
  var _column$getSize;
11542
11715
  return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
@@ -11577,11 +11750,12 @@ function useTableRowHeightListener(table) {
11577
11750
  }
11578
11751
 
11579
11752
  function useTableRowSelectionListener(table, onRowSelect) {
11753
+ // note that the selected row model may not contain all rows in state when using server loading
11580
11754
  const rows = table.getSelectedRowModel().flatRows;
11581
- const rowSelection = React__default.useMemo(() => rows.map(row => row.original), [rows]);
11755
+ const state = table.getState().rowSelection;
11582
11756
  useLazyEffect(() => {
11583
11757
  if (table.options.enableRowSelection && typeof onRowSelect === 'function') {
11584
- onRowSelect(rowSelection);
11758
+ onRowSelect(rows.map(row => row.original), Object.keys(state));
11585
11759
  }
11586
11760
  /**
11587
11761
  * Casting to a boolean, since enableRowSelection can be a function,
@@ -11589,33 +11763,33 @@ function useTableRowSelectionListener(table, onRowSelect) {
11589
11763
  * we only need to know if selection was enabled or disabled, because enableRowSelection function
11590
11764
  * will be applied directly to particular rows.
11591
11765
  */
11592
- }, [!!table.options.enableRowSelection, JSON.stringify(rowSelection)]);
11766
+ }, [!!table.options.enableRowSelection, JSON.stringify(state)]);
11593
11767
  }
11594
11768
 
11595
- function useTableSearchListener(table, onChangeSearch) {
11769
+ function useTableSearchListener(table) {
11596
11770
  const meta = table.options.meta;
11597
11771
  const localization = useLocalization();
11598
- const visibleColumns = table.getVisibleFlatColumns();
11772
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
11773
+ const query = table.getState().globalFilter;
11599
11774
  // Need to re-run search when columns are getting shown/hidden.
11600
- React__default.useEffect(() => {
11601
- if (meta.search.isEnabled && visibleColumns.length > 0) {
11602
- const currentFilter = table.getState().globalFilter;
11775
+ useLazyEffect(() => {
11776
+ if (meta.search.isEnabled) {
11777
+ const currentFilter = query;
11603
11778
  requestAnimationFrame(() => {
11604
11779
  table.resetGlobalFilter();
11605
11780
  table.setGlobalFilter(currentFilter);
11606
11781
  });
11782
+ if (meta.search.handleSearch && meta.search.enableGlobalFilter && query) {
11783
+ meta.search.handleSearch(query, hiddenColumns);
11784
+ }
11607
11785
  }
11608
- }, [visibleColumns.length]);
11786
+ }, [hiddenColumns.length]);
11609
11787
  // recalculates highlighted indexes whenever something important changes
11610
- React__default.useEffect(() => {
11788
+ useLazyEffect(() => {
11611
11789
  if (meta.search.isEnabled) {
11612
- const query = table.getState().globalFilter;
11613
11790
  resetHighlightedColumnIndexes(query, table, localization);
11614
- if (typeof onChangeSearch === 'function') {
11615
- onChangeSearch(query);
11616
- }
11617
11791
  }
11618
- }, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), onChangeSearch]);
11792
+ }, [meta.server.loading, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, query, JSON.stringify(table.getState().sorting)]);
11619
11793
  }
11620
11794
 
11621
11795
  function useTableSettingsListener(table, onChangeSettings) {
@@ -11699,12 +11873,15 @@ function useTableSortingListener(table, onSort) {
11699
11873
  }
11700
11874
 
11701
11875
  function useTableServerLoadingListener(table, loadPage) {
11702
- const sorting = table.getState().sorting;
11703
- const columnFilters = table.getState().columnFilters;
11876
+ const meta = table.options.meta;
11704
11877
  // trigger load of the first page on mount
11705
11878
  React__default.useEffect(() => {
11706
11879
  if (loadPage) {
11707
- loadPage(0, sorting, columnFilters);
11880
+ const sorting = table.getState().sorting;
11881
+ const columnFilters = table.getState().columnFilters;
11882
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
11883
+ const search = meta.search.enableGlobalFilter ? table.getState().globalFilter : undefined;
11884
+ loadPage(0, sorting, columnFilters, hiddenColumns, search);
11708
11885
  }
11709
11886
  }, []);
11710
11887
  }
@@ -11751,13 +11928,13 @@ function useTableManager(props, meta, internalColumns) {
11751
11928
  const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
11752
11929
  const rowDrag = useTableRowDrag(options.enableRowDrag && !(meta !== null && meta !== void 0 && (_meta$editing = meta.editing) !== null && _meta$editing !== void 0 && _meta$editing.isEditing), props.onRowDrag);
11753
11930
  const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
11754
- const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
11931
+ const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
11755
11932
  const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
11756
11933
  const rowGroups = useTableRowGroups(props.rowActionsForGroup);
11757
11934
  const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
11758
11935
  const rowSelection = useTableRowSelection(!!options.enableRowSelection);
11759
- const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
11760
- const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);
11936
+ const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
11937
+ const server = useTableServerLoading(length, data, props.loadPage, props.loadAll, props.pages, props.pageSize, props._experimentalDataLoader2);
11761
11938
  // TODO: memoise
11762
11939
  // convert jsx column components into valid table columns
11763
11940
  const {
@@ -11803,12 +11980,12 @@ function useTableManager(props, meta, internalColumns) {
11803
11980
  }
11804
11981
  });
11805
11982
  // state listeners - we have these so that we don't have to control state outside the table
11806
- useTableDataListener(instance);
11983
+ useTableDataListener(instance, length);
11807
11984
  useTableFilterListener(instance, props.onChangeFilter);
11808
11985
  useTableFontSizeListener(instance);
11809
11986
  useTableRowHeightListener(instance);
11810
11987
  useTableRowSelectionListener(instance, props.onRowSelect);
11811
- useTableSearchListener(instance, props.onChangeSearch);
11988
+ useTableSearchListener(instance);
11812
11989
  useTableServerLoadingListener(instance, server.loadPage);
11813
11990
  useTableSettingsListener(instance, setSettings);
11814
11991
  useTableShortcutsListener(instance, props.shortcuts);
@@ -11879,7 +12056,7 @@ function useTableStyleGrid(tableId, table, fontSize) {
11879
12056
  // we have to be specific so that nested tables don't inherit the same css
11880
12057
  const hiddenColumns = printHiddenColumns.map(id => `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\n,table[data-taco^='table']#${tableId} > tbody > tr > td[data-cell-id='${id}']\n`).join(',');
11881
12058
  const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: repeat(${printGridTemplateColumns}, auto) !important; }
11882
- table[data-taco^='table']#${tableId} [data-cell-id^='__']${hiddenColumns ? `, ${hiddenColumns}` : ''} { display: none; }}`;
12059
+ table[data-taco^='table']#${tableId} [data-cell-id^='__']${hiddenColumns ? `, ${hiddenColumns}` : ''} { display: none; } table[data-taco^='table']#${tableId} tr { page-break-inside: avoid; break-inside: avoid;}}`;
11883
12060
  return {
11884
12061
  style,
11885
12062
  stylesheet
@@ -12034,7 +12211,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
12034
12211
  if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
12035
12212
  return;
12036
12213
  }
12037
- tableMeta.rowActive.handleKeyDown(event, rows.length, scrollToIndex);
12214
+ tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
12038
12215
  tableMeta.rowSelection.handleKeyDown(event, table);
12039
12216
  if (tableMeta.rowActive.rowActiveIndex !== undefined) {
12040
12217
  var _rows$tableMeta$rowAc;
@@ -12047,7 +12224,7 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
12047
12224
  };
12048
12225
  },
12049
12226
  // scrollToIndex function changes when row count changes, so it is important to update handlers
12050
- [tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
12227
+ [tableRef.current, tableMeta.length, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
12051
12228
  }
12052
12229
 
12053
12230
  function useTableRef(table, ref) {
@@ -12070,57 +12247,131 @@ const ROW_HEIGHT_ESTIMATES = {
12070
12247
  'extra-tall': 57
12071
12248
  };
12072
12249
 
12250
+ const RowContext = /*#__PURE__*/React__default.createContext({
12251
+ hideInternalColumns: false,
12252
+ hideRowActions: false,
12253
+ isHovered: false,
12254
+ rowIndex: -1
12255
+ });
12256
+
12257
+ const DELAY_BEFORE_LOAD_MS = 250;
12258
+ /* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
12259
+ function Row(props) {
12260
+ const {
12261
+ renderer: RowRenderer,
12262
+ cellRenderer: CellRenderer,
12263
+ hideInternalColumns = false,
12264
+ hideRowActions = false,
12265
+ scrollDirection,
12266
+ skipPageLoading = false,
12267
+ ...displayRowProps
12268
+ } = props;
12269
+ const tableMeta = props.table.options.meta;
12270
+ const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
12271
+ // context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
12272
+ const contextValue = React__default.useMemo(() => ({
12273
+ isHovered,
12274
+ rowIndex: props.index,
12275
+ hideInternalColumns,
12276
+ hideRowActions
12277
+ }), [isHovered, props.index, hideInternalColumns, hideRowActions]);
12278
+ React__default.useEffect(() => {
12279
+ let timeout;
12280
+ if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 && !skipPageLoading) {
12281
+ const pageIndex = Math.floor(props.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
12282
+ const sorting = props.table.getState().sorting;
12283
+ const filters = props.table.getState().columnFilters;
12284
+ const search = props.table.getState().globalFilter;
12285
+ const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
12286
+ const pageIndexesToFetch = [];
12287
+ // if there's no direction, it means the scroll bar got dropped un unloaded pages,
12288
+ // in that case, load forward and backward pages to prevent skeletons
12289
+ if (scrollDirection === 'backward' || !scrollDirection) {
12290
+ const backIndex = pageIndex - 1;
12291
+ if (backIndex > -1) {
12292
+ pageIndexesToFetch.push(backIndex);
12293
+ }
12294
+ }
12295
+ // always load the next page
12296
+ if ((scrollDirection === 'forward' || !scrollDirection) && pageIndex + 2 < tableMeta.server.pageCount) {
12297
+ pageIndexesToFetch.push(pageIndex + 1);
12298
+ }
12299
+ if (pageIndexesToFetch.length) {
12300
+ // the virtualiser fetches a page ahead, so this won't get called in most cases
12301
+ // but it provides a fallback for some edge cases
12302
+ timeout = setTimeout(() => {
12303
+ pageIndexesToFetch.forEach(index => {
12304
+ var _tableMeta$server$loa, _tableMeta$server;
12305
+ // this can be called by every row within the current page, but loadPage returns early if a pending request exists
12306
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, index, sorting, filters, hiddenColumns, tableMeta.search.enableGlobalFilter ? search : undefined);
12307
+ });
12308
+ }, DELAY_BEFORE_LOAD_MS);
12309
+ }
12310
+ }
12311
+ return () => {
12312
+ clearTimeout(timeout);
12313
+ };
12314
+ }, [tableMeta.server.pages]);
12315
+ return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
12316
+ value: contextValue
12317
+ }, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
12318
+ cellRenderer: CellRenderer
12319
+ })));
12320
+ }
12321
+
12322
+ const DELAY_BEFORE_LOAD_MS$1 = 150;
12073
12323
  function SkeletonRow(props) {
12074
12324
  const {
12075
12325
  index,
12076
- row,
12077
12326
  table
12078
12327
  } = props;
12079
12328
  const tableMeta = table.options.meta;
12080
12329
  if (tableMeta.server.isEnabled) {
12081
- return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props, {
12082
- index: index
12083
- }));
12330
+ return /*#__PURE__*/React__default.createElement(RowWithServerLoading, Object.assign({}, props));
12084
12331
  }
12085
12332
  return /*#__PURE__*/React__default.createElement(Skeleton, {
12086
- cellsCount: row.getVisibleCells().length
12333
+ cellsCount: table.getVisibleFlatColumns().length,
12334
+ index: index
12087
12335
  });
12088
12336
  }
12089
12337
  function RowWithServerLoading(props) {
12090
12338
  var _table$getState$group, _table$getState;
12091
12339
  const {
12092
12340
  index,
12093
- row,
12094
12341
  table
12095
12342
  } = props;
12096
12343
  const tableMeta = table.options.meta;
12097
12344
  const pageIndex = Math.floor(index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
12098
- const {
12099
- ref,
12100
- inView
12101
- } = reactIntersectionObserver.useInView({
12102
- threshold: 0,
12103
- triggerOnce: true,
12104
- initialInView: pageIndex === 0
12105
- });
12106
12345
  React__default.useEffect(() => {
12107
- if (inView) {
12108
- var _tableMeta$server$loa, _tableMeta$server;
12109
- (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters);
12346
+ let timeout;
12347
+ if (tableMeta.server.isEnabled) {
12348
+ const sorting = props.table.getState().sorting;
12349
+ const filters = props.table.getState().columnFilters;
12350
+ const search = props.table.getState().globalFilter;
12351
+ const hiddenColumns = getHiddenColumns(props.table.getState().columnVisibility);
12352
+ timeout = setTimeout(() => {
12353
+ var _tableMeta$server$loa, _tableMeta$server;
12354
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, sorting, filters, hiddenColumns, tableMeta.search.enableGlobalFilter ? search : undefined);
12355
+ }, DELAY_BEFORE_LOAD_MS$1);
12110
12356
  }
12111
- }, [inView]);
12357
+ return () => {
12358
+ clearTimeout(timeout);
12359
+ };
12360
+ }, []);
12112
12361
  const groupedCellCount = (_table$getState$group = (_table$getState = table.getState()) === null || _table$getState === void 0 ? void 0 : _table$getState.grouping.length) !== null && _table$getState$group !== void 0 ? _table$getState$group : 0;
12113
- const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;
12362
+ const ungroupedCellCount = table.getVisibleFlatColumns().length - groupedCellCount;
12114
12363
  return /*#__PURE__*/React__default.createElement(Skeleton, {
12115
12364
  cellsCount: ungroupedCellCount,
12116
- ref: ref
12365
+ index: index
12117
12366
  });
12118
12367
  }
12119
12368
  const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
12120
12369
  const {
12121
- cellsCount
12370
+ cellsCount,
12371
+ index
12122
12372
  } = props;
12123
12373
  return /*#__PURE__*/React__default.createElement("tr", {
12374
+ "data-row-index": index,
12124
12375
  ref: ref
12125
12376
  }, Array(cellsCount).fill(null).map((_, index) => (/*#__PURE__*/React__default.createElement("td", {
12126
12377
  key: index
@@ -12129,38 +12380,6 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
12129
12380
  })))));
12130
12381
  });
12131
12382
 
12132
- const RowContext = /*#__PURE__*/React__default.createContext({
12133
- isHovered: false,
12134
- rowIndex: -1,
12135
- hideRowActions: false
12136
- });
12137
-
12138
- /* anonymous functions will break the memoisation on each render, wrap handlers in callbacks */
12139
- function Row(props) {
12140
- const {
12141
- renderer: RowRenderer,
12142
- cellRenderer: CellRenderer,
12143
- hideRowActions = false,
12144
- ...displayRowProps
12145
- } = props;
12146
- const tableMeta = props.table.options.meta;
12147
- const isHovered = tableMeta.rowActive.rowHoverIndex === props.index;
12148
- // context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
12149
- const contextValue = React__default.useMemo(() => ({
12150
- isHovered,
12151
- rowIndex: props.index,
12152
- hideRowActions
12153
- }), [isHovered, props.index, hideRowActions]);
12154
- if (props.row.original === undefined) {
12155
- return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
12156
- }
12157
- return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
12158
- value: contextValue
12159
- }, /*#__PURE__*/React__default.createElement(RowRenderer, Object.assign({}, displayRowProps, {
12160
- cellRenderer: CellRenderer
12161
- })));
12162
- }
12163
-
12164
12383
  // scroll padding end is designed to always show half of the next row
12165
12384
  function getScrollPaddingEndOffset(table) {
12166
12385
  const tableMeta = table.options.meta;
@@ -12185,8 +12404,8 @@ function getPaddingEndOffset(table, options) {
12185
12404
  const bottomRows = (_table$getBottomRows = table.getBottomRows()) !== null && _table$getBottomRows !== void 0 ? _table$getBottomRows : [];
12186
12405
  return ROW_HEIGHT_ESTIMATES.medium * ((_options$virtualiserP = options === null || options === void 0 ? void 0 : options.virtualiserPaddingEndOffset) !== null && _options$virtualiserP !== void 0 ? _options$virtualiserP : 1) * bottomRows.length;
12187
12406
  }
12188
- function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, options) {
12189
- var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _ref, _virtualItems;
12407
+ function useTableRenderer(renderers, table, tableRef, length, defaultRowActiveIndex, options) {
12408
+ var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _virtualItems$end, _virtualItems;
12190
12409
  const tableMeta = table.options.meta;
12191
12410
  const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
12192
12411
  const rows = (_table$getCenterRows = table.getCenterRows()) !== null && _table$getCenterRows !== void 0 ? _table$getCenterRows : [];
@@ -12199,11 +12418,12 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
12199
12418
  const rangeExtractor = useRowGroupVirtualisation(table);
12200
12419
  // account for thead and tfoot in the scroll area - both are always medium row height
12201
12420
  const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
12421
+ const count = tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2 ? length : rows.length;
12202
12422
  const virtualiser = reactVirtual.useVirtualizer({
12203
- count: rows.length,
12423
+ count,
12204
12424
  estimateSize,
12205
12425
  getScrollElement: () => tableRef.current,
12206
- overscan: tableMeta.printing.isPrinting ? rows.length : undefined,
12426
+ overscan: tableMeta.printing.isPrinting ? count : undefined,
12207
12427
  rangeExtractor,
12208
12428
  // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
12209
12429
  scrollPaddingStart,
@@ -12223,19 +12443,19 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
12223
12443
  if (tableRef.current) {
12224
12444
  if (index === 0) {
12225
12445
  virtualiser.scrollToOffset(0, notSmooth);
12226
- } else if (index === rows.length - 1) {
12446
+ } else if (index === count - 1) {
12227
12447
  // sometimes the last row doesn't fully show, so we just force scroll to the bottom
12228
12448
  tableRef.current.scrollTop = tableRef.current.scrollHeight;
12229
12449
  } else {
12230
12450
  virtualiser.scrollToIndex(index, options);
12231
12451
  }
12232
12452
  }
12233
- }, [virtualItems.length, tableRef.current, totalSize, rows.length]);
12453
+ }, [virtualItems.length, tableRef.current, totalSize, count]);
12234
12454
  // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
12235
- const paddingStartIndex = isTableRowGrouped && rows.length > 1 ? 1 : 0;
12455
+ const paddingStartIndex = isTableRowGrouped && count > 1 ? 1 : 0;
12236
12456
  const startValue = isTableRowGrouped ? ((_virtualItems$padding = virtualItems[paddingStartIndex]) === null || _virtualItems$padding === void 0 ? void 0 : _virtualItems$padding.start) - ((_virtualItems$padding2 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding2 === void 0 ? void 0 : _virtualItems$padding2.size) : (_virtualItems$padding3 = virtualItems[paddingStartIndex]) === null || _virtualItems$padding3 === void 0 ? void 0 : _virtualItems$padding3.start;
12237
12457
  // styling for offsetting rows - this "is" the virtualisation
12238
- const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, startValue !== null && startValue !== void 0 ? startValue : 0), Math.max(0, (_ref = totalSize - ((_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end)) !== null && _ref !== void 0 ? _ref : 0)] : [0, 0];
12458
+ const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [Math.max(0, startValue !== null && startValue !== void 0 ? startValue : 0), Math.max(0, totalSize - ((_virtualItems$end = (_virtualItems = virtualItems[virtualItems.length - 1]) === null || _virtualItems === void 0 ? void 0 : _virtualItems.end) !== null && _virtualItems$end !== void 0 ? _virtualItems$end : 0))] : [0, 0];
12239
12459
  // ensure default active rows are scrolled to
12240
12460
  React__default.useEffect(() => {
12241
12461
  if (defaultRowActiveIndex) {
@@ -12248,23 +12468,52 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, opt
12248
12468
  // rendered output
12249
12469
  let style = {};
12250
12470
  let content = null;
12251
- if (rows.length) {
12471
+ // bottom rows aren't virtualised (they're sticky) but we need to set the height
12472
+ if (count || table.getBottomRows().length) {
12252
12473
  style = {
12253
12474
  height: totalSize,
12254
- paddingBottom,
12255
- paddingTop
12475
+ paddingBottom: isNaN(paddingBottom) ? 0 : paddingBottom,
12476
+ paddingTop: isNaN(paddingTop) ? 0 : paddingTop
12256
12477
  };
12478
+ }
12479
+ // only render non sticky rows
12480
+ if (count) {
12257
12481
  content = virtualItems.map(virtualRow => {
12482
+ var _row, _virtualiser$scrollDi2;
12258
12483
  // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here
12259
12484
  if (!virtualRow) {
12260
12485
  return null;
12261
12486
  }
12262
- const row = rows[virtualRow.index];
12487
+ let row;
12488
+ if (tableMeta.server.isEnabled && tableMeta.server._experimentalDataLoader2) {
12489
+ var _tableMeta$server$pag, _tableMeta$server$pag2;
12490
+ const currentPageIndex = Math.floor(virtualRow.index / tableMeta.server.pageSize) * tableMeta.server.pageSize / tableMeta.server.pageSize;
12491
+ const pagePosition = (_tableMeta$server$pag = (_tableMeta$server$pag2 = tableMeta.server.pages) === null || _tableMeta$server$pag2 === void 0 ? void 0 : _tableMeta$server$pag2.indexOf(currentPageIndex)) !== null && _tableMeta$server$pag !== void 0 ? _tableMeta$server$pag : -1;
12492
+ if (pagePosition > -1) {
12493
+ // "flatten" row indexes down into the dataloader2 dataset size
12494
+ // for example, with a page size of 100...
12495
+ // row index 14267 is actually one of index 67, 167, 267 etc within the dataset (depending on number of pages stored)
12496
+ const fakeIndex = pagePosition * tableMeta.server.pageSize + virtualRow.index % tableMeta.server.pageSize;
12497
+ row = rows[fakeIndex];
12498
+ }
12499
+ } else {
12500
+ row = rows[virtualRow.index];
12501
+ }
12502
+ if (!((_row = row) !== null && _row !== void 0 && _row.original)) {
12503
+ var _virtualiser$scrollDi;
12504
+ return /*#__PURE__*/React__default.createElement(SkeletonRow, {
12505
+ key: virtualRow.index,
12506
+ index: virtualRow.index,
12507
+ scrollDirection: (_virtualiser$scrollDi = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi !== void 0 ? _virtualiser$scrollDi : undefined,
12508
+ table: table
12509
+ });
12510
+ }
12263
12511
  const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);
12264
12512
  return /*#__PURE__*/React__default.createElement(Row, {
12265
12513
  key: row.id,
12266
12514
  row: row,
12267
12515
  index: virtualRow.index,
12516
+ scrollDirection: (_virtualiser$scrollDi2 = virtualiser.scrollDirection) !== null && _virtualiser$scrollDi2 !== void 0 ? _virtualiser$scrollDi2 : undefined,
12268
12517
  table: table,
12269
12518
  measureRow: measureRow,
12270
12519
  renderer: renderers.row,
@@ -12411,9 +12660,9 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
12411
12660
  table
12412
12661
  } = context;
12413
12662
  const {
12663
+ hideRowActions,
12414
12664
  isHovered,
12415
- rowIndex,
12416
- hideRowActions
12665
+ rowIndex
12417
12666
  } = React__default.useContext(RowContext);
12418
12667
  const tableMeta = table.options.meta;
12419
12668
  const actions = tableMeta.rowActions.rowActions;
@@ -12421,7 +12670,8 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
12421
12670
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
12422
12671
  const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;
12423
12672
  const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;
12424
- if (!hideRowActions && actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
12673
+ const isRowGrouped = row.getIsGrouped();
12674
+ if (!hideRowActions && !isRowGrouped && actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
12425
12675
  return /*#__PURE__*/React__default.createElement(Actions$1, {
12426
12676
  actions: actions,
12427
12677
  actionsLength: actionsLength,
@@ -12452,6 +12702,12 @@ function Cell$1() {
12452
12702
  const {
12453
12703
  texts
12454
12704
  } = useLocalization();
12705
+ const {
12706
+ hideInternalColumns
12707
+ } = React__default.useContext(RowContext);
12708
+ if (hideInternalColumns) {
12709
+ return null;
12710
+ }
12455
12711
  return /*#__PURE__*/React__default.createElement(Icon, {
12456
12712
  "aria-label": texts.table.columns.drag.tooltip,
12457
12713
  name: "drag",
@@ -12479,6 +12735,10 @@ function Header$3(context) {
12479
12735
  const {
12480
12736
  table
12481
12737
  } = context;
12738
+ const tableMeta = table.options.meta;
12739
+ if (!tableMeta.rowExpansion.canExpandAll) {
12740
+ return null;
12741
+ }
12482
12742
  const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
12483
12743
  const handleClick = event => {
12484
12744
  event.stopPropagation();
@@ -12500,7 +12760,13 @@ function Cell$2(context) {
12500
12760
  const {
12501
12761
  texts
12502
12762
  } = useLocalization();
12763
+ const {
12764
+ hideInternalColumns
12765
+ } = React__default.useContext(RowContext);
12503
12766
  const tableMeta = context.table.options.meta;
12767
+ if (hideInternalColumns) {
12768
+ return null;
12769
+ }
12504
12770
  const hasExpandedRow = (_tableMeta$rowExpansi = (_tableMeta$rowExpansi2 = tableMeta.rowExpansion).rowExpansionRenderer) === null || _tableMeta$rowExpansi === void 0 ? void 0 : _tableMeta$rowExpansi.call(_tableMeta$rowExpansi2, context.row.original);
12505
12771
  if (hasExpandedRow) {
12506
12772
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;
@@ -12554,8 +12820,9 @@ function Header$4(context) {
12554
12820
  }
12555
12821
  const _temp = function () {
12556
12822
  if (tableMeta.server.loadAllIfNeeded) {
12823
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
12557
12824
  // don't pass the search query because we need all data - not filtered data
12558
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
12825
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
12559
12826
  }
12560
12827
  }();
12561
12828
  // load all data if that is possible
@@ -12571,7 +12838,7 @@ function Header$4(context) {
12571
12838
  className: "hover:border-blue !-mt-px",
12572
12839
  checked: isAllRowsSelected,
12573
12840
  indeterminate: isSomeRowsSelected && !isAllRowsSelected,
12574
- loading: tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
12841
+ loading: tableMeta.server.loading,
12575
12842
  onChange: handleChange
12576
12843
  }));
12577
12844
  }
@@ -12590,10 +12857,11 @@ function Cell$3(context) {
12590
12857
  table
12591
12858
  } = context;
12592
12859
  const {
12860
+ hideInternalColumns,
12593
12861
  rowIndex
12594
12862
  } = React__default.useContext(RowContext);
12595
12863
  const tableMeta = table.options.meta;
12596
- if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
12864
+ if (hideInternalColumns || table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
12597
12865
  return null;
12598
12866
  }
12599
12867
  const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
@@ -12613,6 +12881,7 @@ function Cell$3(context) {
12613
12881
  if (event.shiftKey) {
12614
12882
  var _tableMeta$rowSelecti;
12615
12883
  function _temp4() {
12884
+ const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
12616
12885
  table.setRowSelection(currentRowSelection => ({
12617
12886
  ...currentRowSelection,
12618
12887
  ...selectedRows.filter(row => row.getCanSelect()).reduce((state, row) => ({
@@ -12622,11 +12891,11 @@ function Cell$3(context) {
12622
12891
  }));
12623
12892
  }
12624
12893
  const [fromIndex, toIndex] = toggleBetween((_tableMeta$rowSelecti = tableMeta.rowSelection.lastSelectedRowIndex.current) !== null && _tableMeta$rowSelecti !== void 0 ? _tableMeta$rowSelecti : 0, rowIndex);
12625
- const selectedRows = table.getRowModel().rows.slice(fromIndex, toIndex + 1);
12626
12894
  const _temp3 = function () {
12627
- if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
12895
+ if (tableMeta.server.loadAllIfNeeded) {
12896
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
12628
12897
  // don't pass the search query because we need all data - not filtered data
12629
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
12898
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
12630
12899
  }
12631
12900
  }();
12632
12901
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
@@ -12684,7 +12953,7 @@ function useTable(props, externalRef, renderers, meta, options) {
12684
12953
  // configure the table
12685
12954
  const manager = useTableManager(props, meta, INTERNAL_RENDERERS);
12686
12955
  // configure the virtualised renderer
12687
- const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex, options);
12956
+ const renderer = useTableRenderer(renderers, manager.instance, ref, manager.meta.length, props.defaultRowActiveIndex, options);
12688
12957
  // configure dynamic styling
12689
12958
  const {
12690
12959
  style,
@@ -12797,7 +13066,9 @@ function GroupedCell(props) {
12797
13066
  } = React__default.useContext(RowContext);
12798
13067
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
12799
13068
  const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
12800
- const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;
13069
+ // Set colSpan based on the count of visible cells, including '__actions' and non-internal columns, so that
13070
+ // rowGroupActions aligns with rowActions.
13071
+ const colSpan = cell.row.getVisibleCells().filter(c => c.column.id === '__actions' || !isInternalColumn(c.column.id)).length - 1;
12801
13072
  const content = (_ref = (_columnMeta$renderer = (_columnMeta$renderer2 = columnMeta.renderer) === null || _columnMeta$renderer2 === void 0 ? void 0 : _columnMeta$renderer2.call(columnMeta, cell.getValue(), cell.row.original)) !== null && _columnMeta$renderer !== void 0 ? _columnMeta$renderer : cell.getValue()) !== null && _ref !== void 0 ? _ref : null;
12802
13073
  const subRows = cell.getContext().row.subRows.map(row => row.original);
12803
13074
  return /*#__PURE__*/React__default.createElement(MemoedGroupedCell, Object.assign({}, attributes, {
@@ -12822,21 +13093,26 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
12822
13093
  table,
12823
13094
  ...attributes
12824
13095
  } = props;
12825
- return /*#__PURE__*/React__default.createElement("td", Object.assign({}, attributes, {
12826
- ref: cellRef,
12827
- style: {
12828
- gridColumn: `span ${colSpan} / span ${colSpan}`
12829
- }
12830
- }), /*#__PURE__*/React__default.createElement("span", {
12831
- className: "grow"
12832
- }, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
12833
- actions: rowActions,
12834
- actionsLength: 4,
12835
- data: subRows,
12836
- isActiveRow: true,
12837
- rowId: rowId,
12838
- table: table
12839
- })) : null);
13096
+ return (
13097
+ /*#__PURE__*/
13098
+ // pr-1 is needed to align group row actions with row actions in sibling rows, if present
13099
+ React__default.createElement("td", Object.assign({}, attributes, {
13100
+ className: "!pr-1",
13101
+ ref: cellRef,
13102
+ style: {
13103
+ gridColumn: `span ${colSpan} / span ${colSpan}`
13104
+ }
13105
+ }), /*#__PURE__*/React__default.createElement("span", {
13106
+ className: "grow"
13107
+ }, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
13108
+ actions: rowActions,
13109
+ actionsLength: 4,
13110
+ data: subRows,
13111
+ isActiveRow: true,
13112
+ rowId: rowId,
13113
+ table: table
13114
+ })) : null)
13115
+ );
12840
13116
  });
12841
13117
 
12842
13118
  function Cell$4(props) {
@@ -12897,7 +13173,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12897
13173
  if (tableMeta.rowActive.isEnabled) {
12898
13174
  attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;
12899
13175
  // we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes
12900
- attributes.onPointerDown = handleClickCapture;
13176
+ attributes.onClickCapture = handleClickCapture;
12901
13177
  }
12902
13178
  // row click
12903
13179
  if (tableMeta.rowClick.isEnabled(row.original)) {
@@ -12979,10 +13255,13 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12979
13255
  'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
12980
13256
  'hover:cursor-pointer': typeof attributes.onClick === 'function'
12981
13257
  });
13258
+ const isGrouped = row.getIsGrouped();
12982
13259
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", Object.assign({}, attributes, {
12983
13260
  className: className,
12984
13261
  ref: ref
12985
- }), children, row.getVisibleCells().map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
13262
+ }), children, row.getVisibleCells()
13263
+ // Filter out the row actions cell from rendering in Grouped Row
13264
+ .filter(cell => !(isGrouped && cell.column.id === '__actions')).map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
12986
13265
  key: cell.id,
12987
13266
  cell: cell,
12988
13267
  index: cellIndex,
@@ -13368,7 +13647,9 @@ function HeaderMenu(props) {
13368
13647
  return /*#__PURE__*/React__default.createElement(IconButton, {
13369
13648
  className: className,
13370
13649
  icon: "more",
13371
- menu: popoverElement ? undefined : menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, memoedMenuItems))),
13650
+ menu: popoverElement ? undefined : menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
13651
+ onFocusOutside: event => event.preventDefault()
13652
+ }, memoedMenuItems))),
13372
13653
  popover: popoverElement,
13373
13654
  onClickCapture: event => event.preventDefault(),
13374
13655
  onKeyDown: event => {
@@ -13742,21 +14023,22 @@ function Summary(props) {
13742
14023
  locale,
13743
14024
  texts
13744
14025
  } = useLocalization();
13745
- const length = table.options.meta.length;
14026
+ const tableMeta = table.options.meta;
14027
+ const length = tableMeta.length;
13746
14028
  const currentLength = table.getRowModel().rows.length;
13747
14029
  let label;
13748
14030
  let count;
13749
14031
  // row selection
13750
- const rowsSelectedLength = table.getSelectedRowModel().rows.length;
14032
+ // use table state and not the selected row model because of the way server loading works
14033
+ const rowsSelectedLength = Object.keys(table.getState().rowSelection).length;
13751
14034
  if (rowsSelectedLength > 0) {
13752
14035
  label = texts.table.footer.summary.selected;
13753
14036
  count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(rowsSelectedLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
13754
- } else if ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
14037
+ } else if (!tableMeta.server.isEnabled && ((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length ||
13755
14038
  // filtered data
13756
- !!table.getState().globalFilter && table.options.enableGlobalFilter // search with hide enabled
13757
- ) {
14039
+ !!table.getState().globalFilter && table.options.enableGlobalFilter)) {
13758
14040
  label = texts.table.footer.summary.records;
13759
- count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, currentLength), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
14041
+ count = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(currentLength)), "\u00A0", texts.table.footer.summary.count, "\u00A0", /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length)));
13760
14042
  } else {
13761
14043
  label = texts.table.footer.summary.records;
13762
14044
  count = /*#__PURE__*/React__default.createElement("strong", null, new Intl.NumberFormat(locale).format(length));
@@ -13768,8 +14050,13 @@ function Summary(props) {
13768
14050
  }
13769
14051
 
13770
14052
  function Foot(props) {
13771
- const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
13772
- return /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
14053
+ const {
14054
+ children,
14055
+ table,
14056
+ ...attributes
14057
+ } = props;
14058
+ const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
14059
+ return /*#__PURE__*/React__default.createElement("tfoot", Object.assign({}, attributes), children, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
13773
14060
  key: header.id,
13774
14061
  header: header,
13775
14062
  index: index
@@ -13817,16 +14104,29 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
13817
14104
  });
13818
14105
 
13819
14106
  function EmptyStateBody(props) {
14107
+ var _ref$current, _ref$current$parentNo;
13820
14108
  const {
13821
14109
  emptyState: Placeholder,
14110
+ isReady,
13822
14111
  reason,
13823
14112
  ...attributes
13824
14113
  } = props;
14114
+ const ref = React__default.useRef(null);
14115
+ if (!isReady) {
14116
+ return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
14117
+ className: "!auto-rows-fr"
14118
+ }));
14119
+ }
13825
14120
  return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
13826
- className: "!auto-rows-fr"
14121
+ ref: ref,
14122
+ className: "!auto-rows-fr",
14123
+ "data-taco": "empty-state"
13827
14124
  }), /*#__PURE__*/React__default.createElement("tr", {
13828
- className: "!auto-rows-fr"
14125
+ className: "!auto-rows-fr "
13829
14126
  }, /*#__PURE__*/React__default.createElement("td", {
14127
+ style: {
14128
+ maxWidth: ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$parentNo = _ref$current.parentNode) === null || _ref$current$parentNo === void 0 ? void 0 : _ref$current$parentNo.clientWidth
14129
+ },
13830
14130
  className: "col-span-full !border-0 !p-0 hover:!bg-white"
13831
14131
  }, Placeholder ? /*#__PURE__*/React__default.createElement(Placeholder, {
13832
14132
  reason: reason
@@ -13845,6 +14145,7 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
13845
14145
  onClickFindPrevious: handleClickFindPrevious,
13846
14146
  settingsContent,
13847
14147
  shortcut,
14148
+ showTotal = true,
13848
14149
  value,
13849
14150
  ...attributes
13850
14151
  } = props;
@@ -13923,10 +14224,12 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
13923
14224
  }
13924
14225
  if (hasFind && isActive) {
13925
14226
  postfix = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
13926
- className: "text-grey-700 flex h-4 items-center border-r border-black/[0.25] pr-2"
13927
- }, loading ? /*#__PURE__*/React__default.createElement(Spinner, {
14227
+ className: "text-grey-700 flex h-4 items-center"
14228
+ }, loading ? (/*#__PURE__*/React__default.createElement(Spinner, {
13928
14229
  className: "h-4 w-4"
13929
- }) : `${findCurrent !== null && findCurrent !== void 0 ? findCurrent : 0}/${findTotal !== null && findTotal !== void 0 ? findTotal : 0}`), findCurrent ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
14230
+ })) : showTotal ? (/*#__PURE__*/React__default.createElement("span", {
14231
+ className: "border-r border-black/[0.25] pr-2"
14232
+ }, `${findCurrent !== null && findCurrent !== void 0 ? findCurrent : 0}/${findTotal !== null && findTotal !== void 0 ? findTotal : 0}`)) : null), findCurrent ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IconButton, {
13930
14233
  "aria-label": texts.searchInput.findPrevious,
13931
14234
  className: "scale-75 !bg-transparent hover:!bg-black/[0.08] [&>svg]:scale-125",
13932
14235
  icon: "chevron-up",
@@ -14030,6 +14333,7 @@ function Search$1(props) {
14030
14333
  const scrollTo = rowIndex => scrollToIndex(rowIndex, {
14031
14334
  align: 'center'
14032
14335
  });
14336
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
14033
14337
  React__default.useEffect(() => {
14034
14338
  if (tableMeta.search.highlightedColumnIndexes.length) {
14035
14339
  scrollTo(tableMeta.search.highlightedColumnIndexes[0][0]);
@@ -14038,9 +14342,11 @@ function Search$1(props) {
14038
14342
  const handleFocus = function () {
14039
14343
  try {
14040
14344
  const _temp = function () {
14041
- if (tableMeta.server.loadAllIfNeeded) {
14345
+ if (tableMeta.server.loadAllIfNeeded && !tableMeta.server._experimentalDataLoader2) {
14042
14346
  // don't pass the search query because we need all data - not filtered data
14043
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
14347
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns,
14348
+ // the old data loader doesn't have server side search
14349
+ undefined)).then(function () {});
14044
14350
  }
14045
14351
  }();
14046
14352
  // load all data if that is possible
@@ -14049,8 +14355,20 @@ function Search$1(props) {
14049
14355
  return Promise.reject(e);
14050
14356
  }
14051
14357
  };
14358
+ const [loading, setLoading] = React__default.useState(false);
14359
+ const searchTimeoutRef = React__default.useRef();
14052
14360
  const handleChange = query => {
14053
14361
  table.setGlobalFilter(String(query !== null && query !== void 0 ? query : ''));
14362
+ if (tableMeta.search.enableGlobalFilter && tableMeta.search.handleSearch) {
14363
+ clearTimeout(searchTimeoutRef.current);
14364
+ searchTimeoutRef.current = setTimeout(() => {
14365
+ var _tableMeta$search$han, _tableMeta$search;
14366
+ setLoading(true);
14367
+ (_tableMeta$search$han = (_tableMeta$search = tableMeta.search).handleSearch) === null || _tableMeta$search$han === void 0 ? void 0 : _tableMeta$search$han.call(_tableMeta$search, query, hiddenColumns).then(() => {
14368
+ setLoading(false);
14369
+ });
14370
+ }, 150);
14371
+ }
14054
14372
  };
14055
14373
  const handleToggleExcludeUnmatchedResults = enabled => {
14056
14374
  tableMeta.search.setEnableGlobalFilter(enabled, table);
@@ -14058,6 +14376,12 @@ function Search$1(props) {
14058
14376
  var _ref$current;
14059
14377
  return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
14060
14378
  });
14379
+ if (tableMeta.search.handleSearch) {
14380
+ setLoading(true);
14381
+ tableMeta.search.handleSearch(enabled ? query : undefined, hiddenColumns).then(() => {
14382
+ setLoading(false);
14383
+ });
14384
+ }
14061
14385
  };
14062
14386
  const handleNextResult = () => {
14063
14387
  if (!tableMeta.search.highlightedColumnIndexes.length) {
@@ -14101,7 +14425,7 @@ function Search$1(props) {
14101
14425
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
14102
14426
  findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
14103
14427
  findTotal: (_tableMeta$search$hig = (_tableMeta$search$hig2 = tableMeta.search.highlightedColumnIndexes) === null || _tableMeta$search$hig2 === void 0 ? void 0 : _tableMeta$search$hig2.length) !== null && _tableMeta$search$hig !== void 0 ? _tableMeta$search$hig : null,
14104
- loading: tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
14428
+ loading: tableMeta.server._experimentalDataLoader2 ? loading : tableMeta.server.loading,
14105
14429
  name: "table-search",
14106
14430
  onClickFindPrevious: handlePreviousResult,
14107
14431
  onClickFindNext: handleNextResult,
@@ -14116,6 +14440,7 @@ function Search$1(props) {
14116
14440
  meta: true,
14117
14441
  shift: false
14118
14442
  },
14443
+ showTotal: !tableMeta.server._experimentalDataLoader2,
14119
14444
  value: query
14120
14445
  }));
14121
14446
  }
@@ -14469,9 +14794,11 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
14469
14794
  var _collection$querySele;
14470
14795
  (_collection$querySele = collection.querySelector(`[aria-current]`)) === null || _collection$querySele === void 0 ? void 0 : _collection$querySele.removeAttribute('aria-current');
14471
14796
  option.setAttribute('aria-current', 'true');
14472
- option.scrollIntoView({
14473
- block: 'nearest'
14474
- });
14797
+ if (!props['aria-multiselectable']) {
14798
+ option.scrollIntoView({
14799
+ block: 'nearest'
14800
+ });
14801
+ }
14475
14802
  setActiveIndex(index);
14476
14803
  };
14477
14804
  const setActiveIndexByElement = React__default.useCallback(option => {
@@ -14793,14 +15120,16 @@ const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
14793
15120
  ref: ref,
14794
15121
  "data-taco": "tag"
14795
15122
  }), /*#__PURE__*/React__default.createElement("span", {
14796
- className: "truncate px-2",
15123
+ className: "flex items-center truncate px-2",
14797
15124
  ref: textRef
14798
15125
  }, icon ? typeof icon === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
14799
15126
  name: icon,
14800
- className: "-ml-1 -mt-0.5 mr-1 !h-5 !w-5"
15127
+ className: "-ml-1 mr-1 !h-5 !w-5"
14801
15128
  })) : (/*#__PURE__*/React__default.cloneElement(icon, {
14802
- className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5'
14803
- })) : null, children), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
15129
+ className: cn(icon.props.className, 'mr-1 -ml-1')
15130
+ })) : null, /*#__PURE__*/React__default.createElement("span", {
15131
+ className: "truncate"
15132
+ }, children)), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
14804
15133
  name: "close",
14805
15134
  onClick: onDelete,
14806
15135
  className: "-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
@@ -15077,12 +15406,13 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
15077
15406
  }), hasValue ? (/*#__PURE__*/React__default.createElement(Icon, {
15078
15407
  name: "tick",
15079
15408
  className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible"
15080
- })) : null, isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
15409
+ })) : null, typeof children !== 'string' ? (/*#__PURE__*/React__default.createElement("span", null, children)) : isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
15081
15410
  className: "pointer-events-none my-1",
15082
15411
  color: color,
15083
15412
  icon: prefix
15084
15413
  }, children)) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, prefix ? typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
15085
- name: prefix
15414
+ name: prefix,
15415
+ className: "!h-5 !w-5"
15086
15416
  }) : prefix : null, /*#__PURE__*/React__default.createElement("span", {
15087
15417
  className: "flex w-full justify-between"
15088
15418
  }, /*#__PURE__*/React__default.createElement("span", {
@@ -15091,9 +15421,10 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
15091
15421
  className: "text-grey-700 -mt-1.5 mb-1.5 text-xs"
15092
15422
  }, description) : null), /*#__PURE__*/React__default.createElement("span", {
15093
15423
  className: "flex flex-col self-center"
15094
- }, postfix ? typeof postfix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
15095
- name: postfix
15096
- }) : postfix : null)))), popover ? (/*#__PURE__*/React__default.createElement(IconButton, {
15424
+ }, postfix ? typeof postfix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
15425
+ name: postfix,
15426
+ className: "!h-5 !w-5"
15427
+ })) : postfix : null)))), popover ? (/*#__PURE__*/React__default.createElement(IconButton, {
15097
15428
  icon: "ellipsis-vertical",
15098
15429
  appearance: "discrete",
15099
15430
  className: cn('group-aria-current:visible invisible -mr-1 ml-auto !h-5 min-h-[theme(spacing.6)] !w-5 min-w-[theme(spacing.6)] hover:!bg-black/[.08] focus:!shadow-none group-hover:visible', {
@@ -15259,7 +15590,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
15259
15590
  readOnly,
15260
15591
  tags
15261
15592
  } = useSelect2Context();
15262
- const contentClassName = cn('truncate items-center gap-1');
15593
+ const contentClassName = cn('truncate flex items-center gap-1');
15263
15594
  const currentValue = children.find(matchesValue(value));
15264
15595
  let output;
15265
15596
  if (placeholder && currentValue === undefined) {
@@ -15269,13 +15600,13 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
15269
15600
  }, placeholder);
15270
15601
  } else if (currentValue) {
15271
15602
  if (tags && emptyValue !== value) {
15272
- output = /*#__PURE__*/React__default.createElement(Tag$1, {
15603
+ if (typeof currentValue.props.children === 'string') output = /*#__PURE__*/React__default.createElement(Tag$1, {
15273
15604
  className: "truncate",
15274
15605
  color: currentValue.props.color,
15275
15606
  disabled: disabled,
15276
15607
  icon: currentValue.props.prefix,
15277
15608
  readOnly: readOnly
15278
- }, currentValue.props.children);
15609
+ }, currentValue.props.children);else output = currentValue.props.children;
15279
15610
  } else {
15280
15611
  output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, currentValue.props.prefix ? typeof currentValue.props.prefix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
15281
15612
  name: currentValue.props.prefix,
@@ -15326,7 +15657,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
15326
15657
  }, valuesAsChildren.length === 0 ? (/*#__PURE__*/React__default.createElement(Placeholder, {
15327
15658
  disabled: disabled,
15328
15659
  readOnly: readOnly
15329
- }, placeholder)) : valuesAsChildren.map(child => (/*#__PURE__*/React__default.createElement(Tag$1, {
15660
+ }, placeholder)) : valuesAsChildren.map(child => typeof child.props.children === 'string' ? (/*#__PURE__*/React__default.createElement(Tag$1, {
15330
15661
  key: String(child.props.value),
15331
15662
  className: "truncate",
15332
15663
  color: tags ? child.props.color : undefined,
@@ -15340,7 +15671,23 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
15340
15671
  }
15341
15672
  },
15342
15673
  readOnly: readOnly
15343
- }, child.props.children)))));
15674
+ }, child.props.children)) : (/*#__PURE__*/React__default.cloneElement(child.props.children, {
15675
+ key: String(child.props.value),
15676
+ className: '!pr-0 !pl-1.5',
15677
+ children: (/*#__PURE__*/React__default.createElement("span", {
15678
+ className: "flex items-center"
15679
+ }, child.props.children.props.children, /*#__PURE__*/React__default.createElement(Icon, {
15680
+ name: "close",
15681
+ onClick: event => {
15682
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
15683
+ event === null || event === void 0 ? void 0 : event.preventDefault();
15684
+ if (!disabled && !readOnly) {
15685
+ setValue(child.props.value);
15686
+ }
15687
+ },
15688
+ className: "ml-0.5 !h-5 !w-5 shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
15689
+ })))
15690
+ })))));
15344
15691
  } else {
15345
15692
  content = /*#__PURE__*/React__default.createElement(MultipleValue, {
15346
15693
  onClick: forwardClick,
@@ -15371,6 +15718,18 @@ const MultipleValue = ({
15371
15718
  } = useSelect2Context();
15372
15719
  const [contentRef, setContentRef] = React__default.useState(null);
15373
15720
  const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;
15721
+ // Retrieves the relevant text content from any JSX.Element passed as a select option, handling nested elements, arrays, and direct text
15722
+ const getTooltipTitle = child => {
15723
+ const children = child.props.children;
15724
+ if (typeof children === 'string') return children;
15725
+ if (typeof children.props.children === 'string') {
15726
+ return children.props.children;
15727
+ }
15728
+ if (Array.isArray(children.props.children)) {
15729
+ return children.props.children.filter(item => typeof item === 'string');
15730
+ }
15731
+ return '';
15732
+ };
15374
15733
  return /*#__PURE__*/React__default.createElement("div", {
15375
15734
  className: "relative flex w-full items-center gap-1 overflow-hidden",
15376
15735
  onClick: onClick
@@ -15381,26 +15740,35 @@ const MultipleValue = ({
15381
15740
  disabled: disabled,
15382
15741
  readOnly: readOnly
15383
15742
  }, placeholder)) : valuesAsChildren.map((child, index) => {
15384
- const tag = /*#__PURE__*/React__default.createElement(Tag$1, {
15385
- key: String(child.props.value),
15743
+ const classNames = {
15744
+ truncate: index === boundaryIndex,
15745
+ hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
15746
+ };
15747
+ let output;
15748
+ if (typeof child.props.children === 'string') {
15749
+ output = /*#__PURE__*/React__default.createElement(Tag$1, {
15750
+ key: String(child.props.value),
15751
+ className: cn('cursor-pointer', classNames),
15752
+ color: tags ? child.props.color : undefined,
15753
+ disabled: disabled,
15754
+ icon: child.props.prefix,
15755
+ readOnly: readOnly
15756
+ }, child.props.children);
15757
+ } else output = /*#__PURE__*/React__default.cloneElement(child.props.children, {
15386
15758
  className: cn('cursor-pointer', {
15387
- truncate: index === boundaryIndex,
15388
- hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
15389
- }),
15390
- color: tags ? child.props.color : undefined,
15391
- disabled: disabled,
15392
- icon: child.props.prefix,
15393
- readOnly: readOnly
15394
- }, child.props.children);
15759
+ 'shrink-0': index !== boundaryIndex
15760
+ }, classNames),
15761
+ key: String(child.props.value)
15762
+ });
15395
15763
  if (index === boundaryIndex) {
15396
15764
  return /*#__PURE__*/React__default.createElement(Tooltip, {
15397
15765
  key: String(child.props.value),
15398
- title: String(child.props.children)
15399
- }, tag);
15766
+ title: String(getTooltipTitle(child))
15767
+ }, output);
15400
15768
  }
15401
- return tag;
15769
+ return output;
15402
15770
  })), boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (/*#__PURE__*/React__default.createElement(Tooltip, {
15403
- title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(child.props.children) : '').join(', ')
15771
+ title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(getTooltipTitle(child)) : '').join(', ')
15404
15772
  }, /*#__PURE__*/React__default.createElement(Badge, {
15405
15773
  className: "flex-shrink-0"
15406
15774
  }, "+", valuesAsChildren.length - (boundaryIndex + 1)))) : null);
@@ -15465,7 +15833,7 @@ const BubbleSelect = props => {
15465
15833
  if (prevValue !== value && setValue) {
15466
15834
  if (Array.isArray(value)) {
15467
15835
  value.forEach(v => {
15468
- const option = select.querySelector(`option[value='${v}']`);
15836
+ const option = select.querySelector(`option[value='${CSS.escape(v)}']`);
15469
15837
  if (option) {
15470
15838
  option.selected = true;
15471
15839
  }
@@ -15593,20 +15961,19 @@ const useChildren = ({
15593
15961
  };
15594
15962
 
15595
15963
  const getNextColor = options => {
15596
- const occurrences = AVAILABLE_COLORS.reduce((prev, color) => {
15597
- if (color !== 'transparent') {
15598
- return {
15599
- ...prev,
15600
- [color]: 0
15601
- };
15602
- }
15603
- return prev;
15604
- }, {});
15605
- options.forEach(option => {
15964
+ let occurrences = {};
15965
+ AVAILABLE_COLORS.filter(color => color !== 'transparent').forEach(color => {
15966
+ occurrences = {
15967
+ ...occurrences,
15968
+ [color]: 0
15969
+ };
15970
+ });
15971
+ options.reduce((occurrences, option) => {
15606
15972
  if (option.props.color) {
15607
15973
  occurrences[option.props.color] = occurrences[option.props.color] ? occurrences[option.props.color] + 1 : 1;
15608
15974
  }
15609
- });
15975
+ return occurrences;
15976
+ }, occurrences);
15610
15977
  const colors = Object.keys(occurrences);
15611
15978
  if (colors.length) {
15612
15979
  return colors.sort((a, b) => occurrences[a] - occurrences[b])[0];
@@ -16160,8 +16527,9 @@ function Print$1(props) {
16160
16527
  const toastRef = toast.loading(texts.table.print.loading);
16161
16528
  const _temp2 = function () {
16162
16529
  if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
16530
+ const hiddenColumns = getHiddenColumns(table.getState().columnVisibility);
16163
16531
  const _temp = _catch(function () {
16164
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
16532
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, hiddenColumns, tableMeta.search.enableGlobalFilter ? table.getState().globalFilter : undefined)).then(function () {});
16165
16533
  }, function (error) {
16166
16534
  const errorMessage = `${texts.table.print.error}: ${error}`;
16167
16535
  console.error(errorMessage);
@@ -16275,10 +16643,11 @@ function guessComparatorsBasedOnControl(column) {
16275
16643
  return getDataTypeProperties(columnMeta.dataType).filterComparators;
16276
16644
  }
16277
16645
 
16646
+ const FilterContext = /*#__PURE__*/React__default.createContext([]);
16647
+
16278
16648
  const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
16279
16649
  const {
16280
16650
  allColumns,
16281
- filters,
16282
16651
  onChange: handleChange,
16283
16652
  value = null,
16284
16653
  ...attributes
@@ -16286,6 +16655,7 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
16286
16655
  const {
16287
16656
  texts
16288
16657
  } = useLocalization();
16658
+ const filters = React__default.useContext(FilterContext);
16289
16659
  const selectedColumn = allColumns.find(column => column.id === value);
16290
16660
  const warning = selectedColumn && !selectedColumn.getIsVisible();
16291
16661
  return /*#__PURE__*/React__default.createElement("div", {
@@ -16451,6 +16821,7 @@ function Control(props) {
16451
16821
  } = props;
16452
16822
  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;
16453
16823
  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;
16824
+ const filters = React__default.useContext(FilterContext);
16454
16825
  const ref = React__default.useRef(null);
16455
16826
  React.useEffect(() => {
16456
16827
  // 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
@@ -16464,7 +16835,7 @@ function Control(props) {
16464
16835
  setValue: value => onChange(value),
16465
16836
  value,
16466
16837
  ref
16467
- }), {
16838
+ }, undefined, filters), {
16468
16839
  ['data-query-selector']: querySelector,
16469
16840
  className: 'focus:yt-focus'
16470
16841
  });
@@ -16506,7 +16877,6 @@ function Filter$1(props) {
16506
16877
  const {
16507
16878
  allColumns,
16508
16879
  filter,
16509
- filters,
16510
16880
  onChange: handleChange,
16511
16881
  onRemove,
16512
16882
  position
@@ -16581,7 +16951,6 @@ function Filter$1(props) {
16581
16951
  className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
16582
16952
  }, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
16583
16953
  allColumns: allColumns,
16584
- filters: filters,
16585
16954
  onChange: handleChangeColumn,
16586
16955
  value: id,
16587
16956
  ref: ref
@@ -16685,7 +17054,9 @@ function ManageFiltersPopover(props) {
16685
17054
  };
16686
17055
  return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
16687
17056
  onChange: handleClose
16688
- }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
17057
+ }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(FilterContext.Provider, {
17058
+ value: filters
17059
+ }, /*#__PURE__*/React__default.createElement("div", {
16689
17060
  className: "flex w-[40rem] flex-col gap-4"
16690
17061
  }, /*#__PURE__*/React__default.createElement("div", {
16691
17062
  className: "flex h-8"
@@ -16701,7 +17072,6 @@ function ManageFiltersPopover(props) {
16701
17072
  key: `filter_${index}`,
16702
17073
  allColumns: allColumns,
16703
17074
  filter: filter,
16704
- filters: filters,
16705
17075
  position: index,
16706
17076
  onChange: handleChangeFilter,
16707
17077
  onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
@@ -16717,7 +17087,7 @@ function ManageFiltersPopover(props) {
16717
17087
  }, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
16718
17088
  appearance: "primary",
16719
17089
  onClick: handleApply
16720
- }, texts.table.filters.buttons.apply)))));
17090
+ }, texts.table.filters.buttons.apply))))));
16721
17091
  }
16722
17092
 
16723
17093
  function Filters(props) {
@@ -16820,7 +17190,7 @@ function Table(props) {
16820
17190
  }
16821
17191
  Table.Toolbar = TableToolbar;
16822
17192
  Table.Grid = TableGrid;
16823
- function getFilterReason(table) {
17193
+ function getEmptyStateReason(table) {
16824
17194
  if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {
16825
17195
  const state = table.instance.getState();
16826
17196
  if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {
@@ -16837,13 +17207,14 @@ function TableGrid(props) {
16837
17207
  var _table$state$grouping;
16838
17208
  const {
16839
17209
  enableHorizontalArrowKeyNavigation,
17210
+ footerRows,
16840
17211
  table,
16841
17212
  ...attributes
16842
17213
  } = props;
16843
17214
  const handleFocus = table.meta.rowActive.rowActiveIndex === undefined ? event => {
16844
17215
  table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
16845
17216
  } : undefined;
16846
- const filterReason = getFilterReason(table);
17217
+ const emptyStateReason = getEmptyStateReason(table);
16847
17218
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("style", null, table.stylesheet), /*#__PURE__*/React__default.createElement(focus.FocusScope, null, /*#__PURE__*/React__default.createElement("table", Object.assign({}, attributes, {
16848
17219
  id: table.id,
16849
17220
  "data-table-font-size": table.meta.fontSize.size,
@@ -16864,9 +17235,10 @@ function TableGrid(props) {
16864
17235
  key: props.id,
16865
17236
  header: props,
16866
17237
  scrollToIndex: table.renderer.scrollToIndex
16867
- }))))))), filterReason ? (/*#__PURE__*/React__default.createElement(EmptyStateBody, {
17238
+ }))))))), emptyStateReason ? (/*#__PURE__*/React__default.createElement(EmptyStateBody, {
16868
17239
  emptyState: props.table.props.emptyState,
16869
- reason: filterReason
17240
+ isReady: table.meta.server.isEnabled ? table.meta.server.isReady : true,
17241
+ reason: emptyStateReason
16870
17242
  })) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
16871
17243
  enableHorizontalArrowKeyNavigation: enableHorizontalArrowKeyNavigation,
16872
17244
  table: table.instance,
@@ -16878,12 +17250,11 @@ function TableGrid(props) {
16878
17250
  } : table.renderer.style
16879
17251
  }, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
16880
17252
  table: table.instance
16881
- }) : null)))));
17253
+ }, footerRows) : null)))));
16882
17254
  }
16883
17255
 
16884
- function Column$1(_) {
16885
- return null;
16886
- }
17256
+ const Column$1 = () => null;
17257
+ Column$1.displayName = 'Table3Column';
16887
17258
  function Group$4(_) {
16888
17259
  return null;
16889
17260
  }
@@ -18471,19 +18842,26 @@ const shortcut = {
18471
18842
  meta: true,
18472
18843
  shift: false
18473
18844
  };
18845
+ function isTableScrolled(ref) {
18846
+ if (ref.current) {
18847
+ var _ref$current, _ref$current$querySel, _ref$current2, _ref$current2$querySe;
18848
+ const height = parseFloat(((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : (_ref$current$querySel = _ref$current.querySelector('tbody')) === null || _ref$current$querySel === void 0 ? void 0 : _ref$current$querySel.style.height) || '0') + parseFloat(((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$querySe = _ref$current2.querySelector('tbody')) === null || _ref$current2$querySe === void 0 ? void 0 : _ref$current2$querySe.style.paddingBottom) || '0');
18849
+ return height > ref.current.scrollHeight;
18850
+ }
18851
+ return false;
18852
+ }
18474
18853
 
18475
18854
  function useTableEditingListener(table, tableRef, scrollToIndex) {
18476
18855
  const tableMeta = table.options.meta;
18477
18856
  const localization = useLocalization();
18478
- // save when the row changes
18479
- // store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again
18480
- const lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
18481
18857
  useLazyEffect(() => {
18482
- if (tableMeta.editing.isEditing && lastRowActiveIndexRef.current !== undefined && tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {
18483
- lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;
18484
- tableMeta.editing.saveChanges(table);
18485
- }
18486
- }, [tableMeta.rowActive.rowActiveIndex, tableMeta.editing.saveChanges]);
18858
+ return () => {
18859
+ if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== undefined) {
18860
+ var _table$getRowModel$ro;
18861
+ tableMeta.editing.saveChanges(table, (_table$getRowModel$ro = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id);
18862
+ }
18863
+ };
18864
+ }, [tableMeta.rowActive.rowActiveIndex]);
18487
18865
  // show a warning if the user navigates away without triggering save, such as using the browser back/forward button
18488
18866
  const hasChanges = tableMeta.editing.hasChanges();
18489
18867
  React__default.useEffect(() => {
@@ -18509,9 +18887,9 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
18509
18887
  const onClickOutside = event => {
18510
18888
  if (tableMeta.editing.isEditing) {
18511
18889
  const element = event.target;
18512
- const insideTable = element.getAttribute('data-taco') === 'backdrop' || element.getAttribute('data-table') === 'editing-toggle' || isElementInsideOrTriggeredFromContainer(element, tableRef.current);
18890
+ const isTableOrIsInsideTable = element.tagName === 'TABLE' || element.tagName === 'TBODY' || element.getAttribute('data-taco') === 'backdrop' || element.getAttribute('data-table') === 'editing-toggle' || !document.body.contains(element) || isElementInsideOrTriggeredFromContainer(element, tableRef.current);
18513
18891
  // users can click the white space below rows which could be inside the table, but a valid scenario to save
18514
- if (!insideTable || element.tagName === 'TABLE' || element.tagName === 'TBODY') {
18892
+ if (!isTableOrIsInsideTable) {
18515
18893
  tableMeta.editing.saveChanges(table);
18516
18894
  }
18517
18895
  }
@@ -18519,18 +18897,21 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
18519
18897
  document.addEventListener('click', onClickOutside);
18520
18898
  return () => document.removeEventListener('click', onClickOutside);
18521
18899
  }, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
18522
- const rows = table.getRowModel().rows;
18523
- // make sure pending changes are removed for rows that no longer exist
18524
- useLazyEffect(() => {
18525
- const pendingChanges = tableMeta.editing.getErrorsShownInAlert();
18526
- pendingChanges.forEach(pendingChange => {
18527
- try {
18528
- table.getRow(pendingChange.rowId);
18529
- } catch {
18530
- tableMeta.editing.discardChanges(pendingChange.rowId, table);
18531
- }
18532
- });
18533
- }, [rows.length]);
18900
+ /*
18901
+ const rows = table.getRowModel().rows;
18902
+ // make sure pending changes are removed for rows that no longer exist
18903
+ useLazyEffect(() => {
18904
+ const pendingChanges = tableMeta.editing.getErrorsShownInAlert();
18905
+ pendingChanges.forEach(pendingChange => {
18906
+ try {
18907
+ table.getRow(pendingChange.rowId);
18908
+ } catch {
18909
+ // TODO: this has the potential to remove changes for "unloaded" rows in server loading
18910
+ //tableMeta.editing.discardChanges(pendingChange.rowId, table);
18911
+ }
18912
+ });
18913
+ }, [rows.length]);
18914
+ */
18534
18915
  // shortcuts
18535
18916
  useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
18536
18917
  event.preventDefault();
@@ -18558,6 +18939,7 @@ function reducer$2(state, action) {
18558
18939
  {
18559
18940
  const {
18560
18941
  columnId,
18942
+ index,
18561
18943
  row,
18562
18944
  value
18563
18945
  } = payload;
@@ -18567,7 +18949,8 @@ function reducer$2(state, action) {
18567
18949
  ...state.changes,
18568
18950
  rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
18569
18951
  originals: setWith(state.changes.originals, rowId, row, Object)
18570
- }
18952
+ },
18953
+ indexes: setWith(state.indexes, rowId, index, Object)
18571
18954
  };
18572
18955
  }
18573
18956
  case 'removeCellValue':
@@ -18601,6 +18984,7 @@ function reducer$2(state, action) {
18601
18984
  {
18602
18985
  const {
18603
18986
  cellErrors,
18987
+ index,
18604
18988
  moveReasons,
18605
18989
  original,
18606
18990
  value
@@ -18610,12 +18994,13 @@ function reducer$2(state, action) {
18610
18994
  changes: {
18611
18995
  ...state.changes,
18612
18996
  rows: setWith(state.changes.rows, rowId, value, Object),
18613
- errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors.cells[rowId], Object),
18997
+ errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors[rowId], Object),
18614
18998
  originals: setWith(state.changes.originals, rowId, original !== null && original !== void 0 ? original : state.changes.originals[rowId], Object),
18615
18999
  moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
18616
19000
  // status can be undefined, so don't use ??
18617
19001
  status: setWith(state.changes.status, rowId, undefined, Object)
18618
- }
19002
+ },
19003
+ indexes: setWith(state.indexes, rowId, index, Object)
18619
19004
  };
18620
19005
  }
18621
19006
  case 'removeRow':
@@ -18633,6 +19018,7 @@ function reducer$2(state, action) {
18633
19018
  originals: omit(state.changes.originals, rowId),
18634
19019
  status: omit(state.changes.status, rowId)
18635
19020
  },
19021
+ indexes: omit(state.indexes, rowId),
18636
19022
  temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
18637
19023
  };
18638
19024
  }
@@ -18662,9 +19048,10 @@ function reducer$2(state, action) {
18662
19048
  }
18663
19049
  };
18664
19050
  }
18665
- case 'createRow':
19051
+ case 'insertTemporaryRow':
18666
19052
  {
18667
19053
  const {
19054
+ index,
18668
19055
  value
18669
19056
  } = payload;
18670
19057
  return {
@@ -18674,14 +19061,36 @@ function reducer$2(state, action) {
18674
19061
  ...state.changes,
18675
19062
  rows: setWith(state.changes.rows, rowId, value, Object),
18676
19063
  originals: setWith(state.changes.originals, rowId, value, Object)
18677
- }
19064
+ },
19065
+ indexes: setWith(state.indexes, rowId, index, Object)
18678
19066
  };
18679
19067
  }
18680
19068
  default:
18681
19069
  return state;
18682
19070
  }
18683
19071
  }
18684
- function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
19072
+ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator) {
19073
+ const discardChanges = function (rowId, table) {
19074
+ try {
19075
+ // remove any new rows from pinned state before discarding them
19076
+ table.resetRowPinning(true);
19077
+ dispatch({
19078
+ type: 'removeRow',
19079
+ rowId,
19080
+ payload: {
19081
+ rowIdentityAccessor
19082
+ }
19083
+ });
19084
+ const _temp8 = function () {
19085
+ if (typeof handleDiscard === 'function') {
19086
+ return Promise.resolve(handleDiscard()).then(function () {});
19087
+ }
19088
+ }();
19089
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function () {}) : void 0);
19090
+ } catch (e) {
19091
+ return Promise.reject(e);
19092
+ }
19093
+ };
18685
19094
  const saveChanges = function (table, rowId = undefined) {
18686
19095
  try {
18687
19096
  let _exit = false;
@@ -18694,35 +19103,38 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18694
19103
  [rowId]: state.changes.rows[rowId]
18695
19104
  } : state.changes.rows;
18696
19105
  let completed = true;
18697
- const _temp9 = _forOf(Object.keys(changes), function (rowId) {
19106
+ const _temp7 = _forOf(Object.keys(changes), function (rowId) {
18698
19107
  const status = getRowStatus(rowId);
18699
19108
  return _catch(function () {
18700
- function _temp8(_result) {
19109
+ var _changes$rowId;
19110
+ function _temp6(_result) {
18701
19111
  return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
18702
19112
  // cleanup changes, we don't need them after saving
18703
- discardChanges(rowId, table);
18704
- // show the saved status, then remove it after a delay
18705
- setRowStatus(rowId, 'saved');
18706
- setTimeout(() => {
18707
- setRowStatus(rowId, undefined);
18708
- }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
19113
+ return Promise.resolve(discardChanges(rowId, table)).then(function () {
19114
+ // show the saved status, then remove it after a delay
19115
+ setRowStatus(rowId, 'saved');
19116
+ setTimeout(() => {
19117
+ setRowStatus(rowId, undefined);
19118
+ }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
19119
+ });
18709
19120
  });
18710
19121
  }
19122
+ const rowChanges = (_changes$rowId = changes[rowId]) !== null && _changes$rowId !== void 0 ? _changes$rowId : {};
18711
19123
  // don't try to save if - already saving, or there are known errors
18712
- if (status === 'saving' || status === 'errored') {
19124
+ if (!Object.keys(rowChanges).length || status === 'saving' || status === 'errored') {
18713
19125
  return;
18714
19126
  }
18715
19127
  setRowStatus(rowId, 'saving');
18716
19128
  const changeSet = {
18717
19129
  ...state.changes.originals[rowId],
18718
- ...changes[rowId]
19130
+ ...rowChanges
18719
19131
  };
18720
19132
  // if we had to create a temporary id, delete it first - it's our data, not theirs
18721
19133
  if (isTemporaryRow(changeSet[rowIdentityAccessor])) {
18722
19134
  delete changeSet[rowIdentityAccessor];
18723
19135
  }
18724
19136
  // re-run validation, maybe a cell is already invalid but has never been blurred
18725
- const _temp7 = function () {
19137
+ const _temp5 = function () {
18726
19138
  if (validator) {
18727
19139
  return Promise.resolve(validator(changeSet)).then(function (errors) {
18728
19140
  if (errors && Object.keys(errors).length) {
@@ -18731,7 +19143,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18731
19143
  });
18732
19144
  }
18733
19145
  }();
18734
- return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7); // send new data to the server
19146
+ return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5); // send new data to the server
18735
19147
  }, function (error) {
18736
19148
  var _error$response;
18737
19149
  if (error instanceof ReferenceError || error instanceof TypeError || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) >= 500) {
@@ -18771,18 +19183,18 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18771
19183
  }, function () {
18772
19184
  return _exit;
18773
19185
  });
18774
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function (_result3) {
19186
+ return Promise.resolve(_temp7 && _temp7.then ? _temp7.then(function (_result3) {
18775
19187
  return _exit ? _result3 : completed;
18776
- }) : _exit ? _temp9 : completed);
19188
+ }) : _exit ? _temp7 : completed);
18777
19189
  } catch (e) {
18778
19190
  return Promise.reject(e);
18779
19191
  }
18780
19192
  };
18781
- const onCellChanged = function (cell, rowIndex, shouldRunUpdaters = true) {
19193
+ const onCellChanged = function (cell, rowIndex, nextValue, shouldRunUpdaters = true) {
18782
19194
  try {
18783
- function _temp6() {
19195
+ function _temp4() {
18784
19196
  var _state$changes$errors11;
18785
- function _temp4() {
19197
+ function _temp2() {
18786
19198
  // only set errors and move reasons for the cells we're currently acting on
18787
19199
  // why? because the UX is not good if we set them for cells the user hasn't touched yet
18788
19200
  const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
@@ -18813,6 +19225,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18813
19225
  rowId: cell.row.id,
18814
19226
  payload: {
18815
19227
  cellErrors: nextCellErrors,
19228
+ index: rowIndex,
18816
19229
  moveReasons: nextMoveReasons,
18817
19230
  value: nextChanges
18818
19231
  }
@@ -18820,7 +19233,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18820
19233
  }
18821
19234
  // create a projection of the next state, so we can act against it
18822
19235
  const nextChanges = {
18823
- ...state.changes.rows[cell.row.id],
19236
+ ...changes,
18824
19237
  ...updatesForOtherCells
18825
19238
  };
18826
19239
  const nextMoveReasons = {
@@ -18829,29 +19242,35 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18829
19242
  const nextCellErrors = {
18830
19243
  ...((_state$changes$errors11 = state.changes.errors[cell.row.id]) === null || _state$changes$errors11 === void 0 ? void 0 : _state$changes$errors11.cells)
18831
19244
  };
18832
- // run validation
19245
+ // run validation - if there are changes, and if there is an original stored
18833
19246
  let validationErrors = {};
18834
- const _temp3 = function () {
18835
- if (validator) {
19247
+ const _temp = function () {
19248
+ if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
19249
+ // merge with the original so we get a full row
18836
19250
  const nextRowValue = {
18837
19251
  ...state.changes.originals[cell.row.id],
18838
19252
  ...changes,
18839
19253
  ...updatesForOtherCells
18840
19254
  };
18841
- return Promise.resolve(validator(nextRowValue)).then(function (_validator2) {
18842
- validationErrors = _validator2 !== null && _validator2 !== void 0 ? _validator2 : {};
19255
+ return Promise.resolve(validator(nextRowValue)).then(function (_validator) {
19256
+ validationErrors = _validator !== null && _validator !== void 0 ? _validator : {};
18843
19257
  });
18844
19258
  }
18845
19259
  }();
18846
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
19260
+ return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
18847
19261
  }
18848
- const changes = state.changes.rows[cell.row.id];
18849
- if (!changes) {
19262
+ const changes = nextValue !== undefined ? {
19263
+ ...state.changes.rows[cell.row.id],
19264
+ [cell.column.id]: nextValue
19265
+ } : {
19266
+ ...state.changes.rows[cell.row.id]
19267
+ };
19268
+ if (!Object.keys(changes).length) {
18850
19269
  return Promise.resolve();
18851
19270
  }
18852
19271
  let updatesForOtherCells = {};
18853
19272
  // run the updater handler if there is one, to see if there are any other cells to update
18854
- const _temp5 = function () {
19273
+ const _temp3 = function () {
18855
19274
  if (typeof handleChange === 'function' && shouldRunUpdaters) {
18856
19275
  const previousRowValue = {
18857
19276
  ...state.changes.originals[cell.row.id]
@@ -18865,42 +19284,11 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18865
19284
  });
18866
19285
  }
18867
19286
  }();
18868
- return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
19287
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
18869
19288
  } catch (e) {
18870
19289
  return Promise.reject(e);
18871
19290
  }
18872
19291
  }; // general
18873
- // rows
18874
- const setRowValue = function (rowId, original, value) {
18875
- try {
18876
- function _temp2() {
18877
- dispatch({
18878
- type: 'updateRow',
18879
- rowId,
18880
- payload: {
18881
- cellErrors,
18882
- original,
18883
- value
18884
- }
18885
- });
18886
- }
18887
- let cellErrors;
18888
- const _temp = function () {
18889
- if (validator) {
18890
- const row = {
18891
- ...original,
18892
- ...value
18893
- };
18894
- return Promise.resolve(validator(row)).then(function (_validator) {
18895
- cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
18896
- });
18897
- }
18898
- }();
18899
- return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
18900
- } catch (e) {
18901
- return Promise.reject(e);
18902
- }
18903
- };
18904
19292
  const localization = useLocalization();
18905
19293
  const [state, dispatch] = React__default.useReducer(reducer$2, {
18906
19294
  changes: {
@@ -18910,8 +19298,10 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18910
19298
  originals: {},
18911
19299
  status: {}
18912
19300
  },
19301
+ indexes: {},
18913
19302
  temporaryRows: []
18914
19303
  });
19304
+ // rows
18915
19305
  function getRowValue(rowId) {
18916
19306
  var _state$changes$rows$r, _state$changes$rows;
18917
19307
  return (_state$changes$rows$r = (_state$changes$rows = state.changes.rows) === null || _state$changes$rows === void 0 ? void 0 : _state$changes$rows[rowId]) !== null && _state$changes$rows$r !== void 0 ? _state$changes$rows$r : undefined;
@@ -18949,23 +19339,24 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18949
19339
  }
18950
19340
  });
18951
19341
  }
18952
- function createRow(data) {
19342
+ function insertTemporaryRow(data, rowIndex) {
18953
19343
  const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
18954
19344
  const value = {
18955
19345
  ...data,
18956
19346
  [rowIdentityAccessor]: newRowId
18957
19347
  };
18958
19348
  dispatch({
18959
- type: 'createRow',
19349
+ type: 'insertTemporaryRow',
18960
19350
  rowId: newRowId,
18961
19351
  payload: {
19352
+ index: rowIndex,
18962
19353
  value
18963
19354
  }
18964
19355
  });
18965
19356
  return newRowId;
18966
19357
  }
18967
19358
  // cells
18968
- function setCellValue(cell, value) {
19359
+ function setCellValue(cell, rowIndex, value) {
18969
19360
  const rowId = cell.row.id;
18970
19361
  const columnId = cell.column.id;
18971
19362
  // update if the change is different to the original value
@@ -18975,6 +19366,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
18975
19366
  rowId,
18976
19367
  payload: {
18977
19368
  columnId,
19369
+ index: rowIndex,
18978
19370
  row: cell.row.original,
18979
19371
  value
18980
19372
  }
@@ -19007,6 +19399,7 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
19007
19399
  }
19008
19400
  return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
19009
19401
  rowId,
19402
+ index: state.indexes[rowId],
19010
19403
  changes: state.changes.rows[rowId],
19011
19404
  errors: state.changes.errors[rowId]
19012
19405
  }));
@@ -19017,20 +19410,8 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
19017
19410
  function hasChanges(rowId) {
19018
19411
  return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
19019
19412
  }
19020
- function discardChanges(rowId, table) {
19021
- // remove any new rows from pinned state before discarding them
19022
- table.resetRowPinning(true);
19023
- dispatch({
19024
- type: 'removeRow',
19025
- rowId,
19026
- payload: {
19027
- rowIdentityAccessor
19028
- }
19029
- });
19030
- }
19031
19413
  return {
19032
19414
  // row
19033
- setRowValue,
19034
19415
  getRowValue,
19035
19416
  getRowMoveReason,
19036
19417
  hasRowErrors,
@@ -19050,12 +19431,66 @@ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, v
19050
19431
  discardChanges,
19051
19432
  hasSaved,
19052
19433
  // new rows
19053
- createRow,
19434
+ insertTemporaryRow,
19054
19435
  temporaryRows: state.temporaryRows
19055
19436
  };
19056
19437
  }
19057
19438
 
19058
- function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentityAccessor, validator) {
19439
+ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCreate, handleDiscard, rowIdentityAccessor, validator) {
19440
+ const createRow = function (table, row) {
19441
+ try {
19442
+ let _exit = false;
19443
+ function _temp2(_result) {
19444
+ if (_exit) return _result;
19445
+ const changeset = row !== null && row !== void 0 ? row : handleCreate();
19446
+ try {
19447
+ if (changeset) {
19448
+ // set the active row to the new row before toggling editing on
19449
+ const temporaryRows = tableMeta.editing.temporaryRows;
19450
+ const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
19451
+ const newRowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
19452
+ // prep the row
19453
+ table.setRowPinning(currentState => {
19454
+ var _ref, _currentState$bottom;
19455
+ return {
19456
+ ...currentState,
19457
+ bottom: (_ref = (_currentState$bottom = currentState.bottom) !== null && _currentState$bottom !== void 0 ? _currentState$bottom : []) === null || _ref === void 0 ? void 0 : _ref.concat(newRowId)
19458
+ };
19459
+ });
19460
+ // prep editing mode
19461
+ toggleDetailedMode(false);
19462
+ setLastFocusedCellIndex(undefined);
19463
+ // wait until set states have run
19464
+ requestAnimationFrame(() => {
19465
+ tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
19466
+ table.resetRowSelection();
19467
+ if (!tableMeta.editing.isEditing) {
19468
+ setEditing(true);
19469
+ }
19470
+ });
19471
+ }
19472
+ } catch (error) {
19473
+ console.error(error);
19474
+ }
19475
+ }
19476
+ if (!handleCreate) {
19477
+ return Promise.resolve();
19478
+ }
19479
+ const tableMeta = table.options.meta;
19480
+ const _temp = function () {
19481
+ if (tableMeta.rowActive.rowActiveIndex !== undefined) {
19482
+ return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
19483
+ if (!saved) {
19484
+ _exit = true;
19485
+ }
19486
+ });
19487
+ }
19488
+ }();
19489
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
19490
+ } catch (e) {
19491
+ return Promise.reject(e);
19492
+ }
19493
+ };
19059
19494
  // used to switch the table into editing mode
19060
19495
  const [isEditing, setEditing] = React__default.useState(false);
19061
19496
  // used to switch the editing between "detailed" mode
@@ -19064,26 +19499,27 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
19064
19499
  const createRowButtonRef = React__default.useRef(null);
19065
19500
  // store the last focused cell, so that up/down arrow key navigation remains in the same column
19066
19501
  const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
19067
- const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
19502
+ const pendingChangesFns = usePendingChangesState(handleSave, handleChange, handleDiscard, rowIdentityAccessor, validator);
19068
19503
  function toggleEditing(enabled, table, scrollToIndex) {
19069
- var _tableMeta$rowActive$, _table$getRowModel$ro;
19070
- if (!enabled) {
19071
- // save
19072
- pendingChangesFns.saveChanges(table);
19504
+ const tableMeta = table.options.meta;
19505
+ if (enabled) {
19506
+ var _tableMeta$rowActive$, _table$getRowModel$ro;
19507
+ const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
19508
+ if (tableMeta.rowActive.rowActiveIndex === undefined) {
19509
+ console.log('edit toggle active', index);
19510
+ tableMeta.rowActive.setRowActiveIndex(index);
19511
+ }
19512
+ if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
19513
+ scrollToIndex(index);
19514
+ }
19515
+ } else if (!enabled) {
19073
19516
  // reset detailed mode
19074
19517
  toggleDetailedMode(false);
19075
19518
  // reset the last index back to the first focusable element, when editing gets turned off
19076
19519
  setLastFocusedCellIndex(undefined);
19077
19520
  }
19078
- const tableMeta = table.options.meta;
19079
- const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
19080
- if (tableMeta.rowActive.rowActiveIndex === undefined) {
19081
- tableMeta.rowActive.setRowActiveIndex(index);
19082
- }
19083
19521
  setEditing(enabled);
19084
- if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
19085
- scrollToIndex(index);
19086
- }
19522
+ pendingChangesFns.saveChanges(table);
19087
19523
  }
19088
19524
  return {
19089
19525
  isEnabled,
@@ -19093,6 +19529,7 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, rowIdentit
19093
19529
  toggleEditing: isEnabled ? toggleEditing : () => undefined,
19094
19530
  lastFocusedCellIndex,
19095
19531
  setLastFocusedCellIndex,
19532
+ createRow,
19096
19533
  createRowButtonRef,
19097
19534
  ...pendingChangesFns
19098
19535
  };
@@ -19349,24 +19786,30 @@ function EditingControlCell(props) {
19349
19786
  var _cellRef$current;
19350
19787
  return typeof type === 'function' && !!((_cellRef$current = cellRef.current) !== null && _cellRef$current !== void 0 && _cellRef$current.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
19351
19788
  }, [cellRef.current]);
19352
- const handleChange = nextValue => {
19789
+ const handleChange = React__default.useCallback(nextValue => {
19353
19790
  if (nextValue !== value) {
19354
- tableMeta.editing.setCellValue(cell, nextValue);
19791
+ tableMeta.editing.setCellValue(cell, rowIndex, nextValue);
19355
19792
  if (hasNonTextControl) {
19356
- tableMeta.editing.onCellChanged(cell, rowIndex);
19793
+ requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
19357
19794
  }
19358
19795
  }
19359
- };
19360
- const handleBlur = () => {
19796
+ }, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]);
19797
+ const blur = React__default.useCallback(function blur() {
19361
19798
  tableMeta.editing.toggleDetailedMode(false);
19362
- tableMeta.editing.onCellChanged(cell, rowIndex, !hasNonTextControl);
19363
- };
19799
+ tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);
19800
+ }, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]);
19801
+ const handleBlur = React__default.useCallback(event => {
19802
+ if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
19803
+ return;
19804
+ }
19805
+ blur();
19806
+ }, [blur]);
19364
19807
  // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
19365
19808
  React__default.useEffect(() => {
19366
19809
  const ref = cellRef.current;
19367
19810
  return () => {
19368
19811
  if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
19369
- handleBlur();
19812
+ blur();
19370
19813
  }
19371
19814
  };
19372
19815
  }, []);
@@ -19514,11 +19957,21 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
19514
19957
  props.onChange(newDate);
19515
19958
  }
19516
19959
  };
19960
+ const handleDatepickerInputKeyDown = event => {
19961
+ // When in detailed mode, we want to handle the change, when 'Enter' is pressed.
19962
+ // To make it possible, we just need to prevent handleInputKeyDown from being executed, and give the full control to Datepicker,
19963
+ // by doing this, Datepicker will exit "detailed mode" by itself when a valid date change event is triggered.
19964
+ // In any other cases we'll just execute the "handleInputKeyDown" handler.
19965
+ if (isDetailedMode && event.key === 'Enter' && event.target.value !== '') {
19966
+ return;
19967
+ }
19968
+ handleInputKeyDown(event);
19969
+ };
19517
19970
  return /*#__PURE__*/React__default.createElement(Datepicker, Object.assign({}, commonProps, {
19518
19971
  invalid: invalid,
19519
19972
  onChange: handleChange,
19520
19973
  onFocus: handleFocus,
19521
- onKeyDown: handleInputKeyDown,
19974
+ onKeyDown: handleDatepickerInputKeyDown,
19522
19975
  ref: controlRef,
19523
19976
  value: valueAsDate
19524
19977
  }));
@@ -19610,14 +20063,13 @@ function DiscardChangesConfirmationDialog(props) {
19610
20063
  }, /*#__PURE__*/React__default.createElement(Dialog.Title, null, texts.table3.editing.clearChangesConfirmationDialog.title), /*#__PURE__*/React__default.createElement("p", null, texts.table3.editing.clearChangesConfirmationDialog.description), /*#__PURE__*/React__default.createElement(Dialog.Footer, null, /*#__PURE__*/React__default.createElement(Group, null, /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
19611
20064
  tabIndex: 0
19612
20065
  }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
19613
- autoFocus: true,
19614
20066
  tabIndex: 0,
19615
20067
  appearance: "primary",
19616
20068
  onClick: handleDiscard
19617
20069
  }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
19618
20070
  }
19619
20071
 
19620
- function EditingActionMenu(props) {
20072
+ function EditingActionsMenu(props) {
19621
20073
  const {
19622
20074
  hasChanges,
19623
20075
  hasErrors,
@@ -19646,7 +20098,8 @@ function EditingActionMenu(props) {
19646
20098
  icon: "more",
19647
20099
  onKeyDown: handleKeyDown,
19648
20100
  menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
19649
- onKeyDown: handleMenuContentKeyDown
20101
+ onKeyDown: handleMenuContentKeyDown,
20102
+ onFocusOutside: event => event.preventDefault()
19650
20103
  }, /*#__PURE__*/React__default.createElement(Menu$1.Item, {
19651
20104
  icon: "tick",
19652
20105
  disabled: !hasChanges || hasErrors,
@@ -19769,7 +20222,7 @@ const RENDERERS$1 = {
19769
20222
  cell: Cell$5
19770
20223
  };
19771
20224
  function useTable3(props, ref) {
19772
- const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.rowIdentityAccessor, props.validator);
20225
+ const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.onEditingCreate, props.onEditingDiscard, props.rowIdentityAccessor, props.validator);
19773
20226
  const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
19774
20227
  // this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
19775
20228
  const data = React__default.useMemo(() => {
@@ -19786,10 +20239,18 @@ function useTable3(props, ref) {
19786
20239
  // Display EditingActionMenu instead of row actions while editing
19787
20240
  rowActions: editing.isEditing ? [(_, rowId, table) => {
19788
20241
  const tableMeta = table.options.meta;
19789
- return /*#__PURE__*/React__default.createElement(EditingActionMenu, {
20242
+ return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
19790
20243
  hasChanges: editing.hasChanges(rowId),
19791
20244
  hasErrors: editing.hasRowErrors(rowId),
19792
- onDiscard: () => editing.discardChanges(rowId, table),
20245
+ onDiscard: () => {
20246
+ editing.discardChanges(rowId, table);
20247
+ if (editing.temporaryRows.length) {
20248
+ requestAnimationFrame(() => {
20249
+ var _editing$createRowBut;
20250
+ return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
20251
+ });
20252
+ }
20253
+ },
19793
20254
  onEditingSave: function () {
19794
20255
  try {
19795
20256
  return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
@@ -19813,6 +20274,9 @@ function useTable3(props, ref) {
19813
20274
  React__default.useEffect(() => {
19814
20275
  if (table.ref.current) {
19815
20276
  table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance, table.renderer.scrollToIndex);
20277
+ if (props.onEditingCreate) {
20278
+ table.ref.current.instance.createRow = row => table.meta.editing.createRow(table.instance, row);
20279
+ }
19816
20280
  }
19817
20281
  }, [table.ref.current]);
19818
20282
  return table;
@@ -19851,22 +20315,26 @@ function Alert$1(props) {
19851
20315
  // generate links to each invalid row, to go into the error message
19852
20316
  const links = [];
19853
20317
  const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
19854
- const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ? table.getColumn(String(tableMeta.rowIdentityAccessor)) : undefined;
20318
+ const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
20319
+ // table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
20320
+ table.getAllColumns().find(x => x.id === String(tableMeta.rowIdentityAccessor)) : undefined;
19855
20321
  pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
20322
+ var _row;
19856
20323
  // if appropriate, concatenate the item with the text "and"
19857
20324
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
19858
20325
  // Add space before and after `messageAnd` text
19859
20326
  links.push(` ${validationTexts.alert.messageAnd} `);
19860
20327
  }
19861
- const rowIndex = table.getRowModel().rows.findIndex(row => row.id === pendingChangeWithError.rowId);
20328
+ // note: if this row click functionality is removed, indexes can be removed from useEditingState
19862
20329
  const handleClick = () => {
19863
20330
  // if row is visible
19864
- if (rowIndex > -1) {
19865
- scrollToRow(rowIndex);
20331
+ if (pendingChangeWithError.index > -1) {
20332
+ scrollToRow(pendingChangeWithError.index);
20333
+ tableMeta.rowActive.setRowActiveIndex(pendingChangeWithError.index);
19866
20334
  }
19867
20335
  // if row is filtered out
19868
20336
  else {
19869
- setShowFilterResetDialog(pendingChangeWithError.rowId);
20337
+ setShowFilterResetDialog(pendingChangeWithError.index);
19870
20338
  }
19871
20339
  };
19872
20340
  let tooltip;
@@ -19878,7 +20346,12 @@ function Alert$1(props) {
19878
20346
  const columnName = (_table$getAllColumns$ = table.getAllColumns().find(column => column.id === firstCellErrorColumnId)) === null || _table$getAllColumns$ === void 0 ? void 0 : (_table$getAllColumns$2 = _table$getAllColumns$.columnDef.meta) === null || _table$getAllColumns$2 === void 0 ? void 0 : _table$getAllColumns$2.header;
19879
20347
  tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
19880
20348
  }
19881
- const row = table.getRow(pendingChangeWithError.rowId).original;
20349
+ let row = undefined;
20350
+ try {
20351
+ row = table.getRow(pendingChangeWithError.rowId).original;
20352
+ } catch {
20353
+ // because of server loading, some rows may not be accessible
20354
+ }
19882
20355
  links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
19883
20356
  key: pendingChangeWithError.rowId,
19884
20357
  title: tooltip
@@ -19886,7 +20359,7 @@ function Alert$1(props) {
19886
20359
  className: "text-blue",
19887
20360
  onClick: handleClick,
19888
20361
  role: "button"
19889
- }, rowIdentityColumn ? row[rowIdentityColumn.id] : rowIndex + 1)));
20362
+ }, rowIdentityColumn ? (_row = row) === null || _row === void 0 ? void 0 : _row[rowIdentityColumn.id] : pendingChangeWithError.index + 1)));
19890
20363
  // if appropriate, concatenate the item with the text ","
19891
20364
  if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
19892
20365
  links.push(', ');
@@ -19907,9 +20380,8 @@ function Alert$1(props) {
19907
20380
  table.resetGlobalFilter();
19908
20381
  table.resetColumnFilters();
19909
20382
  requestAnimationFrame(() => {
19910
- const rowIndex = table.getRowModel().rows.findIndex(row => row.id === showFilterResetDialog);
19911
- if (rowIndex > -1) {
19912
- scrollToRow(rowIndex);
20383
+ if (showFilterResetDialog && showFilterResetDialog > -1) {
20384
+ scrollToRow(showFilterResetDialog);
19913
20385
  }
19914
20386
  setShowFilterResetDialog(false);
19915
20387
  });
@@ -19973,11 +20445,9 @@ function CreateNewRow(props) {
19973
20445
  var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
19974
20446
  const {
19975
20447
  buttonRef,
19976
- onEditingCreate: handleEditingCreate,
19977
- scrollToIndex,
20448
+ isScrolled,
19978
20449
  table,
19979
- tableMeta,
19980
- tableRef
20450
+ tableMeta
19981
20451
  } = props;
19982
20452
  const {
19983
20453
  texts
@@ -19986,46 +20456,19 @@ function CreateNewRow(props) {
19986
20456
  const temporaryRowId = (_temporaryRows$0$tabl = (_temporaryRows$ = temporaryRows[0]) === null || _temporaryRows$ === void 0 ? void 0 : _temporaryRows$[tableMeta.rowIdentityAccessor]) !== null && _temporaryRows$0$tabl !== void 0 ? _temporaryRows$0$tabl : '';
19987
20457
  const isDisabled = !!table.getState().globalFilter || !!((_table$getState$colum = table.getState().columnFilters) !== null && _table$getState$colum !== void 0 && _table$getState$colum.length) || !!temporaryRowId && !!tableMeta.editing.hasRowErrors(temporaryRowId);
19988
20458
  const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';
19989
- const createRow = function (row) {
20459
+ const handleCreate = function () {
19990
20460
  try {
19991
- if (!handleEditingCreate || isDisabled) {
20461
+ if (isDisabled) {
19992
20462
  return Promise.resolve();
19993
20463
  }
19994
- return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
19995
- if (!saved) {
19996
- return;
19997
- }
19998
- const changeset = row !== null && row !== void 0 ? row : handleEditingCreate();
19999
- try {
20000
- if (changeset) {
20001
- const rowId = tableMeta.editing.createRow(changeset);
20002
- table.getRow(rowId).pin('bottom');
20003
- // set the active row to the new row before toggling editing on
20004
- const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
20005
- tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
20006
- tableMeta.editing.toggleEditing(true, table, scrollToIndex);
20007
- tableMeta.editing.setLastFocusedCellIndex(0);
20008
- }
20009
- } catch (error) {
20010
- console.error(error);
20011
- }
20012
- });
20464
+ return Promise.resolve(tableMeta.editing.createRow(table)).then(function () {});
20013
20465
  } catch (e) {
20014
20466
  return Promise.reject(e);
20015
20467
  }
20016
20468
  };
20017
- // allow programmatic access to creating rows from outside the table
20018
- React__default.useEffect(() => {
20019
- if (tableRef.current) {
20020
- tableRef.current.instance.createRow = createRow;
20021
- }
20022
- }, [tableRef.current, createRow]);
20023
- const handleCreate = function () {
20024
- return createRow();
20025
- };
20026
20469
  const shortcut = {
20027
20470
  key: 'Enter',
20028
- shift: true
20471
+ meta: true
20029
20472
  };
20030
20473
  let tooltip;
20031
20474
  if (isSaving) {
@@ -20037,11 +20480,9 @@ function CreateNewRow(props) {
20037
20480
  keys: shortcut
20038
20481
  });
20039
20482
  }
20040
- const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
20041
20483
  const className = cn('group/row border-grey-300 !sticky z-[21]', {
20042
20484
  'bottom-10': tableMeta.footer.isEnabled,
20043
20485
  'bottom-0': !tableMeta.footer.isEnabled,
20044
- 'border-t-2': isScrolled,
20045
20486
  'border-b': !isScrolled
20046
20487
  });
20047
20488
  return /*#__PURE__*/React__default.createElement("tr", {
@@ -20066,6 +20507,7 @@ function CreateNewRow(props) {
20066
20507
  function TemporaryRow(props) {
20067
20508
  const {
20068
20509
  createRowButtonRef,
20510
+ isScrolled,
20069
20511
  table,
20070
20512
  tableMeta,
20071
20513
  tableRef
@@ -20128,10 +20570,9 @@ function TemporaryRow(props) {
20128
20570
  }
20129
20571
  }
20130
20572
  };
20131
- const isScrolled = tableRef.current ? tableRef.current.scrollHeight > tableRef.current.clientHeight : false;
20132
- const className = cn('group/row border-grey-300 !sticky z-[22]', {
20133
- 'bottom-[calc(5rem_+_3px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
20134
- 'bottom-[calc(2.5rem_+_3px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
20573
+ const className = cn('group/row border-grey-300 !sticky z-[22] print:hidden', {
20574
+ 'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
20575
+ 'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
20135
20576
  'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
20136
20577
  });
20137
20578
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
@@ -20145,14 +20586,13 @@ function TemporaryRow(props) {
20145
20586
  className: className,
20146
20587
  onKeyDown: handleKeyDown,
20147
20588
  onKeyDownCapture: handleKeyDownCapture,
20148
- // Row actions should only be hidden on temporary rows when editing is turned off
20149
- hideRowActions: !tableMeta.editing.isEditing
20589
+ hideInternalColumns: true,
20590
+ hideRowActions: !tableMeta.editing.isEditing,
20591
+ skipPageLoading: true
20150
20592
  }))));
20151
20593
  }
20152
20594
 
20153
- function Column$3(_) {
20154
- return null;
20155
- }
20595
+ const Column$3 = () => null;
20156
20596
  Column$3.displayName = 'Table3Column';
20157
20597
  function Group$5(_) {
20158
20598
  return null;
@@ -20167,6 +20607,16 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
20167
20607
  };
20168
20608
  const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;
20169
20609
  const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
20610
+ const isScrolled = isTableScrolled(table3.ref);
20611
+ let createWorkflow;
20612
+ if (hasCreateWorkflow) {
20613
+ createWorkflow = /*#__PURE__*/React__default.createElement(CreateNewRow, {
20614
+ buttonRef: table3.meta.editing.createRowButtonRef,
20615
+ isScrolled: isScrolled,
20616
+ table: table3.instance,
20617
+ tableMeta: table3.meta
20618
+ });
20619
+ }
20170
20620
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
20171
20621
  table: table3
20172
20622
  }, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
@@ -20179,20 +20629,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
20179
20629
  tableRef: table3.ref
20180
20630
  })) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
20181
20631
  "data-taco": "table3",
20632
+ footerRows: hasCreateWorkflow && isScrolled ? createWorkflow : undefined,
20182
20633
  table: table3
20183
20634
  }), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
20184
20635
  createRowButtonRef: table3.meta.editing.createRowButtonRef,
20636
+ isScrolled: isScrolled,
20185
20637
  table: table3.instance,
20186
20638
  tableMeta: table3.meta,
20187
20639
  tableRef: table3.ref
20188
- }), /*#__PURE__*/React__default.createElement(CreateNewRow, {
20189
- buttonRef: table3.meta.editing.createRowButtonRef,
20190
- onEditingCreate: props.onEditingCreate,
20191
- scrollToIndex: table3.renderer.scrollToIndex,
20192
- table: table3.instance,
20193
- tableMeta: table3.meta,
20194
- tableRef: table3.ref
20195
- }))) : null));
20640
+ }), !isScrolled ? createWorkflow : null)) : null));
20196
20641
  });
20197
20642
  const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
20198
20643
  const stringifiedChildren = String(props.children);
@@ -20428,6 +20873,796 @@ const Tour = props => {
20428
20873
  };
20429
20874
  Tour.Step = TourStep;
20430
20875
 
20876
+ // NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js
20877
+
20878
+ const THEME_COLORS = {
20879
+ transparent: 'transparent',
20880
+ current: 'currentColor',
20881
+ white: '#fff',
20882
+ black: '#1c1c1c',
20883
+ brand: {
20884
+ vismaRed: '#E70641',
20885
+ paleOrange: '#FFF5E5',
20886
+ sunsetOrange: '#E89C2E',
20887
+ midnightBlue: '#29283E',
20888
+ coolBlue: '#F5F7F9'
20889
+ },
20890
+ grey: {
20891
+ lightest: '#fafafa',
20892
+ light: '#F6F6F6',
20893
+ DEFAULT: '#EBEBEB',
20894
+ dark: '#DDDDDD',
20895
+ darker: '#ACACAC',
20896
+ darkest: '#595959',
20897
+ darkNew: '#a5a6a9',
20898
+ 50: '#fafafa',
20899
+ 100: '#F6F6F6',
20900
+ 200: '#EBEBEB',
20901
+ 300: '#DDDDDD',
20902
+ 500: '#ACACAC',
20903
+ 700: '#595959',
20904
+ 900: '#303030'
20905
+ },
20906
+ purple: {
20907
+ lightest: '#585c74',
20908
+ light: '#4b4f64',
20909
+ DEFAULT: '#3d4153',
20910
+ dark: '#353a48',
20911
+ darker: '#29283e',
20912
+ darkest: '#212032',
20913
+ darkNew_1: '#373647',
20914
+ darkNew_2: '#414050',
20915
+ 100: '#EEE5FF',
20916
+ 200: '#ddd1ff',
20917
+ 300: '#CBBCFE',
20918
+ 500: '#9270FA',
20919
+ 700: '#6542D1',
20920
+ 900: '#412970'
20921
+ },
20922
+ blue: {
20923
+ lightest: '#DEEBFF',
20924
+ light: '#75A0F5',
20925
+ DEFAULT: '#4573D2',
20926
+ dark: '#2B57B4',
20927
+ 100: '#DEEBFF',
20928
+ 200: '#AACCFF',
20929
+ 300: '#75A0F5',
20930
+ 500: '#4573D2',
20931
+ 700: '#2B57B4',
20932
+ 900: '#29283E'
20933
+ },
20934
+ red: {
20935
+ lightest: '#FFDAD2',
20936
+ light: '#E66568',
20937
+ DEFAULT: '#CE3F42',
20938
+ dark: '#950027',
20939
+ 100: '#FFDAD2',
20940
+ 200: '#f3a09d',
20941
+ 300: '#E66568',
20942
+ 500: '#CE3F42',
20943
+ 700: '#950027',
20944
+ 900: '#64001B'
20945
+ },
20946
+ green: {
20947
+ lightest: '#cdf0e7',
20948
+ light: '#52C7AB',
20949
+ DEFAULT: '#08AE87',
20950
+ dark: '#028465',
20951
+ 100: '#cdf0e7',
20952
+ 200: '#9be1ce',
20953
+ 300: '#52C7AB',
20954
+ 500: '#08AE87',
20955
+ 700: '#028465',
20956
+ 900: '#14493A'
20957
+ },
20958
+ yellow: {
20959
+ lightest: '#FFF1C3',
20960
+ light: '#FFD665',
20961
+ DEFAULT: '#FFBD3B',
20962
+ dark: '#e89c2e',
20963
+ 100: '#FFF1C3',
20964
+ 200: '#ffe494',
20965
+ 300: '#FFD665',
20966
+ 500: '#FFBD3B',
20967
+ 700: '#e89c2e',
20968
+ 900: '#733700'
20969
+ },
20970
+ pink: {
20971
+ 100: '#FFE3F7',
20972
+ 200: '#fcb9e9',
20973
+ 300: '#F98EDB',
20974
+ 500: '#E165BF',
20975
+ 700: '#CF49AA',
20976
+ 900: '#870062'
20977
+ },
20978
+ brown: {
20979
+ 100: '#EEE0DA',
20980
+ 200: '#DFCCC2',
20981
+ 300: '#C4AB9E',
20982
+ 500: '#93715D',
20983
+ 700: '#73503B',
20984
+ 900: '#45291F'
20985
+ },
20986
+ orange: {
20987
+ 100: '#FFE3BB',
20988
+ 200: '#FCCB80',
20989
+ 300: '#FAB64D',
20990
+ 500: '#F99702',
20991
+ 700: '#EF7D00',
20992
+ 900: '#4A2811'
20993
+ }
20994
+ };
20995
+
20996
+ const mapColor = (palette, prefix = '') => {
20997
+ return Object.keys(palette).reduce((accum, color) => {
20998
+ if (color === 'current') {
20999
+ return accum;
21000
+ } else if (typeof palette[color] === 'string') {
21001
+ return {
21002
+ ...accum,
21003
+ [prefix ? color === 'DEFAULT' ? prefix : `${prefix}-${color}` : color]: palette[color]
21004
+ };
21005
+ } else {
21006
+ return {
21007
+ ...accum,
21008
+ ...mapColor(palette[color], color)
21009
+ };
21010
+ }
21011
+ }, {});
21012
+ };
21013
+ const colors = /*#__PURE__*/mapColor(THEME_COLORS);
21014
+ const getThemeColor = color => colors[color];
21015
+
21016
+ function Legend(props) {
21017
+ const {
21018
+ activeIndex,
21019
+ onMouseEnter,
21020
+ onMouseLeave,
21021
+ onClick,
21022
+ payload,
21023
+ layout,
21024
+ activeItems
21025
+ } = props;
21026
+ const [hoverIndex, setHoverIndex] = React.useState(null);
21027
+ const handleMouseEnter = (entry, index) => {
21028
+ setHoverIndex(index);
21029
+ if (activeItems[entry.dataKey]) onMouseEnter(entry, index);
21030
+ };
21031
+ const handleMouseLeave = () => {
21032
+ onMouseLeave();
21033
+ setHoverIndex(null);
21034
+ };
21035
+ const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
21036
+ appearance: "transparent",
21037
+ className: "text-grey-700"
21038
+ }, moreButtonText));
21039
+ return /*#__PURE__*/React__default.createElement("div", {
21040
+ className: "mx-auto w-auto max-w-full overflow-hidden"
21041
+ }, /*#__PURE__*/React__default.createElement("div", {
21042
+ className: cn('mb-0 ml-0 flex justify-center', {
21043
+ 'flex-col': layout === 'vertical'
21044
+ })
21045
+ }, /*#__PURE__*/React__default.createElement(OverflowGroup, {
21046
+ className: "w-full items-center py-1",
21047
+ moreButton: moreButton
21048
+ }, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement("span", {
21049
+ key: `${entry.dataKey}-${index}`,
21050
+ className: cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {
21051
+ 'bg-grey-100 rounded': activeIndex === index
21052
+ }),
21053
+ onMouseEnter: () => handleMouseEnter(entry, index),
21054
+ onMouseLeave: handleMouseLeave,
21055
+ onClick: onClick ? () => onClick(entry) : undefined
21056
+ }, /*#__PURE__*/React__default.createElement("span", {
21057
+ className: "text-grey-700 flex items-center gap-[4px]"
21058
+ }, /*#__PURE__*/React__default.createElement("span", {
21059
+ className: cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {
21060
+ 'border-grey-300 border !bg-white': !activeItems[entry.dataKey]
21061
+ }),
21062
+ style: {
21063
+ backgroundColor: entry.color
21064
+ }
21065
+ }, hoverIndex === index && activeItems[entry.dataKey] && (/*#__PURE__*/React__default.createElement(Icon, {
21066
+ name: "tick-bold",
21067
+ className: "!h-full !w-full text-white"
21068
+ }))), entry.value)))))));
21069
+ }
21070
+
21071
+ const Tooltip$2 = ({
21072
+ active,
21073
+ formatter,
21074
+ payload,
21075
+ style,
21076
+ singlePieDonutChart
21077
+ }) => {
21078
+ const getColor = entry => {
21079
+ var _ref, _entry$color;
21080
+ if (singlePieDonutChart) {
21081
+ // We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
21082
+ // and one with multiple pies.
21083
+ return getThemeColor(entry.payload.color);
21084
+ }
21085
+ return (_ref = (_entry$color = entry.color) !== null && _entry$color !== void 0 ? _entry$color : entry.payload.fill) !== null && _ref !== void 0 ? _ref : 'blue-500';
21086
+ };
21087
+ if (active && payload && payload.length) {
21088
+ return /*#__PURE__*/React__default.createElement("dl", {
21089
+ className: "z-20 grid grid-cols-[max-content_max-content] gap-x-4 rounded-md bg-white p-4 text-xs shadow-[0px_0px_1px_rgba(0,0,0,0.1),_0px_6px_18px_rgba(47,51,68,0.2)]",
21090
+ style: style
21091
+ }, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
21092
+ key: `${entry.name}-${index}`
21093
+ }, /*#__PURE__*/React__default.createElement("dt", {
21094
+ className: "text-grey-700 mb-0 flex items-center gap-1 font-normal"
21095
+ }, /*#__PURE__*/React__default.createElement("span", {
21096
+ className: "-mt-px h-2.5 w-2.5 rounded-sm",
21097
+ style: {
21098
+ background: getColor(entry)
21099
+ }
21100
+ }),
21101
+ // We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
21102
+ // and one with multiple pies.
21103
+ singlePieDonutChart ? entry.payload.label : entry.name), /*#__PURE__*/React__default.createElement("dd", {
21104
+ className: "mb-0 text-right font-bold text-black "
21105
+ }, formatter ? formatter(entry.value) : entry.value)))));
21106
+ }
21107
+ return null;
21108
+ };
21109
+
21110
+ const getCartesianGridProps = () => ({
21111
+ vertical: false
21112
+ });
21113
+ const getXAxisProps = props => ({
21114
+ axisLine: false,
21115
+ dataKey: props.accessor,
21116
+ fontSize: 12,
21117
+ scale: props.xAxisScale,
21118
+ tickLine: false,
21119
+ tickFormatter: props.xAxisTickFormat
21120
+ });
21121
+ const getYAxisProps = props => ({
21122
+ axisLine: false,
21123
+ fontSize: 12,
21124
+ scale: props.yAxisScale,
21125
+ tickLine: false,
21126
+ tickFormatter: props.yAxisTickFormat
21127
+ });
21128
+ const getLegendProps = props => ({
21129
+ content: /*#__PURE__*/React__default.createElement(Legend, Object.assign({}, props))
21130
+ });
21131
+ const getTooltipProps = (props = undefined) => ({
21132
+ content: /*#__PURE__*/React__default.createElement(Tooltip$2, Object.assign({}, props)),
21133
+ wrapperStyle: {
21134
+ outline: 'none'
21135
+ }
21136
+ });
21137
+
21138
+ // A hacky fix for EC-50037 to make sure that Chart doesn't resize when it is inside a Card.
21139
+ const ResponsiveContainer = props => (/*#__PURE__*/React__default.createElement(Recharts.ResponsiveContainer, Object.assign({
21140
+ className: "!h-[calc(100%-1px)] !w-[calc(100%-1px)]"
21141
+ }, props)));
21142
+
21143
+ const Area = _ => null;
21144
+ const AreaChart = function AreaChart(externalProps) {
21145
+ const {
21146
+ children,
21147
+ data,
21148
+ formatter,
21149
+ ...props
21150
+ } = externalProps;
21151
+ const [hoveredArea, setHoveredArea] = React.useState(null);
21152
+ const [activeAreas, setActiveAreas] = React.useState(() => {
21153
+ const areas = {};
21154
+ React__default.Children.forEach(children, child => {
21155
+ areas[child.props.accessor] = true;
21156
+ });
21157
+ return areas;
21158
+ });
21159
+ const handleLegendClick = entry => {
21160
+ setHoveredArea(null);
21161
+ setActiveAreas({
21162
+ ...activeAreas,
21163
+ [entry.dataKey]: !activeAreas[entry.dataKey]
21164
+ });
21165
+ };
21166
+ return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.AreaChart, {
21167
+ data: data,
21168
+ margin: {
21169
+ top: 10,
21170
+ right: 0,
21171
+ left: -25,
21172
+ bottom: 0
21173
+ }
21174
+ }, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
21175
+ onClick: handleLegendClick,
21176
+ onMouseEnter: entry => setHoveredArea(entry.dataKey),
21177
+ onMouseLeave: () => setHoveredArea(null),
21178
+ activeItems: activeAreas
21179
+ }))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
21180
+ formatter: formatter
21181
+ })), React__default.Children.map(children, child => {
21182
+ var _child$props$color, _child$props$color2, _child$props$color3;
21183
+ return /*#__PURE__*/React__default.createElement(Recharts.Area, {
21184
+ activeDot: {
21185
+ fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
21186
+ },
21187
+ isAnimationActive: false,
21188
+ dataKey: child.props.accessor,
21189
+ dot: false,
21190
+ fill: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'grey-100'),
21191
+ name: child.props.label,
21192
+ strokeWidth: 2,
21193
+ stroke: getThemeColor((_child$props$color3 = child.props.color) !== null && _child$props$color3 !== void 0 ? _child$props$color3 : 'grey-300'),
21194
+ stackId: child.props.stackId,
21195
+ hide: !activeAreas[child.props.accessor],
21196
+ opacity: hoveredArea && child.props.accessor !== hoveredArea ? 0.3 : 1
21197
+ });
21198
+ })));
21199
+ };
21200
+ AreaChart.Area = Area;
21201
+
21202
+ const Bar$1 = _ => null;
21203
+ const getXAxisVerticalProps = props => ({
21204
+ ...getXAxisProps(props),
21205
+ ...{
21206
+ type: 'number',
21207
+ dataKey: undefined
21208
+ }
21209
+ });
21210
+ const getYAxisVerticalProps = props => ({
21211
+ ...getYAxisProps(props),
21212
+ ...{
21213
+ dataKey: props.accessor,
21214
+ type: 'category'
21215
+ }
21216
+ });
21217
+ const BarChart = function BarChart(externalProps) {
21218
+ const {
21219
+ children,
21220
+ data,
21221
+ formatter,
21222
+ layout = 'horizontal',
21223
+ ...props
21224
+ } = externalProps;
21225
+ const [activeIndex, setActiveIndex] = React__default.useState(undefined);
21226
+ const [hoveredBar, setHoveredBar] = React__default.useState(null);
21227
+ const [activeBars, setActiveBars] = React__default.useState(() => {
21228
+ const keys = {};
21229
+ React__default.Children.forEach(children, child => {
21230
+ keys[child.props.accessor] = true;
21231
+ });
21232
+ return keys;
21233
+ });
21234
+ // Recharts doesn't provide a way for us to know if a stacked bar is at the top or the bottom,
21235
+ // so we can't set proper radiuses without some "magic"
21236
+ const stacks = {};
21237
+ React__default.Children.forEach(children, child => {
21238
+ if (child.props.stackId) {
21239
+ if (!stacks[child.props.stackId]) {
21240
+ stacks[child.props.stackId] = [child.props.accessor];
21241
+ } else {
21242
+ stacks[child.props.stackId].push(child.props.accessor);
21243
+ }
21244
+ }
21245
+ });
21246
+ const handleLegendClick = entry => {
21247
+ setHoveredBar(null);
21248
+ setActiveBars({
21249
+ ...activeBars,
21250
+ [entry.dataKey]: !activeBars[entry.dataKey]
21251
+ });
21252
+ };
21253
+ const handleLegendHover = (entry, index) => {
21254
+ setHoveredBar(entry.dataKey);
21255
+ setActiveIndex(index);
21256
+ };
21257
+ return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.BarChart, {
21258
+ layout: layout,
21259
+ data: data,
21260
+ margin: {
21261
+ top: 10,
21262
+ right: 0,
21263
+ left: layout === 'vertical' ? 0 : -25,
21264
+ bottom: 0
21265
+ },
21266
+ onMouseMove: chartState => setActiveIndex(chartState.activeTooltipIndex),
21267
+ onMouseLeave: () => setActiveIndex(undefined)
21268
+ }, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, layout === 'vertical' ? getXAxisVerticalProps(props) : getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, layout === 'vertical' ? getYAxisVerticalProps(props) : getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
21269
+ onClick: handleLegendClick,
21270
+ onMouseEnter: handleLegendHover,
21271
+ onMouseLeave: () => setHoveredBar(null),
21272
+ activeItems: activeBars
21273
+ }))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
21274
+ formatter: formatter
21275
+ })), React__default.Children.map(children, child => (/*#__PURE__*/React__default.createElement(Recharts.Bar, {
21276
+ isAnimationActive: false,
21277
+ barSize: 16,
21278
+ dataKey: child.props.accessor,
21279
+ name: child.props.label,
21280
+ onMouseEnter: (_, index) => setActiveIndex(index),
21281
+ onMouseLeave: () => setActiveIndex(undefined),
21282
+ fill: getThemeColor(child.props.color ? `${child.props.color}` : `blue-300`),
21283
+ radius: getBarRadius(stacks, child.props.accessor, child.props.stackId, activeBars),
21284
+ stackId: child.props.stackId,
21285
+ style: child.props.stackId ? {
21286
+ stroke: '#fff',
21287
+ strokeWidth: '2px'
21288
+ } : undefined,
21289
+ hide: !activeBars[child.props.accessor]
21290
+ }, data.map((_, index) => (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
21291
+ key: `cell-${index}`,
21292
+ opacity: hoveredBar && child.props.accessor !== hoveredBar || activeIndex !== undefined && activeIndex !== index ? 0.3 : 1
21293
+ }))))))));
21294
+ };
21295
+ BarChart.Bar = Bar$1;
21296
+ const getBarRadius = (stacks, accessor, stackId, activeBars) => {
21297
+ if (stackId && Array.isArray(stacks[stackId])) {
21298
+ const length = stacks[stackId].length - 1;
21299
+ const index = stacks[stackId].indexOf(accessor);
21300
+ if (Object.entries(activeBars).filter(item => item[0] !== accessor).every(item => !item[1])) {
21301
+ return [3, 3, 0, 0];
21302
+ }
21303
+ if (activeBars[stacks[stackId][index + 1]] === false) {
21304
+ return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length - 1 ? 0 : 3, index === length - 1 ? 0 : 3];
21305
+ }
21306
+ if (index !== 0 && index !== length) {
21307
+ return 0;
21308
+ }
21309
+ return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length ? 0 : 3, index === length ? 0 : 3];
21310
+ }
21311
+ return 3;
21312
+ };
21313
+
21314
+ const Legend$1 = ({
21315
+ legendPosition,
21316
+ hoveredItem,
21317
+ selectedItem,
21318
+ data,
21319
+ onClick,
21320
+ setHoveredItem,
21321
+ formatter,
21322
+ total,
21323
+ visibleItems,
21324
+ label
21325
+ }) => {
21326
+ const isTotalLegendSelected = selectedItem.length === data.length;
21327
+ const isTotalLegendHovered = hoveredItem.length === data.length;
21328
+ const handleMouseLeave = () => setHoveredItem([]);
21329
+ const renderLegendItem = (entry, index) => {
21330
+ const isTotal = entry === null;
21331
+ // We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.
21332
+ const itemData = entry === null ? {
21333
+ id: 'total',
21334
+ label,
21335
+ value: total,
21336
+ color: 'grey-300'
21337
+ } : entry;
21338
+ const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);
21339
+ const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);
21340
+ return /*#__PURE__*/React__default.createElement("li", {
21341
+ key: isTotal ? 'total' : `${itemData.label}-${index}`,
21342
+ className: cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {
21343
+ 'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),
21344
+ 'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right')
21345
+ }),
21346
+ onClick: () => onClick(isTotal ? data : itemData),
21347
+ onMouseEnter: () => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id]),
21348
+ onMouseLeave: handleMouseLeave
21349
+ }, legendPosition === 'bottom' ? (/*#__PURE__*/React__default.createElement("div", {
21350
+ className: "flex items-center gap-1"
21351
+ }, /*#__PURE__*/React__default.createElement("span", {
21352
+ className: cn('ml-1 h-3 w-3 rounded-sm', {
21353
+ 'border-grey-300 border !bg-white': !visibleItems[itemData.id]
21354
+ }),
21355
+ style: {
21356
+ backgroundColor: getThemeColor(itemData.color)
21357
+ }
21358
+ }, visibleItems[itemData.id] && isHovered && (/*#__PURE__*/React__default.createElement(Icon, {
21359
+ name: "tick-bold",
21360
+ className: "mb-2.5 !h-full !w-full text-white"
21361
+ }))), /*#__PURE__*/React__default.createElement("div", null, itemData.label))) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
21362
+ className: "ml-1 mt-1 h-9 w-2 rounded-[1px]",
21363
+ style: {
21364
+ backgroundColor: getThemeColor(itemData.color)
21365
+ }
21366
+ }), /*#__PURE__*/React__default.createElement("div", null, itemData.label, /*#__PURE__*/React__default.createElement("span", {
21367
+ className: "-mt-1 flex w-full text-lg font-bold"
21368
+ }, formatter ? formatter(itemData.value) : itemData.value)))));
21369
+ };
21370
+ const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
21371
+ appearance: "transparent",
21372
+ className: "text-grey-700"
21373
+ }, moreButtonText));
21374
+ const className = cn('flex-grow pl-4', {
21375
+ 'w-full': legendPosition === 'bottom'
21376
+ });
21377
+ return /*#__PURE__*/React__default.createElement("div", {
21378
+ className: className
21379
+ }, /*#__PURE__*/React__default.createElement("ul", {
21380
+ className: cn('mb-0 ml-0 mt-4 flex justify-center space-y-1', legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row')
21381
+ }, legendPosition === 'right' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderLegendItem(null), data.map(renderLegendItem))) : (/*#__PURE__*/React__default.createElement(OverflowGroup, {
21382
+ className: "w-full items-center py-1",
21383
+ moreButton: moreButton
21384
+ }, data.map(renderLegendItem)))));
21385
+ };
21386
+
21387
+ const DONUT_WIDTH = 16;
21388
+ const HOVER_DONUT_WIDTH = 10;
21389
+
21390
+ const CenteredLabel = ({
21391
+ radius,
21392
+ legendPosition,
21393
+ label,
21394
+ total,
21395
+ formatter,
21396
+ showLegend
21397
+ }) => {
21398
+ const totalInset = HOVER_DONUT_WIDTH + DONUT_WIDTH + DONUT_WIDTH;
21399
+ const diameter = radius * 2;
21400
+ return /*#__PURE__*/React__default.createElement("div", {
21401
+ className: "absolute mt-1 flex h-12 flex-col text-center",
21402
+ style: {
21403
+ top: `calc(${radius}px - (3rem / 2))`,
21404
+ left: legendPosition === 'right' ? `${totalInset}px` : `calc(50%-${diameter - 2 * totalInset})`,
21405
+ width: showLegend ? `${diameter - 2 * totalInset}px` : `${diameter}px`
21406
+ }
21407
+ }, /*#__PURE__*/React__default.createElement("span", {
21408
+ className: "w-full truncate text-lg font-bold"
21409
+ }, formatter ? formatter(total) : total), label);
21410
+ };
21411
+
21412
+ const ActiveShape = props => {
21413
+ var _getThemeColor;
21414
+ const {
21415
+ cx,
21416
+ cy,
21417
+ id,
21418
+ innerRadius,
21419
+ onClick,
21420
+ outerRadius = 0,
21421
+ pieColors,
21422
+ startAngle,
21423
+ endAngle,
21424
+ fill
21425
+ } = props;
21426
+ return /*#__PURE__*/React__default.createElement("g", {
21427
+ onClick: () => onClick(id),
21428
+ className: cn({
21429
+ 'cursor-pointer': !!onClick
21430
+ })
21431
+ }, /*#__PURE__*/React__default.createElement(Recharts.Sector, {
21432
+ cx: cx,
21433
+ cy: cy,
21434
+ innerRadius: innerRadius,
21435
+ outerRadius: outerRadius,
21436
+ startAngle: startAngle,
21437
+ endAngle: endAngle,
21438
+ fill: fill
21439
+ }), /*#__PURE__*/React__default.createElement(Recharts.Sector, {
21440
+ cx: cx,
21441
+ cy: cy,
21442
+ startAngle: startAngle,
21443
+ endAngle: endAngle,
21444
+ innerRadius: outerRadius + 2,
21445
+ outerRadius: outerRadius + HOVER_DONUT_WIDTH,
21446
+ fill: id !== undefined ? (_getThemeColor = getThemeColor(pieColors[id])) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-500') : getThemeColor('blue-500'),
21447
+ opacity: 0.3
21448
+ }));
21449
+ };
21450
+
21451
+ const Segment = _ => null;
21452
+ const DonutChart = function DonutChart({
21453
+ children,
21454
+ formatter,
21455
+ onClick,
21456
+ showLegend = false,
21457
+ legendPosition = 'bottom',
21458
+ label
21459
+ }) {
21460
+ const ref = React__default.useRef(null);
21461
+ const [radius, setRadius] = React__default.useState(0);
21462
+ const [hoveredItem, setHoveredItem] = React__default.useState([]);
21463
+ // used for right legends
21464
+ const [selectedItem, setSelectedItem] = React__default.useState([]);
21465
+ // used for bottom legends
21466
+ const [visibleItems, setVisibleItems] = React__default.useState(() => {
21467
+ const keys = {};
21468
+ React__default.Children.forEach(children, child => {
21469
+ keys[child.props.id] = true;
21470
+ });
21471
+ return keys;
21472
+ });
21473
+ React__default.useEffect(() => {
21474
+ if (ref.current) {
21475
+ var _ref$current$parentEl;
21476
+ const rect = (_ref$current$parentEl = ref.current.parentElement) === null || _ref$current$parentEl === void 0 ? void 0 : _ref$current$parentEl.getBoundingClientRect();
21477
+ if (rect) {
21478
+ const width = showLegend ? rect.width / 2 : rect.width;
21479
+ const max = rect.height < width ? rect.height : width;
21480
+ setRadius(max / 2);
21481
+ }
21482
+ }
21483
+ }, [showLegend]);
21484
+ const diameter = radius * 2; // get dimensions of the parent container to find the max radius, so we can fill the container AND always have a 16px wide donut
21485
+ const data = React__default.Children.map(children, child => ({
21486
+ id: child.props.id,
21487
+ color: child.props.color,
21488
+ label: child.props.label,
21489
+ value: child.props.value
21490
+ }));
21491
+ const displayedData = data.filter(child => visibleItems[child.id]);
21492
+ const total = displayedData.reduce((accum, entry) => accum + entry.value, 0);
21493
+ const showTooltip = (!showLegend || legendPosition === 'bottom') && displayedData.length > 0;
21494
+ const handleLegendClick = entry => {
21495
+ if (legendPosition === 'bottom' && !Array.isArray(entry)) {
21496
+ setVisibleItems({
21497
+ ...visibleItems,
21498
+ [entry.id]: !visibleItems[entry.id]
21499
+ });
21500
+ } else {
21501
+ const nextSelectedItem = Array.isArray(entry) ? entry.map(entryItem => entryItem.id) : [entry.id];
21502
+ // Using slice to avoid mutation of the react state 'selectedItem'
21503
+ const isCurrentSegmentActive = selectedItem.slice().sort().join(',') === nextSelectedItem.sort().join(',');
21504
+ if (onClick && !isCurrentSegmentActive) {
21505
+ onClick(entry);
21506
+ }
21507
+ setSelectedItem(isCurrentSegmentActive ? [] : nextSelectedItem);
21508
+ }
21509
+ };
21510
+ const handlePieClick = React__default.useCallback(pieId => {
21511
+ if (onClick && pieId !== undefined) {
21512
+ const pieProps = displayedData.find(item => item.id === pieId);
21513
+ onClick(pieProps);
21514
+ }
21515
+ }, [onClick, displayedData]);
21516
+ const singlePieDonutChart = displayedData.length === 1;
21517
+ const activeShapeColor = React__default.useMemo(() => {
21518
+ const getSegmentColor = item => item.reduce((colors, itemId) => {
21519
+ const visibleHoveredItem = displayedData.find(dataItem => dataItem.id === itemId);
21520
+ if (visibleHoveredItem) {
21521
+ colors[visibleHoveredItem.id] = visibleHoveredItem.color;
21522
+ }
21523
+ return colors;
21524
+ }, {});
21525
+ const hoveredSegmentColor = getSegmentColor(hoveredItem);
21526
+ const selectedSegmentColor = getSegmentColor(selectedItem);
21527
+ return legendPosition === 'bottom' || hoveredItem.length !== 0 ? hoveredSegmentColor : selectedSegmentColor;
21528
+ }, [hoveredItem, selectedItem, legendPosition]);
21529
+ if (ref.current && !radius) {
21530
+ return null;
21531
+ }
21532
+ const getActiveIndex = () => {
21533
+ if (hoveredItem.length > 0) {
21534
+ return hoveredItem.map(itemId => displayedData.findIndex(element => element.id === itemId));
21535
+ }
21536
+ return selectedItem.map(selectedItemId => displayedData.findIndex(element => element.id === selectedItemId));
21537
+ };
21538
+ const content = () => {
21539
+ const elements = React__default.Children.toArray(children).filter(child => /*#__PURE__*/React__default.isValidElement(child) && visibleItems[child.props.id]);
21540
+ return elements.length > 0 ? elements.map((child, index) => {
21541
+ var _getThemeColor;
21542
+ return /*#__PURE__*/React__default.createElement(Recharts.Cell, {
21543
+ key: `cell-${index}`,
21544
+ name: child.props.label,
21545
+ fill: (_getThemeColor = getThemeColor(child.props.color)) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-300')
21546
+ });
21547
+ }) : (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
21548
+ key: "empty-chart",
21549
+ name: '',
21550
+ fill: getThemeColor('grey-200')
21551
+ }));
21552
+ };
21553
+ return /*#__PURE__*/React__default.createElement("div", {
21554
+ className: cn('relative h-full w-full', {
21555
+ [`flex `]: showLegend,
21556
+ 'flex-col items-center': legendPosition === 'bottom'
21557
+ }),
21558
+ ref: ref
21559
+ }, /*#__PURE__*/React__default.createElement(CenteredLabel, {
21560
+ radius: radius,
21561
+ legendPosition: legendPosition,
21562
+ label: label,
21563
+ total: total,
21564
+ formatter: formatter,
21565
+ showLegend: showLegend
21566
+ }), /*#__PURE__*/React__default.createElement(Recharts.PieChart, {
21567
+ data: data,
21568
+ height: diameter,
21569
+ width: diameter,
21570
+ style: {
21571
+ transform: 'rotate(90deg) scale(-1,1)'
21572
+ }
21573
+ }, showTooltip ? (/*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps({
21574
+ style: {
21575
+ transform: 'rotate(90deg) scale(-1,1)'
21576
+ },
21577
+ singlePieDonutChart
21578
+ })))) : null, /*#__PURE__*/React__default.createElement(Recharts.Pie, {
21579
+ isAnimationActive: false,
21580
+ activeIndex: getActiveIndex(),
21581
+ activeShape: /*#__PURE__*/React__default.createElement(ActiveShape, {
21582
+ pieColors: activeShapeColor,
21583
+ onClick: handlePieClick
21584
+ }),
21585
+ data: displayedData.length > 0 ? displayedData : [],
21586
+ dataKey: "value",
21587
+ innerRadius: radius - HOVER_DONUT_WIDTH - DONUT_WIDTH,
21588
+ onMouseEnter: segment => displayedData.length > 0 && setHoveredItem([segment.id]),
21589
+ onMouseLeave: () => setHoveredItem([]),
21590
+ outerRadius: radius - HOVER_DONUT_WIDTH,
21591
+ paddingAngle: 2,
21592
+ // Prevents the pie group element from being focusable
21593
+ rootTabIndex: -1
21594
+ }, content())), showLegend && (/*#__PURE__*/React__default.createElement(Legend$1, {
21595
+ data: data,
21596
+ visibleItems: visibleItems,
21597
+ onClick: handleLegendClick,
21598
+ total: total,
21599
+ setHoveredItem: setHoveredItem,
21600
+ label: label,
21601
+ legendPosition: legendPosition,
21602
+ hoveredItem: hoveredItem,
21603
+ selectedItem: selectedItem,
21604
+ formatter: formatter
21605
+ })));
21606
+ };
21607
+ DonutChart.Segment = Segment;
21608
+
21609
+ const Line$1 = _ => null;
21610
+ const LineChart = function LineChart(externalProps) {
21611
+ const {
21612
+ children,
21613
+ data,
21614
+ formatter,
21615
+ ...props
21616
+ } = externalProps;
21617
+ const [hoveredLine, setHoveredLine] = React.useState(null);
21618
+ const [activeLines, setActiveLines] = React.useState(() => {
21619
+ const keys = {};
21620
+ React__default.Children.forEach(children, child => {
21621
+ keys[child.props.accessor] = true;
21622
+ });
21623
+ return keys;
21624
+ });
21625
+ const handleLegendClick = entry => {
21626
+ setHoveredLine(null);
21627
+ setActiveLines({
21628
+ ...activeLines,
21629
+ [entry.dataKey]: !activeLines[entry.dataKey]
21630
+ });
21631
+ };
21632
+ return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.LineChart, {
21633
+ data: data,
21634
+ margin: {
21635
+ top: 10,
21636
+ right: 0,
21637
+ left: -25,
21638
+ bottom: 0
21639
+ }
21640
+ }, /*#__PURE__*/React__default.createElement(Recharts.CartesianGrid, Object.assign({}, getCartesianGridProps())), /*#__PURE__*/React__default.createElement(Recharts.XAxis, Object.assign({}, getXAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.YAxis, Object.assign({}, getYAxisProps(props))), /*#__PURE__*/React__default.createElement(Recharts.Legend, Object.assign({}, getLegendProps({
21641
+ onClick: handleLegendClick,
21642
+ onMouseEnter: entry => setHoveredLine(entry.dataKey),
21643
+ onMouseLeave: () => setHoveredLine(null),
21644
+ activeItems: activeLines
21645
+ }))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
21646
+ formatter: formatter
21647
+ })), React__default.Children.map(children, child => {
21648
+ var _child$props$color, _child$props$color2;
21649
+ return /*#__PURE__*/React__default.createElement(Recharts.Line, {
21650
+ activeDot: {
21651
+ fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
21652
+ },
21653
+ dataKey: child.props.accessor,
21654
+ isAnimationActive: false,
21655
+ dot: false,
21656
+ name: child.props.label,
21657
+ stroke: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'blue-300'),
21658
+ strokeWidth: 2,
21659
+ hide: !activeLines[child.props.accessor],
21660
+ opacity: hoveredLine && child.props.accessor !== hoveredLine ? 0.3 : 1
21661
+ });
21662
+ })));
21663
+ };
21664
+ LineChart.Line = Line$1;
21665
+
20431
21666
  const Button$4 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
20432
21667
  const {
20433
21668
  ...attributes
@@ -20700,15 +21935,13 @@ const AgreementDisplay = props => {
20700
21935
  }));
20701
21936
  };
20702
21937
 
20703
- const Container$1 = ({
20704
- children
20705
- }) => {
21938
+ const Container$1 = props => {
20706
21939
  return /*#__PURE__*/React__default.createElement("div", {
20707
21940
  className: "-ml-2 flex flex-shrink-0 flex-grow-0 items-center gap-2 pr-2 xl:ml-auto xl:w-64",
20708
21941
  "data-taco": "header-agreements"
20709
21942
  }, /*#__PURE__*/React__default.createElement("span", {
20710
21943
  className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
20711
- }), children);
21944
+ }), props.children);
20712
21945
  };
20713
21946
  function AgreementSelector(props) {
20714
21947
  const {
@@ -21141,6 +22374,223 @@ Navigation2.Link = Link$3;
21141
22374
  Navigation2.Section = Section;
21142
22375
  Navigation2.Content = Content$a;
21143
22376
 
22377
+ const DATASET_SIZE_MULTIPLIER = 15;
22378
+ function useTableDataLoader2(fetchPage, fetchAll, options = {
22379
+ pageSize: DEFAULT_PAGE_SIZE
22380
+ }) {
22381
+ const loadPage = function (pageIndex, sorting, filters, hiddenColumns, search, reset = false) {
22382
+ try {
22383
+ // if a request is already pending for this page (and it's not a reset), skip it
22384
+ if (_pendingPageRequests.current[pageIndex] && !reset) {
22385
+ return Promise.resolve();
22386
+ }
22387
+ const hasChangedData = JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current) || search !== _lastUsedSearch.current;
22388
+ // if the page is already loaded and has actual rows, abort
22389
+ if (data.cache[pageIndex] && data.cache[pageIndex][0] && !hasChangedData && !reset) {
22390
+ return Promise.resolve();
22391
+ }
22392
+ // create an id to track the update
22393
+ const requestId = uuid.v4();
22394
+ // set the page as loading, so that subsequent requests don't retrigger it
22395
+ _pendingPageRequests.current[pageIndex] = true;
22396
+ const _temp2 = _catch(function () {
22397
+ _lastRequestId.current = requestId;
22398
+ return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters, hiddenColumns, search)).then(function (response) {
22399
+ length.current = response.length;
22400
+ // update state, here we do some "magic" to support "load in place"
22401
+ setData(currentData => {
22402
+ // if this request wasn't the last one, just return the current state to prevent weird updates
22403
+ if (_lastRequestId.current !== requestId) {
22404
+ return currentData;
22405
+ }
22406
+ const direction = getDirection(pageIndex, currentData.pages);
22407
+ const nextPages = getPages(pageIndex, currentData.lastFetchedPage, reset ? [] : currentData.pages, direction);
22408
+ // set values so we can track if they changed between loads
22409
+ _lastUsedSorting.current = sorting;
22410
+ _lastUsedFilters.current = filters;
22411
+ _lastUsedSearch.current = search;
22412
+ _lastUsedHiddenColumns.current = hiddenColumns;
22413
+ // cache data as an object to prevent any duplicates for pages
22414
+ let nextCache;
22415
+ if (reset || hasChangedData || !direction) {
22416
+ nextCache = nextPages.reduce((acc, p) => ({
22417
+ ...acc,
22418
+ [p]: Array(pageSize).fill(undefined)
22419
+ }), {});
22420
+ } else {
22421
+ nextCache = {
22422
+ ...currentData.cache
22423
+ };
22424
+ }
22425
+ nextCache[pageIndex] = response.data;
22426
+ // cleanup "unloaded" pages
22427
+ if (direction === 'forward' && currentData.rows.length >= DATASET_SIZE) {
22428
+ delete nextCache[currentData.pages[0]];
22429
+ } else if (direction === 'backward' && currentData.rows.length >= DATASET_SIZE) {
22430
+ delete nextCache[currentData.pages[currentData.pages.length - 1]];
22431
+ }
22432
+ // remap rows from the cached data - do it here and not in render to save some performance
22433
+ const rows = Object.values(nextCache).reduce((acc, p) => acc.concat(p), []);
22434
+ return {
22435
+ cache: nextCache,
22436
+ pages: nextPages,
22437
+ rows: rows,
22438
+ lastFetchedPage: pageIndex
22439
+ };
22440
+ });
22441
+ // reset pending requests
22442
+ delete _pendingPageRequests.current[pageIndex];
22443
+ });
22444
+ }, function () {});
22445
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
22446
+ } catch (e) {
22447
+ return Promise.reject(e);
22448
+ }
22449
+ };
22450
+ const {
22451
+ pageSize
22452
+ } = options;
22453
+ const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
22454
+ // track the data length, we don't know it until the first request
22455
+ const length = React__default.useRef(0);
22456
+ // data will be filled after the first request
22457
+ const [data, setData] = React__default.useState({
22458
+ rows: [],
22459
+ pages: [],
22460
+ cache: {},
22461
+ lastFetchedPage: undefined
22462
+ });
22463
+ // track which pages have been loaded to dedupe requests
22464
+ const _pendingPageRequests = React__default.useRef({});
22465
+ // it's possible to spam updates, e.g. sort, so we don't set state if the last request wasn't the current oen
22466
+ const _lastRequestId = React__default.useRef();
22467
+ // store last used properties
22468
+ const _lastUsedSorting = React__default.useRef([]);
22469
+ const _lastUsedFilters = React__default.useRef([]);
22470
+ const _lastUsedSearch = React__default.useRef();
22471
+ const _lastUsedHiddenColumns = React__default.useRef([]);
22472
+ const loadAll = function (sorting, filters, hiddenColumns, search) {
22473
+ try {
22474
+ // set values so we can track if they changed between loads
22475
+ _lastUsedSorting.current = sorting;
22476
+ _lastUsedFilters.current = filters;
22477
+ _lastUsedSearch.current = search;
22478
+ _lastUsedHiddenColumns.current = hiddenColumns;
22479
+ const _temp = _finallyRethrows(function () {
22480
+ return _catch(function () {
22481
+ return Promise.resolve(fetchAll(sorting, filters, hiddenColumns, search)).then(function (response) {
22482
+ length.current = response.length;
22483
+ const pages = [];
22484
+ const cache = {};
22485
+ const pageCount = Math.ceil(response.length / pageSize);
22486
+ Array.from(Array(pageCount).keys()).forEach(index => {
22487
+ pages.push(index);
22488
+ const startIndex = index * pageSize;
22489
+ cache[index] = response.data.slice(startIndex, startIndex + pageSize);
22490
+ });
22491
+ setData({
22492
+ cache,
22493
+ pages,
22494
+ rows: response.data,
22495
+ lastFetchedPage: undefined
22496
+ });
22497
+ });
22498
+ }, function () {});
22499
+ }, function (_wasThrown, _result) {
22500
+ // reset pending requests
22501
+ _pendingPageRequests.current = {};
22502
+ if (_wasThrown) throw _result;
22503
+ return _result;
22504
+ });
22505
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
22506
+ } catch (e) {
22507
+ return Promise.reject(e);
22508
+ }
22509
+ };
22510
+ const invalidate = function () {
22511
+ try {
22512
+ // reset stuff
22513
+ _pendingPageRequests.current = {};
22514
+ // load the current page again
22515
+ return loadPage(getCurrentPage(data.pages), _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
22516
+ } catch (e) {
22517
+ return Promise.reject(e);
22518
+ }
22519
+ };
22520
+ const handleSort = function (sorting) {
22521
+ try {
22522
+ // reset before loading the current page
22523
+ _pendingPageRequests.current = {};
22524
+ return loadPage(getCurrentPage(data.pages), sorting, _lastUsedFilters.current, _lastUsedHiddenColumns.current, _lastUsedSearch.current, true);
22525
+ } catch (e) {
22526
+ return Promise.reject(e);
22527
+ }
22528
+ };
22529
+ const handleFilter = function (filters, hiddenColumns) {
22530
+ try {
22531
+ // reset before loading the current page
22532
+ _pendingPageRequests.current = {};
22533
+ return loadPage(0, _lastUsedSorting.current, filters, hiddenColumns, _lastUsedSearch.current, true);
22534
+ } catch (e) {
22535
+ return Promise.reject(e);
22536
+ }
22537
+ };
22538
+ const handleSearch = function (search, hiddenColumns) {
22539
+ try {
22540
+ // reset before loading the current page
22541
+ _pendingPageRequests.current = {};
22542
+ return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, hiddenColumns, search, true);
22543
+ } catch (e) {
22544
+ return Promise.reject(e);
22545
+ }
22546
+ };
22547
+ return [{
22548
+ data: data.rows,
22549
+ pages: data.pages,
22550
+ length: length.current,
22551
+ loadAll,
22552
+ loadPage,
22553
+ onChangeFilter: handleFilter,
22554
+ onChangeSearch: handleSearch,
22555
+ onChangeSort: handleSort,
22556
+ pageSize,
22557
+ _experimentalDataLoader2: true
22558
+ }, invalidate];
22559
+ }
22560
+ function getCurrentPage(currentPages) {
22561
+ if (currentPages.length <= 2) {
22562
+ return currentPages[0];
22563
+ }
22564
+ // for even page lengths we can't know which is the current visible page - it could even be both
22565
+ // so we load one of them and rely on the "load next/previous page" functionality in row
22566
+ const middle = Math.floor(currentPages.length / 2);
22567
+ return currentPages[middle];
22568
+ }
22569
+ function getDirection(pageIndex, currentPages) {
22570
+ if (currentPages.length) {
22571
+ if (pageIndex === currentPages[currentPages.length - 1] + 1) {
22572
+ return 'forward';
22573
+ } else if (pageIndex === currentPages[0] - 1 || currentPages.length === 2 && currentPages[0] !== 0 && pageIndex === currentPages[0]) {
22574
+ return 'backward';
22575
+ }
22576
+ }
22577
+ return undefined;
22578
+ }
22579
+ function getPages(pageIndex, lastUsedPageIndex, currentPages, direction) {
22580
+ if (currentPages.length && (pageIndex === lastUsedPageIndex || currentPages.includes(pageIndex))) {
22581
+ return currentPages;
22582
+ }
22583
+ if (direction === 'forward') {
22584
+ const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(1) : currentPages;
22585
+ return nextPages.concat(pageIndex);
22586
+ }
22587
+ if (direction === 'backward') {
22588
+ const nextPages = currentPages.length === DATASET_SIZE_MULTIPLIER ? currentPages.slice(0, -1) : currentPages;
22589
+ return [pageIndex].concat(nextPages);
22590
+ }
22591
+ return [pageIndex];
22592
+ }
22593
+
21144
22594
  const useBoundaryOverflowDetection = (ref, dependencies = []) => {
21145
22595
  const [boundaryIndex, setBoundaryIndex] = React__default.useState();
21146
22596
  const dimensions = useBoundingClientRectListener(ref, dependencies);
@@ -21174,10 +22624,12 @@ const useOnClickOutside = (ref, callback) => {
21174
22624
  exports.Accordion = Accordion;
21175
22625
  exports.Alert = Alert;
21176
22626
  exports.AlertDialog = AlertDialog;
22627
+ exports.AreaChart = AreaChart;
21177
22628
  exports.Backdrop = Backdrop;
21178
22629
  exports.Badge = Badge;
21179
22630
  exports.BadgeIcon = BadgeIcon;
21180
22631
  exports.Banner = Banner;
22632
+ exports.BarChart = BarChart;
21181
22633
  exports.Base = Base;
21182
22634
  exports.Button = Button$1;
21183
22635
  exports.Calendar = Calendar$1;
@@ -21188,6 +22640,7 @@ exports.Combobox = Combobox;
21188
22640
  exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
21189
22641
  exports.Datepicker = Datepicker;
21190
22642
  exports.Dialog = Dialog;
22643
+ exports.DonutChart = DonutChart;
21191
22644
  exports.Drawer = Drawer;
21192
22645
  exports.Field = Field;
21193
22646
  exports.Form = Form;
@@ -21199,6 +22652,7 @@ exports.Icon = Icon;
21199
22652
  exports.IconButton = IconButton;
21200
22653
  exports.Input = Input;
21201
22654
  exports.Layout = Layout$1;
22655
+ exports.LineChart = LineChart;
21202
22656
  exports.List = List$1;
21203
22657
  exports.Listbox = Listbox;
21204
22658
  exports.LocalizationContext = LocalizationContext;
@@ -21276,6 +22730,7 @@ exports.useOnClickOutside = useOnClickOutside;
21276
22730
  exports.usePagination = usePagination;
21277
22731
  exports.useRadioGroup = useRadioGroup;
21278
22732
  exports.useTableDataLoader = useTableDataLoader;
22733
+ exports.useTableDataLoader2 = useTableDataLoader2;
21279
22734
  exports.useTableRowCreation = useTableRowCreation;
21280
22735
  exports.useToast = useToast;
21281
22736
  //# sourceMappingURL=taco.cjs.development.js.map