@economic/taco 2.47.0-server.4 → 2.47.0-server.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (662) hide show
  1. package/dist/components/Icon/components/Autopay.d.ts +3 -0
  2. package/dist/components/Icon/components/AutopayPaused.d.ts +3 -0
  3. package/dist/components/Icon/components/Person.d.ts +3 -0
  4. package/dist/components/Icon/components/PersonSolid.d.ts +3 -0
  5. package/dist/components/Icon/components/Wallet.d.ts +3 -0
  6. package/dist/components/Icon/components/index.d.ts +1 -1
  7. package/dist/components/Input/Input.d.ts +1 -1
  8. package/dist/components/Menu/components/Item.d.ts +1 -1
  9. package/dist/components/Menu/components/Link.d.ts +1 -1
  10. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  11. package/dist/components/Select2/components/Option.d.ts +2 -2
  12. package/dist/components/Select2/components/Search.d.ts +1 -1
  13. package/dist/components/Tag/Tag.d.ts +1 -1
  14. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +32 -0
  15. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  16. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js +32 -24
  17. package/dist/esm/packages/taco/src/charts/components/Area/AreaChart.js.map +1 -1
  18. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js +84 -61
  19. package/dist/esm/packages/taco/src/charts/components/Bar/BarChart.js.map +1 -1
  20. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js +16 -15
  21. package/dist/esm/packages/taco/src/charts/components/Donut/ActiveShape.js.map +1 -1
  22. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js +12 -13
  23. package/dist/esm/packages/taco/src/charts/components/Donut/CenteredLabel.js.map +1 -1
  24. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js +104 -68
  25. package/dist/esm/packages/taco/src/charts/components/Donut/DonutChart.js.map +1 -1
  26. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js +38 -29
  27. package/dist/esm/packages/taco/src/charts/components/Donut/Legend.js.map +1 -1
  28. package/dist/esm/packages/taco/src/charts/components/Donut/util.js +2 -2
  29. package/dist/esm/packages/taco/src/charts/components/Donut/util.js.map +1 -1
  30. package/dist/esm/packages/taco/src/charts/components/Legend.js +45 -37
  31. package/dist/esm/packages/taco/src/charts/components/Legend.js.map +1 -1
  32. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js +32 -24
  33. package/dist/esm/packages/taco/src/charts/components/Line/LineChart.js.map +1 -1
  34. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js +5 -3
  35. package/dist/esm/packages/taco/src/charts/components/ResponsiveContainer.js.map +1 -1
  36. package/dist/esm/packages/taco/src/charts/components/Tooltip.js +26 -25
  37. package/dist/esm/packages/taco/src/charts/components/Tooltip.js.map +1 -1
  38. package/dist/esm/packages/taco/src/charts/utils/color.js +13 -12
  39. package/dist/esm/packages/taco/src/charts/utils/color.js.map +1 -1
  40. package/dist/esm/packages/taco/src/charts/utils/common.js +39 -26
  41. package/dist/esm/packages/taco/src/charts/utils/common.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +30 -31
  43. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Alert/Alert.js +7 -9
  45. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js +14 -13
  47. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/AlertDialog/Context.js +2 -2
  49. package/dist/esm/packages/taco/src/components/AlertDialog/Context.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +10 -9
  51. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/AlertDialog/components/Footer.js +4 -4
  53. package/dist/esm/packages/taco/src/components/AlertDialog/components/Footer.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/AlertDialog/components/Trigger.js +5 -6
  55. package/dist/esm/packages/taco/src/components/AlertDialog/components/Trigger.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +2 -2
  57. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Badge/Badge.js +21 -25
  59. package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +12 -14
  61. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Banner/Banner.js +7 -10
  63. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  64. package/dist/esm/packages/taco/src/components/Banner/util.js +3 -3
  65. package/dist/esm/packages/taco/src/components/Banner/util.js.map +1 -1
  66. package/dist/esm/packages/taco/src/components/Button/Button.js +28 -29
  67. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Button/util.js +25 -24
  69. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  70. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +75 -71
  71. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/Card/Card.js +14 -15
  73. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +24 -22
  75. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +21 -23
  77. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  78. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +76 -64
  79. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  80. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +60 -57
  81. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  82. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +27 -28
  83. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  84. package/dist/esm/packages/taco/src/components/Dialog/Context.js +4 -4
  85. package/dist/esm/packages/taco/src/components/Dialog/Context.js.map +1 -1
  86. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js +54 -39
  87. package/dist/esm/packages/taco/src/components/Dialog/Dialog.js.map +1 -1
  88. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +36 -38
  89. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  90. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js +3 -3
  91. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js +2 -2
  93. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Dialog/components/Trigger.js +5 -6
  95. package/dist/esm/packages/taco/src/components/Dialog/components/Trigger.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Dialog/util.js +7 -3
  97. package/dist/esm/packages/taco/src/components/Dialog/util.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Drawer/Context.js +5 -5
  99. package/dist/esm/packages/taco/src/components/Drawer/Context.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +61 -51
  101. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  102. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +134 -145
  103. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js +1 -1
  105. package/dist/esm/packages/taco/src/components/Drawer/components/Trigger.js.map +1 -1
  106. package/dist/esm/packages/taco/src/components/Drawer/util.js +5 -5
  107. package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Field/Field.js +14 -12
  109. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  110. package/dist/esm/packages/taco/src/components/Form/Form.js +7 -6
  111. package/dist/esm/packages/taco/src/components/Form/Form.js.map +1 -1
  112. package/dist/esm/packages/taco/src/components/Group/Group.js +9 -7
  113. package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
  114. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +37 -36
  115. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  116. package/dist/esm/packages/taco/src/components/Header/Header.js +2 -2
  117. package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js +14 -10
  119. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Badge.js +5 -4
  121. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Badge.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +7 -9
  123. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +9 -9
  125. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +66 -46
  127. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Header/components/Button.js +12 -8
  129. package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Header/components/Link.js +22 -18
  131. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Header/components/Logo.js +4 -4
  133. package/dist/esm/packages/taco/src/components/Header/components/Logo.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +2 -2
  135. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +10 -9
  137. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +2 -2
  139. package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js +5 -7
  141. package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js +1 -1
  143. package/dist/esm/packages/taco/src/components/HoverCard/Primitives.js.map +1 -1
  144. package/dist/esm/packages/taco/src/components/Icon/Icon.js +7 -7
  145. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  146. package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js +19 -0
  147. package/dist/esm/packages/taco/src/components/Icon/components/Autopay.js.map +1 -0
  148. package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js +19 -0
  149. package/dist/esm/packages/taco/src/components/Icon/components/AutopayPaused.js.map +1 -0
  150. package/dist/esm/packages/taco/src/components/Icon/components/Person.js +19 -0
  151. package/dist/esm/packages/taco/src/components/Icon/components/Person.js.map +1 -0
  152. package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js +19 -0
  153. package/dist/esm/packages/taco/src/components/Icon/components/PersonSolid.js.map +1 -0
  154. package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js +19 -0
  155. package/dist/esm/packages/taco/src/components/Icon/components/Wallet.js.map +1 -0
  156. package/dist/esm/packages/taco/src/components/Icon/components/index.js +14 -4
  157. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  158. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js +22 -23
  159. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
  160. package/dist/esm/packages/taco/src/components/Input/Input.js +45 -44
  161. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  162. package/dist/esm/packages/taco/src/components/Input/util.js +8 -5
  163. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Layout/Layout.js +7 -5
  165. package/dist/esm/packages/taco/src/components/Layout/Layout.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Layout/components/Content.js +2 -2
  167. package/dist/esm/packages/taco/src/components/Layout/components/Content.js.map +1 -1
  168. package/dist/esm/packages/taco/src/components/Layout/components/Context.js +4 -2
  169. package/dist/esm/packages/taco/src/components/Layout/components/Context.js.map +1 -1
  170. package/dist/esm/packages/taco/src/components/Layout/components/Page.js +2 -2
  171. package/dist/esm/packages/taco/src/components/Layout/components/Page.js.map +1 -1
  172. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +34 -27
  173. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  174. package/dist/esm/packages/taco/src/components/Layout/components/Top.js +9 -6
  175. package/dist/esm/packages/taco/src/components/Layout/components/Top.js.map +1 -1
  176. package/dist/esm/packages/taco/src/components/List/components/Button.js +1 -1
  177. package/dist/esm/packages/taco/src/components/List/components/Button.js.map +1 -1
  178. package/dist/esm/packages/taco/src/components/List/components/Collapsible.js +10 -7
  179. package/dist/esm/packages/taco/src/components/List/components/Collapsible.js.map +1 -1
  180. package/dist/esm/packages/taco/src/components/List/components/Group.js +1 -1
  181. package/dist/esm/packages/taco/src/components/List/components/Group.js.map +1 -1
  182. package/dist/esm/packages/taco/src/components/List/components/Item.js +15 -13
  183. package/dist/esm/packages/taco/src/components/List/components/Item.js.map +1 -1
  184. package/dist/esm/packages/taco/src/components/List/components/Link.js +3 -3
  185. package/dist/esm/packages/taco/src/components/List/components/Link.js.map +1 -1
  186. package/dist/esm/packages/taco/src/components/List/components/Toggle.js +29 -27
  187. package/dist/esm/packages/taco/src/components/List/components/Toggle.js.map +1 -1
  188. package/dist/esm/packages/taco/src/components/Listbox/Listbox.js +21 -26
  189. package/dist/esm/packages/taco/src/components/Listbox/Listbox.js.map +1 -1
  190. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +82 -70
  191. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  192. package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +56 -51
  193. package/dist/esm/packages/taco/src/components/Listbox/useListbox.js.map +1 -1
  194. package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +83 -65
  195. package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js.map +1 -1
  196. package/dist/esm/packages/taco/src/components/Listbox/useTypeahead.js +9 -10
  197. package/dist/esm/packages/taco/src/components/Listbox/useTypeahead.js.map +1 -1
  198. package/dist/esm/packages/taco/src/components/Listbox/util.js +78 -48
  199. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  200. package/dist/esm/packages/taco/src/components/Menu/Context.js +2 -2
  201. package/dist/esm/packages/taco/src/components/Menu/Context.js.map +1 -1
  202. package/dist/esm/packages/taco/src/components/Menu/Menu.js +42 -26
  203. package/dist/esm/packages/taco/src/components/Menu/Menu.js.map +1 -1
  204. package/dist/esm/packages/taco/src/components/Menu/components/Checkbox.js +8 -8
  205. package/dist/esm/packages/taco/src/components/Menu/components/Checkbox.js.map +1 -1
  206. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +27 -21
  207. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  208. package/dist/esm/packages/taco/src/components/Menu/components/Header.js +3 -3
  209. package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
  210. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +32 -32
  211. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  212. package/dist/esm/packages/taco/src/components/Menu/components/Link.js +10 -10
  213. package/dist/esm/packages/taco/src/components/Menu/components/Link.js.map +1 -1
  214. package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js +15 -16
  215. package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js.map +1 -1
  216. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js +1 -1
  217. package/dist/esm/packages/taco/src/components/Menu/components/Separator.js.map +1 -1
  218. package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js +7 -7
  219. package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js.map +1 -1
  220. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +5 -5
  221. package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js.map +1 -1
  222. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +6 -6
  223. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  224. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +41 -36
  225. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  226. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +6 -6
  227. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -1
  228. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +6 -6
  229. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js.map +1 -1
  230. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js +14 -11
  231. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js.map +1 -1
  232. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +31 -24
  233. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  234. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +7 -7
  235. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  236. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js +9 -7
  237. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -1
  238. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +48 -51
  239. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  240. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +26 -23
  241. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
  242. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +53 -39
  243. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  244. package/dist/esm/packages/taco/src/components/Pagination/usePagination.js +17 -7
  245. package/dist/esm/packages/taco/src/components/Pagination/usePagination.js.map +1 -1
  246. package/dist/esm/packages/taco/src/components/Pagination/usePaginationShortcuts.js +8 -9
  247. package/dist/esm/packages/taco/src/components/Pagination/usePaginationShortcuts.js.map +1 -1
  248. package/dist/esm/packages/taco/src/components/Popover/Popover.js +45 -43
  249. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  250. package/dist/esm/packages/taco/src/components/Popover/Primitives.js +1 -1
  251. package/dist/esm/packages/taco/src/components/Popover/Primitives.js.map +1 -1
  252. package/dist/esm/packages/taco/src/components/Popover/util.js +3 -1
  253. package/dist/esm/packages/taco/src/components/Popover/util.js.map +1 -1
  254. package/dist/esm/packages/taco/src/components/Progress/Progress.js +13 -11
  255. package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
  256. package/dist/esm/packages/taco/src/components/Provider/Localization.js +13 -12
  257. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  258. package/dist/esm/packages/taco/src/components/Provider/Provider.js +8 -8
  259. package/dist/esm/packages/taco/src/components/Provider/Provider.js.map +1 -1
  260. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +54 -47
  261. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  262. package/dist/esm/packages/taco/src/components/RadioGroup/util.js +7 -1
  263. package/dist/esm/packages/taco/src/components/RadioGroup/util.js.map +1 -1
  264. package/dist/esm/packages/taco/src/components/Report/Report.js +7 -5
  265. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
  266. package/dist/esm/packages/taco/src/components/Report/useReport.js +1 -1
  267. package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -1
  268. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +17 -13
  269. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  270. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +11 -11
  271. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  272. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +44 -39
  273. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  274. package/dist/esm/packages/taco/src/components/Select/Select.js +28 -31
  275. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  276. package/dist/esm/packages/taco/src/components/Select/useSelect.js +79 -70
  277. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  278. package/dist/esm/packages/taco/src/components/Select2/Select2.js +154 -121
  279. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  280. package/dist/esm/packages/taco/src/components/Select2/components/Collection.js +2 -4
  281. package/dist/esm/packages/taco/src/components/Select2/components/Collection.js.map +1 -1
  282. package/dist/esm/packages/taco/src/components/Select2/components/Context.js +4 -2
  283. package/dist/esm/packages/taco/src/components/Select2/components/Context.js.map +1 -1
  284. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +45 -41
  285. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  286. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +145 -129
  287. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  288. package/dist/esm/packages/taco/src/components/Select2/components/Group.js +8 -8
  289. package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
  290. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +29 -30
  291. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  292. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +9 -10
  293. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  294. package/dist/esm/packages/taco/src/components/Select2/components/Title.js +2 -2
  295. package/dist/esm/packages/taco/src/components/Select2/components/Title.js.map +1 -1
  296. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +136 -128
  297. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  298. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +32 -23
  299. package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
  300. package/dist/esm/packages/taco/src/components/Select2/utilities.js +13 -6
  301. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  302. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +16 -13
  303. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  304. package/dist/esm/packages/taco/src/components/Spinner/Spinner.js +17 -12
  305. package/dist/esm/packages/taco/src/components/Spinner/Spinner.js.map +1 -1
  306. package/dist/esm/packages/taco/src/components/Switch/Switch.js +14 -14
  307. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  308. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +28 -23
  309. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  310. package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js +7 -3
  311. package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js.map +1 -1
  312. package/dist/esm/packages/taco/src/components/Table/components/Table.js +22 -18
  313. package/dist/esm/packages/taco/src/components/Table/components/Table.js.map +1 -1
  314. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +100 -92
  315. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  316. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +136 -118
  317. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  318. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js +55 -55
  319. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowDraggable.js.map +1 -1
  320. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js +35 -41
  321. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowEditing.js.map +1 -1
  322. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js +77 -71
  323. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowSelect.js.map +1 -1
  324. package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js +56 -30
  325. package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js.map +1 -1
  326. package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js +151 -142
  327. package/dist/esm/packages/taco/src/components/Table/hooks/useTable.js.map +1 -1
  328. package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js +22 -20
  329. package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js.map +1 -1
  330. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +9 -12
  331. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  332. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +41 -41
  333. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  334. package/dist/esm/packages/taco/src/components/Table/util/rowIndexPath.js +16 -14
  335. package/dist/esm/packages/taco/src/components/Table/util/rowIndexPath.js.map +1 -1
  336. package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js +32 -26
  337. package/dist/esm/packages/taco/src/components/Table/util/sortTypes.js.map +1 -1
  338. package/dist/esm/packages/taco/src/components/Table/util.js +37 -30
  339. package/dist/esm/packages/taco/src/components/Table/util.js.map +1 -1
  340. package/dist/esm/packages/taco/src/components/Table3/Table3.js +12 -10
  341. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  342. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Cell.js +13 -14
  343. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Cell.js.map +1 -1
  344. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js +21 -23
  345. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  346. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js +20 -17
  347. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js.map +1 -1
  348. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +67 -73
  349. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  350. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingDisplayCell.js +2 -2
  351. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingDisplayCell.js.map +1 -1
  352. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +19 -20
  353. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
  354. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +26 -25
  355. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  356. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +45 -40
  357. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  358. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +7 -8
  359. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +1 -1
  360. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +18 -19
  361. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +1 -1
  362. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +7 -10
  363. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  364. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +38 -36
  365. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +1 -1
  366. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +15 -15
  367. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  368. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +8 -11
  369. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  370. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +164 -201
  371. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +1 -1
  372. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +40 -27
  373. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  374. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +18 -16
  375. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  376. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +25 -19
  377. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  378. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +29 -35
  379. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  380. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +34 -35
  381. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  382. package/dist/esm/packages/taco/src/components/Tag/Tag.js +12 -12
  383. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  384. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +8 -11
  385. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
  386. package/dist/esm/packages/taco/src/components/Toast/Toast.js +19 -20
  387. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  388. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +117 -96
  389. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  390. package/dist/esm/packages/taco/src/components/Toast/util.js +6 -4
  391. package/dist/esm/packages/taco/src/components/Toast/util.js.map +1 -1
  392. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +10 -9
  393. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  394. package/dist/esm/packages/taco/src/components/Tour/Tour.js +49 -46
  395. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  396. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +33 -27
  397. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  398. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js +15 -13
  399. package/dist/esm/packages/taco/src/components/Truncate/Truncate.js.map +1 -1
  400. package/dist/esm/packages/taco/src/components/VisuallyHidden/VisuallyHidden.js +1 -1
  401. package/dist/esm/packages/taco/src/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
  402. package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js +11 -6
  403. package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js.map +1 -1
  404. package/dist/esm/packages/taco/src/hooks/useBoundingClientRectListener.js +19 -13
  405. package/dist/esm/packages/taco/src/hooks/useBoundingClientRectListener.js.map +1 -1
  406. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js +4 -4
  407. package/dist/esm/packages/taco/src/hooks/useGlobalKeyDown.js.map +1 -1
  408. package/dist/esm/packages/taco/src/hooks/useId.js +4 -2
  409. package/dist/esm/packages/taco/src/hooks/useId.js.map +1 -1
  410. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js +20 -18
  411. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  412. package/dist/esm/packages/taco/src/hooks/useIsFormControl.js +7 -5
  413. package/dist/esm/packages/taco/src/hooks/useIsFormControl.js.map +1 -1
  414. package/dist/esm/packages/taco/src/hooks/useIsHoverStatePaused.js +9 -5
  415. package/dist/esm/packages/taco/src/hooks/useIsHoverStatePaused.js.map +1 -1
  416. package/dist/esm/packages/taco/src/hooks/useIsLargeScreen.js +3 -1
  417. package/dist/esm/packages/taco/src/hooks/useIsLargeScreen.js.map +1 -1
  418. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js +2 -2
  419. package/dist/esm/packages/taco/src/hooks/useLazyEffect.js.map +1 -1
  420. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js +24 -22
  421. package/dist/esm/packages/taco/src/hooks/useLocalStorage.js.map +1 -1
  422. package/dist/esm/packages/taco/src/hooks/useMatchMedia.js +13 -6
  423. package/dist/esm/packages/taco/src/hooks/useMatchMedia.js.map +1 -1
  424. package/dist/esm/packages/taco/src/hooks/useMergedRef.js +3 -3
  425. package/dist/esm/packages/taco/src/hooks/useMergedRef.js.map +1 -1
  426. package/dist/esm/packages/taco/src/hooks/usePrevious.js +2 -2
  427. package/dist/esm/packages/taco/src/hooks/usePrevious.js.map +1 -1
  428. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js +14 -14
  429. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
  430. package/dist/esm/packages/taco/src/primitives/Button.js +16 -13
  431. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  432. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js +50 -44
  433. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  434. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Context.js +4 -2
  435. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Context.js.map +1 -1
  436. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Group.js +9 -5
  437. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Group.js.map +1 -1
  438. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js +16 -18
  439. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
  440. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js +47 -40
  441. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
  442. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Title.js +9 -10
  443. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Title.js.map +1 -1
  444. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js +22 -20
  445. package/dist/esm/packages/taco/src/primitives/Sortable/components/Container.js.map +1 -1
  446. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js +24 -27
  447. package/dist/esm/packages/taco/src/primitives/Sortable/components/Item.js.map +1 -1
  448. package/dist/esm/packages/taco/src/primitives/Sortable/components/List.js +11 -10
  449. package/dist/esm/packages/taco/src/primitives/Sortable/components/List.js.map +1 -1
  450. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +22 -19
  451. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  452. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js +25 -22
  453. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/Body.js.map +1 -1
  454. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js +6 -6
  455. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/EmptyStateBody.js.map +1 -1
  456. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js +30 -14
  457. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Body/util.js.map +1 -1
  458. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js +18 -19
  459. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js.map +1 -1
  460. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +34 -34
  461. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  462. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/Cell.js +10 -12
  463. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/Cell.js.map +1 -1
  464. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js +19 -18
  465. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js.map +1 -1
  466. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +42 -40
  467. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  468. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js +5 -7
  469. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Drag.js.map +1 -1
  470. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js +19 -24
  471. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Expansion.js.map +1 -1
  472. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +56 -55
  473. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  474. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +27 -23
  475. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  476. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js +13 -16
  477. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Summary.js.map +1 -1
  478. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +86 -87
  479. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  480. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js +14 -11
  481. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  482. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +85 -58
  483. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  484. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js +18 -20
  485. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Resizer.js.map +1 -1
  486. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js +3 -3
  487. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/SortIndicator.js.map +1 -1
  488. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js +11 -6
  489. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/util.js.map +1 -1
  490. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +58 -49
  491. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  492. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +28 -32
  493. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  494. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js +34 -29
  495. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/Row.js.map +1 -1
  496. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js +1 -1
  497. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/RowContext.js.map +1 -1
  498. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js +11 -11
  499. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js.map +1 -1
  500. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js +1 -1
  501. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/FilterContext.js.map +1 -1
  502. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js +23 -22
  503. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  504. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +54 -39
  505. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  506. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js +39 -37
  507. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/Filter.js.map +1 -1
  508. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +20 -16
  509. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  510. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +16 -15
  511. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
  512. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +50 -41
  513. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  514. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js +13 -9
  515. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js.map +1 -1
  516. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +57 -51
  517. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  518. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js +71 -67
  519. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js.map +1 -1
  520. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +40 -37
  521. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  522. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js +64 -44
  523. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  524. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js +62 -51
  525. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  526. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js +6 -6
  527. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableGlobalShortcuts.js.map +1 -1
  528. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRef.js +13 -5
  529. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRef.js.map +1 -1
  530. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +93 -77
  531. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  532. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyle.js +15 -15
  533. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyle.js.map +1 -1
  534. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js +31 -41
  535. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
  536. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +31 -30
  537. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
  538. package/dist/esm/packages/taco/src/primitives/Table/Core/listeners/useTableRowActiveListener.js +3 -3
  539. package/dist/esm/packages/taco/src/primitives/Table/Core/listeners/useTableRowActiveListener.js.map +1 -1
  540. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js +14 -15
  541. package/dist/esm/packages/taco/src/primitives/Table/Core/useTable.js.map +1 -1
  542. package/dist/esm/packages/taco/src/primitives/Table/Core/util/rows.js +2 -2
  543. package/dist/esm/packages/taco/src/primitives/Table/Core/util/rows.js.map +1 -1
  544. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +42 -36
  545. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  546. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js +67 -74
  547. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader2.js.map +1 -1
  548. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnFreezing.js +11 -6
  549. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnFreezing.js.map +1 -1
  550. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnOrdering.js +5 -2
  551. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableColumnOrdering.js.map +1 -1
  552. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFontSize.js +15 -5
  553. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFontSize.js.map +1 -1
  554. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFooter.js +5 -2
  555. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableFooter.js.map +1 -1
  556. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js +26 -16
  557. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -1
  558. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js +9 -3
  559. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActions.js.map +1 -1
  560. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js +42 -23
  561. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowActive.js.map +1 -1
  562. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js +9 -6
  563. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowClick.js.map +1 -1
  564. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrag.js +9 -4
  565. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrag.js.map +1 -1
  566. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrop.js +5 -2
  567. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowDrop.js.map +1 -1
  568. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js +9 -3
  569. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowExpansion.js.map +1 -1
  570. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGoto.js +5 -2
  571. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGoto.js.map +1 -1
  572. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGroups.js +1 -1
  573. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowGroups.js.map +1 -1
  574. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowHeight.js +15 -5
  575. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowHeight.js.map +1 -1
  576. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js +14 -9
  577. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableRowSelection.js.map +1 -1
  578. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js +25 -13
  579. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSearch.js.map +1 -1
  580. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js +43 -24
  581. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableServerLoading.js.map +1 -1
  582. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js +34 -24
  583. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  584. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js +4 -4
  585. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableDataListener.js.map +1 -1
  586. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js +3 -3
  587. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFilterListener.js.map +1 -1
  588. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +18 -16
  589. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  590. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowHeightListener.js +2 -2
  591. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowHeightListener.js.map +1 -1
  592. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js +6 -4
  593. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableRowSelectionListener.js.map +1 -1
  594. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +8 -8
  595. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  596. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +6 -6
  597. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  598. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js +8 -6
  599. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSettingsListener.js.map +1 -1
  600. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js +17 -17
  601. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableShortcutsListener.js.map +1 -1
  602. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSortingListener.js +2 -2
  603. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSortingListener.js.map +1 -1
  604. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +55 -55
  605. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  606. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +59 -30
  607. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  608. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js +4 -4
  609. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/dataTypes.js.map +1 -1
  610. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js +33 -19
  611. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/filtering.js.map +1 -1
  612. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js +11 -11
  613. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/presets.js.map +1 -1
  614. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js +21 -19
  615. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/search.js.map +1 -1
  616. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +6 -7
  617. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  618. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +138 -106
  619. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  620. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js +3 -1
  621. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/sorting.js.map +1 -1
  622. package/dist/esm/packages/taco/src/types.js +1 -1
  623. package/dist/esm/packages/taco/src/types.js.map +1 -1
  624. package/dist/esm/packages/taco/src/utils/aria.js +2 -2
  625. package/dist/esm/packages/taco/src/utils/aria.js.map +1 -1
  626. package/dist/esm/packages/taco/src/utils/date.js +47 -23
  627. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  628. package/dist/esm/packages/taco/src/utils/debounce.js +10 -4
  629. package/dist/esm/packages/taco/src/utils/debounce.js.map +1 -1
  630. package/dist/esm/packages/taco/src/utils/device.js +4 -2
  631. package/dist/esm/packages/taco/src/utils/device.js.map +1 -1
  632. package/dist/esm/packages/taco/src/utils/dom.js +26 -20
  633. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  634. package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js +40 -38
  635. package/dist/esm/packages/taco/src/utils/hooks/useDraggable.js.map +1 -1
  636. package/dist/esm/packages/taco/src/utils/hooks/useDropTarget.js +9 -7
  637. package/dist/esm/packages/taco/src/utils/hooks/useDropTarget.js.map +1 -1
  638. package/dist/esm/packages/taco/src/utils/hooks/useListKeyboardNavigation.js +20 -9
  639. package/dist/esm/packages/taco/src/utils/hooks/useListKeyboardNavigation.js.map +1 -1
  640. package/dist/esm/packages/taco/src/utils/hooks/useListScrollTo.js +9 -9
  641. package/dist/esm/packages/taco/src/utils/hooks/useListScrollTo.js.map +1 -1
  642. package/dist/esm/packages/taco/src/utils/hooks/useOnClickOutside.js +8 -6
  643. package/dist/esm/packages/taco/src/utils/hooks/useOnClickOutside.js.map +1 -1
  644. package/dist/esm/packages/taco/src/utils/hooks/useTimer.js +16 -11
  645. package/dist/esm/packages/taco/src/utils/hooks/useTimer.js.map +1 -1
  646. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js +11 -6
  647. package/dist/esm/packages/taco/src/utils/hooks/useTruncated.js.map +1 -1
  648. package/dist/esm/packages/taco/src/utils/input.js +10 -7
  649. package/dist/esm/packages/taco/src/utils/input.js.map +1 -1
  650. package/dist/esm/packages/taco/src/utils/keyboard.js +8 -5
  651. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  652. package/dist/esm/packages/taco/src/utils/mergeRefs.js +2 -2
  653. package/dist/esm/packages/taco/src/utils/mergeRefs.js.map +1 -1
  654. package/dist/esm/packages/taco/src/utils/tailwind.js +5 -5
  655. package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -1
  656. package/dist/esm/packages/taco/tailwind.colors.js +1 -1
  657. package/dist/esm/packages/taco/tailwind.colors.js.map +1 -1
  658. package/dist/taco.cjs.development.js +7857 -6877
  659. package/dist/taco.cjs.development.js.map +1 -1
  660. package/dist/taco.cjs.production.min.js +1 -1
  661. package/dist/taco.cjs.production.min.js.map +1 -1
  662. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useEditingState.js","sources":["../../../../../../../../src/components/Table3/features/useEditingState.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, Cell as ReactTableCell } from '@tanstack/react-table';\nimport { v4 as uuid } from 'uuid';\nimport omit from 'lodash/omit';\nimport setWith from 'lodash/setWith';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { isTemporaryRow, TEMPORARY_ROW_ID_PREFIX, willRowMove } from '../util/editing';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst DELAY_BEFORE_REMOVING_SAVE_STATUS = 3000;\n\ntype EditingError = {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n};\ntype EditingRowMoveReason = Record<string, 'search' | 'sorting' | 'filter'>;\ntype EditingSaveState = 'saving' | 'saved' | 'errored';\ntype EditingChangeset<TType = unknown> = Partial<TType>;\ntype EditingState<TType = unknown> = {\n changes: {\n rows: Record<string, EditingChangeset<TType>>;\n errors: Record<string, EditingError>;\n moveReasons: Record<string, EditingRowMoveReason>;\n originals: Record<string, TType>;\n status: Record<string, EditingSaveState>;\n };\n indexes: Record<string, number>;\n temporaryRows: TType[];\n};\ntype EditingStateAction = {\n type:\n | 'setCellValue'\n | 'removeCellValue'\n | 'updateRow'\n | 'mergeRowValue'\n | 'removeRow'\n | 'setRowStatus'\n | 'setRowErrors'\n | 'insertTemporaryRow';\n rowId: string;\n payload?: any;\n};\n\nfunction reducer<TType = unknown>(state: EditingState<TType>, action: EditingStateAction) {\n const { type, rowId, payload } = action;\n\n switch (type) {\n case 'setCellValue': {\n const { columnId, index, row, value } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),\n originals: setWith(state.changes.originals, rowId, row, Object),\n },\n indexes: setWith(state.indexes, rowId, index, Object),\n };\n }\n\n case 'removeCellValue': {\n const { columnId, rowIdentityAccessor } = payload;\n const changes = omit(state.changes.rows, `${rowId}.${columnId}`);\n\n // if there are no changes left, remove the row\n if (!Object.keys(changes[rowId]).length) {\n return reducer(state, { type: 'removeRow', rowId, payload: { rowIdentityAccessor } });\n }\n\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: omit(state.changes.rows, `${rowId}.${columnId}`),\n errors: omit(state.changes.errors, `${rowId}.cells.${columnId}`),\n moveReasons: omit(state.changes.moveReasons, `${rowId}.${columnId}`),\n },\n };\n }\n\n case 'updateRow': {\n const { cellErrors, index, moveReasons, original, value } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, rowId, value, Object),\n errors: setWith(\n state.changes.errors,\n `${rowId}.cells`,\n cellErrors ?? state.changes.errors.cells[rowId],\n Object\n ),\n originals: setWith(state.changes.originals, rowId, original ?? state.changes.originals[rowId], Object),\n moveReasons: setWith(\n state.changes.moveReasons,\n rowId,\n moveReasons ?? state.changes.moveReasons[rowId],\n Object\n ),\n // status can be undefined, so don't use ??\n status: setWith(state.changes.status, rowId, undefined, Object),\n },\n indexes: setWith(state.indexes, rowId, index, Object),\n };\n }\n\n case 'removeRow': {\n const { rowIdentityAccessor } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: omit(state.changes.rows, rowId),\n errors: omit(state.changes.errors, rowId),\n moveReasons: omit(state.changes.moveReasons, rowId),\n originals: omit(state.changes.originals, rowId),\n status: omit(state.changes.status, rowId),\n },\n indexes: omit(state.indexes, rowId),\n temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId),\n };\n }\n\n case 'setRowStatus': {\n const { status } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n status: status ? setWith(state.changes.status, rowId, status, Object) : omit(state.changes.status, rowId),\n },\n };\n }\n\n case 'setRowErrors': {\n const { ...errors } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n errors: setWith(state.changes.errors, rowId, errors, Object),\n },\n };\n }\n\n case 'insertTemporaryRow': {\n const { index, value } = payload;\n return {\n ...state,\n temporaryRows: state.temporaryRows.concat(value),\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, rowId, value, Object),\n originals: setWith(state.changes.originals, rowId, value, Object),\n },\n indexes: setWith(state.indexes, rowId, index, Object),\n };\n }\n\n default:\n return state;\n }\n}\n\nexport function usePendingChangesState<TType = unknown>(\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n rowIdentityAccessor: keyof TType,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [state, dispatch] = React.useReducer(reducer, {\n changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, status: {} },\n indexes: {},\n temporaryRows: [],\n });\n\n // rows\n function getRowValue(rowId: string) {\n return state.changes.rows?.[rowId] ?? undefined;\n }\n\n function getRowMoveReason(rowId: string) {\n return Object.values(state.changes.moveReasons?.[rowId] ?? {})[0] ?? undefined;\n }\n\n function hasRowErrors(rowId: string) {\n return !!state.changes.errors[rowId]?.row || !!Object.keys(state.changes.errors[rowId]?.cells ?? {}).length;\n }\n\n function hasRowErrorsShownInAlert(rowId: string) {\n return hasRowErrors(rowId) && !!state.changes.errors[rowId]?.shouldShowErrorAlert;\n }\n\n function hasTemporaryRowErrors<T extends TType>() {\n const newRow = state.temporaryRows?.[0] as T | undefined;\n\n if (!newRow) {\n return false;\n }\n\n const rowId = newRow[rowIdentityAccessor as string];\n return !!state.changes.errors[rowId]?.row || !!Object.keys(state.changes.errors[rowId]?.cells ?? {}).length;\n }\n\n function getRowStatus(rowId: string) {\n return state.changes.status[rowId];\n }\n\n function setRowStatus(rowId: string, status: EditingSaveState | undefined) {\n dispatch({\n type: 'setRowStatus',\n rowId,\n payload: {\n status,\n },\n });\n }\n\n function insertTemporaryRow<T extends TType>(data: Partial<T>, rowIndex: number) {\n const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid()}`;\n const value: Partial<TType> = {\n ...data,\n [rowIdentityAccessor]: newRowId,\n };\n\n dispatch({\n type: 'insertTemporaryRow',\n rowId: newRowId,\n payload: { index: rowIndex, value },\n });\n\n return newRowId;\n }\n\n // cells\n function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, rowIndex: number, value: unknown) {\n const rowId = cell.row.id;\n const columnId = cell.column.id;\n\n // update if the change is different to the original value\n if (value !== cell.row.original[columnId]) {\n dispatch({\n type: 'setCellValue',\n rowId,\n payload: {\n columnId,\n index: rowIndex,\n row: cell.row.original,\n value,\n },\n });\n }\n // otherwise remove any previous change - no point saving the same value\n else if (cell.row.id in state.changes.rows) {\n dispatch({\n type: 'removeCellValue',\n rowId,\n payload: {\n columnId,\n rowIdentityAccessor,\n },\n });\n }\n }\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return state.changes.rows?.[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return state.changes.errors?.[cell.row.id]?.cells?.[cell.column.id];\n }\n\n async function onCellChanged<T extends TType>(cell: ReactTableCell<T, unknown>, rowIndex: number, shouldRunUpdaters = true) {\n const changes = state.changes.rows[cell.row.id];\n\n if (!changes) {\n return;\n }\n\n let updatesForOtherCells: Partial<T> = {};\n\n // run the updater handler if there is one, to see if there are any other cells to update\n if (typeof handleChange === 'function' && shouldRunUpdaters) {\n const previousRowValue = {\n ...state.changes.originals[cell.row.id],\n //...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),\n };\n const nextRowValue = {\n ...state.changes.originals[cell.row.id],\n ...changes,\n };\n updatesForOtherCells = ((await handleChange(\n cell.column.id,\n changes[cell.column.id],\n nextRowValue,\n previousRowValue\n )) ?? {}) as Partial<T>;\n }\n\n // create a projection of the next state, so we can act against it\n const nextChanges = { ...state.changes.rows[cell.row.id], ...updatesForOtherCells };\n const nextMoveReasons: EditingRowMoveReason = { ...state.changes.moveReasons[cell.row.id] };\n const nextCellErrors: Record<string, string> = { ...state.changes.errors[cell.row.id]?.cells };\n\n // run validation\n let validationErrors: Record<string, string> = {};\n\n if (validator) {\n const nextRowValue = { ...state.changes.originals[cell.row.id], ...changes, ...updatesForOtherCells };\n validationErrors = ((await validator(nextRowValue)) ?? {}) as Record<string, string>;\n }\n\n // only set errors and move reasons for the cells we're currently acting on\n // why? because the UX is not good if we set them for cells the user hasn't touched yet\n const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];\n const allCells = cell.row._getAllCellsByColumnId();\n\n cellsToActOn.forEach(accessor => {\n if (validationErrors[accessor]) {\n nextCellErrors[accessor] = validationErrors[accessor];\n // don't show move indicator for cells with errors, they aren't valid and can't be saved\n delete nextMoveReasons[accessor];\n } else {\n // there isn't any error in this run, remove any error set in state\n delete nextCellErrors[accessor];\n\n if (allCells[accessor]?.column.getIsSorted()) {\n // run row move determination\n const reason = willRowMove(cell, nextChanges[accessor], rowIndex, localization);\n\n // if the row will move based on this change save why, otherwise delete any existing state\n if (reason) {\n nextMoveReasons[accessor] = reason;\n } else {\n delete nextMoveReasons[accessor];\n }\n }\n }\n });\n\n dispatch({\n type: 'updateRow',\n rowId: cell.row.id,\n payload: {\n cellErrors: nextCellErrors,\n index: rowIndex,\n moveReasons: nextMoveReasons,\n value: nextChanges,\n },\n });\n }\n\n // general\n function getErrorsShownInAlert<T extends TType>() {\n const rowsWithErrors = Object.keys(state.changes.errors);\n\n if (!rowsWithErrors.length) {\n return [];\n }\n\n return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({\n rowId,\n index: state.indexes[rowId],\n changes: state.changes.rows[rowId] as EditingChangeset<T>,\n errors: state.changes.errors[rowId],\n }));\n }\n\n function hasSaved() {\n return !!Object.values(state.changes.status).filter(value => value === 'saved').length;\n }\n\n function hasChanges(rowId?: string) {\n return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;\n }\n\n async function saveChanges<T extends TType>(table: ReactTable<T>, rowId: string | undefined = undefined): Promise<boolean> {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return false;\n }\n\n // sometimes we only want to save one row\n const changes = rowId ? { [rowId]: state.changes.rows[rowId] } : state.changes.rows;\n\n let completed = true;\n\n for (const rowId of Object.keys(changes)) {\n const status = getRowStatus(rowId);\n\n try {\n // don't try to save if - already saving, or there are known errors\n if (status === 'saving' || status === 'errored') {\n continue;\n }\n\n setRowStatus(rowId, 'saving');\n\n const changeSet = { ...state.changes.originals[rowId], ...changes[rowId] };\n\n // if we had to create a temporary id, delete it first - it's our data, not theirs\n if (isTemporaryRow(changeSet[rowIdentityAccessor as string])) {\n delete changeSet[rowIdentityAccessor];\n }\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n discardChanges(rowId, table);\n\n // show the saved status, then remove it after a delay\n setRowStatus(rowId, 'saved');\n setTimeout(() => {\n setRowStatus(rowId, undefined);\n }, DELAY_BEFORE_REMOVING_SAVE_STATUS);\n } catch (error) {\n if (error instanceof ReferenceError || error instanceof TypeError || (error as any)?.response?.status >= 500) {\n console.error(error);\n }\n\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError: string | undefined;\n let cellErrors;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n dispatch({\n type: 'setRowErrors',\n rowId,\n payload: {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n },\n });\n }\n\n setRowStatus(rowId, 'errored');\n completed = false;\n }\n }\n\n return completed;\n }\n\n function discardChanges<T extends TType>(rowId: string, table: ReactTable<T>) {\n // remove any new rows from pinned state before discarding them\n table.resetRowPinning(true);\n\n dispatch({\n type: 'removeRow',\n rowId,\n payload: { rowIdentityAccessor },\n });\n }\n\n return {\n // row\n getRowValue,\n getRowMoveReason,\n hasRowErrors,\n hasRowErrorsShownInAlert,\n hasTemporaryRowErrors,\n getRowStatus,\n setRowStatus,\n // cells\n setCellValue,\n getCellValue,\n getCellError,\n onCellChanged,\n // general\n getErrorsShownInAlert,\n hasChanges,\n saveChanges,\n discardChanges,\n hasSaved,\n // new rows\n insertTemporaryRow,\n temporaryRows: state.temporaryRows,\n };\n}\n"],"names":["DELAY_BEFORE_REMOVING_SAVE_STATUS","reducer","state","action","type","rowId","payload","columnId","index","row","value","changes","rows","setWith","Object","originals","indexes","rowIdentityAccessor","omit","keys","length","errors","moveReasons","cellErrors","original","cells","status","undefined","temporaryRows","filter","concat","usePendingChangesState","handleSave","handleChange","validator","saveChanges","table","console","warn","Promise","resolve","completed","_temp7","_forOf","getRowStatus","_catch","_temp6","_result","_exit","changeSet","then","discardChanges","setRowStatus","setTimeout","isTemporaryRow","_temp5","error","_error$response","ReferenceError","TypeError","response","rowError","Error","_error$response2","message","data","_error$response3","dispatch","shouldShowErrorAlert","_result3","e","reject","onCellChanged","cell","rowIndex","shouldRunUpdaters","cellsToActOn","column","id","updatesForOtherCells","allCells","_getAllCellsByColumnId","forEach","accessor","validationErrors","nextCellErrors","nextMoveReasons","_allCells$accessor","getIsSorted","reason","willRowMove","nextChanges","localization","_state$changes$errors11","_temp","nextRowValue","_validator","_temp2","_temp3","previousRowValue","_handleChange","_temp4","useLocalization","React","useReducer","getRowValue","_state$changes$rows$r","_state$changes$rows","getRowMoveReason","_Object$values$","values","_state$changes$moveRe","_state$changes$moveRe2","hasRowErrors","_state$changes$errors","_state$changes$errors2","_state$changes$errors3","hasRowErrorsShownInAlert","_state$changes$errors4","hasTemporaryRowErrors","newRow","_state$temporaryRows","_state$changes$errors5","_state$changes$errors6","_state$changes$errors7","insertTemporaryRow","newRowId","TEMPORARY_ROW_ID_PREFIX","uuid","setCellValue","getCellValue","_state$changes$rows2","_state$changes$rows2$","getCellError","_state$changes$errors8","_state$changes$errors9","_state$changes$errors10","getErrorsShownInAlert","rowsWithErrors","map","hasSaved","hasChanges","resetRowPinning"],"mappings":";;;;;;;;AASA,MAAMA,iCAAiC,GAAG,IAAI;AAmC9C,SAASC,OAAOA,CAAkBC,KAA0B,EAAEC,MAA0B;EACpF,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC;GAAS,GAAGH,MAAM;EAEvC,QAAQC,IAAI;IACR,KAAK,cAAc;MAAE;QACjB,MAAM;UAAEG,QAAQ;UAAEC,KAAK;UAAEC,GAAG;UAAEC;SAAO,GAAGJ,OAAO;QAC/C,OAAO;UACH,GAAGJ,KAAK;UACRS,OAAO,EAAE;YACL,GAAGT,KAAK,CAACS,OAAO;YAChBC,IAAI,EAAEC,OAAO,CAACX,KAAK,CAACS,OAAO,CAACC,IAAI,EAAE,GAAGP,KAAK,IAAIE,QAAQ,EAAE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X,KAAK,CAAC;MAC3BM,OAAO,EAAET,KAAK,CAACS,OAAO,CAACC,IAAI,CAACP,KAAK,CAAwB;MACzDgB,MAAM,EAAEnB,KAAK,CAACS,OAAO,CAACU,MAAM,CAAChB,KAAK;KACrC,CAAC,CAAC;;EAGP,SAASuI,QAAQA;IACb,OAAO,CAAC,CAAC9H,MAAM,CAACgG,MAAM,CAAC5G,KAAK,CAACS,OAAO,CAACe,MAAM,CAAC,CAACG,MAAM,CAACnB,KAAK,IAAIA,KAAK,KAAK,OAAO,CAAC,CAACU,MAAM;;EAG1F,SAASyH,UAAUA,CAACxI,KAAc;IAC9B,OAAOA,KAAK,GAAG,CAAC,CAACH,KAAK,CAACS,OAAO,CAACC,IAAI,CAACP,KAAK,CAAC,GAAG,CAAC,CAACS,MAAM,CAACK,IAAI,CAACjB,KAAK,CAACS,OAAO,CAACC,IAAI,CAAC,CAACQ,MAAM;;EA+FzF,SAAS+B,cAAcA,CAAkB9C,KAAa,EAAE+B,KAAoB;;IAExEA,KAAK,CAAC0G,eAAe,CAAC,IAAI,CAAC;IAE3B3E,QAAQ,CAAC;MACL/D,IAAI,EAAE,WAAW;MACjBC,KAAK;MACLC,OAAO,EAAE;QAAEW;;KACd,CAAC;;EAGN,OAAO;;IAEHwF,WAAW;IACXG,gBAAgB;IAChBK,YAAY;IACZI,wBAAwB;IACxBE,qBAAqB;IACrB3E,YAAY;IACZQ,YAAY;;IAEZ6E,YAAY;IACZC,YAAY;IACZG,YAAY;IACZ7D,aAAa;;IAEbiE,qBAAqB;IACrBI,UAAU;IACV1G,WAAW;IACXgB,cAAc;IACdyF,QAAQ;;IAERf,kBAAkB;IAClBjG,aAAa,EAAE1B,KAAK,CAAC0B;GACxB;AACL;;;;"}
1
+ {"version":3,"file":"useEditingState.js","sources":["../../../../../../../../src/components/Table3/features/useEditingState.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, Cell as ReactTableCell } from '@tanstack/react-table';\nimport { v4 as uuid } from 'uuid';\nimport omit from 'lodash/omit';\nimport setWith from 'lodash/setWith';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { isTemporaryRow, TEMPORARY_ROW_ID_PREFIX, willRowMove } from '../util/editing';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst DELAY_BEFORE_REMOVING_SAVE_STATUS = 3000;\n\ntype EditingError = {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n};\ntype EditingRowMoveReason = Record<string, 'search' | 'sorting' | 'filter'>;\ntype EditingSaveState = 'saving' | 'saved' | 'errored';\ntype EditingChangeset<TType = unknown> = Partial<TType>;\ntype EditingState<TType = unknown> = {\n changes: {\n rows: Record<string, EditingChangeset<TType>>;\n errors: Record<string, EditingError>;\n moveReasons: Record<string, EditingRowMoveReason>;\n originals: Record<string, TType>;\n status: Record<string, EditingSaveState>;\n };\n indexes: Record<string, number>;\n temporaryRows: TType[];\n};\ntype EditingStateAction = {\n type:\n | 'setCellValue'\n | 'removeCellValue'\n | 'updateRow'\n | 'mergeRowValue'\n | 'removeRow'\n | 'setRowStatus'\n | 'setRowErrors'\n | 'insertTemporaryRow';\n rowId: string;\n payload?: any;\n};\n\nfunction reducer<TType = unknown>(state: EditingState<TType>, action: EditingStateAction) {\n const { type, rowId, payload } = action;\n\n switch (type) {\n case 'setCellValue': {\n const { columnId, index, row, value } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),\n originals: setWith(state.changes.originals, rowId, row, Object),\n },\n indexes: setWith(state.indexes, rowId, index, Object),\n };\n }\n\n case 'removeCellValue': {\n const { columnId, rowIdentityAccessor } = payload;\n const changes = omit(state.changes.rows, `${rowId}.${columnId}`);\n\n // if there are no changes left, remove the row\n if (!Object.keys(changes[rowId]).length) {\n return reducer(state, { type: 'removeRow', rowId, payload: { rowIdentityAccessor } });\n }\n\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: omit(state.changes.rows, `${rowId}.${columnId}`),\n errors: omit(state.changes.errors, `${rowId}.cells.${columnId}`),\n moveReasons: omit(state.changes.moveReasons, `${rowId}.${columnId}`),\n },\n };\n }\n\n case 'updateRow': {\n const { cellErrors, index, moveReasons, original, value } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, rowId, value, Object),\n errors: setWith(\n state.changes.errors,\n `${rowId}.cells`,\n cellErrors ?? state.changes.errors.cells[rowId],\n Object\n ),\n originals: setWith(state.changes.originals, rowId, original ?? state.changes.originals[rowId], Object),\n moveReasons: setWith(\n state.changes.moveReasons,\n rowId,\n moveReasons ?? state.changes.moveReasons[rowId],\n Object\n ),\n // status can be undefined, so don't use ??\n status: setWith(state.changes.status, rowId, undefined, Object),\n },\n indexes: setWith(state.indexes, rowId, index, Object),\n };\n }\n\n case 'removeRow': {\n const { rowIdentityAccessor } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: omit(state.changes.rows, rowId),\n errors: omit(state.changes.errors, rowId),\n moveReasons: omit(state.changes.moveReasons, rowId),\n originals: omit(state.changes.originals, rowId),\n status: omit(state.changes.status, rowId),\n },\n indexes: omit(state.indexes, rowId),\n temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId),\n };\n }\n\n case 'setRowStatus': {\n const { status } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n status: status ? setWith(state.changes.status, rowId, status, Object) : omit(state.changes.status, rowId),\n },\n };\n }\n\n case 'setRowErrors': {\n const { ...errors } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n errors: setWith(state.changes.errors, rowId, errors, Object),\n },\n };\n }\n\n case 'insertTemporaryRow': {\n const { index, value } = payload;\n return {\n ...state,\n temporaryRows: state.temporaryRows.concat(value),\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, rowId, value, Object),\n originals: setWith(state.changes.originals, rowId, value, Object),\n },\n indexes: setWith(state.indexes, rowId, index, Object),\n };\n }\n\n default:\n return state;\n }\n}\n\nexport function usePendingChangesState<TType = unknown>(\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n rowIdentityAccessor: keyof TType,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [state, dispatch] = React.useReducer(reducer, {\n changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, status: {} },\n indexes: {},\n temporaryRows: [],\n });\n\n // rows\n function getRowValue(rowId: string) {\n return state.changes.rows?.[rowId] ?? undefined;\n }\n\n function getRowMoveReason(rowId: string) {\n return Object.values(state.changes.moveReasons?.[rowId] ?? {})[0] ?? undefined;\n }\n\n function hasRowErrors(rowId: string) {\n return !!state.changes.errors[rowId]?.row || !!Object.keys(state.changes.errors[rowId]?.cells ?? {}).length;\n }\n\n function hasRowErrorsShownInAlert(rowId: string) {\n return hasRowErrors(rowId) && !!state.changes.errors[rowId]?.shouldShowErrorAlert;\n }\n\n function hasTemporaryRowErrors<T extends TType>() {\n const newRow = state.temporaryRows?.[0] as T | undefined;\n\n if (!newRow) {\n return false;\n }\n\n const rowId = newRow[rowIdentityAccessor as string];\n return !!state.changes.errors[rowId]?.row || !!Object.keys(state.changes.errors[rowId]?.cells ?? {}).length;\n }\n\n function getRowStatus(rowId: string) {\n return state.changes.status[rowId];\n }\n\n function setRowStatus(rowId: string, status: EditingSaveState | undefined) {\n dispatch({\n type: 'setRowStatus',\n rowId,\n payload: {\n status,\n },\n });\n }\n\n function insertTemporaryRow<T extends TType>(data: Partial<T>, rowIndex: number) {\n const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid()}`;\n const value: Partial<TType> = {\n ...data,\n [rowIdentityAccessor]: newRowId,\n };\n\n dispatch({\n type: 'insertTemporaryRow',\n rowId: newRowId,\n payload: { index: rowIndex, value },\n });\n\n return newRowId;\n }\n\n // cells\n function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, rowIndex: number, value: unknown) {\n const rowId = cell.row.id;\n const columnId = cell.column.id;\n\n // update if the change is different to the original value\n if (value !== cell.row.original[columnId]) {\n dispatch({\n type: 'setCellValue',\n rowId,\n payload: {\n columnId,\n index: rowIndex,\n row: cell.row.original,\n value,\n },\n });\n }\n // otherwise remove any previous change - no point saving the same value\n else if (cell.row.id in state.changes.rows) {\n dispatch({\n type: 'removeCellValue',\n rowId,\n payload: {\n columnId,\n rowIdentityAccessor,\n },\n });\n }\n }\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return state.changes.rows?.[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return state.changes.errors?.[cell.row.id]?.cells?.[cell.column.id];\n }\n\n async function onCellChanged<T extends TType>(cell: ReactTableCell<T, unknown>, rowIndex: number, shouldRunUpdaters = true) {\n const changes = state.changes.rows[cell.row.id];\n\n if (!changes) {\n return;\n }\n\n let updatesForOtherCells: Partial<T> = {};\n\n // run the updater handler if there is one, to see if there are any other cells to update\n if (typeof handleChange === 'function' && shouldRunUpdaters) {\n const previousRowValue = {\n ...state.changes.originals[cell.row.id],\n //...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),\n };\n const nextRowValue = {\n ...state.changes.originals[cell.row.id],\n ...changes,\n };\n updatesForOtherCells = ((await handleChange(\n cell.column.id,\n changes[cell.column.id],\n nextRowValue,\n previousRowValue\n )) ?? {}) as Partial<T>;\n }\n\n // create a projection of the next state, so we can act against it\n const nextChanges = { ...state.changes.rows[cell.row.id], ...updatesForOtherCells };\n const nextMoveReasons: EditingRowMoveReason = { ...state.changes.moveReasons[cell.row.id] };\n const nextCellErrors: Record<string, string> = { ...state.changes.errors[cell.row.id]?.cells };\n\n // run validation\n let validationErrors: Record<string, string> = {};\n\n if (validator) {\n const nextRowValue = { ...state.changes.originals[cell.row.id], ...changes, ...updatesForOtherCells };\n validationErrors = ((await validator(nextRowValue)) ?? {}) as Record<string, string>;\n }\n\n // only set errors and move reasons for the cells we're currently acting on\n // why? because the UX is not good if we set them for cells the user hasn't touched yet\n const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];\n const allCells = cell.row._getAllCellsByColumnId();\n\n cellsToActOn.forEach(accessor => {\n if (validationErrors[accessor]) {\n nextCellErrors[accessor] = validationErrors[accessor];\n // don't show move indicator for cells with errors, they aren't valid and can't be saved\n delete nextMoveReasons[accessor];\n } else {\n // there isn't any error in this run, remove any error set in state\n delete nextCellErrors[accessor];\n\n if (allCells[accessor]?.column.getIsSorted()) {\n // run row move determination\n const reason = willRowMove(cell, nextChanges[accessor], rowIndex, localization);\n\n // if the row will move based on this change save why, otherwise delete any existing state\n if (reason) {\n nextMoveReasons[accessor] = reason;\n } else {\n delete nextMoveReasons[accessor];\n }\n }\n }\n });\n\n dispatch({\n type: 'updateRow',\n rowId: cell.row.id,\n payload: {\n cellErrors: nextCellErrors,\n index: rowIndex,\n moveReasons: nextMoveReasons,\n value: nextChanges,\n },\n });\n }\n\n // general\n function getErrorsShownInAlert<T extends TType>() {\n const rowsWithErrors = Object.keys(state.changes.errors);\n\n if (!rowsWithErrors.length) {\n return [];\n }\n\n return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({\n rowId,\n index: state.indexes[rowId],\n changes: state.changes.rows[rowId] as EditingChangeset<T>,\n errors: state.changes.errors[rowId],\n }));\n }\n\n function hasSaved() {\n return !!Object.values(state.changes.status).filter(value => value === 'saved').length;\n }\n\n function hasChanges(rowId?: string) {\n return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;\n }\n\n async function saveChanges<T extends TType>(table: ReactTable<T>, rowId: string | undefined = undefined): Promise<boolean> {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return false;\n }\n\n // sometimes we only want to save one row\n const changes = rowId ? { [rowId]: state.changes.rows[rowId] } : state.changes.rows;\n\n let completed = true;\n\n for (const rowId of Object.keys(changes)) {\n const status = getRowStatus(rowId);\n\n try {\n // don't try to save if - already saving, or there are known errors\n if (status === 'saving' || status === 'errored') {\n continue;\n }\n\n setRowStatus(rowId, 'saving');\n\n const changeSet = { ...state.changes.originals[rowId], ...changes[rowId] };\n\n // if we had to create a temporary id, delete it first - it's our data, not theirs\n if (isTemporaryRow(changeSet[rowIdentityAccessor as string])) {\n delete changeSet[rowIdentityAccessor];\n }\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n discardChanges(rowId, table);\n\n // show the saved status, then remove it after a delay\n setRowStatus(rowId, 'saved');\n setTimeout(() => {\n setRowStatus(rowId, undefined);\n }, DELAY_BEFORE_REMOVING_SAVE_STATUS);\n } catch (error) {\n if (error instanceof ReferenceError || error instanceof TypeError || (error as any)?.response?.status >= 500) {\n console.error(error);\n }\n\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError: string | undefined;\n let cellErrors;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n dispatch({\n type: 'setRowErrors',\n rowId,\n payload: {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n },\n });\n }\n\n setRowStatus(rowId, 'errored');\n completed = false;\n }\n }\n\n return completed;\n }\n\n function discardChanges<T extends TType>(rowId: string, table: ReactTable<T>) {\n // remove any new rows from pinned state before discarding them\n table.resetRowPinning(true);\n\n dispatch({\n type: 'removeRow',\n rowId,\n payload: { rowIdentityAccessor },\n });\n }\n\n return {\n // row\n getRowValue,\n getRowMoveReason,\n hasRowErrors,\n hasRowErrorsShownInAlert,\n hasTemporaryRowErrors,\n getRowStatus,\n setRowStatus,\n // cells\n setCellValue,\n getCellValue,\n getCellError,\n onCellChanged,\n // general\n getErrorsShownInAlert,\n hasChanges,\n saveChanges,\n discardChanges,\n hasSaved,\n // new rows\n insertTemporaryRow,\n temporaryRows: state.temporaryRows,\n };\n}\n"],"names":["DELAY_BEFORE_REMOVING_SAVE_STATUS","reducer","state","action","type","rowId","payload","columnId","index","row","value","_extends","changes","rows","setWith","Object","originals","indexes","rowIdentityAccessor","omit","keys","length","errors","moveReasons","cellErrors","original","cells","status","undefined","temporaryRows","filter","_objectDestructuringEmpty","concat","usePendingChangesState","handleSave","handleChange","validator","saveChanges","table","console","warn","Promise","resolve","_ref","completed","_temp7","_forOf","getRowStatus","_catch","_temp6","_result","_exit","changeSet","then","discardChanges","setRowStatus","setTimeout","isTemporaryRow","_temp5","error","_error$response","ReferenceError","TypeError","response","rowError","Error","_error$response2","message","data","_error$response3","dispatch","shouldShowErrorAlert","_result3","e","reject","onCellChanged","cell","rowIndex","shouldRunUpdaters","cellsToActOn","column","id","updatesForOtherCells","allCells","_getAllCellsByColumnId","forEach","accessor","validationErrors","nextCellErrors","nextMoveReasons","_allCells$accessor","getIsSorted","reason","willRowMove","nextChanges","localization","_state$changes$errors11","_temp","nextRowValue","_validator","_temp2","_temp3","previousRowValue","_handleChange","_temp4","useLocalization","_React$useReducer","React","useReducer","getRowValue","_state$changes$rows$r","_state$changes$rows","getRowMoveReason","_Object$values$","values","_state$changes$moveRe","_state$changes$moveRe2","hasRowErrors","_state$changes$errors","_state$changes$errors2","_state$changes$errors3","hasRowErrorsShownInAlert","_state$changes$errors4","hasTemporaryRowErrors","newRow","_state$temporaryRows","_state$changes$errors5","_state$changes$errors6","_state$changes$errors7","insertTemporaryRow","newRowId","TEMPORARY_ROW_ID_PREFIX","uuid","_extends2","setCellValue","getCellValue","_state$changes$rows2","_state$changes$rows2$","getCellError","_state$changes$errors8","_state$changes$errors9","_state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U,EAAVA,UAAU;IACV7G,WAAW,EAAXA,WAAW;IACXiB,cAAc,EAAdA,cAAc;IACd2F,QAAQ,EAARA,QAAQ;;IAERhB,kBAAkB,EAAlBA,kBAAkB;IAClBpG,aAAa,EAAE3B,KAAK,CAAC2B;GACxB;AACL;;;;"}
@@ -1,25 +1,26 @@
1
1
  import React__default from 'react';
2
+ import { extends as _extends } from '../../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
3
  import { isTemporaryRow } from '../util/editing.js';
3
4
  import { usePendingChangesState } from './useEditingState.js';
4
5
 
5
- function useTableEditing(isEnabled = false, handleSave, handleChange, handleCreate, rowIdentityAccessor, validator) {
6
- const createRow = function (table, scrollToIndex, row) {
6
+ function useTableEditing(isEnabled, handleSave, handleChange, handleCreate, rowIdentityAccessor, validator) {
7
+ var createRow = function createRow(table, scrollToIndex, row) {
7
8
  try {
8
9
  if (!handleCreate) {
9
10
  return Promise.resolve();
10
11
  }
11
- const tableMeta = table.options.meta;
12
+ var tableMeta = table.options.meta;
12
13
  return Promise.resolve(tableMeta.editing.saveChanges(table)).then(function (saved) {
13
14
  if (!saved) {
14
15
  return;
15
16
  }
16
- const changeset = row !== null && row !== void 0 ? row : handleCreate();
17
+ var changeset = row !== null && row !== void 0 ? row : handleCreate();
17
18
  try {
18
19
  if (changeset) {
19
20
  // set the active row to the new row before toggling editing on
20
- const temporaryRows = tableMeta.editing.temporaryRows;
21
- const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
22
- const rowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
21
+ var temporaryRows = tableMeta.editing.temporaryRows;
22
+ var nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;
23
+ var rowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);
23
24
  table.getRow(rowId).pin('bottom');
24
25
  tableMeta.rowActive.setRowActiveIndex(nextRowIndex);
25
26
  toggleEditing(true, table, scrollToIndex);
@@ -33,15 +34,24 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
33
34
  return Promise.reject(e);
34
35
  }
35
36
  };
37
+ if (isEnabled === void 0) {
38
+ isEnabled = false;
39
+ }
36
40
  // used to switch the table into editing mode
37
- const [isEditing, setEditing] = React__default.useState(false);
41
+ var _React$useState = React__default.useState(false),
42
+ isEditing = _React$useState[0],
43
+ setEditing = _React$useState[1];
38
44
  // used to switch the editing between "detailed" mode
39
- const [isDetailedMode, toggleDetailedMode] = React__default.useState(false);
45
+ var _React$useState2 = React__default.useState(false),
46
+ isDetailedMode = _React$useState2[0],
47
+ toggleDetailedMode = _React$useState2[1];
40
48
  // used to contain ref to the create button
41
- const createRowButtonRef = React__default.useRef(null);
49
+ var createRowButtonRef = React__default.useRef(null);
42
50
  // store the last focused cell, so that up/down arrow key navigation remains in the same column
43
- const [lastFocusedCellIndex, setLastFocusedCellIndex] = React__default.useState(undefined);
44
- const pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
51
+ var _React$useState3 = React__default.useState(undefined),
52
+ lastFocusedCellIndex = _React$useState3[0],
53
+ setLastFocusedCellIndex = _React$useState3[1];
54
+ var pendingChangesFns = usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator);
45
55
  function toggleEditing(enabled, table, scrollToIndex) {
46
56
  var _tableMeta$rowActive$, _table$getRowModel$ro;
47
57
  if (!enabled) {
@@ -52,30 +62,33 @@ function useTableEditing(isEnabled = false, handleSave, handleChange, handleCrea
52
62
  // reset the last index back to the first focusable element, when editing gets turned off
53
63
  setLastFocusedCellIndex(undefined);
54
64
  }
55
- const tableMeta = table.options.meta;
56
- const index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
65
+ var tableMeta = table.options.meta;
66
+ var index = (_tableMeta$rowActive$ = tableMeta.rowActive.rowActiveIndex) !== null && _tableMeta$rowActive$ !== void 0 ? _tableMeta$rowActive$ : 0;
57
67
  if (tableMeta.rowActive.rowActiveIndex === undefined) {
58
68
  tableMeta.rowActive.setRowActiveIndex(index);
59
69
  }
60
70
  setEditing(enabled);
61
- const row = (_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id;
71
+ var row = (_table$getRowModel$ro = table.getRowModel().rows[index]) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.id;
62
72
  if (row && !isTemporaryRow(row)) {
63
73
  console.log('hmm');
64
74
  scrollToIndex(index);
65
75
  }
66
76
  }
67
- return {
68
- isEnabled,
69
- isEditing,
70
- isDetailedMode,
71
- toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,
72
- toggleEditing: isEnabled ? toggleEditing : () => undefined,
73
- lastFocusedCellIndex,
74
- setLastFocusedCellIndex,
75
- createRow,
76
- createRowButtonRef,
77
- ...pendingChangesFns
78
- };
77
+ return _extends({
78
+ isEnabled: isEnabled,
79
+ isEditing: isEditing,
80
+ isDetailedMode: isDetailedMode,
81
+ toggleDetailedMode: isEnabled ? toggleDetailedMode : function () {
82
+ return undefined;
83
+ },
84
+ toggleEditing: isEnabled ? toggleEditing : function () {
85
+ return undefined;
86
+ },
87
+ lastFocusedCellIndex: lastFocusedCellIndex,
88
+ setLastFocusedCellIndex: setLastFocusedCellIndex,
89
+ createRow: createRow,
90
+ createRowButtonRef: createRowButtonRef
91
+ }, pendingChangesFns);
79
92
  }
80
93
 
81
94
  export { useTableEditing };
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEditing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport {\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n} from '../types';\nimport { usePendingChangesState } from './useEditingState';\nimport { isTemporaryRow } from '../util/editing';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n handleCreate: Table3EditingCreateHandler<TType> | undefined,\n rowIdentityAccessor: keyof TType | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, setEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // used to contain ref to the create button\n const createRowButtonRef = React.useRef<HTMLButtonElement>(null);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = React.useState<number | undefined>(undefined);\n\n const pendingChangesFns = usePendingChangesState<TType>(\n handleSave,\n handleChange,\n rowIdentityAccessor as keyof TType,\n validator\n );\n\n function toggleEditing<T extends TType>(\n enabled: React.SetStateAction<boolean>,\n table: ReactTable<T>,\n scrollToIndex: (index: number) => void\n ) {\n if (!enabled) {\n // save\n pendingChangesFns.saveChanges(table);\n // reset detailed mode\n toggleDetailedMode(false);\n // reset the last index back to the first focusable element, when editing gets turned off\n setLastFocusedCellIndex(undefined);\n }\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const index = tableMeta.rowActive.rowActiveIndex ?? 0;\n\n if (tableMeta.rowActive.rowActiveIndex === undefined) {\n tableMeta.rowActive.setRowActiveIndex(index);\n }\n\n setEditing(enabled);\n\n const row = table.getRowModel().rows[index]?.id;\n\n if (row && !isTemporaryRow(row)) {\n console.log('hmm');\n scrollToIndex(index);\n }\n }\n\n async function createRow<T extends TType>(table: ReactTable<T>, scrollToIndex: (index: number) => void, row?: Partial<T>) {\n if (!handleCreate) {\n return;\n }\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const saved = await tableMeta.editing.saveChanges(table);\n\n if (!saved) {\n return;\n }\n\n const changeset = row ?? handleCreate();\n\n try {\n if (changeset) {\n // set the active row to the new row before toggling editing on\n const temporaryRows = tableMeta.editing.temporaryRows as TType[];\n const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;\n const rowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);\n table.getRow(rowId).pin('bottom');\n\n tableMeta.rowActive.setRowActiveIndex(nextRowIndex);\n\n toggleEditing(true, table, scrollToIndex);\n setLastFocusedCellIndex(undefined);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n createRow,\n createRowButtonRef,\n ...pendingChangesFns,\n };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","handleCreate","rowIdentityAccessor","validator","createRow","table","scrollToIndex","row","Promise","resolve","tableMeta","options","meta","editing","saveChanges","then","saved","changeset","temporaryRows","nextRowIndex","length","rowId","pendingChangesFns","insertTemporaryRow","getRow","pin","rowActive","setRowActiveIndex","toggleEditing","setLastFocusedCellIndex","undefined","error","console","e","reject","isEditing","setEditing","React","useState","isDetailedMode","toggleDetailedMode","createRowButtonRef","useRef","lastFocusedCellIndex","usePendingChangesState","enabled","index","_tableMeta$rowActive$","rowActiveIndex","_table$getRowModel$ro","getRowModel","rows","id","isTemporaryRow","log"],"mappings":";;;;SAWgBA,eAAeA,CAC3BC,SAAS,GAAG,KAAK,EACjBC,UAAuD,EACvDC,YAA2D,EAC3DC,YAA2D,EAC3DC,mBAA4C,EAC5CC,SAAsD;QAoDvCC,SAAS,aAAkBC,KAAoB,EAAEC,aAAsC,EAAEC,GAAgB;IAAA;MACpH,IAAI,CAACN,YAAY,EAAE;QACf,OAAAO,OAAA,CAAAC,OAAA;;MAGJ,MAAMC,SAAS,GAAGL,KAAK,CAACM,OAAO,CAACC,IAA6B;MAAC,OAAAJ,OAAA,CAAAC,OAAA,CAC1CC,SA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ing.js","sources":["../../../../../../../../src/components/Table3/features/useTableEditing.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport {\n Table3EditingChangeHandler,\n Table3EditingCreateHandler,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n} from '../types';\nimport { usePendingChangesState } from './useEditingState';\nimport { isTemporaryRow } from '../util/editing';\n\nexport function useTableEditing<TType = unknown>(\n isEnabled = false,\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n handleCreate: Table3EditingCreateHandler<TType> | undefined,\n rowIdentityAccessor: keyof TType | undefined,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n // used to switch the table into editing mode\n const [isEditing, setEditing] = React.useState(false);\n\n // used to switch the editing between \"detailed\" mode\n const [isDetailedMode, toggleDetailedMode] = React.useState(false);\n\n // used to contain ref to the create button\n const createRowButtonRef = React.useRef<HTMLButtonElement>(null);\n\n // store the last focused cell, so that up/down arrow key navigation remains in the same column\n const [lastFocusedCellIndex, setLastFocusedCellIndex] = React.useState<number | undefined>(undefined);\n\n const pendingChangesFns = usePendingChangesState<TType>(\n handleSave,\n handleChange,\n rowIdentityAccessor as keyof TType,\n validator\n );\n\n function toggleEditing<T extends TType>(\n enabled: React.SetStateAction<boolean>,\n table: ReactTable<T>,\n scrollToIndex: (index: number) => void\n ) {\n if (!enabled) {\n // save\n pendingChangesFns.saveChanges(table);\n // reset detailed mode\n toggleDetailedMode(false);\n // reset the last index back to the first focusable element, when editing gets turned off\n setLastFocusedCellIndex(undefined);\n }\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const index = tableMeta.rowActive.rowActiveIndex ?? 0;\n\n if (tableMeta.rowActive.rowActiveIndex === undefined) {\n tableMeta.rowActive.setRowActiveIndex(index);\n }\n\n setEditing(enabled);\n\n const row = table.getRowModel().rows[index]?.id;\n\n if (row && !isTemporaryRow(row)) {\n console.log('hmm');\n scrollToIndex(index);\n }\n }\n\n async function createRow<T extends TType>(table: ReactTable<T>, scrollToIndex: (index: number) => void, row?: Partial<T>) {\n if (!handleCreate) {\n return;\n }\n\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const saved = await tableMeta.editing.saveChanges(table);\n\n if (!saved) {\n return;\n }\n\n const changeset = row ?? handleCreate();\n\n try {\n if (changeset) {\n // set the active row to the new row before toggling editing on\n const temporaryRows = tableMeta.editing.temporaryRows as TType[];\n const nextRowIndex = temporaryRows.length ? tableMeta.length + 1 : tableMeta.length;\n const rowId = pendingChangesFns.insertTemporaryRow(changeset, nextRowIndex);\n table.getRow(rowId).pin('bottom');\n\n tableMeta.rowActive.setRowActiveIndex(nextRowIndex);\n\n toggleEditing(true, table, scrollToIndex);\n setLastFocusedCellIndex(undefined);\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n return {\n isEnabled,\n isEditing,\n isDetailedMode,\n toggleDetailedMode: isEnabled ? toggleDetailedMode : () => undefined,\n toggleEditing: isEnabled ? toggleEditing : () => undefined,\n lastFocusedCellIndex,\n setLastFocusedCellIndex,\n createRow,\n createRowButtonRef,\n ...pendingChangesFns,\n };\n}\n"],"names":["useTableEditing","isEnabled","handleSave","handleChange","handleCreate","rowIdentityAccessor","validator","createRow","table","scrollToIndex","row","Promise","resolve","tableMeta","options","meta","editing","saveChanges","then","saved","changeset","temporaryRows","nextRowIndex","length","rowId","pendingChangesFns","insertTemporaryRow","getRow","pin","rowActive","setRowActiveIndex","toggleEditing","setLastFocusedCellIndex","undefined","error","console","e","reject","_React$useState","React","useState","isEditing","setEditing","_React$useState2","isDetailedMode","toggleDetailedMode","createRowButtonRef","useRef","_React$useState3","lastFocusedCellIndex","usePendingChangesState","enabled","index","_tableMeta$rowActive$","rowActiveIndex","_table$getRowModel$ro","getRowModel","rows","id","isTemporaryRow","log","_extends"],"mappings":";;;;;SAWgBA,eAAeA,CAC3BC,SAAS,EACTC,UAAuD,EACvDC,YAA2D,EAC3DC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C,IAAIhD,GAAG,IAAI,CAACiD,cAAc,CAACjD,GAAG,CAAC,EAAE;MAC7ByB,OAAO,CAACyB,GAAG,CAAC,KAAK,CAAC;MAClBnD,aAAa,CAAC2C,KAAK,CAAC;;;EAoC5B,OAAAS,QAAA;IACI5D,SAAS,EAATA,SAAS;IACTwC,SAAS,EAATA,SAAS;IACTG,cAAc,EAAdA,cAAc;IACdC,kBAAkB,EAAE5C,SAAS,GAAG4C,kBAAkB,GAAG;MAAA,OAAMZ,SAAS;;IACpEF,aAAa,EAAE9B,SAAS,GAAG8B,aAAa,GAAG;MAAA,OAAME,SAAS;;IAC1DgB,oBAAoB,EAApBA,oBAAoB;IACpBjB,uBAAuB,EAAvBA,uBAAuB;IACvBzB,SAAS,EAATA,SAAS;IACTuC,kBAAkB,EAAlBA;KACGrB,iBAAiB;AAE5B;;;;"}
@@ -7,12 +7,12 @@ import { useLazyEffect } from '../../../hooks/useLazyEffect.js';
7
7
  import { shortcut } from '../util/editing.js';
8
8
 
9
9
  function useTableEditingListener(table, tableRef, scrollToIndex) {
10
- const tableMeta = table.options.meta;
11
- const localization = useLocalization();
10
+ var tableMeta = table.options.meta;
11
+ var localization = useLocalization();
12
12
  // save when the row changes
13
13
  // store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again
14
- const lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
15
- useLazyEffect(() => {
14
+ var lastRowActiveIndexRef = React__default.useRef(tableMeta.rowActive.rowActiveIndex);
15
+ useLazyEffect(function () {
16
16
  if (tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {
17
17
  lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;
18
18
  if (tableMeta.editing.isEditing && lastRowActiveIndexRef.current !== undefined) {
@@ -21,8 +21,8 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
21
21
  }
22
22
  }, [tableMeta.rowActive.rowActiveIndex]);
23
23
  // show a warning if the user navigates away without triggering save, such as using the browser back/forward button
24
- const hasChanges = tableMeta.editing.hasChanges();
25
- React__default.useEffect(() => {
24
+ var hasChanges = tableMeta.editing.hasChanges();
25
+ React__default.useEffect(function () {
26
26
  function showUnsavedChangesWarning(event) {
27
27
  if (tableMeta.editing.isEditing && hasChanges) {
28
28
  event.returnValue = true;
@@ -31,21 +31,21 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
31
31
  return false;
32
32
  }
33
33
  window.addEventListener('beforeunload', showUnsavedChangesWarning);
34
- return () => {
34
+ return function () {
35
35
  window.removeEventListener('beforeunload', showUnsavedChangesWarning);
36
36
  };
37
37
  }, [tableMeta.editing.isEditing, hasChanges]);
38
- const hasSavedChanges = tableMeta.editing.hasSaved();
39
- useLazyEffect(() => {
38
+ var hasSavedChanges = tableMeta.editing.hasSaved();
39
+ useLazyEffect(function () {
40
40
  if (hasSavedChanges) {
41
41
  resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);
42
42
  }
43
43
  }, [hasSavedChanges]);
44
- React__default.useEffect(() => {
45
- const onClickOutside = event => {
44
+ React__default.useEffect(function () {
45
+ var onClickOutside = function onClickOutside(event) {
46
46
  if (tableMeta.editing.isEditing) {
47
- const element = event.target;
48
- 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);
47
+ var element = event.target;
48
+ var 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);
49
49
  // users can click the white space below rows which could be inside the table, but a valid scenario to save
50
50
  if (!isTableOrIsInsideTable) {
51
51
  tableMeta.editing.saveChanges(table);
@@ -53,7 +53,9 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
53
53
  }
54
54
  };
55
55
  document.addEventListener('click', onClickOutside);
56
- return () => document.removeEventListener('click', onClickOutside);
56
+ return function () {
57
+ return document.removeEventListener('click', onClickOutside);
58
+ };
57
59
  }, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);
58
60
  /*
59
61
  const rows = table.getRowModel().rows;
@@ -71,7 +73,7 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
71
73
  }, [rows.length]);
72
74
  */
73
75
  // shortcuts
74
- useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, event => {
76
+ useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, function (event) {
75
77
  event.preventDefault();
76
78
  tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing, table, scrollToIndex);
77
79
  });
@@ -79,7 +81,7 @@ function useTableEditingListener(table, tableRef, scrollToIndex) {
79
81
  key: 's',
80
82
  meta: true,
81
83
  shift: false
82
- } : undefined, event => {
84
+ } : undefined, function (event) {
83
85
  event.preventDefault();
84
86
  tableMeta.editing.saveChanges(table);
85
87
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useTableEditingListener.js","sources":["../../../../../../../../src/components/Table3/listeners/useTableEditingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../hooks/useLazyEffect';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { TableRef } from '../../../primitives/Table/types';\nimport { resetHighlightedColumnIndexes } from '../../../primitives/Table/useTableManager/util/search';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { shortcut } from '../util/editing';\n\nexport function useTableEditingListener<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n scrollToIndex: (index: number) => void\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const localization = useLocalization();\n\n // save when the row changes\n // store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again\n const lastRowActiveIndexRef = React.useRef<number | undefined>(tableMeta.rowActive.rowActiveIndex);\n\n useLazyEffect(() => {\n if (tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {\n lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;\n\n if (tableMeta.editing.isEditing && lastRowActiveIndexRef.current !== undefined) {\n tableMeta.editing.saveChanges(table);\n }\n }\n }, [tableMeta.rowActive.rowActiveIndex]);\n\n // show a warning if the user navigates away without triggering save, such as using the browser back/forward button\n const hasChanges = tableMeta.editing.hasChanges();\n\n React.useEffect(() => {\n function showUnsavedChangesWarning(event: BeforeUnloadEvent) {\n if (tableMeta.editing.isEditing && hasChanges) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n }\n\n window.addEventListener('beforeunload', showUnsavedChangesWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showUnsavedChangesWarning);\n };\n }, [tableMeta.editing.isEditing, hasChanges]);\n\n const hasSavedChanges = tableMeta.editing.hasSaved();\n\n useLazyEffect(() => {\n if (hasSavedChanges) {\n resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);\n }\n }, [hasSavedChanges]);\n\n React.useEffect(() => {\n const onClickOutside = (event: MouseEvent) => {\n if (tableMeta.editing.isEditing) {\n const element = event.target as Element;\n const isTableOrIsInsideTable =\n element.tagName === 'TABLE' ||\n element.tagName === 'TBODY' ||\n element.getAttribute('data-taco') === 'backdrop' ||\n element.getAttribute('data-table') === 'editing-toggle' ||\n !document.body.contains(element) ||\n isElementInsideOrTriggeredFromContainer(element, tableRef.current);\n\n // users can click the white space below rows which could be inside the table, but a valid scenario to save\n if (!isTableOrIsInsideTable) {\n tableMeta.editing.saveChanges(table);\n }\n }\n };\n\n document.addEventListener('click', onClickOutside);\n\n return () => document.removeEventListener('click', onClickOutside);\n }, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);\n\n /*\n const rows = table.getRowModel().rows;\n\n // make sure pending changes are removed for rows that no longer exist\n useLazyEffect(() => {\n const pendingChanges = tableMeta.editing.getErrorsShownInAlert();\n\n pendingChanges.forEach(pendingChange => {\n try {\n table.getRow(pendingChange.rowId);\n } catch {\n // TODO: this has the potential to remove changes for \"unloaded\" rows in server loading\n //tableMeta.editing.discardChanges(pendingChange.rowId, table);\n }\n });\n }, [rows.length]);\n */\n\n // shortcuts\n useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, (event: KeyboardEvent) => {\n event.preventDefault();\n tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing, table, scrollToIndex);\n });\n\n useGlobalKeyDown(tableMeta.editing.isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n tableMeta.editing.saveChanges(table);\n });\n}\n"],"names":["useTableEditingListener","table","tableRef","scrollToIndex","tableMeta","options","meta","localization","useLocalization","lastRowActiveIndexRef","React","useRef","rowActive","rowActiveIndex","useLazyEffect","current","editing","isEditing","undefined","saveChanges","hasChanges","useEffect","showUnsavedChangesWarning","event","returnValue","window","addEventListener","removeEventListener","hasSavedChanges","hasSaved","resetHighlightedColumnIndexes","getState","globalFilter","onClickOutside","element","target","isTableOrIsInsideTable","tagName","getAttribute","document","body","contains","isElementInsideOrTriggeredFromContainer","useGlobalKeyDown","isEnabled","shortcut","preventDefault","toggleEditing","key","shift"],"mappings":";;;;;;;;SAUgBA,uBAAuBA,CACnCC,KAAwB,EACxBC,QAAmC,EACnCC,aAAsC;EAEtC,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,YAAY,GAAGC,eAAe,EAAE;;;EAItC,MAAMC,qBAAqB,GAAGC,cAAK,CAACC,MAAM,CAAqBP,SAAS,CAACQ,SAAS,CAACC,cAAc,CAAC;EAElGC,aAAa,CAAC;IACV,IAAIV,SAAS,CAACQ,SAAS,CAACC,cAAc,KAAKJ,qBAAqB,CAACM,OAAO,EAAE;MACtEN,qBAAqB,C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OAAO,CAACG,OAAO,KAAK,OAAO,IAC3BH,OAAO,CAACI,YAAY,CAAC,WAAW,CAAC,KAAK,UAAU,IAChDJ,OAAO,CAACI,YAAY,CAAC,YAAY,CAAC,KAAK,gBAAgB,IACvD,CAACC,QAAQ,CAACC,IAAI,CAACC,QAAQ,CAACP,OAAO,CAAC,IAChCQ,uCAAuC,CAACR,OAAO,EAAEhC,QAAQ,CAACa,OAAO,CAAC;;QAGtE,IAAI,CAACqB,sBAAsB,EAAE;UACzBhC,SAAS,CAACY,OAAO,CAACG,WAAW,CAAClB,KAAK,CAAC;;;KAG/C;IAEDsC,QAAQ,CAACb,gBAAgB,CAAC,OAAO,EAAEO,cAAc,CAAC;IAElD,OAAO,MAAMM,QAAQ,CAACZ,mBAAmB,CAAC,OAAO,EAAEM,cAAc,CAAC;GACrE,EAAE,CAAC7B,SAAS,CAACY,OAAO,CAACC,SAAS,EAAEb,SAAS,CAACY,OAAO,CAACG,WAAW,CAAC,CAAC;;;;;;;;;;;;;;;;;EAqBhEwB,gBAAgB,CAACvC,SAAS,CAACY,OAAO,CAAC4B,SAAS,GAAGC,QAAQ,GAAG3B,SAAS,EAAGK,KAAoB;IACtFA,KAAK,CAACuB,cAAc,EAAE;IACtB1C,SAAS,CAACY,OAAO,CAAC+B,aAAa,CAAC,CAAC3C,SAAS,CAACY,OAAO,CAACC,SAAS,EAAEhB,KAAK,EAAEE,aAAa,CAAC;GACtF,CAAC;EAEFwC,gBAAgB,CAACvC,SAAS,CAACY,OAAO,CAACC,SAAS,GAAG;IAAE+B,GAAG,EAAE,GAAG;IAAE1C,IAAI,EAAE,IAAI;IAAE2C,KAAK,EAAE;GAAO,GAAG/B,SAAS,EAAEK,KAAK;IACpGA,KAAK,CAACuB,cAAc,EAAE;IACtB1C,SAAS,CAACY,OAAO,CAACG,WAAW,CAAClB,KAAK,CAAC;GACvC,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"useTableEditingListener.js","sources":["../../../../../../../../src/components/Table3/listeners/useTableEditingListener.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useLazyEffect } from '../../../hooks/useLazyEffect';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../utils/dom';\nimport { TableRef } from '../../../primitives/Table/types';\nimport { resetHighlightedColumnIndexes } from '../../../primitives/Table/useTableManager/util/search';\nimport { useLocalization } from '../../Provider/Localization';\nimport { useGlobalKeyDown } from '../../../hooks/useGlobalKeyDown';\nimport { shortcut } from '../util/editing';\n\nexport function useTableEditingListener<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n scrollToIndex: (index: number) => void\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const localization = useLocalization();\n\n // save when the row changes\n // store the last row active index, otherwise everytime tableMeta.editing.saveChanges changes the hook runs again\n const lastRowActiveIndexRef = React.useRef<number | undefined>(tableMeta.rowActive.rowActiveIndex);\n\n useLazyEffect(() => {\n if (tableMeta.rowActive.rowActiveIndex !== lastRowActiveIndexRef.current) {\n lastRowActiveIndexRef.current = tableMeta.rowActive.rowActiveIndex;\n\n if (tableMeta.editing.isEditing && lastRowActiveIndexRef.current !== undefined) {\n tableMeta.editing.saveChanges(table);\n }\n }\n }, [tableMeta.rowActive.rowActiveIndex]);\n\n // show a warning if the user navigates away without triggering save, such as using the browser back/forward button\n const hasChanges = tableMeta.editing.hasChanges();\n\n React.useEffect(() => {\n function showUnsavedChangesWarning(event: BeforeUnloadEvent) {\n if (tableMeta.editing.isEditing && hasChanges) {\n event.returnValue = true;\n return true;\n }\n\n return false;\n }\n\n window.addEventListener('beforeunload', showUnsavedChangesWarning);\n\n return () => {\n window.removeEventListener('beforeunload', showUnsavedChangesWarning);\n };\n }, [tableMeta.editing.isEditing, hasChanges]);\n\n const hasSavedChanges = tableMeta.editing.hasSaved();\n\n useLazyEffect(() => {\n if (hasSavedChanges) {\n resetHighlightedColumnIndexes(table.getState().globalFilter, table, localization);\n }\n }, [hasSavedChanges]);\n\n React.useEffect(() => {\n const onClickOutside = (event: MouseEvent) => {\n if (tableMeta.editing.isEditing) {\n const element = event.target as Element;\n const isTableOrIsInsideTable =\n element.tagName === 'TABLE' ||\n element.tagName === 'TBODY' ||\n element.getAttribute('data-taco') === 'backdrop' ||\n element.getAttribute('data-table') === 'editing-toggle' ||\n !document.body.contains(element) ||\n isElementInsideOrTriggeredFromContainer(element, tableRef.current);\n\n // users can click the white space below rows which could be inside the table, but a valid scenario to save\n if (!isTableOrIsInsideTable) {\n tableMeta.editing.saveChanges(table);\n }\n }\n };\n\n document.addEventListener('click', onClickOutside);\n\n return () => document.removeEventListener('click', onClickOutside);\n }, [tableMeta.editing.isEditing, tableMeta.editing.saveChanges]);\n\n /*\n const rows = table.getRowModel().rows;\n\n // make sure pending changes are removed for rows that no longer exist\n useLazyEffect(() => {\n const pendingChanges = tableMeta.editing.getErrorsShownInAlert();\n\n pendingChanges.forEach(pendingChange => {\n try {\n table.getRow(pendingChange.rowId);\n } catch {\n // TODO: this has the potential to remove changes for \"unloaded\" rows in server loading\n //tableMeta.editing.discardChanges(pendingChange.rowId, table);\n }\n });\n }, [rows.length]);\n */\n\n // shortcuts\n useGlobalKeyDown(tableMeta.editing.isEnabled ? shortcut : undefined, (event: KeyboardEvent) => {\n event.preventDefault();\n tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing, table, scrollToIndex);\n });\n\n useGlobalKeyDown(tableMeta.editing.isEditing ? { key: 's', meta: true, shift: false } : undefined, event => {\n event.preventDefault();\n tableMeta.editing.saveChanges(table);\n });\n}\n"],"names":["useTableEditingListener","table","tableRef","scrollToIndex","tableMeta","options","meta","localization","useLocalization","lastRowActiveIndexRef","React","useRef","rowActive","rowActiveIndex","useLazyEffect","current","editing","isEditing","undefined","saveChanges","hasChanges","useEffect","showUnsavedChangesWarning","event","returnValue","window","addEventListener","removeEventListener","hasSavedChanges","hasSaved","resetHighlightedColumnIndexes","getState","globalFilter","onClickOutside","element","target","isTableOrIsInsideTable","tagName","getAttribute","document","body","contains","isElementInsideOrTriggeredFromContainer","useGlobalKeyDown","isEnabled","shortcut","preventDefault","toggleEditing","key","shift"],"mappings":";;;;;;;;SAUgBA,uBAAuBA,CACnCC,KAAwB,EACxBC,QAAmC,EACnCC,aAAsC;EAEtC,IAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,IAAMC,YAAY,GAAGC,eAAe,EAAE;;;EAItC,IAAMC,qBAAqB,GAAGC,cAAK,CAACC,MAAM,CAAqBP,SAAS,CAACQ,SAAS,CAACC,cAAc,CAAC;EAElGC,aAAa,CAAC;IACV,IAAIV,SAAS,CAACQ,SAAS,CAACC,cAAc,KAAKJ,qBAAqB,CAACM,OAAO,EAAE;MACtEN,qBAAqB,CAACM,OAAO,GAAGX,SAAS,CAACQ,SAAS,CAACC,cAAc;MAElE,IAAIT,SAAS,CAACY,OAAO,CAACC,SAAS,IAAIR,qBAAqB,CAACM,OAAO,KAAKG,SAAS,EAAE;QAC5Ed,SAAS,CAACY,OAAO,CAACG,WAAW,CAAClB,KAAK,CAAC;;;GAG/C,EAAE,CAACG,SAAS,CAACQ,SAAS,CAACC,cAAc,CAAC,CAAC;;EAGxC,IAAMO,UAAU,GAAGhB,SAAS,CAACY,OAAO,CAACI,UAAU,EAAE;EAEjDV,cAAK,CAACW,SAAS,CAAC;IACZ,SAASC,yBAAyBA,CAACC,KAAwB;MACvD,IAAInB,SAAS,CAACY,OAAO,CAACC,SAAS,IAAIG,UAAU,EAAE;QAC3CG,KAAK,CAACC,WAAW,GAAG,IAAI;QACxB,OAAO,IAAI;;MAGf,OAAO,KAAK;;IAGhBC,MAAM,CAACC,gBAAgB,CAAC,cAAc,EAAEJ,yBAAyB,CAAC;IAElE,OAAO;MACHG,MAAM,CAACE,mBAAmB,CAAC,cAAc,EAAEL,yBAAyB,CAAC;KACxE;GACJ,EAAE,CAAClB,SAAS,CAACY,OAAO,CAACC,SAAS,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,GAAG3B,SAAS,EAAE,UAACK,KAAoB;IACtFA,KAAK,CAACuB,cAAc,EAAE;IACtB1C,SAAS,CAACY,OAAO,CAAC+B,aAAa,CAAC,CAAC3C,SAAS,CAACY,OAAO,CAACC,SAAS,EAAEhB,KAAK,EAAEE,aAAa,CAAC;GACtF,CAAC;EAEFwC,gBAAgB,CAACvC,SAAS,CAACY,OAAO,CAACC,SAAS,GAAG;IAAE+B,GAAG,EAAE,GAAG;IAAE1C,IAAI,EAAE,IAAI;IAAE2C,KAAK,EAAE;GAAO,GAAG/B,SAAS,EAAE,UAAAK,KAAK;IACpGA,KAAK,CAACuB,cAAc,EAAE;IACtB1C,SAAS,CAACY,OAAO,CAACG,WAAW,CAAClB,KAAK,CAAC;GACvC,CAAC;AACN;;;;"}
@@ -1,4 +1,5 @@
1
1
  import React__default from 'react';
2
+ import { extends as _extends } from '../../../../../_virtual/_rollupPluginBabelHelpers.js';
2
3
  import { useTable } from '../../primitives/Table/Core/useTable.js';
3
4
  import { useTableEditingListener } from './listeners/useTableEditingListener.js';
4
5
  import { useTableEditing } from './features/useTableEditing.js';
@@ -6,35 +7,34 @@ import { Cell } from './components/Columns/Cell/Cell.js';
6
7
  import { EditingActionsMenu } from './components/Columns/Internal/EditingActionsMenu.js';
7
8
  import { Row } from './components/Row/Row.js';
8
9
 
9
- const RENDERERS = {
10
+ var RENDERERS = {
10
11
  row: Row,
11
12
  cell: Cell
12
13
  };
13
14
  function useTable3(props, ref) {
14
- const editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.onEditingCreate, props.rowIdentityAccessor, props.validator);
15
- const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
15
+ var editing = useTableEditing(props.enableEditing, props.onEditingSave, props.onEditingChange, props.onEditingCreate, props.rowIdentityAccessor, props.validator);
16
+ var creationEnabled = editing.isEnabled && !!props.onEditingCreate;
16
17
  // this gives me the performance heeby jeebies, but can't think of a better way to internalise the state
17
- const data = React__default.useMemo(() => {
18
+ var data = React__default.useMemo(function () {
18
19
  if (editing.temporaryRows.length) {
19
20
  var _props$data;
20
21
  return ((_props$data = props.data) !== null && _props$data !== void 0 ? _props$data : []).concat(editing.temporaryRows);
21
22
  }
22
23
  return props.data;
23
24
  }, [JSON.stringify(props.data), editing.temporaryRows.length]);
24
- const extendedProps = {
25
- ...props,
26
- data,
25
+ var extendedProps = _extends({}, props, {
26
+ data: data,
27
27
  enableRowActions: editing.isEditing ? true : props.enableRowActions,
28
28
  // Display EditingActionMenu instead of row actions while editing
29
- rowActions: editing.isEditing ? [(_, rowId, table) => {
30
- const tableMeta = table.options.meta;
29
+ rowActions: editing.isEditing ? [function (_, rowId, table) {
30
+ var tableMeta = table.options.meta;
31
31
  return /*#__PURE__*/React__default.createElement(EditingActionsMenu, {
32
32
  hasChanges: editing.hasChanges(rowId),
33
33
  hasErrors: editing.hasRowErrors(rowId),
34
- onDiscard: () => {
34
+ onDiscard: function onDiscard() {
35
35
  if (editing.temporaryRows.length) {
36
36
  tableMeta.rowActive.setRowActiveIndex(undefined);
37
- setTimeout(() => {
37
+ setTimeout(function () {
38
38
  var _editing$createRowBut;
39
39
  return (_editing$createRowBut = editing.createRowButtonRef.current) === null || _editing$createRowBut === void 0 ? void 0 : _editing$createRowBut.focus();
40
40
  }, 50);
@@ -51,21 +51,27 @@ function useTable3(props, ref) {
51
51
  isLastRow: !creationEnabled && tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1
52
52
  });
53
53
  }] : props.rowActions
54
+ });
55
+ var meta = {
56
+ editing: editing
54
57
  };
55
- const meta = {
56
- editing
57
- };
58
- const options = {
58
+ var options = {
59
59
  virtualiserPaddingEndOffset: props.enableEditing && props.onEditingCreate ? editing.hasTemporaryRowErrors() ? 1.4 : 1 : 0
60
60
  };
61
- const table = useTable(extendedProps, ref, RENDERERS, meta, options);
61
+ var table = useTable(extendedProps, ref, RENDERERS, meta, options);
62
62
  // listeners
63
63
  useTableEditingListener(table.instance, table.ref, table.renderer.scrollToIndex);
64
- React__default.useEffect(() => {
64
+ React__default.useEffect(function () {
65
65
  if (table.ref.current) {
66
- table.ref.current.instance.toggleEditing = enabled => table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : editing => !editing, table.instance, table.renderer.scrollToIndex);
66
+ table.ref.current.instance.toggleEditing = function (enabled) {
67
+ return table.meta.editing.toggleEditing(enabled !== null && enabled !== void 0 ? enabled : function (editing) {
68
+ return !editing;
69
+ }, table.instance, table.renderer.scrollToIndex);
70
+ };
67
71
  if (props.onEditingCreate) {
68
- table.ref.current.instance.createRow = row => table.meta.editing.createRow(table.instance, table.renderer.scrollToIndex, row);
72
+ table.ref.current.instance.createRow = function (row) {
73
+ return table.meta.editing.createRow(table.instance, table.renderer.scrollToIndex, row);
74
+ };
69
75
  }
70
76
  }
71
77
  }, [table.ref.current]);
@@ -1 +1 @@
1
- {"version":3,"file":"useTable3.js","sources":["../../../../../../../src/components/Table3/useTable3.tsx"],"sourcesContent":["import React from 'react';\nimport { RowData, Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useTable } from '../../primitives/Table/Core/useTable';\nimport { useTableEditingListener } from './listeners/useTableEditingListener';\nimport { useTableEditing } from './features/useTableEditing';\nimport { Table3Props, Table3Ref } from './types';\nimport { TableRowActionRenderer } from '../../primitives/Table/types';\nimport { Cell } from './components/Columns/Cell/Cell';\nimport { EditingActionsMenu } from './components/Columns/Internal/EditingActionsMenu';\nimport { Row } from './components/Row/Row';\nimport { useTableRenderOptions } from '../../primitives/Table/Core/types';\n\nexport const RENDERERS = {\n row: Row,\n cell: Cell,\n};\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n editing: ReturnType<typeof useTableEditing>;\n }\n}\n\ntype Table3Meta = {\n editing: ReturnType<typeof useTableEditing>;\n};\n\nexport function useTable3<TType>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const editing = useTableEditing(\n props.enableEditing,\n props.onEditingSave,\n props.onEditingChange,\n props.onEditingCreate,\n props.rowIdentityAccessor,\n props.validator\n );\n const creationEnabled = editing.isEnabled && !!props.onEditingCreate;\n\n // this gives me the performance heeby jeebies, but can't think of a better way to internalise the state\n const data: TType[] = React.useMemo(() => {\n if (editing.temporaryRows.length) {\n return (props.data ?? []).concat(editing.temporaryRows as TType[]);\n }\n\n return props.data;\n }, [JSON.stringify(props.data), editing.temporaryRows.length]);\n\n const extendedProps: Table3Props<TType> = {\n ...props,\n data,\n enableRowActions: editing.isEditing ? true : props.enableRowActions,\n // Display EditingActionMenu instead of row actions while editing\n rowActions: editing.isEditing\n ? ([\n (_, rowId, table: ReactTable<TType>) => {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n return (\n <EditingActionsMenu\n hasChanges={editing.hasChanges(rowId)}\n hasErrors={editing.hasRowErrors(rowId)}\n onDiscard={() => {\n if (editing.temporaryRows.length) {\n tableMeta.rowActive.setRowActiveIndex(undefined);\n setTimeout(() => editing.createRowButtonRef.current?.focus(), 50);\n }\n\n editing.discardChanges(rowId, table);\n }}\n onEditingSave={async () => {\n await editing.saveChanges(table, rowId);\n }}\n isLastRow={!creationEnabled && tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1}\n />\n );\n },\n ] as TableRowActionRenderer<TType>[])\n : props.rowActions,\n };\n const meta = { editing };\n\n const options: useTableRenderOptions = {\n virtualiserPaddingEndOffset:\n props.enableEditing && props.onEditingCreate ? (editing.hasTemporaryRowErrors() ? 1.4 : 1) : 0,\n };\n\n const table = useTable<TType, Table3Meta>(extendedProps, ref, RENDERERS, meta, options);\n\n // listeners\n useTableEditingListener<TType>(table.instance, table.ref, table.renderer.scrollToIndex);\n\n React.useEffect(() => {\n if (table.ref.current) {\n (table.ref.current as Table3Ref).instance.toggleEditing = (enabled: boolean | undefined) =>\n table.meta.editing.toggleEditing(enabled ?? (editing => !editing), table.instance, table.renderer.scrollToIndex);\n\n if (props.onEditingCreate) {\n (table.ref.current as Table3Ref).instance.createRow = (row: unknown) =>\n table.meta.editing.createRow(table.instance, table.renderer.scrollToIndex, row as Partial<TType>);\n }\n }\n }, [table.ref.current]);\n\n return table;\n}\n"],"names":["RENDERERS","row","Row","cell","Cell","useTable3","props","ref","editing","useTableEditing","enableEditing","onEditingSave","onEditingChange","onEditingCreate","rowIdentityAccessor","validator","creationEnabled","isEnabled","data","React","useMemo","temporaryRows","length","_props$data","concat","JSON","stringify","extendedProps","enableRowActions","isEditing","rowActions","_","rowId","table","tableMeta","options","meta","EditingActionsMenu","hasChanges","hasErrors","hasRowErrors","onDiscard","rowActive","setRowActiveIndex","undefined","setTimeout","_editing$createRowBut","createRowButtonRef","current","focus","discardChanges","saveChanges","then","e","Promise","reject","isLastRow","rowActiveIndex","virtualiserPaddingEndOffset","hasTemporaryRowErrors","useTable","useTableEditingListener","instance","renderer","scrollToIndex","useEffect","toggleEditing","enabled","createRow"],"mappings":";;;;;;;;MAYaA,SAAS,GAAG;EACrBC,GAAG,EAAEC,GAAG;EACRC,IAAI,EAAEC;;SAaMC,SAASA,CAAQC,KAAyB,EAAEC,GAAyB;EACjF,MAAMC,OAAO,GAAGC,eAAe,CAC3BH,KAAK,CAACI,aAAa,EACnBJ,KAAK,CAACK,aAAa,EACnBL,KAAK,CAACM,eAAe,EACrBN,KAAK,CAACO,eAAe,EACrBP,KAAK,CAACQ,mBAAmB,EACzBR,KAAK,CAACS,SAAS,CAClB;EACD,MAAMC,eAAe,GAAGR,OAAO,CAACS,SAAS,IAAI,CAAC,CAACX,KAAK,CAACO,eAAe;;EAGpE,MAAMK,IAAI,GAAYC,cAAK,CAACC,OAAO,CAAC;IAChC,IAAIZ,OAAO,CAACa,aAAa,CAACC,MAAM,EAAE;MAAA,IAAAC,WAAA;MAC9B,OAAO,EAAAA,WAAA,GAACjB,KAAK,CAACY,IAAI,cAAAK,WAAA,cAAAA,WAAA,GAAI,EAAE,EAAEC,MAAM,CAAChB,OAAO,CAACa,aAAwB,CAAC;;IAGtE,OAAOf,KAAK,CAACY,I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able3.js","sources":["../../../../../../../src/components/Table3/useTable3.tsx"],"sourcesContent":["import React from 'react';\nimport { RowData, Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { useTable } from '../../primitives/Table/Core/useTable';\nimport { useTableEditingListener } from './listeners/useTableEditingListener';\nimport { useTableEditing } from './features/useTableEditing';\nimport { Table3Props, Table3Ref } from './types';\nimport { TableRowActionRenderer } from '../../primitives/Table/types';\nimport { Cell } from './components/Columns/Cell/Cell';\nimport { EditingActionsMenu } from './components/Columns/Internal/EditingActionsMenu';\nimport { Row } from './components/Row/Row';\nimport { useTableRenderOptions } from '../../primitives/Table/Core/types';\n\nexport const RENDERERS = {\n row: Row,\n cell: Cell,\n};\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n editing: ReturnType<typeof useTableEditing>;\n }\n}\n\ntype Table3Meta = {\n editing: ReturnType<typeof useTableEditing>;\n};\n\nexport function useTable3<TType>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const editing = useTableEditing(\n props.enableEditing,\n props.onEditingSave,\n props.onEditingChange,\n props.onEditingCreate,\n props.rowIdentityAccessor,\n props.validator\n );\n const creationEnabled = editing.isEnabled && !!props.onEditingCreate;\n\n // this gives me the performance heeby jeebies, but can't think of a better way to internalise the state\n const data: TType[] = React.useMemo(() => {\n if (editing.temporaryRows.length) {\n return (props.data ?? []).concat(editing.temporaryRows as TType[]);\n }\n\n return props.data;\n }, [JSON.stringify(props.data), editing.temporaryRows.length]);\n\n const extendedProps: Table3Props<TType> = {\n ...props,\n data,\n enableRowActions: editing.isEditing ? true : props.enableRowActions,\n // Display EditingActionMenu instead of row actions while editing\n rowActions: editing.isEditing\n ? ([\n (_, rowId, table: ReactTable<TType>) => {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n return (\n <EditingActionsMenu\n hasChanges={editing.hasChanges(rowId)}\n hasErrors={editing.hasRowErrors(rowId)}\n onDiscard={() => {\n if (editing.temporaryRows.length) {\n tableMeta.rowActive.setRowActiveIndex(undefined);\n setTimeout(() => editing.createRowButtonRef.current?.focus(), 50);\n }\n\n editing.discardChanges(rowId, table);\n }}\n onEditingSave={async () => {\n await editing.saveChanges(table, rowId);\n }}\n isLastRow={!creationEnabled && tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1}\n />\n );\n },\n ] as TableRowActionRenderer<TType>[])\n : props.rowActions,\n };\n const meta = { editing };\n\n const options: useTableRenderOptions = {\n virtualiserPaddingEndOffset:\n props.enableEditing && props.onEditingCreate ? (editing.hasTemporaryRowErrors() ? 1.4 : 1) : 0,\n };\n\n const table = useTable<TType, Table3Meta>(extendedProps, ref, RENDERERS, meta, options);\n\n // listeners\n useTableEditingListener<TType>(table.instance, table.ref, table.renderer.scrollToIndex);\n\n React.useEffect(() => {\n if (table.ref.current) {\n (table.ref.current as Table3Ref).instance.toggleEditing = (enabled: boolean | undefined) =>\n table.meta.editing.toggleEditing(enabled ?? (editing => !editing), table.instance, table.renderer.scrollToIndex);\n\n if (props.onEditingCreate) {\n (table.ref.current as Table3Ref).instance.createRow = (row: unknown) =>\n table.meta.editing.createRow(table.instance, table.renderer.scrollToIndex, row as Partial<TType>);\n }\n }\n }, [table.ref.current]);\n\n return table;\n}\n"],"names":["RENDERERS","row","Row","cell","Cell","useTable3","props","ref","editing","useTableEditing","enableEditing","onEditingSave","onEditingChange","onEditingCreate","rowIdentityAccessor","validator","creationEnabled","isEnabled","data","React","useMemo","temporaryRows","length","_props$data","concat","JSON","stringify","extendedProps","_extends","enableRowActions","isEditing","rowActions","_","rowId","table","tableMeta","options","meta","EditingActionsMenu","hasChanges","hasErrors","hasRowErrors","onDiscard","rowActive","setRowActiveIndex","undefined","setTimeout","_editing$createRowBut","createRowButtonRef","current","focus","discardChanges","saveChanges","then","e","Promise","reject","isLastRow","rowActiveIndex","virtualiserPaddingEndOffset","hasTemporaryRowErrors","useTable","useTableEditingListener","instance","renderer","scrollToIndex","useEffect","toggleEditing","enabled","createRow"],"m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