@economic/taco 2.45.0-alpha.0 → 2.45.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) 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/Icon/components/Autopay.d.ts +3 -0
  18. package/dist/components/Icon/components/AutopayPaused.d.ts +3 -0
  19. package/dist/components/Icon/components/Experiment.d.ts +3 -0
  20. package/dist/components/Icon/components/Person.d.ts +3 -0
  21. package/dist/components/Icon/components/PersonSolid.d.ts +3 -0
  22. package/dist/components/Icon/components/Wallet.d.ts +3 -0
  23. package/dist/components/Icon/components/index.d.ts +1 -1
  24. package/dist/components/Input/Input.d.ts +1 -1
  25. package/dist/components/Layout/components/Top.d.ts +3 -3
  26. package/dist/components/Menu/components/Item.d.ts +1 -1
  27. package/dist/components/Menu/components/Link.d.ts +1 -1
  28. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  29. package/dist/components/Pagination/PageNumbers.d.ts +0 -1
  30. package/dist/components/Popover/Popover.d.ts +1 -1
  31. package/dist/components/Provider/Localization.d.ts +2 -0
  32. package/dist/components/RadioGroup/RadioGroup.d.ts +3 -3
  33. package/dist/components/Report/Report.d.ts +1 -1
  34. package/dist/components/Select2/components/Option.d.ts +4 -4
  35. package/dist/components/Select2/components/Search.d.ts +1 -7
  36. package/dist/components/Select2/utilities.d.ts +2 -0
  37. package/dist/components/Table3/Table3.d.ts +2 -14
  38. package/dist/components/Table3/components/Columns/Cell/EditingDisplayCell.d.ts +0 -1
  39. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +3 -4
  40. package/dist/components/Table3/components/Editing/DiscardChangesConfirmationDialog.d.ts +7 -0
  41. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +13 -0
  42. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +12 -0
  43. package/dist/components/Table3/features/useEditingState.d.ts +29 -0
  44. package/dist/components/Table3/features/useTableEditing.d.ts +28 -37
  45. package/dist/components/Table3/listeners/useTableEditingListener.d.ts +1 -1
  46. package/dist/components/Table3/types.d.ts +24 -8
  47. package/dist/components/Table3/useTable3.d.ts +6 -0
  48. package/dist/components/Table3/util/editing.d.ts +10 -1
  49. package/dist/components/Tag/Tag.d.ts +1 -1
  50. package/dist/esm/index.css +76 -10
  51. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js +67 -0
  52. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js.map +1 -0
  53. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js +120 -0
  54. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js.map +1 -0
  55. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js +47 -0
  56. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js.map +1 -0
  57. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js +27 -0
  58. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js.map +1 -0
  59. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js +170 -0
  60. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js.map +1 -0
  61. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +164 -0
  62. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -0
  63. package/dist/esm/packages/taco/src/charts/components/Donut/util.js +5 -0
  64. package/dist/esm/packages/taco/src/charts/components/Donut/util.js.map +1 -0
  65. package/dist/esm/packages/taco/src/charts/components/Legend.js +145 -0
  66. package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -0
  67. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js +65 -0
  68. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js.map +1 -0
  69. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js +10 -0
  70. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js.map +1 -0
  71. package/dist/esm/packages/taco/src/charts/components/Tooltip.js +44 -0
  72. package/dist/esm/packages/taco/src/charts/components/Tooltip.js.map +1 -0
  73. package/dist/esm/packages/taco/src/charts/utils/color.js +24 -0
  74. package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -0
  75. package/dist/esm/packages/taco/src/charts/utils/common.js +34 -0
  76. package/dist/esm/packages/taco/src/charts/utils/common.js.map +1 -0
  77. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +6 -14
  78. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  79. package/dist/esm/packages/taco/src/components/Alert/Alert.js +2 -0
  80. package/dist/esm/packages/taco/src/components/Alert/Alert.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/Combobox/useCombobox.js +8 -5
  90. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  91. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +1 -0
  92. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  93. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +2 -4
  95. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js +19 -0
  97. package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js.map +1 -0
  98. package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js +19 -0
  99. package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js.map +1 -0
  100. package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js +20 -0
  101. package/dist/esm/packages/taco/src/components/Icon/components/Experiment.js.map +1 -0
  102. package/dist/esm/packages/taco/src/components/Icon/components/Person.js +19 -0
  103. package/dist/esm/packages/taco/src/components/Icon/components/Person.js.map +1 -0
  104. package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js +19 -0
  105. package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js.map +1 -0
  106. package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js +19 -0
  107. package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js.map +1 -0
  108. package/dist/esm/packages/taco/src/components/Icon/components/index.js +12 -0
  109. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  110. package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
  111. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Layout/components/Top.js +2 -2
  113. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Listbox/util.js +1 -7
  115. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +5 -0
  117. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +2 -2
  119. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  121. package/dist/esm/packages/taco/src/components/Provider/Localization.js +5 -3
  122. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  123. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Select2/Select2.js +50 -45
  125. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +8 -6
  127. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +3 -13
  129. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +75 -20
  131. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +1 -10
  133. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Select2/utilities.js +11 -1
  135. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
  137. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
  139. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  141. package/dist/esm/packages/taco/src/components/Table3/Table3.js +22 -7
  142. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  143. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js +1 -2
  144. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  145. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +42 -14
  146. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  147. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +7 -39
  148. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  149. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +19 -12
  150. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  151. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +34 -0
  152. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -0
  153. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +73 -0
  154. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -0
  155. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +2 -14
  156. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  157. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +96 -0
  158. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -0
  159. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +39 -6
  160. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  161. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +4 -17
  162. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  163. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +527 -0
  164. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -0
  165. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +71 -399
  166. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  167. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +44 -34
  168. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  169. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +46 -14
  170. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  171. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +19 -23
  172. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  173. package/dist/esm/packages/taco/src/components/Tag/Tag.js +6 -4
  174. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  175. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js +1 -1
  176. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js.map +1 -1
  177. package/dist/esm/packages/taco/src/index.js +5 -1
  178. package/dist/esm/packages/taco/src/index.js.map +1 -1
  179. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js +1 -1
  180. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
  181. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +20 -4
  182. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  183. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js +0 -4
  184. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
  185. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +1 -0
  186. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
  187. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  188. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +13 -9
  189. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  190. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js +15 -2
  191. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js.map +1 -1
  192. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +30 -17
  193. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  194. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +9 -6
  195. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  196. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js +7 -0
  197. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map +1 -1
  198. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +11 -0
  199. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  200. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +3 -3
  201. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  202. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +7 -2
  203. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  204. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +6 -3
  205. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  206. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +6 -2
  207. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
  208. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js +2 -0
  209. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js.map +1 -1
  210. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js +6 -0
  211. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js.map +1 -0
  212. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +5 -3
  213. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  214. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js +0 -2
  215. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  216. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +2 -1
  217. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  218. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +11 -2
  219. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  220. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +1 -2
  221. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  222. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +34 -8
  223. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  224. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +2 -2
  225. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  226. package/dist/esm/packages/taco/src/primitives/Table/types.js +1 -7
  227. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  228. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +2 -1
  229. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
  230. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js +2 -1
  231. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js.map +1 -1
  232. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +3 -3
  233. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  234. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +12 -7
  235. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
  236. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +2 -1
  237. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  238. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +1 -1
  239. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  240. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +3 -3
  241. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  242. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +6 -2
  243. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -1
  244. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +7 -1
  245. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  246. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +7 -1
  247. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  248. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +19 -3
  249. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  250. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  251. package/dist/esm/packages/taco/src/types.js.map +1 -1
  252. package/dist/esm/packages/taco/src/utils/dom.js +35 -13
  253. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  254. package/dist/esm/packages/taco/src/utils/tailwind.js +2 -0
  255. package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -1
  256. package/dist/esm/packages/taco/tailwind.colors.js +122 -0
  257. package/dist/esm/packages/taco/tailwind.colors.js.map +1 -0
  258. package/dist/index.css +76 -10
  259. package/dist/index.d.ts +5 -0
  260. package/dist/primitives/Collection/components/Root.d.ts +3 -1
  261. package/dist/primitives/Table/Core/Table.d.ts +1 -0
  262. package/dist/primitives/Table/Core/components/Body/EmptyStateBody.d.ts +1 -0
  263. package/dist/primitives/Table/Core/components/Body/util.d.ts +4 -4
  264. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +3 -1
  265. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +1 -1
  266. package/dist/primitives/Table/Core/components/Row/RowContext.d.ts +2 -0
  267. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.d.ts +3 -0
  268. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.d.ts +0 -1
  269. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +0 -3
  270. package/dist/primitives/Table/Core/features/useTableRenderer.d.ts +2 -2
  271. package/dist/primitives/Table/Core/features/useTableStyle.d.ts +3 -3
  272. package/dist/primitives/Table/Core/types.d.ts +5 -0
  273. package/dist/primitives/Table/Core/useTable.d.ts +2 -2
  274. package/dist/primitives/Table/types.d.ts +3 -7
  275. package/dist/primitives/Table/useTableManager/features/useTableRowExpansion.d.ts +2 -1
  276. package/dist/primitives/Table/useTableManager/features/useTableServerLoading.d.ts +3 -3
  277. package/dist/primitives/Table/useTableManager/types.d.ts +0 -1
  278. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
  279. package/dist/primitives/Table/useTableManager/util/dataTypes.d.ts +1 -1
  280. package/dist/taco.cjs.development.js +2349 -881
  281. package/dist/taco.cjs.development.js.map +1 -1
  282. package/dist/taco.cjs.production.min.js +1 -1
  283. package/dist/taco.cjs.production.min.js.map +1 -1
  284. package/dist/types.d.ts +1 -1
  285. package/dist/utils/dom.d.ts +2 -1
  286. package/package.json +20 -19
  287. package/tailwind.colors.js +121 -0
  288. package/tailwind.config.js +3 -2
  289. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +0 -11
  290. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +0 -90
  291. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +0 -1
@@ -43,10 +43,12 @@ var set = _interopDefault(require('lodash/set'));
43
43
  var unset = _interopDefault(require('lodash/unset'));
44
44
  var compact = _interopDefault(require('lodash/compact'));
45
45
  var pullAt = _interopDefault(require('lodash/pullAt'));
46
- var lodash = require('lodash');
46
+ var omit = _interopDefault(require('lodash/omit'));
47
+ var setWith = _interopDefault(require('lodash/setWith'));
47
48
  var TabsPrimitive = require('@radix-ui/react-tabs');
48
49
  var Joyride = require('react-joyride');
49
50
  var Joyride__default = _interopDefault(Joyride);
51
+ var Recharts = require('recharts');
50
52
 
51
53
  const AVAILABLE_COLORS = ['green', 'yellow', 'red', 'blue', 'purple', 'brown', 'pink', 'orange', 'grey', 'transparent'];
