@economic/taco 2.21.2 → 2.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. package/dist/components/Report/Report.d.ts +21 -0
  2. package/dist/components/Report/components/Cell/Cell.d.ts +0 -1
  3. package/dist/components/Report/components/Cell/DisplayCell.d.ts +1 -1
  4. package/dist/components/Report/components/Cell/util.d.ts +1 -1
  5. package/dist/components/Report/components/Row/DisplayRow.d.ts +2 -9
  6. package/dist/components/Report/components/Toolbar/components/Filters/components/Placeholder.d.ts +5 -5
  7. package/dist/components/Report/listeners/useTableRowActiveListener.d.ts +3 -0
  8. package/dist/components/Report/styles/util.d.ts +2 -2
  9. package/dist/components/Report/types.d.ts +1 -3
  10. package/dist/components/Report/useReport.d.ts +2 -7
  11. package/dist/components/Table3/types.d.ts +1 -1
  12. package/dist/esm/index.css +501 -9
  13. package/dist/esm/packages/taco/src/components/Card/Card.js +1 -1
  14. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Group/Group.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Group/Group.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Input/Input.js +37 -7
  18. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Input/util.js +3 -1
  20. package/dist/esm/packages/taco/src/components/Input/util.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Report/Report.js +70 -0
  22. package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -0
  23. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js +61 -0
  24. package/dist/esm/packages/taco/src/components/Report/components/Body/Body.js.map +1 -0
  25. package/dist/esm/packages/taco/src/components/Report/components/Body/util.js +22 -0
  26. package/dist/esm/packages/taco/src/components/Report/components/Body/util.js.map +1 -0
  27. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js +32 -0
  28. package/dist/esm/packages/taco/src/components/Report/components/Cell/Cell.js.map +1 -0
  29. package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js +23 -0
  30. package/dist/esm/packages/taco/src/components/Report/components/Cell/DisplayCell.js.map +1 -0
  31. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js +58 -0
  32. package/dist/esm/packages/taco/src/components/Report/components/Cell/GroupedCell.js.map +1 -0
  33. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js +69 -0
  34. package/dist/esm/packages/taco/src/components/Report/components/Cell/util.js.map +1 -0
  35. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js +34 -0
  36. package/dist/esm/packages/taco/src/components/Report/components/Footer/Footer.js.map +1 -0
  37. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js +39 -0
  38. package/dist/esm/packages/taco/src/components/Report/components/Footer/Summary.js.map +1 -0
  39. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js +194 -0
  40. package/dist/esm/packages/taco/src/components/Report/components/Header/Header.js.map +1 -0
  41. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js +28 -0
  42. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Goto.js.map +1 -0
  43. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js +150 -0
  44. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Menu.js.map +1 -0
  45. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js +60 -0
  46. package/dist/esm/packages/taco/src/components/Report/components/Header/components/Resizer.js.map +1 -0
  47. package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js +41 -0
  48. package/dist/esm/packages/taco/src/components/Report/components/Header/components/SortIndicator.js.map +1 -0
  49. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js +24 -0
  50. package/dist/esm/packages/taco/src/components/Report/components/Header/util.js.map +1 -0
  51. package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js +90 -0
  52. package/dist/esm/packages/taco/src/components/Report/components/Internal/Actions.js.map +1 -0
  53. package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js +59 -0
  54. package/dist/esm/packages/taco/src/components/Report/components/Internal/Expansion.js.map +1 -0
  55. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js +118 -0
  56. package/dist/esm/packages/taco/src/components/Report/components/Internal/Selection.js.map +1 -0
  57. package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js +102 -0
  58. package/dist/esm/packages/taco/src/components/Report/components/Row/DisplayRow.js.map +1 -0
  59. package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js +24 -0
  60. package/dist/esm/packages/taco/src/components/Report/components/Row/Row.js.map +1 -0
  61. package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js +10 -0
  62. package/dist/esm/packages/taco/src/components/Report/components/Row/RowContext.js.map +1 -0
  63. package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js +62 -0
  64. package/dist/esm/packages/taco/src/components/Report/components/Row/SkeletonRow.js.map +1 -0
  65. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js +63 -0
  66. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/Toolbar.js.map +1 -0
  67. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js +50 -0
  68. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/Filters.js.map +1 -0
  69. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js +136 -0
  70. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -0
  71. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js +95 -0
  72. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Filter.js.map +1 -0
  73. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js +49 -0
  74. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -0
  75. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js +110 -0
  76. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -0
  77. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js +118 -0
  78. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -0
  79. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js +41 -0
  80. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/components/Placeholder.js.map +1 -0
  81. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js +7 -0
  82. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Filters/util.js.map +1 -0
  83. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js +123 -0
  84. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/Print.js.map +1 -0
  85. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js +88 -0
  86. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Print/PrintDialog.js.map +1 -0
  87. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js +95 -0
  88. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Search/Search.js.map +1 -0
  89. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js +105 -0
  90. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -0
  91. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js +103 -0
  92. package/dist/esm/packages/taco/src/components/Report/components/Toolbar/components/Settings/Settings.js.map +1 -0
  93. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js +24 -0
  94. package/dist/esm/packages/taco/src/components/Report/listeners/useTableRowActiveListener.js.map +1 -0
  95. package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js +44 -0
  96. package/dist/esm/packages/taco/src/components/Report/styles/useColumnPinningStylesheet.js.map +1 -0
  97. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js +54 -0
  98. package/dist/esm/packages/taco/src/components/Report/styles/useCssGridStylesheet.js.map +1 -0
  99. package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js +20 -0
  100. package/dist/esm/packages/taco/src/components/Report/styles/useStylesheet.js.map +1 -0
  101. package/dist/esm/packages/taco/src/components/Report/styles/util.js +61 -0
  102. package/dist/esm/packages/taco/src/components/Report/styles/util.js.map +1 -0
  103. package/dist/esm/packages/taco/src/components/Report/useReport.js +51 -0
  104. package/dist/esm/packages/taco/src/components/Report/useReport.js.map +1 -0
  105. package/dist/esm/packages/taco/src/components/Report/util/rows.js +10 -0
  106. package/dist/esm/packages/taco/src/components/Report/util/rows.js.map +1 -0
  107. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js +39 -0
  108. package/dist/esm/packages/taco/src/components/Report/util/useTableGlobalShortcuts.js.map +1 -0
  109. package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js +162 -0
  110. package/dist/esm/packages/taco/src/components/Report/util/useTableRenderer.js.map +1 -0
  111. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js +2 -1
  112. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  113. package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
  114. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +1 -1
  115. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +1 -1
  116. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +1 -1
  117. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +6 -7
  118. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  119. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +1 -1
  120. package/dist/esm/packages/taco/src/components/Table3/Table3.js +7 -2
  121. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js +6 -6
  123. package/dist/esm/packages/taco/src/components/Table3/components/alert/ErrorAlert.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +7 -1
  125. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
  126. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -0
  127. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  128. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +6 -1
  129. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
  130. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +1 -0
  131. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
  132. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +3 -1
  133. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  134. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js +1 -0
  135. package/dist/esm/packages/taco/src/components/Table3/components/columns/footer/Summary.js.map +1 -1
  136. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +9 -1
  137. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
  138. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +1 -0
  139. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  140. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +2 -0
  141. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  142. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/ColumnSettings.js +3 -3
  143. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js +4 -8
  144. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/Filters.js.map +1 -1
  145. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js +1 -0
  146. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Filter/filters/components/FilterComparator.js.map +1 -1
  147. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +19 -14
  148. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
  149. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +6 -5
  150. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
  151. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +18 -1
  152. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  153. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js +8 -14
  154. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useColumnFreezing.js.map +1 -1
  155. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +1 -1
  156. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useSettings.js +1 -1
  157. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +5 -1
  158. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  159. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +15 -15
  160. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  161. package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js +20 -0
  162. package/dist/esm/packages/taco/src/components/Table3/hooks/useTablePreset.js.map +1 -1
  163. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  164. package/dist/esm/packages/taco/src/components/Table3/util/columns.js +2 -0
  165. package/dist/esm/packages/taco/src/components/Table3/util/columns.js.map +1 -1
  166. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js +1 -1
  167. package/dist/esm/packages/taco/src/components/Textarea/Textarea.js.map +1 -1
  168. package/dist/esm/packages/taco/src/hooks/useBoundaryOverflowDetection.js +1 -1
  169. package/dist/esm/packages/taco/src/index.js +7 -6
  170. package/dist/esm/packages/taco/src/index.js.map +1 -1
  171. package/dist/esm/packages/taco/src/primitives/Button.js +2 -1
  172. package/dist/esm/packages/taco/src/primitives/Button.js.map +1 -1
  173. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  174. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js +21 -0
  175. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableColumnFreezing.js.map +1 -0
  176. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js +8 -0
  177. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableFooter.js.map +1 -0
  178. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js +16 -0
  179. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTablePrinting.js.map +1 -0
  180. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js +17 -0
  181. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRef.js.map +1 -0
  182. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js +11 -0
  183. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowActions.js.map +1 -0
  184. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js +9 -0
  185. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowExpansion.js.map +1 -0
  186. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js +9 -0
  187. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableRowGroups.js.map +1 -0
  188. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js +38 -0
  189. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSearch.js.map +1 -0
  190. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js +28 -0
  191. package/dist/esm/packages/taco/src/primitives/Table/useTable/features/useTableSettings.js.map +1 -0
  192. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js +14 -0
  193. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableRowHeightListener.js.map +1 -0
  194. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js +15 -0
  195. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSearchListener.js.map +1 -0
  196. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js +26 -0
  197. package/dist/esm/packages/taco/src/primitives/Table/useTable/listeners/useTableSettingsListener.js.map +1 -0
  198. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js +117 -0
  199. package/dist/esm/packages/taco/src/primitives/Table/useTable/useTable.js.map +1 -0
  200. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js +30 -3
  201. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/columns.js.map +1 -1
  202. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js +131 -0
  203. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/filtering.js.map +1 -0
  204. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js +131 -0
  205. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/presets.js.map +1 -0
  206. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js +43 -0
  207. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/search.js.map +1 -0
  208. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js +22 -0
  209. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/settings.js.map +1 -0
  210. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js +270 -0
  211. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/setup.js.map +1 -0
  212. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js +18 -0
  213. package/dist/esm/packages/taco/src/primitives/Table/useTable/util/sorting.js.map +1 -0
  214. package/dist/esm/packages/taco/src/utils/dom.js +5 -1
  215. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  216. package/dist/esm/packages/taco/src/utils/keyboard.js +3 -5
  217. package/dist/esm/packages/taco/src/utils/keyboard.js.map +1 -1
  218. package/dist/index.css +501 -9
  219. package/dist/index.d.ts +1 -0
  220. package/dist/primitives/Table/types.d.ts +2 -2
  221. package/dist/primitives/Table/useTable/features/useTablePrinting.d.ts +1 -1
  222. package/dist/primitives/Table/useTable/util/settings.d.ts +1 -1
  223. package/dist/primitives/Table/useTable/util/sorting.d.ts +1 -1
  224. package/dist/taco.cjs.development.js +6380 -2731
  225. package/dist/taco.cjs.development.js.map +1 -1
  226. package/dist/taco.cjs.production.min.js +1 -1
  227. package/dist/taco.cjs.production.min.js.map +1 -1
  228. package/dist/utils/dom.d.ts +1 -0
  229. package/dist/utils/keyboard.d.ts +0 -1
  230. package/package.json +2 -2
  231. package/types.json +4682 -4776
  232. package/dist/components/Report/features/useReportExport.d.ts +0 -3
