@economic/taco 2.19.0 → 2.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (330) hide show
  1. package/dist/components/Provider/Localization.d.ts +18 -0
  2. package/dist/components/Report/components/Body/Body.d.ts +8 -0
  3. package/dist/components/Report/components/Cell/Cell.d.ts +3 -0
  4. package/dist/components/Report/components/Cell/DisplayCell.d.ts +7 -0
  5. package/dist/components/Report/components/Cell/GroupedCell.d.ts +7 -0
  6. package/dist/components/Report/components/Cell/util.d.ts +18 -0
  7. package/dist/components/Report/components/Footer/Footer.d.ts +6 -0
  8. package/dist/components/Report/components/Footer/Summary.d.ts +7 -0
  9. package/dist/components/Report/components/Header/Header.d.ts +37 -0
  10. package/dist/components/Report/components/Header/components/Goto.d.ts +6 -0
  11. package/dist/components/Report/components/Header/components/Menu.d.ts +17 -0
  12. package/dist/components/Report/components/Header/components/Resizer.d.ts +12 -0
  13. package/dist/components/Report/components/Header/components/SortIndicator.d.ts +15 -0
  14. package/dist/components/Report/components/Header/util.d.ts +4 -0
  15. package/dist/components/Report/components/Internal/Actions.d.ts +13 -0
  16. package/dist/components/Report/components/Internal/Expansion.d.ts +4 -0
  17. package/dist/components/Report/components/Internal/Selection.d.ts +4 -0
  18. package/dist/components/Report/components/Row/DisplayRow.d.ts +16 -0
  19. package/dist/components/Report/components/Row/Row.d.ts +8 -0
  20. package/dist/components/Report/components/Row/RowContext.d.ts +9 -0
  21. package/dist/components/Report/components/Row/SkeletonRow.d.ts +10 -0
  22. package/dist/components/Report/components/Toolbar/Toolbar.d.ts +15 -0
  23. package/dist/components/Report/components/Toolbar/components/Filters/Filters.d.ts +7 -0
  24. package/dist/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.d.ts +7 -0
  25. package/dist/components/Report/components/Toolbar/components/Filters/components/Filter.d.ts +12 -0
  26. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterColumn.d.ts +9 -0
  27. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterComparator.d.ts +7 -0
  28. package/dist/components/Report/components/Toolbar/components/Filters/components/FilterValue.d.ts +10 -0
  29. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +12 -0
  30. package/dist/components/Report/components/Toolbar/components/Filters/util.d.ts +2 -0
  31. package/dist/components/Report/components/Toolbar/components/Print/Print.d.ts +9 -0
  32. package/dist/components/Report/components/Toolbar/components/Print/PrintDialog.d.ts +17 -0
  33. package/dist/components/Report/components/Toolbar/components/Search/Search.d.ts +8 -0
  34. package/dist/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.d.ts +7 -0
  35. package/dist/components/Report/components/Toolbar/components/Settings/Settings.d.ts +8 -0
  36. package/dist/components/Report/features/useReportExport.d.ts +3 -0
  37. package/dist/components/Report/styles/useColumnPinningStylesheet.d.ts +2 -0
  38. package/dist/components/Report/styles/useCssGridStylesheet.d.ts +3 -0
  39. package/dist/components/Report/styles/useStylesheet.d.ts +3 -0
  40. package/dist/components/Report/styles/util.d.ts +3 -0
  41. package/dist/components/Report/types.d.ts +20 -0
  42. package/dist/components/Report/useReport.d.ts +14 -0
  43. package/dist/components/Report/util/rows.d.ts +7 -0
  44. package/dist/components/Report/util/useTableGlobalShortcuts.d.ts +4 -0
  45. package/dist/components/Report/util/useTableRenderer.d.ts +9 -0
  46. package/dist/components/Table3/Table3.d.ts +1 -1
  47. package/dist/components/Table3/components/rows/Row.d.ts +1 -1
  48. package/dist/components/Table3/hooks/features/usePrinting.d.ts +7 -0
  49. package/dist/components/Table3/hooks/useTable.d.ts +5 -5
  50. package/dist/components/Table3/types.d.ts +21 -3
  51. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js +1 -1
  52. package/dist/esm/packages/taco/src/components/Accordion/Accordion.js.map +1 -1
  53. package/dist/esm/packages/taco/src/components/Alert/Alert.js +1 -1
  54. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  55. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +1 -1
  56. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
  57. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js +2 -2
  58. package/dist/esm/packages/taco/src/components/Backdrop/Backdrop.js.map +1 -1
  59. package/dist/esm/packages/taco/src/components/Badge/Badge.js +1 -1
  60. package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
  61. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +1 -1
  62. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
  63. package/dist/esm/packages/taco/src/components/Banner/Banner.js +2 -2
  64. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  65. package/dist/esm/packages/taco/src/components/Button/Button.js +1 -1
  66. package/dist/esm/packages/taco/src/components/Button/Button.js.map +1 -1
  67. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +1 -1
  68. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  69. package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
  70. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  71. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +1 -1
  72. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  73. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +1 -1
  74. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  75. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +1 -1
  76. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +5 -5
  78. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  79. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js +1 -1
  80. package/dist/esm/packages/taco/src/components/Dialog/components/DialogDrawer.js.map +1 -1
  81. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js +1 -1
  82. package/dist/esm/packages/taco/src/components/Dialog/components/Extra.js.map +1 -1
  83. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
  84. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  85. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +1 -1
  86. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  87. package/dist/esm/packages/taco/src/components/Drawer/util.js +1 -1
  88. package/dist/esm/packages/taco/src/components/Drawer/util.js.map +1 -1
  89. package/dist/esm/packages/taco/src/components/Field/Field.js +1 -1
  90. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  91. package/dist/esm/packages/taco/src/components/Form/Form.js +1 -1
  92. package/dist/esm/packages/taco/src/components/Form/Form.js.map +1 -1
  93. package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
  94. package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
  95. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +2 -2
  96. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  97. package/dist/esm/packages/taco/src/components/Header/Header.js +1 -1
  98. package/dist/esm/packages/taco/src/components/Header/Header.js.map +1 -1
  99. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js +1 -1
  100. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Avatar.js.map +1 -1
  101. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js +2 -2
  102. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -1
  103. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +2 -2
  104. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  105. package/dist/esm/packages/taco/src/components/Header/components/Button.js +1 -1
  106. package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
  107. package/dist/esm/packages/taco/src/components/Header/components/Link.js +1 -1
  108. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  109. package/dist/esm/packages/taco/src/components/Header/components/Logo.js +1 -1
  110. package/dist/esm/packages/taco/src/components/Header/components/Logo.js.map +1 -1
  111. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +1 -1
  112. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -1
  113. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +1 -1
  114. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  115. package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +1 -1
  116. package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
  117. package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js +1 -1
  118. package/dist/esm/packages/taco/src/components/HoverCard/HoverCard.js.map +1 -1
  119. package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -1
  120. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  121. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js +1 -1
  122. package/dist/esm/packages/taco/src/components/IconButton/IconButton.js.map +1 -1
  123. package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
  124. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  125. package/dist/esm/packages/taco/src/components/Input/util.js +1 -1
  126. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  127. package/dist/esm/packages/taco/src/components/Layout/Layout.js +2 -2
  128. package/dist/esm/packages/taco/src/components/Layout/Layout.js.map +1 -1
  129. package/dist/esm/packages/taco/src/components/Layout/components/Content.js +2 -2
  130. package/dist/esm/packages/taco/src/components/Layout/components/Content.js.map +1 -1
  131. package/dist/esm/packages/taco/src/components/Layout/components/Page.js +2 -2
  132. package/dist/esm/packages/taco/src/components/Layout/components/Page.js.map +1 -1
  133. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +2 -2
  134. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  135. package/dist/esm/packages/taco/src/components/Listbox/Listbox.js +1 -1
  136. package/dist/esm/packages/taco/src/components/Listbox/Listbox.js.map +1 -1
  137. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
  138. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  139. package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
  140. package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
  141. package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
  142. package/dist/esm/packages/taco/src/components/Menu/components/Header.js.map +1 -1
  143. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
  144. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  145. package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js +1 -1
  146. package/dist/esm/packages/taco/src/components/Menu/components/RadioGroup.js.map +1 -1
  147. package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js +1 -1
  148. package/dist/esm/packages/taco/src/components/Menu/components/SubMenu.js.map +1 -1
  149. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +1 -1
  150. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  151. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +1 -1
  152. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  153. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js +1 -1
  154. package/dist/esm/packages/taco/src/components/Navigation2/Navigation2.js.map +1 -1
  155. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js +1 -1
  156. package/dist/esm/packages/taco/src/components/Navigation2/components/Content.js.map +1 -1
  157. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js +1 -1
  158. package/dist/esm/packages/taco/src/components/Navigation2/components/Group.js.map +1 -1
  159. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +2 -2
  160. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  161. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +1 -1
  162. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  163. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js +1 -1
  164. package/dist/esm/packages/taco/src/components/Navigation2/components/util.js.map +1 -1
  165. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -1
  166. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  167. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +1 -1
  168. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  169. package/dist/esm/packages/taco/src/components/Popover/Popover.js +1 -1
  170. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  171. package/dist/esm/packages/taco/src/components/Progress/Progress.js +1 -1
  172. package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
  173. package/dist/esm/packages/taco/src/components/Provider/Localization.js +18 -0
  174. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  175. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +1 -1
  176. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  177. package/dist/esm/packages/taco/src/components/RadioGroup/util.js +1 -1
  178. package/dist/esm/packages/taco/src/components/RadioGroup/util.js.map +1 -1
  179. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +1 -1
  180. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  181. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +3 -3
  182. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  183. package/dist/esm/packages/taco/src/components/Select/Select.js +1 -1
  184. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  185. package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
  186. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  187. package/dist/esm/packages/taco/src/components/Select2/Select2.js +1 -1
  188. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  189. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
  190. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  191. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  192. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  193. package/dist/esm/packages/taco/src/components/Select2/components/Group.js +1 -1
  194. package/dist/esm/packages/taco/src/components/Select2/components/Group.js.map +1 -1
  195. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  196. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  197. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +1 -1
  198. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  199. package/dist/esm/packages/taco/src/components/Select2/components/Title.js +1 -1
  200. package/dist/esm/packages/taco/src/components/Select2/components/Title.js.map +1 -1
  201. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +2 -2
  202. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  203. package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -1
  204. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  205. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
  206. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  207. package/dist/esm/packages/taco/src/components/Spinner/Spinner.js +1 -1
  208. package/dist/esm/packages/taco/src/components/Spinner/Spinner.js.map +1 -1
  209. package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
  210. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  211. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +2 -2
  212. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  213. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
  214. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  215. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
  216. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  217. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js +1 -1
  218. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  219. package/dist/esm/packages/taco/src/components/Table3/Table3.js +1 -6
  220. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  221. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +1 -1
  222. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  223. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +4 -2
  224. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  225. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -1
  226. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  227. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js +2 -2
  228. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Highlight.js.map +1 -1
  229. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js +1 -1
  230. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Indicator.js.map +1 -1
  231. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +2 -2
  232. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  233. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js +1 -1
  234. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Footer.js.map +1 -1
  235. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js +1 -1
  236. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Group.js.map +1 -1
  237. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +5 -2
  238. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  239. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +1 -1
  240. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  241. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js +1 -1
  242. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Resizer.js.map +1 -1
  243. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -1
  244. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  245. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +1 -1
  246. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
  247. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
  248. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  249. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js +1 -1
  250. package/dist/esm/packages/taco/src/components/Table3/components/columns/styles.js.map +1 -1
  251. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +1 -1
  252. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  253. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +2 -2
  254. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js.map +1 -1
  255. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +1 -1
  256. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  257. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js +1 -1
  258. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterValue.js.map +1 -1
  259. package/dist/esm/packages/taco/src/{primitives/Table/useTable/features/useTablePrinting.js → components/Table3/hooks/features/usePrinting.js} +3 -3
  260. package/dist/esm/packages/taco/src/components/Table3/hooks/features/usePrinting.js.map +1 -0
  261. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +4 -3
  262. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  263. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  264. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +1 -1
  265. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  266. package/dist/esm/packages/taco/src/components/Tag/Tag.js +2 -2
  267. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  268. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
  269. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
  270. package/dist/esm/packages/taco/src/components/Toast/Toast.js +2 -2
  271. package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
  272. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js +2 -2
  273. package/dist/esm/packages/taco/src/components/Tooltip/Tooltip.js.map +1 -1
  274. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +1 -1
  275. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  276. package/dist/esm/packages/taco/src/primitives/Table/types.js +27 -0
  277. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -0
  278. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js +1 -1
  279. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnOrdering.js.map +1 -1
  280. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js +11 -21
  281. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActive.js.map +1 -1
  282. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowClick.js.map +1 -1
  283. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js +1 -1
  284. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGoto.js.map +1 -1
  285. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js +1 -0
  286. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowSelection.js.map +1 -1
  287. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js +42 -2
  288. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableServerLoading.js.map +1 -1
  289. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +10 -8
  290. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
  291. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +7 -0
  292. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -0
  293. package/dist/esm/packages/taco/src/utils/dom.js +10 -1
  294. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  295. package/dist/primitives/Table/types.d.ts +187 -2
  296. package/dist/primitives/Table/useTable/features/useTableColumnFreezing.d.ts +6 -0
  297. package/dist/primitives/Table/useTable/features/useTableFooter.d.ts +3 -0
  298. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -0
  299. package/dist/primitives/Table/useTable/features/useTableRef.d.ts +4 -0
  300. package/dist/primitives/Table/useTable/features/useTableRowActions.d.ts +6 -0
  301. package/dist/primitives/Table/useTable/features/useTableRowActive.d.ts +0 -1
  302. package/dist/primitives/Table/useTable/features/useTableRowClick.d.ts +1 -1
  303. package/dist/primitives/Table/useTable/features/useTableRowExpansion.d.ts +5 -0
  304. package/dist/primitives/Table/useTable/features/useTableRowGoto.d.ts +1 -1
  305. package/dist/primitives/Table/useTable/features/useTableRowGroups.d.ts +5 -0
  306. package/dist/primitives/Table/useTable/features/useTableRowSelection.d.ts +1 -0
  307. package/dist/primitives/Table/useTable/features/useTableSearch.d.ts +11 -0
  308. package/dist/primitives/Table/useTable/features/useTableServerLoading.d.ts +5 -2
  309. package/dist/primitives/Table/useTable/features/useTableSettings.d.ts +3 -0
  310. package/dist/primitives/Table/useTable/listeners/useTableRowHeightListener.d.ts +2 -0
  311. package/dist/primitives/Table/useTable/listeners/useTableSearchListener.d.ts +2 -0
  312. package/dist/primitives/Table/useTable/listeners/useTableSettingsListener.d.ts +3 -0
  313. package/dist/primitives/Table/useTable/useTable.d.ts +57 -0
  314. package/dist/primitives/Table/useTable/util/columns.d.ts +7 -1
  315. package/dist/primitives/Table/useTable/util/columns.spec.d.ts +1 -0
  316. package/dist/primitives/Table/useTable/util/filtering.d.ts +7 -0
  317. package/dist/primitives/Table/useTable/util/presets.d.ts +2 -0
  318. package/dist/primitives/Table/useTable/util/search.d.ts +2 -0
  319. package/dist/primitives/Table/useTable/util/settings.d.ts +13 -0
  320. package/dist/primitives/Table/useTable/util/setup.d.ts +14 -0
  321. package/dist/primitives/Table/useTable/util/sorting.d.ts +2 -0
  322. package/dist/primitives/Table/useTableDataLoader.d.ts +23 -0
  323. package/dist/taco.cjs.development.js +149 -68
  324. package/dist/taco.cjs.development.js.map +1 -1
  325. package/dist/taco.cjs.production.min.js +1 -1
  326. package/dist/taco.cjs.production.min.js.map +1 -1
  327. package/dist/utils/dom.d.ts +1 -0
  328. package/package.json +4 -3
  329. package/types.json +20877 -7755
  330. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { forwardRef, createElement } from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { getInputClasses } from '../Input/util.js';