52
54
  const getColorByState = state => {
@@ -57,6 +59,8 @@ const getColorByState = state => {
57
59
  return 'yellow';
58
60
  case 'error':
59
61
  return 'red';
62
+ case 'experiment':
63
+ return 'purple';
60
64
  case 'success':
61
65
  return 'green';
62
66
  default:
@@ -389,6 +393,36 @@ function IconAttach(props, svgRef) {
389
393
  }
390
394
  var Attach = /*#__PURE__*/React.forwardRef(IconAttach);
391
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
+
392
426
  function IconAutotextInsert(props, svgRef) {
393
427
  return /*#__PURE__*/React.createElement("svg", Object.assign({
394
428
  xmlns: "http://www.w3.org/2000/svg",
@@ -1583,6 +1617,22 @@ function IconExpenses(props, svgRef) {
1583
1617
  }
1584
1618
  var Expenses = /*#__PURE__*/React.forwardRef(IconExpenses);
1585
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
+
1586
1636
  function IconExportToExcel(props, svgRef) {
1587
1637
  return /*#__PURE__*/React.createElement("svg", Object.assign({
1588
1638
  xmlns: "http://www.w3.org/2000/svg",
@@ -2624,6 +2674,21 @@ function IconPersonPlus(props, svgRef) {
2624
2674
  }
2625
2675
  var PersonPlus = /*#__PURE__*/React.forwardRef(IconPersonPlus);
2626
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
+
2627
2692
  function IconPersonTick(props, svgRef) {
2628
2693
  return /*#__PURE__*/React.createElement("svg", Object.assign({
2629
2694
  xmlns: "http://www.w3.org/2000/svg",
@@ -2637,6 +2702,21 @@ function IconPersonTick(props, svgRef) {
2637
2702
  }
2638
2703
  var PersonTick = /*#__PURE__*/React.forwardRef(IconPersonTick);
2639
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
+
2640
2720
  function IconPhoneSolid(props, svgRef) {
2641
2721
  return /*#__PURE__*/React.createElement("svg", Object.assign({
2642
2722
  fill: "none",
@@ -3406,6 +3486,21 @@ function IconUnreconciled(props, svgRef) {
3406
3486
  }
3407
3487
  var Unreconciled = /*#__PURE__*/React.forwardRef(IconUnreconciled);
3408
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
+
3409
3504
  function IconWarning(props, svgRef) {
3410
3505
  return /*#__PURE__*/React.createElement("svg", Object.assign({
3411
3506
  fill: "none",
@@ -3503,6 +3598,8 @@ const icons = {
3503
3598
  'attach-cancel': AttachCancel,
3504
3599
  'attach-warning': AttachWarning,
3505
3600
  attach: Attach,
3601
+ 'autopay-paused': AutopayPaused,
3602
+ autopay: Autopay,
3506
3603
  'autotext-insert': AutotextInsert,
3507
3604
  autotext: Autotext,
3508
3605
  'basic-tabs': BasicTabs,
@@ -3593,6 +3690,7 @@ const icons = {
3593
3690
  envelope: Envelope,
3594
3691
  'expand-view': ExpandView,
3595
3692
  expenses: Expenses,
3693
+ experiment: Experiment,
3596
3694
  'export-to-excel': ExportToExcel,
3597
3695
  'export-to-pdf': ExportToPdf,
3598
3696
  export: Export,
@@ -3669,7 +3767,9 @@ const icons = {
3669
3767
  'person-change': PersonChange,
3670
3768
  'person-minus': PersonMinus,
3671
3769
  'person-plus': PersonPlus,
3770
+ 'person-solid': PersonSolid,
3672
3771
  'person-tick': PersonTick,
3772
+ person: Person,
3673
3773
  'phone-solid': PhoneSolid,
3674
3774
  phone: Phone,
3675
3775
  play: Play,
@@ -3728,6 +3828,7 @@ const icons = {
3728
3828
  undo: Undo,
3729
3829
  undock: Undock,
3730
3830
  unreconciled: Unreconciled,
3831
+ wallet: Wallet,
3731
3832
  warning: Warning,
3732
3833
  webshop: Webshop,
3733
3834
  website: Website,
@@ -3797,6 +3898,8 @@ const getIconName = state => {
3797
3898
  return 'warning';
3798
3899
  case 'error':
3799
3900
  return 'close';
3901
+ case 'experiment':
3902
+ return 'experiment';
3800
3903
  case 'success':
3801
3904
  return 'tick';
3802
3905
  default:
@@ -4037,33 +4140,25 @@ const Accordion = props => {
4037
4140
  const context = React__default.useMemo(() => ({
4038
4141
  as
4039
4142
  }), [as]);
4040
- const type = typeof defaultId === 'string' || typeof id === 'string' ? 'single' : 'multiple';
4041
4143
  let valueProps;
4042
4144
  if (defaultId) {
4043
- valueProps = type === 'single' ? {
4044
- type: 'single',
4045
- defaultValue: defaultId
4046
- } : {
4047
- type: 'multiple',
4048
- defaultValue: defaultId
4145
+ valueProps = {
4146
+ defaultValue: defaultId || undefined
4049
4147
  };
4050
4148
  } else {
4051
- valueProps = type === 'single' ? {
4052
- type: 'single',
4053
- onValueChange: onChange,
4054
- value: id || undefined
4055
- } : {
4056
- type: 'multiple',
4149
+ valueProps = {
4057
4150
  onValueChange: onChange,
4058
4151
  value: id || undefined
4059
4152
  };
4060
4153
  }
4154
+ const type = typeof valueProps.defaultValue === 'string' || typeof valueProps.value === 'string' ? 'single' : 'multiple';
4061
4155
  const className = cn('divide-y divide-grey-200', props.className);
4062
4156
  return /*#__PURE__*/React__default.createElement(AccordionContext.Provider, {
4063
4157
  value: context
4064
4158
  }, /*#__PURE__*/React__default.createElement(AccordionPrimitive.Root, Object.assign({}, otherProps, valueProps, {
4065
4159
  "data-taco": "accordion",
4066
- className: className
4160
+ className: className,
4161
+ type: type
4067
4162
  })));
4068
4163
  };
4069
4164
  Accordion.Item = Item;
@@ -4089,10 +4184,10 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
4089
4184
  ...otherProps
4090
4185
  } = props;
4091
4186
  const isTransparent = color === 'transparent';
4092
- 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', {
4093
4188
  [`border ${getOutlineColorShadeClasses(color)}`]: outline,
4094
- [`border-transparent font-normal ${getSubtleColorShadeClasses(color)}`]: subtle,
4095
- [`border-transparent ${getColorShadeClasses(color)}`]: !outline && !subtle,
4189
+ [`border-none font-normal ${getSubtleColorShadeClasses(color)}`]: subtle,
4190
+ [`border-none ${getColorShadeClasses(color)}`]: !outline && !subtle,
4096
4191
  'h-4 min-w-0 py-0 px-1 text-xs': small,
4097
4192
  'h-2 w-2 min-w-0': compact,
4098
4193
  'font-bold': outline || !subtle,
@@ -4104,12 +4199,15 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
4104
4199
  if (compact) {
4105
4200
  return /*#__PURE__*/React.createElement(VisuallyHidden, null, children);
4106
4201
  }
4202
+ const contentToRender = typeof children === 'string' ? /*#__PURE__*/React.createElement("span", {
4203
+ className: "items-center truncate"
4204
+ }, children) : children;
4107
4205
  if (status) {
4108
4206
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4109
- className: cn('mr-1 h-2 w-2 rounded-full', getColorShadeClasses(color))
4110
- }), children);
4207
+ className: cn('mr-1 h-2 w-2 shrink-0 rounded-full', getColorShadeClasses(color))
4208
+ }), contentToRender);
4111
4209
  }
4112
- return children;
4210
+ return contentToRender;
4113
4211
  };
4114
4212
  return /*#__PURE__*/React.createElement("span", Object.assign({}, otherProps, {
4115
4213
  "aria-atomic": "true",
@@ -4137,6 +4235,11 @@ const getBannerIcon = type => {
4137
4235
  icon: "close",
4138
4236
  color: "red"
4139
4237
  });
4238
+ case 'experiment':
4239
+ return /*#__PURE__*/React__default.createElement(BadgeIcon, {
4240
+ icon: "experiment",
4241
+ color: "purple"
4242
+ });
4140
4243
  case 'warning':
4141
4244
  return /*#__PURE__*/React__default.createElement(BadgeIcon, {
4142
4245
  icon: "warning",
@@ -4169,7 +4272,7 @@ const useMergedRef = ref => {
4169
4272
  };
4170
4273
 
4171
4274
  // taken from react-aria
4172
- const FOCUSABLE_ELEMENTS = ['input:not([disabled]):not([type=hidden])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'a[href]', 'area[href]', 'summary', 'iframe', 'object', 'embed', 'audio[controls]', 'video[controls]', '[contenteditable]', '[tabindex]:not([tabindex="-1"]):not([disabled])', 'details:not([disabled])', 'summary:not(:disabled)'];
4275
+ const FOCUSABLE_ELEMENTS = ['[tabindex]:not([disabled])', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'a[href]', 'area[href]', 'summary', 'iframe', 'object', 'embed', 'audio[controls]', 'video[controls]', '[contenteditable]', 'details:not([disabled])', 'summary:not(:disabled)'];
4173
4276
  const hasFocusableElement = element => {
4174
4277
  if (!element) {
4175
4278
  return null;
@@ -4195,13 +4298,20 @@ const getNextFocussableElement = currentElement => {
4195
4298
  if (!currentElement) {
4196
4299
  return null;
4197
4300
  }
4198
- const focussableElements = [...document.querySelectorAll(FOCUSABLE_ELEMENTS.join(','))];
4301
+ let focussableElements = [...document.querySelectorAll(FOCUSABLE_ELEMENTS.join(','))];
4199
4302
  const currentElementIndex = focussableElements.indexOf(currentElement);
4200
- // If the currentElement is not in the focussable elements list or it is the last element
4201
- if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {
4202
- return null;
4303
+ if (currentElementIndex > -1) {
4304
+ focussableElements = focussableElements.slice(currentElementIndex + 1).filter(element => element.getAttribute('tabindex') !== '-1');
4305
+ if (focussableElements.length) {
4306
+ var _focussableElements$;
4307
+ focussableElements = focussableElements.filter(element => {
4308
+ var _element$checkVisibil, _element$checkVisibil2;
4309
+ return (_element$checkVisibil = (_element$checkVisibil2 = element.checkVisibility) === null || _element$checkVisibil2 === void 0 ? void 0 : _element$checkVisibil2.call(element)) !== null && _element$checkVisibil !== void 0 ? _element$checkVisibil : true;
4310
+ });
4311
+ return (_focussableElements$ = focussableElements[0]) !== null && _focussableElements$ !== void 0 ? _focussableElements$ : null;
4312
+ }
4203
4313
  }
4204
- return focussableElements[currentElementIndex + 1];
4314
+ return null;
4205
4315
  };
4206
4316
  const getOverlaySelector = element => {
4207
4317
  switch (element === null || element === void 0 ? void 0 : element.getAttribute('role')) {
@@ -4213,21 +4323,28 @@ const getOverlaySelector = element => {
4213
4323
  return undefined;
4214
4324
  }
4215
4325
  };
4216
- function isElementInsideOrTriggeredFromContainer(element, container) {
4326
+ function isElementTriggeredFromContainer(element, container) {
4217
4327
  var _getOverlaySelector, _element$closest;
4218
4328
  const selector = (_getOverlaySelector = getOverlaySelector(element)) !== null && _getOverlaySelector !== void 0 ? _getOverlaySelector : getOverlaySelector((_element$closest = element === null || element === void 0 ? void 0 : element.closest('[role=dialog],[role=menu]')) !== null && _element$closest !== void 0 ? _element$closest : null);
4219
4329
  if (selector) {
4220
- if (container !== null && container !== void 0 && container.querySelector(selector)) {
4330
+ const escapedSelector = CSS.escape(selector);
4331
+ if (container !== null && container !== void 0 && container.querySelector(escapedSelector)) {
4332
+ return true;
4333
+ }
4334
+ const elementInDocument = document.querySelector(escapedSelector);
4335
+ if (elementInDocument === container) {
4221
4336
  return true;
4222
4337
  }
4223
- const elementInDocument = document.querySelector(selector);
4224
4338
  // if the element does exist, see if it is itself connected to somethng that was triggered from the container
4225
4339
  if (elementInDocument) {
4226
- return isElementInsideOrTriggeredFromContainer(elementInDocument, container);
4340
+ return isElementTriggeredFromContainer(elementInDocument, container);
4227
4341
  }
4228
4342
  return false;
4229
4343
  }
4230
- return !!(container !== null && container !== void 0 && container.contains(element));
4344
+ return false;
4345
+ }
4346
+ function isElementInsideOrTriggeredFromContainer(element, container) {
4347
+ return isElementTriggeredFromContainer(element, container) || !!(container !== null && container !== void 0 && container.contains(element));
4231
4348
  }
4232
4349
  function isElementInsideOverlay(element) {
4233
4350
  return !!(element !== null && element !== void 0 && element.closest('[role=dialog],[role=menu]'));
@@ -4240,7 +4357,15 @@ function isElementInteractive(element) {
4240
4357
  if (!element) {
4241
4358
  return false;
4242
4359
  }
4243
- 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;
4244
4369
  }
4245
4370
  function isElementInsideTable3OrReport(element) {
4246
4371
  return !!(element !== null && element !== void 0 && element.closest('[data-taco^=table]'));
@@ -4373,7 +4498,7 @@ const Tooltip = /*#__PURE__*/React.forwardRef(function Tooltip(props, ref) {
4373
4498
  });
4374
4499
 
4375
4500
  const getButtonClasses = () => {
4376
- 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';
4377
4502
  };
4378
4503
  const getAppearanceClasses = (value, icon = false) => {
4379
4504
  switch (value) {
@@ -4721,7 +4846,9 @@ const defaultLocalisationTexts = {
4721
4846
  tooltip: 'Edit table'
4722
4847
  },
4723
4848
  create: {
4724
- label: 'New'
4849
+ label: 'New',
4850
+ disabled: 'Existing new row must be saved',
4851
+ saving: 'Saving...'
4725
4852
  }
4726
4853
  },
4727
4854
  clearChangesConfirmationDialog: {
@@ -4743,8 +4870,8 @@ const defaultLocalisationTexts = {
4743
4870
  },
4744
4871
  validation: {
4745
4872
  alert: {
4746
- titleOne: '[COUNT] unsaved entry:',
4747
- titlePlural: '[COUNT] unsaved entries:',
4873
+ titleOne: '[COUNT] unsaved row:',
4874
+ titlePlural: '[COUNT] unsaved rows:',
4748
4875
  messageOne: "[COLUMN] [ROW] is incomplete and hasn't been saved.",
4749
4876
  messagePlural: "[COLUMN] [ROW] are incomplete and haven't been saved.",
4750
4877
  messageRow: 'Row',
@@ -4852,7 +4979,8 @@ const Base$1 = /*#__PURE__*/React.forwardRef(function ButtonBase(props, ref) {
4852
4979
  }, props.className);
4853
4980
  return createButtonWithTooltip({
4854
4981
  ...otherProps,
4855
- 'data-taco': 'button'
4982
+ 'data-taco': 'button',
4983
+ 'data-appearance': appearance
4856
4984
  }, className, ref);
4857
4985
  });
4858
4986
  const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
@@ -5240,7 +5368,7 @@ const getInputClasses = props => {
5240
5368
  const disabled = props.disabled || !!props['aria-disabled'];
5241
5369
  const readOnly = props.readOnly || !!props['aria-readonly'];
5242
5370
  const invalid = props.invalid || !!props['aria-invalid'];
5243
- 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',
5371
+ 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',
5244
5372
  // hide the arrow controls on input[type=number]
5245
5373
  '[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none', {
5246
5374
  'bg-white': !props.highlighted && !readOnly,
@@ -5744,13 +5872,7 @@ const searchForString = (child, value, strategy = 'includes') => {
5744
5872
  }
5745
5873
  return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
5746
5874
  } else {
5747
- const childLowerCase = child.toString().toLowerCase();
5748
- const valueLowerCase = String(value).toLowerCase();
5749
- if (strategy === 'startsWith') {
5750
- return childLowerCase.startsWith(valueLowerCase);
5751
- } else {
5752
- return childLowerCase.includes(valueLowerCase);
5753
- }
5875
+ return child.toString().toLowerCase()[strategy](String(value).toLowerCase());
5754
5876
  }
5755
5877
  } catch {
5756
5878
  return false;
@@ -5942,7 +6064,6 @@ const useCombobox = ({
5942
6064
  }, [open]);
5943
6065
  // event handlers
5944
6066
  const handleInputBlur = event => {
5945
- event.persist();
5946
6067
  if (listRef.current && event.relatedTarget === listRef.current) {
5947
6068
  event.preventDefault();
5948
6069
  return;
@@ -5955,7 +6076,14 @@ const useCombobox = ({
5955
6076
  if (parents !== null && parents.length > 0) {
5956
6077
  event.detail.parents = parents;
5957
6078
  }
5958
- onChange(event);
6079
+ const isComboboxChangeEvent = event => {
6080
+ return !event.isTrusted; // this makes sure we only take our own custom event, and not the browser default blur on tab.
6081
+ };
6082
+ // Only trigger onChange if this is our custom event (not a browser blur event)
6083
+ // or if the input was cleared.
6084
+ if (isComboboxChangeEvent(event) || event.target.value === '' && !inline) {
6085
+ onChange(event);
6086
+ }
5959
6087
  }
5960
6088
  if (props.onBlur) {
5961
6089
  props.onBlur(event);
@@ -5969,12 +6097,10 @@ const useCombobox = ({
5969
6097
  setOpen(true);
5970
6098
  }
5971
6099
  if (onClick) {
5972
- event.persist();
5973
6100
  onClick(event);
5974
6101
  }
5975
6102
  };
5976
6103
  const handleInputKeyDown = event => {
5977
- event.persist();
5978
6104
  if (!event.ctrlKey && !event.metaKey) {
5979
6105
  switch (event.key) {
5980
6106
  case 'Backspace':
@@ -6043,7 +6169,6 @@ const useCombobox = ({
6043
6169
  }
6044
6170
  }
6045
6171
  if (!event.isDefaultPrevented() && onKeyDown) {
6046
- event.persist();
6047
6172
  onKeyDown(event);
6048
6173
  }
6049
6174
  };
@@ -6299,6 +6424,7 @@ const useDatepicker = ({
6299
6424
  setInternalValue(event.target.value);
6300
6425
  };
6301
6426
  const handleChange = date => {
6427
+ // Update both the input value and calendar view date when selecting a date
6302
6428
  setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
6303
6429
  };
6304
6430
  const handleKeyDown = event => {
@@ -7646,7 +7772,7 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
7646
7772
  onCheckedChange: onChange,
7647
7773
  ref: ref
7648
7774
  }), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
7649
- className: "'will-change-transform mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
7775
+ className: "pointer-events-none mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
7650
7776
  }));
7651
7777
  if (label) {
7652
7778
  const labelContainerClassName = cn('flex self-start cursor-pointer', {
@@ -8208,6 +8334,11 @@ const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref)
8208
8334
  if (child.props.shortcut) {
8209
8335
  shortcuts.push(createShortcutKeyDownHandler(child.props.shortcut, event => {
8210
8336
  event.preventDefault();
8337
+ const dialog = document.querySelector('[role="dialog"]');
8338
+ // Don't trigger the shortcut if it is outside of the dialog
8339
+ if (dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(internalRef.current))) {
8340
+ return;
8341
+ }
8211
8342
  menu === null || menu === void 0 ? void 0 : menu.open();
8212
8343
  setTimeout(() => {
8213
8344
  var _childrenRefs$current, _childrenRefs$current2;
@@ -8282,7 +8413,7 @@ const Shortcut = ({
8282
8413
  className: className
8283
8414
  }), texts.map(key => (/*#__PURE__*/React__default.createElement("kbd", {
8284
8415
  key: key,
8285
- 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"
8416
+ 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"
8286
8417
  }, key))));
8287
8418
  };
8288
8419
 
@@ -8706,10 +8837,10 @@ const ModeSwitch = /*#__PURE__*/React.forwardRef(function ModeSwitch(props, ref)
8706
8837
  onCheckedChange: onChange,
8707
8838
  ref: ref
8708
8839
  }), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
8709
- className: "'will-change-transform flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[100%]"
8840
+ className: "pointer-events-none flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform will-change-transform group-disabled:opacity-50 group-aria-checked:translate-x-[100%]"
8710
8841
  }, /*#__PURE__*/React.createElement(Icon, {
8711
8842
  name: "edit-simple",
8712
- className: "!h-5 !w-5"
8843
+ className: "pointer-events-none !h-5 !w-5"
8713
8844
  })));
8714
8845
  });
8715
8846
  ModeSwitch.displayName = 'ModeSwitch';
@@ -9822,11 +9953,6 @@ const fixedForwardRef = React__default.forwardRef;
9822
9953
  TableFilterComparator[TableFilterComparator["HasAllOf"] = 12] = "HasAllOf";
9823
9954
  TableFilterComparator[TableFilterComparator["HasNoneOf"] = 13] = "HasNoneOf";
9824
9955
  })(exports.TableFilterComparator || (exports.TableFilterComparator = {}));
9825
- (function (TableServerLoadAllState) {
9826
- TableServerLoadAllState[TableServerLoadAllState["Incomplete"] = 0] = "Incomplete";
9827
- TableServerLoadAllState[TableServerLoadAllState["Loading"] = 1] = "Loading";
9828
- TableServerLoadAllState[TableServerLoadAllState["Completed"] = 2] = "Completed";
9829
- })(exports.TableServerLoadAllState || (exports.TableServerLoadAllState = {}));
9830
9956
 
9831
9957
  const dataTypes = {
9832
9958
  auto: {
@@ -9864,9 +9990,13 @@ const dataTypes = {
9864
9990
  if (value === undefined) {
9865
9991
  return '';
9866
9992
  }
9867
- 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, {
9993
+ 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, {
9868
9994
  minimumFractionDigits: 2
9869
- }).format(Number(value));
9995
+ });
9996
+ const decimalSeperator = formatter.format(1.1).substring(1, 2);
9997
+ const localisedValue = formatter.format(Number(value));
9998
+ const localisedValueWithoutThousandsSeperator = decimalSeperator === '.' ? localisedValue.replace(',', '') : localisedValue.replace('.', '');
9999
+ return [localisedValue, localisedValueWithoutThousandsSeperator];
9870
10000
  }
9871
10001
  }
9872
10002
  };
@@ -10014,7 +10144,13 @@ function isMatched(searchQuery, cellValue, dataType, localization) {
10014
10144
  const cellDisplayValue = dataTypeProperties.getDisplayValue(cellValue, {
10015
10145
  localization
10016
10146
  });
10017
- if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
10147
+ if (Array.isArray(cellDisplayValue)) {
10148
+ for (const displayValue of cellDisplayValue) {
10149
+ if (isWeakContains(displayValue, searchQuery)) {
10150
+ return true;
10151
+ }
10152
+ }
10153
+ } else if (cellDisplayValue !== undefined && isWeakContains(cellDisplayValue, searchQuery)) {
10018
10154
  return true;
10019
10155
  }
10020
10156
  }
@@ -10312,10 +10448,15 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
10312
10448
  column.cell = info => renderer(info.getValue(), info.row.original);
10313
10449
  } else if (dataTypeProperties.getDisplayValue) {
10314
10450
  const dataTypeRenderer = value => {
10315
- var _dataTypeProperties$g, _dataTypeProperties$g2;
10316
- return (_dataTypeProperties$g = (_dataTypeProperties$g2 = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g2 === void 0 ? void 0 : _dataTypeProperties$g2.call(dataTypeProperties, value, {
10451
+ var _dataTypeProperties$g;
10452
+ const displayValue = (_dataTypeProperties$g = dataTypeProperties.getDisplayValue) === null || _dataTypeProperties$g === void 0 ? void 0 : _dataTypeProperties$g.call(dataTypeProperties, value, {
10317
10453
  localization
10318
- })) !== null && _dataTypeProperties$g !== void 0 ? _dataTypeProperties$g : value;
10454
+ });
10455
+ if (Array.isArray(displayValue)) {
10456
+ var _displayValue$;
10457
+ return (_displayValue$ = displayValue[0]) !== null && _displayValue$ !== void 0 ? _displayValue$ : value;
10458
+ }
10459
+ return displayValue !== null && displayValue !== void 0 ? displayValue : value;
10319
10460
  };
10320
10461
  column.cell = info => dataTypeRenderer(info.getValue());
10321
10462
  column.meta.renderer = dataTypeRenderer;
@@ -10412,6 +10553,15 @@ function configureReactTableOptions(options, props, localization) {
10412
10553
  // We don't want to expose internal Tanstack Table row, so we need to wrap enableRowSelection callback into additional function,
10413
10554
  // which receives the React Table Row object and passes row.original to a callback.
10414
10555
  const reactTableEnableRowSelection = typeof options.enableRowSelection === 'function' ? row => options.enableRowSelection(row.original) : options.enableRowSelection;
10556
+ let getRowId;
10557
+ if (props.rowIdentityAccessor) {
10558
+ getRowId = (originalRow, index) => {
10559
+ if (originalRow) {
10560
+ return String(originalRow[props.rowIdentityAccessor]);
10561
+ }
10562
+ return String(index);
10563
+ };
10564
+ }
10415
10565
  const tableOptions = {
10416
10566
  defaultColumn: {
10417
10567
  enableColumnFilter: options.enableFiltering || true,
@@ -10430,11 +10580,13 @@ function configureReactTableOptions(options, props, localization) {
10430
10580
  enableGrouping: true,
10431
10581
  enableHiding: (_options$enableColumn2 = options.enableColumnHiding) !== null && _options$enableColumn2 !== void 0 ? _options$enableColumn2 : false,
10432
10582
  enablePinning: (_options$enableColumn3 = options.enableColumnFreezing) !== null && _options$enableColumn3 !== void 0 ? _options$enableColumn3 : false,
10583
+ enableRowPinning: true,
10433
10584
  enableRowSelection: reactTableEnableRowSelection !== null && reactTableEnableRowSelection !== void 0 ? reactTableEnableRowSelection : false,
10434
10585
  enableSorting: (_options$enableSortin = options.enableSorting) !== null && _options$enableSortin !== void 0 ? _options$enableSortin : false,
10435
10586
  // models for default features
10436
10587
  getExpandedRowModel: reactTable.getExpandedRowModel(),
10437
10588
  getGroupedRowModel: reactTable.getGroupedRowModel(),
10589
+ getRowId,
10438
10590
  groupedColumnMode: false
10439
10591
  };
10440
10592
  if (tableOptions.enableColumnResizing) {
@@ -10514,6 +10666,7 @@ const DEFAULT_PRESET = {
10514
10666
  enableColumnHiding: false,
10515
10667
  enableColumnResizing: false,
10516
10668
  enableRowExpansion: false,
10669
+ enableRowExpansionAll: true,
10517
10670
  enableRowSelection: false,
10518
10671
  // custom -- common between all table types
10519
10672
  enableColumnOrdering: false,
@@ -10540,6 +10693,7 @@ const presets = {
10540
10693
  enableColumnHiding: true,
10541
10694
  enableColumnResizing: true,
10542
10695
  enableRowExpansion: true,
10696
+ enableRowExpansionAll: true,
10543
10697
  enableRowSelection: true,
10544
10698
  // custom -- common between all table types
10545
10699
  enableColumnOrdering: true,
@@ -10565,6 +10719,7 @@ const presets = {
10565
10719
  enableColumnHiding: false,
10566
10720
  enableColumnResizing: false,
10567
10721
  enableRowExpansion: true,
10722
+ enableRowExpansionAll: true,
10568
10723
  enableRowSelection: true,
10569
10724
  // custom -- common between all table types
10570
10725
  enableColumnOrdering: false,
@@ -10590,6 +10745,7 @@ const presets = {
10590
10745
  enableColumnHiding: false,
10591
10746
  enableColumnResizing: false,
10592
10747
  enableRowExpansion: true,
10748
+ enableRowExpansionAll: true,
10593
10749
  enableRowSelection: false,
10594
10750
  // custom -- common between all table types
10595
10751
  enableColumnOrdering: false,
@@ -10607,7 +10763,7 @@ const presets = {
10607
10763
  }
10608
10764
  };
10609
10765
  function getTableFeaturePreset(props) {
10610
- 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;
10766
+ 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;
10611
10767
  const presetOptions = props.preset ? presets[props.preset] : DEFAULT_PRESET;
10612
10768
  const enableRowActions = (_props$enableRowActio = props.enableRowActions) !== null && _props$enableRowActio !== void 0 ? _props$enableRowActio : presetOptions.enableRowActions;
10613
10769
  const enableRowClick = (_props$enableRowClick = props.enableRowClick) !== null && _props$enableRowClick !== void 0 ? _props$enableRowClick : presetOptions.enableRowClick;
@@ -10615,6 +10771,7 @@ function getTableFeaturePreset(props) {
10615
10771
  const enableRowDrop = (_props$enableRowDrop = props.enableRowDrop) !== null && _props$enableRowDrop !== void 0 ? _props$enableRowDrop : presetOptions.enableRowDrop;
10616
10772
  const enableRowGoto = (_props$enableRowGoto = props.enableRowGoto) !== null && _props$enableRowGoto !== void 0 ? _props$enableRowGoto : presetOptions.enableRowGoto;
10617
10773
  const enableRowExpansion = (_props$enableRowExpan = props.enableRowExpansion) !== null && _props$enableRowExpan !== void 0 ? _props$enableRowExpan : presetOptions.enableRowExpansion;
10774
+ const enableRowExpansionAll = (_props$enableRowExpan2 = props.enableRowExpansionAll) !== null && _props$enableRowExpan2 !== void 0 ? _props$enableRowExpan2 : presetOptions.enableRowExpansionAll;
10618
10775
  const enableRowSelection = (_props$enableRowSelec = props.enableRowSelection) !== null && _props$enableRowSelec !== void 0 ? _props$enableRowSelec : presetOptions.enableRowSelection;
10619
10776
  return {
10620
10777
  // react-table built-in
@@ -10639,6 +10796,7 @@ function getTableFeaturePreset(props) {
10639
10796
  enableRowDrag: enableRowDrag && !!props.onRowDrag,
10640
10797
  enableRowDrop: enableRowDrop && !!props.onRowDrop,
10641
10798
  enableRowGoto: enableRowGoto && !!props.onRowGoto,
10799
+ enableRowExpansionAll: enableRowExpansion && enableRowExpansionAll && !!props.rowExpansionRenderer,
10642
10800
  enableRowHeight: (_props$enableRowHeigh = props.enableRowHeight) !== null && _props$enableRowHeigh !== void 0 ? _props$enableRowHeigh : presetOptions.enableRowHeight,
10643
10801
  enableSaveSettings: (_props$enableSaveSett = props.enableSaveSettings) !== null && _props$enableSaveSett !== void 0 ? _props$enableSaveSett : presetOptions.enableSaveSettings
10644
10802
  };
@@ -10883,9 +11041,10 @@ function useTableRowClick(isEnabled = false, onRowClick) {
10883
11041
  };
10884
11042
  }
10885
11043
 
10886
- function useTableRowExpansion(isEnabled = false, rowExpansionRenderer) {
11044
+ function useTableRowExpansion(isEnabled = false, canExpandAll = true, rowExpansionRenderer) {
10887
11045
  return {
10888
11046
  isEnabled,
11047
+ canExpandAll,
10889
11048
  rowExpansionRenderer: isEnabled ? rowExpansionRenderer : undefined
10890
11049
  };
10891
11050
  }
@@ -10916,6 +11075,7 @@ function useTableRowHeight(isEnabled = false, defaultRowHeight = 'medium') {
10916
11075
  function useTableRowSelection(isEnabled = false) {
10917
11076
  const lastSelectedRowIndex = React__default.useRef();
10918
11077
  const onKeyDown = React__default.useCallback((event, table) => {
11078
+ var _event$target;
10919
11079
  if (!isEnabled || !table.options.enableRowSelection || event.defaultPrevented) {
10920
11080
  return;
10921
11081
  }
@@ -10930,7 +11090,7 @@ function useTableRowSelection(isEnabled = false) {
10930
11090
  (_rows$rowActiveIndex2 = rows[rowActiveIndex]) === null || _rows$rowActiveIndex2 === void 0 ? void 0 : _rows$rowActiveIndex2.toggleSelected();
10931
11091
  }
10932
11092
  return;
10933
- } else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {
11093
+ } else if ((event.ctrlKey || event.metaKey) && event.key === 'a' && !['INPUT', 'TEXTAREA'].includes((_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.tagName)) {
10934
11094
  event.preventDefault();
10935
11095
  table.toggleAllRowsSelected();
10936
11096
  return;
@@ -10955,10 +11115,10 @@ function useTableSearch(isEnabled = false, defaultEnableGlobalFilter = false) {
10955
11115
  // react-table doesn't re-render when options.enableGlobalFilter changes, so for now we force it
10956
11116
  const currentFilter = instance.getState().globalFilter;
10957
11117
  if (currentFilter) {
10958
- setTimeout(() => {
10959
- instance.setGlobalFilter('');
11118
+ instance.resetGlobalFilter(true);
11119
+ window.requestAnimationFrame(() => {
10960
11120
  instance.setGlobalFilter(currentFilter);
10961
- }, 1);
11121
+ });
10962
11122
  }
10963
11123
  }
10964
11124
  // highlighting
@@ -11335,10 +11495,16 @@ function useTableDataLoader(fetchPage, fetchAll, options = {
11335
11495
  }, invalidate];
11336
11496
  }
11337
11497
 
11338
- function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
11498
+ function useTableServerLoading(length, data, loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
11339
11499
  const isEnabled = !!loadPage && !!loadAll;
11340
11500
  const [isReady, setReady] = React__default.useState(false);
11341
- const [loadAllStatus, setLoadedStatus] = React__default.useState(exports.TableServerLoadAllState.Incomplete);
11501
+ const [loading, setLoading] = React__default.useState(false);
11502
+ const hasLoadedAll = React__default.useMemo(() => {
11503
+ if (data.length !== length || data.some(x => x === undefined)) {
11504
+ return false;
11505
+ }
11506
+ return true;
11507
+ }, [data, length]);
11342
11508
  let _loadPage;
11343
11509
  let _loadAll;
11344
11510
  let _loadAllIfNeeded;
@@ -11363,9 +11529,9 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
11363
11529
  try {
11364
11530
  const _temp2 = function () {
11365
11531
  if (typeof loadAll === 'function') {
11366
- setLoadedStatus(exports.TableServerLoadAllState.Loading);
11532
+ setLoading(true);
11367
11533
  return Promise.resolve(loadAll(...args)).then(function () {
11368
- setLoadedStatus(exports.TableServerLoadAllState.Completed);
11534
+ setLoading(false);
11369
11535
  setReady(true);
11370
11536
  });
11371
11537
  }
@@ -11378,7 +11544,7 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
11378
11544
  _loadAllIfNeeded = function (...args) {
11379
11545
  try {
11380
11546
  const _temp3 = function () {
11381
- if (loadAllStatus === exports.TableServerLoadAllState.Incomplete) {
11547
+ if (!hasLoadedAll) {
11382
11548
  var _loadAll2;
11383
11549
  return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
11384
11550
  }
@@ -11395,7 +11561,7 @@ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE)
11395
11561
  loadPage: _loadPage,
11396
11562
  loadAll: _loadAll,
11397
11563
  loadAllIfNeeded: _loadAllIfNeeded,
11398
- loadAllStatus,
11564
+ loading,
11399
11565
  pageSize
11400
11566
  };
11401
11567
  }
@@ -11468,7 +11634,7 @@ function useLazyEffect(effect, deps) {
11468
11634
  const readyRef = React__default.useRef(false);
11469
11635
  React__default.useEffect(() => {
11470
11636
  if (readyRef.current) {
11471
- effect();
11637
+ return effect();
11472
11638
  } else {
11473
11639
  readyRef.current = true;
11474
11640
  }
@@ -11510,7 +11676,8 @@ function useTableFontSizeListener(table) {
11510
11676
  table.setColumnSizing(sizes => {
11511
11677
  return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
11512
11678
  var _column$columnDef$min;
11513
- const column = table.getColumn(columnName);
11679
+ // table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
11680
+ const column = table.getAllColumns().find(x => x.id === columnName);
11514
11681
  if (isInternalColumn(columnName)) {
11515
11682
  var _column$getSize;
11516
11683
  return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
@@ -11589,7 +11756,7 @@ function useTableSearchListener(table, onChangeSearch) {
11589
11756
  onChangeSearch(query);
11590
11757
  }
11591
11758
  }
11592
- }, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), onChangeSearch]);
11759
+ }, [meta.server.loading, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), onChangeSearch]);
11593
11760
  }
11594
11761
 
11595
11762
  function useTableSettingsListener(table, onChangeSettings) {
@@ -11725,13 +11892,13 @@ function useTableManager(props, meta, internalColumns) {
11725
11892
  const rowClick = useTableRowClick(options.enableRowClick, props.onRowClick);
11726
11893
  const rowDrag = useTableRowDrag(options.enableRowDrag && !(meta !== null && meta !== void 0 && (_meta$editing = meta.editing) !== null && _meta$editing !== void 0 && _meta$editing.isEditing), props.onRowDrag);
11727
11894
  const rowDrop = useTableRowDrop(options.enableRowDrop, props.onRowDrop);
11728
- const rowExpansion = useTableRowExpansion(options.enableRowExpansion, props.rowExpansionRenderer);
11895
+ const rowExpansion = useTableRowExpansion(options.enableRowExpansion, options.enableRowExpansionAll, props.rowExpansionRenderer);
11729
11896
  const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);
11730
11897
  const rowGroups = useTableRowGroups(props.rowActionsForGroup);
11731
11898
  const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
11732
11899
  const rowSelection = useTableRowSelection(!!options.enableRowSelection);
11733
11900
  const search = useTableSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);
11734
- const server = useTableServerLoading(props.loadPage, props.loadAll, props.pageSize);
11901
+ const server = useTableServerLoading(length, data, props.loadPage, props.loadAll, props.pageSize);
11735
11902
  // TODO: memoise
11736
11903
  // convert jsx column components into valid table columns
11737
11904
  const {
@@ -11767,7 +11934,7 @@ function useTableManager(props, meta, internalColumns) {
11767
11934
  rowDrag,
11768
11935
  rowDrop: rowDrop,
11769
11936
  rowExpansion: rowExpansion,
11770
- rowIdentityColumnId: props.rowIdentityColumnId,
11937
+ rowIdentityAccessor: props.rowIdentityAccessor,
11771
11938
  rowGoto,
11772
11939
  rowGroups: rowGroups,
11773
11940
  rowHeight,
@@ -12104,6 +12271,8 @@ const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props,
12104
12271
  });
12105
12272
 
12106
12273
  const RowContext = /*#__PURE__*/React__default.createContext({
12274
+ hideInternalColumns: false,
12275
+ hideRowActions: false,
12107
12276
  isHovered: false,
12108
12277
  rowIndex: -1
12109
12278
  });
@@ -12113,6 +12282,8 @@ function Row(props) {
12113
12282
  const {
12114
12283
  renderer: RowRenderer,
12115
12284
  cellRenderer: CellRenderer,
12285
+ hideInternalColumns = false,
12286
+ hideRowActions = false,
12116
12287
  ...displayRowProps
12117
12288
  } = props;
12118
12289
  const tableMeta = props.table.options.meta;
@@ -12120,8 +12291,10 @@ function Row(props) {
12120
12291
  // context - it must be here for cells to read it, since they render alongside the row inside DisplayRow
12121
12292
  const contextValue = React__default.useMemo(() => ({
12122
12293
  isHovered,
12123
- rowIndex: props.index
12124
- }), [isHovered, props.index]);
12294
+ rowIndex: props.index,
12295
+ hideInternalColumns,
12296
+ hideRowActions
12297
+ }), [isHovered, props.index, hideInternalColumns, hideRowActions]);
12125
12298
  if (props.row.original === undefined) {
12126
12299
  return /*#__PURE__*/React__default.createElement(SkeletonRow, Object.assign({}, props));
12127
12300
  }
@@ -12132,11 +12305,35 @@ function Row(props) {
12132
12305
  })));
12133
12306
  }
12134
12307
 
12135
- function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
12136
- var _table$getState$group, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _ref, _virtualItems;
12308
+ // scroll padding end is designed to always show half of the next row
12309
+ function getScrollPaddingEndOffset(table) {
12310
+ const tableMeta = table.options.meta;
12311
+ let offset = 2;
12312
+ if (tableMeta.footer.isEnabled) {
12313
+ offset += 1;
12314
+ }
12315
+ if (table.getHeaderGroups().length > 1) {
12316
+ offset += table.getHeaderGroups().length - 1;
12317
+ }
12318
+ let height = ROW_HEIGHT_ESTIMATES.medium * offset;
12319
+ const bottomRows = table.getBottomRows();
12320
+ if (bottomRows.length) {
12321
+ // 1.4 offsets for half rows and also accounts for increased row heights (which is likely in pinned rows)
12322
+ height += ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] * 1.4 * bottomRows.length;
12323
+ }
12324
+ return height;
12325
+ }
12326
+ // scroll padding end is designed to always show half of the next row
12327
+ function getPaddingEndOffset(table, options) {
12328
+ var _table$getBottomRows, _options$virtualiserP;
12329
+ const bottomRows = (_table$getBottomRows = table.getBottomRows()) !== null && _table$getBottomRows !== void 0 ? _table$getBottomRows : [];
12330
+ 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;
12331
+ }
12332
+ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex, options) {
12333
+ var _table$getState$group, _table$getCenterRows, _virtualItems$padding, _virtualItems$padding2, _virtualItems$padding3, _ref, _virtualItems;
12137
12334
  const tableMeta = table.options.meta;
12138
- const rows = table.getRowModel().rows;
12139
12335
  const isTableRowGrouped = !!((_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length);
12336
+ const rows = (_table$getCenterRows = table.getCenterRows()) !== null && _table$getCenterRows !== void 0 ? _table$getCenterRows : [];
12140
12337
  // expanded rows
12141
12338
  const {
12142
12339
  createRowMeasurer,
@@ -12146,9 +12343,6 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
12146
12343
  const rangeExtractor = useRowGroupVirtualisation(table);
12147
12344
  // account for thead and tfoot in the scroll area - both are always medium row height
12148
12345
  const scrollPaddingStart = ROW_HEIGHT_ESTIMATES.medium;
12149
- // column groups offset the bottom padding :shrug:, multiplying by 1.5 ensures the bottom padding remains
12150
- // consistent when there are groups and when there aren't. 1.5 is relatively arbitrary, but it gives alignment
12151
- const scrollPaddingEnd = ROW_HEIGHT_ESTIMATES.medium * (table.getHeaderGroups().length > 1 ? 1.5 : 1);
12152
12346
  const virtualiser = reactVirtual.useVirtualizer({
12153
12347
  count: rows.length,
12154
12348
  estimateSize,
@@ -12157,7 +12351,8 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
12157
12351
  rangeExtractor,
12158
12352
  // correctly sets the scroll padding offset, e.g. when keyboard navigating rows in the list
12159
12353
  scrollPaddingStart,
12160
- scrollPaddingEnd: tableMeta.footer.isEnabled ? scrollPaddingEnd * 2 : scrollPaddingEnd
12354
+ scrollPaddingEnd: getScrollPaddingEndOffset(table),
12355
+ paddingEnd: getPaddingEndOffset(table, options)
12161
12356
  });
12162
12357
  const totalSize = virtualiser.getTotalSize();
12163
12358
  const virtualItems = virtualiser.getVirtualItems();
@@ -12197,12 +12392,16 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
12197
12392
  // rendered output
12198
12393
  let style = {};
12199
12394
  let content = null;
12200
- if (rows.length) {
12395
+ // bottom rows aren't virtualised (they're sticky) but we need to set the height
12396
+ if (rows.length || table.getBottomRows().length) {
12201
12397
  style = {
12202
12398
  height: totalSize,
12203
12399
  paddingBottom,
12204
12400
  paddingTop
12205
12401
  };
12402
+ }
12403
+ // only render non sticky rows
12404
+ if (rows.length) {
12206
12405
  content = virtualItems.map(virtualRow => {
12207
12406
  // there appears to be a react-virtual bug where it inserts a single `undefined` item at the end of the row, which crashes here
12208
12407
  if (!virtualRow) {
@@ -12314,12 +12513,14 @@ function Actions$1(props) {
12314
12513
  actionsLength,
12315
12514
  data,
12316
12515
  isActiveRow,
12317
- rowId
12516
+ rowId,
12517
+ table
12318
12518
  } = props;
12319
12519
  const {
12320
12520
  texts
12321
12521
  } = useLocalization();
12322
- const visibleActions = actions.map(action => action(data, rowId)).filter(action => !!action);
12522
+ // we don't want to document passing table, so it isn't on the type
12523
+ const visibleActions = actions.map(action => action(data, rowId, table)).filter(action => !!action);
12323
12524
  const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
12324
12525
  const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
12325
12526
  const className = cn('flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden');
@@ -12358,6 +12559,7 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
12358
12559
  table
12359
12560
  } = context;
12360
12561
  const {
12562
+ hideRowActions,
12361
12563
  isHovered,
12362
12564
  rowIndex
12363
12565
  } = React__default.useContext(RowContext);
@@ -12367,15 +12569,15 @@ const Cell = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
12367
12569
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
12368
12570
  const isResizingColumn = !!table.getState().columnSizingInfo.isResizingColumn;
12369
12571
  const isHoverStatePaused = tableMeta.rowActive.isHoverStatePaused;
12370
- // We don't want to show actions in edit mode, since we have editing actions,
12371
- // which is shown in edit mode instead.
12372
- if (actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
12572
+ const isRowGrouped = row.getIsGrouped();
12573
+ if (!hideRowActions && !isRowGrouped && actions !== null && actions !== void 0 && actions.length && (isActiveRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
12373
12574
  return /*#__PURE__*/React__default.createElement(Actions$1, {
12374
12575
  actions: actions,
12375
12576
  actionsLength: actionsLength,
12376
12577
  data: row.original,
12377
12578
  isActiveRow: isActiveRow,
12378
- rowId: row.id
12579
+ rowId: row.id,
12580
+ table: table
12379
12581
  });
12380
12582
  }
12381
12583
  return null;
@@ -12399,6 +12601,12 @@ function Cell$1() {
12399
12601
  const {
12400
12602
  texts
12401
12603
  } = useLocalization();
12604
+ const {
12605
+ hideInternalColumns
12606
+ } = React__default.useContext(RowContext);
12607
+ if (hideInternalColumns) {
12608
+ return null;
12609
+ }
12402
12610
  return /*#__PURE__*/React__default.createElement(Icon, {
12403
12611
  "aria-label": texts.table.columns.drag.tooltip,
12404
12612
  name: "drag",
@@ -12426,6 +12634,10 @@ function Header$3(context) {
12426
12634
  const {
12427
12635
  table
12428
12636
  } = context;
12637
+ const tableMeta = table.options.meta;
12638
+ if (!tableMeta.rowExpansion.canExpandAll) {
12639
+ return null;
12640
+ }
12429
12641
  const isSomeRowsExpanded = table.getIsSomeRowsExpanded();
12430
12642
  const handleClick = event => {
12431
12643
  event.stopPropagation();
@@ -12447,7 +12659,13 @@ function Cell$2(context) {
12447
12659
  const {
12448
12660
  texts
12449
12661
  } = useLocalization();
12662
+ const {
12663
+ hideInternalColumns
12664
+ } = React__default.useContext(RowContext);
12450
12665
  const tableMeta = context.table.options.meta;
12666
+ if (hideInternalColumns) {
12667
+ return null;
12668
+ }
12451
12669
  const hasExpandedRow = (_tableMeta$rowExpansi = (_tableMeta$rowExpansi2 = tableMeta.rowExpansion).rowExpansionRenderer) === null || _tableMeta$rowExpansi === void 0 ? void 0 : _tableMeta$rowExpansi.call(_tableMeta$rowExpansi2, context.row.original);
12452
12670
  if (hasExpandedRow) {
12453
12671
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === context.row.index;
@@ -12518,7 +12736,7 @@ function Header$4(context) {
12518
12736
  className: "hover:border-blue !-mt-px",
12519
12737
  checked: isAllRowsSelected,
12520
12738
  indeterminate: isSomeRowsSelected && !isAllRowsSelected,
12521
- loading: tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
12739
+ loading: tableMeta.server.loading,
12522
12740
  onChange: handleChange
12523
12741
  }));
12524
12742
  }
@@ -12537,10 +12755,11 @@ function Cell$3(context) {
12537
12755
  table
12538
12756
  } = context;
12539
12757
  const {
12758
+ hideInternalColumns,
12540
12759
  rowIndex
12541
12760
  } = React__default.useContext(RowContext);
12542
12761
  const tableMeta = table.options.meta;
12543
- if (table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
12762
+ if (hideInternalColumns || table.options.enableGrouping && (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length && !row.getIsGrouped()) {
12544
12763
  return null;
12545
12764
  }
12546
12765
  const isSelected = row.getIsGrouped() ? row.getIsAllSubRowsSelected() : row.getIsSelected();
@@ -12625,13 +12844,13 @@ const INTERNAL_RENDERERS = {
12625
12844
  rowExpansion: renderer$2,
12626
12845
  rowSelection: renderer$3
12627
12846
  };
12628
- function useTable(props, externalRef, renderers, meta) {
12847
+ function useTable(props, externalRef, renderers, meta, options) {
12629
12848
  // create a ref and merge with the consumer's ref
12630
12849
  const ref = useMergedRef(externalRef);
12631
12850
  // configure the table
12632
12851
  const manager = useTableManager(props, meta, INTERNAL_RENDERERS);
12633
12852
  // configure the virtualised renderer
12634
- const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex);
12853
+ const renderer = useTableRenderer(renderers, manager.instance, ref, props.defaultRowActiveIndex, options);
12635
12854
  // configure dynamic styling
12636
12855
  const {
12637
12856
  style,
@@ -12732,7 +12951,10 @@ function GroupedCell(props) {
12732
12951
  index,
12733
12952
  isHighlighted
12734
12953
  } = props;
12735
- const tableMeta = cell.getContext().table.options.meta;
12954
+ const {
12955
+ table
12956
+ } = cell.getContext();
12957
+ const tableMeta = table.options.meta;
12736
12958
  const columnMeta = cell.column.columnDef.meta;
12737
12959
  const attributes = getCellAttributes(cell, index, isHighlighted);
12738
12960
  const {
@@ -12741,7 +12963,9 @@ function GroupedCell(props) {
12741
12963
  } = React__default.useContext(RowContext);
12742
12964
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
12743
12965
  const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
12744
- const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;
12966
+ // Set colSpan based on the count of visible cells, including '__actions' and non-internal columns, so that
12967
+ // rowGroupActions aligns with rowActions.
12968
+ const colSpan = cell.row.getVisibleCells().filter(c => c.column.id === '__actions' || !isInternalColumn(c.column.id)).length - 1;
12745
12969
  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;
12746
12970
  const subRows = cell.getContext().row.subRows.map(row => row.original);
12747
12971
  return /*#__PURE__*/React__default.createElement(MemoedGroupedCell, Object.assign({}, attributes, {
@@ -12750,7 +12974,8 @@ function GroupedCell(props) {
12750
12974
  colSpan: colSpan,
12751
12975
  rowActions: tableMeta.rowGroups.rowActionsForGroup,
12752
12976
  rowId: cell.row.id,
12753
- subRows: subRows
12977
+ subRows: subRows,
12978
+ table: table
12754
12979
  }), content);
12755
12980
  }
12756
12981
  const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupedCell(props) {
@@ -12762,22 +12987,29 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
12762
12987
  rowActions,
12763
12988
  rowId,
12764
12989
  subRows,
12990
+ table,
12765
12991
  ...attributes
12766
12992
  } = props;
12767
- return /*#__PURE__*/React__default.createElement("td", Object.assign({}, attributes, {
12768
- ref: cellRef,
12769
- style: {
12770
- gridColumn: `span ${colSpan} / span ${colSpan}`
12771
- }
12772
- }), /*#__PURE__*/React__default.createElement("span", {
12773
- className: "grow"
12774
- }, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
12775
- actions: rowActions,
12776
- actionsLength: 4,
12777
- data: subRows,
12778
- isActiveRow: true,
12779
- rowId: rowId
12780
- })) : null);
12993
+ return (
12994
+ /*#__PURE__*/
12995
+ // pr-1 is needed to align group row actions with row actions in sibling rows, if present
12996
+ React__default.createElement("td", Object.assign({}, attributes, {
12997
+ className: "!pr-1",
12998
+ ref: cellRef,
12999
+ style: {
13000
+ gridColumn: `span ${colSpan} / span ${colSpan}`
13001
+ }
13002
+ }), /*#__PURE__*/React__default.createElement("span", {
13003
+ className: "grow"
13004
+ }, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? (/*#__PURE__*/React__default.createElement(Actions$1, {
13005
+ actions: rowActions,
13006
+ actionsLength: 4,
13007
+ data: subRows,
13008
+ isActiveRow: true,
13009
+ rowId: rowId,
13010
+ table: table
13011
+ })) : null)
13012
+ );
12781
13013
  });
12782
13014
 
12783
13015
  function Cell$4(props) {
@@ -12838,7 +13070,7 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12838
13070
  if (tableMeta.rowActive.isEnabled) {
12839
13071
  attributes['data-row-active'] = tableMeta.rowActive.rowActiveIndex === index ? true : undefined;
12840
13072
  // we use capture because it let's us picks up clicks on components inside the row, e.g. checkboxes
12841
- attributes.onClickCapture = handleClickCapture;
13073
+ attributes.onPointerDown = handleClickCapture;
12842
13074
  }
12843
13075
  // row click
12844
13076
  if (tableMeta.rowClick.isEnabled(row.original)) {
@@ -12916,14 +13148,17 @@ const DisplayRow = /*#__PURE__*/React__default.memo(function DisplayRow(props) {
12916
13148
  const expansionRef = React__default.useRef(null);
12917
13149
  const isExpanded = !!attributes['data-row-expanded'];
12918
13150
  useSetVirtualisedRowHeight(measureRow, ref.current, expansionRef.current, isExpanded);
12919
- const className = cn('group/row', {
13151
+ const className = cn('group/row', otherAttributes.className, {
12920
13152
  'hover:cursor-grab': tableMeta.rowDrag.isEnabled && typeof attributes.onClick !== 'function',
12921
13153
  'hover:cursor-pointer': typeof attributes.onClick === 'function'
12922
13154
  });
13155
+ const isGrouped = row.getIsGrouped();
12923
13156
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", Object.assign({}, attributes, {
12924
13157
  className: className,
12925
13158
  ref: ref
12926
- }), children, row.getVisibleCells().map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
13159
+ }), children, row.getVisibleCells()
13160
+ // Filter out the row actions cell from rendering in Grouped Row
13161
+ .filter(cell => !(isGrouped && cell.column.id === '__actions')).map((cell, cellIndex) => (/*#__PURE__*/React__default.createElement(Cell$4, {
12927
13162
  key: cell.id,
12928
13163
  cell: cell,
12929
13164
  index: cellIndex,
@@ -13709,8 +13944,13 @@ function Summary(props) {
13709
13944
  }
13710
13945
 
13711
13946
  function Foot(props) {
13712
- const nonGroupedHeaders = props.table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
13713
- return /*#__PURE__*/React__default.createElement("tfoot", null, /*#__PURE__*/React__default.createElement("tr", null, nonGroupedHeaders.map((header, index) => (/*#__PURE__*/React__default.createElement(Footer$3, {
13947
+ const {
13948
+ children,
13949
+ table,
13950
+ ...attributes
13951
+ } = props;
13952
+ const nonGroupedHeaders = table.getFooterGroups()[0].headers.filter(header => !header.column.getIsGrouped());
13953
+ 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, {
13714
13954
  key: header.id,
13715
13955
  header: header,
13716
13956
  index: index
@@ -13758,16 +13998,29 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
13758
13998
  });
13759
13999
 
13760
14000
  function EmptyStateBody(props) {
14001
+ var _ref$current, _ref$current$parentNo;
13761
14002
  const {
13762
14003
  emptyState: Placeholder,
14004
+ isReady,
13763
14005
  reason,
13764
14006
  ...attributes
13765
14007
  } = props;
14008
+ const ref = React__default.useRef(null);
14009
+ if (!isReady) {
14010
+ return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
14011
+ className: "!auto-rows-fr"
14012
+ }));
14013
+ }
13766
14014
  return /*#__PURE__*/React__default.createElement("tbody", Object.assign({}, attributes, {
13767
- className: "!auto-rows-fr"
14015
+ ref: ref,
14016
+ className: "!auto-rows-fr",
14017
+ "data-taco": "empty-state"
13768
14018
  }), /*#__PURE__*/React__default.createElement("tr", {
13769
- className: "!auto-rows-fr"
14019
+ className: "!auto-rows-fr "
13770
14020
  }, /*#__PURE__*/React__default.createElement("td", {
14021
+ style: {
14022
+ 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
14023
+ },
13771
14024
  className: "col-span-full !border-0 !p-0 hover:!bg-white"
13772
14025
  }, Placeholder ? /*#__PURE__*/React__default.createElement(Placeholder, {
13773
14026
  reason: reason
@@ -14042,7 +14295,7 @@ function Search$1(props) {
14042
14295
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SearchInput2, {
14043
14296
  findCurrent: tableMeta.search.currentHighlightColumnIndex !== undefined ? tableMeta.search.currentHighlightColumnIndex + 1 : null,
14044
14297
  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,
14045
- loading: tableMeta.server.loadAllStatus === exports.TableServerLoadAllState.Loading,
14298
+ loading: tableMeta.server.loading,
14046
14299
  name: "table-search",
14047
14300
  onClickFindPrevious: handlePreviousResult,
14048
14301
  onClickFindNext: handleNextResult,
@@ -14400,12 +14653,12 @@ const getOptionsFromCollection = (collection, selector) => collection.querySelec
14400
14653
  const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(props, ref) {
14401
14654
  const {
14402
14655
  querySelector,
14656
+ resetOnChange,
14403
14657
  tabIndex = 0,
14404
14658
  ...otherProps
14405
14659
  } = props;
14406
14660
  const internalRef = useMergedRef(ref);
14407
14661
  const [activeIndex, setActiveIndex] = React__default.useState();
14408
- const lastLengthRef = React__default.useRef(0);
14409
14662
  const setActiveOption = (index, collection, option) => {
14410
14663
  var _collection$querySele;
14411
14664
  (_collection$querySele = collection.querySelector(`[aria-current]`)) === null || _collection$querySele === void 0 ? void 0 : _collection$querySele.removeAttribute('aria-current');
@@ -14428,17 +14681,34 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
14428
14681
  }, [internalRef.current, querySelector]);
14429
14682
  React__default.useEffect(() => {
14430
14683
  if (internalRef.current) {
14431
- internalRef.current.setActiveIndex = setActiveIndexByElement;
14684
+ internalRef.current.setActiveIndexByElement = setActiveIndexByElement;
14432
14685
  }
14433
14686
  }, [internalRef.current]);
14687
+ React__default.useEffect(() => {
14688
+ if (internalRef.current) {
14689
+ const selected = internalRef.current.querySelectorAll(`[aria-current="true"]`);
14690
+ const options = getOptionsFromCollection(internalRef.current, querySelector);
14691
+ if (options.length && selected.length === 1) {
14692
+ const firstSelected = internalRef.current.querySelector(`[aria-selected]`);
14693
+ if (firstSelected) {
14694
+ const selectedIndex = Array.from(options).indexOf(firstSelected);
14695
+ if (selectedIndex > -1) {
14696
+ setActiveOption(selectedIndex, internalRef.current, firstSelected);
14697
+ }
14698
+ }
14699
+ }
14700
+ }
14701
+ }, [resetOnChange]);
14434
14702
  React__default.useEffect(() => {
14435
14703
  if (internalRef.current) {
14436
14704
  const options = getOptionsFromCollection(internalRef.current, querySelector);
14437
- if (options.length && options.length !== lastLengthRef.current) {
14705
+ if (options.length) {
14438
14706
  let selected = internalRef.current.querySelectorAll(`[aria-current="true"]`);
14707
+ // if nothing is current (keyboard visible), look for selected items
14439
14708
  if (selected.length === 0) {
14440
14709
  selected = internalRef.current.querySelectorAll(`[aria-selected]`);
14441
14710
  }
14711
+ // if one item is selected, make sure it's current
14442
14712
  if (selected.length === 1) {
14443
14713
  if (options) {
14444
14714
  const firstSelected = selected.item(0);
@@ -14452,7 +14722,6 @@ const Root = /*#__PURE__*/React__default.forwardRef(function CollectionRoot(prop
14452
14722
  setActiveOption(0, internalRef.current, options.item(0));
14453
14723
  }
14454
14724
  }
14455
- lastLengthRef.current = options.length;
14456
14725
  }
14457
14726
  }, [props.children]);
14458
14727
  const handleClick = event => {
@@ -14585,6 +14854,7 @@ const Root$1 = /*#__PURE__*/React__default.forwardRef(function Listbox2(props, r
14585
14854
  id: id,
14586
14855
  querySelector: customSelector ? `${DEFAULT_SELECTOR}, ${customSelector}` : DEFAULT_SELECTOR,
14587
14856
  ref: ref,
14857
+ resetOnChange: value,
14588
14858
  role: "listbox"
14589
14859
  }), children)));
14590
14860
  });
@@ -14643,10 +14913,6 @@ const Option = /*#__PURE__*/React__default.forwardRef(function Listbox2Option(pr
14643
14913
  if (disabled || listboxDisabled || listboxReadOnly) {
14644
14914
  event.stopPropagation();
14645
14915
  return;
14646
- }
14647
- // UX requirement: if tab key is pressed and the current option is selected then keydown event is ignored
14648
- else if (event.key === 'Tab' && selected) {
14649
- return;
14650
14916
  } else if (isAriaSelectionKey(event)) {
14651
14917
  setValue(value);
14652
14918
  }
@@ -14721,14 +14987,16 @@ const Tag$1 = /*#__PURE__*/React__default.forwardRef((props, ref) => {
14721
14987
  ref: ref,
14722
14988
  "data-taco": "tag"
14723
14989
  }), /*#__PURE__*/React__default.createElement("span", {
14724
- className: "truncate px-2",
14990
+ className: "flex items-center truncate px-2",
14725
14991
  ref: textRef
14726
14992
  }, icon ? typeof icon === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
14727
14993
  name: icon,
14728
- className: "-ml-1 -mt-0.5 mr-1 !h-5 !w-5"
14994
+ className: "-ml-1 mr-1 !h-5 !w-5"
14729
14995
  })) : (/*#__PURE__*/React__default.cloneElement(icon, {
14730
- className: 'mr-1 -ml-1 -mt-0.5 !h-5 !w-5'
14731
- })) : null, children), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
14996
+ className: 'mr-1 -ml-1 !h-5 !w-5'
14997
+ })) : null, /*#__PURE__*/React__default.createElement("span", {
14998
+ className: "truncate"
14999
+ }, children)), onDelete ? (/*#__PURE__*/React__default.createElement(Icon, {
14732
15000
  name: "close",
14733
15001
  onClick: onDelete,
14734
15002
  className: "-ml-1.5 !h-6 !w-5 flex-shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
@@ -14750,6 +15018,16 @@ const getFontSize = fontSize => {
14750
15018
  return 'text-sm';
14751
15019
  }
14752
15020
  };
15021
+ const filterOption = (child, searchQuery) => {
15022
+ var _child$props$textValu, _child$props$descript;
15023
+ if ((_child$props$textValu = child.props.textValue) !== null && _child$props$textValu !== void 0 && _child$props$textValu.toLowerCase().includes(searchQuery.toLowerCase())) {
15024
+ return true;
15025
+ }
15026
+ if ((_child$props$descript = child.props.description) !== null && _child$props$descript !== void 0 && _child$props$descript.toLowerCase().includes(searchQuery.toLowerCase())) {
15027
+ return true;
15028
+ }
15029
+ return String(child.props.children).toLowerCase().includes(searchQuery.toLowerCase());
15030
+ };
14753
15031
 
14754
15032
  const Select2Context = /*#__PURE__*/React__default.createContext({});
14755
15033
  const useSelect2Context = () => React__default.useContext(Select2Context);
@@ -14995,12 +15273,13 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
14995
15273
  }), hasValue ? (/*#__PURE__*/React__default.createElement(Icon, {
14996
15274
  name: "tick",
14997
15275
  className: "pointer-events-none invisible -mx-0.5 !h-4 !w-4 group-aria-selected:visible"
14998
- })) : null, isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
15276
+ })) : null, typeof children !== 'string' ? (/*#__PURE__*/React__default.createElement("span", null, children)) : isTag ? (/*#__PURE__*/React__default.createElement(Tag$1, {
14999
15277
  className: "pointer-events-none my-1",
15000
15278
  color: color,
15001
15279
  icon: prefix
15002
15280
  }, children)) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, prefix ? typeof prefix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
15003
- name: prefix
15281
+ name: prefix,
15282
+ className: "!h-5 !w-5"
15004
15283
  }) : prefix : null, /*#__PURE__*/React__default.createElement("span", {
15005
15284
  className: "flex w-full justify-between"
15006
15285
  }, /*#__PURE__*/React__default.createElement("span", {
@@ -15009,9 +15288,10 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
15009
15288
  className: "text-grey-700 -mt-1.5 mb-1.5 text-xs"
15010
15289
  }, description) : null), /*#__PURE__*/React__default.createElement("span", {
15011
15290
  className: "flex flex-col self-center"
15012
- }, postfix ? typeof postfix === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
15013
- name: postfix
15014
- }) : postfix : null)))), popover ? (/*#__PURE__*/React__default.createElement(IconButton, {
15291
+ }, postfix ? typeof postfix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
15292
+ name: postfix,
15293
+ className: "!h-5 !w-5"
15294
+ })) : postfix : null)))), popover ? (/*#__PURE__*/React__default.createElement(IconButton, {
15015
15295
  icon: "ellipsis-vertical",
15016
15296
  appearance: "discrete",
15017
15297
  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', {
@@ -15020,7 +15300,7 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
15020
15300
  onClick: event => {
15021
15301
  var _listboxRef$current;
15022
15302
  event.stopPropagation();
15023
- listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.setActiveIndex(event.currentTarget.parentElement);
15303
+ listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.setActiveIndexByElement(event.currentTarget.parentElement);
15024
15304
  },
15025
15305
  popover: popover,
15026
15306
  tabIndex: -1
@@ -15089,7 +15369,9 @@ const Button$3 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
15089
15369
  var _props$className;
15090
15370
  const {
15091
15371
  children,
15372
+ onBlur,
15092
15373
  onClick,
15374
+ onFocus,
15093
15375
  tabIndex = 0,
15094
15376
  ...otherProps
15095
15377
  } = props;
@@ -15120,6 +15402,18 @@ const Button$3 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
15120
15402
  onClick(event);
15121
15403
  }
15122
15404
  };
15405
+ let handleBlur;
15406
+ if (typeof onBlur === 'function') {
15407
+ // we might be focusing on an input or something inside the dropdown that was triggered by the select
15408
+ // so see if the element gaining focus is inside a portal and look up its controller
15409
+ // if we don't do this, things like validate on blur occur while simply opening the select
15410
+ handleBlur = event => {
15411
+ if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
15412
+ return;
15413
+ }
15414
+ onBlur(event);
15415
+ };
15416
+ }
15123
15417
  // select the value text if the select is readonly
15124
15418
  const handleFocus = event => {
15125
15419
  if (readOnly) {
@@ -15129,6 +15423,9 @@ const Button$3 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
15129
15423
  (_window$getSelection = window.getSelection()) === null || _window$getSelection === void 0 ? void 0 : (_window$getSelection$ = _window$getSelection.selectAllChildren) === null || _window$getSelection$ === void 0 ? void 0 : _window$getSelection$.call(_window$getSelection, value);
15130
15424
  }
15131
15425
  }
15426
+ if (typeof onFocus === 'function') {
15427
+ onFocus(event);
15428
+ }
15132
15429
  };
15133
15430
  return /*#__PURE__*/React__default.createElement("button", Object.assign({}, otherProps, {
15134
15431
  "aria-invalid": invalid ? true : undefined,
@@ -15136,6 +15433,7 @@ const Button$3 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
15136
15433
  className: className,
15137
15434
  disabled: disabled,
15138
15435
  onClick: handleClick,
15436
+ onBlur: handleBlur,
15139
15437
  onFocus: handleFocus,
15140
15438
  ref: ref,
15141
15439
  role: "combobox",
@@ -15159,7 +15457,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
15159
15457
  readOnly,
15160
15458
  tags
15161
15459
  } = useSelect2Context();
15162
- const contentClassName = cn('truncate items-center gap-1');
15460
+ const contentClassName = cn('truncate flex items-center gap-1');
15163
15461
  const currentValue = children.find(matchesValue(value));
15164
15462
  let output;
15165
15463
  if (placeholder && currentValue === undefined) {
@@ -15169,13 +15467,13 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
15169
15467
  }, placeholder);
15170
15468
  } else if (currentValue) {
15171
15469
  if (tags && emptyValue !== value) {
15172
- output = /*#__PURE__*/React__default.createElement(Tag$1, {
15470
+ if (typeof currentValue.props.children === 'string') output = /*#__PURE__*/React__default.createElement(Tag$1, {
15173
15471
  className: "truncate",
15174
15472
  color: currentValue.props.color,
15175
15473
  disabled: disabled,
15176
15474
  icon: currentValue.props.prefix,
15177
15475
  readOnly: readOnly
15178
- }, currentValue.props.children);
15476
+ }, currentValue.props.children);else output = currentValue.props.children;
15179
15477
  } else {
15180
15478
  output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, currentValue.props.prefix ? typeof currentValue.props.prefix === 'string' ? (/*#__PURE__*/React__default.createElement(Icon, {
15181
15479
  name: currentValue.props.prefix,
@@ -15226,7 +15524,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
15226
15524
  }, valuesAsChildren.length === 0 ? (/*#__PURE__*/React__default.createElement(Placeholder, {
15227
15525
  disabled: disabled,
15228
15526
  readOnly: readOnly
15229
- }, placeholder)) : valuesAsChildren.map(child => (/*#__PURE__*/React__default.createElement(Tag$1, {
15527
+ }, placeholder)) : valuesAsChildren.map(child => typeof child.props.children === 'string' ? (/*#__PURE__*/React__default.createElement(Tag$1, {
15230
15528
  key: String(child.props.value),
15231
15529
  className: "truncate",
15232
15530
  color: tags ? child.props.color : undefined,
@@ -15240,7 +15538,23 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
15240
15538
  }
15241
15539
  },
15242
15540
  readOnly: readOnly
15243
- }, child.props.children)))));
15541
+ }, child.props.children)) : (/*#__PURE__*/React__default.cloneElement(child.props.children, {
15542
+ key: String(child.props.value),
15543
+ className: '!pr-0 !pl-1.5',
15544
+ children: (/*#__PURE__*/React__default.createElement("span", {
15545
+ className: "flex items-center"
15546
+ }, child.props.children.props.children, /*#__PURE__*/React__default.createElement(Icon, {
15547
+ name: "close",
15548
+ onClick: event => {
15549
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
15550
+ event === null || event === void 0 ? void 0 : event.preventDefault();
15551
+ if (!disabled && !readOnly) {
15552
+ setValue(child.props.value);
15553
+ }
15554
+ },
15555
+ className: "ml-0.5 !h-5 !w-5 shrink-0 cursor-pointer rounded-r p-0.5 hover:bg-black/5"
15556
+ })))
15557
+ })))));
15244
15558
  } else {
15245
15559
  content = /*#__PURE__*/React__default.createElement(MultipleValue, {
15246
15560
  onClick: forwardClick,
@@ -15271,6 +15585,18 @@ const MultipleValue = ({
15271
15585
  } = useSelect2Context();
15272
15586
  const [contentRef, setContentRef] = React__default.useState(null);
15273
15587
  const boundaryIndex = contentRef ? getIndexOfFirstChildOverflowingParent(contentRef, 30) : undefined;
15588
+ // Retrieves the relevant text content from any JSX.Element passed as a select option, handling nested elements, arrays, and direct text
15589
+ const getTooltipTitle = child => {
15590
+ const children = child.props.children;
15591
+ if (typeof children === 'string') return children;
15592
+ if (typeof children.props.children === 'string') {
15593
+ return children.props.children;
15594
+ }
15595
+ if (Array.isArray(children.props.children)) {
15596
+ return children.props.children.filter(item => typeof item === 'string');
15597
+ }
15598
+ return '';
15599
+ };
15274
15600
  return /*#__PURE__*/React__default.createElement("div", {
15275
15601
  className: "relative flex w-full items-center gap-1 overflow-hidden",
15276
15602
  onClick: onClick
@@ -15281,26 +15607,35 @@ const MultipleValue = ({
15281
15607
  disabled: disabled,
15282
15608
  readOnly: readOnly
15283
15609
  }, placeholder)) : valuesAsChildren.map((child, index) => {
15284
- const tag = /*#__PURE__*/React__default.createElement(Tag$1, {
15285
- key: String(child.props.value),
15610
+ const classNames = {
15611
+ truncate: index === boundaryIndex,
15612
+ hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
15613
+ };
15614
+ let output;
15615
+ if (typeof child.props.children === 'string') {
15616
+ output = /*#__PURE__*/React__default.createElement(Tag$1, {
15617
+ key: String(child.props.value),
15618
+ className: cn('cursor-pointer', classNames),
15619
+ color: tags ? child.props.color : undefined,
15620
+ disabled: disabled,
15621
+ icon: child.props.prefix,
15622
+ readOnly: readOnly
15623
+ }, child.props.children);
15624
+ } else output = /*#__PURE__*/React__default.cloneElement(child.props.children, {
15286
15625
  className: cn('cursor-pointer', {
15287
- truncate: index === boundaryIndex,
15288
- hidden: boundaryIndex !== undefined && boundaryIndex !== null ? index > boundaryIndex : false
15289
- }),
15290
- color: tags ? child.props.color : undefined,
15291
- disabled: disabled,
15292
- icon: child.props.prefix,
15293
- readOnly: readOnly
15294
- }, child.props.children);
15626
+ 'shrink-0': index !== boundaryIndex
15627
+ }, classNames),
15628
+ key: String(child.props.value)
15629
+ });
15295
15630
  if (index === boundaryIndex) {
15296
15631
  return /*#__PURE__*/React__default.createElement(Tooltip, {
15297
15632
  key: String(child.props.value),
15298
- title: String(child.props.children)
15299
- }, tag);
15633
+ title: String(getTooltipTitle(child))
15634
+ }, output);
15300
15635
  }
15301
- return tag;
15636
+ return output;
15302
15637
  })), boundaryIndex !== undefined && boundaryIndex !== null && boundaryIndex < valuesAsChildren.length - 1 ? (/*#__PURE__*/React__default.createElement(Tooltip, {
15303
- title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(child.props.children) : '').join(', ')
15638
+ title: valuesAsChildren.slice(boundaryIndex + 1).map(child => child ? String(getTooltipTitle(child)) : '').join(', ')
15304
15639
  }, /*#__PURE__*/React__default.createElement(Badge, {
15305
15640
  className: "flex-shrink-0"
15306
15641
  }, "+", valuesAsChildren.length - (boundaryIndex + 1)))) : null);
@@ -15365,7 +15700,7 @@ const BubbleSelect = props => {
15365
15700
  if (prevValue !== value && setValue) {
15366
15701
  if (Array.isArray(value)) {
15367
15702
  value.forEach(v => {
15368
- const option = select.querySelector(`option[value='${v}']`);
15703
+ const option = select.querySelector(`option[value='${CSS.escape(v)}']`);
15369
15704
  if (option) {
15370
15705
  option.selected = true;
15371
15706
  }
@@ -15398,17 +15733,12 @@ const BubbleSelect = props => {
15398
15733
  };
15399
15734
 
15400
15735
  const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(props, ref) {
15401
- const {
15402
- onTabKeyPress,
15403
- ...otherProps
15404
- } = props;
15405
15736
  const {
15406
15737
  listboxRef,
15407
15738
  searchQuery,
15408
15739
  setSearchQuery,
15409
15740
  setValidationError,
15410
- validationError,
15411
- setOpen
15741
+ validationError
15412
15742
  } = useSelect2Context();
15413
15743
  const handleChange = event => {
15414
15744
  if (validationError) {
@@ -15421,11 +15751,6 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
15421
15751
  if (event.key === ' ') {
15422
15752
  return;
15423
15753
  }
15424
- // Select2 should close dropdown and receive focus, when user press Tab while searching (UX requirement to support better keyboard navigation)
15425
- if (event.key === 'Tab') {
15426
- setOpen(false);
15427
- onTabKeyPress();
15428
- }
15429
15754
  if (isAriaSelectionKey(event) || event.key === 'ArrowDown' || event.key === 'ArrowUp') {
15430
15755
  var _listboxRef$current;
15431
15756
  event.preventDefault();
@@ -15435,12 +15760,12 @@ const Search$2 = /*#__PURE__*/React__default.forwardRef(function ListboxSearch(p
15435
15760
  }
15436
15761
  };
15437
15762
  return /*#__PURE__*/React__default.createElement(Field, {
15438
- className: cn('mx-1.5 mb-1.5 !min-h-fit ', {
15763
+ className: cn('mx-1.5 mb-1.5 !min-h-fit', {
15439
15764
  '!pb-0': !validationError
15440
15765
  }),
15441
15766
  invalid: !!validationError,
15442
15767
  message: validationError === null || validationError === void 0 ? void 0 : validationError.message
15443
- }, /*#__PURE__*/React__default.createElement(Input, Object.assign({}, otherProps, {
15768
+ }, /*#__PURE__*/React__default.createElement(Input, Object.assign({}, props, {
15444
15769
  autoFocus: true,
15445
15770
  invalid: !!validationError,
15446
15771
  onChange: handleChange,
@@ -15501,16 +15826,6 @@ const useChildren = ({
15501
15826
  setSearchQuery
15502
15827
  };
15503
15828
  };
15504
- const filterOption = (child, searchQuery) => {
15505
- var _child$props$textValu, _child$props$descript;
15506
- if ((_child$props$textValu = child.props.textValue) !== null && _child$props$textValu !== void 0 && _child$props$textValu.toLowerCase().includes(searchQuery.toLowerCase())) {
15507
- return true;
15508
- }
15509
- if ((_child$props$descript = child.props.description) !== null && _child$props$descript !== void 0 && _child$props$descript.toLowerCase().includes(searchQuery.toLowerCase())) {
15510
- return true;
15511
- }
15512
- return String(child.props.children).toLowerCase().includes(searchQuery.toLowerCase());
15513
- };
15514
15829
 
15515
15830
  const getNextColor = options => {
15516
15831
  const occurrences = AVAILABLE_COLORS.reduce((prev, color) => {
@@ -15674,7 +15989,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15674
15989
  // align the listbox min width with the width of the input - it should never be smaller
15675
15990
  const dimensions = useBoundingClientRectListener(internalRef);
15676
15991
  // state
15677
- const [tabTriggeredClose, setTabTriggeredClose] = React__default.useState(false);
15678
15992
  const [open, setOpen] = React__default.useState(false);
15679
15993
  const [value, _setValue] = reactUseControllableState.useControllableState({
15680
15994
  // uncontrolled
@@ -15727,58 +16041,69 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15727
16041
  createDialog,
15728
16042
  createTriggerText
15729
16043
  };
16044
+ const hasInlineCreation = onCreate && !createDialog;
16045
+ const hasSearch = flattenedChildren.length > 5 || hasInlineCreation;
16046
+ const visibleChildren = searchQuery === '' ? initialChildren : filteredChildren;
16047
+ const selectOptions = searchQuery === '' ? flattenedChildren.map(child => child.props.value) : filteredChildren.map(child => isGroup(child) ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value) : child.props.value).flatMap(c => c) || [];
16048
+ // support typeahead functionality when search isn't available
16049
+ const queryTimeoutRef = React__default.useRef('');
16050
+ const typeahead = debounce(function () {
16051
+ if (!queryTimeoutRef.current) {
16052
+ return;
16053
+ }
16054
+ const matchedValueIndex = visibleChildren.findIndex(child => filterOption(child, queryTimeoutRef.current));
16055
+ if (matchedValueIndex > -1) {
16056
+ setValue(selectOptions[matchedValueIndex]);
16057
+ }
16058
+ queryTimeoutRef.current = '';
16059
+ }, 200);
16060
+ const setValueIfMatched = query => {
16061
+ queryTimeoutRef.current = queryTimeoutRef.current + query;
16062
+ typeahead();
16063
+ };
15730
16064
  const handleKeyDown = event => {
15731
16065
  var _listboxRef$current;
15732
16066
  if (open) {
15733
16067
  event.preventDefault();
15734
- } else if (isElementInsideTable3OrReport(event.currentTarget)) {
16068
+ } else if (isElementInsideTable3OrReport(event.currentTarget) && isAriaDirectionKey(event)) {
15735
16069
  return;
15736
16070
  } else if (!event.ctrlKey && !event.metaKey && (event.key === 'ArrowDown' || /^[a-z0-9]$/i.test(event.key))) {
15737
16071
  setOpen(true);
16072
+ if (!hasSearch) {
16073
+ setValueIfMatched(event.key);
16074
+ }
15738
16075
  }
15739
16076
  // the focus should always remain on the input, so we forward events on to the listbox
15740
16077
  (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.dispatchEvent(createCustomKeyboardEvent(event));
15741
16078
  };
15742
- let handleBlur;
15743
- if (otherProps.onBlur) {
15744
- // we might be focusing on an input or something inside the dropdown that was triggered by the select
15745
- // so see if the element gaining focus is inside a portal and look up its controller
15746
- // if we don't do this, things like validate on blur occur while simply opening the select
15747
- handleBlur = event => {
15748
- var _elementGainingFocus$;
15749
- const elementGainingFocus = event.relatedTarget;
15750
- if (elementGainingFocus === undefined) {
15751
- return;
15752
- }
15753
- const portalId = elementGainingFocus === null || elementGainingFocus === void 0 ? void 0 : (_elementGainingFocus$ = elementGainingFocus.closest('[data-radix-popper-content-wrapper] > :first-child')) === null || _elementGainingFocus$ === void 0 ? void 0 : _elementGainingFocus$.id;
15754
- if (!portalId || event.currentTarget.getAttribute(`aria-controls`) !== portalId) {
15755
- var _otherProps$onBlur;
15756
- (_otherProps$onBlur = otherProps.onBlur) === null || _otherProps$onBlur === void 0 ? void 0 : _otherProps$onBlur.call(otherProps, event);
15757
- }
15758
- };
15759
- }
16079
+ const shouldFocusNextRef = React__default.useRef(false);
15760
16080
  const handleListboxKeyDown = event => {
15761
16081
  if (isAriaDirectionKey(event)) {
15762
16082
  setShouldPauseHoverState(true);
16083
+ return;
16084
+ }
16085
+ if (event.key === 'Tab') {
16086
+ shouldFocusNextRef.current = true;
16087
+ setOpen(false);
16088
+ return;
16089
+ }
16090
+ // support typeahead to set the value by typing its text
16091
+ if (!hasSearch && /^[a-z0-9]$/i.test(event.key)) {
16092
+ setValueIfMatched(event.key);
16093
+ return;
15763
16094
  }
15764
16095
  };
16096
+ // popover closes and unmounts before any event can be used to focus next, so prevent focusing the trigger and focus next
15765
16097
  const handleCloseAutoFocus = event => {
15766
- event.preventDefault();
15767
- event.stopPropagation();
15768
- if (tabTriggeredClose) {
15769
- const nextFocussableElement = getNextFocussableElement(internalRef.current);
15770
- if (nextFocussableElement) {
15771
- // UX requirement: move focus to the next focussable element when tab key is pressed to select the value
15772
- nextFocussableElement.focus();
15773
- // Reset the tabTriggeredClose state
15774
- setTabTriggeredClose(false);
15775
- }
15776
- } else {
15777
- var _internalRef$current;
15778
- (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.focus();
16098
+ if (shouldFocusNextRef.current) {
16099
+ var _otherProps$onBlur, _getNextFocussableEle;
16100
+ event.preventDefault();
16101
+ shouldFocusNextRef.current = false;
16102
+ (_otherProps$onBlur = otherProps.onBlur) === null || _otherProps$onBlur === void 0 ? void 0 : _otherProps$onBlur.call(otherProps, event);
16103
+ (_getNextFocussableEle = getNextFocussableElement(internalRef.current)) === null || _getNextFocussableEle === void 0 ? void 0 : _getNextFocussableEle.focus();
16104
+ return;
15779
16105
  }
15780
16106
  };
15781
- const selectOptions = searchQuery === '' ? flattenedChildren.map(child => child.props.value) : filteredChildren.map(child => isGroup(child) ? Array.isArray(child.props.children) && child.props.children.map(subChild => subChild.props.value) : child.props.value).flatMap(c => c) || [];
15782
16107
  const areAllSelected = Array.isArray(value) && selectOptions.every(option => value.includes(option));
15783
16108
  const selectAllText = React__default.useMemo(() => {
15784
16109
  if (searchQuery === '') {
@@ -15810,8 +16135,6 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15810
16135
  setValue(nextValue);
15811
16136
  }
15812
16137
  };
15813
- const hasInlineCreation = onCreate && !createDialog;
15814
- const hasSearch = flattenedChildren.length > 5 || hasInlineCreation;
15815
16138
  const className = cn('border-grey-300 rounded border bg-white py-1.5 shadow-md ', {
15816
16139
  'focus-within:yt-focus': !hasSearch,
15817
16140
  'outline-none': hasSearch
@@ -15827,18 +16150,14 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15827
16150
  }, /*#__PURE__*/React__default.createElement(Trigger$7, Object.assign({}, otherProps, {
15828
16151
  "aria-haspopup": "listbox",
15829
16152
  emptyValue: emptyValue,
15830
- onBlur: handleBlur,
15831
16153
  onKeyDown: handleKeyDown,
15832
16154
  placeholder: placeholder,
15833
16155
  ref: internalRef
15834
16156
  }), flattenedChildren)), /*#__PURE__*/React__default.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Content, {
15835
16157
  asChild: true,
15836
16158
  align: "start",
15837
- onOpenAutoFocus: () => {
15838
- var _internalRef$current2;
15839
- (_internalRef$current2 = internalRef.current) === null || _internalRef$current2 === void 0 ? void 0 : _internalRef$current2.focus();
15840
- },
15841
16159
  onCloseAutoFocus: handleCloseAutoFocus,
16160
+ onPointerDownOutside: otherProps.onBlur,
15842
16161
  sideOffset: 4,
15843
16162
  tabIndex: -1
15844
16163
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -15848,8 +16167,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15848
16167
  }
15849
16168
  }, hasSearch ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Search$2, {
15850
16169
  placeholder: hasInlineCreation ? texts.select2.searchOrCreate : texts.select2.search,
15851
- ref: searchRef,
15852
- onTabKeyPress: () => setTabTriggeredClose(true)
16170
+ ref: searchRef
15853
16171
  }), multiple && selectOptions.length > 1 && (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button$1, {
15854
16172
  className: "!justify-start",
15855
16173
  appearance: "discrete",
@@ -15878,7 +16196,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
15878
16196
  ref: listboxRef,
15879
16197
  setValue: setValue,
15880
16198
  value: value
15881
- }, searchQuery === '' ? (/*#__PURE__*/React__default.createElement(Collection$1, null, initialChildren)) : (/*#__PURE__*/React__default.createElement(Collection$1, null, filteredChildren)), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
16199
+ }, /*#__PURE__*/React__default.createElement(Collection$1, null, visibleChildren), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
15882
16200
  onCreate: onCreate,
15883
16201
  options: flattenedChildren
15884
16202
  }) : null))))), /*#__PURE__*/React__default.createElement(ControlledHiddenField, {
@@ -15919,6 +16237,7 @@ const ControlledHiddenField = props => {
15919
16237
  key: String(bubbleValue),
15920
16238
  multiple: multiple,
15921
16239
  name: name,
16240
+ tabIndex: -1,
15922
16241
  value: bubbleValue
15923
16242
  }, emptyValue !== undefined ? /*#__PURE__*/React__default.createElement("option", {
15924
16243
  value: emptyValue
@@ -16191,10 +16510,11 @@ function guessComparatorsBasedOnControl(column) {
16191
16510
  return getDataTypeProperties(columnMeta.dataType).filterComparators;
16192
16511
  }
16193
16512
 
16513
+ const FilterContext = /*#__PURE__*/React__default.createContext([]);
16514
+
16194
16515
  const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
16195
16516
  const {
16196
16517
  allColumns,
16197
- filters,
16198
16518
  onChange: handleChange,
16199
16519
  value = null,
16200
16520
  ...attributes
@@ -16202,6 +16522,7 @@ const FilterColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
16202
16522
  const {
16203
16523
  texts
16204
16524
  } = useLocalization();
16525
+ const filters = React__default.useContext(FilterContext);
16205
16526
  const selectedColumn = allColumns.find(column => column.id === value);
16206
16527
  const warning = selectedColumn && !selectedColumn.getIsVisible();
16207
16528
  return /*#__PURE__*/React__default.createElement("div", {
@@ -16367,10 +16688,11 @@ function Control(props) {
16367
16688
  } = props;
16368
16689
  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;
16369
16690
  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;
16691
+ const filters = React__default.useContext(FilterContext);
16370
16692
  const ref = React__default.useRef(null);
16371
16693
  React.useEffect(() => {
16372
16694
  // 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
16373
- if (controlRenderer === 'switch' && value === undefined) {
16695
+ if ((controlRenderer === 'switch' || controlRenderer === 'checkbox') && value === undefined) {
16374
16696
  onChange(false);
16375
16697
  }
16376
16698
  }, [controlRenderer]);
@@ -16380,7 +16702,7 @@ function Control(props) {
16380
16702
  setValue: value => onChange(value),
16381
16703
  value,
16382
16704
  ref
16383
- }), {
16705
+ }, undefined, filters), {
16384
16706
  ['data-query-selector']: querySelector,
16385
16707
  className: 'focus:yt-focus'
16386
16708
  });
@@ -16395,6 +16717,12 @@ function Control(props) {
16395
16717
  checked: Boolean(value),
16396
16718
  onChange: onChange
16397
16719
  }));
16720
+ } else if (controlRenderer === 'checkbox') {
16721
+ return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, attributes, {
16722
+ className: "!m-1.5",
16723
+ checked: Boolean(value),
16724
+ onChange: onChange
16725
+ }));
16398
16726
  } else if ((controlRenderer === 'input' || controlRenderer === undefined) && dataType === 'number') {
16399
16727
  return /*#__PURE__*/React__default.createElement(Input, Object.assign({}, attributes, {
16400
16728
  className: "flex-grow",
@@ -16416,7 +16744,6 @@ function Filter$1(props) {
16416
16744
  const {
16417
16745
  allColumns,
16418
16746
  filter,
16419
- filters,
16420
16747
  onChange: handleChange,
16421
16748
  onRemove,
16422
16749
  position
@@ -16491,7 +16818,6 @@ function Filter$1(props) {
16491
16818
  className: "flex min-h-[theme(spacing.8)] w-14 flex-shrink-0 items-center justify-end pr-2 text-right"
16492
16819
  }, position > 0 ? texts.table.filters.conditions.and : texts.table.filters.conditions.where), /*#__PURE__*/React__default.createElement(FilterColumn, {
16493
16820
  allColumns: allColumns,
16494
- filters: filters,
16495
16821
  onChange: handleChangeColumn,
16496
16822
  value: id,
16497
16823
  ref: ref
@@ -16595,7 +16921,9 @@ function ManageFiltersPopover(props) {
16595
16921
  };
16596
16922
  return /*#__PURE__*/React__default.createElement(Popover, Object.assign({}, popoverProps, {
16597
16923
  onChange: handleClose
16598
- }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement("div", {
16924
+ }), /*#__PURE__*/React__default.createElement(Popover.Content, null, /*#__PURE__*/React__default.createElement(FilterContext.Provider, {
16925
+ value: filters
16926
+ }, /*#__PURE__*/React__default.createElement("div", {
16599
16927
  className: "flex w-[40rem] flex-col gap-4"
16600
16928
  }, /*#__PURE__*/React__default.createElement("div", {
16601
16929
  className: "flex h-8"
@@ -16611,7 +16939,6 @@ function ManageFiltersPopover(props) {
16611
16939
  key: `filter_${index}`,
16612
16940
  allColumns: allColumns,
16613
16941
  filter: filter,
16614
- filters: filters,
16615
16942
  position: index,
16616
16943
  onChange: handleChangeFilter,
16617
16944
  onRemove: filters.length > 0 && filters.some(f => f.id) || filters.length > 1 ? handleRemoveFilter : undefined
@@ -16627,7 +16954,7 @@ function ManageFiltersPopover(props) {
16627
16954
  }, texts.table.filters.buttons.clear), /*#__PURE__*/React__default.createElement(Button$1, {
16628
16955
  appearance: "primary",
16629
16956
  onClick: handleApply
16630
- }, texts.table.filters.buttons.apply)))));
16957
+ }, texts.table.filters.buttons.apply))))));
16631
16958
  }
16632
16959
 
16633
16960
  function Filters(props) {
@@ -16730,7 +17057,7 @@ function Table(props) {
16730
17057
  }
16731
17058
  Table.Toolbar = TableToolbar;
16732
17059
  Table.Grid = TableGrid;
16733
- function getFilterReason(table) {
17060
+ function getEmptyStateReason(table) {
16734
17061
  if (table.instance.getFilteredRowModel().rows.length === 0 && table.instance.getCoreRowModel().rows.length !== 0) {
16735
17062
  const state = table.instance.getState();
16736
17063
  if (table.meta.search.enableGlobalFilter && !!state.globalFilter) {
@@ -16747,15 +17074,14 @@ function TableGrid(props) {
16747
17074
  var _table$state$grouping;
16748
17075
  const {
16749
17076
  enableHorizontalArrowKeyNavigation,
17077
+ footerRows,
16750
17078
  table,
16751
17079
  ...attributes
16752
17080
  } = props;
16753
17081
  const handleFocus = table.meta.rowActive.rowActiveIndex === undefined ? event => {
16754
17082
  table.meta.rowActive.handleFocus(event, table.meta.length, table.renderer.scrollToIndex);
16755
17083
  } : undefined;
16756
- const filterReason = getFilterReason(table);
16757
- const searchNotApplied = !table.state.globalFilter || table.state.globalFilter === '';
16758
- const filtersNotApplied = !table.state.columnFilters || table.state.columnFilters.length === 0;
17084
+ const emptyStateReason = getEmptyStateReason(table);
16759
17085
  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, {
16760
17086
  id: table.id,
16761
17087
  "data-table-font-size": table.meta.fontSize.size,
@@ -16771,14 +17097,19 @@ function TableGrid(props) {
16771
17097
  style: table.style,
16772
17098
  tabIndex: -1
16773
17099
  }), /*#__PURE__*/React__default.createElement("thead", null, table.instance.getHeaderGroups().map(headerGroup => (/*#__PURE__*/React__default.createElement("tr", {
16774
- key: headerGroup.id
17100
+ key: headerGroup.id,
17101
+ onFocus: event => {
17102
+ // prevents rowActive.handleFocus from running when clicking on column-header menus.
17103
+ event.stopPropagation();
17104
+ }
16775
17105
  }, headerGroup.headers.map(props => (/*#__PURE__*/React__default.createElement(Header$5, {
16776
17106
  key: props.id,
16777
17107
  header: props,
16778
17108
  scrollToIndex: table.renderer.scrollToIndex
16779
- }))))))), filterReason ? (/*#__PURE__*/React__default.createElement(EmptyStateBody, {
17109
+ }))))))), emptyStateReason ? (/*#__PURE__*/React__default.createElement(EmptyStateBody, {
16780
17110
  emptyState: props.table.props.emptyState,
16781
- reason: filterReason
17111
+ isReady: table.meta.server.isEnabled ? table.meta.server.isReady : true,
17112
+ reason: emptyStateReason
16782
17113
  })) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Body, {
16783
17114
  enableHorizontalArrowKeyNavigation: enableHorizontalArrowKeyNavigation,
16784
17115
  table: table.instance,
@@ -16788,9 +17119,9 @@ function TableGrid(props) {
16788
17119
  ...table.renderer.style,
16789
17120
  height: table.renderer.style.height + ROW_HEIGHT_ESTIMATES[table.meta.rowHeight.height]
16790
17121
  } : table.renderer.style
16791
- }, table.renderer.rows, searchNotApplied && filtersNotApplied && props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
17122
+ }, table.renderer.rows, props.children), table.meta.footer.isEnabled ? /*#__PURE__*/React__default.createElement(Foot, {
16792
17123
  table: table.instance
16793
- }) : null)))));
17124
+ }, footerRows) : null)))));
16794
17125
  }
16795
17126
 
16796
17127
  function Column$1(_) {
@@ -18291,71 +18622,6 @@ const useTableRowCreation = (data, tableRef) => {
18291
18622
  };
18292
18623
  };
18293
18624
 
18294
- function useTableEditingListener(table, tableRef) {
18295
- const tableMeta = table.options.meta;
18296
- const completedRowsCount = tableMeta.editing.getCompletedRowsCount();
18297
- const localization = useLocalization();
18298
- const saveChanges = () => {
18299
- requestAnimationFrame(() => {
18300
- tableMeta.editing.saveChanges();
18301
- });
18302
- };
18303
- // save when the row changes
18304
- useLazyEffect(() => {
18305
- if (tableMeta.editing.isEditing) {
18306
- saveChanges();
18307
- }
18308
- }, [tableMeta.rowActive.rowActiveIndex]);
18309
- useLazyEffect(() => {
18310
- if (tableMeta.editing.isEditing) {
18311
- if (tableMeta.rowActive.rowActiveIndex === undefined) {
18312
- tableMeta.rowActive.setRowActiveIndex(0);
18313
- }
18314
- } else {
18315
- // save
18316
- saveChanges();
18317
- // reset detailed mode
18318
- tableMeta.editing.toggleDetailedMode(false);
18319
- // reset the last index back to the first focusable element, when editing gets turned off
18320
- tableMeta.editing.setLastFocusedCellIndex(undefined);
18321
- }
18322
- }, [tableMeta.editing.isEditing]);
18323
- // show a warning if the user navigates away without triggering save, such as using the browser back/forward button
18324
- const hasChanges = tableMeta.editing.hasChanges();
18325
- React__default.useEffect(() => {
18326
- function showUnsavedChangesWarning(event) {
18327
- if (tableMeta.editing.isEditing && hasChanges) {
18328
- event.returnValue = true;
18329
- return true;
18330
- }
18331
- return false;
18332
- }
18333
- window.addEventListener('beforeunload', showUnsavedChangesWarning);
18334
- return () => {
18335
- window.removeEventListener('beforeunload', showUnsavedChangesWarning);
18336
- };
18337
- }, [tableMeta.editing.isEditing, hasChanges]);
18338
- React__default.useEffect(() => {
18339
- if (completedRowsCount > 0) {
18340
- resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
18341
- }
18342
- }, [completedRowsCount]);
18343
- React__default.useEffect(() => {
18344
- const onClickOutside = event => {
18345
- if (tableMeta.editing.isEditing) {
18346
- var _event$target$getAttr, _event$target;
18347
- const element = (_event$target$getAttr = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getAttribute('data-taco')) !== null && _event$target$getAttr !== void 0 ? _event$target$getAttr : '';
18348
- const insideTable = isElementInsideOrTriggeredFromContainer(event.target, tableRef.current) || element === 'backdrop';
18349
- if (!insideTable) {
18350
- saveChanges();
18351
- }
18352
- }
18353
- };
18354
- document.addEventListener('click', onClickOutside);
18355
- return () => document.removeEventListener('click', onClickOutside);
18356
- }, [saveChanges, tableMeta.editing.isEditing]);
18357
- }
18358
-
18359
18625
  function willRowMove(cell, change, rowIndex, localization) {
18360
18626
  const {
18361
18627
  table
@@ -18436,444 +18702,706 @@ function willRowMoveAfterSorting(cell, change, rowIndex) {
18436
18702
  }
18437
18703
  return ((_resortedRows$index = resortedRows[index]) === null || _resortedRows$index === void 0 ? void 0 : _resortedRows$index.id) !== cell.row.id;
18438
18704
  }
18439
- function animateCreateRow(id) {
18440
- const templateRow = document.querySelector(`[data-row-id="${id}"]`);
18441
- if (templateRow) {
18442
- const firstCell = templateRow.querySelector(':first-child');
18443
- const checkbox = firstCell === null || firstCell === void 0 ? void 0 : firstCell.querySelector('[data-taco="checkbox"]');
18444
- firstCell === null || firstCell === void 0 ? void 0 : firstCell.focus();
18445
- if (checkbox) {
18446
- setDataFocusAttribute(checkbox);
18447
- }
18448
- templateRow.scrollIntoView();
18449
- const keyframes = [{
18450
- background: '#b2c7ef'
18451
- }, {
18452
- background: '#ebebeb'
18453
- }];
18454
- for (const child of templateRow.children) {
18455
- child.animate(keyframes, {
18456
- duration: 1000,
18457
- easing: 'ease-out'
18458
- });
18459
- }
18705
+ const TEMPORARY_ROW_ID_PREFIX = 'temp-';
18706
+ function isTemporaryRow(rowId) {
18707
+ if (rowId === undefined) {
18708
+ return false;
18709
+ }
18710
+ return String(rowId).startsWith(TEMPORARY_ROW_ID_PREFIX);
18711
+ }
18712
+ const shortcut = {
18713
+ key: 'e',
18714
+ meta: true,
18715
+ shift: false
18716
+ };
18717
+ function isTableScrolled(ref) {
18718
+ if (ref.current) {
18719
+ var _ref$current, _ref$current$querySel, _ref$current2, _ref$current2$querySe;
18720
+ 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');
18721
+ return height > ref.current.scrollHeight;
18460
18722
  }
18723
+ return false;
18461
18724
  }
18462
18725
 
18463
- function useTableEditing(isEnabled = false, handleSave, handleChange, validator) {
18464
- // used to switch the table into editing mode
18465
- const [isEditing, toggleEditing] = React__default.useState(false);
18466
- // used to switch the editing between "detailed" mode
18467
- const [isDetailedMode, toggleDetailedMode] = React__default.useState(false);
18468
- // store the last focused cell, so that up/down arrow key navigation remains in the same column
18469
- const [lastFocusedCellIndex, setLastFocusedCellIndex] = useLastFocusedCellIndex();
18470
- // store pending changes for each row
18471
- // changes are saved as soon as the active row changes, so in most cases this will only contain the active row's changes
18472
- // but not always - if validation or server requests fail when saving, those rows remain until the failure is resolved
18473
- const pendingChangesFns = usePendingChanges(isEnabled, handleSave, handleChange, validator);
18474
- useGlobalKeyDown(isEnabled && isEditing ? {
18726
+ function useTableEditingListener(table, tableRef, scrollToIndex) {
18727
+ const tableMeta = table.options.meta;
18728
+ const localization = useLocalization();
18729
+ useLazyEffect(() => {
18730
+ return () => {
18731
+ if (tableMeta.editing.isEditing && tableMeta.rowActive.rowActiveIndex !== undefined) {
18732
+ var _table$getRowModel$ro;
18733
+ 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);
18734
+ }
18735
+ };
18736
+ }, [tableMeta.rowActive.rowActiveIndex]);
18737
+ // show a warning if the user navigates away without triggering save, such as using the browser back/forward button
18738
+ const hasChanges = tableMeta.editing.hasChanges();
18739
+ React__default.useEffect(() => {
18740
+ function showUnsavedChangesWarning(event) {
18741
+ if (tableMeta.editing.isEditing && hasChanges) {
18742
+ event.returnValue = true;
18743
+ return true;
18744
+ }
18745
+ return false;
18746
+ }
18747
+ window.addEventListener('beforeunload', showUnsavedChangesWarning);
18748
+ return () => {
18749
+ window.removeEventListener('beforeunload', showUnsavedChangesWarning);
18750
+ };
18751
+ }, [tableMeta.editing.isEditing, hasChanges]);
18752
+ const hasSavedChanges = tableMeta.editing.hasSaved();
18753
+ useLazyEffect(() => {
18754
+ if (hasSavedChanges) {
18755
+ resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
18756
+ }
18757
+ }, [hasSavedChanges]);
18758
+ React__default.useEffect(() => {
18759
+ const onClickOutside = event => {
18760
+ if (tableMeta.editing.isEditing) {
18761
+ const element = event.target;
18762
+ 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);
18763
+ // users can click the white space below rows which could be inside the table, but a valid scenario to save
18764
+ if (!isTableOrIsInsideTable) {
18765
+ tableMeta.editing.saveChanges(table);
18766
+ }
18767
+ }
18768
+ };
18769
+ document.addEventListener('click', onClickOutside);
18770
+ return () => document.removeEventListener('click', onClickOutside);
18771
+ }, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
18772
+ const rows = table.getRowModel().rows;
18773
+ // make sure pending changes are removed for rows that no longer exist
18774
+ useLazyEffect(() => {
18775
+ const pendingChanges = tableMeta.editing.getErrorsShownInAlert();
18776
+ pendingChanges.forEach(pendingChange => {
18777
+ try {
18778
+ table.getRow(pendingChange.rowId);
18779
+ } catch {
18780
+ tableMeta.editing.discardChanges(pendingChange.rowId, table);
18781
+ }
18782
+ });
18783
+ }, [rows.length]);
18784
+ // shortcuts
18785
+ useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
18786
+ event.preventDefault();
18787
+ tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing, table, scrollToIndex);
18788
+ });
18789
+ useGlobalKeyDown(tableMeta.editing.isEditing ? {
18475
18790
  key: 's',
18476
18791
  meta: true,
18477
18792
  shift: false
18478
18793
  } : undefined, event => {
18479
18794
  event.preventDefault();
18480
- pendingChangesFns.saveChanges();
18795
+ tableMeta.editing.saveChanges(table);
18481
18796
  });
18482
- return {
18483
- isEnabled,
18484
- isEditing,
18485
- isDetailedMode,
18486
- toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,
18487
- toggleEditing: isEnabled ? toggleEditing : () => undefined,
18488
- lastFocusedCellIndex,
18489
- setLastFocusedCellIndex,
18490
- ...pendingChangesFns
18491
- };
18492
18797
  }
18493
- function usePendingChanges(isEnabled, handleSave, handleChange, validator) {
18494
- const saveChanges = function (rowId = undefined) {
18798
+
18799
+ const DELAY_BEFORE_REMOVING_SAVE_STATUS = 3000;
18800
+ function reducer$2(state, action) {
18801
+ const {
18802
+ type,
18803
+ rowId,
18804
+ payload
18805
+ } = action;
18806
+ switch (type) {
18807
+ case 'setCellValue':
18808
+ {
18809
+ const {
18810
+ columnId,
18811
+ row,
18812
+ value
18813
+ } = payload;
18814
+ return {
18815
+ ...state,
18816
+ changes: {
18817
+ ...state.changes,
18818
+ rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
18819
+ originals: setWith(state.changes.originals, rowId, row, Object)
18820
+ }
18821
+ };
18822
+ }
18823
+ case 'removeCellValue':
18824
+ {
18825
+ const {
18826
+ columnId,
18827
+ rowIdentityAccessor
18828
+ } = payload;
18829
+ const changes = omit(state.changes.rows, `${rowId}.${columnId}`);
18830
+ // if there are no changes left, remove the row
18831
+ if (!Object.keys(changes[rowId]).length) {
18832
+ return reducer$2(state, {
18833
+ type: 'removeRow',
18834
+ rowId,
18835
+ payload: {
18836
+ rowIdentityAccessor
18837
+ }
18838
+ });
18839
+ }
18840
+ return {
18841
+ ...state,
18842
+ changes: {
18843
+ ...state.changes,
18844
+ rows: omit(state.changes.rows, `${rowId}.${columnId}`),
18845
+ errors: omit(state.changes.errors, `${rowId}.cells.${columnId}`),
18846
+ moveReasons: omit(state.changes.moveReasons, `${rowId}.${columnId}`)
18847
+ }
18848
+ };
18849
+ }
18850
+ case 'updateRow':
18851
+ {
18852
+ const {
18853
+ cellErrors,
18854
+ moveReasons,
18855
+ original,
18856
+ value
18857
+ } = payload;
18858
+ return {
18859
+ ...state,
18860
+ changes: {
18861
+ ...state.changes,
18862
+ rows: setWith(state.changes.rows, rowId, value, Object),
18863
+ errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors.cells[rowId], Object),
18864
+ originals: setWith(state.changes.originals, rowId, original !== null && original !== void 0 ? original : state.changes.originals[rowId], Object),
18865
+ moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
18866
+ // status can be undefined, so don't use ??
18867
+ status: setWith(state.changes.status, rowId, undefined, Object)
18868
+ }
18869
+ };
18870
+ }
18871
+ case 'removeRow':
18872
+ {
18873
+ const {
18874
+ rowIdentityAccessor
18875
+ } = payload;
18876
+ return {
18877
+ ...state,
18878
+ changes: {
18879
+ ...state.changes,
18880
+ rows: omit(state.changes.rows, rowId),
18881
+ errors: omit(state.changes.errors, rowId),
18882
+ moveReasons: omit(state.changes.moveReasons, rowId),
18883
+ originals: omit(state.changes.originals, rowId),
18884
+ status: omit(state.changes.status, rowId)
18885
+ },
18886
+ temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
18887
+ };
18888
+ }
18889
+ case 'setRowStatus':
18890
+ {
18891
+ const {
18892
+ status
18893
+ } = payload;
18894
+ return {
18895
+ ...state,
18896
+ changes: {
18897
+ ...state.changes,
18898
+ status: status ? setWith(state.changes.status, rowId, status, Object) : omit(state.changes.status, rowId)
18899
+ }
18900
+ };
18901
+ }
18902
+ case 'setRowErrors':
18903
+ {
18904
+ const {
18905
+ ...errors
18906
+ } = payload;
18907
+ return {
18908
+ ...state,
18909
+ changes: {
18910
+ ...state.changes,
18911
+ errors: setWith(state.changes.errors, rowId, errors, Object)
18912
+ }
18913
+ };
18914
+ }
18915
+ case 'insertTemporaryRow':
18916
+ {
18917
+ const {
18918
+ value
18919
+ } = payload;
18920
+ return {
18921
+ ...state,
18922
+ temporaryRows: state.temporaryRows.concat(value),
18923
+ changes: {
18924
+ ...state.changes,
18925
+ rows: setWith(state.changes.rows, rowId, value, Object),
18926
+ originals: setWith(state.changes.originals, rowId, value, Object)
18927
+ }
18928
+ };
18929
+ }
18930
+ default:
18931
+ return state;
18932
+ }
18933
+ }
18934
+ function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
18935
+ const saveChanges = function (table, rowId = undefined) {
18495
18936
  try {
18496
18937
  let _exit = false;
18497
18938
  if (!handleSave) {
18498
18939
  console.warn('Tried to save, but Table has no onEditingSave handler');
18499
- return Promise.resolve();
18940
+ return Promise.resolve(false);
18500
18941
  }
18501
- // we save back to pendingChanges, so make a copy of it's state when save was triggered
18502
- const changesToSave = rowId ? {
18503
- [rowId]: pendingChanges[rowId]
18504
- } : {
18505
- ...pendingChanges
18506
- };
18507
- const changes = Object.keys(changesToSave);
18508
- return Promise.resolve(function () {
18509
- if (changes.length) {
18510
- return _forOf(changes, function (rowId) {
18511
- const pendingChange = changesToSave[rowId];
18512
- const changeSet = getChangesetFromChanges(pendingChange);
18513
- return _catch(function () {
18514
- function _temp3(_result) {
18515
- return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
18516
- // cleanup changes, we don't need them after saving
18517
- resetChanges(rowId);
18518
- setRowSaveStatus(rowId, 'complete');
18519
- });
18520
- }
18521
- if (getRowSaveStatus(rowId) === 'pending') {
18522
- _exit = true;
18523
- return;
18524
- }
18525
- // set saving = true
18526
- setRowSaveStatus(rowId, 'pending');
18527
- // re-run validation, maybe a cell is already invalid but has never been blurred
18528
- const _temp2 = function () {
18529
- if (validator) {
18530
- return Promise.resolve(validator(changeSet)).then(function (errors) {
18531
- if (errors && Object.keys(errors).length) {
18532
- throw errors;
18533
- }
18534
- });
18535
- }
18536
- }();
18537
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2); // send new data to the server
18538
- }, function (error) {
18539
- // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc
18540
- // this code handles those errors and maps them either to row errors or cell specific errors
18541
- let rowError;
18542
- let cellErrors;
18543
- if (typeof error === 'string') {
18544
- rowError = error;
18545
- } else if (error instanceof Error) {
18546
- var _error$response;
18547
- rowError = error.message;
18548
- // most of our apis return error objects within this shape
18549
- if (typeof ((_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.data) === 'object') {
18550
- var _error$response2;
18551
- cellErrors = (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data;
18942
+ // sometimes we only want to save one row
18943
+ const changes = rowId ? {
18944
+ [rowId]: state.changes.rows[rowId]
18945
+ } : state.changes.rows;
18946
+ let completed = true;
18947
+ const _temp9 = _forOf(Object.keys(changes), function (rowId) {
18948
+ const status = getRowStatus(rowId);
18949
+ return _catch(function () {
18950
+ var _changes$rowId;
18951
+ function _temp8(_result) {
18952
+ return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
18953
+ // cleanup changes, we don't need them after saving
18954
+ discardChanges(rowId, table);
18955
+ // show the saved status, then remove it after a delay
18956
+ setRowStatus(rowId, 'saved');
18957
+ setTimeout(() => {
18958
+ setRowStatus(rowId, undefined);
18959
+ }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
18960
+ });
18961
+ }
18962
+ const rowChanges = (_changes$rowId = changes[rowId]) !== null && _changes$rowId !== void 0 ? _changes$rowId : {};
18963
+ // don't try to save if - already saving, or there are known errors
18964
+ if (!Object.keys(rowChanges).length || status === 'saving' || status === 'errored') {
18965
+ return;
18966
+ }
18967
+ setRowStatus(rowId, 'saving');
18968
+ const changeSet = {
18969
+ ...state.changes.originals[rowId],
18970
+ ...rowChanges
18971
+ };
18972
+ // if we had to create a temporary id, delete it first - it's our data, not theirs
18973
+ if (isTemporaryRow(changeSet[rowIdentityAccessor])) {
18974
+ delete changeSet[rowIdentityAccessor];
18975
+ }
18976
+ // re-run validation, maybe a cell is already invalid but has never been blurred
18977
+ const _temp7 = function () {
18978
+ if (validator) {
18979
+ return Promise.resolve(validator(changeSet)).then(function (errors) {
18980
+ if (errors && Object.keys(errors).length) {
18981
+ throw errors;
18552
18982
  }
18553
- } else if (typeof error === 'object') {
18554
- cellErrors = error;
18983
+ });
18984
+ }
18985
+ }();
18986
+ return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7); // send new data to the server
18987
+ }, function (error) {
18988
+ var _error$response;
18989
+ 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) {
18990
+ console.error(error);
18991
+ }
18992
+ // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc
18993
+ // this code handles those errors and maps them either to row errors or cell specific errors
18994
+ let rowError;
18995
+ let cellErrors;
18996
+ if (typeof error === 'string') {
18997
+ rowError = error;
18998
+ } else if (error instanceof Error) {
18999
+ var _error$response2;
19000
+ rowError = error.message;
19001
+ // most of our apis return error objects within this shape
19002
+ if (typeof ((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) === 'object') {
19003
+ var _error$response3;
19004
+ cellErrors = (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data;
19005
+ }
19006
+ } else if (typeof error === 'object') {
19007
+ cellErrors = error;
19008
+ }
19009
+ if (rowError || cellErrors) {
19010
+ dispatch({
19011
+ type: 'setRowErrors',
19012
+ rowId,
19013
+ payload: {
19014
+ row: rowError,
19015
+ cells: cellErrors,
19016
+ shouldShowErrorAlert: true
18555
19017
  }
18556
- if (rowError || cellErrors) {
18557
- setPendingChanges(currentChanges => {
18558
- const nextChanges = {
18559
- ...currentChanges
18560
- };
18561
- nextChanges[rowId]._meta.errors = {
18562
- row: rowError,
18563
- cells: cellErrors,
18564
- shouldShowErrorAlert: true
18565
- };
18566
- return nextChanges;
18567
- });
19018
+ });
19019
+ }
19020
+ setRowStatus(rowId, 'errored');
19021
+ completed = false;
19022
+ });
19023
+ }, function () {
19024
+ return _exit;
19025
+ });
19026
+ return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function (_result3) {
19027
+ return _exit ? _result3 : completed;
19028
+ }) : _exit ? _temp9 : completed);
19029
+ } catch (e) {
19030
+ return Promise.reject(e);
19031
+ }
19032
+ };
19033
+ const onCellChanged = function (cell, rowIndex, nextValue, shouldRunUpdaters = true) {
19034
+ try {
19035
+ function _temp6() {
19036
+ var _state$changes$errors11;
19037
+ function _temp4() {
19038
+ // only set errors and move reasons for the cells we're currently acting on
19039
+ // why? because the UX is not good if we set them for cells the user hasn't touched yet
19040
+ const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
19041
+ const allCells = cell.row._getAllCellsByColumnId();
19042
+ cellsToActOn.forEach(accessor => {
19043
+ if (validationErrors[accessor]) {
19044
+ nextCellErrors[accessor] = validationErrors[accessor];
19045
+ // don't show move indicator for cells with errors, they aren't valid and can't be saved
19046
+ delete nextMoveReasons[accessor];
19047
+ } else {
19048
+ var _allCells$accessor;
19049
+ // there isn't any error in this run, remove any error set in state
19050
+ delete nextCellErrors[accessor];
19051
+ if ((_allCells$accessor = allCells[accessor]) !== null && _allCells$accessor !== void 0 && _allCells$accessor.column.getIsSorted()) {
19052
+ // run row move determination
19053
+ const reason = willRowMove(cell, nextChanges[accessor], rowIndex, localization);
19054
+ // if the row will move based on this change save why, otherwise delete any existing state
19055
+ if (reason) {
19056
+ nextMoveReasons[accessor] = reason;
19057
+ } else {
19058
+ delete nextMoveReasons[accessor];
19059
+ }
18568
19060
  }
18569
- setRowSaveStatus(rowId, undefined);
19061
+ }
19062
+ });
19063
+ dispatch({
19064
+ type: 'updateRow',
19065
+ rowId: cell.row.id,
19066
+ payload: {
19067
+ cellErrors: nextCellErrors,
19068
+ moveReasons: nextMoveReasons,
19069
+ value: nextChanges
19070
+ }
19071
+ });
19072
+ }
19073
+ // create a projection of the next state, so we can act against it
19074
+ const nextChanges = {
19075
+ ...changes,
19076
+ ...updatesForOtherCells
19077
+ };
19078
+ const nextMoveReasons = {
19079
+ ...state.changes.moveReasons[cell.row.id]
19080
+ };
19081
+ const nextCellErrors = {
19082
+ ...((_state$changes$errors11 = state.changes.errors[cell.row.id]) === null || _state$changes$errors11 === void 0 ? void 0 : _state$changes$errors11.cells)
19083
+ };
19084
+ // run validation - if there are changes, and if there is an original stored
19085
+ let validationErrors = {};
19086
+ const _temp3 = function () {
19087
+ if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
19088
+ // merge with the original so we get a full row
19089
+ const nextRowValue = {
19090
+ ...state.changes.originals[cell.row.id],
19091
+ ...changes,
19092
+ ...updatesForOtherCells
19093
+ };
19094
+ return Promise.resolve(validator(nextRowValue)).then(function (_validator2) {
19095
+ validationErrors = _validator2 !== null && _validator2 !== void 0 ? _validator2 : {};
18570
19096
  });
18571
- }, function () {
18572
- return _exit;
19097
+ }
19098
+ }();
19099
+ return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
19100
+ }
19101
+ const changes = nextValue !== undefined ? {
19102
+ ...state.changes.rows[cell.row.id],
19103
+ [cell.column.id]: nextValue
19104
+ } : {
19105
+ ...state.changes.rows[cell.row.id]
19106
+ };
19107
+ if (!Object.keys(changes).length) {
19108
+ return Promise.resolve();
19109
+ }
19110
+ let updatesForOtherCells = {};
19111
+ // run the updater handler if there is one, to see if there are any other cells to update
19112
+ const _temp5 = function () {
19113
+ if (typeof handleChange === 'function' && shouldRunUpdaters) {
19114
+ const previousRowValue = {
19115
+ ...state.changes.originals[cell.row.id]
19116
+ };
19117
+ const nextRowValue = {
19118
+ ...state.changes.originals[cell.row.id],
19119
+ ...changes
19120
+ };
19121
+ return Promise.resolve(handleChange(cell.column.id, changes[cell.column.id], nextRowValue, previousRowValue)).then(function (_handleChange) {
19122
+ updatesForOtherCells = _handleChange !== null && _handleChange !== void 0 ? _handleChange : {};
18573
19123
  });
18574
19124
  }
18575
- }());
19125
+ }();
19126
+ return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
18576
19127
  } catch (e) {
18577
19128
  return Promise.reject(e);
18578
19129
  }
18579
- };
18580
- const validateCell = function (cell) {
19130
+ }; // general
19131
+ // rows
19132
+ const setRowValue = function (rowId, original, value) {
18581
19133
  try {
18582
- if (!validator || !isEnabled) {
18583
- return Promise.resolve();
19134
+ function _temp2() {
19135
+ dispatch({
19136
+ type: 'updateRow',
19137
+ rowId,
19138
+ payload: {
19139
+ cellErrors,
19140
+ original,
19141
+ value
19142
+ }
19143
+ });
18584
19144
  }
18585
- const changeSet = getChangesetFromChanges(pendingChanges[cell.row.id]);
18586
- // only validate if the cell being blurred actually has any changes
19145
+ let cellErrors;
18587
19146
  const _temp = function () {
18588
- if (cell.column.id in changeSet) {
18589
- return Promise.resolve(validator(changeSet)).then(function (errors) {
18590
- setPendingChanges(currentChanges => {
18591
- const nextChanges = {
18592
- ...currentChanges
18593
- };
18594
- nextChanges[cell.row.id]._meta = {
18595
- ...nextChanges[cell.row.id]._meta,
18596
- errors: {
18597
- ...nextChanges[cell.row.id]._meta.errors,
18598
- cells: errors,
18599
- shouldShowErrorAlert: !Object.keys(errors).length ? false : nextChanges[cell.row.id]._meta.errors.shouldShowErrorAlert
18600
- }
18601
- };
18602
- return nextChanges;
18603
- });
19147
+ if (validator) {
19148
+ const row = {
19149
+ ...original,
19150
+ ...value
19151
+ };
19152
+ return Promise.resolve(validator(row)).then(function (_validator) {
19153
+ cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
18604
19154
  });
18605
19155
  }
18606
19156
  }();
18607
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
18608
- } catch (e) {
18609
- return Promise.reject(e);
18610
- }
18611
- };
18612
- const setCellValue = function (cell, change, rowIndex) {
18613
- try {
18614
- const changes = {
18615
- [cell.column.id]: change
18616
- };
18617
- setPendingChanges(currentChanges => {
18618
- const nextChanges = createPendingChangesSetter(currentChanges, cell.row, rowIndex, changes, localization);
18619
- pendingChangesUpdater.syncCellChanges(nextChanges);
18620
- return nextChanges;
18621
- });
18622
- pendingChangesUpdater.runCellUpdates(changes, cell, rowIndex);
18623
- return Promise.resolve();
18624
- } catch (e) {
18625
- return Promise.reject(e);
18626
- }
18627
- };
18628
- const addCreatedRowChangeset = function (row) {
18629
- try {
18630
- const cells = row.getAllCells();
18631
- setPendingChanges(currentChanges => {
18632
- return cells.reduce((changes, cell) => {
18633
- if (cell.getValue()) {
18634
- var _currentChanges$cell$, _currentChanges$cell$2, _currentChanges$cell$3;
18635
- return {
18636
- ...changes,
18637
- [cell.row.id]: {
18638
- ...changes[cell.row.id],
18639
- [cell.column.id]: cell.getValue(),
18640
- _meta: {
18641
- ...((_currentChanges$cell$ = currentChanges[cell.row.id]) === null || _currentChanges$cell$ === void 0 ? void 0 : _currentChanges$cell$._meta),
18642
- original: cell.row.original,
18643
- moveReason: {
18644
- ...((_currentChanges$cell$2 = currentChanges[cell.row.id]) === null || _currentChanges$cell$2 === void 0 ? void 0 : _currentChanges$cell$2._meta.moveReason)
18645
- },
18646
- errors: {
18647
- ...((_currentChanges$cell$3 = currentChanges[cell.row.id]) === null || _currentChanges$cell$3 === void 0 ? void 0 : _currentChanges$cell$3._meta.errors)
18648
- }
18649
- }
18650
- }
18651
- };
18652
- } else {
18653
- return changes;
18654
- }
18655
- }, currentChanges);
18656
- });
18657
- return Promise.resolve();
19157
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
18658
19158
  } catch (e) {
18659
19159
  return Promise.reject(e);
18660
19160
  }
18661
19161
  };
18662
19162
  const localization = useLocalization();
18663
- const [pendingChanges, setPendingChanges] = React__default.useState({});
18664
- // we maintain save status as separate state because 'complete' needs to briefly show after pendingChanges are deleted
18665
- const [saveStates, setSaveState] = React__default.useState({});
18666
- function getCellValue(cell) {
18667
- var _pendingChanges$cell$;
18668
- return (_pendingChanges$cell$ = pendingChanges[cell.row.id]) === null || _pendingChanges$cell$ === void 0 ? void 0 : _pendingChanges$cell$[cell.column.id];
19163
+ const [state, dispatch] = React__default.useReducer(reducer$2, {
19164
+ changes: {
19165
+ rows: {},
19166
+ errors: {},
19167
+ moveReasons: {},
19168
+ originals: {},
19169
+ status: {}
19170
+ },
19171
+ temporaryRows: []
19172
+ });
19173
+ function getRowValue(rowId) {
19174
+ var _state$changes$rows$r, _state$changes$rows;
19175
+ 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;
18669
19176
  }
18670
- function getCellError(cell) {
18671
- var _pendingChanges$cell$2, _pendingChanges$cell$3, _pendingChanges$cell$4;
18672
- return (_pendingChanges$cell$2 = pendingChanges[cell.row.id]) === null || _pendingChanges$cell$2 === void 0 ? void 0 : (_pendingChanges$cell$3 = _pendingChanges$cell$2._meta.errors) === null || _pendingChanges$cell$3 === void 0 ? void 0 : (_pendingChanges$cell$4 = _pendingChanges$cell$3.cells) === null || _pendingChanges$cell$4 === void 0 ? void 0 : _pendingChanges$cell$4[cell.column.id];
19177
+ function getRowMoveReason(rowId) {
19178
+ var _Object$values$, _state$changes$moveRe, _state$changes$moveRe2;
19179
+ return (_Object$values$ = Object.values((_state$changes$moveRe = (_state$changes$moveRe2 = state.changes.moveReasons) === null || _state$changes$moveRe2 === void 0 ? void 0 : _state$changes$moveRe2[rowId]) !== null && _state$changes$moveRe !== void 0 ? _state$changes$moveRe : {})[0]) !== null && _Object$values$ !== void 0 ? _Object$values$ : undefined;
18673
19180
  }
18674
- const pendingChangesUpdater = usePendingChangesUpdater(handleChange, setPendingChanges);
18675
19181
  function hasRowErrors(rowId) {
18676
- var _pendingChanges$rowId, _pendingChanges$rowId2, _pendingChanges$rowId3, _pendingChanges$rowId4, _pendingChanges$rowId5;
18677
- if (!isEnabled) {
18678
- return false;
18679
- }
18680
- return !!((_pendingChanges$rowId = pendingChanges[rowId]) !== null && _pendingChanges$rowId !== void 0 && (_pendingChanges$rowId2 = _pendingChanges$rowId._meta.errors) !== null && _pendingChanges$rowId2 !== void 0 && _pendingChanges$rowId2.row) || !!Object.keys((_pendingChanges$rowId3 = (_pendingChanges$rowId4 = pendingChanges[rowId]) === null || _pendingChanges$rowId4 === void 0 ? void 0 : (_pendingChanges$rowId5 = _pendingChanges$rowId4._meta.errors) === null || _pendingChanges$rowId5 === void 0 ? void 0 : _pendingChanges$rowId5.cells) !== null && _pendingChanges$rowId3 !== void 0 ? _pendingChanges$rowId3 : {}).length;
19182
+ var _state$changes$errors, _state$changes$errors2, _state$changes$errors3;
19183
+ return !!((_state$changes$errors = state.changes.errors[rowId]) !== null && _state$changes$errors !== void 0 && _state$changes$errors.row) || !!Object.keys((_state$changes$errors2 = (_state$changes$errors3 = state.changes.errors[rowId]) === null || _state$changes$errors3 === void 0 ? void 0 : _state$changes$errors3.cells) !== null && _state$changes$errors2 !== void 0 ? _state$changes$errors2 : {}).length;
18681
19184
  }
18682
- function hasRowErrorsSeen(rowId) {
18683
- var _pendingChanges$rowId6;
18684
- if (!isEnabled) {
19185
+ function hasRowErrorsShownInAlert(rowId) {
19186
+ var _state$changes$errors4;
19187
+ return hasRowErrors(rowId) && !!((_state$changes$errors4 = state.changes.errors[rowId]) !== null && _state$changes$errors4 !== void 0 && _state$changes$errors4.shouldShowErrorAlert);
19188
+ }
19189
+ function hasTemporaryRowErrors() {
19190
+ var _state$temporaryRows, _state$changes$errors5, _state$changes$errors6, _state$changes$errors7;
19191
+ const newRow = (_state$temporaryRows = state.temporaryRows) === null || _state$temporaryRows === void 0 ? void 0 : _state$temporaryRows[0];
19192
+ if (!newRow) {
18685
19193
  return false;
18686
19194
  }
18687
- return hasRowErrors(rowId) && !!((_pendingChanges$rowId6 = pendingChanges[rowId]._meta.errors) !== null && _pendingChanges$rowId6 !== void 0 && _pendingChanges$rowId6.shouldShowErrorAlert);
19195
+ const rowId = newRow[rowIdentityAccessor];
19196
+ return !!((_state$changes$errors5 = state.changes.errors[rowId]) !== null && _state$changes$errors5 !== void 0 && _state$changes$errors5.row) || !!Object.keys((_state$changes$errors6 = (_state$changes$errors7 = state.changes.errors[rowId]) === null || _state$changes$errors7 === void 0 ? void 0 : _state$changes$errors7.cells) !== null && _state$changes$errors6 !== void 0 ? _state$changes$errors6 : {}).length;
18688
19197
  }
18689
- function getRowPendingChange(rowId) {
18690
- const rowPendingChanges = pendingChanges[rowId];
18691
- if (rowPendingChanges) {
18692
- const {
18693
- _meta,
18694
- ...pendingChange
18695
- } = rowPendingChanges;
18696
- return pendingChange;
18697
- }
18698
- return undefined;
19198
+ function getRowStatus(rowId) {
19199
+ return state.changes.status[rowId];
18699
19200
  }
18700
- function getRowSaveStatus(rowId) {
18701
- if (!isEnabled) {
18702
- return false;
18703
- }
18704
- return saveStates[rowId];
19201
+ function setRowStatus(rowId, status) {
19202
+ dispatch({
19203
+ type: 'setRowStatus',
19204
+ rowId,
19205
+ payload: {
19206
+ status
19207
+ }
19208
+ });
18705
19209
  }
18706
- function setRowSaveStatus(rowId, status) {
18707
- setSaveState(currentStates => {
18708
- const nextStates = {
18709
- ...currentStates
18710
- };
18711
- if (status) {
18712
- nextStates[rowId] = status;
18713
- } else {
18714
- delete nextStates[rowId];
19210
+ function insertTemporaryRow(data) {
19211
+ const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid.v4()}`;
19212
+ const value = {
19213
+ ...data,
19214
+ [rowIdentityAccessor]: newRowId
19215
+ };
19216
+ dispatch({
19217
+ type: 'insertTemporaryRow',
19218
+ rowId: newRowId,
19219
+ payload: {
19220
+ value
18715
19221
  }
18716
- return nextStates;
18717
19222
  });
19223
+ return newRowId;
19224
+ }
19225
+ // cells
19226
+ function setCellValue(cell, value) {
19227
+ const rowId = cell.row.id;
19228
+ const columnId = cell.column.id;
19229
+ // update if the change is different to the original value
19230
+ if (value !== cell.row.original[columnId]) {
19231
+ dispatch({
19232
+ type: 'setCellValue',
19233
+ rowId,
19234
+ payload: {
19235
+ columnId,
19236
+ row: cell.row.original,
19237
+ value
19238
+ }
19239
+ });
19240
+ }
19241
+ // otherwise remove any previous change - no point saving the same value
19242
+ else if (cell.row.id in state.changes.rows) {
19243
+ dispatch({
19244
+ type: 'removeCellValue',
19245
+ rowId,
19246
+ payload: {
19247
+ columnId,
19248
+ rowIdentityAccessor
19249
+ }
19250
+ });
19251
+ }
18718
19252
  }
18719
- function getRowMoveReason(rowId) {
18720
- var _pendingChanges$rowId7;
18721
- return (_pendingChanges$rowId7 = pendingChanges[rowId]) !== null && _pendingChanges$rowId7 !== void 0 && _pendingChanges$rowId7._meta.moveReason ? Object.values(pendingChanges[rowId]._meta.moveReason)[0] : undefined;
19253
+ function getCellValue(cell) {
19254
+ var _state$changes$rows2, _state$changes$rows2$;
19255
+ return (_state$changes$rows2 = state.changes.rows) === null || _state$changes$rows2 === void 0 ? void 0 : (_state$changes$rows2$ = _state$changes$rows2[cell.row.id]) === null || _state$changes$rows2$ === void 0 ? void 0 : _state$changes$rows2$[cell.column.id];
18722
19256
  }
18723
- function hasChanges(rowId) {
18724
- if (!isEnabled) {
18725
- return false;
18726
- }
18727
- return rowId ? !!pendingChanges[rowId] : !!Object.keys(pendingChanges).length;
19257
+ function getCellError(cell) {
19258
+ var _state$changes$errors8, _state$changes$errors9, _state$changes$errors10;
19259
+ return (_state$changes$errors8 = state.changes.errors) === null || _state$changes$errors8 === void 0 ? void 0 : (_state$changes$errors9 = _state$changes$errors8[cell.row.id]) === null || _state$changes$errors9 === void 0 ? void 0 : (_state$changes$errors10 = _state$changes$errors9.cells) === null || _state$changes$errors10 === void 0 ? void 0 : _state$changes$errors10[cell.column.id];
18728
19260
  }
18729
- function hasAlertErrors() {
18730
- if (!isEnabled) {
18731
- return false;
19261
+ function getErrorsShownInAlert() {
19262
+ const rowsWithErrors = Object.keys(state.changes.errors);
19263
+ if (!rowsWithErrors.length) {
19264
+ return [];
18732
19265
  }
18733
- return !!getAlertErrors().length;
18734
- }
18735
- function getAlertErrors() {
18736
- return Object.keys(pendingChanges).filter(hasRowErrorsSeen).map(rowId => ({
19266
+ return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
18737
19267
  rowId,
18738
- pendingChange: pendingChanges[rowId]
19268
+ changes: state.changes.rows[rowId],
19269
+ errors: state.changes.errors[rowId]
18739
19270
  }));
18740
19271
  }
18741
- function resetChanges(rowId) {
18742
- setPendingChanges(currentChanges => {
18743
- const nextChanges = {
18744
- ...currentChanges
18745
- };
18746
- delete nextChanges[rowId];
18747
- return nextChanges;
18748
- });
19272
+ function hasSaved() {
19273
+ return !!Object.values(state.changes.status).filter(value => value === 'saved').length;
18749
19274
  }
18750
- function getCompletedRowsCount() {
18751
- return Object.values(saveStates).filter(value => value === 'complete').length;
19275
+ function hasChanges(rowId) {
19276
+ return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
19277
+ }
19278
+ function discardChanges(rowId, table) {
19279
+ // remove any new rows from pinned state before discarding them
19280
+ table.resetRowPinning(true);
19281
+ dispatch({
19282
+ type: 'removeRow',
19283
+ rowId,
19284
+ payload: {
19285
+ rowIdentityAccessor
19286
+ }
19287
+ });
18752
19288
  }
18753
19289
  return {
19290
+ // row
19291
+ setRowValue,
19292
+ getRowValue,
19293
+ getRowMoveReason,
19294
+ hasRowErrors,
19295
+ hasRowErrorsShownInAlert,
19296
+ hasTemporaryRowErrors,
19297
+ getRowStatus,
19298
+ setRowStatus,
19299
+ // cells
19300
+ setCellValue,
18754
19301
  getCellValue,
18755
19302
  getCellError,
18756
- setCellValue,
18757
- validateCell,
18758
- addCreatedRowChangeset,
19303
+ onCellChanged,
19304
+ // general
19305
+ getErrorsShownInAlert,
18759
19306
  hasChanges,
18760
- hasAlertErrors,
18761
- getAlertErrors,
18762
19307
  saveChanges,
18763
- resetChanges,
18764
- hasRowErrors,
18765
- hasRowErrorsSeen,
18766
- getRowPendingChange,
18767
- getRowSaveStatus,
18768
- setRowSaveStatus,
18769
- getRowMoveReason,
18770
- getCompletedRowsCount
19308
+ discardChanges,
19309
+ hasSaved,
19310
+ // new rows
19311
+ insertTemporaryRow,
19312
+ temporaryRows: state.temporaryRows
18771
19313
  };
18772
19314
  }
18773
- function useLastFocusedCellIndex() {
18774
- // store the last focused cell, so that up/down arrow key navigation remains in the same column
18775
- const lastFocusedCellIndexRef = React__default.useRef(undefined);
18776
- const setLastFocusedCellIndex = React__default.useCallback(index => {
18777
- lastFocusedCellIndexRef.current = index;
18778
- }, []);
18779
- return [lastFocusedCellIndexRef.current, setLastFocusedCellIndex];
18780
- }
18781
- function usePendingChangesUpdater(handleChange, setPendingChanges) {
18782
- const localization = useLocalization();
18783
- const updatersRef = React__default.useRef({});
18784
- const runCellUpdates = React__default.useCallback(lodash.debounce(function (changes, cell, rowIndex) {
19315
+
19316
+ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCreate, rowIdentityAccessor, validator) {
19317
+ const createRow = function (table, scrollToIndex, row) {
18785
19318
  try {
18786
- const _temp4 = function () {
18787
- if (typeof handleChange === 'function') {
18788
- const previousValues = {
18789
- ...cell.row.original,
18790
- ...getChangesetFromChanges(updatersRef.current[cell.row.id])
18791
- };
18792
- const nextValues = {
18793
- ...previousValues,
18794
- ...changes
18795
- };
18796
- return Promise.resolve(handleChange(cell.column.id, changes[cell.column.id], nextValues, previousValues)).then(function (updates) {
18797
- if (updates && Object.keys(updates).length) {
18798
- setPendingChanges(currentChanges => createPendingChangesSetter(currentChanges, cell.row, rowIndex, updates, localization));
19319
+ let _exit = false;
19320
+ function _temp2(_result) {
19321
+ if (_exit) return _result;
19322
+ const changeset = row !== null && row !== void 0 ? row : handleCreate();
19323
+ try {
19324
+ if (changeset) {
19325
+ const newRowId = pendingChangesFns.insertTemporaryRow(changeset);
19326
+ // reset before changing row otherwise the cell changes and validation might run
19327
+ setLastFocusedCellIndex(undefined);
19328
+ // set the active row to the new row before toggling editing on
19329
+ const temporaryRows = tableMeta.editing.temporaryRows;
19330
+ const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
19331
+ tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
19332
+ // wait until set states have run
19333
+ requestAnimationFrame(() => {
19334
+ toggleEditing(true, table, scrollToIndex, false);
19335
+ setTimeout(() => {
19336
+ requestAnimationFrame(() => table.getRow(newRowId).pin('bottom'));
19337
+ }, 250);
19338
+ });
19339
+ }
19340
+ } catch (error) {
19341
+ console.error(error);
19342
+ }
19343
+ }
19344
+ if (!handleCreate) {
19345
+ return Promise.resolve();
19346
+ }
19347
+ const tableMeta = table.options.meta;
19348
+ const _temp = function () {
19349
+ if (tableMeta.rowActive.rowActiveIndex !== undefined) {
19350
+ var _table$getRowModel$ro2;
19351
+ return Promise.resolve(tableMeta.editing.saveChanges(table, (_table$getRowModel$ro2 = table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex]) === null || _table$getRowModel$ro2 === void 0 ? void 0 : _table$getRowModel$ro2.id)).then(function (saved) {
19352
+ if (!saved) {
19353
+ _exit = true;
18799
19354
  }
18800
19355
  });
18801
19356
  }
18802
19357
  }();
18803
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
19358
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
18804
19359
  } catch (e) {
18805
19360
  return Promise.reject(e);
18806
19361
  }
18807
- }, 250), []);
18808
- function syncCellChanges(changes) {
18809
- updatersRef.current = changes;
18810
- }
18811
- return {
18812
- syncCellChanges,
18813
- runCellUpdates
18814
- };
18815
- }
18816
- function createPendingChangesSetter(currentChanges, row, rowIndex, changes, localization) {
18817
- var _currentChanges$row$i, _currentChanges$row$i2, _currentChanges$row$i3;
18818
- // prepare
18819
- const nextChanges = {
18820
- ...currentChanges
18821
- };
18822
- const rowChanges = {
18823
- ...currentChanges[row.id],
18824
- _meta: {
18825
- ...((_currentChanges$row$i = currentChanges[row.id]) === null || _currentChanges$row$i === void 0 ? void 0 : _currentChanges$row$i._meta),
18826
- original: row.original,
18827
- moveReason: {
18828
- ...((_currentChanges$row$i2 = currentChanges[row.id]) === null || _currentChanges$row$i2 === void 0 ? void 0 : _currentChanges$row$i2._meta.moveReason)
18829
- },
18830
- errors: {
18831
- ...((_currentChanges$row$i3 = currentChanges[row.id]) === null || _currentChanges$row$i3 === void 0 ? void 0 : _currentChanges$row$i3._meta.errors)
18832
- }
18833
- }
18834
19362
  };
18835
- // run changes
18836
- const cells = row._getAllCellsByColumnId();
18837
- for (const [accessor, change] of Object.entries(changes)) {
18838
- // update if the change is different to the original (saved) value,
18839
- // otherwise remove any change - no point saving the same value
18840
- if (change !== row.original[accessor]) {
18841
- rowChanges[accessor] = change;
18842
- // consumers sometimes include properties in onEditingChange that aren't rendered as columns, we need to guard against that.
18843
- // eslint-disable-next-line no-prototype-builtins
18844
- if (cells.hasOwnProperty(accessor)) {
18845
- // determine if the row will move position based on this change, and save why it will move
18846
- const reason = willRowMove(cells[accessor], change, rowIndex, localization);
18847
- if (reason) {
18848
- rowChanges._meta.moveReason[accessor] = reason;
18849
- } else {
18850
- delete rowChanges._meta.moveReason[accessor];
18851
- }
19363
+ // used to switch the table into editing mode
19364
+ const [isEditing, setEditing] = React__default.useState(false);
19365
+ // used to switch the editing between "detailed" mode
19366
+ const [isDetailedMode, toggleDetailedMode] = React__default.useState(false);
19367
+ // used to contain ref to the create button
19368
+ const createRowButtonRef = React__default.useRef(null);
19369
+ // store the last focused cell, so that up/down arrow key navigation remains in the same column
19370
+ const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
19371
+ const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
19372
+ function toggleEditing(enabled, table, scrollToIndex, doSave = true) {
19373
+ const tableMeta = table.options.meta;
19374
+ if (enabled) {
19375
+ var _tableMeta$rowActive$, _table$getRowModel$ro;
19376
+ const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
19377
+ if (tableMeta.rowActive.rowActiveIndex === undefined) {
19378
+ tableMeta.rowActive.setRowActiveIndex(index);
18852
19379
  }
18853
- } else {
18854
- delete rowChanges[accessor];
18855
- delete rowChanges._meta.moveReason[accessor];
19380
+ if (!isTemporaryRow((_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id)) {
19381
+ scrollToIndex(index);
19382
+ }
19383
+ } else if (!enabled) {
19384
+ // reset detailed mode
19385
+ toggleDetailedMode(false);
19386
+ // reset the last index back to the first focusable element, when editing gets turned off
19387
+ setLastFocusedCellIndex(undefined);
19388
+ }
19389
+ setEditing(enabled);
19390
+ if (doSave) {
19391
+ pendingChangesFns.saveChanges(table);
18856
19392
  }
18857
19393
  }
18858
- // set changes
18859
- // or delete if there are no changes left, so that we don't store changes with unchanged data
18860
- if (Object.keys(rowChanges).filter(k => k !== '_meta').length) {
18861
- nextChanges[row.id] = rowChanges;
18862
- } else {
18863
- delete nextChanges[row.id];
18864
- }
18865
- return nextChanges;
18866
- }
18867
- function getChangesetFromChanges(changes) {
18868
- // extract the original data from the row changes
18869
- const {
18870
- _meta,
18871
- ...changeset
18872
- } = changes !== null && changes !== void 0 ? changes : {};
18873
- // and mix them in with the changes, ready to send to the server
18874
19394
  return {
18875
- ...(_meta === null || _meta === void 0 ? void 0 : _meta.original),
18876
- ...changeset
19395
+ isEnabled,
19396
+ isEditing,
19397
+ isDetailedMode,
19398
+ toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,
19399
+ toggleEditing: isEnabled ? toggleEditing : () => undefined,
19400
+ lastFocusedCellIndex,
19401
+ setLastFocusedCellIndex,
19402
+ createRow,
19403
+ createRowButtonRef,
19404
+ ...pendingChangesFns
18877
19405
  };
18878
19406
  }
18879
19407
 
@@ -18917,7 +19445,6 @@ function RowMoveIndicator(props) {
18917
19445
  if (!show) {
18918
19446
  return null;
18919
19447
  }
18920
- const className = 'wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap rounded-b-md px-1 py-1 text-xs font-bold z-10';
18921
19448
  const {
18922
19449
  title,
18923
19450
  description
@@ -18926,7 +19453,7 @@ function RowMoveIndicator(props) {
18926
19453
  placement: "bottom",
18927
19454
  title: description.replace('[COLUMN]', columnMeta.header)
18928
19455
  }, /*#__PURE__*/React__default.createElement("span", {
18929
- className: className
19456
+ "data-row-move-indicator": true
18930
19457
  }, /*#__PURE__*/React__default.createElement(Icon, {
18931
19458
  name: "info",
18932
19459
  className: "-mt-0.5 mr-1 !h-4 !w-4 rounded-full bg-white !p-0 text-blue-500"
@@ -19115,20 +19642,44 @@ function EditingControlCell(props) {
19115
19642
  const {
19116
19643
  rowIndex
19117
19644
  } = React__default.useContext(RowContext);
19118
- const tableMeta = cell.getContext().table.options.meta;
19645
+ const {
19646
+ table
19647
+ } = cell.getContext();
19648
+ const tableMeta = table.options.meta;
19119
19649
  const columnMeta = cell.column.columnDef.meta;
19120
19650
  const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
19651
+ const type = (_columnMeta$control = columnMeta.control) !== null && _columnMeta$control !== void 0 ? _columnMeta$control : 'input';
19121
19652
  const handleFocus = useEditingCellAutofocus(props);
19122
- const handleBlur = () => {
19653
+ const value = cell.getValue();
19654
+ // some controls, like select2, should trigger cell changed (validation, updates) as the value changes
19655
+ const hasNonTextControl = React__default.useMemo(() => {
19656
+ var _cellRef$current;
19657
+ 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"]'));
19658
+ }, [cellRef.current]);
19659
+ const handleChange = React__default.useCallback(nextValue => {
19660
+ if (nextValue !== value) {
19661
+ tableMeta.editing.setCellValue(cell, nextValue);
19662
+ if (hasNonTextControl) {
19663
+ requestAnimationFrame(() => tableMeta.editing.onCellChanged(cell, rowIndex, nextValue));
19664
+ }
19665
+ }
19666
+ }, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]);
19667
+ const blur = React__default.useCallback(function blur() {
19123
19668
  tableMeta.editing.toggleDetailedMode(false);
19124
- tableMeta.editing.validateCell(cell);
19125
- };
19669
+ tableMeta.editing.onCellChanged(cell, rowIndex, undefined, !hasNonTextControl);
19670
+ }, [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]);
19671
+ const handleBlur = React__default.useCallback(event => {
19672
+ if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
19673
+ return;
19674
+ }
19675
+ blur();
19676
+ }, [blur]);
19126
19677
  // ensure that blur runs when the cell gets unmounted (when vertically arrow key navigating)
19127
19678
  React__default.useEffect(() => {
19128
19679
  const ref = cellRef.current;
19129
19680
  return () => {
19130
19681
  if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
19131
- handleBlur();
19682
+ blur();
19132
19683
  }
19133
19684
  };
19134
19685
  }, []);
@@ -19141,14 +19692,13 @@ function EditingControlCell(props) {
19141
19692
  isDetailedMode: tableMeta.editing.isDetailedMode,
19142
19693
  isTruncated: !!columnMeta.enableTruncate,
19143
19694
  onBlur: handleBlur,
19144
- onChange: value => tableMeta.editing.setCellValue(cell, value, rowIndex),
19695
+ onChange: handleChange,
19145
19696
  row: cell.row.original,
19146
- rowPendingChanges: tableMeta.editing.getRowPendingChange(cell.row.id),
19697
+ rowPendingChanges: tableMeta.editing.getRowValue(cell.row.id),
19147
19698
  tabIndex: isActiveRow ? 0 : -1,
19148
- toggleEditing: tableMeta.editing.toggleEditing,
19149
19699
  toggleDetailedMode: tableMeta.editing.toggleDetailedMode,
19150
- type: (_columnMeta$control = columnMeta.control) !== null && _columnMeta$control !== void 0 ? _columnMeta$control : 'input',
19151
- value: cell.getValue()
19700
+ type,
19701
+ value
19152
19702
  };
19153
19703
  const cellAttributes = {
19154
19704
  ...getCellAttributes(cell, index, isHighlighted),
@@ -19180,7 +19730,6 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
19180
19730
  row,
19181
19731
  rowPendingChanges,
19182
19732
  tabIndex = -1,
19183
- toggleEditing,
19184
19733
  toggleDetailedMode,
19185
19734
  type = 'input',
19186
19735
  value
@@ -19211,6 +19760,13 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
19211
19760
  ref: controlRef
19212
19761
  }));
19213
19762
  }
19763
+ if (type === 'checkbox') {
19764
+ return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, commonProps, {
19765
+ checked: Boolean(value),
19766
+ onChange: onChange,
19767
+ ref: controlRef
19768
+ }));
19769
+ }
19214
19770
  const handleInputKeyDown = event => {
19215
19771
  const target = event.target;
19216
19772
  if (target.readOnly) {
@@ -19239,8 +19795,8 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
19239
19795
  }
19240
19796
  // reset the value, or exit edit mode when pressing escape
19241
19797
  if (event.key === 'Escape') {
19242
- event.preventDefault();
19243
19798
  if (isDetailedMode) {
19799
+ event.preventDefault();
19244
19800
  toggleDetailedMode(false);
19245
19801
  if (value !== currentValue) {
19246
19802
  props.onChange(currentValue);
@@ -19250,8 +19806,6 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
19250
19806
  var _target$select2;
19251
19807
  return (_target$select2 = target.select) === null || _target$select2 === void 0 ? void 0 : _target$select2.call(target);
19252
19808
  });
19253
- } else {
19254
- toggleEditing(false);
19255
19809
  }
19256
19810
  return;
19257
19811
  }
@@ -19350,12 +19904,37 @@ function Cell$5(props) {
19350
19904
  return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props));
19351
19905
  }
19352
19906
 
19353
- function EditingActionMenu(props) {
19907
+ function DiscardChangesConfirmationDialog(props) {
19908
+ const {
19909
+ onDiscard: handleDiscard,
19910
+ ...dialogProps
19911
+ } = props;
19912
+ const {
19913
+ texts
19914
+ } = useLocalization();
19915
+ const handleClickInsideDialogContent = event => {
19916
+ // Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs
19917
+ // inside the dialog
19918
+ event.stopPropagation();
19919
+ };
19920
+ return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps), /*#__PURE__*/React__default.createElement(Dialog.Content, {
19921
+ "aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
19922
+ onClick: handleClickInsideDialogContent
19923
+ }, /*#__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, {
19924
+ tabIndex: 0
19925
+ }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
19926
+ autoFocus: true,
19927
+ tabIndex: 0,
19928
+ appearance: "primary",
19929
+ onClick: handleDiscard
19930
+ }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
19931
+ }
19932
+
19933
+ function EditingActionsMenu(props) {
19354
19934
  const {
19355
19935
  hasChanges,
19356
19936
  hasErrors,
19357
- onClear: handleClear,
19358
- onExit: handleExit,
19937
+ onDiscard: handleDiscard,
19359
19938
  onEditingSave: handleSave,
19360
19939
  isLastRow
19361
19940
  } = props;
@@ -19377,7 +19956,6 @@ function EditingActionMenu(props) {
19377
19956
  return /*#__PURE__*/React__default.createElement(IconButton, {
19378
19957
  appearance: "transparent",
19379
19958
  "aria-label": texts.table3.editing.actions.tooltip,
19380
- className: "group-[[data-row-editing-status]]/row:hidden",
19381
19959
  icon: "more",
19382
19960
  onKeyDown: handleKeyDown,
19383
19961
  menu: menuProps => (/*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
@@ -19389,42 +19967,13 @@ function EditingActionMenu(props) {
19389
19967
  }, texts.table3.editing.actions.save), /*#__PURE__*/React__default.createElement(Menu$1.Item, {
19390
19968
  icon: "close",
19391
19969
  disabled: !hasChanges,
19392
- dialog: props => /*#__PURE__*/React__default.createElement(ConfirmClearChangesDialog, Object.assign({}, props, {
19393
- onClear: handleClear
19970
+ dialog: props => /*#__PURE__*/React__default.createElement(DiscardChangesConfirmationDialog, Object.assign({}, props, {
19971
+ onDiscard: handleDiscard
19394
19972
  }))
19395
- }, texts.table3.editing.actions.clear), /*#__PURE__*/React__default.createElement(Menu$1.Item, {
19396
- icon: "undo",
19397
- onClick: handleExit
19398
- }, texts.table3.editing.actions.exit))))
19973
+ }, texts.table3.editing.actions.clear))))
19399
19974
  });
19400
19975
  }
19401
- function ConfirmClearChangesDialog(props) {
19402
- const {
19403
- onClear: handleClear,
19404
- ...dialogProps
19405
- } = props;
19406
- const {
19407
- texts
19408
- } = useLocalization();
19409
- const handleClickInsideDialogContent = event => {
19410
- // Prevents the click event from propagating to the table, ensuring the row isn't saved when a click occurs
19411
- // inside the dialog
19412
- event.stopPropagation();
19413
- };
19414
- return /*#__PURE__*/React__default.createElement(Dialog, Object.assign({}, dialogProps), /*#__PURE__*/React__default.createElement(Dialog.Content, {
19415
- "aria-label": texts.table3.editing.clearChangesConfirmationDialog.title,
19416
- onClick: handleClickInsideDialogContent
19417
- }, /*#__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, {
19418
- tabIndex: 0
19419
- }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /*#__PURE__*/React__default.createElement(Dialog.Close, null, /*#__PURE__*/React__default.createElement(Button$1, {
19420
- autoFocus: true,
19421
- tabIndex: 0,
19422
- appearance: "primary",
19423
- onClick: handleClear
19424
- }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))));
19425
- }
19426
19976
 
19427
- const COMPLETE_INDICATOR_DELAY = 3000;
19428
19977
  function SaveStatus(props) {
19429
19978
  const {
19430
19979
  rowId,
@@ -19434,18 +19983,7 @@ function SaveStatus(props) {
19434
19983
  texts
19435
19984
  } = useLocalization();
19436
19985
  const tableMeta = table.options.meta;
19437
- const status = tableMeta.editing.getRowSaveStatus(rowId);
19438
- React__default.useEffect(() => {
19439
- let timeout;
19440
- if (status === 'complete') {
19441
- timeout = setTimeout(() => {
19442
- tableMeta.editing.setRowSaveStatus(rowId, undefined);
19443
- }, COMPLETE_INDICATOR_DELAY);
19444
- }
19445
- return () => {
19446
- clearTimeout(timeout);
19447
- };
19448
- }, [status]);
19986
+ const status = tableMeta.editing.getRowStatus(rowId);
19449
19987
  const className = cn('col-span-full sticky ml-auto right-0 top-0 -mb-[100%] z-10 h-8 bg-[inherit] flex items-center px-1.5 shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]', {
19450
19988
  'mt-0.5': tableMeta.rowHeight.height === 'short',
19451
19989
  'mt-1': tableMeta.rowHeight.height === 'medium',
@@ -19456,7 +19994,7 @@ function SaveStatus(props) {
19456
19994
  className: "!contents"
19457
19995
  }, /*#__PURE__*/React__default.createElement("span", {
19458
19996
  className: className
19459
- }, status === 'pending' ? (/*#__PURE__*/React__default.createElement(Tooltip, {
19997
+ }, status === 'saving' ? (/*#__PURE__*/React__default.createElement(Tooltip, {
19460
19998
  title: texts.table3.editing.saving.progress
19461
19999
  }, /*#__PURE__*/React__default.createElement(Spinner, {
19462
20000
  delay: 0,
@@ -19497,15 +20035,46 @@ function Row$2(props) {
19497
20035
  }
19498
20036
  }
19499
20037
  }, [tableMeta.editing.isEditing, isActiveRow]);
20038
+ const rowStatus = tableMeta.editing.getRowStatus(row.id);
20039
+ // discard new row
20040
+ const [showDiscardDialog, setShowDiscardDialog] = React__default.useState(false);
20041
+ function handleDiscard() {
20042
+ tableMeta.editing.discardChanges(row.id, table);
20043
+ requestAnimationFrame(() => {
20044
+ if (isTemporaryRow(row.id)) {
20045
+ var _tableMeta$editing$cr;
20046
+ (_tableMeta$editing$cr = tableMeta.editing.createRowButtonRef.current) === null || _tableMeta$editing$cr === void 0 ? void 0 : _tableMeta$editing$cr.focus();
20047
+ } else {
20048
+ focusManager.focusFirst();
20049
+ }
20050
+ });
20051
+ }
20052
+ function handleKeyDown(event) {
20053
+ if (props.onKeyDown) {
20054
+ props.onKeyDown(event);
20055
+ }
20056
+ if (event.isDefaultPrevented() || event.isPropagationStopped()) {
20057
+ return;
20058
+ }
20059
+ if (event.key === 'Escape' && tableMeta.editing.hasChanges(row.id) && !isElementTriggeredFromContainer(event.target, event.currentTarget)) {
20060
+ event.preventDefault();
20061
+ setShowDiscardDialog(true);
20062
+ }
20063
+ }
19500
20064
  const attributes = {
19501
- 'data-row-editing-invalid': tableMeta.editing.isEnabled && tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsSeen(row.id) ? 'unseen' : true : undefined,
19502
- 'data-row-editing-status': tableMeta.editing.isEnabled && tableMeta.editing.getRowSaveStatus(row.id) ? tableMeta.editing.getRowSaveStatus(row.id) : undefined,
19503
- onFocus: handleFocus
20065
+ 'data-row-editing-invalid': tableMeta.editing.hasRowErrors(row.id) ? !tableMeta.editing.hasRowErrorsShownInAlert(row.id) ? 'unseen' : true : undefined,
20066
+ 'data-row-editing-status': rowStatus,
20067
+ onFocus: handleFocus,
20068
+ onKeyDown: handleKeyDown
19504
20069
  };
19505
- return /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes), tableMeta.editing.getRowSaveStatus(row.id) ? /*#__PURE__*/React__default.createElement(SaveStatus, {
20070
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(DisplayRow, Object.assign({}, props, attributes), rowStatus === 'saving' || rowStatus === 'saved' ? /*#__PURE__*/React__default.createElement(SaveStatus, {
19506
20071
  rowId: row.id,
19507
20072
  table: table
19508
- }) : null);
20073
+ }) : null), /*#__PURE__*/React__default.createElement(DiscardChangesConfirmationDialog, {
20074
+ open: showDiscardDialog,
20075
+ onChange: setShowDiscardDialog,
20076
+ onDiscard: handleDiscard
20077
+ }));
19509
20078
  }
19510
20079
 
19511
20080
  const RENDERERS$1 = {
@@ -19513,29 +20082,61 @@ const RENDERERS$1 = {
19513
20082
  cell: Cell$5
19514
20083
  };
19515
20084
  function useTable3(props, ref) {
19516
- const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.validator);
20085
+ const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.onEditingCreate, props.rowIdentityAccessor, props.validator);
19517
20086
  const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
20087
+ // this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
20088
+ const data = React__default.useMemo(() => {
20089
+ if (editing.temporaryRows.length) {
20090
+ var _props$data;
20091
+ return ((_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : []).concat(editing.temporaryRows);
20092
+ }
20093
+ return props.data;
20094
+ }, [JSON.stringify(props.data), editing.temporaryRows.length]);
19518
20095
  const extendedProps = {
19519
20096
  ...props,
20097
+ data,
19520
20098
  enableRowActions: editing.isEditing ? true : props.enableRowActions,
19521
- rowActions: editing.isEditing ? [(_, rowId) => (/*#__PURE__*/React__default.createElement(EditingActionMenu, {
19522
- hasChanges: editing.hasChanges(rowId),
19523
- hasErrors: editing.hasRowErrors(rowId),
19524
- onClear: () => editing.resetChanges(rowId),
19525
- onEditingSave: () => editing.saveChanges(rowId),
19526
- onExit: () => editing.toggleEditing(false),
19527
- isLastRow: !creationEnabled && table.meta.rowActive.rowActiveIndex === table.meta.length - 1
19528
- }))] : props.rowActions
20099
+ // Display EditingActionMenu instead of row actions while editing
20100
+ rowActions: editing.isEditing ? [(_, rowId, table) => {
20101
+ const tableMeta = table.options.meta;
20102
+ return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
20103
+ hasChanges: editing.hasChanges(rowId),
20104
+ hasErrors: editing.hasRowErrors(rowId),
20105
+ onDiscard: () => {
20106
+ editing.discardChanges(rowId, table);
20107
+ if (editing.temporaryRows.length) {
20108
+ requestAnimationFrame(() => {
20109
+ var _editing$createRowBut;
20110
+ return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
20111
+ });
20112
+ }
20113
+ },
20114
+ onEditingSave: function () {
20115
+ try {
20116
+ return Promise.resolve(editing.saveChanges(table, rowId)).then(function () {});
20117
+ } catch (e) {
20118
+ return Promise.reject(e);
20119
+ }
20120
+ },
20121
+ isLastRow: !creationEnabled && tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1
20122
+ });
20123
+ }] : props.rowActions
19529
20124
  };
19530
20125
  const meta = {
19531
20126
  editing
19532
20127
  };
19533
- const table = useTable(extendedProps, ref, RENDERERS$1, meta);
20128
+ const options = {
20129
+ virtualiserPaddingEndOffset: props.enableEditing && props.onEditingCreate ? editing.hasTemporaryRowErrors() ? 1.4 : 1 : 0
20130
+ };
20131
+ const table = useTable(extendedProps, ref, RENDERERS$1, meta, options);
19534
20132
  // listeners
19535
- useTableEditingListener(table.instance, table.ref);
20133
+ useTableEditingListener(table.instance, table.ref, table.renderer.scrollToIndex);
19536
20134
  React__default.useEffect(() => {
19537
20135
  if (table.ref.current) {
19538
- table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing);
20136
+ table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance, table.renderer.scrollToIndex);
20137
+ if (props.onEditingCreate) {
20138
+ table.ref.current.instance.createRow = row => table.meta.editing.createRow(table.instance, table.renderer.scrollToIndex, row);
20139
+ }
19539
20140
  }
19540
20141
  }, [table.ref.current]);
19541
20142
  return table;
@@ -19554,7 +20155,7 @@ function Alert$1(props) {
19554
20155
  const validationTexts = texts.table3.editing.validation;
19555
20156
  const tableMeta = table.options.meta;
19556
20157
  const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
19557
- const pendingChangesWithErrors = tableMeta.editing.getAlertErrors();
20158
+ const pendingChangesWithErrors = tableMeta.editing.getErrorsShownInAlert();
19558
20159
  function scrollToRow(rowIndex) {
19559
20160
  tableMeta.rowActive.setRowActiveIndex(rowIndex);
19560
20161
  scrollToIndex(rowIndex, {
@@ -19573,38 +20174,45 @@ function Alert$1(props) {
19573
20174
  const title = (pendingChangesWithErrors.length === 1 ? validationTexts.alert.titleOne : validationTexts.alert.titlePlural).replace('[COUNT]', String(pendingChangesWithErrors.length));
19574
20175
  // generate links to each invalid row, to go into the error message
19575
20176
  const links = [];
19576
- const rowIdentityColumn = tableMeta.rowIdentityColumnId ? table.getColumn(tableMeta.rowIdentityColumnId) : undefined;
19577
- pendingChangesWithErrors.forEach((error, index) => {
20177
+ const visibleColumns = table.getVisibleFlatColumns().map(c => c.id);
20178
+ const rowIdentityColumn = tableMeta.rowIdentityAccessor && visibleColumns.includes(String(tableMeta.rowIdentityAccessor)) ?
20179
+ // table.getColumn(columName) throw error in strict dev mode. Related thread: https://github.com/TanStack/table/discussions/5505
20180
+ table.getAllColumns().find(x => x.id === String(tableMeta.rowIdentityAccessor)) : undefined;
20181
+ pendingChangesWithErrors.forEach((pendingChangeWithError, index) => {
19578
20182
  // if appropriate, concatenate the item with the text "and"
19579
20183
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
19580
20184
  // Add space before and after `messageAnd` text
19581
20185
  links.push(` ${validationTexts.alert.messageAnd} `);
19582
20186
  }
19583
- const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
20187
+ const rowIndex = table.getRowModel().rows.findIndex(row => row.id === pendingChangeWithError.rowId);
19584
20188
  const handleClick = () => {
20189
+ // if row is visible
19585
20190
  if (rowIndex > -1) {
19586
20191
  scrollToRow(rowIndex);
19587
- } else {
19588
- setShowFilterResetDialog(error.rowId);
20192
+ }
20193
+ // if row is filtered out
20194
+ else {
20195
+ setShowFilterResetDialog(pendingChangeWithError.rowId);
19589
20196
  }
19590
20197
  };
19591
20198
  let tooltip;
19592
- if (error.pendingChange._meta.errors.row) {
19593
- tooltip = error.pendingChange._meta.errors.row;
20199
+ if (pendingChangeWithError.errors.row) {
20200
+ tooltip = pendingChangeWithError.errors.row;
19594
20201
  } else {
19595
20202
  var _table$getAllColumns$, _table$getAllColumns$2;
19596
- const firstCellErrorColumnId = Object.keys(error.pendingChange._meta.errors.cells)[0];
20203
+ const firstCellErrorColumnId = Object.keys(pendingChangeWithError.errors.cells)[0];
19597
20204
  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;
19598
- tooltip = `${columnName}: ${error.pendingChange._meta.errors.cells[firstCellErrorColumnId]}`;
20205
+ tooltip = `${columnName}: ${pendingChangeWithError.errors.cells[firstCellErrorColumnId]}`;
19599
20206
  }
20207
+ const row = table.getRow(pendingChangeWithError.rowId).original;
19600
20208
  links.push(/*#__PURE__*/React__default.createElement(Tooltip, {
19601
- key: error.rowId,
20209
+ key: pendingChangeWithError.rowId,
19602
20210
  title: tooltip
19603
20211
  }, /*#__PURE__*/React__default.createElement("span", {
19604
20212
  className: "text-blue",
19605
20213
  onClick: handleClick,
19606
20214
  role: "button"
19607
- }, rowIdentityColumn ? error.pendingChange._meta.original[rowIdentityColumn.id] : rowIndex + 1)));
20215
+ }, rowIdentityColumn ? row[rowIdentityColumn.id] : rowIndex + 1)));
19608
20216
  // if appropriate, concatenate the item with the text ","
19609
20217
  if (pendingChangesWithErrors.length > 2 && index < pendingChangesWithErrors.length - 2) {
19610
20218
  links.push(', ');
@@ -19660,9 +20268,38 @@ function FilterResetDialog(props) {
19660
20268
  }, texts.table3.editing.validation.resetFiltersDialog.confirm)))));
19661
20269
  }
19662
20270
 
19663
- function CreateNewRowButton(props) {
20271
+ function Editing(props) {
20272
+ const {
20273
+ scrollToIndex,
20274
+ table
20275
+ } = props;
20276
+ const {
20277
+ texts
20278
+ } = useLocalization();
20279
+ const ref = React__default.useRef(null);
20280
+ const tableMeta = table.options.meta;
20281
+ const handleChange = enabled => {
20282
+ tableMeta.editing.toggleEditing(enabled, table, scrollToIndex);
20283
+ };
20284
+ const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
20285
+ className: "ml-2",
20286
+ keys: shortcut
20287
+ }));
20288
+ return /*#__PURE__*/React__default.createElement(Tooltip, {
20289
+ title: tooltip
20290
+ }, /*#__PURE__*/React__default.createElement(ModeSwitch, {
20291
+ "data-table": "editing-toggle",
20292
+ checked: tableMeta.editing.isEditing,
20293
+ onChange: handleChange,
20294
+ ref: ref
20295
+ }));
20296
+ }
20297
+
20298
+ function CreateNewRow(props) {
20299
+ var _temporaryRows$0$tabl, _temporaryRows$, _table$getState$colum;
19664
20300
  const {
19665
- onEditingCreate,
20301
+ buttonRef,
20302
+ isScrolled,
19666
20303
  scrollToIndex,
19667
20304
  table,
19668
20305
  tableMeta
@@ -19670,117 +20307,143 @@ function CreateNewRowButton(props) {
19670
20307
  const {
19671
20308
  texts
19672
20309
  } = useLocalization();
19673
- const rows = table.getCoreRowModel().rows.filter(row => row.original !== undefined);
19674
- const [rowCreated, setRowCreated] = React__default.useState({
19675
- rowFinder: undefined
19676
- });
19677
- const handleKeyDown = event => {
19678
- if (!tableMeta.editing.hasChanges() && event.key === 'Tab') {
19679
- tableMeta.editing.saveChanges();
19680
- }
19681
- };
20310
+ const temporaryRows = tableMeta.editing.temporaryRows;
20311
+ 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 : '';
20312
+ 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);
20313
+ const isSaving = !!temporaryRowId && tableMeta.editing.getRowStatus(temporaryRowId) === 'saving';
19682
20314
  const handleCreate = function () {
19683
20315
  try {
19684
- if (!onEditingCreate) {
20316
+ if (isDisabled) {
19685
20317
  return Promise.resolve();
19686
20318
  }
19687
- const createdRow = rows.find(row => {
19688
- var _rowCreated$rowFinder;
19689
- return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder = rowCreated.rowFinder) === null || _rowCreated$rowFinder === void 0 ? void 0 : _rowCreated$rowFinder.call(rowCreated, row.original);
19690
- });
19691
- const _temp = function () {
19692
- if (createdRow) {
19693
- return Promise.resolve(tableMeta.editing.saveChanges()).then(function () {
19694
- if (!tableMeta.editing.hasRowErrors(createdRow.id)) {
19695
- const rowFinder = onEditingCreate();
19696
- setRowCreated({
19697
- rowFinder
19698
- });
19699
- }
19700
- });
19701
- } else {
19702
- const rowFinder = onEditingCreate();
19703
- setRowCreated({
19704
- rowFinder
19705
- });
19706
- }
19707
- }();
19708
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
20319
+ return Promise.resolve(tableMeta.editing.createRow(table, scrollToIndex)).then(function () {});
19709
20320
  } catch (e) {
19710
20321
  return Promise.reject(e);
19711
20322
  }
19712
20323
  };
19713
- React__default.useEffect(() => {
19714
- if (typeof (rowCreated === null || rowCreated === void 0 ? void 0 : rowCreated.rowFinder) === 'function') {
19715
- const createdRow = rows.find(row => {
19716
- var _rowCreated$rowFinder2;
19717
- return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder2 = rowCreated.rowFinder) === null || _rowCreated$rowFinder2 === void 0 ? void 0 : _rowCreated$rowFinder2.call(rowCreated, row.original);
19718
- });
19719
- if (createdRow) {
19720
- const rowInTable = table.getRowModel().rows.filter(row => row.original !== undefined).find(row => {
19721
- var _rowCreated$rowFinder3;
19722
- return rowCreated === null || rowCreated === void 0 ? void 0 : (_rowCreated$rowFinder3 = rowCreated.rowFinder) === null || _rowCreated$rowFinder3 === void 0 ? void 0 : _rowCreated$rowFinder3.call(rowCreated, row.original);
19723
- });
19724
- if (rowInTable) {
19725
- tableMeta.editing.toggleEditing(true);
19726
- tableMeta.rowActive.setRowActiveIndex(createdRow.index);
19727
- scrollToIndex(createdRow.index);
19728
- requestAnimationFrame(() => animateCreateRow(createdRow.id));
19729
- }
19730
- requestAnimationFrame(() => tableMeta.editing.addCreatedRowChangeset(createdRow));
19731
- }
19732
- }
19733
- }, [rowCreated]);
20324
+ const shortcut = {
20325
+ key: 'Enter',
20326
+ meta: true
20327
+ };
20328
+ let tooltip;
20329
+ if (isSaving) {
20330
+ tooltip = texts.table3.editing.buttons.create.saving;
20331
+ } else if (isDisabled) {
20332
+ tooltip = texts.table3.editing.buttons.create.disabled;
20333
+ } else {
20334
+ tooltip = /*#__PURE__*/React__default.createElement(Shortcut, {
20335
+ keys: shortcut
20336
+ });
20337
+ }
20338
+ const className = cn('group/row border-grey-300 !sticky z-[21]', {
20339
+ 'bottom-10': tableMeta.footer.isEnabled,
20340
+ 'bottom-0': !tableMeta.footer.isEnabled,
20341
+ 'border-b': !isScrolled
20342
+ });
19734
20343
  return /*#__PURE__*/React__default.createElement("tr", {
19735
- onClick: handleCreate,
19736
- className: "border-grey-300 hover:bg-grey-100 group !sticky bottom-10 left-0 z-[21] !block cursor-pointer border-t"
20344
+ "data-row-create": true,
20345
+ className: className,
20346
+ tabIndex: -1
19737
20347
  }, /*#__PURE__*/React__default.createElement("td", {
19738
- className: "!border-t-0 !bg-transparent"
20348
+ className: "!bg-grey-50 col-span-full !border-b-0 !px-1"
19739
20349
  }, /*#__PURE__*/React__default.createElement(Button$1, {
19740
- onKeyDown: handleKeyDown,
19741
- className: "group-hover:bg-grey-200 sticky left-0",
19742
- appearance: "transparent"
19743
- }, "+ ", texts.table3.editing.buttons.create.label)));
20350
+ appearance: "transparent",
20351
+ className: "group-hover:bg-grey-200 sticky left-[4px]",
20352
+ disabled: isDisabled,
20353
+ onClick: handleCreate,
20354
+ ref: buttonRef,
20355
+ shortcut: shortcut,
20356
+ tooltip: tooltip
20357
+ }, /*#__PURE__*/React__default.createElement(Icon, {
20358
+ name: "circle-plus"
20359
+ }), texts.table3.editing.buttons.create.label)));
19744
20360
  }
19745
20361
 
19746
- function Editing(props) {
20362
+ function TemporaryRow(props) {
19747
20363
  const {
19748
- scrollToIndex,
19749
- table
20364
+ createRowButtonRef,
20365
+ isScrolled,
20366
+ table,
20367
+ tableMeta,
20368
+ tableRef
19750
20369
  } = props;
19751
- const {
19752
- texts
19753
- } = useLocalization();
19754
- const ref = React__default.useRef(null);
19755
- const tableMeta = table.options.meta;
19756
- const shortcut = {
19757
- key: 'e',
19758
- meta: true,
19759
- shift: false
20370
+ const handleKeyDown = function (event) {
20371
+ try {
20372
+ const _temp2 = function () {
20373
+ if (event.key === 'ArrowDown') {
20374
+ event.preventDefault();
20375
+ const _temp = function () {
20376
+ if (!isElementTriggeredFromContainer(event.target, event.currentTarget)) {
20377
+ return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
20378
+ if (saved) {
20379
+ var _createRowButtonRef$c;
20380
+ (_createRowButtonRef$c = createRowButtonRef.current) === null || _createRowButtonRef$c === void 0 ? void 0 : _createRowButtonRef$c.focus();
20381
+ }
20382
+ });
20383
+ }
20384
+ }();
20385
+ if (_temp && _temp.then) return _temp.then(function () {});
20386
+ } else if (event.key === 'ArrowUp') {
20387
+ event.preventDefault();
20388
+ event.stopPropagation();
20389
+ if (tableRef.current) {
20390
+ var _tableRef$current$que, _tableRef$current$que2, _tableRef$current$que3;
20391
+ const availableRows = Array.from((_tableRef$current$que = tableRef.current.querySelectorAll(`tbody tr:not([data-row-id^='${TEMPORARY_ROW_ID_PREFIX}'])`)) !== null && _tableRef$current$que !== void 0 ? _tableRef$current$que : []);
20392
+ const footerHeight = (_tableRef$current$que2 = (_tableRef$current$que3 = tableRef.current.querySelector('tfoot')) === null || _tableRef$current$que3 === void 0 ? void 0 : _tableRef$current$que3.getBoundingClientRect().height) !== null && _tableRef$current$que2 !== void 0 ? _tableRef$current$que2 : 0;
20393
+ const newRowHeight = event.currentTarget.getBoundingClientRect().height;
20394
+ const visibleHeight = tableRef.current.clientHeight - footerHeight - newRowHeight;
20395
+ const tableTopOffset = tableRef.current.getBoundingClientRect().top;
20396
+ let nextRowIndex;
20397
+ // iterate available rows in reverse order, since we're working at the bottom
20398
+ for (let index = availableRows.length - 1; index >= 0; index--) {
20399
+ const rowRect = availableRows[index].getBoundingClientRect();
20400
+ const topPlusHalfRow = rowRect.top + rowRect.height / 2;
20401
+ if (topPlusHalfRow - tableTopOffset <= visibleHeight) {
20402
+ nextRowIndex = index;
20403
+ break;
20404
+ }
20405
+ }
20406
+ if (nextRowIndex) {
20407
+ tableMeta.rowActive.setRowActiveIndex(Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute('data-row-index')));
20408
+ }
20409
+ }
20410
+ }
20411
+ }();
20412
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
20413
+ } catch (e) {
20414
+ return Promise.reject(e);
20415
+ }
19760
20416
  };
19761
- const tooltip = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
19762
- className: "ml-2",
19763
- keys: shortcut
19764
- }));
19765
- useGlobalKeyDown(shortcut, event => {
19766
- var _ref$current;
19767
- event.preventDefault();
19768
- (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
19769
- });
19770
- const handleChange = enabled => {
19771
- tableMeta.editing.toggleEditing(enabled);
19772
- requestAnimationFrame(() => {
19773
- var _tableMeta$rowActive$;
19774
- return scrollToIndex((_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0);
19775
- });
20417
+ const handleKeyDownCapture = event => {
20418
+ if (event.key === 'ArrowLeft' && tableMeta.editing.lastFocusedCellIndex === 0) {
20419
+ event.preventDefault();
20420
+ event.stopPropagation();
20421
+ } else if (event.key === 'ArrowRight' && tableMeta.editing.lastFocusedCellIndex) {
20422
+ if (tableMeta.editing.lastFocusedCellIndex === table.getVisibleFlatColumns().length - 1) {
20423
+ event.preventDefault();
20424
+ event.stopPropagation();
20425
+ }
20426
+ }
19776
20427
  };
19777
- return /*#__PURE__*/React__default.createElement(Tooltip, {
19778
- title: tooltip
19779
- }, /*#__PURE__*/React__default.createElement(ModeSwitch, {
19780
- checked: tableMeta.editing.isEditing,
19781
- onChange: handleChange,
19782
- ref: ref
19783
- }));
20428
+ const className = cn('group/row border-grey-300 !sticky z-[22]', {
20429
+ 'bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]': tableMeta.footer.isEnabled,
20430
+ 'bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]': !tableMeta.footer.isEnabled,
20431
+ 'border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0': isScrolled
20432
+ });
20433
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, table.getBottomRows().map(row => (/*#__PURE__*/React__default.createElement(Row, {
20434
+ key: row.id,
20435
+ cellRenderer: RENDERERS$1.cell,
20436
+ index: tableMeta.length,
20437
+ measureRow: () => null,
20438
+ renderer: RENDERERS$1.row,
20439
+ row: row,
20440
+ table: table,
20441
+ className: className,
20442
+ onKeyDown: handleKeyDown,
20443
+ onKeyDownCapture: handleKeyDownCapture,
20444
+ hideInternalColumns: true,
20445
+ hideRowActions: !tableMeta.editing.isEditing
20446
+ }))));
19784
20447
  }
19785
20448
 
19786
20449
  function Column$3(_) {
@@ -19798,8 +20461,19 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
19798
20461
  'data-table-editing-mode': (_table3$meta$editing = table3.meta.editing) !== null && _table3$meta$editing !== void 0 && _table3$meta$editing.isEditing ? (_table3$meta$editing2 = table3.meta.editing) !== null && _table3$meta$editing2 !== void 0 && _table3$meta$editing2.isDetailedMode ? 'detailed' : 'normal' : undefined,
19799
20462
  enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing
19800
20463
  };
19801
- const hasAlertErrors = table3.meta.editing.hasAlertErrors();
19802
- const showCreateRowButton = table3.meta.editing.isEnabled && props.onEditingCreate;
20464
+ const hasAlertErrors = table3.meta.editing.getErrorsShownInAlert().length;
20465
+ const hasCreateWorkflow = table3.meta.editing.isEnabled && props.onEditingCreate;
20466
+ const isScrolled = isTableScrolled(table3.ref);
20467
+ let createWorkflow;
20468
+ if (hasCreateWorkflow) {
20469
+ createWorkflow = /*#__PURE__*/React__default.createElement(CreateNewRow, {
20470
+ buttonRef: table3.meta.editing.createRowButtonRef,
20471
+ isScrolled: isScrolled,
20472
+ scrollToIndex: table3.renderer.scrollToIndex,
20473
+ table: table3.instance,
20474
+ tableMeta: table3.meta
20475
+ });
20476
+ }
19803
20477
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
19804
20478
  table: table3
19805
20479
  }, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
@@ -19812,13 +20486,15 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
19812
20486
  tableRef: table3.ref
19813
20487
  })) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
19814
20488
  "data-taco": "table3",
20489
+ footerRows: hasCreateWorkflow && isScrolled ? createWorkflow : undefined,
19815
20490
  table: table3
19816
- }), showCreateRowButton && (/*#__PURE__*/React__default.createElement(CreateNewRowButton, {
20491
+ }), hasCreateWorkflow ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TemporaryRow, {
20492
+ createRowButtonRef: table3.meta.editing.createRowButtonRef,
20493
+ isScrolled: isScrolled,
19817
20494
  table: table3.instance,
19818
20495
  tableMeta: table3.meta,
19819
- onEditingCreate: props.onEditingCreate,
19820
- scrollToIndex: table3.renderer.scrollToIndex
19821
- }))));
20496
+ tableRef: table3.ref
20497
+ }), !isScrolled ? createWorkflow : null)) : null));
19822
20498
  });
19823
20499
  const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
19824
20500
  const stringifiedChildren = String(props.children);
@@ -20054,6 +20730,796 @@ const Tour = props => {
20054
20730
  };
20055
20731
  Tour.Step = TourStep;
20056
20732
 
20733
+ // NOTE: this file is intentianally a js file so that it can be consumed by tailwind.config.js
20734
+
20735
+ const THEME_COLORS = {
20736
+ transparent: 'transparent',
20737
+ current: 'currentColor',
20738
+ white: '#fff',
20739
+ black: '#1c1c1c',
20740
+ brand: {
20741
+ vismaRed: '#E70641',
20742
+ paleOrange: '#FFF5E5',
20743
+ sunsetOrange: '#E89C2E',
20744
+ midnightBlue: '#29283E',
20745
+ coolBlue: '#F5F7F9'
20746
+ },
20747
+ grey: {
20748
+ lightest: '#fafafa',
20749
+ light: '#F6F6F6',
20750
+ DEFAULT: '#EBEBEB',
20751
+ dark: '#DDDDDD',
20752
+ darker: '#ACACAC',
20753
+ darkest: '#595959',
20754
+ darkNew: '#a5a6a9',
20755
+ 50: '#fafafa',
20756
+ 100: '#F6F6F6',
20757
+ 200: '#EBEBEB',
20758
+ 300: '#DDDDDD',
20759
+ 500: '#ACACAC',
20760
+ 700: '#595959',
20761
+ 900: '#303030'
20762
+ },
20763
+ purple: {
20764
+ lightest: '#585c74',
20765
+ light: '#4b4f64',
20766
+ DEFAULT: '#3d4153',
20767
+ dark: '#353a48',
20768
+ darker: '#29283e',
20769
+ darkest: '#212032',
20770
+ darkNew_1: '#373647',
20771
+ darkNew_2: '#414050',
20772
+ 100: '#EEE5FF',
20773
+ 200: '#ddd1ff',
20774
+ 300: '#CBBCFE',
20775
+ 500: '#9270FA',
20776
+ 700: '#6542D1',
20777
+ 900: '#412970'
20778
+ },
20779
+ blue: {
20780
+ lightest: '#DEEBFF',
20781
+ light: '#75A0F5',
20782
+ DEFAULT: '#4573D2',
20783
+ dark: '#2B57B4',
20784
+ 100: '#DEEBFF',
20785
+ 200: '#AACCFF',
20786
+ 300: '#75A0F5',
20787
+ 500: '#4573D2',
20788
+ 700: '#2B57B4',
20789
+ 900: '#29283E'
20790
+ },
20791
+ red: {
20792
+ lightest: '#FFDAD2',
20793
+ light: '#E66568',
20794
+ DEFAULT: '#CE3F42',
20795
+ dark: '#950027',
20796
+ 100: '#FFDAD2',
20797
+ 200: '#f3a09d',
20798
+ 300: '#E66568',
20799
+ 500: '#CE3F42',
20800
+ 700: '#950027',
20801
+ 900: '#64001B'
20802
+ },
20803
+ green: {
20804
+ lightest: '#cdf0e7',
20805
+ light: '#52C7AB',
20806
+ DEFAULT: '#08AE87',
20807
+ dark: '#028465',
20808
+ 100: '#cdf0e7',
20809
+ 200: '#9be1ce',
20810
+ 300: '#52C7AB',
20811
+ 500: '#08AE87',
20812
+ 700: '#028465',
20813
+ 900: '#14493A'
20814
+ },
20815
+ yellow: {
20816
+ lightest: '#FFF1C3',
20817
+ light: '#FFD665',
20818
+ DEFAULT: '#FFBD3B',
20819
+ dark: '#e89c2e',
20820
+ 100: '#FFF1C3',
20821
+ 200: '#ffe494',
20822
+ 300: '#FFD665',
20823
+ 500: '#FFBD3B',
20824
+ 700: '#e89c2e',
20825
+ 900: '#733700'
20826
+ },
20827
+ pink: {
20828
+ 100: '#FFE3F7',
20829
+ 200: '#fcb9e9',
20830
+ 300: '#F98EDB',
20831
+ 500: '#E165BF',
20832
+ 700: '#CF49AA',
20833
+ 900: '#870062'
20834
+ },
20835
+ brown: {
20836
+ 100: '#EEE0DA',
20837
+ 200: '#DFCCC2',
20838
+ 300: '#C4AB9E',
20839
+ 500: '#93715D',
20840
+ 700: '#73503B',
20841
+ 900: '#45291F'
20842
+ },
20843
+ orange: {
20844
+ 100: '#FFE3BB',
20845
+ 200: '#FCCB80',
20846
+ 300: '#FAB64D',
20847
+ 500: '#F99702',
20848
+ 700: '#EF7D00',
20849
+ 900: '#4A2811'
20850
+ }
20851
+ };
20852
+
20853
+ const mapColor = (palette, prefix = '') => {
20854
+ return Object.keys(palette).reduce((accum, color) => {
20855
+ if (color === 'current') {
20856
+ return accum;
20857
+ } else if (typeof palette[color] === 'string') {
20858
+ return {
20859
+ ...accum,
20860
+ [prefix ? color === 'DEFAULT' ? prefix : `${prefix}-${color}` : color]: palette[color]
20861
+ };
20862
+ } else {
20863
+ return {
20864
+ ...accum,
20865
+ ...mapColor(palette[color], color)
20866
+ };
20867
+ }
20868
+ }, {});
20869
+ };
20870
+ const colors = /*#__PURE__*/mapColor(THEME_COLORS);
20871
+ const getThemeColor = color => colors[color];
20872
+
20873
+ function Legend(props) {
20874
+ const {
20875
+ activeIndex,
20876
+ onMouseEnter,
20877
+ onMouseLeave,
20878
+ onClick,
20879
+ payload,
20880
+ layout,
20881
+ activeItems
20882
+ } = props;
20883
+ const [hoverIndex, setHoverIndex] = React.useState(null);
20884
+ const handleMouseEnter = (entry, index) => {
20885
+ setHoverIndex(index);
20886
+ if (activeItems[entry.dataKey]) onMouseEnter(entry, index);
20887
+ };
20888
+ const handleMouseLeave = () => {
20889
+ onMouseLeave();
20890
+ setHoverIndex(null);
20891
+ };
20892
+ const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
20893
+ appearance: "transparent",
20894
+ className: "text-grey-700"
20895
+ }, moreButtonText));
20896
+ return /*#__PURE__*/React__default.createElement("div", {
20897
+ className: "mx-auto w-auto max-w-full overflow-hidden"
20898
+ }, /*#__PURE__*/React__default.createElement("div", {
20899
+ className: cn('mb-0 ml-0 flex justify-center', {
20900
+ 'flex-col': layout === 'vertical'
20901
+ })
20902
+ }, /*#__PURE__*/React__default.createElement(OverflowGroup, {
20903
+ className: "w-full items-center py-1",
20904
+ moreButton: moreButton
20905
+ }, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement("span", {
20906
+ key: `${entry.dataKey}-${index}`,
20907
+ className: cn(' hover:bg-grey-100 cursor-pointer px-[8px] py-[2px] hover:rounded-[4px]', {
20908
+ 'bg-grey-100 rounded': activeIndex === index
20909
+ }),
20910
+ onMouseEnter: () => handleMouseEnter(entry, index),
20911
+ onMouseLeave: handleMouseLeave,
20912
+ onClick: onClick ? () => onClick(entry) : undefined
20913
+ }, /*#__PURE__*/React__default.createElement("span", {
20914
+ className: "text-grey-700 flex items-center gap-[4px]"
20915
+ }, /*#__PURE__*/React__default.createElement("span", {
20916
+ className: cn('-mt-px ml-1 flex h-3 w-3 rounded-sm', {
20917
+ 'border-grey-300 border !bg-white': !activeItems[entry.dataKey]
20918
+ }),
20919
+ style: {
20920
+ backgroundColor: entry.color
20921
+ }
20922
+ }, hoverIndex === index && activeItems[entry.dataKey] && (/*#__PURE__*/React__default.createElement(Icon, {
20923
+ name: "tick-bold",
20924
+ className: "!h-full !w-full text-white"
20925
+ }))), entry.value)))))));
20926
+ }
20927
+
20928
+ const Tooltip$2 = ({
20929
+ active,
20930
+ formatter,
20931
+ payload,
20932
+ style,
20933
+ singlePieDonutChart
20934
+ }) => {
20935
+ const getColor = entry => {
20936
+ var _ref, _entry$color;
20937
+ if (singlePieDonutChart) {
20938
+ // We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
20939
+ // and one with multiple pies.
20940
+ return getThemeColor(entry.payload.color);
20941
+ }
20942
+ return (_ref = (_entry$color = entry.color) !== null && _entry$color !== void 0 ? _entry$color : entry.payload.fill) !== null && _ref !== void 0 ? _ref : 'blue-500';
20943
+ };
20944
+ if (active && payload && payload.length) {
20945
+ return /*#__PURE__*/React__default.createElement("dl", {
20946
+ 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)]",
20947
+ style: style
20948
+ }, payload.map((entry, index) => (/*#__PURE__*/React__default.createElement(React__default.Fragment, {
20949
+ key: `${entry.name}-${index}`
20950
+ }, /*#__PURE__*/React__default.createElement("dt", {
20951
+ className: "text-grey-700 mb-0 flex items-center gap-1 font-normal"
20952
+ }, /*#__PURE__*/React__default.createElement("span", {
20953
+ className: "-mt-px h-2.5 w-2.5 rounded-sm",
20954
+ style: {
20955
+ background: getColor(entry)
20956
+ }
20957
+ }),
20958
+ // We use entry.payload.label because the payload structure differs between a Donut chart with a single pie
20959
+ // and one with multiple pies.
20960
+ singlePieDonutChart ? entry.payload.label : entry.name), /*#__PURE__*/React__default.createElement("dd", {
20961
+ className: "mb-0 text-right font-bold text-black "
20962
+ }, formatter ? formatter(entry.value) : entry.value)))));
20963
+ }
20964
+ return null;
20965
+ };
20966
+
20967
+ const getCartesianGridProps = () => ({
20968
+ vertical: false
20969
+ });
20970
+ const getXAxisProps = props => ({
20971
+ axisLine: false,
20972
+ dataKey: props.accessor,
20973
+ fontSize: 12,
20974
+ scale: props.xAxisScale,
20975
+ tickLine: false,
20976
+ tickFormatter: props.xAxisTickFormat
20977
+ });
20978
+ const getYAxisProps = props => ({
20979
+ axisLine: false,
20980
+ fontSize: 12,
20981
+ scale: props.yAxisScale,
20982
+ tickLine: false,
20983
+ tickFormatter: props.yAxisTickFormat
20984
+ });
20985
+ const getLegendProps = props => ({
20986
+ content: /*#__PURE__*/React__default.createElement(Legend, Object.assign({}, props))
20987
+ });
20988
+ const getTooltipProps = (props = undefined) => ({
20989
+ content: /*#__PURE__*/React__default.createElement(Tooltip$2, Object.assign({}, props)),
20990
+ wrapperStyle: {
20991
+ outline: 'none'
20992
+ }
20993
+ });
20994
+
20995
+ // A hacky fix for EC-50037 to make sure that Chart doesn't resize when it is inside a Card.
20996
+ const ResponsiveContainer = props => (/*#__PURE__*/React__default.createElement(Recharts.ResponsiveContainer, Object.assign({
20997
+ className: "!h-[calc(100%-1px)] !w-[calc(100%-1px)]"
20998
+ }, props)));
20999
+
21000
+ const Area = _ => null;
21001
+ const AreaChart = function AreaChart(externalProps) {
21002
+ const {
21003
+ children,
21004
+ data,
21005
+ formatter,
21006
+ ...props
21007
+ } = externalProps;
21008
+ const [hoveredArea, setHoveredArea] = React.useState(null);
21009
+ const [activeAreas, setActiveAreas] = React.useState(() => {
21010
+ const areas = {};
21011
+ React__default.Children.forEach(children, child => {
21012
+ areas[child.props.accessor] = true;
21013
+ });
21014
+ return areas;
21015
+ });
21016
+ const handleLegendClick = entry => {
21017
+ setHoveredArea(null);
21018
+ setActiveAreas({
21019
+ ...activeAreas,
21020
+ [entry.dataKey]: !activeAreas[entry.dataKey]
21021
+ });
21022
+ };
21023
+ return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.AreaChart, {
21024
+ data: data,
21025
+ margin: {
21026
+ top: 10,
21027
+ right: 0,
21028
+ left: -25,
21029
+ bottom: 0
21030
+ }
21031
+ }, /*#__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({
21032
+ onClick: handleLegendClick,
21033
+ onMouseEnter: entry => setHoveredArea(entry.dataKey),
21034
+ onMouseLeave: () => setHoveredArea(null),
21035
+ activeItems: activeAreas
21036
+ }))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
21037
+ formatter: formatter
21038
+ })), React__default.Children.map(children, child => {
21039
+ var _child$props$color, _child$props$color2, _child$props$color3;
21040
+ return /*#__PURE__*/React__default.createElement(Recharts.Area, {
21041
+ activeDot: {
21042
+ fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
21043
+ },
21044
+ isAnimationActive: false,
21045
+ dataKey: child.props.accessor,
21046
+ dot: false,
21047
+ fill: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'grey-100'),
21048
+ name: child.props.label,
21049
+ strokeWidth: 2,
21050
+ stroke: getThemeColor((_child$props$color3 = child.props.color) !== null && _child$props$color3 !== void 0 ? _child$props$color3 : 'grey-300'),
21051
+ stackId: child.props.stackId,
21052
+ hide: !activeAreas[child.props.accessor],
21053
+ opacity: hoveredArea && child.props.accessor !== hoveredArea ? 0.3 : 1
21054
+ });
21055
+ })));
21056
+ };
21057
+ AreaChart.Area = Area;
21058
+
21059
+ const Bar$1 = _ => null;
21060
+ const getXAxisVerticalProps = props => ({
21061
+ ...getXAxisProps(props),
21062
+ ...{
21063
+ type: 'number',
21064
+ dataKey: undefined
21065
+ }
21066
+ });
21067
+ const getYAxisVerticalProps = props => ({
21068
+ ...getYAxisProps(props),
21069
+ ...{
21070
+ dataKey: props.accessor,
21071
+ type: 'category'
21072
+ }
21073
+ });
21074
+ const BarChart = function BarChart(externalProps) {
21075
+ const {
21076
+ children,
21077
+ data,
21078
+ formatter,
21079
+ layout = 'horizontal',
21080
+ ...props
21081
+ } = externalProps;
21082
+ const [activeIndex, setActiveIndex] = React__default.useState(undefined);
21083
+ const [hoveredBar, setHoveredBar] = React__default.useState(null);
21084
+ const [activeBars, setActiveBars] = React__default.useState(() => {
21085
+ const keys = {};
21086
+ React__default.Children.forEach(children, child => {
21087
+ keys[child.props.accessor] = true;
21088
+ });
21089
+ return keys;
21090
+ });
21091
+ // Recharts doesn't provide a way for us to know if a stacked bar is at the top or the bottom,
21092
+ // so we can't set proper radiuses without some "magic"
21093
+ const stacks = {};
21094
+ React__default.Children.forEach(children, child => {
21095
+ if (child.props.stackId) {
21096
+ if (!stacks[child.props.stackId]) {
21097
+ stacks[child.props.stackId] = [child.props.accessor];
21098
+ } else {
21099
+ stacks[child.props.stackId].push(child.props.accessor);
21100
+ }
21101
+ }
21102
+ });
21103
+ const handleLegendClick = entry => {
21104
+ setHoveredBar(null);
21105
+ setActiveBars({
21106
+ ...activeBars,
21107
+ [entry.dataKey]: !activeBars[entry.dataKey]
21108
+ });
21109
+ };
21110
+ const handleLegendHover = (entry, index) => {
21111
+ setHoveredBar(entry.dataKey);
21112
+ setActiveIndex(index);
21113
+ };
21114
+ return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.BarChart, {
21115
+ layout: layout,
21116
+ data: data,
21117
+ margin: {
21118
+ top: 10,
21119
+ right: 0,
21120
+ left: layout === 'vertical' ? 0 : -25,
21121
+ bottom: 0
21122
+ },
21123
+ onMouseMove: chartState => setActiveIndex(chartState.activeTooltipIndex),
21124
+ onMouseLeave: () => setActiveIndex(undefined)
21125
+ }, /*#__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({
21126
+ onClick: handleLegendClick,
21127
+ onMouseEnter: handleLegendHover,
21128
+ onMouseLeave: () => setHoveredBar(null),
21129
+ activeItems: activeBars
21130
+ }))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
21131
+ formatter: formatter
21132
+ })), React__default.Children.map(children, child => (/*#__PURE__*/React__default.createElement(Recharts.Bar, {
21133
+ isAnimationActive: false,
21134
+ barSize: 16,
21135
+ dataKey: child.props.accessor,
21136
+ name: child.props.label,
21137
+ onMouseEnter: (_, index) => setActiveIndex(index),
21138
+ onMouseLeave: () => setActiveIndex(undefined),
21139
+ fill: getThemeColor(child.props.color ? `${child.props.color}` : `blue-300`),
21140
+ radius: getBarRadius(stacks, child.props.accessor, child.props.stackId, activeBars),
21141
+ stackId: child.props.stackId,
21142
+ style: child.props.stackId ? {
21143
+ stroke: '#fff',
21144
+ strokeWidth: '2px'
21145
+ } : undefined,
21146
+ hide: !activeBars[child.props.accessor]
21147
+ }, data.map((_, index) => (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
21148
+ key: `cell-${index}`,
21149
+ opacity: hoveredBar && child.props.accessor !== hoveredBar || activeIndex !== undefined && activeIndex !== index ? 0.3 : 1
21150
+ }))))))));
21151
+ };
21152
+ BarChart.Bar = Bar$1;
21153
+ const getBarRadius = (stacks, accessor, stackId, activeBars) => {
21154
+ if (stackId && Array.isArray(stacks[stackId])) {
21155
+ const length = stacks[stackId].length - 1;
21156
+ const index = stacks[stackId].indexOf(accessor);
21157
+ if (Object.entries(activeBars).filter(item => item[0] !== accessor).every(item => !item[1])) {
21158
+ return [3, 3, 0, 0];
21159
+ }
21160
+ if (activeBars[stacks[stackId][index + 1]] === false) {
21161
+ return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length - 1 ? 0 : 3, index === length - 1 ? 0 : 3];
21162
+ }
21163
+ if (index !== 0 && index !== length) {
21164
+ return 0;
21165
+ }
21166
+ return [index === 0 ? 0 : 3, index === 0 ? 0 : 3, index === length ? 0 : 3, index === length ? 0 : 3];
21167
+ }
21168
+ return 3;
21169
+ };
21170
+
21171
+ const Legend$1 = ({
21172
+ legendPosition,
21173
+ hoveredItem,
21174
+ selectedItem,
21175
+ data,
21176
+ onClick,
21177
+ setHoveredItem,
21178
+ formatter,
21179
+ total,
21180
+ visibleItems,
21181
+ label
21182
+ }) => {
21183
+ const isTotalLegendSelected = selectedItem.length === data.length;
21184
+ const isTotalLegendHovered = hoveredItem.length === data.length;
21185
+ const handleMouseLeave = () => setHoveredItem([]);
21186
+ const renderLegendItem = (entry, index) => {
21187
+ const isTotal = entry === null;
21188
+ // We can't use `isTotal` here because TypeScript is unable to infer the type when `entry` is not null.
21189
+ const itemData = entry === null ? {
21190
+ id: 'total',
21191
+ label,
21192
+ value: total,
21193
+ color: 'grey-300'
21194
+ } : entry;
21195
+ const isSelected = isTotal ? isTotalLegendSelected : selectedItem.includes(itemData.id);
21196
+ const isHovered = isTotal ? isTotalLegendHovered : hoveredItem.includes(itemData.id);
21197
+ return /*#__PURE__*/React__default.createElement("li", {
21198
+ key: isTotal ? 'total' : `${itemData.label}-${index}`,
21199
+ className: cn('mr-2 flex cursor-pointer gap-2 rounded pl-0 pr-1', {
21200
+ 'bg-grey-100': isHovered && (!isTotal || legendPosition === 'right'),
21201
+ 'bg-grey-200': isSelected && (!isTotal || legendPosition === 'right')
21202
+ }),
21203
+ onClick: () => onClick(isTotal ? data : itemData),
21204
+ onMouseEnter: () => setHoveredItem(isTotal ? data.map(item => item.id) : [itemData.id]),
21205
+ onMouseLeave: handleMouseLeave
21206
+ }, legendPosition === 'bottom' ? (/*#__PURE__*/React__default.createElement("div", {
21207
+ className: "flex items-center gap-1"
21208
+ }, /*#__PURE__*/React__default.createElement("span", {
21209
+ className: cn('ml-1 h-3 w-3 rounded-sm', {
21210
+ 'border-grey-300 border !bg-white': !visibleItems[itemData.id]
21211
+ }),
21212
+ style: {
21213
+ backgroundColor: getThemeColor(itemData.color)
21214
+ }
21215
+ }, visibleItems[itemData.id] && isHovered && (/*#__PURE__*/React__default.createElement(Icon, {
21216
+ name: "tick-bold",
21217
+ className: "mb-2.5 !h-full !w-full text-white"
21218
+ }))), /*#__PURE__*/React__default.createElement("div", null, itemData.label))) : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", {
21219
+ className: "ml-1 mt-1 h-9 w-2 rounded-[1px]",
21220
+ style: {
21221
+ backgroundColor: getThemeColor(itemData.color)
21222
+ }
21223
+ }), /*#__PURE__*/React__default.createElement("div", null, itemData.label, /*#__PURE__*/React__default.createElement("span", {
21224
+ className: "-mt-1 flex w-full text-lg font-bold"
21225
+ }, formatter ? formatter(itemData.value) : itemData.value)))));
21226
+ };
21227
+ const moreButton = moreButtonText => (/*#__PURE__*/React__default.createElement(Button$1, {
21228
+ appearance: "transparent",
21229
+ className: "text-grey-700"
21230
+ }, moreButtonText));
21231
+ const className = cn('flex-grow pl-4', {
21232
+ 'w-full': legendPosition === 'bottom'
21233
+ });
21234
+ return /*#__PURE__*/React__default.createElement("div", {
21235
+ className: className
21236
+ }, /*#__PURE__*/React__default.createElement("ul", {
21237
+ className: cn('mb-0 ml-0 mt-4 flex justify-center space-y-1', legendPosition === 'right' ? 'flex-col gap-1' : 'flex-row')
21238
+ }, legendPosition === 'right' ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderLegendItem(null), data.map(renderLegendItem))) : (/*#__PURE__*/React__default.createElement(OverflowGroup, {
21239
+ className: "w-full items-center py-1",
21240
+ moreButton: moreButton
21241
+ }, data.map(renderLegendItem)))));
21242
+ };
21243
+
21244
+ const DONUT_WIDTH = 16;
21245
+ const HOVER_DONUT_WIDTH = 10;
21246
+
21247
+ const CenteredLabel = ({
21248
+ radius,
21249
+ legendPosition,
21250
+ label,
21251
+ total,
21252
+ formatter,
21253
+ showLegend
21254
+ }) => {
21255
+ const totalInset = HOVER_DONUT_WIDTH + DONUT_WIDTH + DONUT_WIDTH;
21256
+ const diameter = radius * 2;
21257
+ return /*#__PURE__*/React__default.createElement("div", {
21258
+ className: "absolute mt-1 flex h-12 flex-col text-center",
21259
+ style: {
21260
+ top: `calc(${radius}px - (3rem / 2))`,
21261
+ left: legendPosition === 'right' ? `${totalInset}px` : `calc(50%-${diameter - 2 * totalInset})`,
21262
+ width: showLegend ? `${diameter - 2 * totalInset}px` : `${diameter}px`
21263
+ }
21264
+ }, /*#__PURE__*/React__default.createElement("span", {
21265
+ className: "w-full truncate text-lg font-bold"
21266
+ }, formatter ? formatter(total) : total), label);
21267
+ };
21268
+
21269
+ const ActiveShape = props => {
21270
+ var _getThemeColor;
21271
+ const {
21272
+ cx,
21273
+ cy,
21274
+ id,
21275
+ innerRadius,
21276
+ onClick,
21277
+ outerRadius = 0,
21278
+ pieColors,
21279
+ startAngle,
21280
+ endAngle,
21281
+ fill
21282
+ } = props;
21283
+ return /*#__PURE__*/React__default.createElement("g", {
21284
+ onClick: () => onClick(id),
21285
+ className: cn({
21286
+ 'cursor-pointer': !!onClick
21287
+ })
21288
+ }, /*#__PURE__*/React__default.createElement(Recharts.Sector, {
21289
+ cx: cx,
21290
+ cy: cy,
21291
+ innerRadius: innerRadius,
21292
+ outerRadius: outerRadius,
21293
+ startAngle: startAngle,
21294
+ endAngle: endAngle,
21295
+ fill: fill
21296
+ }), /*#__PURE__*/React__default.createElement(Recharts.Sector, {
21297
+ cx: cx,
21298
+ cy: cy,
21299
+ startAngle: startAngle,
21300
+ endAngle: endAngle,
21301
+ innerRadius: outerRadius + 2,
21302
+ outerRadius: outerRadius + HOVER_DONUT_WIDTH,
21303
+ fill: id !== undefined ? (_getThemeColor = getThemeColor(pieColors[id])) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-500') : getThemeColor('blue-500'),
21304
+ opacity: 0.3
21305
+ }));
21306
+ };
21307
+
21308
+ const Segment = _ => null;
21309
+ const DonutChart = function DonutChart({
21310
+ children,
21311
+ formatter,
21312
+ onClick,
21313
+ showLegend = false,
21314
+ legendPosition = 'bottom',
21315
+ label
21316
+ }) {
21317
+ const ref = React__default.useRef(null);
21318
+ const [radius, setRadius] = React__default.useState(0);
21319
+ const [hoveredItem, setHoveredItem] = React__default.useState([]);
21320
+ // used for right legends
21321
+ const [selectedItem, setSelectedItem] = React__default.useState([]);
21322
+ // used for bottom legends
21323
+ const [visibleItems, setVisibleItems] = React__default.useState(() => {
21324
+ const keys = {};
21325
+ React__default.Children.forEach(children, child => {
21326
+ keys[child.props.id] = true;
21327
+ });
21328
+ return keys;
21329
+ });
21330
+ React__default.useEffect(() => {
21331
+ if (ref.current) {
21332
+ var _ref$current$parentEl;
21333
+ const rect = (_ref$current$parentEl = ref.current.parentElement) === null || _ref$current$parentEl === void 0 ? void 0 : _ref$current$parentEl.getBoundingClientRect();
21334
+ if (rect) {
21335
+ const width = showLegend ? rect.width / 2 : rect.width;
21336
+ const max = rect.height < width ? rect.height : width;
21337
+ setRadius(max / 2);
21338
+ }
21339
+ }
21340
+ }, [showLegend]);
21341
+ 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
21342
+ const data = React__default.Children.map(children, child => ({
21343
+ id: child.props.id,
21344
+ color: child.props.color,
21345
+ label: child.props.label,
21346
+ value: child.props.value
21347
+ }));
21348
+ const displayedData = data.filter(child => visibleItems[child.id]);
21349
+ const total = displayedData.reduce((accum, entry) => accum + entry.value, 0);
21350
+ const showTooltip = (!showLegend || legendPosition === 'bottom') && displayedData.length > 0;
21351
+ const handleLegendClick = entry => {
21352
+ if (legendPosition === 'bottom' && !Array.isArray(entry)) {
21353
+ setVisibleItems({
21354
+ ...visibleItems,
21355
+ [entry.id]: !visibleItems[entry.id]
21356
+ });
21357
+ } else {
21358
+ const nextSelectedItem = Array.isArray(entry) ? entry.map(entryItem => entryItem.id) : [entry.id];
21359
+ // Using slice to avoid mutation of the react state 'selectedItem'
21360
+ const isCurrentSegmentActive = selectedItem.slice().sort().join(',') === nextSelectedItem.sort().join(',');
21361
+ if (onClick && !isCurrentSegmentActive) {
21362
+ onClick(entry);
21363
+ }
21364
+ setSelectedItem(isCurrentSegmentActive ? [] : nextSelectedItem);
21365
+ }
21366
+ };
21367
+ const handlePieClick = React__default.useCallback(pieId => {
21368
+ if (onClick && pieId !== undefined) {
21369
+ const pieProps = displayedData.find(item => item.id === pieId);
21370
+ onClick(pieProps);
21371
+ }
21372
+ }, [onClick, displayedData]);
21373
+ const singlePieDonutChart = displayedData.length === 1;
21374
+ const activeShapeColor = React__default.useMemo(() => {
21375
+ const getSegmentColor = item => item.reduce((colors, itemId) => {
21376
+ const visibleHoveredItem = displayedData.find(dataItem => dataItem.id === itemId);
21377
+ if (visibleHoveredItem) {
21378
+ colors[visibleHoveredItem.id] = visibleHoveredItem.color;
21379
+ }
21380
+ return colors;
21381
+ }, {});
21382
+ const hoveredSegmentColor = getSegmentColor(hoveredItem);
21383
+ const selectedSegmentColor = getSegmentColor(selectedItem);
21384
+ return legendPosition === 'bottom' || hoveredItem.length !== 0 ? hoveredSegmentColor : selectedSegmentColor;
21385
+ }, [hoveredItem, selectedItem, legendPosition]);
21386
+ if (ref.current && !radius) {
21387
+ return null;
21388
+ }
21389
+ const getActiveIndex = () => {
21390
+ if (hoveredItem.length > 0) {
21391
+ return hoveredItem.map(itemId => displayedData.findIndex(element => element.id === itemId));
21392
+ }
21393
+ return selectedItem.map(selectedItemId => displayedData.findIndex(element => element.id === selectedItemId));
21394
+ };
21395
+ const content = () => {
21396
+ const elements = React__default.Children.toArray(children).filter(child => /*#__PURE__*/React__default.isValidElement(child) && visibleItems[child.props.id]);
21397
+ return elements.length > 0 ? elements.map((child, index) => {
21398
+ var _getThemeColor;
21399
+ return /*#__PURE__*/React__default.createElement(Recharts.Cell, {
21400
+ key: `cell-${index}`,
21401
+ name: child.props.label,
21402
+ fill: (_getThemeColor = getThemeColor(child.props.color)) !== null && _getThemeColor !== void 0 ? _getThemeColor : getThemeColor('blue-300')
21403
+ });
21404
+ }) : (/*#__PURE__*/React__default.createElement(Recharts.Cell, {
21405
+ key: "empty-chart",
21406
+ name: '',
21407
+ fill: getThemeColor('grey-200')
21408
+ }));
21409
+ };
21410
+ return /*#__PURE__*/React__default.createElement("div", {
21411
+ className: cn('relative h-full w-full', {
21412
+ [`flex `]: showLegend,
21413
+ 'flex-col items-center': legendPosition === 'bottom'
21414
+ }),
21415
+ ref: ref
21416
+ }, /*#__PURE__*/React__default.createElement(CenteredLabel, {
21417
+ radius: radius,
21418
+ legendPosition: legendPosition,
21419
+ label: label,
21420
+ total: total,
21421
+ formatter: formatter,
21422
+ showLegend: showLegend
21423
+ }), /*#__PURE__*/React__default.createElement(Recharts.PieChart, {
21424
+ data: data,
21425
+ height: diameter,
21426
+ width: diameter,
21427
+ style: {
21428
+ transform: 'rotate(90deg) scale(-1,1)'
21429
+ }
21430
+ }, showTooltip ? (/*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps({
21431
+ style: {
21432
+ transform: 'rotate(90deg) scale(-1,1)'
21433
+ },
21434
+ singlePieDonutChart
21435
+ })))) : null, /*#__PURE__*/React__default.createElement(Recharts.Pie, {
21436
+ isAnimationActive: false,
21437
+ activeIndex: getActiveIndex(),
21438
+ activeShape: /*#__PURE__*/React__default.createElement(ActiveShape, {
21439
+ pieColors: activeShapeColor,
21440
+ onClick: handlePieClick
21441
+ }),
21442
+ data: displayedData.length > 0 ? displayedData : [],
21443
+ dataKey: "value",
21444
+ innerRadius: radius - HOVER_DONUT_WIDTH - DONUT_WIDTH,
21445
+ onMouseEnter: segment => displayedData.length > 0 && setHoveredItem([segment.id]),
21446
+ onMouseLeave: () => setHoveredItem([]),
21447
+ outerRadius: radius - HOVER_DONUT_WIDTH,
21448
+ paddingAngle: 2,
21449
+ // Prevents the pie group element from being focusable
21450
+ rootTabIndex: -1
21451
+ }, content())), showLegend && (/*#__PURE__*/React__default.createElement(Legend$1, {
21452
+ data: data,
21453
+ visibleItems: visibleItems,
21454
+ onClick: handleLegendClick,
21455
+ total: total,
21456
+ setHoveredItem: setHoveredItem,
21457
+ label: label,
21458
+ legendPosition: legendPosition,
21459
+ hoveredItem: hoveredItem,
21460
+ selectedItem: selectedItem,
21461
+ formatter: formatter
21462
+ })));
21463
+ };
21464
+ DonutChart.Segment = Segment;
21465
+
21466
+ const Line$1 = _ => null;
21467
+ const LineChart = function LineChart(externalProps) {
21468
+ const {
21469
+ children,
21470
+ data,
21471
+ formatter,
21472
+ ...props
21473
+ } = externalProps;
21474
+ const [hoveredLine, setHoveredLine] = React.useState(null);
21475
+ const [activeLines, setActiveLines] = React.useState(() => {
21476
+ const keys = {};
21477
+ React__default.Children.forEach(children, child => {
21478
+ keys[child.props.accessor] = true;
21479
+ });
21480
+ return keys;
21481
+ });
21482
+ const handleLegendClick = entry => {
21483
+ setHoveredLine(null);
21484
+ setActiveLines({
21485
+ ...activeLines,
21486
+ [entry.dataKey]: !activeLines[entry.dataKey]
21487
+ });
21488
+ };
21489
+ return /*#__PURE__*/React__default.createElement(ResponsiveContainer, null, /*#__PURE__*/React__default.createElement(Recharts.LineChart, {
21490
+ data: data,
21491
+ margin: {
21492
+ top: 10,
21493
+ right: 0,
21494
+ left: -25,
21495
+ bottom: 0
21496
+ }
21497
+ }, /*#__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({
21498
+ onClick: handleLegendClick,
21499
+ onMouseEnter: entry => setHoveredLine(entry.dataKey),
21500
+ onMouseLeave: () => setHoveredLine(null),
21501
+ activeItems: activeLines
21502
+ }))), /*#__PURE__*/React__default.createElement(Recharts.Tooltip, Object.assign({}, getTooltipProps(), {
21503
+ formatter: formatter
21504
+ })), React__default.Children.map(children, child => {
21505
+ var _child$props$color, _child$props$color2;
21506
+ return /*#__PURE__*/React__default.createElement(Recharts.Line, {
21507
+ activeDot: {
21508
+ fill: getThemeColor((_child$props$color = child.props.color) !== null && _child$props$color !== void 0 ? _child$props$color : 'blue-300')
21509
+ },
21510
+ dataKey: child.props.accessor,
21511
+ isAnimationActive: false,
21512
+ dot: false,
21513
+ name: child.props.label,
21514
+ stroke: getThemeColor((_child$props$color2 = child.props.color) !== null && _child$props$color2 !== void 0 ? _child$props$color2 : 'blue-300'),
21515
+ strokeWidth: 2,
21516
+ hide: !activeLines[child.props.accessor],
21517
+ opacity: hoveredLine && child.props.accessor !== hoveredLine ? 0.3 : 1
21518
+ });
21519
+ })));
21520
+ };
21521
+ LineChart.Line = Line$1;
21522
+
20057
21523
  const Button$4 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
20058
21524
  const {
20059
21525
  ...attributes
@@ -20326,15 +21792,13 @@ const AgreementDisplay = props => {
20326
21792
  }));
20327
21793
  };
20328
21794
 
20329
- const Container$1 = ({
20330
- children
20331
- }) => {
21795
+ const Container$1 = props => {
20332
21796
  return /*#__PURE__*/React__default.createElement("div", {
20333
21797
  className: "-ml-2 flex flex-shrink-0 flex-grow-0 items-center gap-2 pr-2 xl:ml-auto xl:w-64",
20334
21798
  "data-taco": "header-agreements"
20335
21799
  }, /*#__PURE__*/React__default.createElement("span", {
20336
21800
  className: "hidden h-8 w-px flex-shrink-0 flex-grow-0 bg-white/[0.3] xl:flex"
20337
- }), children);
21801
+ }), props.children);
20338
21802
  };
20339
21803
  function AgreementSelector(props) {
20340
21804
  const {
@@ -20572,9 +22036,9 @@ const Top = props => {
20572
22036
  setSidebarOpen
20573
22037
  } = React__default.useContext(LayoutContext);
20574
22038
  const toggleSidebar = () => setSidebarOpen(open => !open);
20575
- return typeof props.children === 'function' ? props.children({
22039
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, typeof props.children === 'function' ? props.children({
20576
22040
  toggleSidebar
20577
- }) : props.children;
22041
+ }) : props.children);
20578
22042
  };
20579
22043
 
20580
22044
  const Page = /*#__PURE__*/React__default.forwardRef(function LayoutPage(props, ref) {
@@ -20800,10 +22264,12 @@ const useOnClickOutside = (ref, callback) => {
20800
22264
  exports.Accordion = Accordion;
20801
22265
  exports.Alert = Alert;
20802
22266
  exports.AlertDialog = AlertDialog;
22267
+ exports.AreaChart = AreaChart;
20803
22268
  exports.Backdrop = Backdrop;
20804
22269
  exports.Badge = Badge;
20805
22270
  exports.BadgeIcon = BadgeIcon;
20806
22271
  exports.Banner = Banner;
22272
+ exports.BarChart = BarChart;
20807
22273
  exports.Base = Base;
20808
22274
  exports.Button = Button$1;
20809
22275
  exports.Calendar = Calendar$1;
@@ -20814,6 +22280,7 @@ exports.Combobox = Combobox;
20814
22280
  exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
20815
22281
  exports.Datepicker = Datepicker;
20816
22282
  exports.Dialog = Dialog;
22283
+ exports.DonutChart = DonutChart;
20817
22284
  exports.Drawer = Drawer;
20818
22285
  exports.Field = Field;
20819
22286
  exports.Form = Form;
@@ -20825,6 +22292,7 @@ exports.Icon = Icon;
20825
22292
  exports.IconButton = IconButton;
20826
22293
  exports.Input = Input;
20827
22294
  exports.Layout = Layout$1;
22295
+ exports.LineChart = LineChart;
20828
22296
  exports.List = List$1;
20829
22297
  exports.Listbox = Listbox;
20830
22298
  exports.LocalizationContext = LocalizationContext;