@@ -0,0 +1,61 @@
1
+ // we cannot just use a fixed height because our rows need to grow in height (images, edit mode validation etc)
2
+ function getCellHeightPadding(height, fontSize) {
3
+ // TODO: can we get the rem values from tailwind
4
+ switch (height) {
5
+ case 'short':
6
+ {
7
+ switch (fontSize) {
8
+ case 'small':
9
+ return '8px';
10
+ default:
11
+ return '6px';
12
+ }
13
+ }
14
+ case 'tall':
15
+ {
16
+ switch (fontSize) {
17
+ case 'small':
18
+ return '16px';
19
+ case 'large':
20
+ return '12px';
21
+ default:
22
+ return '14px';
23
+ }
24
+ }
25
+ case 'extra-tall':
26
+ {
27
+ switch (fontSize) {
28
+ case 'small':
29
+ return '22px';
30
+ case 'large':
31
+ return '18px';
32
+ default:
33
+ return '20px';
34
+ }
35
+ }
36
+ default:
37
+ {
38
+ switch (fontSize) {
39
+ case 'small':
40
+ return '12px';
41
+ case 'large':
42
+ return '8px';
43
+ default:
44
+ return '10px';
45
+ }
46
+ }
47
+ }
48
+ }
49
+ function getCellWidthPadding(fontSize) {
50
+ switch (fontSize) {
51
+ case 'small':
52
+ return '8px';
53
+ case 'medium':
54
+ return '12px';
55
+ default:
56
+ return '16px';
57
+ }
58
+ }
59
+
60
+ export { getCellHeightPadding, getCellWidthPadding };
61
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sources":["../../../../../../../../src/components/Report/styles/util.ts"],"sourcesContent":["import { TableFontSize, TableRowHeight } from '../../../primitives/Table/types';\n\n// we cannot just use a fixed height because our rows need to grow in height (images, edit mode validation etc)\nexport function getCellHeightPadding(height: TableRowHeight, fontSize: TableFontSize) {\n // TODO: can we get the rem values from tailwind\n switch (height) {\n case 'short': {\n switch (fontSize) {\n case 'small':\n return '8px';\n\n default:\n return '6px';\n }\n }\n\n case 'tall': {\n switch (fontSize) {\n case 'small':\n return '16px';\n\n case 'large':\n return '12px';\n\n default:\n return '14px';\n }\n }\n\n case 'extra-tall': {\n switch (fontSize) {\n case 'small':\n return '22px';\n\n case 'large':\n return '18px';\n\n default:\n return '20px';\n }\n }\n\n default: {\n switch (fontSize) {\n case 'small':\n return '12px';\n\n case 'large':\n return '8px';\n\n default:\n return '10px';\n }\n }\n }\n}\n\nexport function getCellWidthPadding(fontSize: TableFontSize) {\n switch (fontSize) {\n case 'small':\n return '8px';\n\n case 'medium':\n return '12px';\n\n default:\n return '16px';\n }\n}\n"],"names":["getCellHeightPadding","height","fontSize","getCellWidthPadding"],"mappings":"AAEA;SACgBA,oBAAoBA,CAACC,MAAsB,EAAEC,QAAuB;;EAEhF,QAAQD,MAAM;IACV,KAAK,OAAO;MAAE;QACV,QAAQC,QAAQ;UACZ,KAAK,OAAO;YACR,OAAO,KAAK;UAEhB;YACI,OAAO,KAAK;;;IAIxB,KAAK,MAAM;MAAE;QACT,QAAQA,QAAQ;UACZ,KAAK,OAAO;YACR,OAAO,MAAM;UAEjB,KAAK,OAAO;YACR,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB,KAAK,YAAY;MAAE;QACf,QAAQA,QAAQ;UACZ,KAAK,OAAO;YACR,OAAO,MAAM;UAEjB,KAAK,OAAO;YACR,OAAO,MAAM;UAEjB;YACI,OAAO,MAAM;;;IAIzB;MAAS;QACL,QAAQA,QAAQ;UACZ,KAAK,OAAO;YACR,OAAO,MAAM;UAEjB,KAAK,OAAO;YACR,OAAO,KAAK;UAEhB;YACI,OAAO,MAAM;;;;AAIjC;SAEgBC,mBAAmBA,CAACD,QAAuB;EACvD,QAAQA,QAAQ;IACZ,KAAK,OAAO;MACR,OAAO,KAAK;IAEhB,KAAK,QAAQ;MACT,OAAO,MAAM;IAEjB;MACI,OAAO,MAAM;;AAEzB;;;;"}
@@ -0,0 +1,51 @@
1
+ import React__default from 'react';
2
+ import cn from 'clsx';
3
+ import { useTable } from '../../primitives/Table/useTable/useTable.js';
4
+ import { Header, Cell } from './components/Internal/Actions.js';
5
+ import { Header as Header$1, Cell as Cell$1 } from './components/Internal/Expansion.js';
6
+ import { Header as Header$2, Cell as Cell$2 } from './components/Internal/Selection.js';
7
+ import { useTableRowActiveListener } from './listeners/useTableRowActiveListener.js';
8
+
9
+ function useReport(props, ref) {
10
+ const meta = {};
11
+ // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel
12
+ const INTERNAL_COLUMNS = React__default.useMemo(() => ({
13
+ rowActions: {
14
+ header: Header,
15
+ renderer: Cell,
16
+ meta: {
17
+ align: 'right',
18
+ className: cn('print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky [table[data-table-pause-hover="false"]_&]:group-hover/row:sticky right-0', 'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-row-selected="true"]]/row:text-blue-100', 'group-[[data-row-selected="false"]:hover]/row:text-grey-100'),
19
+ header: ''
20
+ }
21
+ },
22
+ rowExpansion: {
23
+ header: Header$1,
24
+ renderer: Cell$1,
25
+ size: 40,
26
+ meta: {
27
+ align: 'center',
28
+ header: '',
29
+ headerClassName: '!p-0'
30
+ }
31
+ },
32
+ rowSelection: {
33
+ header: Header$2,
34
+ renderer: Cell$2,
35
+ size: 40,
36
+ meta: {
37
+ align: 'center',
38
+ className: '!px-1',
39
+ header: '',
40
+ headerClassName: '!px-1'
41
+ }
42
+ }
43
+ }), []);
44
+ const report = useTable(props, ref, meta, INTERNAL_COLUMNS);
45
+ // listeners
46
+ useTableRowActiveListener(report.instance, ref);
47
+ return report;
48
+ }
49
+
50
+ export { useReport };
51
+ //# sourceMappingURL=useReport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReport.js","sources":["../../../../../../../src/components/Report/useReport.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { useTable } from '../../primitives/Table/useTable/useTable';\nimport { ReportProps } from './types';\nimport { Header as RowActionsHeader, Cell as RowActionsCell } from './components/Internal/Actions';\nimport { Header as RowExpansionHeader, Cell as RowExpansionCell } from './components/Internal/Expansion';\nimport { Header as RowSelectHeader, Cell as RowSelectCell } from './components/Internal/Selection';\nimport { TableRef, useTableInternalColumns } from '../../primitives/Table/types';\nimport { useTableRowActiveListener } from './listeners/useTableRowActiveListener';\n\ntype ReportMeta = {};\n\nexport function useReport<TType>(props: ReportProps<TType>, ref: React.RefObject<TableRef>) {\n const meta: ReportMeta = {};\n // @ts-expect-error: fixing type issue while report and table3 TableMeta definitions live in parallel\n const INTERNAL_COLUMNS: useTableInternalColumns<TType> = React.useMemo(\n () => ({\n rowActions: {\n header: RowActionsHeader,\n renderer: RowActionsCell,\n meta: {\n align: 'right',\n className: cn(\n 'print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active=\"true\"]]/row:sticky [table[data-table-pause-hover=\"false\"]_&]:group-hover/row:sticky right-0',\n 'group-[[data-row-active=\"true\"][data-selected=\"false\"]]/row:text-grey-200',\n 'group-[[data-row-selected=\"true\"]]/row:text-blue-100',\n 'group-[[data-row-selected=\"false\"]:hover]/row:text-grey-100'\n ),\n header: '',\n },\n },\n rowExpansion: {\n header: RowExpansionHeader,\n renderer: RowExpansionCell,\n size: 40,\n meta: {\n align: 'center',\n header: '',\n headerClassName: '!p-0',\n },\n },\n rowSelection: {\n header: RowSelectHeader,\n renderer: RowSelectCell,\n size: 40,\n meta: {\n align: 'center',\n className: '!px-1',\n header: '',\n headerClassName: '!px-1',\n },\n },\n }),\n []\n );\n\n const report = useTable<TType, ReportMeta>(props, ref, meta, INTERNAL_COLUMNS);\n\n // listeners\n useTableRowActiveListener(report.instance, ref);\n\n return report;\n}\n"],"names":["useReport","props","ref","meta","INTERNAL_COLUMNS","React","useMemo","rowActions","header","RowActionsHeader","renderer","RowActionsCell","align","className","cn","rowExpansion","RowExpansionHeader","RowExpansionCell","size","headerClassName","rowSelection","RowSelectHeader","RowSelectCell","report","useTable","useTableRowActiveListener","instance"],"mappings":";;;;;;;;SAYgBA,SAASA,CAAQC,KAAyB,EAAEC,GAA8B;EACtF,MAAMC,IAAI,GAAe,EAAE;;EAE3B,MAAMC,gBAAgB,GAAmCC,cAAK,CAACC,OAAO,CAClE,OAAO;IACHC,UAAU,EAAE;MACRC,MAAM,EAAEC,MAAgB;MACxBC,QAAQ,EAAEC,IAAc;MACxBR,IAAI,EAAE;QACFS,KAAK,EAAE,OAAO;QACdC,SAAS,EAAEC,EAAE,CACT,4KAA4K,EAC5K,2EAA2E,EAC3E,sDAAsD,EACtD,6DAA6D,CAChE;QACDN,MAAM,EAAE;;KAEf;IACDO,YAAY,EAAE;MACVP,MAAM,EAAEQ,QAAkB;MAC1BN,QAAQ,EAAEO,MAAgB;MAC1BC,IAAI,EAAE,EAAE;MACRf,IAAI,EAAE;QACFS,KAAK,EAAE,QAAQ;QACfJ,MAAM,EAAE,EAAE;QACVW,eAAe,EAAE;;KAExB;IACDC,YAAY,EAAE;MACVZ,MAAM,EAAEa,QAAe;MACvBX,QAAQ,EAAEY,MAAa;MACvBJ,IAAI,EAAE,EAAE;MACRf,IAAI,EAAE;QACFS,KAAK,EAAE,QAAQ;QACfC,SAAS,EAAE,OAAO;QAClBL,MAAM,EAAE,EAAE;QACVW,eAAe,EAAE;;;GAG5B,CAAC,EACF,EAAE,CACL;EAED,MAAMI,MAAM,GAAGC,QAAQ,CAAoBvB,KAAK,EAAEC,GAAG,EAAEC,IAAI,EAAEC,gBAAgB,CAAC;;EAG9EqB,yBAAyB,CAACF,MAAM,CAACG,QAAQ,EAAExB,GAAG,CAAC;EAE/C,OAAOqB,MAAM;AACjB;;;;"}
@@ -0,0 +1,10 @@
1
+ const ROW_HEIGHT_ESTIMATES = {
2
+ short: 33,
3
+ medium: 41,
4
+ tall: 49,
5
+ 'extra-tall': 57
6
+ };
7
+ const HEADER_ROW_HEIGHT_ESTIMATE = ROW_HEIGHT_ESTIMATES.medium + 2; // header includes 2px border
8
+
9
+ export { HEADER_ROW_HEIGHT_ESTIMATE, ROW_HEIGHT_ESTIMATES };
10
+ //# sourceMappingURL=rows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.js","sources":["../../../../../../../../src/components/Report/util/rows.ts"],"sourcesContent":["export const ROW_HEIGHT_ESTIMATES = {\n short: 33,\n medium: 41,\n tall: 49,\n 'extra-tall': 57,\n};\n\nexport const HEADER_ROW_HEIGHT_ESTIMATE = ROW_HEIGHT_ESTIMATES.medium + 2; // header includes 2px border\n"],"names":["ROW_HEIGHT_ESTIMATES","short","medium","tall","HEADER_ROW_HEIGHT_ESTIMATE"],"mappings":"MAAaA,oBAAoB,GAAG;EAChCC,KAAK,EAAE,EAAE;EACTC,MAAM,EAAE,EAAE;EACVC,IAAI,EAAE,EAAE;EACR,YAAY,EAAE;;MAGLC,0BAA0B,GAAGJ,oBAAoB,CAACE,MAAM,GAAG,EAAE;;;;"}
@@ -0,0 +1,39 @@
1
+ import React__default from 'react';
2
+
3
+ function useTableGlobalShortcuts(table, tableRef, scrollToIndex) {
4
+ const tableMeta = table.options.meta;
5
+ const rows = table.getRowModel().rows;
6
+ React__default.useEffect(() => {
7
+ const handleKeyDown = event => {
8
+ const target = event.target;
9
+ const dialog = target.closest('[role="dialog"]');
10
+ //const eventOriginatedFromCombobox = !!target.closest('[role="combobox"]');
11
+ // Don't trigger global shortcuts on the table if event originated from a combobox or if table is
12
+ // outside the dialog
13
+ if (
14
+ //eventOriginatedFromCombobox ||
15
+ dialog && !(dialog !== null && dialog !== void 0 && dialog.contains(tableRef.current))
16
+ // || tableMeta.shortcutsState.isPaused
17
+ ) {
18
+ return;
19
+ }
20
+ tableMeta.rowActive.handleKeyDown(event, rows.length, scrollToIndex, tableRef);
21
+ tableMeta.rowSelection.handleKeyDown(event, table);
22
+ if (tableMeta.rowActive.rowActiveIndex !== undefined) {
23
+ var _rows$tableMeta$rowAc;
24
+ tableMeta.rowClick.handleKeyDown(event, (_rows$tableMeta$rowAc = rows[tableMeta.rowActive.rowActiveIndex]) === null || _rows$tableMeta$rowAc === void 0 ? void 0 : _rows$tableMeta$rowAc.original);
25
+ }
26
+ };
27
+ document.addEventListener('keydown', handleKeyDown);
28
+ return () => {
29
+ document.removeEventListener('keydown', handleKeyDown);
30
+ };
31
+ },
32
+ // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143
33
+ // scrollToIndex function changes when row count changes, so it is important to update handlers with new
34
+ // scrollToIndex function.
35
+ [tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]);
36
+ }
37
+
38
+ export { useTableGlobalShortcuts };
39
+ //# sourceMappingURL=useTableGlobalShortcuts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableGlobalShortcuts.js","sources":["../../../../../../../../src/components/Report/util/useTableGlobalShortcuts.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport { TableRef } from '../../../primitives/Table/types';\n\nexport function useTableGlobalShortcuts<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n scrollToIndex: (index: number) => void\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n\n React.useEffect(\n () => {\n const handleKeyDown = (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const dialog = target.closest('[role=\"dialog\"]');\n //const eventOriginatedFromCombobox = !!target.closest('[role=\"combobox\"]');\n\n // Don't trigger global shortcuts on the table if event originated from a combobox or if table is\n // outside the dialog\n if (\n //eventOriginatedFromCombobox ||\n dialog &&\n !dialog?.contains(tableRef.current)\n // || tableMeta.shortcutsState.isPaused\n ) {\n return;\n }\n\n tableMeta.rowActive.handleKeyDown(event, rows.length, scrollToIndex, tableRef);\n tableMeta.rowSelection.handleKeyDown(event, table);\n\n if (tableMeta.rowActive.rowActiveIndex !== undefined) {\n tableMeta.rowClick.handleKeyDown(event, rows[tableMeta.rowActive.rowActiveIndex]?.original);\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n },\n // See https://github.com/e-conomic/taco/blob/dev/packages/taco/src/components/Table3/strategies/virtualised.tsx#L143\n // scrollToIndex function changes when row count changes, so it is important to update handlers with new\n // scrollToIndex function.\n [tableRef.current, tableMeta.rowActive.rowActiveIndex, scrollToIndex]\n );\n}\n"],"names":["useTableGlobalShortcuts","table","tableRef","scrollToIndex","tableMeta","options","meta","rows","getRowModel","React","useEffect","handleKeyDown","event","target","dialog","closest","contains","current","rowActive","length","rowSelection","rowActiveIndex","undefined","_rows$tableMeta$rowAc","rowClick","original","document","addEventListener","removeEventListener"],"mappings":";;SAIgBA,uBAAuBA,CACnCC,KAAwB,EACxBC,QAAmC,EACnCC,aAAsC;EAEtC,MAAMC,SAAS,GAAGH,KAAK,CAACI,OAAO,CAACC,IAA6B;EAC7D,MAAMC,IAAI,GAAGN,KAAK,CAACO,WAAW,EAAE,CAACD,IAAI;EAErCE,cAAK,CAACC,SAAS,CACX;IACI,MAAMC,aAAa,GAAIC,KAAoB;MACvC,MAAMC,MAAM,GAAGD,KAAK,CAACC,MAAqB;MAC1C,MAAMC,MAAM,GAAGD,MAAM,CAACE,OAAO,CAAC,iBAAiB,CAAC;;;;MAKhD;;MAEID,MAAM,IACN,EAACA,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEE,QAAQ,CAACd,QAAQ,CAACe,OAAO,CAAC;;QAErC;QACE;;MAGJb,SAAS,CAACc,SAAS,CAACP,aAAa,CAACC,KAAK,EAAEL,IAAI,CAACY,MAAM,EAAEhB,aAAa,EAAED,QAAQ,CAAC;MAC9EE,SAAS,CAACgB,YAAY,CAACT,aAAa,CAACC,KAAK,EAAEX,KAAK,CAAC;MAElD,IAAIG,SAAS,CAACc,SAAS,CAACG,cAAc,KAAKC,SAAS,EAAE;QAAA,IAAAC,qBAAA;QAClDnB,SAAS,CAACoB,QAAQ,CAACb,aAAa,CAACC,KAAK,GAAAW,qBAAA,GAAEhB,IAAI,CAACH,SAAS,CAACc,SAAS,CAACG,cAAc,CAAC,cAAAE,qBAAA,uBAAxCA,qBAAA,CAA0CE,QAAQ,CAAC;;KAElG;IAEDC,QAAQ,CAACC,gBAAgB,CAAC,SAAS,EAAEhB,aAAa,CAAC;IAEnD,OAAO;MACHe,QAAQ,CAACE,mBAAmB,CAAC,SAAS,EAAEjB,aAAa,CAAC;KACzD;GACJ;;;;EAID,CAACT,QAAQ,CAACe,OAAO,EAAEb,SAAS,CAACc,SAAS,CAACG,cAAc,EAAElB,aAAa,CAAC,CACxE;AACL;;;;"}
@@ -0,0 +1,162 @@
1
+ import React__default from 'react';
2
+ import { useVirtualizer, defaultRangeExtractor } from '@tanstack/react-virtual';
3
+ import { HEADER_ROW_HEIGHT_ESTIMATE, ROW_HEIGHT_ESTIMATES } from './rows.js';
4
+ import { Row } from '../components/Row/Row.js';
5
+
6
+ const TABLE_SCROLL_PADDING_BOTTOM = 36;
7
+ const TABLE_PADDING_BOTTOM = 120;
8
+ function useTableRenderer(table, tableRef, defaultRowActiveIndex) {
9
+ var _table$getState$group, _virtualItems$;
10
+ const tableMeta = table.options.meta;
11
+ const rows = table.getRowModel().rows;
12
+ const HEADER_OFFSET_TOTAL = HEADER_ROW_HEIGHT_ESTIMATE * table.getHeaderGroups().length;
13
+ // expanded rows
14
+ const {
15
+ createRowMeasurer,
16
+ estimateSize
17
+ } = useRowHeightVirtualisation(table);
18
+ // row groups
19
+ const rangeExtractor = useRowGroupVirtualisation(table);
20
+ const virtualiser = useVirtualizer({
21
+ count: rows.length,
22
+ estimateSize,
23
+ getScrollElement: () => tableRef.current,
24
+ overscan: tableMeta.printing.isPrinting ? rows.length : undefined,
25
+ rangeExtractor,
26
+ scrollPaddingStart: (_table$getState$group = table.getState().grouping) !== null && _table$getState$group !== void 0 && _table$getState$group.length ? HEADER_ROW_HEIGHT_ESTIMATE : undefined,
27
+ scrollPaddingEnd: HEADER_OFFSET_TOTAL + TABLE_SCROLL_PADDING_BOTTOM,
28
+ paddingEnd: TABLE_PADDING_BOTTOM
29
+ });
30
+ const virtualItems = virtualiser.getVirtualItems();
31
+ const scrollToIndex = React__default.useCallback((index, options = {
32
+ align: 'auto',
33
+ behavior: 'smooth'
34
+ }) => {
35
+ const notSmooth = {
36
+ ...options,
37
+ behavior: 'auto'
38
+ };
39
+ if (tableRef.current) {
40
+ if (index === 0) {
41
+ virtualiser.scrollToOffset(0, notSmooth);
42
+ } else if (index >= virtualItems.length - 1) {
43
+ // scrolling to the last row isn't easy when rows have dynamic height
44
+ // because you don't know all the heights until they render...
45
+ // so when you skip to the last you don't know if "the end" is actually the end
46
+ virtualiser.scrollToIndex(index, notSmooth);
47
+ // https://github.com/TanStack/virtual/issues/216
48
+ setTimeout(() => {
49
+ virtualiser.scrollToIndex(index, notSmooth);
50
+ setTimeout(() => {
51
+ virtualiser.scrollToIndex(index, notSmooth);
52
+ }, 150);
53
+ }, 150);
54
+ } else {
55
+ virtualiser.scrollToIndex(index, options);
56
+ }
57
+ }
58
+ }, [virtualItems.length, tableRef.current]);
59
+ // styling for offsetting rows - this "is" the virtualisation
60
+ const [paddingTop, paddingBottom] = virtualItems.length > 0 ? [
61
+ // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0
62
+ Math.max(0, ((_virtualItems$ = virtualItems[1]) !== null && _virtualItems$ !== void 0 ? _virtualItems$ : virtualItems[0]).start - virtualiser.options.scrollMargin - virtualItems[0].size), Math.max(0, virtualiser.getTotalSize() - virtualItems[virtualItems.length - 1].end)] : [0, 0];
63
+ // ensure default active rows are scrolled to
64
+ React__default.useEffect(() => {
65
+ if (defaultRowActiveIndex) {
66
+ scrollToIndex(defaultRowActiveIndex, {
67
+ align: 'center',
68
+ behavior: 'auto'
69
+ });
70
+ }
71
+ }, []);
72
+ // rendered output
73
+ let style = {};
74
+ let content = null;
75
+ if (rows.length) {
76
+ style = {
77
+ height: `${virtualiser.getTotalSize()}px`,
78
+ paddingBottom,
79
+ paddingTop
80
+ };
81
+ content = virtualItems.map(virtualRow => {
82
+ const row = rows[virtualRow.index];
83
+ const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);
84
+ return /*#__PURE__*/React__default.createElement(Row, {
85
+ key: row.id,
86
+ row: row,
87
+ index: virtualRow.index,
88
+ table: table,
89
+ measureRow: measureRow
90
+ });
91
+ });
92
+ }
93
+ return {
94
+ rows: content,
95
+ style,
96
+ scrollToIndex
97
+ };
98
+ }
99
+ // support varying row heights - variable row heights, row expansion
100
+ function useRowHeightVirtualisation(table) {
101
+ const tableMeta = table.options.meta;
102
+ const rows = table.getRowModel().rows;
103
+ const expandedState = table.getState().expanded;
104
+ const [expandedRowHeightsCache, setExpandedRowHeightsCache] = React__default.useState({});
105
+ // look at all registered expanded row heights and use them to form a more accurate average size
106
+ // it might be worth considering if taking the max, or an upper bound, would be better
107
+ const averageExpandedRowHeight = React__default.useMemo(() => {
108
+ const values = Object.values(expandedRowHeightsCache);
109
+ return values.length ? values.reduce((a, b) => a + b, 0) / values.length : 0;
110
+ }, [expandedRowHeightsCache]);
111
+ // row heights
112
+ const estimateSize = React__default.useCallback(index => {
113
+ var _rows$index, _rows$index$getIsExpa;
114
+ const rowHeight = tableMeta.rowHeight.height ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height] : ROW_HEIGHT_ESTIMATES.medium;
115
+ if (expandedState === true || (_rows$index = rows[index]) !== null && _rows$index !== void 0 && (_rows$index$getIsExpa = _rows$index.getIsExpanded) !== null && _rows$index$getIsExpa !== void 0 && _rows$index$getIsExpa.call(_rows$index)) {
116
+ return rowHeight + averageExpandedRowHeight;
117
+ }
118
+ return rowHeight;
119
+ }, [tableMeta.rowHeight.height, averageExpandedRowHeight, expandedState]);
120
+ const createRowMeasurer = React__default.useCallback((resizeItem, virtualRow) => (rowHeight, expansionHeight) => {
121
+ // register the expansion height so that it can be used to determine an average
122
+ if (expansionHeight) {
123
+ setExpandedRowHeightsCache(cache => ({
124
+ ...cache,
125
+ [virtualRow.index]: expansionHeight
126
+ }));
127
+ }
128
+ // update the whole row's size to include the expanded height
129
+ resizeItem(virtualRow, rowHeight + (expansionHeight !== null && expansionHeight !== void 0 ? expansionHeight : 0));
130
+ }, []);
131
+ return {
132
+ estimateSize,
133
+ createRowMeasurer
134
+ };
135
+ }
136
+ // support virtualised row groups (where the row group headers are sticky)
137
+ function useRowGroupVirtualisation(table) {
138
+ const rows = table.getRowModel().rows;
139
+ const isTableGrouped = !!table.getState().grouping.length;
140
+ const rowGroupIndexes = React__default.useMemo(() => {
141
+ const indexes = [];
142
+ if (isTableGrouped) {
143
+ rows.forEach((row, index) => {
144
+ if (row.getIsGrouped()) {
145
+ indexes.push(index);
146
+ }
147
+ });
148
+ }
149
+ return indexes;
150
+ }, []);
151
+ // this is taken from the react-virtual docs/examples
152
+ const rangeExtractor = React__default.useCallback(range => {
153
+ var _reverse$find;
154
+ const activeRowGroupIndex = (_reverse$find = [...rowGroupIndexes].reverse().find(index => range.startIndex >= index)) !== null && _reverse$find !== void 0 ? _reverse$find : rowGroupIndexes[0];
155
+ const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);
156
+ return [...next].sort((a, b) => a - b);
157
+ }, [rowGroupIndexes]);
158
+ return isTableGrouped ? rangeExtractor : undefined;
159
+ }
160
+
161
+ export { useTableRenderer };
162
+ //# sourceMappingURL=useTableRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTableRenderer.js","sources":["../../../../../../../../src/components/Report/util/useTableRenderer.tsx"],"sourcesContent":["import React, { CSSProperties } from 'react';\nimport { Table as ReactTable, TableMeta as ReactTableMeta } from '@tanstack/react-table';\nimport {\n useVirtualizer,\n defaultRangeExtractor,\n ScrollToOptions as ReactVirtualScrollToOptions,\n VirtualItem,\n} from '@tanstack/react-virtual';\nimport { TableRef } from '../../../primitives/Table/types';\nimport { HEADER_ROW_HEIGHT_ESTIMATE, ROW_HEIGHT_ESTIMATES } from './rows';\nimport { Row } from '../components/Row/Row';\n\nconst TABLE_SCROLL_PADDING_BOTTOM = 36;\nconst TABLE_PADDING_BOTTOM = 120;\n\nexport function useTableRenderer<TType = unknown>(\n table: ReactTable<TType>,\n tableRef: React.RefObject<TableRef>,\n defaultRowActiveIndex?: number | undefined\n) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const HEADER_OFFSET_TOTAL = HEADER_ROW_HEIGHT_ESTIMATE * table.getHeaderGroups().length;\n\n // expanded rows\n const { createRowMeasurer, estimateSize } = useRowHeightVirtualisation<TType>(table);\n\n // row groups\n const rangeExtractor = useRowGroupVirtualisation<TType>(table);\n\n const virtualiser = useVirtualizer({\n count: rows.length,\n estimateSize,\n getScrollElement: () => tableRef.current,\n overscan: tableMeta.printing.isPrinting ? rows.length : undefined,\n rangeExtractor,\n scrollPaddingStart: table.getState().grouping?.length ? HEADER_ROW_HEIGHT_ESTIMATE : undefined,\n scrollPaddingEnd: HEADER_OFFSET_TOTAL + TABLE_SCROLL_PADDING_BOTTOM,\n paddingEnd: TABLE_PADDING_BOTTOM,\n });\n\n const virtualItems = virtualiser.getVirtualItems();\n\n const scrollToIndex = React.useCallback(\n (index: number, options: ReactVirtualScrollToOptions = { align: 'auto', behavior: 'smooth' }) => {\n const notSmooth: ReactVirtualScrollToOptions = { ...options, behavior: 'auto' };\n\n if (tableRef.current) {\n if (index === 0) {\n virtualiser.scrollToOffset(0, notSmooth);\n } else if (index >= virtualItems.length - 1) {\n // scrolling to the last row isn't easy when rows have dynamic height\n // because you don't know all the heights until they render...\n // so when you skip to the last you don't know if \"the end\" is actually the end\n virtualiser.scrollToIndex(index, notSmooth);\n\n // https://github.com/TanStack/virtual/issues/216\n setTimeout(() => {\n virtualiser.scrollToIndex(index, notSmooth);\n\n setTimeout(() => {\n virtualiser.scrollToIndex(index, notSmooth);\n }, 150);\n }, 150);\n } else {\n virtualiser.scrollToIndex(index, options);\n }\n }\n },\n [virtualItems.length, tableRef.current]\n );\n\n // styling for offsetting rows - this \"is\" the virtualisation\n const [paddingTop, paddingBottom] =\n virtualItems.length > 0\n ? [\n // use row 1 not 0, because 0 might be sticky in grouped tables and it's start value will always be 0\n Math.max(\n 0,\n (virtualItems[1] ?? virtualItems[0]).start - virtualiser.options.scrollMargin - virtualItems[0].size\n ),\n Math.max(0, virtualiser.getTotalSize() - virtualItems[virtualItems.length - 1].end),\n ]\n : [0, 0];\n\n // ensure default active rows are scrolled to\n React.useEffect(() => {\n if (defaultRowActiveIndex) {\n scrollToIndex(defaultRowActiveIndex, { align: 'center', behavior: 'auto' });\n }\n }, []);\n\n // rendered output\n let style: CSSProperties = {};\n let content: JSX.Element[] | null = null;\n\n if (rows.length) {\n style = {\n height: `${virtualiser.getTotalSize()}px`,\n paddingBottom,\n paddingTop,\n };\n content = virtualItems.map(virtualRow => {\n const row = rows[virtualRow.index];\n const measureRow = createRowMeasurer(virtualiser.resizeItem, virtualRow);\n return <Row key={row.id} row={row} index={virtualRow.index} table={table} measureRow={measureRow} />;\n });\n }\n\n return {\n rows: content,\n style,\n scrollToIndex,\n };\n}\n\n// support varying row heights - variable row heights, row expansion\nfunction useRowHeightVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const tableMeta = table.options.meta as ReactTableMeta<TType>;\n const rows = table.getRowModel().rows;\n const expandedState = table.getState().expanded;\n\n const [expandedRowHeightsCache, setExpandedRowHeightsCache] = React.useState<Record<number, number>>({});\n\n // look at all registered expanded row heights and use them to form a more accurate average size\n // it might be worth considering if taking the max, or an upper bound, would be better\n const averageExpandedRowHeight = React.useMemo(() => {\n const values: number[] = Object.values(expandedRowHeightsCache);\n return values.length ? values.reduce((a, b) => a + b, 0) / values.length : 0;\n }, [expandedRowHeightsCache]);\n\n // row heights\n const estimateSize = React.useCallback(\n (index: number) => {\n const rowHeight = tableMeta.rowHeight.height\n ? ROW_HEIGHT_ESTIMATES[tableMeta.rowHeight.height]\n : ROW_HEIGHT_ESTIMATES.medium;\n\n if (expandedState === true || rows[index]?.getIsExpanded?.()) {\n return rowHeight + averageExpandedRowHeight;\n }\n\n return rowHeight;\n },\n [tableMeta.rowHeight.height, averageExpandedRowHeight, expandedState]\n );\n\n const createRowMeasurer = React.useCallback(\n (resizeItem: (item: VirtualItem, size: number) => void, virtualRow: VirtualItem) =>\n (rowHeight: number, expansionHeight?: number) => {\n // register the expansion height so that it can be used to determine an average\n if (expansionHeight) {\n setExpandedRowHeightsCache(cache => ({ ...cache, [virtualRow.index]: expansionHeight }));\n }\n\n // update the whole row's size to include the expanded height\n resizeItem(virtualRow, rowHeight + (expansionHeight ?? 0));\n },\n []\n );\n\n return { estimateSize, createRowMeasurer };\n}\n\n// support virtualised row groups (where the row group headers are sticky)\nfunction useRowGroupVirtualisation<TType = unknown>(table: ReactTable<TType>) {\n const rows = table.getRowModel().rows;\n const isTableGrouped = !!table.getState().grouping.length;\n\n const rowGroupIndexes = React.useMemo(() => {\n const indexes: number[] = [];\n\n if (isTableGrouped) {\n rows.forEach((row, index) => {\n if (row.getIsGrouped()) {\n indexes.push(index);\n }\n });\n }\n\n return indexes;\n }, []);\n\n // this is taken from the react-virtual docs/examples\n const rangeExtractor = React.useCallback(\n range => {\n const activeRowGroupIndex =\n [...rowGroupIndexes].reverse().find(index => range.startIndex >= index) ?? rowGroupIndexes[0];\n\n const next = new Set([activeRowGroupIndex, ...defaultRangeExtractor(range)]);\n return [...next].sort((a, b) => a - b);\n },\n [rowGroupIndexes]\n );\n\n return isTableGrouped ? rangeExtractor : undefined;\n}\n"],"names":["TABLE_SCROLL_PADDING_BOTTOM","TABLE_PADDING_BOTTOM","useTableRenderer","table","tableRef","defaultRowActiveIndex","tableMeta","options","meta","rows","getRowModel","HEADER_OFFSET_TOTAL","HEADER_ROW_HEIGHT_ESTIMATE","getHeaderGroups","length","createRowMeasurer","estimateSize","useRowHeightVirtualisation","rangeExtractor","useRowGroupVirtualisation","virtualiser","useVirtualizer","count","getScrollElement","current","overscan","printing","isPrinting","undefined","scrollPaddingStart","_table$getState$group","getState","grouping","scrollPaddingEnd","paddingEnd","virtualItems","getVirtualItems","scrollToIndex","React","useCallback","index","align","behavior","notSmooth","scrollToOffset","setTimeout","paddingTop","paddingBottom","Math","max","_virtualItems$","start","scrollMargin","size","getTotalSize","end","useEffect","style","content","height","map","virtualRow","row","measureRow","resizeItem","Row","key","id","expandedState","expanded","expandedRowHeightsCache","setExpandedRowHeightsCache","useState","averageExpandedRowHeight","useMemo","values","Object","reduce","a","b","rowHeight","ROW_HEIGHT_ESTIMATES","medium","_rows$index","_rows$index$getIsExpa","getIsExpanded","call","expansionHeight","cache","isTableGrouped","rowGroupIndexes","indexes","forEach","getIsGrouped","push","range","activeRowGroupIndex","_reverse$find","reverse","find","startIndex","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25
  return /*#__PURE__*/React__default.createElement(Root, Object.assign({}, otherProps, {
26
- className: cn('overflow-hidden', props.className)
26
+ className: cn('overflow-hidden', props.className),
27
+ "data-taco": "scrollarea"
27
28
  }), /*#__PURE__*/React__default.createElement(Viewport, {
28
29
  className: "h-full w-full"
29
30
  }, children), /*#__PURE__*/React__default.createElement(Bar, {
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollArea.js","sources":["../../../../../../../src/components/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';\n\nconst Bar = props => {\n const className = cn(`flex select-none touch-none transition-colors hover:bg-grey`, {\n 'w-[7px] hover:w-[14px] mr-[2px] hover:px-[2px] hover:mr-0': props.orientation === 'vertical',\n 'flex-col h-[7px] hover:h-[14px] mb-[2px] hover:py-[2px] hover:mb-0': props.orientation === 'horizontal',\n });\n return <ScrollAreaPrimitive.Scrollbar {...props} className={className} />;\n};\n\nconst Thumb = props => <ScrollAreaPrimitive.Thumb {...props} className=\"flex-[1] rounded bg-black opacity-50\" />;\n\nconst Corner = props => <ScrollAreaPrimitive.Corner {...props} classname=\"bg-grey-500\" />;\n\nexport type ScrollbarProps = Omit<ScrollAreaPrimitive.ScrollAreaProps, 'scrollHideDelay'>;\n\nexport const ScrollArea = (props: ScrollbarProps) => {\n const { children, ...otherProps } = props;\n\n return (\n <ScrollAreaPrimitive.Root {...otherProps} className={cn('overflow-hidden', props.className)}>\n <ScrollAreaPrimitive.Viewport className=\"h-full w-full\">{children}</ScrollAreaPrimitive.Viewport>\n <Bar orientation=\"vertical\">\n <Thumb />\n </Bar>\n <Bar orientation=\"horizontal\">\n <Thumb />\n </Bar>\n <Corner />\n </ScrollAreaPrimitive.Root>\n );\n};\n"],"names":["Bar","props","className","cn","orientation","React","ScrollAreaPrimitive","Thumb","Corner","classname","ScrollArea","children","otherProps"],"mappings":";;;;AAIA,MAAMA,GAAG,GAAGC,KAAK;EACb,MAAMC,SAAS,GAAGC,EAAE,8DAA8D,EAAE;IAChF,2DAA2D,EAAEF,KAAK,CAACG,WAAW,KAAK,UAAU;IAC7F,oEAAoE,EAAEH,KAAK,CAACG,WAAW,KAAK;GAC/F,CAAC;EACF,oBAAOC,6BAACC,SAA6B,oBAAKL,KAAK;IAAEC,SAAS,EAAEA;KAAa;AAC7E,CAAC;AAED,MAAMK,KAAK,GAAGN,KAAK,iBAAII,6BAACC,OAAyB,oBAAKL,KAAK;EAAEC,SAAS,EAAC;GAAyC;AAEhH,MAAMM,MAAM,GAAGP,KAAK,iBAAII,6BAACC,QAA0B,oBAAKL,KAAK;EAAEQ,SAAS,EAAC;GAAgB;MAI5EC,UAAU,GAAIT,KAAqB;EAC5C,MAAM;IAAEU,QAAQ;IAAE,GAAGC;GAAY,GAAGX,KAAK;EAEzC,oBACII,6BAACC,IAAwB,oBAAKM,UAAU;IAAEV,SAAS,EAAEC,EAAE,CAAC,iBAAiB,EAAEF,KAAK,CAACC,SAAS;mBACtFG,6BAACC,QAA4B;IAACJ,SAAS,EAAC;KAAiBS,QAAQ,CAAgC,eACjGN,6BAACL,GAAG;IAACI,WAAW,EAAC;kBACbC,6BAACE,KAAK,OAAG,CACP,eACNF,6BAACL,GAAG;IAACI,WAAW,EAAC;kBACbC,6BAACE,KAAK,OAAG,CACP,eACNF,6BAACG,MAAM,OAAG,CACa;AAEnC;;;;"}
1
+ {"version":3,"file":"ScrollArea.js","sources":["../../../../../../../src/components/ScrollArea/ScrollArea.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';\n\nconst Bar = props => {\n const className = cn(`flex select-none touch-none transition-colors hover:bg-grey`, {\n 'w-[7px] hover:w-[14px] mr-[2px] hover:px-[2px] hover:mr-0': props.orientation === 'vertical',\n 'flex-col h-[7px] hover:h-[14px] mb-[2px] hover:py-[2px] hover:mb-0': props.orientation === 'horizontal',\n });\n return <ScrollAreaPrimitive.Scrollbar {...props} className={className} />;\n};\n\nconst Thumb = props => <ScrollAreaPrimitive.Thumb {...props} className=\"flex-[1] rounded bg-black opacity-50\" />;\n\nconst Corner = props => <ScrollAreaPrimitive.Corner {...props} classname=\"bg-grey-500\" />;\n\nexport type ScrollbarProps = Omit<ScrollAreaPrimitive.ScrollAreaProps, 'scrollHideDelay'>;\n\nexport const ScrollArea = (props: ScrollbarProps) => {\n const { children, ...otherProps } = props;\n\n return (\n <ScrollAreaPrimitive.Root {...otherProps} className={cn('overflow-hidden', props.className)} data-taco=\"scrollarea\">\n <ScrollAreaPrimitive.Viewport className=\"h-full w-full\">{children}</ScrollAreaPrimitive.Viewport>\n <Bar orientation=\"vertical\">\n <Thumb />\n </Bar>\n <Bar orientation=\"horizontal\">\n <Thumb />\n </Bar>\n <Corner />\n </ScrollAreaPrimitive.Root>\n );\n};\n"],"names":["Bar","props","className","cn","orientation","React","ScrollAreaPrimitive","Thumb","Corner","classname","ScrollArea","children","otherProps"],"mappings":";;;;AAIA,MAAMA,GAAG,GAAGC,KAAK;EACb,MAAMC,SAAS,GAAGC,EAAE,8DAA8D,EAAE;IAChF,2DAA2D,EAAEF,KAAK,CAACG,WAAW,KAAK,UAAU;IAC7F,oEAAoE,EAAEH,KAAK,CAACG,WAAW,KAAK;GAC/F,CAAC;EACF,oBAAOC,6BAACC,SAA6B,oBAAKL,KAAK;IAAEC,SAAS,EAAEA;KAAa;AAC7E,CAAC;AAED,MAAMK,KAAK,GAAGN,KAAK,iBAAII,6BAACC,OAAyB,oBAAKL,KAAK;EAAEC,SAAS,EAAC;GAAyC;AAEhH,MAAMM,MAAM,GAAGP,KAAK,iBAAII,6BAACC,QAA0B,oBAAKL,KAAK;EAAEQ,SAAS,EAAC;GAAgB;MAI5EC,UAAU,GAAIT,KAAqB;EAC5C,MAAM;IAAEU,QAAQ;IAAE,GAAGC;GAAY,GAAGX,KAAK;EAEzC,oBACII,6BAACC,IAAwB,oBAAKM,UAAU;IAAEV,SAAS,EAAEC,EAAE,CAAC,iBAAiB,EAAEF,KAAK,CAACC,SAAS,CAAC;iBAAY;mBACnGG,6BAACC,QAA4B;IAACJ,SAAS,EAAC;KAAiBS,QAAQ,CAAgC,eACjGN,6BAACL,GAAG;IAACI,WAAW,EAAC;kBACbC,6BAACE,KAAK,OAAG,CACP,eACNF,6BAACL,GAAG;IAACI,WAAW,EAAC;kBACbC,6BAACE,KAAK,OAAG,CACP,eACNF,6BAACG,MAAM,OAAG,CACa;AAEnC;;;;"}
@@ -1,11 +1,13 @@
1
1
  import React__default from 'react';
2
2
  import cn from 'clsx';
3
3
  import { useMergedRef } from '../../hooks/useMergedRef.js';
4
+ import { getNextFocussableElement } from '../../utils/dom.js';
4
5
  import { useLocalization } from '../Provider/Localization.js';
5
6
  import { Root, Trigger, Portal, Content } from '@radix-ui/react-popover';
6
7
  import { useBoundingClientRectListener } from '../../hooks/useBoundingClientRectListener.js';
7
8
  import { createCustomKeyboardEvent } from '../../utils/input.js';
8
9
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
10
+ import { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused.js';
9
11
  import { isAriaDirectionKey } from '../../utils/aria.js';
10
12
  import { Root as Root$1, createListboxValueSetter } from '../../primitives/Listbox2/components/Root.js';
11
13
  import '../../primitives/Listbox2/components/Option.js';
@@ -16,7 +18,6 @@ import { Select2Context } from './components/Context.js';
16
18
  import { Option } from './components/Option.js';
17
19
  import { Group } from './components/Group.js';
18
20
  import { Title } from './components/Title.js';
19
- import { getNextFocussableElement } from '../../utils/dom.js';
20
21
  import { Trigger as Trigger$1 } from './components/Trigger.js';
21
22
  import { useIsFormControl } from '../../hooks/useIsFormControl.js';
22
23
  import { BubbleSelect } from '../../primitives/BubbleSelect.js';
@@ -24,7 +25,6 @@ import { Search } from './components/Search.js';
24
25
  import { useChildren } from './hooks/useChildren.js';
25
26
  import { Create } from './components/Create.js';
26
27
  import { Collection } from './components/Collection.js';
27
- import { useIsHoverStatePaused } from '../../hooks/useIsHoverStatePaused.js';
28
28
 
29
29
  const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, ref) {
30
30
  const {
@@ -2,11 +2,11 @@ import React__default from 'react';
2
2
  import cn from 'clsx';
3
3
  import { AVAILABLE_COLORS } from '../../../utils/tailwind.js';
4
4
  import { useLocalization } from '../../Provider/Localization.js';
5
+ import { _catch } from '../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
5
6
  import { isAriaSelectionKey } from '../../../utils/aria.js';
6
7
  import { Tag } from '../../Tag/Tag.js';
7
8
  import { createOptionClassName } from '../utilities.js';
8
9
  import { useSelect2Context } from './Context.js';
9
- import { _catch } from '../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
10
10
 
11
11
  const getNextColor = options => {
12
12
  let occurrences = {};
@@ -9,8 +9,8 @@ import { Popover } from '../../Popover/Popover.js';
9
9
  import { Group } from '../../Group/Group.js';
10
10
  import { Field } from '../../Field/Field.js';
11
11
  import { Root, Item, Indicator } from '@radix-ui/react-radio-group';
12
- import { useSelect2Context } from './Context.js';
13
12
  import { _catch } from '../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
13
+ import { useSelect2Context } from './Context.js';
14
14
 
15
15
  const EditPopover = props => {
16
16
  const {
@@ -2,6 +2,7 @@ import React__default from 'react';
2
2
  import cn from 'clsx';
3
3
  import { Icon } from '../../Icon/Icon.js';
4
4
  import { IconButton } from '../../IconButton/IconButton.js';
5
+ import { FontSizes } from '../../../types.js';
5
6
  import { isAriaSelectionKey } from '../../../utils/aria.js';
6
7
  import '../../../primitives/Listbox2/components/Root.js';
7
8
  import { Option as Option$1 } from '../../../primitives/Listbox2/components/Option.js';
@@ -12,7 +13,6 @@ import { createOptionClassName } from '../utilities.js';
12
13
  import { useSelect2Context } from './Context.js';
13
14
  import { EditPopover } from './Edit.js';
14
15
  import { isMobileDevice } from '../../../utils/device.js';
15
- import { FontSizes } from '../../../types.js';
16
16
 
17
17
  const Option = /*#__PURE__*/React__default.forwardRef(function Select2Option(props, ref) {
18
18
  var _window;
@@ -3,12 +3,12 @@ import cn from 'clsx';
3
3
  import { Icon } from '../../Icon/Icon.js';
4
4
  import { Badge } from '../../Badge/Badge.js';
5
5
  import { useMergedRef } from '../../../hooks/useMergedRef.js';
6
+ import { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom.js';
6
7
  import { Tooltip } from '../../Tooltip/Tooltip.js';
7
8
  import { getInputClasses } from '../../Input/util.js';
8
9
  import { ScrollArea } from '../../ScrollArea/ScrollArea.js';
9
10
  import { Tag } from '../../Tag/Tag.js';
10
11
  import { useSelect2Context } from './Context.js';
11
- import { getIndexOfFirstChildOverflowingParent } from '../../../utils/dom.js';
12
12
 
13
13
  const Trigger = /*#__PURE__*/React__default.forwardRef(function Select2Trigger(props, ref) {
14
14
  const {
@@ -42,7 +42,7 @@ const Button = /*#__PURE__*/React__default.forwardRef(function Select2TriggerBut
42
42
  open,
43
43
  readOnly
44
44
  } = useSelect2Context();
45
- const className = cn('cursor-pointer !px-1.5', getInputClasses({
45
+ const className = cn('cursor-pointer !px-1 h-fit', getInputClasses({
46
46
  ...props,
47
47
  disabled,
48
48
  highlighted,
@@ -99,7 +99,7 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
99
99
  })
100
100
  }, placeholder);
101
101
  } else if (currentValue) {
102
- if (tags && emptyValue !== undefined && emptyValue !== value) {
102
+ if (tags && emptyValue !== value) {
103
103
  output = /*#__PURE__*/React__default.createElement(Tag, {
104
104
  className: "truncate",
105
105
  color: currentValue.props.color,
@@ -143,7 +143,7 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
143
143
  className
144
144
  } = buttonProps;
145
145
  if (open) {
146
- className = cn('!absolute z-20 !h-fit', buttonProps.className);
146
+ className = cn('!absolute z-20', buttonProps.className);
147
147
  content = /*#__PURE__*/React__default.createElement(ScrollArea, {
148
148
  className: "my-1 flex max-h-[5.5rem] flex-col"
149
149
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -176,9 +176,8 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
176
176
  });
177
177
  }
178
178
  return /*#__PURE__*/React__default.createElement("div", {
179
- className: cn('relative inline-flex flex-grow', {
180
- 'h-8': open
181
- }),
179
+ className: "relative inline-flex h-fit flex-grow",
180
+ "data-taco": "select2-container",
182
181
  style: {
183
182
  width: open ? (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.offsetWidth : undefined
184
183
  }