@gen3/frontend 0.11.1 → 0.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/dist/cjs/index.js +1068 -749
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/Buttons/ActionButton.js +1 -1
  4. package/dist/dts/components/Buttons/ActionButton.js.map +1 -1
  5. package/dist/dts/components/Buttons/DownloadButtons/JSONObjectDownloadButton.js +1 -1
  6. package/dist/dts/components/Buttons/DownloadButtons/JSONObjectDownloadButton.js.map +1 -1
  7. package/dist/dts/components/Buttons/DropdownButtons/DropdownButton.js +1 -1
  8. package/dist/dts/components/Buttons/DropdownButtons/DropdownButton.js.map +1 -1
  9. package/dist/dts/components/Buttons/UploadJSONButton.js +1 -1
  10. package/dist/dts/components/Buttons/UploadJSONButton.js.map +1 -1
  11. package/dist/dts/components/MessageCards/ErrorMessage.js +1 -1
  12. package/dist/dts/components/MessageCards/ErrorMessage.js.map +1 -1
  13. package/dist/dts/components/Providers/Gen3Provider.js +1 -1
  14. package/dist/dts/components/Providers/Gen3Provider.js.map +1 -1
  15. package/dist/dts/components/charts/Charts.js +1 -1
  16. package/dist/dts/components/charts/Charts.js.map +1 -1
  17. package/dist/dts/components/charts/echarts/HorizontalBarChart.d.ts +1 -1
  18. package/dist/dts/components/charts/echarts/HorizontalBarChart.d.ts.map +1 -1
  19. package/dist/dts/components/charts/echarts/HorizontalBarChart.js +8 -4
  20. package/dist/dts/components/charts/echarts/HorizontalBarChart.js.map +1 -1
  21. package/dist/dts/components/counts/CountsValue.d.ts.map +1 -1
  22. package/dist/dts/components/counts/CountsValue.js +2 -2
  23. package/dist/dts/components/counts/CountsValue.js.map +1 -1
  24. package/dist/dts/components/facets/FacetControlsHeader.js +1 -1
  25. package/dist/dts/components/facets/FacetControlsHeader.js.map +1 -1
  26. package/dist/dts/components/facets/FacetEnumList.js +1 -1
  27. package/dist/dts/components/facets/FacetEnumList.js.map +1 -1
  28. package/dist/dts/components/facets/FacetSelectionModal.d.ts +1 -2
  29. package/dist/dts/components/facets/FacetSelectionModal.d.ts.map +1 -1
  30. package/dist/dts/components/facets/FacetSelectionModal.js.map +1 -1
  31. package/dist/dts/components/facets/FacetSelector.d.ts +1 -2
  32. package/dist/dts/components/facets/FacetSelector.d.ts.map +1 -1
  33. package/dist/dts/components/facets/FacetSelector.js +1 -1
  34. package/dist/dts/components/facets/FacetSelector.js.map +1 -1
  35. package/dist/dts/components/facets/FacetTabs.d.ts +1 -2
  36. package/dist/dts/components/facets/FacetTabs.d.ts.map +1 -1
  37. package/dist/dts/components/facets/FacetTabs.js +1 -1
  38. package/dist/dts/components/facets/FacetTabs.js.map +1 -1
  39. package/dist/dts/components/facets/FiltersPanel.d.ts +9 -0
  40. package/dist/dts/components/facets/FiltersPanel.d.ts.map +1 -0
  41. package/dist/dts/{features/CohortBuilder → components/facets}/FiltersPanel.js +3 -2
  42. package/dist/dts/components/facets/FiltersPanel.js.map +1 -0
  43. package/dist/dts/components/facets/Panels/AccordianPanel.d.ts.map +1 -0
  44. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/AccordianPanel.js +2 -2
  45. package/dist/dts/components/facets/Panels/AccordianPanel.js.map +1 -0
  46. package/dist/dts/components/facets/Panels/DropdownPanel.d.ts.map +1 -0
  47. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/DropdownPanel.js +4 -4
  48. package/dist/dts/components/facets/Panels/DropdownPanel.js.map +1 -0
  49. package/dist/dts/components/facets/Panels/TabbedPanel.d.ts +4 -0
  50. package/dist/dts/components/facets/Panels/TabbedPanel.d.ts.map +1 -0
  51. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/TabbedPanel.js +3 -2
  52. package/dist/dts/components/facets/Panels/TabbedPanel.js.map +1 -0
  53. package/dist/dts/components/facets/Panels/index.d.ts +5 -0
  54. package/dist/dts/components/facets/Panels/index.d.ts.map +1 -0
  55. package/dist/dts/components/facets/Panels/index.js +5 -0
  56. package/dist/dts/components/facets/Panels/index.js.map +1 -0
  57. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/types.d.ts +4 -3
  58. package/dist/dts/components/facets/Panels/types.d.ts.map +1 -0
  59. package/dist/dts/components/facets/Panels/types.js.map +1 -0
  60. package/dist/dts/components/facets/createFacetCard.d.ts +1 -2
  61. package/dist/dts/components/facets/createFacetCard.d.ts.map +1 -1
  62. package/dist/dts/components/facets/createFacetCard.js.map +1 -1
  63. package/dist/dts/components/facets/createFacetCards.d.ts +1 -2
  64. package/dist/dts/components/facets/createFacetCards.d.ts.map +1 -1
  65. package/dist/dts/components/facets/createFacetCards.js.map +1 -1
  66. package/dist/dts/components/facets/index.d.ts +6 -1
  67. package/dist/dts/components/facets/index.d.ts.map +1 -1
  68. package/dist/dts/components/facets/index.js +6 -1
  69. package/dist/dts/components/facets/index.js.map +1 -1
  70. package/dist/dts/components/facets/types.d.ts +13 -2
  71. package/dist/dts/components/facets/types.d.ts.map +1 -1
  72. package/dist/dts/components/facets/utils.d.ts +2 -2
  73. package/dist/dts/components/facets/utils.d.ts.map +1 -1
  74. package/dist/dts/components/facets/utils.js +1 -1
  75. package/dist/dts/components/facets/utils.js.map +1 -1
  76. package/dist/dts/features/Analysis/AnalysisCard.js +1 -1
  77. package/dist/dts/features/Analysis/AnalysisCard.js.map +1 -1
  78. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +16 -16
  79. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts.map +1 -1
  80. package/dist/dts/features/CohortBuilder/CohortManager/modals/SaveOrCreateEntityModal.js +1 -1
  81. package/dist/dts/features/CohortBuilder/CohortManager/modals/SaveOrCreateEntityModal.js.map +1 -1
  82. package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
  83. package/dist/dts/features/CohortBuilder/CohortPanel.js +1 -1
  84. package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
  85. package/dist/dts/features/CohortBuilder/CohortSelector.js +1 -1
  86. package/dist/dts/features/CohortBuilder/CohortSelector.js.map +1 -1
  87. package/dist/dts/features/CohortBuilder/DownloadsPanel.js +1 -1
  88. package/dist/dts/features/CohortBuilder/DownloadsPanel.js.map +1 -1
  89. package/dist/dts/features/CohortBuilder/ExplorerTable/ArrayCellRenderer.d.ts +1 -1
  90. package/dist/dts/features/CohortBuilder/ExplorerTable/SubTables/ExpandingSubtable.js +1 -1
  91. package/dist/dts/features/CohortBuilder/ExplorerTable/SubTables/ExpandingSubtable.js.map +1 -1
  92. package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionSection.js +1 -1
  93. package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionSection.js.map +1 -1
  94. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.d.ts.map +1 -1
  95. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js +32 -41
  96. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js.map +1 -1
  97. package/dist/dts/features/CohortBuilder/types.d.ts +2 -2
  98. package/dist/dts/features/CohortBuilder/types.d.ts.map +1 -1
  99. package/dist/dts/features/CohortBuilder/types.js.map +1 -1
  100. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts +2 -1
  101. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts.map +1 -1
  102. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.js.map +1 -1
  103. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js +1 -1
  104. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js.map +1 -1
  105. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts +16 -16
  106. package/dist/dts/features/CohortDiscovery/FacetDefinitionsSlice.d.ts +1 -1
  107. package/dist/dts/features/CohortDiscovery/FacetDefinitionsSlice.d.ts.map +1 -1
  108. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts +1 -2
  109. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts.map +1 -1
  110. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.js.map +1 -1
  111. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts +2 -2
  112. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts.map +1 -1
  113. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.js.map +1 -1
  114. package/dist/dts/features/CohortDiscovery/RequestManagerSlice.d.ts +7 -7
  115. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js +1 -1
  116. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js.map +1 -1
  117. package/dist/dts/features/CohortDiscovery/appApi.d.ts +2 -2
  118. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js +1 -1
  119. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js.map +1 -1
  120. package/dist/dts/features/DataLibrary/SearchAndActions.js +1 -1
  121. package/dist/dts/features/DataLibrary/SearchAndActions.js.map +1 -1
  122. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js +1 -1
  123. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js.map +1 -1
  124. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js +1 -1
  125. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js.map +1 -1
  126. package/dist/dts/features/Dictionary/CategoryHeader.js +1 -1
  127. package/dist/dts/features/Dictionary/CategoryHeader.js.map +1 -1
  128. package/dist/dts/features/Discovery/types.d.ts +1 -0
  129. package/dist/dts/features/Discovery/types.d.ts.map +1 -1
  130. package/dist/dts/features/Discovery/types.js.map +1 -1
  131. package/dist/dts/features/Navigation/NavigationBarButton.d.ts.map +1 -1
  132. package/dist/dts/features/Navigation/NavigationBarButton.js +3 -3
  133. package/dist/dts/features/Navigation/NavigationBarButton.js.map +1 -1
  134. package/dist/dts/features/Navigation/TopBar/AccountButton.d.ts.map +1 -1
  135. package/dist/dts/features/Navigation/TopBar/AccountButton.js.map +1 -1
  136. package/dist/dts/features/Navigation/TopBar/IconButton.js +1 -1
  137. package/dist/dts/features/Navigation/TopBar/IconButton.js.map +1 -1
  138. package/dist/dts/features/Workspace/NotebookCard.js +1 -1
  139. package/dist/dts/features/Workspace/NotebookCard.js.map +1 -1
  140. package/dist/dts/index.d.ts +3 -1
  141. package/dist/dts/index.d.ts.map +1 -1
  142. package/dist/dts/index.js +3 -1
  143. package/dist/dts/index.js.map +1 -1
  144. package/dist/dts/pages/TabbedCohortBuilder/TabbedCohortBuilderPage.d.ts.map +1 -1
  145. package/dist/dts/pages/TabbedCohortBuilder/TabbedCohortBuilderPage.js +4 -2
  146. package/dist/dts/pages/TabbedCohortBuilder/TabbedCohortBuilderPage.js.map +1 -1
  147. package/dist/dts/utils/strings.d.ts +1 -0
  148. package/dist/dts/utils/strings.d.ts.map +1 -1
  149. package/dist/dts/utils/strings.js +29 -0
  150. package/dist/dts/utils/strings.js.map +1 -1
  151. package/dist/esm/index.js +1068 -756
  152. package/dist/esm/index.js.map +1 -1
  153. package/dist/index.d.ts +136 -5
  154. package/dist/tsconfig.tsbuildinfo +1 -1
  155. package/package.json +5 -5
  156. package/dist/dts/api/staticNotebook/index.d.ts +0 -4
  157. package/dist/dts/api/staticNotebook/index.d.ts.map +0 -1
  158. package/dist/dts/api/staticNotebook/index.js +0 -118
  159. package/dist/dts/api/staticNotebook/index.js.map +0 -1
  160. package/dist/dts/api/staticNotebooks/index.d.ts +0 -4
  161. package/dist/dts/api/staticNotebooks/index.d.ts.map +0 -1
  162. package/dist/dts/api/staticNotebooks/index.js +0 -118
  163. package/dist/dts/api/staticNotebooks/index.js.map +0 -1
  164. package/dist/dts/features/CohortBuilder/FiltersPanel.d.ts +0 -10
  165. package/dist/dts/features/CohortBuilder/FiltersPanel.d.ts.map +0 -1
  166. package/dist/dts/features/CohortBuilder/FiltersPanel.js.map +0 -1
  167. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.d.ts.map +0 -1
  168. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.js.map +0 -1
  169. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.d.ts.map +0 -1
  170. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.js.map +0 -1
  171. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.d.ts +0 -3
  172. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.d.ts.map +0 -1
  173. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.js.map +0 -1
  174. package/dist/dts/features/CohortBuilder/Panels/types.d.ts.map +0 -1
  175. package/dist/dts/features/CohortBuilder/Panels/types.js.map +0 -1
  176. package/dist/dts/features/CohortDiscovery/CohortManager.d.ts +0 -6
  177. package/dist/dts/features/CohortDiscovery/CohortManager.d.ts.map +0 -1
  178. package/dist/dts/features/CohortDiscovery/CohortManager.js +0 -55
  179. package/dist/dts/features/CohortDiscovery/CohortManager.js.map +0 -1
  180. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.d.ts +0 -135
  181. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.d.ts.map +0 -1
  182. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.js +0 -40
  183. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.js.map +0 -1
  184. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.d.ts +0 -3
  185. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.d.ts.map +0 -1
  186. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.js +0 -9
  187. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.js.map +0 -1
  188. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.d.ts +0 -7
  189. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.d.ts.map +0 -1
  190. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.js +0 -101
  191. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.js.map +0 -1
  192. package/dist/dts/features/CohortDiscovery/appApiRTKQ.d.ts +0 -1
  193. package/dist/dts/features/CohortDiscovery/appApiRTKQ.d.ts.map +0 -1
  194. package/dist/dts/features/CohortDiscovery/appApiRTKQ.js +0 -101
  195. package/dist/dts/features/CohortDiscovery/appApiRTKQ.js.map +0 -1
  196. package/dist/dts/features/Discovery/Charts/ChartsPanel.d.ts +0 -9
  197. package/dist/dts/features/Discovery/Charts/ChartsPanel.d.ts.map +0 -1
  198. package/dist/dts/features/Discovery/Charts/ChartsPanel.js +0 -24
  199. package/dist/dts/features/Discovery/Charts/ChartsPanel.js.map +0 -1
  200. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.d.ts +0 -9
  201. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.d.ts.map +0 -1
  202. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.js +0 -24
  203. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.js.map +0 -1
  204. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.d.ts +0 -9
  205. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.d.ts.map +0 -1
  206. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.js +0 -12
  207. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.js.map +0 -1
  208. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.d.ts +0 -19
  209. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.d.ts.map +0 -1
  210. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.js +0 -56
  211. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.js.map +0 -1
  212. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.d.ts +0 -14
  213. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.d.ts.map +0 -1
  214. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.js +0 -44
  215. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.js.map +0 -1
  216. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.d.ts +0 -3
  217. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.d.ts.map +0 -1
  218. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.js +0 -37
  219. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.js.map +0 -1
  220. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.d.ts +0 -10
  221. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.d.ts.map +0 -1
  222. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.js +0 -19
  223. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.js.map +0 -1
  224. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.d.ts +0 -8
  225. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.d.ts.map +0 -1
  226. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.js +0 -31
  227. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.js.map +0 -1
  228. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.d.ts +0 -9
  229. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.d.ts.map +0 -1
  230. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.js +0 -11
  231. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.js.map +0 -1
  232. package/dist/dts/features/Discovery/StudyDetails/StudyItems.d.ts +0 -5
  233. package/dist/dts/features/Discovery/StudyDetails/StudyItems.d.ts.map +0 -1
  234. package/dist/dts/features/Discovery/StudyDetails/StudyItems.js +0 -283
  235. package/dist/dts/features/Discovery/StudyDetails/StudyItems.js.map +0 -1
  236. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.d.ts +0 -10
  237. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.d.ts.map +0 -1
  238. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.js +0 -45
  239. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.js.map +0 -1
  240. package/dist/dts/features/Discovery/StudyPage/StudyPage.d.ts +0 -10
  241. package/dist/dts/features/Discovery/StudyPage/StudyPage.d.ts.map +0 -1
  242. package/dist/dts/features/Discovery/StudyPage/StudyPage.js +0 -11
  243. package/dist/dts/features/Discovery/StudyPage/StudyPage.js.map +0 -1
  244. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.d.ts +0 -9
  245. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.d.ts.map +0 -1
  246. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.js +0 -8
  247. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.js.map +0 -1
  248. package/dist/dts/features/StaticNotebook/StaticNotebook.d.ts +0 -4
  249. package/dist/dts/features/StaticNotebook/StaticNotebook.d.ts.map +0 -1
  250. package/dist/dts/features/StaticNotebook/StaticNotebook.js +0 -79
  251. package/dist/dts/features/StaticNotebook/StaticNotebook.js.map +0 -1
  252. package/dist/dts/lib/notebooks/index.d.ts +0 -3
  253. package/dist/dts/lib/notebooks/index.d.ts.map +0 -1
  254. package/dist/dts/lib/notebooks/index.js +0 -96
  255. package/dist/dts/lib/notebooks/index.js.map +0 -1
  256. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/AccordianPanel.d.ts +0 -0
  257. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/DropdownPanel.d.ts +0 -0
  258. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/types.js +0 -0