4
4
 
5
5
  const Textarea = /*#__PURE__*/forwardRef(function Textarea(props, ref) {
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../../../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'classnames';\nimport { getInputClasses } from '../Input/util';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** Draws attention to the textarea by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /** Value of the textarea */\n value?: string;\n};\n\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in textarea\n if (event.key.length === 1) {\n event.stopPropagation();\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","defaultValue","_","highlighted","invalid","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","length","stopPropagation","preventDefault","position","currentTarget","value","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;MAaaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQA,CAACE,KAAoB,EAAEC,GAAmC;EAChH,MAAM;IAAEC,YAAY,EAAEC,CAAC;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAE,GAAGC;GAAY,GAAGP,KAAK;EACjF,MAAMQ,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACV,KAAK,CAAC,EAAE,wCAAwC,EAAEA,KAAK,CAACW,SAAS,CAAC;;;;EAKxG,MAAMC,aAAa,GAAIC,KAA+C;;IAElE,IAAIA,KAAK,CAACC,GAAG,CAACC,MAAM,KAAK,CAAC,EAAE;MACxBF,KAAK,CAACG,eAAe,EAAE;;IAG3B,IAAIH,KAAK,CAACC,GAAG,KAAK,MAAM,IAAID,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;MAC7CD,KAAK,CAACI,cAAc,EAAE;MACtB,MAAMC,QAAQ,GAAGL,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACM,aAAa,CAACC,KAAK,CAACL,MAAM,GAAG,CAAC;MAC3EF,KAAK,CAACM,aAAa,CAACE,iBAAiB,CAACH,QAAQ,EAAEA,QAAQ,CAAC;MACzDL,KAAK,CAACM,aAAa,CAACG,SAAS,GAAGT,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACM,aAAa,CAACI,YAAY,GAAG,CAAC;;IAG9F,IAAIjB,SAAS,EAAE;MACXA,SAAS,CAACO,KAAK,CAAC;;GAEvB;EAED,oBAAOd,4CAAcQ,UAAU;IAAEI,SAAS,EAAEH,UAAU;iBAAY,UAAU;IAACF,SAAS,EAAEM,aAAa;IAAEX,GAAG,EAAEA;KAAO;AACvH,CAAC;;;;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../../../../../../src/components/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport { getInputClasses } from '../Input/util';\n\nexport type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement> & {\n /** Draws attention to the textarea by changing its style and making it visually prominent */\n highlighted?: boolean;\n /* Whether the input is in an invalid state */\n invalid?: boolean;\n /** Value of the textarea */\n value?: string;\n};\n\nexport const Textarea = React.forwardRef(function Textarea(props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) {\n const { defaultValue: _, highlighted, invalid, onKeyDown, ...otherProps } = props;\n const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);\n\n // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll\n // if it has scroll height then the browser reverts to native scrolling behaviour only\n // so we manually override it to ensure _our_ desired behaviour remains intact\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n // prevent any external keyboard shortcuts from executing while typing single characters in textarea\n if (event.key.length === 1) {\n event.stopPropagation();\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\n event.currentTarget.setSelectionRange(position, position);\n event.currentTarget.scrollTop = event.key === 'End' ? event.currentTarget.scrollHeight : 0;\n }\n\n if (onKeyDown) {\n onKeyDown(event);\n }\n };\n\n return <textarea {...otherProps} className={classNames} data-taco=\"textarea\" onKeyDown={handleKeyDown} ref={ref} />;\n});\n"],"names":["Textarea","React","props","ref","defaultValue","_","highlighted","invalid","onKeyDown","otherProps","classNames","cn","getInputClasses","className","handleKeyDown","event","key","length","stopPropagation","preventDefault","position","currentTarget","value","setSelectionRange","scrollTop","scrollHeight"],"mappings":";;;;MAaaA,QAAQ,gBAAGC,UAAgB,CAAC,SAASD,QAAQA,CAACE,KAAoB,EAAEC,GAAmC;EAChH,MAAM;IAAEC,YAAY,EAAEC,CAAC;IAAEC,WAAW;IAAEC,OAAO;IAAEC,SAAS;IAAE,GAAGC;GAAY,GAAGP,KAAK;EACjF,MAAMQ,UAAU,GAAGC,EAAE,CAACC,eAAe,CAACV,KAAK,CAAC,EAAE,wCAAwC,EAAEA,KAAK,CAACW,SAAS,CAAC;;;;EAKxG,MAAMC,aAAa,GAAIC,KAA+C;;IAElE,IAAIA,KAAK,CAACC,GAAG,CAACC,MAAM,KAAK,CAAC,EAAE;MACxBF,KAAK,CAACG,eAAe,EAAE;;IAG3B,IAAIH,KAAK,CAACC,GAAG,KAAK,MAAM,IAAID,KAAK,CAACC,GAAG,KAAK,KAAK,EAAE;MAC7CD,KAAK,CAACI,cAAc,EAAE;MACtB,MAAMC,QAAQ,GAAGL,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACM,aAAa,CAACC,KAAK,CAACL,MAAM,GAAG,CAAC;MAC3EF,KAAK,CAACM,aAAa,CAACE,iBAAiB,CAACH,QAAQ,EAAEA,QAAQ,CAAC;MACzDL,KAAK,CAACM,aAAa,CAACG,SAAS,GAAGT,KAAK,CAACC,GAAG,KAAK,KAAK,GAAGD,KAAK,CAACM,aAAa,CAACI,YAAY,GAAG,CAAC;;IAG9F,IAAIjB,SAAS,EAAE;MACXA,SAAS,CAACO,KAAK,CAAC;;GAEvB;EAED,oBAAOd,4CAAcQ,UAAU;IAAEI,SAAS,EAAEH,UAAU;iBAAY,UAAU;IAACF,SAAS,EAAEM,aAAa;IAAEX,GAAG,EAAEA;KAAO;AACvH,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { IconButton } from '../IconButton/IconButton.js';
4
4
  import { useLocalization } from '../Provider/Localization.js';
5
5
  import { useAnimation, motion } from 'framer-motion';
@@ -20,7 +20,7 @@ const Toast = ({
20
20
  autoClose,
21
21
  type = 'default'
22
22
  } = options;
23
- const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow', {
23
+ const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {
24
24
  'border border-grey-200': type === 'default' || type === 'loading' || !type,
25
25
  'border border-grey-500': type === 'success',
26
26
  'border border-blue-500': type === 'information',
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { motion, useAnimation } from 'framer-motion';\nimport useTimer from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Omit<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow', {\n 'border border-grey-200': type === 'default' || type === 'loading' || !type,\n 'border border-grey-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-700': type === 'warning',\n 'border border-red': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"text-grey-700 -mr-2 cursor-pointer self-start !px-0\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["Toast","content","lastUpdated","onClose","handleClose","options","props","texts","useLocalization","autoClose","type","className","cn","timer","useTimer","controls","useAnimation","console","warn","getToastEmptyContentWarning","React","useEffect","start","triggerUpdateAnimation","scale","then","Promise","resolve","e","reject","running","motion","div","animate","onMouseEnter","pause","onMouseLeave","resume","getBadgeIcon","IconButton","appearance","icon","toasts","dismiss","onClick"],"mappings":";;;;;;;;MA4CaA,KAAK,GAAGA,CAAC;EAAEC,OAAO;EAAEC,WAAW;EAAEC,OAAO,EAAEC,WAAW;EAAEC,OAAO;EAAE,GAAGC;CAAmB;EAC/F,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC,SAAS;IAAEC,IAAI,GAAG;GAAW,GAAGL,OAAO;EAC/C,MAAMM,SAAS,GAAGC,EAAE,CAAC,6EAA6E,EAAE;IAChG,wBAAwB,EAAEF,IAAI,KAAK,SAAS,IAAIA,IAAI,KAAK,SAAS,IAAI,CAACA,IAAI;IAC3E,wBAAwB,EAAEA,IAAI,KAAK,SAAS;IAC5C,wBAAwB,EAAEA,IAAI,KAAK,aAAa;IAChD,0BAA0B,EAAEA,IAAI,KAAK,SAAS;IAC9C,mBAAmB,EAAEA,IAAI,KAAK;GACjC,CAAC;EACF,MAAMG,KAAK,GAAGC,QAAQ,CAACL,SAAS,EAAEL,WAAW,CAAC;EAC9C,MAAMW,QAAQ,GAAGC,YAAY,EAAE;EAE/B,IAAI,CAACf,OAAO,EAAE;IACVgB,OAAO,CAACC,IAAI,CAACC,2BAA2B,CAAClB,OAAO,CAAC,CAAC;;EAGtDmB,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIZ,SAAS,EAAE;MACXI,KAAK,CAACS,KAAK,EAAE;;GAEpB,EAAE,CAACb,SAAS,CAAC,CAAC;EAEf,MAAMc,sBAAsB;IAAA;6BAClBR,QAAQ,CAACO,KAAK,CAAC;QAAEE,KAAK,EAAE;OAAM,CAAC,EAAAC,IAAA;QAAA,OAAAC,OAAA,CAAAC,OAAA,CAC/BZ,QAAQ,CAACO,KAAK,CAAC;UAAEE,KAAK,EAAE;SAAG,CAAC,EAAAC,IAAA;;KACrC,QAAAG,CAAA;MAAA,OAAAF,OAAA,CAAAG,MAAA,CAAAD,CAAA;;;EAEDR,cAAK,CAACC,SAAS,CAAC;IACZ,IAAInB,WAAW,EAAE;MACbqB,sBAAsB,EAAE;MAExB,IAAIV,KAAK,CAACiB,OAAO,EAAE;QACfjB,KAAK,CAACS,KAAK,EAAE;;;GAGxB,EAAE,CAACpB,WAAW,CAAC,CAAC;EAEjB,oBACIkB,6BAACW,MAAM,CAACC,GAAG,oBACH1B,KAAK;IACT2B,OAAO,EAAElB,QAAQ;IACjBJ,SAAS,EAAEA,SAAS;iBACV,OAAO;IACjBuB,YAAY,EAAErB,KAAK,CAACsB,KAAK;IACzBC,YAAY,EAAEvB,KAAK,CAACwB;MACnBC,YAAY,CAAC5B,IAAI,CAAC,eACnBU;IAAKT,SAAS,EAAC;KAAaV,OAAO,CAAO,eAC1CmB,6BAACmB,UAAU;IACPC,UAAU,EAAC,UAAU;IACrB7B,SAAS,EAAC,qDAAqD;IAC/D8B,IAAI,EAAC,OAAO;kBACAlC,KAAK,CAACmC,MAAM,CAACC,OAAO;IAChCC,OAAO,EAAExC;IACX,CACO;AAErB;;;;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { motion, useAnimation } from 'framer-motion';\nimport useTimer from '../../utils/hooks/useTimer';\nimport { getBadgeIcon, getToastEmptyContentWarning } from './util';\nimport { State } from '../../types';\nimport { useLocalization } from '../Provider/Localization';\nimport { IconButton } from '../IconButton/IconButton';\n\nexport type ToastsTexts = {\n /** Aria-label for the close icon button of toast */\n dismiss: string;\n};\n\nexport type ToastType = Omit<State, 'default'> | 'loading';\nexport type ToastOptions = {\n /** Provide time in milliseconds after which the toast should autoclose */\n autoClose?: number;\n /**\n * State will change the icon displayed in toast and other characteristics,\n * for e.g. `loading` state will display a progress animation.\n * Default value is `default`\n */\n type?: ToastType;\n};\nexport type ToastContent = Omit<React.ReactNode, 'null' | 'undefined'>;\nexport type ToastProps = {\n /** Provide a unique id for toast */\n id: string;\n /**\n * Content can be any valid react node, for e.g. a `div`, or a simple text.\n */\n content: ToastContent;\n /** Additional options to define your toast */\n options: ToastOptions;\n /**\n * Handler called when toast closes.\n * To read more about how to provide the text, see [Provider](component:provider) component\n */\n onClose: () => void;\n lastUpdated?: number;\n lastDuplicateId?: string;\n};\n\nexport const Toast = ({ content, lastUpdated, onClose: handleClose, options, ...props }: ToastProps): JSX.Element => {\n const { texts } = useLocalization();\n const { autoClose, type = 'default' } = options;\n const className = cn('bg-white relative flex items-center py-1 px-2 mt-3 w-full rounded yt-shadow print:hidden', {\n 'border border-grey-200': type === 'default' || type === 'loading' || !type,\n 'border border-grey-500': type === 'success',\n 'border border-blue-500': type === 'information',\n 'border border-yellow-700': type === 'warning',\n 'border border-red': type === 'error',\n });\n const timer = useTimer(autoClose, handleClose);\n const controls = useAnimation();\n\n if (!content) {\n console.warn(getToastEmptyContentWarning(content));\n }\n\n React.useEffect(() => {\n if (autoClose) {\n timer.start();\n }\n }, [autoClose]);\n\n const triggerUpdateAnimation = async () => {\n await controls.start({ scale: 1.05 });\n await controls.start({ scale: 1 });\n };\n\n React.useEffect(() => {\n if (lastUpdated) {\n triggerUpdateAnimation();\n\n if (timer.running) {\n timer.start();\n }\n }\n }, [lastUpdated]);\n\n return (\n <motion.div\n {...props}\n animate={controls}\n className={className}\n data-taco=\"toast\"\n onMouseEnter={timer.pause}\n onMouseLeave={timer.resume}>\n {getBadgeIcon(type)}\n <div className=\"flex-grow\">{content}</div>\n <IconButton\n appearance=\"discrete\"\n className=\"text-grey-700 -mr-2 cursor-pointer self-start !px-0\"\n icon=\"close\"\n aria-label={texts.toasts.dismiss}\n onClick={handleClose}\n />\n </motion.div>\n );\n};\n"],"names":["Toast","content","lastUpdated","onClose","handleClose","options","props","texts","useLocalization","autoClose","type","className","cn","timer","useTimer","controls","useAnimation","console","warn","getToastEmptyContentWarning","React","useEffect","start","triggerUpdateAnimation","scale","then","Promise","resolve","e","reject","running","motion","div","animate","onMouseEnter","pause","onMouseLeave","resume","getBadgeIcon","IconButton","appearance","icon","toasts","dismiss","onClick"],"mappings":";;;;;;;;MA4CaA,KAAK,GAAGA,CAAC;EAAEC,OAAO;EAAEC,WAAW;EAAEC,OAAO,EAAEC,WAAW;EAAEC,OAAO;EAAE,GAAGC;CAAmB;EAC/F,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EACnC,MAAM;IAAEC,SAAS;IAAEC,IAAI,GAAG;GAAW,GAAGL,OAAO;EAC/C,MAAMM,SAAS,GAAGC,EAAE,CAAC,0FAA0F,EAAE;IAC7G,wBAAwB,EAAEF,IAAI,KAAK,SAAS,IAAIA,IAAI,KAAK,SAAS,IAAI,CAACA,IAAI;IAC3E,wBAAwB,EAAEA,IAAI,KAAK,SAAS;IAC5C,wBAAwB,EAAEA,IAAI,KAAK,aAAa;IAChD,0BAA0B,EAAEA,IAAI,KAAK,SAAS;IAC9C,mBAAmB,EAAEA,IAAI,KAAK;GACjC,CAAC;EACF,MAAMG,KAAK,GAAGC,QAAQ,CAACL,SAAS,EAAEL,WAAW,CAAC;EAC9C,MAAMW,QAAQ,GAAGC,YAAY,EAAE;EAE/B,IAAI,CAACf,OAAO,EAAE;IACVgB,OAAO,CAACC,IAAI,CAACC,2BAA2B,CAAClB,OAAO,CAAC,CAAC;;EAGtDmB,cAAK,CAACC,SAAS,CAAC;IACZ,IAAIZ,SAAS,EAAE;MACXI,KAAK,CAACS,KAAK,EAAE;;GAEpB,EAAE,CAACb,SAAS,CAAC,CAAC;EAEf,MAAMc,sBAAsB;IAAA;6BAClBR,QAAQ,CAACO,KAAK,CAAC;QAAEE,KAAK,EAAE;OAAM,CAAC,EAAAC,IAAA;QAAA,OAAAC,OAAA,CAAAC,OAAA,CAC/BZ,QAAQ,CAACO,KAAK,CAAC;UAAEE,KAAK,EAAE;SAAG,CAAC,EAAAC,IAAA;;KACrC,QAAAG,CAAA;MAAA,OAAAF,OAAA,CAAAG,MAAA,CAAAD,CAAA;;;EAEDR,cAAK,CAACC,SAAS,CAAC;IACZ,IAAInB,WAAW,EAAE;MACbqB,sBAAsB,EAAE;MAExB,IAAIV,KAAK,CAACiB,OAAO,EAAE;QACfjB,KAAK,CAACS,KAAK,EAAE;;;GAGxB,EAAE,CAACpB,WAAW,CAAC,CAAC;EAEjB,oBACIkB,6BAACW,MAAM,CAACC,GAAG,oBACH1B,KAAK;IACT2B,OAAO,EAAElB,QAAQ;IACjBJ,SAAS,EAAEA,SAAS;iBACV,OAAO;IACjBuB,YAAY,EAAErB,KAAK,CAACsB,KAAK;IACzBC,YAAY,EAAEvB,KAAK,CAACwB;MACnBC,YAAY,CAAC5B,IAAI,CAAC,eACnBU;IAAKT,SAAS,EAAC;KAAaV,OAAO,CAAO,eAC1CmB,6BAACmB,UAAU;IACPC,UAAU,EAAC,UAAU;IACrB7B,SAAS,EAAC,qDAAqD;IAC/D8B,IAAI,EAAC,OAAO;kBACAlC,KAAK,CAACmC,MAAM,CAACC,OAAO;IAChCC,OAAO,EAAExC;IACX,CACO;AAErB;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { forwardRef, createElement } from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
  import { Root, Trigger, Portal, Content, Arrow } from '@radix-ui/react-tooltip';
4
4
 
5
5
  const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
@@ -25,7 +25,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
25
25
  side: placement,
26
26
  sideOffset: 3
27
27
  }), /*#__PURE__*/createElement("div", {
28
- className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white",
28
+ className: "xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white print:hidden",
29
29
  "data-taco": "tooltip",
30
30
  style: {
31
31
  transformOrigin: 'var(--radix-tooltip-content-transform-origin)'
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn from 'classnames';\n\nexport type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Use this value to hide tooltip conditionally */\n hide?: boolean;\n /** Text displayed in the tooltip */\n title: string | JSX.Element;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, hide = false, ...otherProps } = props;\n const className = cn(otherProps.className);\n\n if (hide) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root delayDuration={250}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content {...otherProps} asChild className={className} side={placement} sideOffset={3}>\n <div\n className=\"xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"-mt-px fill-blue-900/90 stroke-blue-900/90\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","hide","otherProps","className","cn","TooltipPrimitive","delayDuration","asChild","side","sideOffset","style","transformOrigin"],"mappings":";;;;MAkBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASD,OAAOA,CAACE,KAAmB,EAAEC,GAA2B;EACrG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACzE,MAAMO,SAAS,GAAGC,EAAE,CAACF,UAAU,CAACC,SAAS,CAAC;EAE1C,IAAIF,IAAI,EAAE;IACN,OAAOF,QAAQ;;EAGnB,oBACIJ,cAACU,IAAqB;IAACC,aAAa,EAAE;kBAClCX,cAACU,OAAwB;IAACE,OAAO;IAACV,GAAG,EAAEA;KAClCE,QAAQ,CACc,eAC3BJ,cAACU,MAAuB,qBACpBV,cAACU,OAAwB,oBAAKH,UAAU;IAAEK,OAAO;IAACJ,SAAS,EAAEA,SAAS;IAAEK,IAAI,EAAER,SAAS;IAAES,UAAU,EAAE;mBACjGd;IACIQ,SAAS,EAAC,8IAA8I;iBAC9I,SAAS;IACnBO,KAAK,EAAE;MACHC,eAAe,EAAE;;kBAErBhB,cAACU,KAAsB;IAACF,SAAS,EAAC;IAA+C,EAChFL,KAAK,CACJ,CACiB,CACL,CACN;AAEhC,CAAC;;;;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../../../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip';\nimport cn from 'clsx';\n\nexport type TooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> & {\n /** The element which activates the tooltip when hovered. Should be a single React/HTML element */\n children: React.ReactElement | any;\n /** Use this value to hide tooltip conditionally */\n hide?: boolean;\n /** Text displayed in the tooltip */\n title: string | JSX.Element;\n /**\n * Placement of the tooltip relative to the reference element. Placement will be reversed if a collision occurs\n * @defaultValue bottom\n */\n placement?: 'top' | 'right' | 'bottom' | 'left';\n};\n\nexport const Tooltip = React.forwardRef(function Tooltip(props: TooltipProps, ref: React.Ref<HTMLElement>) {\n const { title, children, placement, hide = false, ...otherProps } = props;\n const className = cn(otherProps.className);\n\n if (hide) {\n return children;\n }\n\n return (\n <TooltipPrimitive.Root delayDuration={250}>\n <TooltipPrimitive.Trigger asChild ref={ref as any}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content {...otherProps} asChild className={className} side={placement} sideOffset={3}>\n <div\n className=\"xs:max-w-[theme(spacing.56)] max-w-[theme(spacing.32)] animate-[fade-in_150ms] rounded-sm bg-blue-900 px-2 py-1 text-xs font-bold text-white print:hidden\"\n data-taco=\"tooltip\"\n style={{\n transformOrigin: 'var(--radix-tooltip-content-transform-origin)',\n }}>\n <TooltipPrimitive.Arrow className=\"-mt-px fill-blue-900/90 stroke-blue-900/90\" />\n {title}\n </div>\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n </TooltipPrimitive.Root>\n );\n});\n"],"names":["Tooltip","React","props","ref","title","children","placement","hide","otherProps","className","cn","TooltipPrimitive","delayDuration","asChild","side","sideOffset","style","transformOrigin"],"mappings":";;;;MAkBaA,OAAO,gBAAGC,UAAgB,CAAC,SAASD,OAAOA,CAACE,KAAmB,EAAEC,GAA2B;EACrG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC,SAAS;IAAEC,IAAI,GAAG,KAAK;IAAE,GAAGC;GAAY,GAAGN,KAAK;EACzE,MAAMO,SAAS,GAAGC,EAAE,CAACF,UAAU,CAACC,SAAS,CAAC;EAE1C,IAAIF,IAAI,EAAE;IACN,OAAOF,QAAQ;;EAGnB,oBACIJ,cAACU,IAAqB;IAACC,aAAa,EAAE;kBAClCX,cAACU,OAAwB;IAACE,OAAO;IAACV,GAAG,EAAEA;KAClCE,QAAQ,CACc,eAC3BJ,cAACU,MAAuB,qBACpBV,cAACU,OAAwB,oBAAKH,UAAU;IAAEK,OAAO;IAACJ,SAAS,EAAEA,SAAS;IAAEK,IAAI,EAAER,SAAS;IAAES,UAAU,EAAE;mBACjGd;IACIQ,SAAS,EAAC,2JAA2J;iBAC3J,SAAS;IACnBO,KAAK,EAAE;MACHC,eAAe,EAAE;;kBAErBhB,cAACU,KAAsB;IAACF,SAAS,EAAC;IAA+C,EAChFL,KAAK,CACJ,CACiB,CACL,CACN;AAEhC,CAAC;;;;"}
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import cn from 'classnames';
2
+ import cn from 'clsx';
3
3
 
4
4
  const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
5
5
  return /*#__PURE__*/React__default.createElement("a", Object.assign({}, props, {
@@ -1 +1 @@
1
- {"version":3,"file":"Treeview.js","sources":["../../../../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef(function TreeviewItem(props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef(function TreeviewGroup(props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedTreeviewWithStatics = React.ForwardRefExoticComponent<\n TreeviewProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef(function Treeview(props: TreeviewProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as ForwardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","className","externalClassName","expanded","initialExpanded","title","fixed","onClick","otherProps","setExpanded","useState","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;AAKA,MAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAiC;EACnH,oBAAOH,oDAAOE,KAAK;IAAEC,GAAG,EAAEA;KAAO;AACrC,CAAC,CAAC;AAkBF,MAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAU,CAAC,SAASG,aAAaA,CAACF,KAAyB,EAAEC,GAA8B;EACnH,MAAM;IACFE,QAAQ;IACRC,SAAS,EAAEC,iBAAiB;IAC5BC,QAAQ,EAAEC,eAAe,GAAG,KAAK;IACjCC,KAAK;IACLC,KAAK;IACLC,OAAO;IACP,GAAGC;GACN,GAAGX,KAAK;EACT,MAAM,CAACM,QAAQ,EAAEM,WAAW,CAAC,GAAGd,cAAK,CAACe,QAAQ,CAACJ,KAAK,IAAIF,eAAe,CAAC;EAExET,cAAK,CAACgB,SAAS,CAAC;IACZ,IAAI,CAACL,KAAK,EAAE;MACRG,WAAW,CAACH,KAAK,IAAIF,eAAe,CAAC;;GAE5C,EAAE,CAACE,KAAK,EAAEF,eAAe,CAAC,CAAC;EAE5B,MAAMQ,aAAa,GAAGC,EAAE,CAAC,eAAe,EAAE;IACtCC,IAAI,EAAEX,QAAQ;IACdY,MAAM,EAAE,CAACZ;GACZ,CAAC;EAEF,MAAMa,SAAS,GAAG;IACd,GAAGR,UAAU;IACb,eAAe,EAAEL,QAAQ;IACzBc,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAE,CAAC;GACd;EAED,MAAMC,WAAW,GAAIC,KAAuC;IACxD,MAAMC,SAAS,GAAG,CAAClB,QAAQ;IAE3B,IAAI,CAACG,KAAK,EAAE;MACRG,WAAW,CAACY,SAAS,CAAC;;IAG1B,IAAId,OAAO,EAAE;MACTA,OAAO,CAACa,KAAK,EAAEC,SAAS,CAAC;;GAEhC;EAED,MAAMpB,SAAS,GAAG,OAAOC,iBAAiB,KAAK,UAAU,GAAGA,iBAAiB,CAACC,QAAQ,CAAC,GAAGD,iBAAiB;EAE3G,oBACIP,sDAASqB,SAAS;IAAEf,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;mBAC3CH;IAAKY,OAAO,EAAEY;KAAc,OAAOd,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACF,QAAQ,CAAC,GAAGE,KAAK,CAAO,eACxFV;IAAIsB,IAAI,EAAC,OAAO;IAAChB,SAAS,EAAEW;KACvBjB,cAAK,CAAC2B,QAAQ,CAACC,OAAO,CAACvB,QAAQ,CAAC,CAC5BwB,MAAM,CAACC,IAAI,IAAI,CAAC,CAACA,IAAI,CAAC,CACtBC,GAAG,CAAC,CAACD,IAAI,EAAEE,CAAC,oBACThC;IAAIiC,GAAG,EAAED,CAAC;IAAEV,IAAI,EAAC;kBACZtB,cAAK,CAACkC,YAAY,CAACJ,IAA+B,EAAE;IAAER,IAAI,EAAE;GAAY,CAAC,CACzE,CACR,CAAC,CACL,CACH;AAEd,CAAC,CAAC;MAaWa,QAAQ,gBAAGnC,cAAK,CAACC,UAAU,CAAC,SAASkC,QAAQA,CAACjC,KAAoB,EAAEC,GAA8B;EAC3G,oBAAOH,sDAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEmB,IAAI,EAAC;KAAS;AACnD,CAAC;AAEDa,QAAQ,CAACC,KAAK,GAAGhC,aAAa;AAC9B+B,QAAQ,CAACE,IAAI,GAAGtC,YAAY;;;;"}
1
+ {"version":3,"file":"Treeview.js","sources":["../../../../../../../src/components/Treeview/Treeview.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\n\nexport type TreeviewItemProps = React.LinkHTMLAttributes<HTMLAnchorElement>;\n\nconst TreeviewItem = React.forwardRef(function TreeviewItem(props: TreeviewItemProps, ref: React.Ref<HTMLAnchorElement>) {\n return <a {...props} ref={ref} />;\n});\n\nexport type TreeviewGroupProps = Omit<React.LinkHTMLAttributes<HTMLDivElement>, 'className' | 'onClick' | 'title'> & {\n /** Add a classname to the treeview */\n className?: string | ((expanded: boolean) => string);\n /**\n * Set wheter the region is expanded, showing the children, or collapsed.\n * Default value is `false`\n */\n expanded?: boolean;\n /** Region is expanded at mount and can't be collapsed */\n fixed?: boolean;\n /** Handler called when user clicks the title of the group */\n onClick?: (event: React.MouseEvent<HTMLDivElement>, expanded: boolean) => void;\n /** Text displayed in the group's header */\n title: React.ReactNode | ((expanded: boolean) => React.ReactNode);\n};\n\nconst TreeviewGroup = React.forwardRef(function TreeviewGroup(props: TreeviewGroupProps, ref: React.Ref<HTMLDivElement>) {\n const {\n children,\n className: externalClassName,\n expanded: initialExpanded = false,\n title,\n fixed,\n onClick,\n ...otherProps\n } = props;\n const [expanded, setExpanded] = React.useState(fixed || initialExpanded);\n\n React.useEffect(() => {\n if (!fixed) {\n setExpanded(fixed || initialExpanded);\n }\n }, [fixed, initialExpanded]);\n\n const listClassName = cn('flex-col mb-0', {\n flex: expanded,\n hidden: !expanded,\n });\n\n const itemProps = {\n ...otherProps,\n 'aria-expanded': expanded,\n role: 'treeitem',\n tabIndex: -1,\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>): void => {\n const nextState = !expanded;\n\n if (!fixed) {\n setExpanded(nextState);\n }\n\n if (onClick) {\n onClick(event, nextState);\n }\n };\n\n const className = typeof externalClassName === 'function' ? externalClassName(expanded) : externalClassName;\n\n return (\n <div {...itemProps} className={className} ref={ref}>\n <div onClick={handleClick}>{typeof title === 'function' ? title(expanded) : title}</div>\n <ul role=\"group\" className={listClassName}>\n {React.Children.toArray(children)\n .filter(item => !!item)\n .map((item, i) => (\n <li key={i} role=\"none\">\n {React.cloneElement(item as React.ReactElement<any>, { role: 'treeitem' })}\n </li>\n ))}\n </ul>\n </div>\n );\n});\n\nexport type TreeviewProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport type ForwardedTreeviewWithStatics = React.ForwardRefExoticComponent<\n TreeviewProps & React.RefAttributes<HTMLDivElement>\n> & {\n /** Navigable link */\n Item: React.ForwardRefExoticComponent<TreeviewItemProps & React.RefAttributes<HTMLAnchorElement>>;\n /** Container for a set of related links, usually expandable */\n Group: React.ForwardRefExoticComponent<TreeviewGroupProps & React.RefAttributes<HTMLDivElement>>;\n};\n\nexport const Treeview = React.forwardRef(function Treeview(props: TreeviewProps, ref: React.Ref<HTMLDivElement>) {\n return <div {...props} ref={ref} role=\"tree\" />;\n}) as ForwardedTreeviewWithStatics;\n\nTreeview.Group = TreeviewGroup;\nTreeview.Item = TreeviewItem;\n"],"names":["TreeviewItem","React","forwardRef","props","ref","TreeviewGroup","children","className","externalClassName","expanded","initialExpanded","title","fixed","onClick","otherProps","setExpanded","useState","useEffect","listClassName","cn","flex","hidden","itemProps","role","tabIndex","handleClick","event","nextState","Children","toArray","filter","item","map","i","key","cloneElement","Treeview","Group","Item"],"mappings":";;;AAKA,MAAMA,YAAY,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CAACG,KAAwB,EAAEC,GAAiC;EACnH,oBAAOH,oDAAOE,KAAK;IAAEC,GAAG,EAAEA;KAAO;AACrC,CAAC,CAAC;AAkBF,MAAMC,aAAa,gBAAGJ,cAAK,CAACC,UAAU,CAAC,SAASG,aAAaA,CAACF,KAAyB,EAAEC,GAA8B;EACnH,MAAM;IACFE,QAAQ;IACRC,SAAS,EAAEC,iBAAiB;IAC5BC,QAAQ,EAAEC,eAAe,GAAG,KAAK;IACjCC,KAAK;IACLC,KAAK;IACLC,OAAO;IACP,GAAGC;GACN,GAAGX,KAAK;EACT,MAAM,CAACM,QAAQ,EAAEM,WAAW,CAAC,GAAGd,cAAK,CAACe,QAAQ,CAACJ,KAAK,IAAIF,eAAe,CAAC;EAExET,cAAK,CAACgB,SAAS,CAAC;IACZ,IAAI,CAACL,KAAK,EAAE;MACRG,WAAW,CAACH,KAAK,IAAIF,eAAe,CAAC;;GAE5C,EAAE,CAACE,KAAK,EAAEF,eAAe,CAAC,CAAC;EAE5B,MAAMQ,aAAa,GAAGC,EAAE,CAAC,eAAe,EAAE;IACtCC,IAAI,EAAEX,QAAQ;IACdY,MAAM,EAAE,CAACZ;GACZ,CAAC;EAEF,MAAMa,SAAS,GAAG;IACd,GAAGR,UAAU;IACb,eAAe,EAAEL,QAAQ;IACzBc,IAAI,EAAE,UAAU;IAChBC,QAAQ,EAAE,CAAC;GACd;EAED,MAAMC,WAAW,GAAIC,KAAuC;IACxD,MAAMC,SAAS,GAAG,CAAClB,QAAQ;IAE3B,IAAI,CAACG,KAAK,EAAE;MACRG,WAAW,CAACY,SAAS,CAAC;;IAG1B,IAAId,OAAO,EAAE;MACTA,OAAO,CAACa,KAAK,EAAEC,SAAS,CAAC;;GAEhC;EAED,MAAMpB,SAAS,GAAG,OAAOC,iBAAiB,KAAK,UAAU,GAAGA,iBAAiB,CAACC,QAAQ,CAAC,GAAGD,iBAAiB;EAE3G,oBACIP,sDAASqB,SAAS;IAAEf,SAAS,EAAEA,SAAS;IAAEH,GAAG,EAAEA;mBAC3CH;IAAKY,OAAO,EAAEY;KAAc,OAAOd,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACF,QAAQ,CAAC,GAAGE,KAAK,CAAO,eACxFV;IAAIsB,IAAI,EAAC,OAAO;IAAChB,SAAS,EAAEW;KACvBjB,cAAK,CAAC2B,QAAQ,CAACC,OAAO,CAACvB,QAAQ,CAAC,CAC5BwB,MAAM,CAACC,IAAI,IAAI,CAAC,CAACA,IAAI,CAAC,CACtBC,GAAG,CAAC,CAACD,IAAI,EAAEE,CAAC,oBACThC;IAAIiC,GAAG,EAAED,CAAC;IAAEV,IAAI,EAAC;kBACZtB,cAAK,CAACkC,YAAY,CAACJ,IAA+B,EAAE;IAAER,IAAI,EAAE;GAAY,CAAC,CACzE,CACR,CAAC,CACL,CACH;AAEd,CAAC,CAAC;MAaWa,QAAQ,gBAAGnC,cAAK,CAACC,UAAU,CAAC,SAASkC,QAAQA,CAACjC,KAAoB,EAAEC,GAA8B;EAC3G,oBAAOH,sDAASE,KAAK;IAAEC,GAAG,EAAEA,GAAG;IAAEmB,IAAI,EAAC;KAAS;AACnD,CAAC;AAEDa,QAAQ,CAACC,KAAK,GAAGhC,aAAa;AAC9B+B,QAAQ,CAACE,IAAI,GAAGtC,YAAY;;;;"}
@@ -0,0 +1,27 @@
1
+ // filtering
2
+ var TableFilterComparator;
3
+ (function (TableFilterComparator) {
4
+ TableFilterComparator[TableFilterComparator["Contains"] = 0] = "Contains";
5
+ TableFilterComparator[TableFilterComparator["DoesNotContain"] = 1] = "DoesNotContain";
6
+ TableFilterComparator[TableFilterComparator["IsEqualTo"] = 2] = "IsEqualTo";
7
+ TableFilterComparator[TableFilterComparator["IsNotEqualTo"] = 3] = "IsNotEqualTo";
8
+ TableFilterComparator[TableFilterComparator["IsGreaterThan"] = 4] = "IsGreaterThan";
9
+ TableFilterComparator[TableFilterComparator["IsLessThan"] = 5] = "IsLessThan";
10
+ TableFilterComparator[TableFilterComparator["IsBetween"] = 6] = "IsBetween";
11
+ TableFilterComparator[TableFilterComparator["IsEmpty"] = 7] = "IsEmpty";
12
+ TableFilterComparator[TableFilterComparator["IsNotEmpty"] = 8] = "IsNotEmpty";
13
+ TableFilterComparator[TableFilterComparator["IsLessThanOrEqualTo"] = 9] = "IsLessThanOrEqualTo";
14
+ TableFilterComparator[TableFilterComparator["IsGreaterThanOrEqualTo"] = 10] = "IsGreaterThanOrEqualTo";
15
+ TableFilterComparator[TableFilterComparator["HasAnyOf"] = 11] = "HasAnyOf";
16
+ TableFilterComparator[TableFilterComparator["HasAllOf"] = 12] = "HasAllOf";
17
+ TableFilterComparator[TableFilterComparator["HasNoneOf"] = 13] = "HasNoneOf";
18
+ })(TableFilterComparator || (TableFilterComparator = {}));
19
+ var TableServerLoadAllState;
20
+ (function (TableServerLoadAllState) {
21
+ TableServerLoadAllState[TableServerLoadAllState["Incomplete"] = 0] = "Incomplete";
22
+ TableServerLoadAllState[TableServerLoadAllState["Loading"] = 1] = "Loading";
23
+ TableServerLoadAllState[TableServerLoadAllState["Completed"] = 2] = "Completed";
24
+ })(TableServerLoadAllState || (TableServerLoadAllState = {}));
25
+
26
+ export { TableFilterComparator, TableServerLoadAllState };
27
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sources":["../../../../../../../src/primitives/Table/types.ts"],"sourcesContent":["import {\n ColumnFilter as ReactTableColumnFilter,\n ColumnFiltersState as ReactTableColumnFilterState,\n ColumnOrderState as ReactTableColumnOrderState,\n ColumnPinningState as ReactTableColumnPinningState,\n ColumnSort as ReactTableColumnSort,\n ColumnSizingState as ReactTableColumnSizingState,\n GroupingState as ReactTableGroupingState,\n VisibilityState as ReactTableColumnVisibilityState,\n SortingState as ReactTableSortingState,\n BuiltInAggregationFn as ReactTableBuiltInAggregationFn,\n BuiltInSortingFn as ReactTableBuiltInSortingFn,\n HeaderContext as ReactTableHeaderContext,\n CellContext as ReactTableCellContext,\n ColumnMeta as ReactTableColumnMeta,\n} from '@tanstack/react-table';\nimport { FontSizes, ValueOf } from '../../types';\nimport { MenuProps } from '../../components/Menu/Menu';\n\ntype TODO = any;\n\nexport type TableRef = HTMLTableElement & {\n instance: {\n resetFiltering: () => void;\n resetRowExpansion: () => void;\n resetRowSelection: () => void;\n resetSorting: () => void;\n };\n};\n\n// filtering\nexport enum TableFilterComparator {\n Contains,\n DoesNotContain,\n IsEqualTo,\n IsNotEqualTo,\n IsGreaterThan,\n IsLessThan,\n IsBetween,\n IsEmpty,\n IsNotEmpty,\n IsLessThanOrEqualTo,\n IsGreaterThanOrEqualTo,\n HasAnyOf,\n HasAllOf,\n HasNoneOf,\n}\nexport type TableFilterValue = {\n comparator: TableFilterComparator;\n value: any;\n};\nexport type TableFilter = {\n id: string;\n value: TableFilterValue;\n};\n\n// columns\nexport type TableColumnAlignment = 'left' | 'center' | 'right';\nexport type TableColumnClassNameHandler<TType = unknown> = string | ((row: TType) => string | undefined);\nexport type TableColumnDataType = 'auto' | 'number' | 'alphanumeric' | 'alphanumericCaseSensitive' | 'datetime' | 'boolean';\nexport type TableColumnFilter = ReactTableColumnFilter;\nexport type TableColumnMenu = (props: Partial<MenuProps>) => JSX.Element;\nexport type TableColumnRenderer<TType, TValue> = (value: TValue, row: TType) => JSX.Element | string | number | null;\nexport type TableColumnRendererAggregate<TType, TValue> = (value: TValue, row: TType) => JSX.Element | string | number | null;\nexport type TableColumnRendererControl<TType = unknown> =\n | ((props: TableColumnRendererControlProps, row?: TType) => JSX.Element)\n | 'datepicker'\n | 'input'\n | 'switch'\n | 'textarea';\nexport type TableColumnRendererControlProps = {\n className?: string;\n disabled?: boolean;\n invalid?: boolean;\n onBlur?: (value: unknown) => void;\n onFocus?: React.FocusEventHandler;\n readOnly?: boolean;\n ref: React.RefObject<HTMLElement> | ((instance: HTMLElement | null | undefined) => void);\n setValue: (value: unknown) => void;\n value: unknown;\n};\nexport type TableColumnRendererHeader = string;\nexport type TableColumnRendererFooter<TValue> = (values: TValue[]) => JSX.Element | string | number | null;\nexport type TableColumnSort = ReactTableColumnSort;\nexport type TableColumnSortDirection = 'asc' | 'desc';\nexport type TableColumnSortFn<TType = unknown> =\n | ((rowA: TType, rowB: TType, columnId: string) => -1 | 0 | 1)\n | ReactTableBuiltInSortingFn\n | 'auto';\nexport type TableColumnWidth = number | 'grow';\n\n// rows\nexport type TableRowActionRenderer<TType = unknown> = (row: TType) => JSX.Element | null;\nexport type TableRowActionGroupRenderer<TType = unknown> = (rows: TType[]) => JSX.Element | null;\nexport type TableRowClickHandler<TType = unknown> = (row: TType) => void;\nexport type TableRowGotoHandler = (\n column: string,\n query: string,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<number>;\nexport type TableRowHeight = 'short' | 'medium' | 'tall' | 'extra-tall';\nexport type TableRowSelectHandler<TType = unknown> = (rows: TType[]) => void;\n\n// shortcuts\nexport type TableShortcutHandlerFn<TType = unknown> = (row: TType) => void;\nexport type TableShortcutHandlerObject<TType = unknown> = {\n handler: TableShortcutHandlerFn<TType>;\n meta?: boolean;\n shift?: boolean;\n};\n\n// table\nexport type TableFilterHandler = (filters: TableColumnFilter[]) => void;\nexport type TableFontSize = keyof typeof FontSizes;\nexport type TablePreset = 'lite' | 'complex';\nexport type TableRowExpansionRenderer<TType = unknown> = (row: TType) => (() => JSX.Element) | null;\nexport type TableScrollToIndexHandler = (index: number, options?: { align: 'start' | 'center' | 'end' | 'auto' }) => void;\nexport type TableServerLoadPageHandler = (\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport type TableServerLoadAllHandler = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport enum TableServerLoadAllState {\n Incomplete,\n Loading,\n Completed,\n}\nexport type TableSettingsHandler = (settings: TableSettings) => void | Promise<void>;\nexport type TableShortcuts<TType = unknown> = Record<string, TableShortcutHandlerFn<TType> | TableShortcutHandlerObject<TType>>;\nexport type TableSortHandler = (sorting: TableColumnSort[]) => void;\n\n// settings\nexport type TableSettings = {\n columnFilters?: ReactTableColumnFilterState;\n columnOrder?: ReactTableColumnOrderState;\n columnPinning?: ReactTableColumnPinningState;\n columnSizing?: ReactTableColumnSizingState;\n columnVisibility?: ReactTableColumnVisibilityState;\n excludeUnmatchedRecordsInSearch?: boolean;\n fontSize?: TableFontSize;\n grouping?: ReactTableGroupingState;\n rowHeight?: TableRowHeight;\n showWarningWhenPrintingLargeDataset?: boolean;\n searchQuery?: string;\n sorting?: ReactTableSortingState;\n};\n\n// props\nexport type TableFeatureProps = {\n // react-table built-in\n enableFiltering?: boolean;\n enableSearch?: boolean;\n enableSorting?: boolean;\n enableColumnFreezing?: boolean;\n enableColumnHiding?: boolean;\n enableColumnResizing?: boolean;\n enableRowExpansion?: boolean;\n enableRowSelection?: boolean;\n enableRowSelectionSingle?: boolean;\n\n // custom -- common between all table types\n enableColumnOrdering?: boolean;\n enableFontSize?: boolean;\n enableFooter?: boolean;\n enablePrinting?: boolean;\n enableRowActions?: boolean;\n enableRowActive?: boolean;\n enableRowClick?: boolean;\n enableRowGoto?: boolean;\n enableRowHeight?: boolean;\n enableSettings?: boolean;\n};\n\nexport type useTableInternalColumn<TType = unknown> = {\n header?: (info: ReactTableHeaderContext<TType, unknown>) => JSX.Element | string | null;\n renderer: (info: ReactTableCellContext<TType, unknown>) => JSX.Element | string | null;\n meta?: ReactTableColumnMeta<TType, unknown>;\n size?: number;\n};\n\nexport type useTableInternalColumns<TType = unknown> = {\n rowActions?: useTableInternalColumn<TType>;\n rowExpansion?: useTableInternalColumn<TType>;\n rowSelection?: useTableInternalColumn<TType>;\n};\n\ntype useTableCommonProps<TType = unknown> = TableFeatureProps & {\n children: (JSX.Element | boolean | null | undefined)[];\n data: TType[];\n id: string;\n\n // misc\n defaultColumnFreezingIndex?: number;\n defaultRowActiveIndex?: number;\n defaultRowGroupColumnId?: keyof TType;\n defaultSettings?: TableSettings;\n preset?: TablePreset;\n rowActions?: TableRowActionRenderer<TType>[];\n rowActionsForGroup?: TableRowActionGroupRenderer<TType>[];\n rowActionsLength?: number;\n rowExpansionRenderer?: TableRowExpansionRenderer<TType>;\n shortcuts?: TableShortcuts<TType>;\n\n // handlers\n onRowClick?: TableRowClickHandler<TType>;\n onRowGoto?: TableRowGotoHandler;\n onRowSelect?: TableRowSelectHandler<TType>;\n\n // state change handlers\n onChangeFilter?: TableFilterHandler;\n onChangeSearch?: TODO; // not currently supported\n onChangeSettings?: TableSettingsHandler;\n onChangeSort?: TableSortHandler;\n};\n\ninterface useTableClientProps<TType = unknown> extends useTableCommonProps<TType> {\n length?: never;\n loadAll?: never;\n loadPage?: never;\n pageSize?: never;\n}\n\ninterface useTableServerProps<TType = unknown> extends useTableCommonProps<TType> {\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n pageSize?: number;\n}\n\nexport type useTableProps<TType = unknown> = useTableClientProps<TType> | useTableServerProps<TType>;\n\nexport type TableColumnProps<TType = unknown> = ValueOf<{\n [Key in keyof TType]: {\n accessor?: Key;\n id: string;\n } & {\n // renderers\n renderer?: TableColumnRenderer<TType, TType[Key]>;\n /** Renderer to use if the cell is an aggregate cell and part of a grouped row */\n aggregate?: TableColumnRendererAggregate<TType, TType[Key]>;\n control?: TableColumnRendererControl<TType>;\n footer?: TableColumnRendererFooter<TType[Key]>;\n header: TableColumnRendererHeader;\n // options\n /** Aggregation function to be used when the column is part of a grouped row */\n aggregationFn?: 'auto' | ReactTableBuiltInAggregationFn;\n align?: TableColumnAlignment;\n className?: TableColumnClassNameHandler<TType>;\n dataType?: TableColumnDataType;\n defaultHidden?: boolean;\n defaultWidth?: TableColumnWidth;\n enableFiltering?: boolean;\n enableGrouping?: boolean;\n enableHiding?: boolean;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableResizing?: boolean;\n enableSearch?: boolean;\n enableSorting?: boolean;\n enableTruncate?: boolean;\n filters?: TableFilterComparator[];\n headerClassName?: string;\n menu?: TableColumnMenu;\n minWidth?: number;\n sort?: TableColumnSortDirection;\n sortFn?: TableColumnSortFn<TType>;\n tooltip?: string;\n };\n}>;\n\nexport type TableGroupProps = {\n children: (JSX.Element | boolean | null | undefined)[];\n header: string;\n id: string;\n};\n"],"names":["TableFilterComparator","TableServerLoadAllState"],"mappings":"AA8BA;IACYA;AAAZ,WAAYA,qBAAqB;EAC7BA,yEAAQ;EACRA,qFAAc;EACdA,2EAAS;EACTA,iFAAY;EACZA,mFAAa;EACbA,6EAAU;EACVA,2EAAS;EACTA,uEAAO;EACPA,6EAAU;EACVA,+FAAmB;EACnBA,sGAAsB;EACtBA,0EAAQ;EACRA,0EAAQ;EACRA,4EAAS;AACb,CAAC,EAfWA,qBAAqB,KAArBA,qBAAqB;IAmGrBC;AAAZ,WAAYA,uBAAuB;EAC/BA,iFAAU;EACVA,2EAAO;EACPA,+EAAS;AACb,CAAC,EAJWA,uBAAuB,KAAvBA,uBAAuB;;;;"}
@@ -1,4 +1,4 @@
1
- function useTableColumnOrdering(isEnabled = true) {
1
+ function useTableColumnOrdering(isEnabled = false) {
2
2
  return {
3
3
  isEnabled
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useTableColumnOrdering.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableColumnOrdering.ts"],"sourcesContent":["export function useTableColumnOrdering(isEnabled = true) {\n return {\n isEnabled,\n };\n}\n"],"names":["useTableColumnOrdering","isEnabled"],"mappings":"SAAgBA,sBAAsBA,CAACC,SAAS,GAAG,IAAI;EACnD,OAAO;IACHA;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useTableColumnOrdering.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableColumnOrdering.ts"],"sourcesContent":["export function useTableColumnOrdering(isEnabled = false) {\n return {\n isEnabled,\n };\n}\n"],"names":["useTableColumnOrdering","isEnabled"],"mappings":"SAAgBA,sBAAsBA,CAACC,SAAS,GAAG,KAAK;EACpD,OAAO;IACHA;GACH;AACL;;;;"}
@@ -1,4 +1,5 @@
1
1
  import React__default from 'react';
2
+ import { isElementInsideOrTriggeredFromContainer } from '../../../../utils/dom.js';
2
3
  import { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused.js';
3
4
 
4
5
  function focusFirstElementInActiveRow(tableRef) {
@@ -13,7 +14,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
13
14
  const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();
14
15
  const move = (direction, length, scrollToIndex) => setRowActiveIndex(currentIndex => {
15
16
  const nextIndex = currentIndex !== undefined ? getNextIndex(direction, currentIndex, length) : 0;
16
- scrollToIndex(direction === -1 ? nextIndex : nextIndex + 3);
17
+ setTimeout(() => scrollToIndex(nextIndex), 1);
17
18
  return nextIndex;
18
19
  });
19
20
  const onKeyDown = React__default.useCallback((event, length, scrollToIndex, tableRef) => {
@@ -55,27 +56,17 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
55
56
  if (!isEnabled || event.isDefaultPrevented()) {
56
57
  return;
57
58
  }
58
- if (rowActiveIndex === undefined && length > 0) {
59
- // do it in the next tick, otherwise it prevents internal focus from working
60
- // meaning you have to tab twice to get to the first focusable element
61
- setTimeout(() => {
62
- setRowActiveIndex(index => {
63
- if (index === undefined) {
64
- scrollToIndex(0);
65
- return 0;
66
- }
67
- return index;
68
- });
69
- }, 1);
70
- }
71
- }, [rowActiveIndex, length, isEnabled]);
72
- const onMouseCapture = React__default.useCallback((event, length) => {
73
- if (!isEnabled || event.isDefaultPrevented()) {
59
+ if (event.target.closest('tbody') || event.target.closest('[data-taco="table2-body"]') || isElementInsideOrTriggeredFromContainer(event.target, event.currentTarget)) {
74
60
  return;
75
61
  }
76
62
  if (rowActiveIndex === undefined && length > 0) {
77
- event.preventDefault();
78
- event.stopPropagation();
63
+ setRowActiveIndex(index => {
64
+ if (index === undefined) {
65
+ scrollToIndex(0);
66
+ return 0;
67
+ }
68
+ return index;
69
+ });
79
70
  }
80
71
  }, [rowActiveIndex, length, isEnabled]);
81
72
  return {
@@ -85,8 +76,7 @@ function useTableRowActive(isEnabled = false, initialRowActiveIndex) {
85
76
  isHoverStatePaused,
86
77
  setHoverStatePaused: isEnabled ? setHoverStatePaused : () => undefined,
87
78
  handleFocus: isEnabled ? onFocus : () => undefined,
88
- handleKeyDown: isEnabled ? onKeyDown : () => undefined,
89
- handleMouseCapture: isEnabled ? onMouseCapture : () => undefined
79
+ handleKeyDown: isEnabled ? onKeyDown : () => undefined
90
80
  };
91
81
  }
92
82
  function getNextIndex(direction, currentIndex, length) {
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRowActive.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowActive.ts"],"sourcesContent":["import React from 'react';\nimport { TableRef, TableScrollToIndexHandler } from '../../types';\nimport { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused';\n\nfunction focusFirstElementInActiveRow(tableRef: React.RefObject<TableRef>) {\n const selector = '[data-taco=\"table2-body\"] [role=\"row\"] [role=\"cell\"]:first-child';\n\n setTimeout(() => {\n (tableRef.current?.querySelector(selector) as HTMLElement)?.focus();\n }, 1);\n}\n\nexport function useTableRowActive(isEnabled = false, initialRowActiveIndex?: number) {\n const [rowActiveIndex, setRowActiveIndex] = React.useState<number | undefined>(initialRowActiveIndex);\n const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();\n\n const move = (direction: -1 | 1, length: number, scrollToIndex: TableScrollToIndexHandler) =>\n setRowActiveIndex(currentIndex => {\n const nextIndex = currentIndex !== undefined ? getNextIndex(direction, currentIndex, length) : 0;\n scrollToIndex(direction === -1 ? nextIndex : nextIndex + 3);\n return nextIndex;\n });\n\n const onKeyDown = React.useCallback(\n (\n event: KeyboardEvent,\n length: number,\n scrollToIndex: TableScrollToIndexHandler,\n tableRef?: React.RefObject<TableRef>\n ) => {\n if (!isEnabled || event.defaultPrevented) {\n return;\n }\n\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n setHoverStatePaused(true);\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = 0;\n setRowActiveIndex(newIndex);\n scrollToIndex(newIndex);\n } else {\n move(-1, length, scrollToIndex);\n }\n\n if (tableRef) {\n focusFirstElementInActiveRow(tableRef);\n }\n\n return;\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = length - 1;\n setRowActiveIndex(newIndex);\n scrollToIndex(newIndex);\n } else {\n move(+1, length, scrollToIndex);\n }\n\n if (tableRef) {\n focusFirstElementInActiveRow(tableRef);\n }\n\n return;\n }\n },\n [isEnabled]\n );\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n if (!isEnabled || event.isDefaultPrevented()) {\n return;\n }\n\n if (rowActiveIndex === undefined && length > 0) {\n // do it in the next tick, otherwise it prevents internal focus from working\n // meaning you have to tab twice to get to the first focusable element\n setTimeout(() => {\n setRowActiveIndex(index => {\n if (index === undefined) {\n scrollToIndex(0);\n return 0;\n }\n return index;\n });\n }, 1);\n }\n },\n [rowActiveIndex, length, isEnabled]\n );\n\n const onMouseCapture = React.useCallback(\n (event: React.MouseEvent, length: number) => {\n if (!isEnabled || event.isDefaultPrevented()) {\n return;\n }\n\n if (rowActiveIndex === undefined && length > 0) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [rowActiveIndex, length, isEnabled]\n );\n\n return {\n isEnabled,\n rowActiveIndex,\n setRowActiveIndex: isEnabled ? setRowActiveIndex : () => undefined,\n isHoverStatePaused,\n setHoverStatePaused: isEnabled ? setHoverStatePaused : () => undefined,\n handleFocus: isEnabled ? onFocus : () => undefined,\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n handleMouseCapture: isEnabled ? onMouseCapture : () => undefined,\n };\n}\n\nfunction getNextIndex(direction: -1 | 1, currentIndex: number, length: number) {\n if (direction === -1) {\n return currentIndex - 1 > 0 ? currentIndex - 1 : 0;\n }\n\n return currentIndex + 1 < length ? currentIndex + 1 : currentIndex;\n}\n"],"names":["focusFirstElementInActiveRow","tableRef","selector","setTimeout","_tableRef$current","current","_tableRef$current$que","querySelector","focus","useTableRowActive","isEnabled","initialRowActiveIndex","rowActiveIndex","setRowActiveIndex","React","useState","isHoverStatePaused","setHoverStatePaused","useIsHoverStatePaused","move","direction","length","scrollToIndex","currentIndex","nextIndex","undefined","getNextIndex","onKeyDown","useCallback","event","defaultPrevented","key","preventDefault","ctrlKey","metaKey","newIndex","onFocus","isDefaultPrevented","index","onMouseCapture","stopPropagation","handleFocus","handleKeyDown","handleMouseCapture"],"mappings":"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"}
1
+ {"version":3,"file":"useTableRowActive.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowActive.ts"],"sourcesContent":["import React from 'react';\nimport { TableRef, TableScrollToIndexHandler } from '../../types';\nimport { useIsHoverStatePaused } from '../../../../hooks/useIsHoverStatePaused';\nimport { isElementInsideOrTriggeredFromContainer } from '../../../../utils/dom';\n\nfunction focusFirstElementInActiveRow(tableRef: React.RefObject<TableRef>) {\n const selector = '[data-taco=\"table2-body\"] [role=\"row\"] [role=\"cell\"]:first-child';\n\n setTimeout(() => {\n (tableRef.current?.querySelector(selector) as HTMLElement)?.focus();\n }, 1);\n}\n\nexport function useTableRowActive(isEnabled = false, initialRowActiveIndex?: number) {\n const [rowActiveIndex, setRowActiveIndex] = React.useState<number | undefined>(initialRowActiveIndex);\n const [isHoverStatePaused, setHoverStatePaused] = useIsHoverStatePaused();\n\n const move = (direction: -1 | 1, length: number, scrollToIndex: TableScrollToIndexHandler) =>\n setRowActiveIndex(currentIndex => {\n const nextIndex = currentIndex !== undefined ? getNextIndex(direction, currentIndex, length) : 0;\n setTimeout(() => scrollToIndex(nextIndex), 1);\n return nextIndex;\n });\n\n const onKeyDown = React.useCallback(\n (\n event: KeyboardEvent,\n length: number,\n scrollToIndex: TableScrollToIndexHandler,\n tableRef?: React.RefObject<TableRef>\n ) => {\n if (!isEnabled || event.defaultPrevented) {\n return;\n }\n\n if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n setHoverStatePaused(true);\n }\n\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = 0;\n setRowActiveIndex(newIndex);\n scrollToIndex(newIndex);\n } else {\n move(-1, length, scrollToIndex);\n }\n\n if (tableRef) {\n focusFirstElementInActiveRow(tableRef);\n }\n\n return;\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n\n if (event.ctrlKey || event.metaKey) {\n const newIndex = length - 1;\n setRowActiveIndex(newIndex);\n scrollToIndex(newIndex);\n } else {\n move(+1, length, scrollToIndex);\n }\n\n if (tableRef) {\n focusFirstElementInActiveRow(tableRef);\n }\n\n return;\n }\n },\n [isEnabled]\n );\n\n const onFocus = React.useCallback(\n (event: React.FocusEvent, length: number, scrollToIndex: TableScrollToIndexHandler) => {\n if (!isEnabled || event.isDefaultPrevented()) {\n return;\n }\n\n if (\n event.target.closest('tbody') ||\n event.target.closest('[data-taco=\"table2-body\"]') ||\n isElementInsideOrTriggeredFromContainer(event.target, event.currentTarget)\n ) {\n return;\n }\n\n if (rowActiveIndex === undefined && length > 0) {\n setRowActiveIndex(index => {\n if (index === undefined) {\n scrollToIndex(0);\n return 0;\n }\n return index;\n });\n }\n },\n [rowActiveIndex, length, isEnabled]\n );\n\n return {\n isEnabled,\n rowActiveIndex,\n setRowActiveIndex: isEnabled ? setRowActiveIndex : () => undefined,\n isHoverStatePaused,\n setHoverStatePaused: isEnabled ? setHoverStatePaused : () => undefined,\n handleFocus: isEnabled ? onFocus : () => undefined,\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n };\n}\n\nfunction getNextIndex(direction: -1 | 1, currentIndex: number, length: number) {\n if (direction === -1) {\n return currentIndex - 1 > 0 ? currentIndex - 1 : 0;\n }\n\n return currentIndex + 1 < length ? currentIndex + 1 : currentIndex;\n}\n"],"names":["focusFirstElementInActiveRow","tableRef","selector","setTimeout","_tableRef$current","current","_tableRef$current$que","querySelector","focus","useTableRowActive","isEnabled","initialRowActiveIndex","rowActiveIndex","setRowActiveIndex","React","useState","isHoverStatePaused","setHoverStatePaused","useIsHoverStatePaused","move","direction","length","scrollToIndex","currentIndex","nextIndex","undefined","getNextIndex","onKeyDown","useCallback","event","defaultPrevented","key","preventDefault","ctrlKey","metaKey","newIndex","onFocus","isDefaultPrevented","target","closest","isElementInsideOrTriggeredFromContainer","currentTarget","index","handleFocus","handleKeyDown"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRowClick.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowClick.ts"],"sourcesContent":["import React from 'react';\nimport { TableRowClickHandler } from '../../types';\n\nexport function useTableRowClick<TType = unknown>(isEnabled = false, onRowClick?: TableRowClickHandler<TType>) {\n const handleKeyDown = React.useCallback(\n function (event: KeyboardEvent, data: TType) {\n if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {\n return;\n }\n\n if (data && event.key === 'Enter') {\n event.preventDefault();\n onRowClick(data);\n return;\n }\n },\n [isEnabled, onRowClick]\n ) as <TType = unknown>(event: KeyboardEvent, data: TType) => void;\n\n const handleClick = React.useCallback(\n function (event: React.MouseEvent<HTMLDivElement>, data: TType) {\n if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {\n return;\n }\n\n event.preventDefault();\n onRowClick(data);\n return;\n },\n [isEnabled, onRowClick]\n );\n\n return {\n isEnabled,\n handleClick,\n handleKeyDown,\n };\n}\n"],"names":["useTableRowClick","isEnabled","onRowClick","handleKeyDown","React","useCallback","event","data","defaultPrevented","key","preventDefault","handleClick"],"mappings":";;SAGgBA,gBAAgBA,CAAkBC,SAAS,GAAG,KAAK,EAAEC,UAAwC;EACzG,MAAMC,aAAa,GAAGC,cAAK,CAACC,WAAW,CACnC,UAAUC,KAAoB,EAAEC,IAAW;IACvC,IAAI,CAACN,SAAS,IAAI,OAAOC,UAAU,KAAK,UAAU,IAAII,KAAK,CAACE,gBAAgB,EAAE;MAC1E;;IAGJ,IAAID,IAAI,IAAID,KAAK,CAACG,GAAG,KAAK,OAAO,EAAE;MAC/BH,KAAK,CAACI,cAAc,EAAE;MACtBR,UAAU,CAACK,IAAI,CAAC;MAChB;;GAEP,EACD,CAACN,SAAS,EAAEC,UAAU,CAAC,CACsC;EAEjE,MAAMS,WAAW,GAAGP,cAAK,CAACC,WAAW,CACjC,UAAUC,KAAuC,EAAEC,IAAW;IAC1D,IAAI,CAACN,SAAS,IAAI,OAAOC,UAAU,KAAK,UAAU,IAAII,KAAK,CAACE,gBAAgB,EAAE;MAC1E;;IAGJF,KAAK,CAACI,cAAc,EAAE;IACtBR,UAAU,CAACK,IAAI,CAAC;IAChB;GACH,EACD,CAACN,SAAS,EAAEC,UAAU,CAAC,CAC1B;EAED,OAAO;IACHD,SAAS;IACTU,WAAW;IACXR;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useTableRowClick.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowClick.ts"],"sourcesContent":["import React from 'react';\nimport { TableRowClickHandler } from '../../types';\n\nexport function useTableRowClick<TType = unknown>(isEnabled = false, onRowClick?: TableRowClickHandler<TType>) {\n const handleKeyDown = React.useCallback(\n function (event: KeyboardEvent, data: TType) {\n if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {\n return;\n }\n\n if (data && event.key === 'Enter') {\n event.preventDefault();\n onRowClick(data);\n return;\n }\n },\n [isEnabled, onRowClick]\n ) as <TType = unknown>(event: KeyboardEvent, data: TType) => void;\n\n const handleClick = React.useCallback(\n function (event: React.MouseEvent<HTMLTableRowElement>, data: TType) {\n if (!isEnabled || typeof onRowClick !== 'function' || event.defaultPrevented) {\n return;\n }\n\n event.preventDefault();\n onRowClick(data);\n return;\n },\n [isEnabled, onRowClick]\n );\n\n return {\n isEnabled,\n handleClick,\n handleKeyDown,\n };\n}\n"],"names":["useTableRowClick","isEnabled","onRowClick","handleKeyDown","React","useCallback","event","data","defaultPrevented","key","preventDefault","handleClick"],"mappings":";;SAGgBA,gBAAgBA,CAAkBC,SAAS,GAAG,KAAK,EAAEC,UAAwC;EACzG,MAAMC,aAAa,GAAGC,cAAK,CAACC,WAAW,CACnC,UAAUC,KAAoB,EAAEC,IAAW;IACvC,IAAI,CAACN,SAAS,IAAI,OAAOC,UAAU,KAAK,UAAU,IAAII,KAAK,CAACE,gBAAgB,EAAE;MAC1E;;IAGJ,IAAID,IAAI,IAAID,KAAK,CAACG,GAAG,KAAK,OAAO,EAAE;MAC/BH,KAAK,CAACI,cAAc,EAAE;MACtBR,UAAU,CAACK,IAAI,CAAC;MAChB;;GAEP,EACD,CAACN,SAAS,EAAEC,UAAU,CAAC,CACsC;EAEjE,MAAMS,WAAW,GAAGP,cAAK,CAACC,WAAW,CACjC,UAAUC,KAA4C,EAAEC,IAAW;IAC/D,IAAI,CAACN,SAAS,IAAI,OAAOC,UAAU,KAAK,UAAU,IAAII,KAAK,CAACE,gBAAgB,EAAE;MAC1E;;IAGJF,KAAK,CAACI,cAAc,EAAE;IACtBR,UAAU,CAACK,IAAI,CAAC;IAChB;GACH,EACD,CAACN,SAAS,EAAEC,UAAU,CAAC,CAC1B;EAED,OAAO;IACHD,SAAS;IACTU,WAAW;IACXR;GACH;AACL;;;;"}
@@ -1,7 +1,7 @@
1
1
  function useTableRowGoto(isEnabled = false, handler) {
2
2
  return {
3
3
  isEnabled,
4
- handleGoto: isEnabled && handler ? handler : () => undefined
4
+ handleGoto: isEnabled ? handler : undefined
5
5
  };
6
6
  }
7
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRowGoto.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowGoto.ts"],"sourcesContent":["import { TableRowGotoHandler } from '../../types';\n\nexport function useTableRowGoto(isEnabled = false, handler?: TableRowGotoHandler) {\n return {\n isEnabled,\n handleGoto: isEnabled && handler ? handler : () => undefined,\n };\n}\n"],"names":["useTableRowGoto","isEnabled","handler","handleGoto","undefined"],"mappings":"SAEgBA,eAAeA,CAACC,SAAS,GAAG,KAAK,EAAEC,OAA6B;EAC5E,OAAO;IACHD,SAAS;IACTE,UAAU,EAAEF,SAAS,IAAIC,OAAO,GAAGA,OAAO,GAAG,MAAME;GACtD;AACL;;;;"}
1
+ {"version":3,"file":"useTableRowGoto.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowGoto.ts"],"sourcesContent":["import { TableRowGotoHandler } from '../../types';\n\nexport function useTableRowGoto(isEnabled = false, handler?: TableRowGotoHandler) {\n return {\n isEnabled,\n handleGoto: isEnabled ? handler : undefined,\n };\n}\n"],"names":["useTableRowGoto","isEnabled","handler","handleGoto","undefined"],"mappings":"SAEgBA,eAAeA,CAACC,SAAS,GAAG,KAAK,EAAEC,OAA6B;EAC5E,OAAO;IACHD,SAAS;IACTE,UAAU,EAAEF,SAAS,GAAGC,OAAO,GAAGE;GACrC;AACL;;;;"}
@@ -23,6 +23,7 @@ function useTableRowSelection(isEnabled = false) {
23
23
  }
24
24
  }, [isEnabled]);
25
25
  return {
26
+ isEnabled,
26
27
  handleKeyDown: isEnabled ? onKeyDown : () => undefined,
27
28
  lastSelectedRowIndex
28
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useTableRowSelection.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowSelection.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\n\nexport function useTableRowSelection(isEnabled = false) {\n const lastSelectedRowIndex = React.useRef<number>();\n\n const onKeyDown = React.useCallback(\n <TType = unknown>(event: KeyboardEvent, table: ReactTable<TType>) => {\n if (!isEnabled || !table.options.enableRowSelection || event.defaultPrevented) {\n return;\n }\n\n const rows = table.getRowModel().rows;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (event.key === ' ') {\n event.preventDefault();\n const rowActiveIndex = tableMeta.rowActive.rowActiveIndex;\n\n if (rowActiveIndex !== undefined) {\n rows[rowActiveIndex]?.toggleSelected();\n }\n\n return;\n } else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {\n event.preventDefault();\n table.toggleAllRowsSelected();\n return;\n }\n },\n [isEnabled]\n ) as <TType = unknown>(event: KeyboardEvent, table: ReactTable<TType>) => void;\n\n return {\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n lastSelectedRowIndex,\n };\n}\n"],"names":["useTableRowSelection","isEnabled","lastSelectedRowIndex","React","useRef","onKeyDown","useCallback","event","table","options","enableRowSelection","defaultPrevented","rows","getRowModel","tableMeta","meta","key","preventDefault","rowActiveIndex","rowActive","undefined","_rows$rowActiveIndex","toggleSelected","ctrlKey","metaKey","toggleAllRowsSelected","handleKeyDown"],"mappings":";;SAGgBA,oBAAoBA,CAACC,SAAS,GAAG,KAAK;EAClD,MAAMC,oBAAoB,GAAGC,cAAK,CAACC,MAAM,EAAU;EAEnD,MAAMC,SAAS,GAAGF,cAAK,CAACG,WAAW,CAC/B,CAAkBC,KAAoB,EAAEC,KAAwB;IAC5D,IAAI,CAACP,SAAS,IAAI,CAACO,KAAK,CAACC,OAAO,CAACC,kBAAkB,IAAIH,KAAK,CAACI,gBAAgB,EAAE;MAC3E;;IAGJ,MAAMC,IAAI,GAAGJ,KAAK,CAACK,WAAW,EAAE,CAACD,IAAI;IACrC,MAAME,SAAS,GAAGN,KAAK,CAACC,OAAO,CAACM,IAA6B;IAE7D,IAAIR,KAAK,CAACS,GAAG,KAAK,GAAG,EAAE;MACnBT,KAAK,CAACU,cAAc,EAAE;MACtB,MAAMC,cAAc,GAAGJ,SAAS,CAACK,SAAS,CAACD,cAAc;MAEzD,IAAIA,cAAc,KAAKE,SAAS,EAAE;QAAA,IAAAC,oBAAA;QAC9B,CAAAA,oBAAA,GAAAT,IAAI,CAACM,cAAc,CAAC,cAAAG,oBAAA,uBAApBA,oBAAA,CAAsBC,cAAc,EAAE;;MAG1C;KACH,MAAM,IAAI,CAACf,KAAK,CAACgB,OAAO,IAAIhB,KAAK,CAACiB,OAAO,KAAKjB,KAAK,CAACS,GAAG,KAAK,GAAG,EAAE;MAC9DT,KAAK,CAACU,cAAc,EAAE;MACtBT,KAAK,CAACiB,qBAAqB,EAAE;MAC7B;;GAEP,EACD,CAACxB,SAAS,CAAC,CAC+D;EAE9E,OAAO;IACHyB,aAAa,EAAEzB,SAAS,GAAGI,SAAS,GAAG,MAAMe,SAAS;IACtDlB;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useTableRowSelection.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableRowSelection.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\n\nexport function useTableRowSelection(isEnabled = false) {\n const lastSelectedRowIndex = React.useRef<number>();\n\n const onKeyDown = React.useCallback(\n <TType = unknown>(event: KeyboardEvent, table: ReactTable<TType>) => {\n if (!isEnabled || !table.options.enableRowSelection || event.defaultPrevented) {\n return;\n }\n\n const rows = table.getRowModel().rows;\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n\n if (event.key === ' ') {\n event.preventDefault();\n const rowActiveIndex = tableMeta.rowActive.rowActiveIndex;\n\n if (rowActiveIndex !== undefined) {\n rows[rowActiveIndex]?.toggleSelected();\n }\n\n return;\n } else if ((event.ctrlKey || event.metaKey) && event.key === 'a') {\n event.preventDefault();\n table.toggleAllRowsSelected();\n return;\n }\n },\n [isEnabled]\n ) as <TType = unknown>(event: KeyboardEvent, table: ReactTable<TType>) => void;\n\n return {\n isEnabled,\n handleKeyDown: isEnabled ? onKeyDown : () => undefined,\n lastSelectedRowIndex,\n };\n}\n"],"names":["useTableRowSelection","isEnabled","lastSelectedRowIndex","React","useRef","onKeyDown","useCallback","event","table","options","enableRowSelection","defaultPrevented","rows","getRowModel","tableMeta","meta","key","preventDefault","rowActiveIndex","rowActive","undefined","_rows$rowActiveIndex","toggleSelected","ctrlKey","metaKey","toggleAllRowsSelected","handleKeyDown"],"mappings":";;SAGgBA,oBAAoBA,CAACC,SAAS,GAAG,KAAK;EAClD,MAAMC,oBAAoB,GAAGC,cAAK,CAACC,MAAM,EAAU;EAEnD,MAAMC,SAAS,GAAGF,cAAK,CAACG,WAAW,CAC/B,CAAkBC,KAAoB,EAAEC,KAAwB;IAC5D,IAAI,CAACP,SAAS,IAAI,CAACO,KAAK,CAACC,OAAO,CAACC,kBAAkB,IAAIH,KAAK,CAACI,gBAAgB,EAAE;MAC3E;;IAGJ,MAAMC,IAAI,GAAGJ,KAAK,CAACK,WAAW,EAAE,CAACD,IAAI;IACrC,MAAME,SAAS,GAAGN,KAAK,CAACC,OAAO,CAACM,IAA6B;IAE7D,IAAIR,KAAK,CAACS,GAAG,KAAK,GAAG,EAAE;MACnBT,KAAK,CAACU,cAAc,EAAE;MACtB,MAAMC,cAAc,GAAGJ,SAAS,CAACK,SAAS,CAACD,cAAc;MAEzD,IAAIA,cAAc,KAAKE,SAAS,EAAE;QAAA,IAAAC,oBAAA;QAC9B,CAAAA,oBAAA,GAAAT,IAAI,CAACM,cAAc,CAAC,cAAAG,oBAAA,uBAApBA,oBAAA,CAAsBC,cAAc,EAAE;;MAG1C;KACH,MAAM,IAAI,CAACf,KAAK,CAACgB,OAAO,IAAIhB,KAAK,CAACiB,OAAO,KAAKjB,KAAK,CAACS,GAAG,KAAK,GAAG,EAAE;MAC9DT,KAAK,CAACU,cAAc,EAAE;MACtBT,KAAK,CAACiB,qBAAqB,EAAE;MAC7B;;GAEP,EACD,CAACxB,SAAS,CAAC,CAC+D;EAE9E,OAAO;IACHA,SAAS;IACTyB,aAAa,EAAEzB,SAAS,GAAGI,SAAS,GAAG,MAAMe,SAAS;IACtDlB;GACH;AACL;;;;"}
@@ -1,9 +1,49 @@
1
- function useTableServerLoading(loadPage, loadAll) {
1
+ import React__default from 'react';
2
+ import { TableServerLoadAllState } from '../../types.js';
3
+ import { DEFAULT_PAGE_SIZE } from '../../useTableDataLoader.js';
4
+
5
+ function useTableServerLoading(loadPage, loadAll, pageSize = DEFAULT_PAGE_SIZE) {
2
6
  const isEnabled = !!loadPage && !!loadAll;
7
+ const [loadAllStatus, setLoadedStatus] = React__default.useState(TableServerLoadAllState.Incomplete);
8
+ let _loadAll;
9
+ let _loadAllIfNeeded;
10
+ if (typeof loadAll === 'function') {
11
+ _loadAll = function (...args) {
12
+ try {
13
+ const _temp = function () {
14
+ if (typeof loadAll === 'function') {
15
+ setLoadedStatus(TableServerLoadAllState.Loading);
16
+ return Promise.resolve(loadAll(...args)).then(function () {
17
+ setLoadedStatus(TableServerLoadAllState.Completed);
18
+ });
19
+ }
20
+ }();
21
+ return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
22
+ } catch (e) {
23
+ return Promise.reject(e);
24
+ }
25
+ };
26
+ _loadAllIfNeeded = function (...args) {
27
+ try {
28
+ const _temp2 = function () {
29
+ if (loadAllStatus === TableServerLoadAllState.Incomplete) {
30
+ var _loadAll2;
31
+ return Promise.resolve((_loadAll2 = _loadAll) === null || _loadAll2 === void 0 ? void 0 : _loadAll2(...args)).then(function () {});
32
+ }
33
+ }();
34
+ return Promise.resolve(_temp2 && _temp2.then ? _temp2.then(function () {}) : void 0);
35
+ } catch (e) {
36
+ return Promise.reject(e);
37
+ }
38
+ };
39
+ }
3
40
  return {
4
41
  isEnabled,
5
42
  loadPage,
6
- loadAll
43
+ loadAll: _loadAll,
44
+ loadAllIfNeeded: _loadAllIfNeeded,
45
+ loadAllStatus,
46
+ pageSize
7
47
  };
8
48
  }
9
49
 
@@ -1 +1 @@
1
- {"version":3,"file":"useTableServerLoading.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableServerLoading.ts"],"sourcesContent":["import { TableServerLoadAllHandler, TableServerLoadPageHandler } from '../../types';\n\nexport function useTableServerLoading(loadPage?: TableServerLoadPageHandler, loadAll?: TableServerLoadAllHandler) {\n const isEnabled = !!loadPage && !!loadAll;\n\n return {\n isEnabled,\n loadPage,\n loadAll,\n };\n}\n"],"names":["useTableServerLoading","loadPage","loadAll","isEnabled"],"mappings":"SAEgBA,qBAAqBA,CAACC,QAAqC,EAAEC,OAAmC;EAC5G,MAAMC,SAAS,GAAG,CAAC,CAACF,QAAQ,IAAI,CAAC,CAACC,OAAO;EAEzC,OAAO;IACHC,SAAS;IACTF,QAAQ;IACRC;GACH;AACL;;;;"}
1
+ {"version":3,"file":"useTableServerLoading.js","sources":["../../../../../../../../../src/primitives/Table/useTable/features/useTableServerLoading.ts"],"sourcesContent":["import React from 'react';\nimport { TableServerLoadAllHandler, TableServerLoadAllState, TableServerLoadPageHandler } from '../../types';\nimport { DEFAULT_PAGE_SIZE } from '../../useTableDataLoader';\n\nexport function useTableServerLoading(\n loadPage?: TableServerLoadPageHandler,\n loadAll?: TableServerLoadAllHandler,\n pageSize = DEFAULT_PAGE_SIZE\n) {\n const isEnabled = !!loadPage && !!loadAll;\n const [loadAllStatus, setLoadedStatus] = React.useState<TableServerLoadAllState>(TableServerLoadAllState.Incomplete);\n\n let _loadAll: TableServerLoadAllHandler | undefined;\n let _loadAllIfNeeded: TableServerLoadAllHandler | undefined;\n\n if (typeof loadAll === 'function') {\n _loadAll = async (...args) => {\n if (typeof loadAll === 'function') {\n setLoadedStatus(TableServerLoadAllState.Loading);\n await loadAll(...args);\n setLoadedStatus(TableServerLoadAllState.Completed);\n }\n };\n\n _loadAllIfNeeded = async (...args) => {\n if (loadAllStatus === TableServerLoadAllState.Incomplete) {\n await _loadAll?.(...args);\n }\n };\n }\n\n return {\n isEnabled,\n loadPage,\n loadAll: _loadAll,\n loadAllIfNeeded: _loadAllIfNeeded,\n loadAllStatus,\n pageSize,\n };\n}\n"],"names":["useTableServerLoading","loadPage","loadAll","pageSize","DEFAULT_PAGE_SIZE","isEnabled","loadAllStatus","setLoadedStatus","React","useState","TableServerLoadAllState","Incomplete","_loadAll","_loadAllIfNeeded","args","Loading","Promise","resolve","then","Completed","_temp","e","reject","_loadAll2","_temp2","loadAllIfNeeded"],"mappings":";;;;SAIgBA,qBAAqBA,CACjCC,QAAqC,EACrCC,OAAmC,EACnCC,QAAQ,GAAGC,iBAAiB;EAE5B,MAAMC,SAAS,GAAG,CAAC,CAACJ,QAAQ,IAAI,CAAC,CAACC,OAAO;EACzC,MAAM,CAACI,aAAa,EAAEC,eAAe,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAA0BC,uBAAuB,CAACC,UAAU,CAAC;EAEpH,IAAIC,QAA+C;EACnD,IAAIC,gBAAuD;EAE3D,IAAI,OAAOX,OAAO,KAAK,UAAU,EAAE;IAC/BU,QAAQ,aAAU,GAAGE,IAAI;MAAA;;cACjB,OAAOZ,OAAO,KAAK,UAAU;YAC7BK,eAAe,CAACG,uBAAuB,CAACK,OAAO,CAAC;YAAC,OAAAC,OAAA,CAAAC,OAAA,CAC3Cf,OAAO,CAAC,GAAGY,IAAI,CAAC,EAAAI,IAAA;cACtBX,eAAe,CAACG,uBAAuB,CAACS,SAAS,CAAC;;;;QAAC,OAAAH,OAAA,CAAAC,OAAA,CAAAG,KAAA,IAAAA,KAAA,CAAAF,IAAA,GAAAE,KAAA,CAAAF,IAAA;OAE1D,QAAAG,CAAA;QAAA,OAAAL,OAAA,CAAAM,MAAA,CAAAD,CAAA;;;IAEDR,gBAAgB,aAAU,GAAGC,IAAI;MAAA;;cACzBR,aAAa,KAAKI,uBAAuB,CAACC,UAAU;YAAA,IAAAY,SAAA;YAAA,OAAAP,OAAA,CAAAC,OAAA,EAAAM,SAAA,GAC9CX,QAAQ,cAAAW,SAAA,uBAARA,SAAA,CAAW,GAAGT,IAAI,CAAC,EAAAI,IAAA;;;QAAA,OAAAF,OAAA,CAAAC,OAAA,CAAAO,MAAA,IAAAA,MAAA,CAAAN,IAAA,GAAAM,MAAA,CAAAN,IAAA;OAEhC,QAAAG,CAAA;QAAA,OAAAL,OAAA,CAAAM,MAAA,CAAAD,CAAA;;;;EAGL,OAAO;IACHhB,SAAS;IACTJ,QAAQ;IACRC,OAAO,EAAEU,QAAQ;IACjBa,eAAe,EAAEZ,gBAAgB;IACjCP,aAAa;IACbH;GACH;AACL;;;;"}
@@ -1,5 +1,10 @@
1
+ import 'date-fns';
2
+ import '../../../../utils/date.js';
1
3
  import { FontSizes } from '../../../../types.js';
2
4
 
5
+ function isInternalColumn(id) {
6
+ return id === null || id === void 0 ? void 0 : id.startsWith('__');
7
+ }
3
8
  // column widths
4
9
  const getCellMinWidth = (fontSize = 'medium') => {
5
10
  switch (fontSize) {
@@ -13,12 +18,9 @@ const getCellMinWidth = (fontSize = 'medium') => {
13
18
  }
14
19
  };
15
20
  // ordering
16
- function ensureOrdering(columns, internalColumnsPinnedToTheRight, settingsOrder) {
21
+ function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight = ['__actions']) {
17
22
  // internal columns come with a defined order
18
- const internalColumns = columns.filter(column => {
19
- var _column$id;
20
- return ((_column$id = column.id) === null || _column$id === void 0 ? void 0 : _column$id.startsWith('__')) && !internalColumnsPinnedToTheRight.includes(column.id);
21
- }).map(column => column.id);
23
+ const internalColumns = columns.filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id))).map(column => column.id);
22
24
  // columns with ordering disabled should be moved to the front
23
25
  const orderingDisabled = [];
24
26
  const orderingEnabled = [];
@@ -30,8 +32,8 @@ function ensureOrdering(columns, internalColumnsPinnedToTheRight, settingsOrder)
30
32
  (a, b) => (settingsOrder.indexOf(a.id) >>> 0) - (settingsOrder.indexOf(b.id) >>> 0));
31
33
  }
32
34
  orderedColumns.forEach(column => {
33
- var _column$id2, _column$meta;
34
- if ((_column$id2 = column.id) !== null && _column$id2 !== void 0 && _column$id2.startsWith('__')) {
35
+ var _column$meta;
36
+ if (isInternalColumn(column.id)) {
35
37
  return;
36
38
  }
37
39
  if ((_column$meta = column.meta) !== null && _column$meta !== void 0 && _column$meta.enableOrdering) {
@@ -50,5 +52,5 @@ function ensureOrdering(columns, internalColumnsPinnedToTheRight, settingsOrder)
50
52
  return order;
51
53
  }
52
54
 
53
- export { ensureOrdering, getCellMinWidth };
55
+ export { ensureOrdering, getCellMinWidth, isInternalColumn };
54
56
  //# sourceMappingURL=columns.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef } from '@tanstack/react-table';\nimport { FontSize, FontSizes } from '../../../../types';\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n internalColumnsPinnedToTheRight: string[],\n settingsOrder: string[] | undefined\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => column.id?.startsWith('__') && !internalColumnsPinnedToTheRight.includes(column.id))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n const orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (column.id?.startsWith('__')) {\n return;\n }\n\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n });\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n"],"names":["getCellMinWidth","fontSize","FontSizes","small","large","medium","ensureOrdering","columns","internalColumnsPinnedToTheRight","settingsOrder","internalColumns","filter","column","_column$id","id","startsWith","includes","map","orderingDisabled","orderingEnabled","orderedColumns","Array","isArray","slice","sort","a","b","indexOf","forEach","_column$id2","_column$meta","meta","enableOrdering","push","order","findIndex"],"mappings":";;AAGA;MACaA,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAEA;SACgBC,cAAcA,CAC1BC,OAAqC,EACrCC,+BAAyC,EACzCC,aAAmC;;EAGnC,MAAMC,eAAe,GAAGH,OAAO,CAC1BI,MAAM,CAACC,MAAM;IAAA,IAAAC,UAAA;IAAA,OAAI,EAAAA,UAAA,GAAAD,MAAM,CAACE,EAAE,cAAAD,UAAA,uBAATA,UAAA,CAAWE,UAAU,CAAC,IAAI,CAAC,KAAI,CAACP,+BAA+B,CAACQ,QAAQ,CAACJ,MAAM,CAACE,EAAE,CAAC;IAAC,CACrGG,GAAG,CAACL,MAAM,IAAIA,MAAM,CAACE,EAAE,CAAa;;EAGzC,MAAMI,gBAAgB,GAAa,EAAE;EACrC,MAAMC,eAAe,GAAa,EAAE;EAEpC,IAAIC,cAAc,GAAGb,OAAO;;EAG5B,IAAIc,KAAK,CAACC,OAAO,CAACb,aAAa,CAAC,EAAE;IAC9BW,cAAc,GAAGb,OAAO,CAACgB,KAAK,EAAE,CAACC,IAAI;;IAEjC,CAACC,CAAC,EAAEC,CAAC,KAAK,CAACjB,aAAa,CAACkB,OAAO,CAACF,CAAC,CAACX,EAAY,CAAC,KAAK,CAAC,KAAKL,aAAa,CAACkB,OAAO,CAACD,CAAC,CAACZ,EAAY,CAAC,KAAK,CAAC,CAAC,CAC1G;;EAGLM,cAAc,CAACQ,OAAO,CAAChB,MAAM;;IACzB,KAAAiB,WAAA,GAAIjB,MAAM,CAACE,EAAE,cAAAe,WAAA,eAATA,WAAA,CAAWd,UAAU,CAAC,IAAI,CAAC,EAAE;MAC7B;;IAGJ,KAAAe,YAAA,GAAIlB,MAAM,CAACmB,IAAI,cAAAD,YAAA,eAAXA,YAAA,CAAaE,cAAc,EAAE;MAC7Bb,eAAe,CAACc,IAAI,CAACrB,MAAM,CAACE,EAAY,CAAC;KAC5C,MAAM;MACHI,gBAAgB,CAACe,IAAI,CAACrB,MAAM,CAACE,EAAY,CAAC;;GAEjD,CAAC;EAEF,MAAMoB,KAAK,GAAG,CAAC,GAAGxB,eAAe,EAAE,GAAGQ,gBAAgB,EAAE,GAAGC,eAAe,CAAC;;EAG3EX,+BAA+B,CAACoB,OAAO,CAACd,EAAE;IACtC,IAAIP,OAAO,CAAC4B,SAAS,CAACvB,MAAM,IAAIA,MAAM,CAACE,EAAE,KAAKA,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;MACpDoB,KAAK,CAACD,IAAI,CAACnB,EAAE,CAAC;;GAErB,CAAC;EAEF,OAAOoB,KAAK;AAChB;;;;"}
1
+ {"version":3,"file":"columns.js","sources":["../../../../../../../../../src/primitives/Table/useTable/util/columns.ts"],"sourcesContent":["import { ColumnDef as ReactTableColumnDef } from '@tanstack/react-table';\nimport { isDate } from 'date-fns';\nimport { FontSize, FontSizes } from '../../../../types';\nimport { format, parseFromISOString } from '../../../../utils/date';\nimport { TableColumnDataType } from '../../types';\n\nexport function isInternalColumn(id: string | undefined) {\n return id?.startsWith('__');\n}\n\n// column widths\nexport const getCellMinWidth = (fontSize: FontSize = 'medium') => {\n switch (fontSize) {\n case FontSizes.small:\n return 57;\n\n case FontSizes.large:\n return 83;\n\n default:\n case FontSizes.medium:\n return 72;\n }\n};\n\n// highlighting\nexport function isCellHighlighted(query: string, value: unknown, dataType?: TableColumnDataType) {\n if (value === undefined || value === null) {\n return false;\n }\n\n return String(getCellValueAsString(value, dataType)).toLocaleLowerCase().includes(query.toLocaleLowerCase());\n}\n\nexport function getCellValueAsString(value: unknown, dataType?: TableColumnDataType): string {\n if (value === undefined || value === null) {\n return '';\n } else if (isDate(value)) {\n return format(value as Date) ?? '';\n } else if (dataType === 'datetime' && typeof value === 'string') {\n return format(parseFromISOString(value as string)) ?? '';\n }\n\n return String(value);\n}\n\n// ordering\nexport function ensureOrdering<TType = unknown>(\n columns: ReactTableColumnDef<TType>[],\n settingsOrder: string[] | undefined,\n internalColumnsPinnedToTheRight: string[] = ['__actions']\n): string[] {\n // internal columns come with a defined order\n const internalColumns = columns\n .filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id)))\n .map(column => column.id) as string[];\n\n // columns with ordering disabled should be moved to the front\n const orderingDisabled: string[] = [];\n const orderingEnabled: string[] = [];\n\n let orderedColumns = columns;\n\n // if settings is defined, make sure the columns that are actual children are sorted by it\n if (Array.isArray(settingsOrder)) {\n orderedColumns = columns.slice().sort(\n // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end\n (a, b) => (settingsOrder.indexOf(a.id as string) >>> 0) - (settingsOrder.indexOf(b.id as string) >>> 0)\n );\n }\n\n orderedColumns.forEach(column => {\n if (isInternalColumn(column.id)) {\n return;\n }\n\n if (column.meta?.enableOrdering) {\n orderingEnabled.push(column.id as string);\n } else {\n orderingDisabled.push(column.id as string);\n }\n });\n\n const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];\n\n // actions should always be last, enforce that\n internalColumnsPinnedToTheRight.forEach(id => {\n if (columns.findIndex(column => column.id === id) > -1) {\n order.push(id);\n }\n });\n\n return order;\n}\n\n// freezing - we use the react-table pinning state, but that requires some mapping between them\nexport function unfreezeAllExternalColumns(leftPinnedState?: string[]): string[] {\n return leftPinnedState?.filter(id => isInternalColumn(id) && id !== '__actions') ?? [];\n}\n\nexport function freezeUptoExternalColumn(index: number, columns: string[]): string[] {\n return columns.slice(0, index + 1);\n}\n"],"names":["isInternalColumn","id","startsWith","getCellMinWidth","fontSize","FontSizes","small","large","medium","ensureOrdering","columns","settingsOrder","internalColumnsPinnedToTheRight","internalColumns","filter","column","includes","String","map","orderingDisabled","orderingEnabled","orderedColumns","Array","isArray","slice","sort","a","b","indexOf","forEach","_column$meta","meta","enableOrdering","push","order","findIndex"],"mappings":";;;;SAMgBA,gBAAgBA,CAACC,EAAsB;EACnD,OAAOA,EAAE,aAAFA,EAAE,uBAAFA,EAAE,CAAEC,UAAU,CAAC,IAAI,CAAC;AAC/B;AAEA;MACaC,eAAe,GAAGA,CAACC,WAAqB,QAAQ;EACzD,QAAQA,QAAQ;IACZ,KAAKC,SAAS,CAACC,KAAK;MAChB,OAAO,EAAE;IAEb,KAAKD,SAAS,CAACE,KAAK;MAChB,OAAO,EAAE;IAEb;IACA,KAAKF,SAAS,CAACG,MAAM;MACjB,OAAO,EAAE;;AAErB;AAuBA;SACgBC,cAAcA,CAC1BC,OAAqC,EACrCC,aAAmC,EACnCC,kCAA4C,CAAC,WAAW,CAAC;;EAGzD,MAAMC,eAAe,GAAGH,OAAO,CAC1BI,MAAM,CAACC,MAAM,IAAIf,gBAAgB,CAACe,MAAM,CAACd,EAAE,CAAC,IAAI,CAACW,+BAA+B,CAACI,QAAQ,CAACC,MAAM,CAACF,MAAM,CAACd,EAAE,CAAC,CAAC,CAAC,CAC7GiB,GAAG,CAACH,MAAM,IAAIA,MAAM,CAACd,EAAE,CAAa;;EAGzC,MAAMkB,gBAAgB,GAAa,EAAE;EACrC,MAAMC,eAAe,GAAa,EAAE;EAEpC,IAAIC,cAAc,GAAGX,OAAO;;EAG5B,IAAIY,KAAK,CAACC,OAAO,CAACZ,aAAa,CAAC,EAAE;IAC9BU,cAAc,GAAGX,OAAO,CAACc,KAAK,EAAE,CAACC,IAAI;;IAEjC,CAACC,CAAC,EAAEC,CAAC,KAAK,CAAChB,aAAa,CAACiB,OAAO,CAACF,CAAC,CAACzB,EAAY,CAAC,KAAK,CAAC,KAAKU,aAAa,CAACiB,OAAO,CAACD,CAAC,CAAC1B,EAAY,CAAC,KAAK,CAAC,CAAC,CAC1G;;EAGLoB,cAAc,CAACQ,OAAO,CAACd,MAAM;;IACzB,IAAIf,gBAAgB,CAACe,MAAM,CAACd,EAAE,CAAC,EAAE;MAC7B;;IAGJ,KAAA6B,YAAA,GAAIf,MAAM,CAACgB,IAAI,cAAAD,YAAA,eAAXA,YAAA,CAAaE,cAAc,EAAE;MAC7BZ,eAAe,CAACa,IAAI,CAAClB,MAAM,CAACd,EAAY,CAAC;KAC5C,MAAM;MACHkB,gBAAgB,CAACc,IAAI,CAAClB,MAAM,CAACd,EAAY,CAAC;;GAEjD,CAAC;EAEF,MAAMiC,KAAK,GAAG,CAAC,GAAGrB,eAAe,EAAE,GAAGM,gBAAgB,EAAE,GAAGC,eAAe,CAAC;;EAG3ER,+BAA+B,CAACiB,OAAO,CAAC5B,EAAE;IACtC,IAAIS,OAAO,CAACyB,SAAS,CAACpB,MAAM,IAAIA,MAAM,CAACd,EAAE,KAAKA,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;MACpDiC,KAAK,CAACD,IAAI,CAAChC,EAAE,CAAC;;GAErB,CAAC;EAEF,OAAOiC,KAAK;AAChB;;;;"}
@@ -0,0 +1,7 @@
1
+ import 'react';
2
+ import '../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
3
+
4
+ const DEFAULT_PAGE_SIZE = 100;
5
+
6
+ export { DEFAULT_PAGE_SIZE };
7
+ //# sourceMappingURL=useTableDataLoader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableDataLoader.js","sources":["../../../../../../../src/primitives/Table/useTableDataLoader.ts"],"sourcesContent":["import React from 'react';\nimport {\n TableColumnFilter,\n TableColumnSort,\n TableFilterHandler,\n TableServerLoadPageHandler,\n TableServerLoadAllHandler,\n TableSortHandler,\n} from './types';\n\nexport const DEFAULT_PAGE_SIZE = 100;\n\nexport type useTableDataPageFetcher<TType = unknown> = (\n pageIndex: number,\n pageSize: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataAllFetcher<TType = unknown> = (\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n) => Promise<{ data: TType[]; length: number }>;\n\nexport type useTableDataLoaderOptions = { pageSize: number };\n\nexport type useTableDataLoaderValues<TType = unknown> = {\n data: TType[];\n length: number | undefined;\n loadAll: TableServerLoadAllHandler;\n loadPage: TableServerLoadPageHandler;\n onChangeFilter: TableFilterHandler;\n onChangeSort: TableSortHandler;\n pageSize: number;\n};\n\nexport function useTableDataLoader<TType = unknown>(\n fetch: useTableDataPageFetcher<TType>,\n fetchAll: useTableDataAllFetcher<TType>,\n options: useTableDataLoaderOptions = { pageSize: DEFAULT_PAGE_SIZE }\n): [useTableDataLoaderValues<TType>, () => void] {\n const { pageSize } = options;\n\n // track the data length, we don't know it until the first request\n const length = React.useRef<number | undefined>(undefined);\n // data will be filled after the first request, then we'll update values in place\n const [data, setData] = React.useState<any[]>([]);\n // track which pages have been loaded to dedupe requests\n const _pendingPageRequests = React.useRef({});\n const _lastUsedSorting = React.useRef<TableColumnSort[]>([]);\n const _lastUsedFilters = React.useRef<TableColumnFilter[]>([]);\n const _lastUsedSearch = React.useRef<string>();\n const _forceReset = React.useRef(false);\n\n const loadPage = async (\n pageIndex: number,\n sorting: TableColumnSort[],\n filters: TableColumnFilter[],\n search: string | undefined\n ) => {\n let reset = false;\n\n // sorting or filters changed, reset everything\n if (\n _forceReset.current ||\n search !== _lastUsedSearch.current ||\n JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) ||\n JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)\n ) {\n _pendingPageRequests.current = {};\n // nuke the dataset so that we \"start again\" after sorting\n reset = true;\n }\n\n if (_pendingPageRequests.current[pageIndex]) {\n // if page is already loaded/loading, abort, otherwise mark it as loading\n return;\n } else {\n _pendingPageRequests.current[pageIndex] = true;\n }\n\n _forceReset.current = false;\n // set the sorting so we can track if it changed between loads\n _lastUsedSorting.current = sorting;\n // set the filters so we can track if it changed between loads\n _lastUsedFilters.current = filters;\n // set the search so we can track if it changed between loads\n _lastUsedSearch.current = search;\n\n try {\n const response = await fetch(pageIndex, pageSize, sorting, filters, search);\n\n // update state, here we do some \"magic\" to support \"load in place\"\n setData(currentData => {\n let nextData;\n\n // reset table state if:\n // - the length isn't set at all (first load)\n // - the client length and server length are different (the data changed)\n if (reset || length.current !== response.length) {\n length.current = response.length;\n nextData = Array(length.current).fill(undefined);\n } else {\n nextData = [...currentData];\n }\n\n const startIndex = pageIndex * pageSize;\n nextData.splice(startIndex, pageSize, ...response.data);\n return nextData;\n });\n } catch {\n //\n } finally {\n _pendingPageRequests.current[pageIndex] = false;\n }\n };\n\n const loadAll = async (sorting: TableColumnSort[], filters: TableColumnFilter[], search: string | undefined) => {\n try {\n const response = await fetchAll(sorting, filters, search);\n length.current = response.length;\n\n setData(() => {\n let nextData;\n\n if (response.data.length !== response.length) {\n nextData = Array(response.length).fill(undefined);\n nextData.splice(0, response.data.length, ...response.data);\n } else {\n nextData = [...response.data];\n }\n\n return nextData;\n });\n } catch {\n //\n }\n };\n\n const invalidate = async () => {\n _forceReset.current = true;\n return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);\n };\n\n // we reset the page to 0 whenever sorting, filtering or search changes\n const handleSort = async (sorting: TableColumnSort[]) =>\n loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);\n const handleFilter = async (filters: TableColumnFilter[]) =>\n loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);\n\n return [\n {\n data,\n length: length.current,\n loadAll,\n loadPage,\n onChangeFilter: handleFilter,\n onChangeSort: handleSort,\n pageSize,\n },\n invalidate,\n ];\n}\n"],"names":["DEFAULT_PAGE_SIZE"],"mappings":";;;MAUaA,iBAAiB,GAAG;;;;"}
@@ -25,6 +25,15 @@ const getNextFocussableElement = currentElement => {
25
25
  }
26
26
  return focussableElements[currentElementIndex + 1];
27
27
  };
28
+ function isElementInsideOrTriggeredFromContainer(element, container) {
29
+ switch (element === null || element === void 0 ? void 0 : element.getAttribute('role')) {
30
+ case 'dialog':
31
+ return !!(container !== null && container !== void 0 && container.querySelector(`[aria-controls='${element.id}']`));
32
+ case 'menu':
33
+ return !!(container !== null && container !== void 0 && container.querySelector(`#${element.getAttribute('aria-labelledby')}`));
34
+ }
35
+ return !!(container !== null && container !== void 0 && container.contains(element));
36
+ }
28
37
 
29
- export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement };
38
+ export { getIndexOfFirstChildOverflowingParent, getNextFocussableElement, isElementInsideOrTriggeredFromContainer };
30
39
  //# sourceMappingURL=dom.js.map