package/dist/cjs/index.js CHANGED
@@ -23,13 +23,15 @@ var reactCookie = require('react-cookie');
23
23
  var FileSaver = require('file-saver');
24
24
  var hooks = require('@mantine/hooks');
25
25
  var defaultComposer = require('default-composer');
26
- var react = require('@iconify/react');
26
+ var react = require('@iconify-icon/react');
27
27
  var echarts = require('echarts');
28
28
  var victory = require('victory');
29
- var fa = require('react-icons/fa');
30
29
  var tw = require('tailwind-styled-components');
30
+ var form = require('@mantine/form');
31
31
  var ri = require('react-icons/ri');
32
+ var fa = require('react-icons/fa');
32
33
  var pi = require('react-icons/pi');
34
+ var modals = require('@mantine/modals');
33
35
  var Image = require('next/image');
34
36
  var Link = require('next/link');
35
37
  var ai = require('react-icons/ai');
@@ -45,7 +47,6 @@ var uniq = require('lodash/uniq');
45
47
  var sum = require('lodash/sum');
46
48
  var lu = require('react-icons/lu');
47
49
  require('universal-cookie');
48
- var modals = require('@mantine/modals');
49
50
  var GraphiQL = require('graphiql');
50
51
  var router$1 = require('next/dist/client/router');
51
52
  var fs = require('fs');
@@ -56,7 +57,6 @@ var redux = require('redux');
56
57
  var toolkit = require('@reduxjs/toolkit');
57
58
  var idb = require('idb');
58
59
  var createWebStorage = require('redux-persist/lib/storage/createWebStorage');
59
- var form = require('@mantine/form');
60
60
  var dynamic = require('next/dynamic');
61
61
  var YAML = require('yaml');
62
62
  var filesize = require('filesize');
@@ -629,6 +629,27 @@ const toDisplayName = (field)=>{
629
629
  if (!fieldName) return 'NotSet';
630
630
  return fieldName.split('_').map((w)=>lodash.capitalize(w)).join(' ');
631
631
  };
632
+ /*
633
+ Function to convert counts to a string with units
634
+ For example: count = 100 units = 'cases' => '100 Cases'
635
+ Function should handle pluralization
636
+ */ const toCountsString = (counts, units)=>{
637
+ if (!counts) return `No ${lodash.capitalize(pluralize(units))}`;
638
+ // return a string with counts and units handling pluralization
639
+ const unitDisplay = counts === 1 ? units : pluralize(units);
640
+ return `${counts.toLocaleString()} ${lodash.capitalize(unitDisplay)}`;
641
+ };
642
+ // Helper function to handle basic pluralization
643
+ const pluralize = (word)=>{
644
+ // Handle special cases
645
+ if (word.endsWith('y')) {
646
+ return word.slice(0, -1) + 'ies';
647
+ } else if (word.endsWith('s') || word.endsWith('x') || word.endsWith('z') || word.endsWith('ch') || word.endsWith('sh')) {
648
+ return word + 'es';
649
+ } else {
650
+ return word + 's';
651
+ }
652
+ };
632
653
 
633
654
  const isArrayOfString = (value)=>{
634
655
  return Array.isArray(value) && value.every((element)=>typeof element === 'string');
@@ -2496,10 +2517,11 @@ const HorizontalBarChart = ({ data, valueType, total, showLegendInChart = true }
2496
2517
  const chartDefinition = React.useMemo(()=>{
2497
2518
  return {
2498
2519
  tooltip: {
2499
- trigger: 'axis',
2500
- axisPointer: {
2501
- // Use axis to trigger tooltip
2502
- type: 'shadow'
2520
+ trigger: 'item',
2521
+ formatter: function(param) {
2522
+ const p = lodash.isArray(param) && param.length > 0 ? param[0] : param;
2523
+ const colorSquare = `<span style="display:inline-block; width:10px; height:10px; background-color:${p.color}; margin-right:5px;"></span>`;
2524
+ return `${colorSquare}${p.seriesName}: <b>${p.value}</b>`;
2503
2525
  }
2504
2526
  },
2505
2527
  legend: {
@@ -3395,6 +3417,173 @@ const DEFAULT_MAXIMUM = 100;
3395
3417
  const BAD_DATA_MESSAGE = 'No data for this field';
3396
3418
  const DAYS_IN_YEAR = 365.25;
3397
3419
 
3420
+ const SegmentedControl = (props)=>{
3421
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.SegmentedControl, {
3422
+ classNames: {
3423
+ root: 'bg-base-max h-fit p-0',
3424
+ indicator: 'opacity-0',
3425
+ control: 'z-0 rounded-none border-0 [&:nth-child(2)>label]:rounded-l-md [&:last-child>label]:rounded-r-md [&:last-child>label]:border-r-1',
3426
+ label: `${props?.padding ? `p-${props.padding}` : 'p-0'} text-primary font-semibold data-active:text-base-max data-active:bg-primary data-disabled:bg-base-lightest data-disabled:text-base-lighter
3427
+ border-1 border-r-0 !border-primary rounded-none data-disabled:!border-base-lighter`
3428
+ },
3429
+ ...props
3430
+ });
3431
+ };
3432
+
3433
+ const ExpanderLabel = tw.div`
3434
+ text-accent-content-darker
3435
+ p-1
3436
+ font-bold
3437
+ cursor-pointer
3438
+ text-xs
3439
+ font-content
3440
+ `;
3441
+ /**
3442
+ * Component which manages the compact/expanded state of a FacetCard
3443
+ * @param remainingValues - number of remaining values when compact "show 4"
3444
+ * @param isGroupExpanded - true if expanded, false if compact
3445
+ * @param onShowChanged - callback to call when the expand/compact button is clicked
3446
+ */ const FacetExpander = ({ remainingValues, isGroupExpanded, onShowChanged })=>{
3447
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
3448
+ className: `mt-3 flex flex-row justify-end ${remainingValues > 0 && 'border-t-2'} p-1.5`,
3449
+ children: remainingValues > 0 && !isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3450
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3451
+ "data-testid": "plus-icon",
3452
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3453
+ className: "flex flex-row flex-nowrap items-center ",
3454
+ children: [
3455
+ /*#__PURE__*/ jsxRuntime.jsx(md.MdAddCircle, {
3456
+ className: "text-accent",
3457
+ size: "1rem",
3458
+ "aria-hidden": "true"
3459
+ }, "show-more"),
3460
+ /*#__PURE__*/ jsxRuntime.jsxs(ExpanderLabel, {
3461
+ children: [
3462
+ remainingValues,
3463
+ " more"
3464
+ ]
3465
+ })
3466
+ ]
3467
+ })
3468
+ }) : isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3469
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3470
+ "data-testid": "minus-icon",
3471
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3472
+ className: "flex flex-row flex-nowrap items-center",
3473
+ children: [
3474
+ /*#__PURE__*/ jsxRuntime.jsx(md.MdRemoveCircle, {
3475
+ className: "text-accent",
3476
+ size: "1rem",
3477
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3478
+ "aria-hidden": "true"
3479
+ }, "show-less"),
3480
+ /*#__PURE__*/ jsxRuntime.jsx(ExpanderLabel, {
3481
+ children: "show less"
3482
+ })
3483
+ ]
3484
+ })
3485
+ }) : null
3486
+ });
3487
+ };
3488
+
3489
+ const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
3490
+ if (sortTypeAndDirection.type === 'alpha') {
3491
+ return sortTypeAndDirection.direction === 'asc' ? `The ${field} names are now sorted alphabetically ascending` : `The ${field} names are now sorted alphabetically descending`;
3492
+ } else {
3493
+ return sortTypeAndDirection.direction === 'asc' ? `The ${field} ${valueLabel} are now sorted numerically ascending` : `The ${field} ${valueLabel} are now sorted numerically descending`;
3494
+ }
3495
+ };
3496
+ /**
3497
+ * FacetCards "sort" header supporting sort by A-Z or by Value both ascending and descending
3498
+ * @param sortType - current sort type
3499
+ * @param valueLabel - Value labels, typically "case" "file"
3500
+ * @param setSort - sets the sort type and direction
3501
+ * @param field - specifies the facet table name
3502
+ */ const FacetSortPanel = ({ sortType, valueLabel, setSort, field })=>{
3503
+ const liveRegionRef = React.useRef(null);
3504
+ const [sortingStatus, setSortingStatus] = React.useState('');
3505
+ React.useEffect(()=>{
3506
+ if (sortingStatus && liveRegionRef?.current) {
3507
+ liveRegionRef.current.textContent = sortingStatus;
3508
+ }
3509
+ }, [
3510
+ sortingStatus
3511
+ ]);
3512
+ const [NameSortIcon, nameIconSize] = sortType.type === 'alpha' ? sortType.direction === 'asc' ? [
3513
+ pi.PiCaretUpFill,
3514
+ '0.75rem'
3515
+ ] : [
3516
+ pi.PiCaretDownFill,
3517
+ '0.75rem'
3518
+ ] : [
3519
+ pi.PiCaretUpDownFill,
3520
+ '1rem'
3521
+ ];
3522
+ const [ValueSortIcon, valueIconSize] = sortType.type === 'value' ? sortType.direction === 'asc' ? [
3523
+ pi.PiCaretUpFill,
3524
+ '0.75rem'
3525
+ ] : [
3526
+ pi.PiCaretDownFill,
3527
+ '0.75rem'
3528
+ ] : [
3529
+ pi.PiCaretUpDownFill,
3530
+ '1rem'
3531
+ ];
3532
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
3533
+ className: "flex flex-row items-center justify-between flex-wrap py-1 px-2 mb-1 border-b-2",
3534
+ children: [
3535
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3536
+ className: "pl-0 ml-0 api-hovered:accent",
3537
+ variant: "transparent",
3538
+ size: "compact-xs",
3539
+ color: "base-contrast.5",
3540
+ onClick: ()=>{
3541
+ const direction = sortType.type === 'alpha' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3542
+ const sortObj = {
3543
+ type: 'alpha',
3544
+ direction
3545
+ };
3546
+ setSort(sortObj);
3547
+ setSortingStatus(sortTypeToAriaDescription(sortObj, 'Name', field));
3548
+ },
3549
+ rightSection: /*#__PURE__*/ jsxRuntime.jsx(NameSortIcon, {
3550
+ size: nameIconSize,
3551
+ "aria-hidden": "true"
3552
+ }),
3553
+ "aria-label": "Sort name alphabetically",
3554
+ children: "Name"
3555
+ }),
3556
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3557
+ className: "pr-0 mr-0",
3558
+ variant: "transparent",
3559
+ size: "compact-xs",
3560
+ color: "base-contrast.5",
3561
+ onClick: ()=>{
3562
+ const direction = sortType.type === 'value' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3563
+ const sortObj = {
3564
+ type: 'value',
3565
+ direction
3566
+ };
3567
+ setSort(sortObj);
3568
+ setSortingStatus(sortTypeToAriaDescription(sortObj, valueLabel, field));
3569
+ },
3570
+ rightSection: /*#__PURE__*/ jsxRuntime.jsx(ValueSortIcon, {
3571
+ size: valueIconSize,
3572
+ "aria-hidden": "true"
3573
+ }),
3574
+ "aria-label": `Sort ${valueLabel} numerically`,
3575
+ children: valueLabel
3576
+ }),
3577
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
3578
+ id: `${field}-liveRegion`,
3579
+ "aria-live": "polite",
3580
+ ref: liveRegionRef,
3581
+ className: "sr-only"
3582
+ })
3583
+ ]
3584
+ });
3585
+ };
3586
+
3398
3587
  const FacetIconButton = tw.button`
3399
3588
  text-base-max
3400
3589
  font-bold
@@ -3601,217 +3790,63 @@ flex items-start justify-between items-center flex-nowrap bg-secondary px-1.5 ro
3601
3790
  });
3602
3791
  };
3603
3792
 
3604
- const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
3605
- if (sortTypeAndDirection.type === 'alpha') {
3606
- return sortTypeAndDirection.direction === 'asc' ? `The ${field} names are now sorted alphabetically ascending` : `The ${field} names are now sorted alphabetically descending`;
3607
- } else {
3608
- return sortTypeAndDirection.direction === 'asc' ? `The ${field} ${valueLabel} are now sorted numerically ascending` : `The ${field} ${valueLabel} are now sorted numerically descending`;
3609
- }
3793
+ const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
3794
+ const [showTooltip, setShowTooltip] = React.useState(false);
3795
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
3796
+ label: label,
3797
+ disabled: !showTooltip,
3798
+ position: "top-start",
3799
+ offset: 5,
3800
+ multiline: true,
3801
+ withArrow: true,
3802
+ arrowOffset: 20,
3803
+ classNames: {
3804
+ tooltip: 'bg-base-min bg-opacity-90 text-base-contrast-min shadow-lg font-content font-medium text-xs',
3805
+ arrow: 'bg-base-min bg-opacity-90'
3806
+ },
3807
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
3808
+ className: `${className} truncate ... `,
3809
+ ref: (el)=>{
3810
+ if (el) {
3811
+ if (el.clientWidth < el.scrollWidth) {
3812
+ setShowTooltip(true);
3813
+ } else {
3814
+ setShowTooltip(false);
3815
+ }
3816
+ }
3817
+ },
3818
+ children: children
3819
+ })
3820
+ });
3610
3821
  };
3611
- /**
3612
- * FacetCards "sort" header supporting sort by A-Z or by Value both ascending and descending
3613
- * @param sortType - current sort type
3614
- * @param valueLabel - Value labels, typically "case" "file"
3615
- * @param setSort - sets the sort type and direction
3616
- * @param field - specifies the facet table name
3617
- */ const FacetSortPanel = ({ sortType, valueLabel, setSort, field })=>{
3618
- const liveRegionRef = React.useRef(null);
3619
- const [sortingStatus, setSortingStatus] = React.useState('');
3822
+
3823
+ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true, sort = 'value-dsc' })=>{
3824
+ const [isGroupExpanded, setIsGroupExpanded] = React.useState(false);
3825
+ const cardRef = React.useRef(null);
3826
+ const searchInputRef = React.useRef(null);
3827
+ const settingRef = React.useRef(null);
3828
+ const [searchTerm, setSearchTerm] = React.useState('');
3829
+ // const [combineMode, setCombineMode] = useState<'or' | 'and'>('or');
3830
+ const { data, enumFilters, combineMode, isSuccess, error } = hooks.useGetFacetData(field);
3831
+ const [selectedEnums, setSelectedEnums] = React.useState(enumFilters ?? []);
3832
+ const totalCount = hooks?.useTotalCounts ? hooks.useTotalCounts() : 1;
3833
+ const clearFilters = hooks.useClearFilter();
3834
+ const updateFacetFilters = hooks.useUpdateFacetFilters();
3835
+ const isFilterExpanded = hooks?.useFilterExpanded && hooks.useFilterExpanded(field);
3836
+ const showFilters = isFilterExpanded === undefined || isFilterExpanded;
3837
+ const [sortedData, setSortedData] = React.useState([]);
3838
+ const [sortType, setSortType] = React.useState(mapFacetSortToSortType(sort));
3839
+ const theme = core$1.useMantineTheme();
3840
+ const updateVisibleValues = hooks?.updateVisibleValues;
3620
3841
  React.useEffect(()=>{
3621
- if (sortingStatus && liveRegionRef?.current) {
3622
- liveRegionRef.current.textContent = sortingStatus;
3842
+ if (isSearching) {
3843
+ searchInputRef?.current?.focus();
3844
+ } else if (searchTerm.length > 0) {
3845
+ setSearchTerm('');
3623
3846
  }
3624
3847
  }, [
3625
- sortingStatus
3626
- ]);
3627
- const [NameSortIcon, nameIconSize] = sortType.type === 'alpha' ? sortType.direction === 'asc' ? [
3628
- pi.PiCaretUpFill,
3629
- '0.75rem'
3630
- ] : [
3631
- pi.PiCaretDownFill,
3632
- '0.75rem'
3633
- ] : [
3634
- pi.PiCaretUpDownFill,
3635
- '1rem'
3636
- ];
3637
- const [ValueSortIcon, valueIconSize] = sortType.type === 'value' ? sortType.direction === 'asc' ? [
3638
- pi.PiCaretUpFill,
3639
- '0.75rem'
3640
- ] : [
3641
- pi.PiCaretDownFill,
3642
- '0.75rem'
3643
- ] : [
3644
- pi.PiCaretUpDownFill,
3645
- '1rem'
3646
- ];
3647
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
3648
- className: "flex flex-row items-center justify-between flex-wrap py-1 px-2 mb-1 border-b-2",
3649
- children: [
3650
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3651
- className: "pl-0 ml-0 api-hovered:accent",
3652
- variant: "transparent",
3653
- size: "compact-xs",
3654
- color: "base-contrast.5",
3655
- onClick: ()=>{
3656
- const direction = sortType.type === 'alpha' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3657
- const sortObj = {
3658
- type: 'alpha',
3659
- direction
3660
- };
3661
- setSort(sortObj);
3662
- setSortingStatus(sortTypeToAriaDescription(sortObj, 'Name', field));
3663
- },
3664
- rightSection: /*#__PURE__*/ jsxRuntime.jsx(NameSortIcon, {
3665
- size: nameIconSize,
3666
- "aria-hidden": "true"
3667
- }),
3668
- "aria-label": "Sort name alphabetically",
3669
- children: "Name"
3670
- }),
3671
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3672
- className: "pr-0 mr-0",
3673
- variant: "transparent",
3674
- size: "compact-xs",
3675
- color: "base-contrast.5",
3676
- onClick: ()=>{
3677
- const direction = sortType.type === 'value' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3678
- const sortObj = {
3679
- type: 'value',
3680
- direction
3681
- };
3682
- setSort(sortObj);
3683
- setSortingStatus(sortTypeToAriaDescription(sortObj, valueLabel, field));
3684
- },
3685
- rightSection: /*#__PURE__*/ jsxRuntime.jsx(ValueSortIcon, {
3686
- size: valueIconSize,
3687
- "aria-hidden": "true"
3688
- }),
3689
- "aria-label": `Sort ${valueLabel} numerically`,
3690
- children: valueLabel
3691
- }),
3692
- /*#__PURE__*/ jsxRuntime.jsx("span", {
3693
- id: `${field}-liveRegion`,
3694
- "aria-live": "polite",
3695
- ref: liveRegionRef,
3696
- className: "sr-only"
3697
- })
3698
- ]
3699
- });
3700
- };
3701
-
3702
- const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
3703
- const [showTooltip, setShowTooltip] = React.useState(false);
3704
- return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
3705
- label: label,
3706
- disabled: !showTooltip,
3707
- position: "top-start",
3708
- offset: 5,
3709
- multiline: true,
3710
- withArrow: true,
3711
- arrowOffset: 20,
3712
- classNames: {
3713
- tooltip: 'bg-base-min bg-opacity-90 text-base-contrast-min shadow-lg font-content font-medium text-xs',
3714
- arrow: 'bg-base-min bg-opacity-90'
3715
- },
3716
- children: /*#__PURE__*/ jsxRuntime.jsx("div", {
3717
- className: `${className} truncate ... `,
3718
- ref: (el)=>{
3719
- if (el) {
3720
- if (el.clientWidth < el.scrollWidth) {
3721
- setShowTooltip(true);
3722
- } else {
3723
- setShowTooltip(false);
3724
- }
3725
- }
3726
- },
3727
- children: children
3728
- })
3729
- });
3730
- };
3731
-
3732
- const ExpanderLabel = tw.div`
3733
- text-accent-content-darker
3734
- p-1
3735
- font-bold
3736
- cursor-pointer
3737
- text-xs
3738
- font-content
3739
- `;
3740
- /**
3741
- * Component which manages the compact/expanded state of a FacetCard
3742
- * @param remainingValues - number of remaining values when compact "show 4"
3743
- * @param isGroupExpanded - true if expanded, false if compact
3744
- * @param onShowChanged - callback to call when the expand/compact button is clicked
3745
- */ const FacetExpander = ({ remainingValues, isGroupExpanded, onShowChanged })=>{
3746
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
3747
- className: `mt-3 flex flex-row justify-end ${remainingValues > 0 && 'border-t-2'} p-1.5`,
3748
- children: remainingValues > 0 && !isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3749
- onClick: ()=>onShowChanged(!isGroupExpanded),
3750
- "data-testid": "plus-icon",
3751
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3752
- className: "flex flex-row flex-nowrap items-center ",
3753
- children: [
3754
- /*#__PURE__*/ jsxRuntime.jsx(md.MdAddCircle, {
3755
- className: "text-accent",
3756
- size: "1rem",
3757
- "aria-hidden": "true"
3758
- }, "show-more"),
3759
- /*#__PURE__*/ jsxRuntime.jsxs(ExpanderLabel, {
3760
- children: [
3761
- remainingValues,
3762
- " more"
3763
- ]
3764
- })
3765
- ]
3766
- })
3767
- }) : isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3768
- onClick: ()=>onShowChanged(!isGroupExpanded),
3769
- "data-testid": "minus-icon",
3770
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3771
- className: "flex flex-row flex-nowrap items-center",
3772
- children: [
3773
- /*#__PURE__*/ jsxRuntime.jsx(md.MdRemoveCircle, {
3774
- className: "text-accent",
3775
- size: "1rem",
3776
- onClick: ()=>onShowChanged(!isGroupExpanded),
3777
- "aria-hidden": "true"
3778
- }, "show-less"),
3779
- /*#__PURE__*/ jsxRuntime.jsx(ExpanderLabel, {
3780
- children: "show less"
3781
- })
3782
- ]
3783
- })
3784
- }) : null
3785
- });
3786
- };
3787
-
3788
- const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true, sort = 'value-dsc' })=>{
3789
- const [isGroupExpanded, setIsGroupExpanded] = React.useState(false);
3790
- const cardRef = React.useRef(null);
3791
- const searchInputRef = React.useRef(null);
3792
- const settingRef = React.useRef(null);
3793
- const [searchTerm, setSearchTerm] = React.useState('');
3794
- // const [combineMode, setCombineMode] = useState<'or' | 'and'>('or');
3795
- const { data, enumFilters, combineMode, isSuccess, error } = hooks.useGetFacetData(field);
3796
- const [selectedEnums, setSelectedEnums] = React.useState(enumFilters ?? []);
3797
- const totalCount = hooks?.useTotalCounts ? hooks.useTotalCounts() : 1;
3798
- const clearFilters = hooks.useClearFilter();
3799
- const updateFacetFilters = hooks.useUpdateFacetFilters();
3800
- const isFilterExpanded = hooks?.useFilterExpanded && hooks.useFilterExpanded(field);
3801
- const showFilters = isFilterExpanded === undefined || isFilterExpanded;
3802
- const [sortedData, setSortedData] = React.useState([]);
3803
- const [sortType, setSortType] = React.useState(mapFacetSortToSortType(sort));
3804
- const theme = core$1.useMantineTheme();
3805
- const updateVisibleValues = hooks?.updateVisibleValues;
3806
- React.useEffect(()=>{
3807
- if (isSearching) {
3808
- searchInputRef?.current?.focus();
3809
- } else if (searchTerm.length > 0) {
3810
- setSearchTerm('');
3811
- }
3812
- }, [
3813
- isSearching,
3814
- searchTerm
3848
+ isSearching,
3849
+ searchTerm
3815
3850
  ]);
3816
3851
  React.useEffect(()=>{
3817
3852
  if (isSettings) {
@@ -4201,194 +4236,54 @@ const EnumFacet = ({ field, hooks, valueLabel, description, facetName, showPerce
4201
4236
  });
4202
4237
  };
4203
4238
 
4204
- const instanceOfIncludesExcludes$1 = (op)=>[
4205
- 'in'
4206
- ].includes(op.operator); // TODO: Guppy does not support excludes
4207
- /**
4208
- * Extracts the operands if the operation isIncludes or Excludes. Returns an empty Array
4209
- * if filter is not the correct type.
4210
- * @param operation - filters to extract values from
4211
- */ const extractValues = (operation)=>{
4212
- if (operation && instanceOfIncludesExcludes$1(operation)) {
4213
- return operation.operands;
4214
- }
4215
- return [];
4216
- };
4217
- /**
4218
- * Exact value facet component
4219
- * @param field - field to facet on
4220
- * @param description - description of the facet
4221
- * @param facetName - name of the facet
4222
- * @param dismissCallback - callback function to dismiss the facet
4223
- * @param width - width of the facet
4224
- * @param hooks - hooks to use for the facet
4225
- * @param header - header components
4226
- * @category Facets
4227
- */ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks, header = {
4239
+ const createBucket = (field, lower, upper)=>({
4240
+ operator: 'and',
4241
+ operands: [
4242
+ {
4243
+ field,
4244
+ operator: '>=',
4245
+ operand: lower
4246
+ },
4247
+ {
4248
+ field,
4249
+ operator: '<=',
4250
+ operand: upper
4251
+ }
4252
+ ]
4253
+ });
4254
+ const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum = DEFAULT_MINIMUM, maximum = DEFAULT_MAXIMUM, showSearch = false, showFlip = false, showSettings = false, dismissCallback = undefined, width = undefined, header = {
4228
4255
  Panel: FacetHeader,
4229
4256
  Label: FacetText,
4230
4257
  iconStyle: controlsIconStyle
4231
4258
  } })=>{
4232
- const [textValue, setTextValue] = React.useState(''); // Handle the state of the TextInput
4233
- const clearFilters = hooks.useClearFilter();
4234
- const updateFacetFilters = hooks.useUpdateFacetFilters();
4235
- const facetTitle = facetName ? facetName : core.trimFirstFieldNameToTitle(field, true);
4236
- const facetValue = hooks.useGetFacetFilters(field);
4237
- const textValues = React.useMemo(()=>extractValues(facetValue), [
4238
- facetValue
4239
- ]);
4240
- const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4241
- const showFilters = isFilterExpanded === undefined || isFilterExpanded;
4242
- const setValues = (values)=>{
4243
- if (values.length > 0) {
4244
- if (facetValue && instanceOfIncludesExcludes$1(facetValue)) {
4245
- // updating facet value
4246
- updateFacetFilters(field, {
4247
- ...facetValue,
4248
- operands: values
4249
- });
4250
- }
4251
- if (facetValue === undefined) {
4252
- // TODO: Assuming Includes by default but this might change to Include|Excludes
4253
- updateFacetFilters(field, {
4254
- operator: 'in',
4255
- field: field,
4256
- operands: values
4257
- });
4258
- }
4259
- } else {
4260
- clearFilters(field);
4261
- }
4262
- };
4263
- const addValue = (s)=>{
4264
- if (s === '') return;
4265
- if (textValues.includes(s)) return;
4266
- setTextValue('');
4267
- setValues([
4268
- ...textValues,
4269
- s
4270
- ]);
4271
- };
4272
- const removeButton = (x)=>{
4273
- return /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4274
- size: "xs",
4275
- color: "white",
4276
- radius: "xl",
4277
- variant: "transparent",
4278
- onClick: ()=>setValues(textValues.filter((i)=>i !== x)),
4279
- children: /*#__PURE__*/ jsxRuntime.jsx(md.MdClose, {
4280
- size: 10,
4281
- "aria-label": "remove value from filter"
4282
- })
4283
- });
4284
- };
4285
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
4286
- className: `flex flex-col ${width ? width : 'mx-0'} bg-base-max relative border-base-lighter border-1 rounded-md text-xs transition`,
4287
- children: [
4288
- /*#__PURE__*/ jsxRuntime.jsx(FacetControlsHeader, {
4289
- field: field,
4290
- description: description,
4291
- hooks: hooks,
4292
- facetName: facetName,
4293
- dismissCallback: dismissCallback,
4294
- header: header
4295
- }),
4296
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
4297
- className: showFilters ? 'h-full' : 'h-0 invisible',
4298
- "aria-hidden": !showFilters,
4299
- children: [
4300
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
4301
- className: "flex flex-nowrap items-center p-2",
4302
- children: [
4303
- /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
4304
- "data-testid": "textbox-add-filter-value",
4305
- size: "sm",
4306
- placeholder: `Enter ${facetTitle}`,
4307
- classNames: {
4308
- root: 'grow',
4309
- input: 'border-r-0 rounded-r-none py-1'
4310
- },
4311
- "aria-label": "enter value to add filter",
4312
- value: textValue,
4313
- onChange: (event)=>setTextValue(event.currentTarget.value)
4314
- }),
4315
- /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4316
- size: "lg",
4317
- "aria-label": "add string value",
4318
- className: "bg-accent text-accent-contrast border-base-min border-1 rounded-l-none h-[30px]",
4319
- onClick: ()=>{
4320
- if (textValue.length > 0) addValue(textValue.trim());
4321
- },
4322
- children: /*#__PURE__*/ jsxRuntime.jsx(fa.FaPlus, {})
4323
- })
4324
- ]
4325
- }),
4326
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
4327
- gap: "xs",
4328
- className: "px-2 py-2 max-h-96 overflow-y-auto",
4329
- "data-testid": "values group",
4330
- children: textValues.map((x)=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Badge, {
4331
- size: "sm",
4332
- variant: "filled",
4333
- color: "accent",
4334
- rightSection: removeButton(x),
4335
- children: x
4336
- }, x))
4337
- })
4338
- ]
4339
- })
4340
- ]
4341
- });
4342
- };
4343
-
4344
- const createBucket = (field, lower, upper)=>({
4345
- operator: 'and',
4346
- operands: [
4347
- {
4348
- field,
4349
- operator: '>=',
4350
- operand: lower
4351
- },
4352
- {
4353
- field,
4354
- operator: '<=',
4355
- operand: upper
4356
- }
4357
- ]
4358
- });
4359
- const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum = DEFAULT_MINIMUM, maximum = DEFAULT_MAXIMUM, showSearch = false, showFlip = false, showSettings = false, dismissCallback = undefined, width = undefined, header = {
4360
- Panel: FacetHeader,
4361
- Label: FacetText,
4362
- iconStyle: controlsIconStyle
4363
- } })=>{
4364
- const { data, rangeFilters, isSuccess } = hooks.useGetFacetData(field);
4365
- const [minMaxValue, setMinMaxValue] = React.useState({
4366
- from: minimum,
4367
- to: maximum
4368
- });
4369
- const clearRangeFilterFromCohort = hooks.useClearFilter();
4370
- React.useCallback(()=>{
4371
- setMinMaxValue({
4372
- from: minimum,
4373
- to: maximum
4374
- });
4375
- clearRangeFilterFromCohort(field);
4376
- }, [
4377
- clearRangeFilterFromCohort,
4378
- field,
4379
- maximum,
4380
- minimum
4381
- ]);
4382
- const updateRangeFilter = hooks.useUpdateFacetFilters();
4383
- const updateFilters = React.useCallback((from, to)=>{
4384
- updateRangeFilter(field, createBucket(field, from, to));
4385
- setMinMaxValue({
4386
- from: from,
4387
- to: to
4388
- });
4389
- }, [
4390
- field,
4391
- updateRangeFilter
4259
+ const { data, rangeFilters, isSuccess } = hooks.useGetFacetData(field);
4260
+ const [minMaxValue, setMinMaxValue] = React.useState({
4261
+ from: minimum,
4262
+ to: maximum
4263
+ });
4264
+ const clearRangeFilterFromCohort = hooks.useClearFilter();
4265
+ React.useCallback(()=>{
4266
+ setMinMaxValue({
4267
+ from: minimum,
4268
+ to: maximum
4269
+ });
4270
+ clearRangeFilterFromCohort(field);
4271
+ }, [
4272
+ clearRangeFilterFromCohort,
4273
+ field,
4274
+ maximum,
4275
+ minimum
4276
+ ]);
4277
+ const updateRangeFilter = hooks.useUpdateFacetFilters();
4278
+ const updateFilters = React.useCallback((from, to)=>{
4279
+ updateRangeFilter(field, createBucket(field, from, to));
4280
+ setMinMaxValue({
4281
+ from: from,
4282
+ to: to
4283
+ });
4284
+ }, [
4285
+ field,
4286
+ updateRangeFilter
4392
4287
  ]);
4393
4288
  const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4394
4289
  const showFilters = isFilterExpanded === undefined || isFilterExpanded;
@@ -4469,7 +4364,7 @@ const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum
4469
4364
  });
4470
4365
  };
4471
4366
 
4472
- const instanceOfIncludesExcludes = (op)=>[
4367
+ const instanceOfIncludesExcludes$1 = (op)=>[
4473
4368
  'in'
4474
4369
  ].includes(op.operator); // TODO: Guppy does not support excludes
4475
4370
  const isOperandsObject = (obj)=>{
@@ -4518,7 +4413,7 @@ const isFacetEmpty = (op)=>{
4518
4413
  useDeepCompare.useDeepCompareEffect(()=>{
4519
4414
  if (!facetValue || isFacetEmpty(facetValue)) {
4520
4415
  setSelectedValues([]);
4521
- } else if (instanceOfIncludesExcludes(facetValue)) {
4416
+ } else if (instanceOfIncludesExcludes$1(facetValue)) {
4522
4417
  const filters = facetValue.operands.map((x)=>x.toString());
4523
4418
  setSelectedValues(filters);
4524
4419
  }
@@ -4578,6 +4473,554 @@ const isFacetEmpty = (op)=>{
4578
4473
  });
4579
4474
  };
4580
4475
 
4476
+ const instanceOfIncludesExcludes = (op)=>[
4477
+ 'in'
4478
+ ].includes(op.operator); // TODO: Guppy does not support excludes
4479
+ /**
4480
+ * Extracts the operands if the operation isIncludes or Excludes. Returns an empty Array
4481
+ * if filter is not the correct type.
4482
+ * @param operation - filters to extract values from
4483
+ */ const extractValues = (operation)=>{
4484
+ if (operation && instanceOfIncludesExcludes(operation)) {
4485
+ return operation.operands;
4486
+ }
4487
+ return [];
4488
+ };
4489
+ /**
4490
+ * Exact value facet component
4491
+ * @param field - field to facet on
4492
+ * @param description - description of the facet
4493
+ * @param facetName - name of the facet
4494
+ * @param dismissCallback - callback function to dismiss the facet
4495
+ * @param width - width of the facet
4496
+ * @param hooks - hooks to use for the facet
4497
+ * @param header - header components
4498
+ * @category Facets
4499
+ */ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks, header = {
4500
+ Panel: FacetHeader,
4501
+ Label: FacetText,
4502
+ iconStyle: controlsIconStyle
4503
+ } })=>{
4504
+ const [textValue, setTextValue] = React.useState(''); // Handle the state of the TextInput
4505
+ const clearFilters = hooks.useClearFilter();
4506
+ const updateFacetFilters = hooks.useUpdateFacetFilters();
4507
+ const facetTitle = facetName ? facetName : core.trimFirstFieldNameToTitle(field, true);
4508
+ const facetValue = hooks.useGetFacetFilters(field);
4509
+ const textValues = React.useMemo(()=>extractValues(facetValue), [
4510
+ facetValue
4511
+ ]);
4512
+ const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4513
+ const showFilters = isFilterExpanded === undefined || isFilterExpanded;
4514
+ const setValues = (values)=>{
4515
+ if (values.length > 0) {
4516
+ if (facetValue && instanceOfIncludesExcludes(facetValue)) {
4517
+ // updating facet value
4518
+ updateFacetFilters(field, {
4519
+ ...facetValue,
4520
+ operands: values
4521
+ });
4522
+ }
4523
+ if (facetValue === undefined) {
4524
+ // TODO: Assuming Includes by default but this might change to Include|Excludes
4525
+ updateFacetFilters(field, {
4526
+ operator: 'in',
4527
+ field: field,
4528
+ operands: values
4529
+ });
4530
+ }
4531
+ } else {
4532
+ clearFilters(field);
4533
+ }
4534
+ };
4535
+ const addValue = (s)=>{
4536
+ if (s === '') return;
4537
+ if (textValues.includes(s)) return;
4538
+ setTextValue('');
4539
+ setValues([
4540
+ ...textValues,
4541
+ s
4542
+ ]);
4543
+ };
4544
+ const removeButton = (x)=>{
4545
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4546
+ size: "xs",
4547
+ color: "white",
4548
+ radius: "xl",
4549
+ variant: "transparent",
4550
+ onClick: ()=>setValues(textValues.filter((i)=>i !== x)),
4551
+ children: /*#__PURE__*/ jsxRuntime.jsx(md.MdClose, {
4552
+ size: 10,
4553
+ "aria-label": "remove value from filter"
4554
+ })
4555
+ });
4556
+ };
4557
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
4558
+ className: `flex flex-col ${width ? width : 'mx-0'} bg-base-max relative border-base-lighter border-1 rounded-md text-xs transition`,
4559
+ children: [
4560
+ /*#__PURE__*/ jsxRuntime.jsx(FacetControlsHeader, {
4561
+ field: field,
4562
+ description: description,
4563
+ hooks: hooks,
4564
+ facetName: facetName,
4565
+ dismissCallback: dismissCallback,
4566
+ header: header
4567
+ }),
4568
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4569
+ className: showFilters ? 'h-full' : 'h-0 invisible',
4570
+ "aria-hidden": !showFilters,
4571
+ children: [
4572
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4573
+ className: "flex flex-nowrap items-center p-2",
4574
+ children: [
4575
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
4576
+ "data-testid": "textbox-add-filter-value",
4577
+ size: "sm",
4578
+ placeholder: `Enter ${facetTitle}`,
4579
+ classNames: {
4580
+ root: 'grow',
4581
+ input: 'border-r-0 rounded-r-none py-1'
4582
+ },
4583
+ "aria-label": "enter value to add filter",
4584
+ value: textValue,
4585
+ onChange: (event)=>setTextValue(event.currentTarget.value)
4586
+ }),
4587
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4588
+ size: "lg",
4589
+ "aria-label": "add string value",
4590
+ className: "bg-accent text-accent-contrast border-base-min border-1 rounded-l-none h-[30px]",
4591
+ onClick: ()=>{
4592
+ if (textValue.length > 0) addValue(textValue.trim());
4593
+ },
4594
+ children: /*#__PURE__*/ jsxRuntime.jsx(fa.FaPlus, {})
4595
+ })
4596
+ ]
4597
+ }),
4598
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
4599
+ gap: "xs",
4600
+ className: "px-2 py-2 max-h-96 overflow-y-auto",
4601
+ "data-testid": "values group",
4602
+ children: textValues.map((x)=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Badge, {
4603
+ size: "sm",
4604
+ variant: "filled",
4605
+ color: "accent",
4606
+ rightSection: removeButton(x),
4607
+ children: x
4608
+ }, x))
4609
+ })
4610
+ ]
4611
+ })
4612
+ ]
4613
+ });
4614
+ };
4615
+
4616
+ const createFacetCard = ({ facetDefinition, valueLabel, hooks: dataFunctions, facetNameFormatter, idPrefix, hideIfEmpty = false, width, showPercent = false, queryOptions })=>{
4617
+ const { field, type, description, label } = facetDefinition;
4618
+ const facetLabel = label ?? facetNameFormatter(facetDefinition.field);
4619
+ const valueTypeLabel = valueLabel === undefined || typeof valueLabel === 'string' ? valueLabel : valueLabel(queryOptions);
4620
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4621
+ children: {
4622
+ enum: /*#__PURE__*/ jsxRuntime.jsx(EnumFacet, {
4623
+ valueLabel: valueTypeLabel,
4624
+ field: field,
4625
+ facetName: facetLabel,
4626
+ description: description,
4627
+ hideIfEmpty: hideIfEmpty,
4628
+ width: width,
4629
+ hooks: dataFunctions,
4630
+ showPercent: showPercent,
4631
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4632
+ }, `${idPrefix}-enum-${field}`),
4633
+ range: /*#__PURE__*/ jsxRuntime.jsx(RangeFacet, {
4634
+ valueLabel: valueTypeLabel,
4635
+ field: field,
4636
+ facetName: facetLabel,
4637
+ description: description,
4638
+ hideIfEmpty: hideIfEmpty,
4639
+ width: width,
4640
+ hooks: dataFunctions,
4641
+ minimum: facetDefinition.range?.minimum,
4642
+ maximum: facetDefinition.range?.maximum,
4643
+ showSettings: showPercent,
4644
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4645
+ }, `${idPrefix}-range-${field}`),
4646
+ exact: /*#__PURE__*/ jsxRuntime.jsx(ExactValueFacet, {
4647
+ field: field,
4648
+ facetName: facetLabel,
4649
+ description: description,
4650
+ hideIfEmpty: hideIfEmpty,
4651
+ width: width,
4652
+ hooks: dataFunctions,
4653
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4654
+ }, `${idPrefix}-exact-${field}`),
4655
+ multiselect: /*#__PURE__*/ jsxRuntime.jsx(MultiSelectValueFacet, {
4656
+ field: field,
4657
+ facetName: facetLabel,
4658
+ description: description,
4659
+ hideIfEmpty: hideIfEmpty,
4660
+ width: width,
4661
+ hooks: dataFunctions,
4662
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4663
+ }, `${idPrefix}-exact-${field}`)
4664
+ }[type]
4665
+ }, `${idPrefix}-facet-${field}`);
4666
+ };
4667
+
4668
+ const FiltersPanel = ({ fields, dataFunctions, valueLabel })=>{
4669
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4670
+ "data-testid": "filters-facets",
4671
+ className: "flex flex-col gap-y-4 w-full",
4672
+ children: fields.map((facetDefinition)=>{
4673
+ if (facetDefinition?.type === undefined) {
4674
+ console.warn('Facet definition missing type', facetDefinition);
4675
+ return null;
4676
+ }
4677
+ if (!(facetDefinition.type in dataFunctions)) return null;
4678
+ return createFacetCard({
4679
+ facetDefinition,
4680
+ valueLabel,
4681
+ hooks: dataFunctions[facetDefinition.type],
4682
+ facetNameFormatter: core.fieldNameToTitle,
4683
+ idPrefix: 'filters-panel',
4684
+ showPercent: false
4685
+ });
4686
+ })
4687
+ });
4688
+ };
4689
+
4690
+ const AccordionPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
4691
+ const coreDispatch = core.useCoreDispatch();
4692
+ const sharedFilters = core.useCoreSelector((state)=>core.selectSharedFilters(state));
4693
+ const theme = core$1.useMantineTheme();
4694
+ const shareFilters = core.useCoreSelector((state)=>core.selectShouldShareFilters(state));
4695
+ const allFiltersCollapsed = core.useCoreSelector((state)=>core.selectAllCohortFiltersCollapsed(state, index));
4696
+ const toggleAllFiltersExpanded = (expand)=>{
4697
+ coreDispatch(core.toggleCohortBuilderAllFilters({
4698
+ expand,
4699
+ index
4700
+ }));
4701
+ };
4702
+ const handleSharedFiltersChange = (value)=>{
4703
+ modals.modals.openConfirmModal({
4704
+ title: 'Confirm change of shared filters mode',
4705
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4706
+ size: "sm",
4707
+ children: value ? 'Switching to Shared Filters mode will apply all selected filters across all indices.' : 'Switching to Unshared Filters mode will stop syncing filters but will not remove them.'
4708
+ }),
4709
+ labels: {
4710
+ confirm: 'Confirm',
4711
+ cancel: 'Cancel'
4712
+ },
4713
+ onConfirm: ()=>coreDispatch(core.setShouldShareFilters(value))
4714
+ });
4715
+ };
4716
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4717
+ align: "flex-start",
4718
+ children: [
4719
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4720
+ justify: "space-between",
4721
+ className: "w-full",
4722
+ children: [
4723
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4724
+ size: "xl",
4725
+ fw: 800,
4726
+ children: "Filters"
4727
+ }),
4728
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
4729
+ className: "text-primary text-sm font-normal",
4730
+ onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
4731
+ children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
4732
+ })
4733
+ ]
4734
+ }),
4735
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4736
+ className: "bg-base-max py-4 px-2 h-full w-full",
4737
+ children: [
4738
+ Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4739
+ gap: "xs",
4740
+ justify: "space-between",
4741
+ children: [
4742
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4743
+ className: "flex items-center space-x-1",
4744
+ children: [
4745
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4746
+ icon: "gen3:share",
4747
+ height: 16,
4748
+ width: 16,
4749
+ color: theme.colors.accent[4]
4750
+ }),
4751
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4752
+ size: "sm",
4753
+ children: "Set the shared filters for all"
4754
+ }),
4755
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4756
+ icon: "gen3:info",
4757
+ height: 12,
4758
+ width: 12,
4759
+ color: theme.colors.accent[4]
4760
+ })
4761
+ ]
4762
+ }),
4763
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Switch, {
4764
+ checked: shareFilters,
4765
+ onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
4766
+ })
4767
+ ]
4768
+ }),
4769
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion, {
4770
+ chevronPosition: "left",
4771
+ multiple: true,
4772
+ defaultValue: [
4773
+ filters?.tabs[0].title ?? 'Filters'
4774
+ ],
4775
+ children: filters.tabs.map((tab)=>{
4776
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Accordion.Item, {
4777
+ value: tab.title,
4778
+ children: [
4779
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Control, {
4780
+ children: tab.title
4781
+ }),
4782
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Panel, {
4783
+ classNames: {
4784
+ panel: 'p-0 m-0'
4785
+ },
4786
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4787
+ fields: tab.fields.reduce((acc, field)=>{
4788
+ return [
4789
+ ...acc,
4790
+ facetDefinitions[field]
4791
+ ];
4792
+ }, []),
4793
+ dataFunctions: facetDataHooks,
4794
+ valueLabel: tabTitle
4795
+ }) : null
4796
+ })
4797
+ ]
4798
+ }, `${tab.title}`);
4799
+ })
4800
+ })
4801
+ ]
4802
+ })
4803
+ ]
4804
+ });
4805
+ };
4806
+
4807
+ const AccessData = [
4808
+ {
4809
+ value: core.Accessibility.ALL,
4810
+ label: 'All'
4811
+ },
4812
+ {
4813
+ value: core.Accessibility.ACCESSIBLE,
4814
+ label: 'Accessible'
4815
+ },
4816
+ {
4817
+ value: core.Accessibility.UNACCESSIBLE,
4818
+ label: 'Not Accessible'
4819
+ }
4820
+ ];
4821
+ const AccessLevelControl = ({ onChange, accessLevel })=>{
4822
+ const theme = core$1.useMantineTheme();
4823
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.SegmentedControl, {
4824
+ color: theme.colors.accent[5],
4825
+ data: AccessData,
4826
+ value: accessLevel,
4827
+ onChange: (val)=>{
4828
+ const accessibilityValue = AccessData.find((item)=>item.value === val)?.value || core.Accessibility.ALL;
4829
+ onChange(accessibilityValue);
4830
+ }
4831
+ });
4832
+ };
4833
+
4834
+ const DropdownPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
4835
+ const [value, setValue] = React.useState('0');
4836
+ const allFiltersCollapsed = core.useCoreSelector((state)=>core.selectAllCohortFiltersCollapsed(state, index));
4837
+ const sharedFilters = core.useCoreSelector((state)=>core.selectSharedFilters(state));
4838
+ const shareFilters = core.useCoreSelector((state)=>core.selectShouldShareFilters(state));
4839
+ const theme = core$1.useMantineTheme();
4840
+ const coreDispatch = core.useCoreDispatch();
4841
+ const toggleAllFiltersExpanded = (expand)=>{
4842
+ coreDispatch(core.toggleCohortBuilderAllFilters({
4843
+ expand,
4844
+ index
4845
+ }));
4846
+ };
4847
+ const items = useDeepCompare.useDeepCompareMemo(()=>filters.tabs.map((tab, idx)=>{
4848
+ return {
4849
+ label: tab.title,
4850
+ value: idx.toString()
4851
+ };
4852
+ }), [
4853
+ filters.tabs
4854
+ ]);
4855
+ const fields = filters.tabs[Number(value)].fields.reduce((acc, field)=>{
4856
+ return [
4857
+ ...acc,
4858
+ facetDefinitions[field]
4859
+ ];
4860
+ }, []);
4861
+ const handleSharedFiltersChange = (value)=>{
4862
+ modals.modals.openConfirmModal({
4863
+ title: 'Confirm change of shared filters mode',
4864
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4865
+ size: "sm",
4866
+ children: value ? 'Switching to Shared Filters mode will apply all selected filters across all indices.' : 'Switching to Unshared Filters mode will stop syncing filters but will not remove them.'
4867
+ }),
4868
+ labels: {
4869
+ confirm: 'Confirm',
4870
+ cancel: 'Cancel'
4871
+ },
4872
+ onConfirm: ()=>coreDispatch(core.setShouldShareFilters(value))
4873
+ });
4874
+ };
4875
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4876
+ align: "flex-start",
4877
+ children: [
4878
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4879
+ justify: "space-between",
4880
+ className: "w-full",
4881
+ children: [
4882
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4883
+ size: "xl",
4884
+ fw: 800,
4885
+ children: "Filters"
4886
+ }),
4887
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
4888
+ className: "text-primary text-sm font-normal",
4889
+ onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
4890
+ children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
4891
+ })
4892
+ ]
4893
+ }),
4894
+ showAccessLevel ? /*#__PURE__*/ jsxRuntime.jsx(AccessLevelControl, {
4895
+ onChange: onAccessChange,
4896
+ accessLevel: accessLevel
4897
+ }) : null,
4898
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4899
+ className: "bg-base-max py-4 px-2 h-full w-full",
4900
+ children: [
4901
+ Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4902
+ gap: "xs",
4903
+ justify: "space-between",
4904
+ children: [
4905
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4906
+ className: "flex items-center space-x-1",
4907
+ children: [
4908
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4909
+ icon: "gen3:share",
4910
+ height: 16,
4911
+ width: 16,
4912
+ color: theme.colors.accent[4]
4913
+ }),
4914
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4915
+ size: "sm",
4916
+ children: "Set the shared filters for all"
4917
+ }),
4918
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
4919
+ label: "If enabled any filter set on this tab will be applied to every tab where occurs.",
4920
+ position: "top",
4921
+ withArrow: true,
4922
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4923
+ icon: "gen3:info",
4924
+ height: 12,
4925
+ width: 12,
4926
+ color: theme.colors.accent[4]
4927
+ })
4928
+ })
4929
+ ]
4930
+ }),
4931
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Switch, {
4932
+ checked: shareFilters,
4933
+ onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
4934
+ })
4935
+ ]
4936
+ }),
4937
+ filters.tabs.length > 1 && /*#__PURE__*/ jsxRuntime.jsx(core$1.Select, {
4938
+ classNames: {
4939
+ options: 'border-1 border-base-dark',
4940
+ option: 'hover:bg-primary-lightest'
4941
+ },
4942
+ withCheckIcon: false,
4943
+ data: items,
4944
+ value: value === null ? '0' : value,
4945
+ onChange: setValue
4946
+ }),
4947
+ Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4948
+ fields: fields,
4949
+ dataFunctions: facetDataHooks,
4950
+ valueLabel: tabTitle
4951
+ }) : null
4952
+ ]
4953
+ })
4954
+ ]
4955
+ });
4956
+ };
4957
+
4958
+ const VerticalTabbedPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
4959
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4960
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
4961
+ variant: "pills",
4962
+ orientation: "vertical",
4963
+ keepMounted: false,
4964
+ defaultValue: filters?.tabs[0].title ?? 'Filters',
4965
+ children: [
4966
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tabs.List, {
4967
+ children: filters.tabs.map((tab)=>{
4968
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tabs.Tab, {
4969
+ value: tab.title,
4970
+ children: tab.title
4971
+ }, `${tab.title}-tab`);
4972
+ })
4973
+ }),
4974
+ filters.tabs.map((tab)=>{
4975
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tabs.Panel, {
4976
+ value: tab.title,
4977
+ className: "w-1/4",
4978
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4979
+ fields: tab.fields.reduce((acc, field)=>{
4980
+ return [
4981
+ ...acc,
4982
+ facetDefinitions[field]
4983
+ ];
4984
+ }, []),
4985
+ dataFunctions: facetDataHooks,
4986
+ valueLabel: tabTitle
4987
+ }) : null
4988
+ }, `filter-${tab.title}-tabPanel`);
4989
+ })
4990
+ ]
4991
+ })
4992
+ });
4993
+ };
4994
+ const SinglePanel = ({ filters, tabTitle, facetDefinitions, facetDataHooks })=>{
4995
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4996
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4997
+ fields: filters.tabs[0].fields.reduce((acc, field)=>{
4998
+ return [
4999
+ ...acc,
5000
+ facetDefinitions[field]
5001
+ ];
5002
+ }, []),
5003
+ dataFunctions: facetDataHooks,
5004
+ valueLabel: tabTitle
5005
+ }) : null
5006
+ });
5007
+ };
5008
+ const TabbedPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks })=>{
5009
+ return filters.tabs.length > 1 ? /*#__PURE__*/ jsxRuntime.jsx(VerticalTabbedPanel, {
5010
+ index: index,
5011
+ filters: filters,
5012
+ tabTitle: tabTitle,
5013
+ facetDefinitions: facetDefinitions,
5014
+ facetDataHooks: facetDataHooks
5015
+ }) : /*#__PURE__*/ jsxRuntime.jsx(SinglePanel, {
5016
+ index: index,
5017
+ filters: filters,
5018
+ tabTitle: tabTitle,
5019
+ facetDefinitions: facetDefinitions,
5020
+ facetDataHooks: facetDataHooks
5021
+ });
5022
+ };
5023
+
4581
5024
  /**
4582
5025
  * Scrolls to hash in url when component mounts and removes hash from url when component unmounts
4583
5026
  * @param valid_hashes - what hashes in url should trigger scroll
@@ -4599,58 +5042,6 @@ const isFacetEmpty = (op)=>{
4599
5042
  }, []);
4600
5043
  };
4601
5044
 
4602
- const createFacetCard = ({ facetDefinition, valueLabel, hooks: dataFunctions, facetNameFormatter, idPrefix, hideIfEmpty = false, width, showPercent = false, queryOptions })=>{
4603
- const { field, type, description, label } = facetDefinition;
4604
- const facetLabel = label ?? facetNameFormatter(facetDefinition.field);
4605
- const valueTypeLabel = valueLabel === undefined || typeof valueLabel === 'string' ? valueLabel : valueLabel(queryOptions);
4606
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
4607
- children: {
4608
- enum: /*#__PURE__*/ jsxRuntime.jsx(EnumFacet, {
4609
- valueLabel: valueTypeLabel,
4610
- field: field,
4611
- facetName: facetLabel,
4612
- description: description,
4613
- hideIfEmpty: hideIfEmpty,
4614
- width: width,
4615
- hooks: dataFunctions,
4616
- showPercent: showPercent,
4617
- sharedWithIndices: facetDefinition?.sharedWithIndices
4618
- }, `${idPrefix}-enum-${field}`),
4619
- range: /*#__PURE__*/ jsxRuntime.jsx(RangeFacet, {
4620
- valueLabel: valueTypeLabel,
4621
- field: field,
4622
- facetName: facetLabel,
4623
- description: description,
4624
- hideIfEmpty: hideIfEmpty,
4625
- width: width,
4626
- hooks: dataFunctions,
4627
- minimum: facetDefinition.range?.minimum,
4628
- maximum: facetDefinition.range?.maximum,
4629
- showSettings: showPercent,
4630
- sharedWithIndices: facetDefinition?.sharedWithIndices
4631
- }, `${idPrefix}-range-${field}`),
4632
- exact: /*#__PURE__*/ jsxRuntime.jsx(ExactValueFacet, {
4633
- field: field,
4634
- facetName: facetLabel,
4635
- description: description,
4636
- hideIfEmpty: hideIfEmpty,
4637
- width: width,
4638
- hooks: dataFunctions,
4639
- sharedWithIndices: facetDefinition?.sharedWithIndices
4640
- }, `${idPrefix}-exact-${field}`),
4641
- multiselect: /*#__PURE__*/ jsxRuntime.jsx(MultiSelectValueFacet, {
4642
- field: field,
4643
- facetName: facetLabel,
4644
- description: description,
4645
- hideIfEmpty: hideIfEmpty,
4646
- width: width,
4647
- hooks: dataFunctions,
4648
- sharedWithIndices: facetDefinition?.sharedWithIndices
4649
- }, `${idPrefix}-exact-${field}`)
4650
- }[type]
4651
- }, `${idPrefix}-facet-${field}`);
4652
- };
4653
-
4654
5045
  const createFacetCards = ({ facets, hooks, facetNameFormatter, idPrefix, valueLabel, dismissCallback, hideIfEmpty, Chart, showPercent })=>{
4655
5046
  return facets.map((facetDefinition)=>{
4656
5047
  return createFacetCard({
@@ -4842,7 +5233,7 @@ const FacetGroup = ({ facets, children })=>{
4842
5233
  const availableFields = facets.map((f)=>f.field);
4843
5234
  useScrollToHash(availableFields, false);
4844
5235
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
4845
- className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 w-content gap-4 my-4 ml-2 w-full",
5236
+ className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 w-content gap-4 ml-2 w-full",
4846
5237
  "data-testid": "title-cohort-builder-facet-groups",
4847
5238
  children: children
4848
5239
  });
@@ -5708,11 +6099,10 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
5708
6099
  * @param iconHeight - the height of the icon
5709
6100
  * @param classNames - the class names to use for root, label, icon/tooltip and arrow'
5710
6101
  * @param noBasePath - set to true to avoid prepending a basePath to the link
5711
- */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '27px', classNames = {}, noBasePath = false })=>{
6102
+ */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '32px', classNames = {}, noBasePath = false })=>{
5712
6103
  const classNamesDefaults = {
5713
- root: 'flex flex-col flex-nowrap px-3 py-2 pt-4 items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100',
6104
+ root: 'flex flex-col flex-nowrap px-3 py-2 pt-4 justify-between items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100',
5714
6105
  label: 'pt-1.5 body-typo font-heading text-sm text-nowrap',
5715
- icon: 'mt-0.5 ml-1',
5716
6106
  ...TooltipStyle
5717
6107
  };
5718
6108
  const mergedClassnames = mergeDefaultTailwindClassnames(classNamesDefaults, classNames);
@@ -11614,7 +12004,7 @@ const CountsValue = ({ label, isSuccess, counts })=>{
11614
12004
  p: "xs",
11615
12005
  withBorder: true,
11616
12006
  className: "bg-primary text-primary-contrast font-heading text-md font-semibold",
11617
- children: `${counts?.toLocaleString() ?? '...'} ${label}`
12007
+ children: toCountsString(counts, label)
11618
12008
  })
11619
12009
  ]
11620
12010
  });
@@ -12133,247 +12523,74 @@ const DownloadsPanel = ({ dropdowns, buttons, loginForDownload, index, totalCoun
12133
12523
  let dropdownsToRender = dropdowns;
12134
12524
  if (loginRequired && !isUserLoggedIn) {
12135
12525
  dropdownsToRender = Object.entries(dropdowns ?? {}).reduce((acc, [key, dropdown])=>{
12136
- return {
12137
- ...acc,
12138
- [key]: {
12139
- ...dropdown,
12140
- title: `${dropdown.title} (Login Required)`,
12141
- buttons: dropdown.dropdownItems?.map((button)=>({
12142
- ...button,
12143
- title: `${button.title} (Login Required)`,
12144
- enabled: false
12145
- }))
12146
- }
12147
- };
12148
- }, {});
12149
- }
12150
- return dropdownsToRender;
12151
- }, [
12152
- dropdowns,
12153
- loginRequired,
12154
- isUserLoggedIn
12155
- ]);
12156
- return dropdowns || buttons ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
12157
- className: "flex space-x-1",
12158
- children: [
12159
- Object.values(dropdownsToRender).map((dropdown)=>{
12160
- return createDownloadMenuButton(dropdown, {
12161
- type: index,
12162
- totalCount,
12163
- fields,
12164
- filter,
12165
- accessibility: accessibility ?? core.Accessibility.ALL
12166
- });
12167
- }),
12168
- buttons.map((button)=>{
12169
- let disabled = false;
12170
- let actionFunction = NullButtonAction;
12171
- let actionArgs = {};
12172
- const buttonAction = button.action ?? button.type;
12173
- if (buttonAction) {
12174
- const actionItem = findButtonAction(buttonAction);
12175
- if (actionItem) {
12176
- const funcArgs = actionItem.args ?? {};
12177
- const func = actionItem.action;
12178
- actionFunction = func;
12179
- actionArgs = funcArgs ?? {};
12180
- }
12181
- }
12182
- if (loginRequired && !isUserLoggedIn) {
12183
- disabled = true;
12184
- }
12185
- return /*#__PURE__*/ jsxRuntime.jsx(CohortActionButton, {
12186
- activeText: 'Downloading...',
12187
- inactiveText: button.title,
12188
- tooltipText: button.tooltipText,
12189
- disabled: disabled || !button.enabled,
12190
- actionFunction: actionFunction,
12191
- actionArgs: {
12192
- ...actionArgs,
12193
- ...button.actionArgs ?? {},
12194
- type: index,
12195
- totalCount,
12196
- fields,
12197
- filter,
12198
- accessibility: accessibility ?? core.Accessibility.ALL
12199
- }
12200
- }, button.title);
12201
- })
12202
- ]
12203
- }) : /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {});
12204
- };
12205
-
12206
- const FiltersPanel = ({ fields, dataFunctions, valueLabel })=>{
12207
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
12208
- "data-testid": "filters-facets",
12209
- className: "flex flex-col gap-y-4 w-full",
12210
- children: fields.map((facetDefinition)=>{
12211
- if (facetDefinition?.type === undefined) {
12212
- console.warn('Facet definition missing type', facetDefinition);
12213
- return null;
12214
- }
12215
- if (!(facetDefinition.type in dataFunctions)) return null;
12216
- return createFacetCard({
12217
- facetDefinition,
12218
- valueLabel,
12219
- hooks: dataFunctions[facetDefinition.type],
12220
- facetNameFormatter: core.fieldNameToTitle,
12221
- idPrefix: 'filters-panel',
12222
- showPercent: false
12223
- });
12224
- })
12225
- });
12226
- };
12227
-
12228
- const AccessData = [
12229
- {
12230
- value: core.Accessibility.ALL,
12231
- label: 'All'
12232
- },
12233
- {
12234
- value: core.Accessibility.ACCESSIBLE,
12235
- label: 'Accessible'
12236
- },
12237
- {
12238
- value: core.Accessibility.UNACCESSIBLE,
12239
- label: 'Not Accessible'
12240
- }
12241
- ];
12242
- const AccessLevelControl = ({ onChange, accessLevel })=>{
12243
- const theme = core$1.useMantineTheme();
12244
- return /*#__PURE__*/ jsxRuntime.jsx(core$1.SegmentedControl, {
12245
- color: theme.colors.accent[5],
12246
- data: AccessData,
12247
- value: accessLevel,
12248
- onChange: (val)=>{
12249
- const accessibilityValue = AccessData.find((item)=>item.value === val)?.value || core.Accessibility.ALL;
12250
- onChange(accessibilityValue);
12251
- }
12252
- });
12253
- };
12254
-
12255
- const DropdownPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
12256
- const [value, setValue] = React.useState('0');
12257
- const allFiltersCollapsed = core.useCoreSelector((state)=>core.selectAllCohortFiltersCollapsed(state, index));
12258
- const sharedFilters = core.useCoreSelector((state)=>core.selectSharedFilters(state));
12259
- const shareFilters = core.useCoreSelector((state)=>core.selectShouldShareFilters(state));
12260
- const theme = core$1.useMantineTheme();
12261
- const coreDispatch = core.useCoreDispatch();
12262
- const toggleAllFiltersExpanded = (expand)=>{
12263
- coreDispatch(core.toggleCohortBuilderAllFilters({
12264
- expand,
12265
- index
12266
- }));
12267
- };
12268
- const items = useDeepCompare.useDeepCompareMemo(()=>filters.tabs.map((tab, idx)=>{
12269
- return {
12270
- label: tab.title,
12271
- value: idx.toString()
12272
- };
12273
- }), [
12274
- filters.tabs
12275
- ]);
12276
- const fields = filters.tabs[Number(value)].fields.reduce((acc, field)=>{
12277
- return [
12278
- ...acc,
12279
- facetDefinitions[field]
12280
- ];
12281
- }, []);
12282
- const handleSharedFiltersChange = (value)=>{
12283
- modals.modals.openConfirmModal({
12284
- title: 'Confirm change of shared filters mode',
12285
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
12286
- size: "sm",
12287
- children: value ? 'Switching to Shared Filters mode will apply all selected filters across all indices.' : 'Switching to Unshared Filters mode will stop syncing filters but will not remove them.'
12288
- }),
12289
- labels: {
12290
- confirm: 'Confirm',
12291
- cancel: 'Cancel'
12292
- },
12293
- onConfirm: ()=>coreDispatch(core.setShouldShareFilters(value))
12294
- });
12295
- };
12296
- return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
12297
- align: "flex-start",
12526
+ return {
12527
+ ...acc,
12528
+ [key]: {
12529
+ ...dropdown,
12530
+ title: `${dropdown.title} (Login Required)`,
12531
+ buttons: dropdown.dropdownItems?.map((button)=>({
12532
+ ...button,
12533
+ title: `${button.title} (Login Required)`,
12534
+ enabled: false
12535
+ }))
12536
+ }
12537
+ };
12538
+ }, {});
12539
+ }
12540
+ return dropdownsToRender;
12541
+ }, [
12542
+ dropdowns,
12543
+ loginRequired,
12544
+ isUserLoggedIn
12545
+ ]);
12546
+ return dropdowns || buttons ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
12547
+ className: "flex space-x-1",
12298
12548
  children: [
12299
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
12300
- justify: "space-between",
12301
- className: "w-full",
12302
- children: [
12303
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
12304
- size: "xl",
12305
- fw: 800,
12306
- children: "Filters"
12307
- }),
12308
- /*#__PURE__*/ jsxRuntime.jsx("button", {
12309
- className: "text-primary text-sm font-normal",
12310
- onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
12311
- children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
12312
- })
12313
- ]
12549
+ Object.values(dropdownsToRender).map((dropdown)=>{
12550
+ return createDownloadMenuButton(dropdown, {
12551
+ type: index,
12552
+ totalCount,
12553
+ fields,
12554
+ filter,
12555
+ accessibility: accessibility ?? core.Accessibility.ALL
12556
+ });
12314
12557
  }),
12315
- showAccessLevel ? /*#__PURE__*/ jsxRuntime.jsx(AccessLevelControl, {
12316
- onChange: onAccessChange,
12317
- accessLevel: accessLevel
12318
- }) : null,
12319
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
12320
- className: "bg-base-max py-4 px-2 h-full w-full",
12321
- children: [
12322
- Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
12323
- gap: "xs",
12324
- justify: "space-between",
12325
- children: [
12326
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
12327
- className: "flex items-center space-x-1",
12328
- children: [
12329
- /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
12330
- icon: "gen3:share",
12331
- height: 16,
12332
- width: 16,
12333
- color: theme.colors.accent[4]
12334
- }),
12335
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
12336
- size: "sm",
12337
- children: "Set the shared filters for all"
12338
- }),
12339
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
12340
- label: "If enabled any filter set on this tab will be applied to every tab where occurs.",
12341
- position: "top",
12342
- withArrow: true,
12343
- children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
12344
- icon: "gen3:info",
12345
- height: 12,
12346
- width: 12,
12347
- color: theme.colors.accent[4]
12348
- })
12349
- })
12350
- ]
12351
- }),
12352
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Switch, {
12353
- checked: shareFilters,
12354
- onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
12355
- })
12356
- ]
12357
- }),
12358
- filters.tabs.length > 1 && /*#__PURE__*/ jsxRuntime.jsx(core$1.Select, {
12359
- classNames: {
12360
- options: 'border-1 border-base-dark',
12361
- option: 'hover:bg-primary-lightest'
12362
- },
12363
- withCheckIcon: false,
12364
- data: items,
12365
- value: value === null ? '0' : value,
12366
- onChange: setValue
12367
- }),
12368
- Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
12369
- fields: fields,
12370
- dataFunctions: facetDataHooks,
12371
- valueLabel: tabTitle
12372
- }) : null
12373
- ]
12558
+ buttons.map((button)=>{
12559
+ let disabled = false;
12560
+ let actionFunction = NullButtonAction;
12561
+ let actionArgs = {};
12562
+ const buttonAction = button.action ?? button.type;
12563
+ if (buttonAction) {
12564
+ const actionItem = findButtonAction(buttonAction);
12565
+ if (actionItem) {
12566
+ const funcArgs = actionItem.args ?? {};
12567
+ const func = actionItem.action;
12568
+ actionFunction = func;
12569
+ actionArgs = funcArgs ?? {};
12570
+ }
12571
+ }
12572
+ if (loginRequired && !isUserLoggedIn) {
12573
+ disabled = true;
12574
+ }
12575
+ return /*#__PURE__*/ jsxRuntime.jsx(CohortActionButton, {
12576
+ activeText: 'Downloading...',
12577
+ inactiveText: button.title,
12578
+ tooltipText: button.tooltipText,
12579
+ disabled: disabled || !button.enabled,
12580
+ actionFunction: actionFunction,
12581
+ actionArgs: {
12582
+ ...actionArgs,
12583
+ ...button.actionArgs ?? {},
12584
+ type: index,
12585
+ totalCount,
12586
+ fields,
12587
+ filter,
12588
+ accessibility: accessibility ?? core.Accessibility.ALL
12589
+ }
12590
+ }, button.title);
12374
12591
  })
12375
12592
  ]
12376
- });
12593
+ }) : /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {});
12377
12594
  };
12378
12595
 
12379
12596
  const EmptyData = {};
@@ -12729,6 +12946,11 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12729
12946
  filters: cohortFilters,
12730
12947
  accessibility: accessLevel
12731
12948
  });
12949
+ const { data: counts, isSuccess: isCountSuccess, isError } = core.useGetCountsQuery({
12950
+ type: index,
12951
+ filters: cohortFilters,
12952
+ accessibility: accessLevel
12953
+ });
12732
12954
  const [facetDefinitions, setFacetDefinitions] = React.useState({});
12733
12955
  React.useEffect(()=>{
12734
12956
  // Check if the router initiated the change
@@ -12806,6 +13028,18 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12806
13028
  cohortFilters.root,
12807
13029
  isSuccess
12808
13030
  ]);
13031
+ const EnumHookInstances = {
13032
+ useGetFacetData: getEnumFacetData,
13033
+ useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
13034
+ useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
13035
+ useClearFilter: lodash.partial(useClearFilters$1, index),
13036
+ useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
13037
+ useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
13038
+ useGetCombineMode: lodash.partial(useCohortFilterCombineState, index),
13039
+ useSetCombineMode: lodash.partial(useSetCohortFilterCombineState, index),
13040
+ useFieldNameToTitle: useFieldNameToTitle,
13041
+ useTotalCounts: undefined
13042
+ };
12809
13043
  const RangeHookInstances = {
12810
13044
  useGetFacetData: getRangeFacetData,
12811
13045
  useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
@@ -12820,38 +13054,9 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12820
13054
  const facetDataHooks = useDeepCompare.useDeepCompareMemo(()=>{
12821
13055
  return {
12822
13056
  // TODO: see if there a better way to do this
12823
- enum: {
12824
- useGetFacetData: getEnumFacetData,
12825
- useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
12826
- useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
12827
- useClearFilter: lodash.partial(useClearFilters$1, index),
12828
- useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
12829
- useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
12830
- useGetCombineMode: lodash.partial(useCohortFilterCombineState, index),
12831
- useSetCombineMode: lodash.partial(useSetCohortFilterCombineState, index),
12832
- useFieldNameToTitle: useFieldNameToTitle,
12833
- useTotalCounts: undefined
12834
- },
12835
- exact: {
12836
- useGetFacetData: getEnumFacetData,
12837
- useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
12838
- useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
12839
- useClearFilter: lodash.partial(useClearFilters$1, index),
12840
- useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
12841
- useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
12842
- useFieldNameToTitle: useFieldNameToTitle,
12843
- useTotalCounts: undefined
12844
- },
12845
- multiselect: {
12846
- useGetFacetData: getEnumFacetData,
12847
- useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
12848
- useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
12849
- useClearFilter: lodash.partial(useClearFilters$1, index),
12850
- useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
12851
- useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
12852
- useFieldNameToTitle: useFieldNameToTitle,
12853
- useTotalCounts: undefined
12854
- },
13057
+ enum: EnumHookInstances,
13058
+ exact: EnumHookInstances,
13059
+ multiselect: EnumHookInstances,
12855
13060
  range: RangeHookInstances,
12856
13061
  age: RangeHookInstances,
12857
13062
  year: RangeHookInstances,
@@ -12859,32 +13064,50 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12859
13064
  days: RangeHookInstances,
12860
13065
  percent: RangeHookInstances,
12861
13066
  datetime: RangeHookInstances,
12862
- toggle: RangeHookInstances
13067
+ toggle: RangeHookInstances,
13068
+ upload: EnumHookInstances
12863
13069
  };
12864
13070
  }, [
12865
13071
  getEnumFacetData,
12866
13072
  getRangeFacetData,
12867
13073
  index
12868
13074
  ]);
12869
- return /*#__PURE__*/ jsxRuntime.jsx(FacetTabs, {
12870
- activeTab: activeTab,
12871
- setActiveTab: setActiveTab,
12872
- facetDefinitions: facetDefinitions,
12873
- tabsConfig: tabsConfig,
12874
- usedFacets: cohortBuilderFilters,
12875
- hooks: facetDataHooks,
12876
- customFacetHooks: {
12877
- useCustomFacets,
12878
- useAvailableCustomFacets: (usedFacets, onlyFiltersWithValues, queryOptions)=>({
12879
- data: {},
12880
- isSuccess: true
12881
- }),
12882
- useAddCustomFilter: ()=>(filter)=>{},
12883
- useRemoveCustomFilter: ()=>(filter)=>{}
13075
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
13076
+ gap: "xs",
13077
+ align: "stretch",
13078
+ classNames: {
13079
+ root: 'w-full'
12884
13080
  },
12885
- getFacetLabel: ()=>'Cases',
12886
- cardScrollMargin: calculateStickyHeaderHeight(),
12887
- useFieldNameToTitle: useFieldNameToTitle
13081
+ children: [
13082
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
13083
+ justify: "flex-end",
13084
+ children: /*#__PURE__*/ jsxRuntime.jsx(CountsValue, {
13085
+ label: index,
13086
+ counts: counts,
13087
+ isSuccess: isCountSuccess
13088
+ })
13089
+ }),
13090
+ /*#__PURE__*/ jsxRuntime.jsx(FacetTabs, {
13091
+ activeTab: activeTab,
13092
+ setActiveTab: setActiveTab,
13093
+ facetDefinitions: facetDefinitions,
13094
+ tabsConfig: tabsConfig,
13095
+ usedFacets: cohortBuilderFilters,
13096
+ hooks: facetDataHooks,
13097
+ customFacetHooks: {
13098
+ useCustomFacets,
13099
+ useAvailableCustomFacets: (usedFacets, onlyFiltersWithValues, queryOptions)=>({
13100
+ data: {},
13101
+ isSuccess: true
13102
+ }),
13103
+ useAddCustomFilter: ()=>(filter)=>{},
13104
+ useRemoveCustomFilter: ()=>(filter)=>{}
13105
+ },
13106
+ getFacetLabel: ()=>'Cases',
13107
+ cardScrollMargin: calculateStickyHeaderHeight(),
13108
+ useFieldNameToTitle: useFieldNameToTitle
13109
+ })
13110
+ ]
12888
13111
  });
12889
13112
  };
12890
13113
 
@@ -13854,7 +14077,7 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
13854
14077
  className: "h-full",
13855
14078
  children: [
13856
14079
  /*#__PURE__*/ jsxRuntime.jsx("div", {
13857
- className: "p-0 rounded-sm h-1/2 h-max-1/2",
14080
+ className: "p-0 rounded-sm h-1/2 h-max-1/2 flex justify-center items-center overflow-hidden",
13858
14081
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Image, {
13859
14082
  component: Image,
13860
14083
  src: `${image}`,
@@ -19108,6 +19331,77 @@ const registerMetadataSchemaApp = ()=>core.createGen3App({
19108
19331
  requiredEntityTypes: []
19109
19332
  });
19110
19333
 
19334
+ const DropdownWithIcon = ({ disableTargetWidth, LeftIcon, RightIcon = /*#__PURE__*/ jsxRuntime.jsx(io.IoMdArrowDropdown, {
19335
+ size: "1.25em",
19336
+ "aria-hidden": "true",
19337
+ "data-testid": "dropdown-icon"
19338
+ }), TargetButtonChildren, targetButtonDisabled, dropdownElements, menuLabelText, menuLabelCustomClass, customPosition, fullHeight, zIndex = undefined, customDataTestId = undefined, tooltip = undefined, buttonAriaLabel = undefined })=>{
19339
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Menu, {
19340
+ width: disableTargetWidth ?? 'target',
19341
+ ...customPosition && {
19342
+ position: customPosition
19343
+ },
19344
+ "data-testid": customDataTestId ?? 'menu-elem',
19345
+ zIndex: zIndex,
19346
+ children: [
19347
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Target, {
19348
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
19349
+ variant: "outline",
19350
+ color: "primary",
19351
+ className: `bg-base-max border-primary data-disabled:opacity-50 data-disabled:bg-base-max data-disabled:text-primary ${focusStyles}`,
19352
+ ...LeftIcon && {
19353
+ leftIcon: LeftIcon
19354
+ },
19355
+ rightSection: RightIcon,
19356
+ disabled: targetButtonDisabled,
19357
+ classNames: {
19358
+ // rightIcon: 'border-l pl-1 -mr-2',
19359
+ root: fullHeight ? 'h-full' : undefined
19360
+ },
19361
+ "aria-label": buttonAriaLabel,
19362
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
19363
+ children: tooltip?.length && !targetButtonDisabled ? /*#__PURE__*/ jsxRuntime.jsx("div", {
19364
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
19365
+ label: tooltip,
19366
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
19367
+ children: TargetButtonChildren
19368
+ })
19369
+ })
19370
+ }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
19371
+ children: TargetButtonChildren
19372
+ })
19373
+ })
19374
+ })
19375
+ }),
19376
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Menu.Dropdown, {
19377
+ "data-testid": "dropdown-menu-options",
19378
+ className: "border-1 border-secondary",
19379
+ children: [
19380
+ menuLabelText && /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
19381
+ children: [
19382
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Label, {
19383
+ className: menuLabelCustomClass ?? 'font-bold',
19384
+ "data-testid": "menu-label",
19385
+ children: menuLabelText
19386
+ }),
19387
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Divider, {})
19388
+ ]
19389
+ }),
19390
+ dropdownElements?.map(({ title, onClick, icon, disabled }, idx)=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Item, {
19391
+ onClick: ()=>{
19392
+ if (onClick) onClick();
19393
+ },
19394
+ "data-testid": `${title}-${idx}`,
19395
+ leftSection: icon && icon,
19396
+ disabled: disabled,
19397
+ children: title
19398
+ }, `${title}-${idx}`))
19399
+ ]
19400
+ })
19401
+ ]
19402
+ });
19403
+ };
19404
+
19111
19405
  const ActionButton = ({ title, enabled, type, leftIcon, rightIcon, tooltipText })=>{
19112
19406
  return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
19113
19407
  label: tooltipText,
@@ -25081,8 +25375,26 @@ const TabbedCohortBuilderPage = ({ headerProps, footerProps, configuration })=>{
25081
25375
  content: 'Tabbed Cohort Builder Page',
25082
25376
  key: 'gen3-tabbed-cohort-builder-page'
25083
25377
  },
25084
- children: /*#__PURE__*/ jsxRuntime.jsx(TabbedCohortBuilder, {
25085
- ...configuration
25378
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
25379
+ align: "stretch",
25380
+ classNames: {
25381
+ root: 'w-full'
25382
+ },
25383
+ children: [
25384
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
25385
+ className: "w-full flex-col flex gap-4 fixed bg-white z-10",
25386
+ children: /*#__PURE__*/ jsxRuntime.jsx(CohortManager$1, {
25387
+ index: configuration.index
25388
+ })
25389
+ }),
25390
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
25391
+ className: "w-full mt-40 mr-4",
25392
+ children: /*#__PURE__*/ jsxRuntime.jsx(TabbedCohortBuilder, {
25393
+ ...configuration,
25394
+ index: configuration.index
25395
+ })
25396
+ })
25397
+ ]
25086
25398
  })
25087
25399
  });
25088
25400
  };
@@ -25551,6 +25863,7 @@ const staticNotebookAPI = async (req, res)=>{
25551
25863
 
25552
25864
  exports.AISearchPageGetServerSideProps = AISearchPageGetServerSideProps;
25553
25865
  exports.AccessLevel = AccessLevel;
25866
+ exports.AccordionPanel = AccordionPanel;
25554
25867
  exports.ActionBar = ActionBar;
25555
25868
  exports.ActionButton = ActionButton;
25556
25869
  exports.AdminAuthZPageGetServerSideProps = AdminAuthZPageGetServerSideProps;
@@ -25593,6 +25906,8 @@ exports.DiscoveryPage = DiscoveryPage;
25593
25906
  exports.DiscoveryPageGetServerSideProps = DiscoveryPageGetServerSideProps;
25594
25907
  exports.DiscoveryRowRendererFactory = DiscoveryRowRendererFactory;
25595
25908
  exports.DropdownButton = DropdownButton;
25909
+ exports.DropdownPanel = DropdownPanel;
25910
+ exports.DropdownWithIcon = DropdownWithIcon;
25596
25911
  exports.EnumFacet = EnumFacet;
25597
25912
  exports.EnumFacetChart = EnumFacetChart;
25598
25913
  exports.ErrorCard = ErrorCard;
@@ -25607,6 +25922,7 @@ exports.FacetExpander = FacetExpander;
25607
25922
  exports.FacetSelector = FacetSelector;
25608
25923
  exports.FacetSortPanel = FacetSortPanel;
25609
25924
  exports.FacetTabs = FacetTabs;
25925
+ exports.FiltersPanel = FiltersPanel;
25610
25926
  exports.FirstTimeModal = FirstTimeModal;
25611
25927
  exports.Footer = Footer;
25612
25928
  exports.Gen3Button = Gen3Button;
@@ -25645,6 +25961,7 @@ exports.RangeFacet = RangeFacet;
25645
25961
  exports.ReactECharts = ReactECharts;
25646
25962
  exports.ResourcesFilters = ResourcesFilters;
25647
25963
  exports.SPECIAL_CASE_FIELDS = SPECIAL_CASE_FIELDS;
25964
+ exports.SegmentedControl = SegmentedControl;
25648
25965
  exports.SessionExpiredModal = SessionExpiredModal;
25649
25966
  exports.SinglePageStudyDetailsPanel = SinglePageStudyDetailsPanel;
25650
25967
  exports.StaticNotebookIFrame = StaticNotebookIFrame;
@@ -25658,6 +25975,7 @@ exports.SubmissionPageGetServerSideProps = SubmissionPageGetServerSideProps;
25658
25975
  exports.TabbedCohortBuilder = TabbedCohortBuilder;
25659
25976
  exports.TabbedCohortBuilderPage = TabbedCohortBuilderPage;
25660
25977
  exports.TabbedCohortBuilderPageGetServerSideProps = TabbedCohortBuilderPageGetServerSideProps;
25978
+ exports.TabbedPanel = TabbedPanel;
25661
25979
  exports.TagCloud = TagCloud;
25662
25980
  exports.TailwindConfig = TailwindConfig;
25663
25981
  exports.TopBar = TopBar;
@@ -25722,6 +26040,7 @@ exports.sessionLogout = sessionLogout;
25722
26040
  exports.sessionToken = sessionToken;
25723
26041
  exports.staticNotebookAPI = staticNotebookAPI;
25724
26042
  exports.stripTrailingSlash = stripTrailingSlash;
26043
+ exports.toCountsString = toCountsString;
25725
26044
  exports.toDisplayName = toDisplayName;
25726
26045
  exports.truncateString = truncateString;
25727
26046
  exports.unixTimeToString = unixTimeToString;