@gen3/frontend 0.11.11 → 0.11.13

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 (251) hide show
  1. package/dist/cjs/index.js +1216 -855
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/DropdownWithIcon/DropdownWithIcon.d.ts +16 -10
  4. package/dist/dts/components/DropdownWithIcon/DropdownWithIcon.d.ts.map +1 -1
  5. package/dist/dts/components/DropdownWithIcon/DropdownWithIcon.js +24 -13
  6. package/dist/dts/components/DropdownWithIcon/DropdownWithIcon.js.map +1 -1
  7. package/dist/dts/components/DropdownWithIcon/DropdownWithIcon.unit.test.js +43 -30
  8. package/dist/dts/components/DropdownWithIcon/DropdownWithIcon.unit.test.js.map +1 -1
  9. package/dist/dts/components/MessageCards/ErrorMessage.js +1 -1
  10. package/dist/dts/components/MessageCards/ErrorMessage.js.map +1 -1
  11. package/dist/dts/components/Providers/Gen3Provider.d.ts +141 -4
  12. package/dist/dts/components/Providers/Gen3Provider.d.ts.map +1 -1
  13. package/dist/dts/components/charts/Charts.d.ts.map +1 -1
  14. package/dist/dts/components/charts/Charts.js +27 -31
  15. package/dist/dts/components/charts/Charts.js.map +1 -1
  16. package/dist/dts/components/charts/CollapsableCharts.d.ts +2 -2
  17. package/dist/dts/components/charts/CollapsableCharts.d.ts.map +1 -1
  18. package/dist/dts/components/charts/CollapsableCharts.js +2 -2
  19. package/dist/dts/components/charts/CollapsableCharts.js.map +1 -1
  20. package/dist/dts/components/charts/createChart.d.ts.map +1 -1
  21. package/dist/dts/components/charts/createChart.js +7 -12
  22. package/dist/dts/components/charts/createChart.js.map +1 -1
  23. package/dist/dts/components/charts/echarts/HorizontalBarChart.d.ts.map +1 -1
  24. package/dist/dts/components/charts/echarts/HorizontalBarChart.js +7 -4
  25. package/dist/dts/components/charts/echarts/HorizontalBarChart.js.map +1 -1
  26. package/dist/dts/components/facets/EnumFacet.d.ts +1 -1
  27. package/dist/dts/components/facets/EnumFacet.d.ts.map +1 -1
  28. package/dist/dts/components/facets/EnumFacet.js +6 -6
  29. package/dist/dts/components/facets/EnumFacet.js.map +1 -1
  30. package/dist/dts/components/facets/FacetEnumList.d.ts +2 -0
  31. package/dist/dts/components/facets/FacetEnumList.d.ts.map +1 -1
  32. package/dist/dts/components/facets/FacetEnumList.js +24 -18
  33. package/dist/dts/components/facets/FacetEnumList.js.map +1 -1
  34. package/dist/dts/components/facets/FacetSelectionModal.d.ts +1 -2
  35. package/dist/dts/components/facets/FacetSelectionModal.d.ts.map +1 -1
  36. package/dist/dts/components/facets/FacetSelectionModal.js.map +1 -1
  37. package/dist/dts/components/facets/FacetSelector.d.ts +1 -2
  38. package/dist/dts/components/facets/FacetSelector.d.ts.map +1 -1
  39. package/dist/dts/components/facets/FacetSelector.js +1 -1
  40. package/dist/dts/components/facets/FacetSelector.js.map +1 -1
  41. package/dist/dts/components/facets/FacetTabs.d.ts +1 -2
  42. package/dist/dts/components/facets/FacetTabs.d.ts.map +1 -1
  43. package/dist/dts/components/facets/FacetTabs.js.map +1 -1
  44. package/dist/dts/components/facets/FiltersPanel.d.ts +9 -0
  45. package/dist/dts/components/facets/FiltersPanel.d.ts.map +1 -0
  46. package/dist/dts/{features/CohortBuilder → components/facets}/FiltersPanel.js +3 -2
  47. package/dist/dts/components/facets/FiltersPanel.js.map +1 -0
  48. package/dist/dts/components/facets/Panels/AccordianPanel.d.ts.map +1 -0
  49. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/AccordianPanel.js +1 -1
  50. package/dist/dts/components/facets/Panels/AccordianPanel.js.map +1 -0
  51. package/dist/dts/components/facets/Panels/DropdownPanel.d.ts.map +1 -0
  52. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/DropdownPanel.js +3 -3
  53. package/dist/dts/components/facets/Panels/DropdownPanel.js.map +1 -0
  54. package/dist/dts/components/facets/Panels/TabbedPanel.d.ts +4 -0
  55. package/dist/dts/components/facets/Panels/TabbedPanel.d.ts.map +1 -0
  56. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/TabbedPanel.js +3 -2
  57. package/dist/dts/components/facets/Panels/TabbedPanel.js.map +1 -0
  58. package/dist/dts/components/facets/Panels/index.d.ts +5 -0
  59. package/dist/dts/components/facets/Panels/index.d.ts.map +1 -0
  60. package/dist/dts/components/facets/Panels/index.js +5 -0
  61. package/dist/dts/components/facets/Panels/index.js.map +1 -0
  62. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/types.d.ts +4 -3
  63. package/dist/dts/components/facets/Panels/types.d.ts.map +1 -0
  64. package/dist/dts/components/facets/Panels/types.js.map +1 -0
  65. package/dist/dts/components/facets/createFacetCard.d.ts +1 -2
  66. package/dist/dts/components/facets/createFacetCard.d.ts.map +1 -1
  67. package/dist/dts/components/facets/createFacetCard.js +4 -4
  68. package/dist/dts/components/facets/createFacetCard.js.map +1 -1
  69. package/dist/dts/components/facets/createFacetCards.d.ts +1 -2
  70. package/dist/dts/components/facets/createFacetCards.d.ts.map +1 -1
  71. package/dist/dts/components/facets/createFacetCards.js.map +1 -1
  72. package/dist/dts/components/facets/index.d.ts +6 -1
  73. package/dist/dts/components/facets/index.d.ts.map +1 -1
  74. package/dist/dts/components/facets/index.js +6 -1
  75. package/dist/dts/components/facets/index.js.map +1 -1
  76. package/dist/dts/components/facets/types.d.ts +17 -2
  77. package/dist/dts/components/facets/types.d.ts.map +1 -1
  78. package/dist/dts/components/facets/types.js.map +1 -1
  79. package/dist/dts/components/facets/utils.d.ts +2 -2
  80. package/dist/dts/components/facets/utils.d.ts.map +1 -1
  81. package/dist/dts/components/facets/utils.js +19 -1
  82. package/dist/dts/components/facets/utils.js.map +1 -1
  83. package/dist/dts/features/Analysis/AnalysisCard.d.ts.map +1 -1
  84. package/dist/dts/features/Analysis/AnalysisCard.js +1 -1
  85. package/dist/dts/features/Analysis/AnalysisCard.js.map +1 -1
  86. package/dist/dts/features/Analysis/AnalysisCard.stories.d.ts.map +1 -1
  87. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +10 -10
  88. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts.map +1 -1
  89. package/dist/dts/features/Analysis/TextDescription.d.ts.map +1 -1
  90. package/dist/dts/features/Analysis/TextDescription.js +3 -19
  91. package/dist/dts/features/Analysis/TextDescription.js.map +1 -1
  92. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts.map +1 -1
  93. package/dist/dts/features/CohortBuilder/CohortBuilder.js +3 -13
  94. package/dist/dts/features/CohortBuilder/CohortBuilder.js.map +1 -1
  95. package/dist/dts/features/CohortBuilder/CohortManager/modals/SaveOrCreateEntityModal.js +1 -1
  96. package/dist/dts/features/CohortBuilder/CohortManager/modals/SaveOrCreateEntityModal.js.map +1 -1
  97. package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
  98. package/dist/dts/features/CohortBuilder/CohortPanel.js +29 -22
  99. package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
  100. package/dist/dts/features/CohortBuilder/ExplorerTable/ArrayCellRenderer.d.ts +1 -1
  101. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.d.ts.map +1 -1
  102. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js +16 -32
  103. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js.map +1 -1
  104. package/dist/dts/features/CohortBuilder/types.d.ts +2 -2
  105. package/dist/dts/features/CohortBuilder/types.d.ts.map +1 -1
  106. package/dist/dts/features/CohortBuilder/types.js.map +1 -1
  107. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts +2 -1
  108. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts.map +1 -1
  109. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.js.map +1 -1
  110. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts +16 -16
  111. package/dist/dts/features/CohortDiscovery/FacetDefinitionsSlice.d.ts +1 -1
  112. package/dist/dts/features/CohortDiscovery/FacetDefinitionsSlice.d.ts.map +1 -1
  113. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts +1 -2
  114. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts.map +1 -1
  115. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.js.map +1 -1
  116. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts +2 -2
  117. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts.map +1 -1
  118. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.js.map +1 -1
  119. package/dist/dts/features/CohortDiscovery/RequestManagerSlice.d.ts +7 -7
  120. package/dist/dts/features/CohortDiscovery/appApi.d.ts +2 -2
  121. package/dist/dts/features/CohortDiscovery/registerApp.js +1 -1
  122. package/dist/dts/features/CohortDiscovery/registerApp.js.map +1 -1
  123. package/dist/dts/features/CohortSimilarity/cohortSimilarityApi.d.ts +10 -10
  124. package/dist/dts/features/Discovery/DataLoaders/MDSAllLocal/DataLoader.d.ts.map +1 -1
  125. package/dist/dts/features/Discovery/DataLoaders/MDSAllLocal/DataLoader.js +1 -0
  126. package/dist/dts/features/Discovery/DataLoaders/MDSAllLocal/DataLoader.js.map +1 -1
  127. package/dist/dts/features/Discovery/DiscoveryIndexPanel.d.ts.map +1 -1
  128. package/dist/dts/features/Discovery/DiscoveryIndexPanel.js +1 -1
  129. package/dist/dts/features/Discovery/DiscoveryIndexPanel.js.map +1 -1
  130. package/dist/dts/features/Discovery/DiscoveryTable.d.ts.map +1 -1
  131. package/dist/dts/features/Discovery/DiscoveryTable.js +30 -5
  132. package/dist/dts/features/Discovery/DiscoveryTable.js.map +1 -1
  133. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.d.ts +1 -0
  134. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.d.ts.map +1 -1
  135. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.js +10 -0
  136. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.js.map +1 -1
  137. package/dist/dts/features/Discovery/types.d.ts +7 -0
  138. package/dist/dts/features/Discovery/types.d.ts.map +1 -1
  139. package/dist/dts/features/Discovery/types.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/esm/index.js +1217 -862
  145. package/dist/esm/index.js.map +1 -1
  146. package/dist/index.d.ts +295 -13
  147. package/dist/tsconfig.tsbuildinfo +1 -1
  148. package/package.json +3 -3
  149. package/dist/dts/api/staticNotebook/index.d.ts +0 -4
  150. package/dist/dts/api/staticNotebook/index.d.ts.map +0 -1
  151. package/dist/dts/api/staticNotebook/index.js +0 -118
  152. package/dist/dts/api/staticNotebook/index.js.map +0 -1
  153. package/dist/dts/api/staticNotebooks/index.d.ts +0 -4
  154. package/dist/dts/api/staticNotebooks/index.d.ts.map +0 -1
  155. package/dist/dts/api/staticNotebooks/index.js +0 -118
  156. package/dist/dts/api/staticNotebooks/index.js.map +0 -1
  157. package/dist/dts/features/CohortBuilder/FiltersPanel.d.ts +0 -10
  158. package/dist/dts/features/CohortBuilder/FiltersPanel.d.ts.map +0 -1
  159. package/dist/dts/features/CohortBuilder/FiltersPanel.js.map +0 -1
  160. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.d.ts.map +0 -1
  161. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.js.map +0 -1
  162. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.d.ts.map +0 -1
  163. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.js.map +0 -1
  164. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.d.ts +0 -3
  165. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.d.ts.map +0 -1
  166. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.js.map +0 -1
  167. package/dist/dts/features/CohortBuilder/Panels/types.d.ts.map +0 -1
  168. package/dist/dts/features/CohortBuilder/Panels/types.js.map +0 -1
  169. package/dist/dts/features/CohortDiscovery/CohortManager.d.ts +0 -6
  170. package/dist/dts/features/CohortDiscovery/CohortManager.d.ts.map +0 -1
  171. package/dist/dts/features/CohortDiscovery/CohortManager.js +0 -55
  172. package/dist/dts/features/CohortDiscovery/CohortManager.js.map +0 -1
  173. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.d.ts +0 -135
  174. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.d.ts.map +0 -1
  175. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.js +0 -40
  176. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.js.map +0 -1
  177. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.d.ts +0 -3
  178. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.d.ts.map +0 -1
  179. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.js +0 -9
  180. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.js.map +0 -1
  181. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.d.ts +0 -7
  182. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.d.ts.map +0 -1
  183. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.js +0 -101
  184. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.js.map +0 -1
  185. package/dist/dts/features/CohortDiscovery/appApiRTKQ.d.ts +0 -1
  186. package/dist/dts/features/CohortDiscovery/appApiRTKQ.d.ts.map +0 -1
  187. package/dist/dts/features/CohortDiscovery/appApiRTKQ.js +0 -101
  188. package/dist/dts/features/CohortDiscovery/appApiRTKQ.js.map +0 -1
  189. package/dist/dts/features/Discovery/Charts/ChartsPanel.d.ts +0 -9
  190. package/dist/dts/features/Discovery/Charts/ChartsPanel.d.ts.map +0 -1
  191. package/dist/dts/features/Discovery/Charts/ChartsPanel.js +0 -24
  192. package/dist/dts/features/Discovery/Charts/ChartsPanel.js.map +0 -1
  193. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.d.ts +0 -9
  194. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.d.ts.map +0 -1
  195. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.js +0 -24
  196. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.js.map +0 -1
  197. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.d.ts +0 -9
  198. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.d.ts.map +0 -1
  199. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.js +0 -12
  200. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.js.map +0 -1
  201. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.d.ts +0 -19
  202. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.d.ts.map +0 -1
  203. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.js +0 -56
  204. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.js.map +0 -1
  205. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.d.ts +0 -14
  206. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.d.ts.map +0 -1
  207. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.js +0 -44
  208. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.js.map +0 -1
  209. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.d.ts +0 -3
  210. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.d.ts.map +0 -1
  211. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.js +0 -37
  212. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.js.map +0 -1
  213. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.d.ts +0 -10
  214. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.d.ts.map +0 -1
  215. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.js +0 -19
  216. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.js.map +0 -1
  217. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.d.ts +0 -8
  218. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.d.ts.map +0 -1
  219. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.js +0 -31
  220. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.js.map +0 -1
  221. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.d.ts +0 -9
  222. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.d.ts.map +0 -1
  223. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.js +0 -11
  224. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.js.map +0 -1
  225. package/dist/dts/features/Discovery/StudyDetails/StudyItems.d.ts +0 -5
  226. package/dist/dts/features/Discovery/StudyDetails/StudyItems.d.ts.map +0 -1
  227. package/dist/dts/features/Discovery/StudyDetails/StudyItems.js +0 -283
  228. package/dist/dts/features/Discovery/StudyDetails/StudyItems.js.map +0 -1
  229. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.d.ts +0 -10
  230. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.d.ts.map +0 -1
  231. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.js +0 -45
  232. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.js.map +0 -1
  233. package/dist/dts/features/Discovery/StudyPage/StudyPage.d.ts +0 -10
  234. package/dist/dts/features/Discovery/StudyPage/StudyPage.d.ts.map +0 -1
  235. package/dist/dts/features/Discovery/StudyPage/StudyPage.js +0 -11
  236. package/dist/dts/features/Discovery/StudyPage/StudyPage.js.map +0 -1
  237. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.d.ts +0 -9
  238. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.d.ts.map +0 -1
  239. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.js +0 -8
  240. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.js.map +0 -1
  241. package/dist/dts/features/StaticNotebook/StaticNotebook.d.ts +0 -4
  242. package/dist/dts/features/StaticNotebook/StaticNotebook.d.ts.map +0 -1
  243. package/dist/dts/features/StaticNotebook/StaticNotebook.js +0 -79
  244. package/dist/dts/features/StaticNotebook/StaticNotebook.js.map +0 -1
  245. package/dist/dts/lib/notebooks/index.d.ts +0 -3
  246. package/dist/dts/lib/notebooks/index.d.ts.map +0 -1
  247. package/dist/dts/lib/notebooks/index.js +0 -96
  248. package/dist/dts/lib/notebooks/index.js.map +0 -1
  249. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/AccordianPanel.d.ts +0 -0
  250. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/DropdownPanel.d.ts +0 -0
  251. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/types.js +0 -0
package/dist/esm/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
  import React__default, { createContext, useState, useMemo, useEffect, useCallback, useContext, useRef, createElement, forwardRef, useReducer } from 'react';
4
- import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, fetchFence, isFetchError, WorkspaceStatus, useGetWorkspaceStatusQuery, useGetWorkspacePayModelsQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, selectRequestedWorkspaceStatusTimestamp, useCoreDispatch, setActiveWorkspaceStatus, RequestedWorkspaceStatus, setRequestedWorkspaceStatus, isTimeGreaterThan, useGetCSRFQuery, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, GEN3_FENCE_API, showModal, Modals, isAuthenticated, useGetLoginProvidersQuery, hideModal, selectCurrentModal, fieldNameToTitle, isOperationWithField, selectShouldShareFilters, selectSharedFilters, updateCohortFilter as updateCohortFilter$1, selectIndexedFilterByName, isUnion, isOperatorWithFieldAndArrayOfOperands, extractEnumFilterValue, removeCohortFilter as removeCohortFilter$1, trimFirstFieldNameToTitle, useIsUserLoggedIn, GEN3_DOMAIN, useDataLibrary, DataLibraryStoreMode, buildListItemsGroupedByDataset, extractFileDatasetsInRecords, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, setCohortFilter as setCohortFilter$1, clearCohortFilters as clearCohortFilters$1, handleOperation, selectAvailableCohorts, selectCurrentCohortId as selectCurrentCohortId$1, selectCohortFilters, selectCurrentCohortModified, selectCurrentCohortSaved, setCohortIndexFilters, setActiveCohort, toggleCohortBuilderCategoryFilter, selectCohortFilterExpanded, setCohortFilterCombineMode, selectCohortFilterCombineMode, selectCurrentCohortName as selectCurrentCohortName$1, useGeneralGQLQuery, selectIndexFilters, useGetRawDataAndTotalCountsQuery, isJSONValue, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, Accessibility, selectAllCohortFiltersCollapsed, toggleCohortBuilderAllFilters, setShouldShareFilters, useGetAggsQuery, useGetAggsNoFilterSelfQuery, isIntersection, useGetCountsQuery, setSharedFilters, usePrevious, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, getCurrentTimestamp, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, useSetCurrentPayModelMutation, PodStatus, PodConditionType, isWorkspaceRunningOrStopping, GEN3_API, GEN3_COMMONS_NAME, getTimestamp, createAppStore, getRemoteSupportServiceRegistry, isHttpStatusError, MissingServiceConfigurationError, useLazyGetAggsNoFilterSelfQuery, useCreateRequestMutation, buildGetAggregationQuery, processHistogramResponse, roundHistogramResponse, selectCSRFToken, useUserRequestQuery, getGen3AppId, createGen3AppWithOwnStore, createAppApiForRTKQ, useGetDictionaryQuery, useGetMetadataByIdQuery, createGen3App, CoreProvider, fetchJSONDataFromURL, HttpMethod, groupSharedFields, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetProjectsDetailsQuery, useGetSubmissionsQuery, isCohortItem, isFileItem, fetchFencePresignedURL, HTTPError, getFederatedLoginStatus, queryMultipleMDSRecords, GEN3_MANIFEST_API, extractIndexFromDataLibraryCohort, isFilterSet, getNumberOfItemsInDatalist, isAdditionalDataItem, useLazyGetCrosswalkDataQuery } from '@gen3/core';
5
- import { LoadingOverlay, Card, Group, Avatar, Text, Checkbox, Stack, Center, Loader, Tooltip, UnstyledButton, ThemeIcon, Box, Select, Button, Divider, Textarea, FileButton, Anchor, Modal, Grid, Table, ColorSwatch, useMantineTheme, Accordion, Switch, ActionIcon, Badge, TextInput, SegmentedControl, NumberInput, RangeSlider, MultiSelect, SimpleGrid, Highlight, MantineProvider, Tabs, Flex, Menu, Alert, Drawer, CopyButton, factory, useProps, getStyleObject, Paper, useCombobox, Combobox, ScrollArea, Autocomplete, Title, Transition, rem, Stepper, Image as Image$1, NavLink, List, createTheme, Pagination, FileInput, CloseButton } from '@mantine/core';
4
+ import { useUserAuth, useCoreSelector, selectUserDetails, useGetAuthzMappingsQuery, fetchFence, isFetchError, WorkspaceStatus, useGetWorkspaceStatusQuery, useGetWorkspacePayModelsQuery, useTerminateWorkspaceMutation, selectRequestedWorkspaceStatus, selectRequestedWorkspaceStatusTimestamp, useCoreDispatch, setActiveWorkspaceStatus, RequestedWorkspaceStatus, setRequestedWorkspaceStatus, isTimeGreaterThan, useGetCSRFQuery, useLazyFetchUserDetailsQuery, selectUserAuthStatus, GEN3_REDIRECT_URL, GEN3_FENCE_API, showModal, Modals, isAuthenticated, useGetLoginProvidersQuery, hideModal, selectCurrentModal, fieldNameToTitle, isOperationWithField, selectShouldShareFilters, selectSharedFilters, updateCohortFilter as updateCohortFilter$1, selectIndexedFilterByName, isUnion, isOperatorWithFieldAndArrayOfOperands, extractEnumFilterValue, removeCohortFilter as removeCohortFilter$1, trimFirstFieldNameToTitle, selectAllCohortFiltersCollapsed, Accessibility, toggleCohortBuilderAllFilters, setShouldShareFilters, useIsUserLoggedIn, GEN3_DOMAIN, useDataLibrary, DataLibraryStoreMode, buildListItemsGroupedByDataset, extractFileDatasetsInRecords, useGetMDSQuery, selectAuthzMappingData, useGetAggMDSQuery, useAskQuestionMutation, useGetIndexAggMDSQuery, useGetTagsQuery, setCohortFilter as setCohortFilter$1, clearCohortFilters as clearCohortFilters$1, handleOperation, selectAvailableCohorts, selectCurrentCohortId as selectCurrentCohortId$1, selectCohortFilters, selectCurrentCohortModified, selectCurrentCohortSaved, setCohortIndexFilters, setActiveCohort, setCohortFilterCombineMode, selectCohortFilterCombineMode, toggleCohortBuilderCategoryFilter, selectCohortFilterExpanded, selectCurrentCohortName as selectCurrentCohortName$1, useGeneralGQLQuery, selectIndexFilters, useGetRawDataAndTotalCountsQuery, isJSONValue, downloadFromGuppyToBlob, downloadJSONDataFromGuppy, useGetAggsQuery, useGetAggsNoFilterSelfQuery, isIntersection, useGetCountsQuery, setSharedFilters, usePrevious, selectHeadersWithCSRFToken, GEN3_GUPPY_API, useLaunchWorkspaceMutation, selectActiveWorkspaceStatus, isFetchBaseQueryError, setActiveWorkspace, getCurrentTimestamp, selectWorkspaceStatusFromService, selectActiveWorkspaceId, useGetWorkspaceOptionsQuery, GEN3_WORKSPACE_API, useGetExternalLoginsQuery, useSetCurrentPayModelMutation, PodStatus, PodConditionType, isWorkspaceRunningOrStopping, GEN3_API, GEN3_COMMONS_NAME, getTimestamp, createAppStore, getRemoteSupportServiceRegistry, isHttpStatusError, MissingServiceConfigurationError, useLazyGetAggsNoFilterSelfQuery, useCreateRequestMutation, buildGetAggregationQuery, processHistogramResponse, roundHistogramResponse, selectCSRFToken, useUserRequestQuery, getGen3AppId, createGen3AppWithOwnStore, createAppApiForRTKQ, useGetDictionaryQuery, useGetMetadataByIdQuery, createGen3App, CoreProvider, fetchJSONDataFromURL, HttpMethod, groupSharedFields, useGetCredentialsQuery, useRemoveCredentialMutation, useAddNewCredentialMutation, useGetProjectsDetailsQuery, useGetSubmissionsQuery, isCohortItem, isFileItem, fetchFencePresignedURL, HTTPError, getFederatedLoginStatus, queryMultipleMDSRecords, GEN3_MANIFEST_API, extractIndexFromDataLibraryCohort, isFilterSet, getNumberOfItemsInDatalist, isAdditionalDataItem, useLazyGetCrosswalkDataQuery } from '@gen3/core';
5
+ import { LoadingOverlay, Card, Group, Avatar, Text, Checkbox, Stack, Center, Loader, Tooltip, UnstyledButton, ThemeIcon, Box, Select, Button, Divider, Textarea, FileButton, Anchor, Modal, Grid, Table, ColorSwatch, useMantineTheme, Accordion, Switch, SegmentedControl as SegmentedControl$1, ActionIcon, Badge, TextInput, NumberInput, RangeSlider, MultiSelect, Tabs, SimpleGrid, Highlight, MantineProvider, Flex, Menu, Alert, Drawer, CopyButton, factory, useProps, getStyleObject, Paper, useCombobox, Combobox, ScrollArea, Autocomplete, Title, Transition, rem, Stepper, Spoiler, Image as Image$1, NavLink, List, createTheme, Pagination, FileInput, CloseButton } from '@mantine/core';
6
6
  import { useDeepCompareEffect, useDeepCompareMemo, useDeepCompareCallback } from 'use-deep-compare';
7
7
  import { useRouter } from 'next/router';
8
8
  import { usePathname } from 'next/navigation';
9
- import { MdLogin, MdClose, MdExpandLess, MdExpandMore, MdSearch, MdFlip, MdAddCircle, MdRemoveCircle, MdLockOutline, MdLibraryAdd, MdAdd, MdKeyboardDoubleArrowLeft, MdUndo, MdInfo, MdOutlineArrowBack, MdOutlineArrowForward, MdKeyboardArrowDown, MdKeyboardArrowUp, MdDownload, MdGroup, MdOutlineBarChart, MdOutlineSearch, MdFormatQuote, MdDelete, MdOutlineRemoveCircle } from 'react-icons/md';
9
+ import { MdLogin, MdClose, MdAddCircle, MdRemoveCircle, MdExpandLess, MdExpandMore, MdSearch, MdFlip, MdLockOutline, MdLibraryAdd, MdAdd, MdKeyboardDoubleArrowLeft, MdUndo, MdInfo, MdOutlineArrowBack, MdOutlineArrowForward, MdKeyboardArrowDown, MdKeyboardArrowUp, MdDownload, MdGroup, MdOutlineBarChart, MdOutlineSearch, MdFormatQuote, MdDelete, MdOutlineRemoveCircle } from 'react-icons/md';
10
10
  import { getCookie, deleteCookie, setCookie } from 'cookies-next';
11
11
  import useSWR from 'swr';
12
12
  import { errors, importSPKI, jwtVerify, decodeJwt } from 'jose';
@@ -25,10 +25,12 @@ import { defaultComposer } from 'default-composer';
25
25
  import { Icon, addCollection } from '@iconify-icon/react';
26
26
  import { init, getInstanceByDom, graphic } from 'echarts';
27
27
  import { VictoryChart, VictoryTheme, VictoryAxis, VictoryStack, VictoryBar, Bar, VictoryTooltip, VictoryContainer } from 'victory';
28
- import { FaUndo, FaPlus, FaExternalLinkAlt, FaExclamationTriangle, FaExclamation, FaQuestion, FaUser, FaExclamationCircle, FaRegStopCircle, FaChartPie, FaCircle, FaCheck, FaVideo, FaRegQuestionCircle, FaGraduationCap, FaRedo, FaUpload, FaDownload } from 'react-icons/fa';
29
28
  import tw from 'tailwind-styled-components';
29
+ import { useForm, isEmail, isNotEmpty } from '@mantine/form';
30
30
  import { RiCloseCircleLine } from 'react-icons/ri';
31
+ import { FaUndo, FaPlus, FaExternalLinkAlt, FaExclamationTriangle, FaExclamation, FaQuestion, FaUser, FaExclamationCircle, FaRegStopCircle, FaChartPie, FaCircle, FaCheck, FaVideo, FaRegQuestionCircle, FaGraduationCap, FaRedo, FaUpload, FaDownload } from 'react-icons/fa';
31
32
  import { PiCaretUpFill, PiCaretDownFill, PiCaretUpDownFill, PiDotsThreeCircleThin, PiTrash, PiSparkleFill, PiCaretCircleDownFill } from 'react-icons/pi';
33
+ import { modals, ModalsProvider } from '@mantine/modals';
32
34
  import Image from 'next/image';
33
35
  import Link from 'next/link';
34
36
  import { AiOutlineLogin } from 'react-icons/ai';
@@ -44,7 +46,6 @@ import uniq from 'lodash/uniq';
44
46
  import sum from 'lodash/sum';
45
47
  import { LuCircleSlash, LuClock, LuLock, LuUnlock } from 'react-icons/lu';
46
48
  import 'universal-cookie';
47
- import { modals, ModalsProvider } from '@mantine/modals';
48
49
  import GraphiQL from 'graphiql';
49
50
  import { useRouter as useRouter$1 } from 'next/dist/client/router';
50
51
  import fs from 'fs';
@@ -55,7 +56,6 @@ import { combineReducers } from 'redux';
55
56
  import { createSlice, nanoid, createEntityAdapter, createAsyncThunk, createSelector } from '@reduxjs/toolkit';
56
57
  import { openDB } from 'idb';
57
58
  import createWebStorage from 'redux-persist/lib/storage/createWebStorage';
58
- import { useForm, isEmail, isNotEmpty } from '@mantine/form';
59
59
  import dynamic from 'next/dynamic';
60
60
  import YAML from 'yaml';
61
61
  import { filesize } from 'filesize';
@@ -1460,7 +1460,7 @@ function hashCode(str) {
1460
1460
  dangerouslySetInnerHTML: {
1461
1461
  __html: textString
1462
1462
  },
1463
- "aria-label": "HTML content" // Provide context for HTML rendered content
1463
+ "aria-label": "HTML content"
1464
1464
  });
1465
1465
  }
1466
1466
  case "textArray":
@@ -1600,7 +1600,7 @@ function hashCode(str) {
1600
1600
  * @param {string} paramValue - The parameter value
1601
1601
  * @returns {string} - The URL with the added parameter
1602
1602
  */ const appendParameterToUrl = (url, paramName, paramValue)=>{
1603
- if (!url || false) {
1603
+ if (!url || !paramName) {
1604
1604
  return url;
1605
1605
  }
1606
1606
  // Extract hash fragment if present
@@ -1936,8 +1936,7 @@ const saveToFile = (savingStr, filename = 'credentials.json')=>{
1936
1936
  children: [
1937
1937
  credentials.api_key === '' && /*#__PURE__*/ jsx(LoadingOverlay, {
1938
1938
  visible: true
1939
- }) // pragma: allowlist-secret;
1940
- ,
1939
+ }),
1941
1940
  /*#__PURE__*/ jsx("p", {
1942
1941
  children: "This key is only shown once. Please copy or save it and store it in a safe place."
1943
1942
  }),
@@ -2494,7 +2493,7 @@ const processChartData$2 = (facetData, valueType = 'count', total, maxBins = 100
2494
2493
  };
2495
2494
  const HorizontalBarChart = ({ data, valueType, total, showLegendInChart = true })=>{
2496
2495
  const chartData = processChartData$2(data, valueType, total);
2497
- const chartDefinition = useMemo(()=>{
2496
+ const chartDefinition = useDeepCompareMemo(()=>{
2498
2497
  return {
2499
2498
  tooltip: {
2500
2499
  trigger: 'item',
@@ -2536,12 +2535,17 @@ const HorizontalBarChart = ({ data, valueType, total, showLegendInChart = true }
2536
2535
  series: chartData
2537
2536
  };
2538
2537
  }, [
2539
- chartData
2538
+ chartData,
2539
+ showLegendInChart
2540
2540
  ]);
2541
2541
  return /*#__PURE__*/ jsx("div", {
2542
2542
  className: "w-full h-64",
2543
2543
  children: /*#__PURE__*/ jsx(ReactECharts, {
2544
- option: chartDefinition
2544
+ option: chartDefinition,
2545
+ settings: {
2546
+ notMerge: true,
2547
+ lazyUpdate: false
2548
+ }
2545
2549
  })
2546
2550
  });
2547
2551
  };
@@ -2569,7 +2573,11 @@ const ChartRendererFactory = ()=>{
2569
2573
  // TODO: add default chart chart for missing chart type
2570
2574
  const element = ChartRendererFactory().getRenderer('chart', type);
2571
2575
  return element({
2572
- ...chartProps
2576
+ total: chartProps.total,
2577
+ valueType: chartProps.valueType,
2578
+ label: chartProps.label,
2579
+ data: chartProps.data,
2580
+ showLegendInChart: chartProps.showLegendInChart
2573
2581
  }, parameters);
2574
2582
  };
2575
2583
 
@@ -2587,6 +2595,106 @@ const chartColors = [
2587
2595
  '#9a60b4',
2588
2596
  '#ea7ccc'
2589
2597
  ];
2598
+ const LegendRows = ({ data })=>{
2599
+ const moreThanMaxRows = data.length > MAX_LEGEND_ROWS;
2600
+ const limitedRows = moreThanMaxRows ? data.slice(0, MAX_LEGEND_ROWS) : data;
2601
+ return limitedRows.map((element, elIndex)=>/*#__PURE__*/ jsxs(Table.Tr, {
2602
+ children: [
2603
+ /*#__PURE__*/ jsxs(Table.Td, {
2604
+ children: [
2605
+ /*#__PURE__*/ jsx(ColorSwatch, {
2606
+ className: "inline-block mr-2 align-middle",
2607
+ size: "1em",
2608
+ radius: "xs",
2609
+ color: chartColors?.[elIndex % chartColors.length] || ''
2610
+ }),
2611
+ element.key
2612
+ ]
2613
+ }),
2614
+ /*#__PURE__*/ jsx(Table.Td, {
2615
+ className: "text-right",
2616
+ children: element.count
2617
+ })
2618
+ ]
2619
+ }, elIndex));
2620
+ };
2621
+ const LegendOverflow = ({ chart, data, chartTitle, counts })=>{
2622
+ const [openedMoreRows, { open: openMoreRows, close: closeMoreRows }] = useDisclosure(false);
2623
+ const theme = useMantineTheme();
2624
+ return /*#__PURE__*/ jsxs(React__default.Fragment, {
2625
+ children: [
2626
+ /*#__PURE__*/ jsx(Modal, {
2627
+ opened: openedMoreRows,
2628
+ onClose: closeMoreRows,
2629
+ title: chartTitle,
2630
+ size: "xl",
2631
+ children: /*#__PURE__*/ jsxs(Grid, {
2632
+ children: [
2633
+ /*#__PURE__*/ jsx(Grid.Col, {
2634
+ span: 6,
2635
+ children: createChart(chart.chartType, {
2636
+ data: data === undefined ? [] : data,
2637
+ total: counts ?? 1,
2638
+ valueType: chart.valueType ?? 'count',
2639
+ label: chart.label,
2640
+ showLegendInChart: chart.showLegendInChart
2641
+ })
2642
+ }, "modal-col-1"),
2643
+ /*#__PURE__*/ jsx(Grid.Col, {
2644
+ span: 6,
2645
+ children: /*#__PURE__*/ jsx("div", {
2646
+ className: "border-solid border-[1px] border-[var(--mantine-color-gray-3)] h-full p-1",
2647
+ children: /*#__PURE__*/ jsx(Table, {
2648
+ withRowBorders: false,
2649
+ classNames: {
2650
+ table: '',
2651
+ td: 'p-1 leading-3'
2652
+ },
2653
+ children: /*#__PURE__*/ jsx(Table.Tbody, {
2654
+ children: data.map((element, elIndex)=>/*#__PURE__*/ jsxs(Table.Tr, {
2655
+ children: [
2656
+ /*#__PURE__*/ jsxs(Table.Td, {
2657
+ children: [
2658
+ /*#__PURE__*/ jsx(ColorSwatch, {
2659
+ className: "inline-block mr-2 align-middle",
2660
+ size: "1em",
2661
+ radius: "xs",
2662
+ color: chartColors?.[elIndex % chartColors.length] || ''
2663
+ }),
2664
+ element.key
2665
+ ]
2666
+ }),
2667
+ /*#__PURE__*/ jsx(Table.Td, {
2668
+ className: "text-right",
2669
+ children: element.count
2670
+ })
2671
+ ]
2672
+ }, elIndex))
2673
+ })
2674
+ })
2675
+ })
2676
+ }, "modal-col-2")
2677
+ ]
2678
+ })
2679
+ }),
2680
+ /*#__PURE__*/ jsxs(Button, {
2681
+ variant: "subtle",
2682
+ onClick: openMoreRows,
2683
+ leftSection: /*#__PURE__*/ jsx(Icon, {
2684
+ icon: "gen3:open-in-modal",
2685
+ height: 24,
2686
+ width: 24,
2687
+ color: theme.colors.accent[5]
2688
+ }),
2689
+ className: "text-black hover:text-black",
2690
+ children: [
2691
+ data.length - MAX_LEGEND_ROWS,
2692
+ " more"
2693
+ ]
2694
+ })
2695
+ ]
2696
+ });
2697
+ };
2590
2698
  //The Charts component maps the data from ChartsProps into a grid of createChart() ReactNodes
2591
2699
  const Charts = ({ charts, data, counts, isSuccess, numCols = DEFAULT_COLS, style = 'tile', showLegends = false })=>{
2592
2700
  const spans = computeRowSpan(Object.keys(charts).length, numCols);
@@ -2597,109 +2705,10 @@ const Charts = ({ charts, data, counts, isSuccess, numCols = DEFAULT_COLS, style
2597
2705
  message: `${field} not found in data`
2598
2706
  });
2599
2707
  }
2600
- const LegendRows = ({ data })=>{
2601
- const moreThanMaxRows = data.length > MAX_LEGEND_ROWS;
2602
- const limitedRows = moreThanMaxRows ? data.slice(0, MAX_LEGEND_ROWS) : data;
2603
- return limitedRows.map((element, elIndex)=>/*#__PURE__*/ jsxs(Table.Tr, {
2604
- children: [
2605
- /*#__PURE__*/ jsxs(Table.Td, {
2606
- children: [
2607
- /*#__PURE__*/ jsx(ColorSwatch, {
2608
- className: "inline-block mr-2 align-middle",
2609
- size: "1em",
2610
- radius: "xs",
2611
- color: chartColors?.[elIndex % chartColors.length] || ''
2612
- }),
2613
- element.key
2614
- ]
2615
- }),
2616
- /*#__PURE__*/ jsx(Table.Td, {
2617
- className: "text-right",
2618
- children: element.count
2619
- })
2620
- ]
2621
- }, elIndex));
2622
- };
2623
- const LegendOverflow = ({ chart, data, chartTitle })=>{
2624
- const [openedMoreRows, { open: openMoreRows, close: closeMoreRows }] = useDisclosure(false);
2625
- const theme = useMantineTheme();
2626
- return /*#__PURE__*/ jsxs(React__default.Fragment, {
2627
- children: [
2628
- /*#__PURE__*/ jsx(Modal, {
2629
- opened: openedMoreRows,
2630
- onClose: closeMoreRows,
2631
- title: chartTitle,
2632
- size: "xl",
2633
- children: /*#__PURE__*/ jsxs(Grid, {
2634
- children: [
2635
- /*#__PURE__*/ jsx(Grid.Col, {
2636
- span: 6,
2637
- children: createChart(chart.chartType, {
2638
- data: data === undefined ? [] : data,
2639
- total: counts ?? 1,
2640
- valueType: chart.valueType ?? 'count',
2641
- label: chart.label,
2642
- showLegendInChart: chart.showLegendInChart
2643
- })
2644
- }, "modal-col-1"),
2645
- /*#__PURE__*/ jsx(Grid.Col, {
2646
- span: 6,
2647
- children: /*#__PURE__*/ jsx("div", {
2648
- className: "border-solid border-[1px] border-[var(--mantine-color-gray-3)] h-full p-1",
2649
- children: /*#__PURE__*/ jsx(Table, {
2650
- withRowBorders: false,
2651
- classNames: {
2652
- table: '',
2653
- td: 'p-1 leading-3'
2654
- },
2655
- children: /*#__PURE__*/ jsx(Table.Tbody, {
2656
- children: data.map((element, elIndex)=>/*#__PURE__*/ jsxs(Table.Tr, {
2657
- children: [
2658
- /*#__PURE__*/ jsxs(Table.Td, {
2659
- children: [
2660
- /*#__PURE__*/ jsx(ColorSwatch, {
2661
- className: "inline-block mr-2 align-middle",
2662
- size: "1em",
2663
- radius: "xs",
2664
- color: chartColors?.[elIndex % chartColors.length] || ''
2665
- }),
2666
- element.key
2667
- ]
2668
- }),
2669
- /*#__PURE__*/ jsx(Table.Td, {
2670
- className: "text-right",
2671
- children: element.count
2672
- })
2673
- ]
2674
- }, elIndex))
2675
- })
2676
- })
2677
- })
2678
- }, "modal-col-2")
2679
- ]
2680
- })
2681
- }),
2682
- /*#__PURE__*/ jsxs(Button, {
2683
- variant: "subtle",
2684
- onClick: openMoreRows,
2685
- leftSection: /*#__PURE__*/ jsx(Icon, {
2686
- icon: "gen3:open-in-modal",
2687
- height: 24,
2688
- width: 24,
2689
- color: theme.colors.accent[5]
2690
- }),
2691
- className: "text-black hover:text-black",
2692
- children: [
2693
- data.length - MAX_LEGEND_ROWS,
2694
- " more"
2695
- ]
2696
- })
2697
- ]
2698
- });
2699
- };
2700
2708
  const dataKeys = field in data && data?.[field].length > 0 ? Object.keys(data[field][0]) : [];
2701
2709
  const chartTitle = charts[field].title ?? fieldNameToTitle(field);
2702
- const moreThanMaxRows = data?.[field] && data[field].length > MAX_LEGEND_ROWS;
2710
+ const numberOfDataItems = data?.[field] && data[field].length;
2711
+ const moreThanMaxRows = numberOfDataItems > MAX_LEGEND_ROWS;
2703
2712
  return /*#__PURE__*/ jsx(Grid.Col, {
2704
2713
  span: spans[indexNum],
2705
2714
  children: /*#__PURE__*/ jsxs(Card, {
@@ -2730,7 +2739,7 @@ const Charts = ({ charts, data, counts, isSuccess, numCols = DEFAULT_COLS, style
2730
2739
  label: charts[field].label,
2731
2740
  showLegendInChart: charts[field].showLegendInChart
2732
2741
  }),
2733
- showLegends && /*#__PURE__*/ jsx(Card.Section, {
2742
+ numberOfDataItems > 0 && showLegends && /*#__PURE__*/ jsx(Card.Section, {
2734
2743
  inheritPadding: true,
2735
2744
  py: "xs",
2736
2745
  withBorder: style === 'box',
@@ -2768,7 +2777,8 @@ const Charts = ({ charts, data, counts, isSuccess, numCols = DEFAULT_COLS, style
2768
2777
  children: /*#__PURE__*/ jsx(LegendOverflow, {
2769
2778
  chart: charts[field],
2770
2779
  data: data[field],
2771
- chartTitle: chartTitle
2780
+ chartTitle: chartTitle,
2781
+ counts: counts ?? 0
2772
2782
  })
2773
2783
  })
2774
2784
  ]
@@ -2781,7 +2791,7 @@ const Charts = ({ charts, data, counts, isSuccess, numCols = DEFAULT_COLS, style
2781
2791
  });
2782
2792
  };
2783
2793
 
2784
- const CollapsableCharts = ({ config, data })=>{
2794
+ const CollapsableCharts = ({ config, data, isError, isFetching, isSuccess })=>{
2785
2795
  const [showLegends, setShowLegends] = useState(config.showLegends?.enabled);
2786
2796
  if (!(config?.charts && Object.keys(config.charts).length > 0)) {
2787
2797
  return /*#__PURE__*/ jsx(Center, {
@@ -2833,7 +2843,7 @@ const CollapsableCharts = ({ config, data })=>{
2833
2843
  charts: config.charts,
2834
2844
  data: data,
2835
2845
  counts: 2,
2836
- isSuccess: true,
2846
+ isSuccess: isSuccess,
2837
2847
  numCols: 4
2838
2848
  })
2839
2849
  })
@@ -3145,6 +3155,8 @@ const classifyFacets = (data, index, fieldMapping = [], facetDefinitionsFromConf
3145
3155
  label: facetDef.label ?? facetName,
3146
3156
  // assumption is that the initial data has the min and max values
3147
3157
  sharedWithIndices: (sharedFieldMapping && fieldKey in sharedFieldMapping && sharedFieldMapping[fieldKey].filter((x)=>x.index !== index)) ?? undefined,
3158
+ moveValuesToBottom: facetDef?.moveValuesToBottom,
3159
+ excludeValues: facetDef?.excludeValues,
3148
3160
  range: facetDef.range ?? type === 'range' ? {
3149
3161
  minimum: Math.floor(Number(value[0].key[0])),
3150
3162
  maximum: Math.ceil(Number(value[0].key[1]))
@@ -3323,6 +3335,22 @@ const convertToStringArray = (inputArray)=>inputArray.map(String);
3323
3335
  * @param {FacetSortType} facetSort - The facet sort type represented as a string in the format "type-direction".
3324
3336
  * @returns {SortType} - The mapped sort type object containing type and direction.
3325
3337
  */ const mapFacetSortToSortType = (facetSort)=>{
3338
+ // Default fallback values
3339
+ const defaultSort = {
3340
+ type: 'value',
3341
+ direction: 'dsc'
3342
+ };
3343
+ // Validate input
3344
+ if (!facetSort) {
3345
+ console.warn(`Invalid facetSort: expected string, got ${typeof facetSort}. Using default.`);
3346
+ return defaultSort;
3347
+ }
3348
+ const parts = facetSort.split('-');
3349
+ // Check if we have exactly 2 parts
3350
+ if (parts.length !== 2) {
3351
+ console.warn(`Invalid facetSort format: expected 'type-direction', got '${facetSort}'. Using default.`);
3352
+ return defaultSort;
3353
+ }
3326
3354
  const [type, direction] = facetSort.split('-');
3327
3355
  return {
3328
3356
  type: type === 'label' ? 'alpha' : 'value',
@@ -3397,6 +3425,173 @@ const DEFAULT_MAXIMUM = 100;
3397
3425
  const BAD_DATA_MESSAGE = 'No data for this field';
3398
3426
  const DAYS_IN_YEAR = 365.25;
3399
3427
 
3428
+ const SegmentedControl = (props)=>{
3429
+ return /*#__PURE__*/ jsx(SegmentedControl$1, {
3430
+ classNames: {
3431
+ root: 'bg-base-max h-fit p-0',
3432
+ indicator: 'opacity-0',
3433
+ 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',
3434
+ 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
3435
+ border-1 border-r-0 !border-primary rounded-none data-disabled:!border-base-lighter`
3436
+ },
3437
+ ...props
3438
+ });
3439
+ };
3440
+
3441
+ const ExpanderLabel = tw.div`
3442
+ text-accent-content-darker
3443
+ p-1
3444
+ font-bold
3445
+ cursor-pointer
3446
+ text-xs
3447
+ font-content
3448
+ `;
3449
+ /**
3450
+ * Component which manages the compact/expanded state of a FacetCard
3451
+ * @param remainingValues - number of remaining values when compact "show 4"
3452
+ * @param isGroupExpanded - true if expanded, false if compact
3453
+ * @param onShowChanged - callback to call when the expand/compact button is clicked
3454
+ */ const FacetExpander = ({ remainingValues, isGroupExpanded, onShowChanged })=>{
3455
+ return /*#__PURE__*/ jsx("div", {
3456
+ className: `mt-3 flex flex-row justify-end ${remainingValues > 0 && 'border-t-2'} p-1.5`,
3457
+ children: remainingValues > 0 && !isGroupExpanded ? /*#__PURE__*/ jsx("button", {
3458
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3459
+ "data-testid": "plus-icon",
3460
+ children: /*#__PURE__*/ jsxs("div", {
3461
+ className: "flex flex-row flex-nowrap items-center ",
3462
+ children: [
3463
+ /*#__PURE__*/ jsx(MdAddCircle, {
3464
+ className: "text-accent",
3465
+ size: "1rem",
3466
+ "aria-hidden": "true"
3467
+ }, "show-more"),
3468
+ /*#__PURE__*/ jsxs(ExpanderLabel, {
3469
+ children: [
3470
+ remainingValues,
3471
+ " more"
3472
+ ]
3473
+ })
3474
+ ]
3475
+ })
3476
+ }) : isGroupExpanded ? /*#__PURE__*/ jsx("button", {
3477
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3478
+ "data-testid": "minus-icon",
3479
+ children: /*#__PURE__*/ jsxs("div", {
3480
+ className: "flex flex-row flex-nowrap items-center",
3481
+ children: [
3482
+ /*#__PURE__*/ jsx(MdRemoveCircle, {
3483
+ className: "text-accent",
3484
+ size: "1rem",
3485
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3486
+ "aria-hidden": "true"
3487
+ }, "show-less"),
3488
+ /*#__PURE__*/ jsx(ExpanderLabel, {
3489
+ children: "show less"
3490
+ })
3491
+ ]
3492
+ })
3493
+ }) : null
3494
+ });
3495
+ };
3496
+
3497
+ const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
3498
+ if (sortTypeAndDirection.type === 'alpha') {
3499
+ return sortTypeAndDirection.direction === 'asc' ? `The ${field} names are now sorted alphabetically ascending` : `The ${field} names are now sorted alphabetically descending`;
3500
+ } else {
3501
+ return sortTypeAndDirection.direction === 'asc' ? `The ${field} ${valueLabel} are now sorted numerically ascending` : `The ${field} ${valueLabel} are now sorted numerically descending`;
3502
+ }
3503
+ };
3504
+ /**
3505
+ * FacetCards "sort" header supporting sort by A-Z or by Value both ascending and descending
3506
+ * @param sortType - current sort type
3507
+ * @param valueLabel - Value labels, typically "case" "file"
3508
+ * @param setSort - sets the sort type and direction
3509
+ * @param field - specifies the facet table name
3510
+ */ const FacetSortPanel = ({ sortType, valueLabel, setSort, field })=>{
3511
+ const liveRegionRef = useRef(null);
3512
+ const [sortingStatus, setSortingStatus] = useState('');
3513
+ useEffect(()=>{
3514
+ if (sortingStatus && liveRegionRef?.current) {
3515
+ liveRegionRef.current.textContent = sortingStatus;
3516
+ }
3517
+ }, [
3518
+ sortingStatus
3519
+ ]);
3520
+ const [NameSortIcon, nameIconSize] = sortType.type === 'alpha' ? sortType.direction === 'asc' ? [
3521
+ PiCaretUpFill,
3522
+ '0.75rem'
3523
+ ] : [
3524
+ PiCaretDownFill,
3525
+ '0.75rem'
3526
+ ] : [
3527
+ PiCaretUpDownFill,
3528
+ '1rem'
3529
+ ];
3530
+ const [ValueSortIcon, valueIconSize] = sortType.type === 'value' ? sortType.direction === 'asc' ? [
3531
+ PiCaretUpFill,
3532
+ '0.75rem'
3533
+ ] : [
3534
+ PiCaretDownFill,
3535
+ '0.75rem'
3536
+ ] : [
3537
+ PiCaretUpDownFill,
3538
+ '1rem'
3539
+ ];
3540
+ return /*#__PURE__*/ jsxs("div", {
3541
+ className: "flex flex-row items-center justify-between flex-wrap py-1 px-2 mb-1 border-b-2",
3542
+ children: [
3543
+ /*#__PURE__*/ jsx(Button, {
3544
+ className: "pl-0 ml-0 api-hovered:accent",
3545
+ variant: "transparent",
3546
+ size: "compact-xs",
3547
+ color: "base-contrast.5",
3548
+ onClick: ()=>{
3549
+ const direction = sortType.type === 'alpha' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3550
+ const sortObj = {
3551
+ type: 'alpha',
3552
+ direction
3553
+ };
3554
+ setSort(sortObj);
3555
+ setSortingStatus(sortTypeToAriaDescription(sortObj, 'Name', field));
3556
+ },
3557
+ rightSection: /*#__PURE__*/ jsx(NameSortIcon, {
3558
+ size: nameIconSize,
3559
+ "aria-hidden": "true"
3560
+ }),
3561
+ "aria-label": "Sort name alphabetically",
3562
+ children: "Name"
3563
+ }),
3564
+ /*#__PURE__*/ jsx(Button, {
3565
+ className: "pr-0 mr-0",
3566
+ variant: "transparent",
3567
+ size: "compact-xs",
3568
+ color: "base-contrast.5",
3569
+ onClick: ()=>{
3570
+ const direction = sortType.type === 'value' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3571
+ const sortObj = {
3572
+ type: 'value',
3573
+ direction
3574
+ };
3575
+ setSort(sortObj);
3576
+ setSortingStatus(sortTypeToAriaDescription(sortObj, valueLabel, field));
3577
+ },
3578
+ rightSection: /*#__PURE__*/ jsx(ValueSortIcon, {
3579
+ size: valueIconSize,
3580
+ "aria-hidden": "true"
3581
+ }),
3582
+ "aria-label": `Sort ${valueLabel} numerically`,
3583
+ children: valueLabel
3584
+ }),
3585
+ /*#__PURE__*/ jsx("span", {
3586
+ id: `${field}-liveRegion`,
3587
+ "aria-live": "polite",
3588
+ ref: liveRegionRef,
3589
+ className: "sr-only"
3590
+ })
3591
+ ]
3592
+ });
3593
+ };
3594
+
3400
3595
  const FacetIconButton = tw.button`
3401
3596
  text-base-max
3402
3597
  font-bold
@@ -3603,104 +3798,6 @@ flex items-start justify-between items-center flex-nowrap bg-secondary px-1.5 ro
3603
3798
  });
3604
3799
  };
3605
3800
 
3606
- const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
3607
- if (sortTypeAndDirection.type === 'alpha') {
3608
- return sortTypeAndDirection.direction === 'asc' ? `The ${field} names are now sorted alphabetically ascending` : `The ${field} names are now sorted alphabetically descending`;
3609
- } else {
3610
- return sortTypeAndDirection.direction === 'asc' ? `The ${field} ${valueLabel} are now sorted numerically ascending` : `The ${field} ${valueLabel} are now sorted numerically descending`;
3611
- }
3612
- };
3613
- /**
3614
- * FacetCards "sort" header supporting sort by A-Z or by Value both ascending and descending
3615
- * @param sortType - current sort type
3616
- * @param valueLabel - Value labels, typically "case" "file"
3617
- * @param setSort - sets the sort type and direction
3618
- * @param field - specifies the facet table name
3619
- */ const FacetSortPanel = ({ sortType, valueLabel, setSort, field })=>{
3620
- const liveRegionRef = useRef(null);
3621
- const [sortingStatus, setSortingStatus] = useState('');
3622
- useEffect(()=>{
3623
- if (sortingStatus && liveRegionRef?.current) {
3624
- liveRegionRef.current.textContent = sortingStatus;
3625
- }
3626
- }, [
3627
- sortingStatus
3628
- ]);
3629
- const [NameSortIcon, nameIconSize] = sortType.type === 'alpha' ? sortType.direction === 'asc' ? [
3630
- PiCaretUpFill,
3631
- '0.75rem'
3632
- ] : [
3633
- PiCaretDownFill,
3634
- '0.75rem'
3635
- ] : [
3636
- PiCaretUpDownFill,
3637
- '1rem'
3638
- ];
3639
- const [ValueSortIcon, valueIconSize] = sortType.type === 'value' ? sortType.direction === 'asc' ? [
3640
- PiCaretUpFill,
3641
- '0.75rem'
3642
- ] : [
3643
- PiCaretDownFill,
3644
- '0.75rem'
3645
- ] : [
3646
- PiCaretUpDownFill,
3647
- '1rem'
3648
- ];
3649
- return /*#__PURE__*/ jsxs("div", {
3650
- className: "flex flex-row items-center justify-between flex-wrap py-1 px-2 mb-1 border-b-2",
3651
- children: [
3652
- /*#__PURE__*/ jsx(Button, {
3653
- className: "pl-0 ml-0 api-hovered:accent",
3654
- variant: "transparent",
3655
- size: "compact-xs",
3656
- color: "base-contrast.5",
3657
- onClick: ()=>{
3658
- const direction = sortType.type === 'alpha' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3659
- const sortObj = {
3660
- type: 'alpha',
3661
- direction
3662
- };
3663
- setSort(sortObj);
3664
- setSortingStatus(sortTypeToAriaDescription(sortObj, 'Name', field));
3665
- },
3666
- rightSection: /*#__PURE__*/ jsx(NameSortIcon, {
3667
- size: nameIconSize,
3668
- "aria-hidden": "true"
3669
- }),
3670
- "aria-label": "Sort name alphabetically",
3671
- children: "Name"
3672
- }),
3673
- /*#__PURE__*/ jsx(Button, {
3674
- className: "pr-0 mr-0",
3675
- variant: "transparent",
3676
- size: "compact-xs",
3677
- color: "base-contrast.5",
3678
- onClick: ()=>{
3679
- const direction = sortType.type === 'value' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3680
- const sortObj = {
3681
- type: 'value',
3682
- direction
3683
- };
3684
- setSort(sortObj);
3685
- setSortingStatus(sortTypeToAriaDescription(sortObj, valueLabel, field));
3686
- },
3687
- rightSection: /*#__PURE__*/ jsx(ValueSortIcon, {
3688
- size: valueIconSize,
3689
- "aria-hidden": "true"
3690
- }),
3691
- "aria-label": `Sort ${valueLabel} numerically`,
3692
- children: valueLabel
3693
- }),
3694
- /*#__PURE__*/ jsx("span", {
3695
- id: `${field}-liveRegion`,
3696
- "aria-live": "polite",
3697
- ref: liveRegionRef,
3698
- className: "sr-only"
3699
- })
3700
- ]
3701
- });
3702
- };
3703
-
3704
3801
  const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
3705
3802
  const [showTooltip, setShowTooltip] = useState(false);
3706
3803
  return /*#__PURE__*/ jsx(Tooltip, {
@@ -3731,63 +3828,7 @@ const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-
3731
3828
  });
3732
3829
  };
3733
3830
 
3734
- const ExpanderLabel = tw.div`
3735
- text-accent-content-darker
3736
- p-1
3737
- font-bold
3738
- cursor-pointer
3739
- text-xs
3740
- font-content
3741
- `;
3742
- /**
3743
- * Component which manages the compact/expanded state of a FacetCard
3744
- * @param remainingValues - number of remaining values when compact "show 4"
3745
- * @param isGroupExpanded - true if expanded, false if compact
3746
- * @param onShowChanged - callback to call when the expand/compact button is clicked
3747
- */ const FacetExpander = ({ remainingValues, isGroupExpanded, onShowChanged })=>{
3748
- return /*#__PURE__*/ jsx("div", {
3749
- className: `mt-3 flex flex-row justify-end ${remainingValues > 0 && 'border-t-2'} p-1.5`,
3750
- children: remainingValues > 0 && !isGroupExpanded ? /*#__PURE__*/ jsx("button", {
3751
- onClick: ()=>onShowChanged(!isGroupExpanded),
3752
- "data-testid": "plus-icon",
3753
- children: /*#__PURE__*/ jsxs("div", {
3754
- className: "flex flex-row flex-nowrap items-center ",
3755
- children: [
3756
- /*#__PURE__*/ jsx(MdAddCircle, {
3757
- className: "text-accent",
3758
- size: "1rem",
3759
- "aria-hidden": "true"
3760
- }, "show-more"),
3761
- /*#__PURE__*/ jsxs(ExpanderLabel, {
3762
- children: [
3763
- remainingValues,
3764
- " more"
3765
- ]
3766
- })
3767
- ]
3768
- })
3769
- }) : isGroupExpanded ? /*#__PURE__*/ jsx("button", {
3770
- onClick: ()=>onShowChanged(!isGroupExpanded),
3771
- "data-testid": "minus-icon",
3772
- children: /*#__PURE__*/ jsxs("div", {
3773
- className: "flex flex-row flex-nowrap items-center",
3774
- children: [
3775
- /*#__PURE__*/ jsx(MdRemoveCircle, {
3776
- className: "text-accent",
3777
- size: "1rem",
3778
- onClick: ()=>onShowChanged(!isGroupExpanded),
3779
- "aria-hidden": "true"
3780
- }, "show-less"),
3781
- /*#__PURE__*/ jsx(ExpanderLabel, {
3782
- children: "show less"
3783
- })
3784
- ]
3785
- })
3786
- }) : null
3787
- });
3788
- };
3789
-
3790
- const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true, sort = 'value-dsc' })=>{
3831
+ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true, sort = 'value-dsc', moveValuesToBottom = [], excludeValues = [] })=>{
3791
3832
  const [isGroupExpanded, setIsGroupExpanded] = useState(false);
3792
3833
  const cardRef = useRef(null);
3793
3834
  const searchInputRef = useRef(null);
@@ -3844,7 +3885,7 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3844
3885
  ];
3845
3886
  updateFacetEnum(field, updated, updateFacetFilters, clearFilters, combineMode);
3846
3887
  } else {
3847
- const updated = selectedEnums?.filter((x)=>x != value);
3888
+ const updated = selectedEnums?.filter((x)=>x !== value);
3848
3889
  updateFacetEnum(field, updated ?? [], updateFacetFilters, clearFilters, combineMode);
3849
3890
  }
3850
3891
  };
@@ -3881,7 +3922,7 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3881
3922
  useDeepCompareEffect(()=>{
3882
3923
  if (isSuccess && data) {
3883
3924
  // get all the data except the missing and empty values
3884
- const tempFilteredData = Object.entries(data).filter((entry)=>entry[0] != '_missing' && entry[0] != '').filter((entry)=>searchTerm === '' ? entry : entry[0].toLowerCase().includes(searchTerm.toLowerCase().trim()));
3925
+ const tempFilteredData = Object.entries(data).filter((entry)=>entry[0] !== '_missing' && entry[0] !== '').filter((entry)=>searchTerm === '' ? entry : entry[0].toLowerCase().includes(searchTerm.toLowerCase().trim()));
3885
3926
  // it is possible that the selected enums are not in the data as their counts are 0
3886
3927
  // therefore we need to add them to the data
3887
3928
  const selectedEnumNotInData = selectedEnums ? selectedEnums.reduce((acc, curr)=>{
@@ -3896,16 +3937,16 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3896
3937
  const remainingValues = tempFilteredData.length + selectedEnumNotInData.length - maxValuesToDisplay;
3897
3938
  const cardStyle = calcCardStyle(remainingValues);
3898
3939
  const numberOfBarsToDisplay = calcNumberOfBarsToDisplay(tempFilteredData.length + selectedEnumNotInData.length);
3940
+ const allData = [
3941
+ ...tempFilteredData,
3942
+ ...selectedEnumNotInData
3943
+ ];
3944
+ // remove any enum in excludeValues
3945
+ const filteredData = allData.filter((x)=>!excludeValues?.includes(x[0].toString()));
3899
3946
  setFacetChartData((prevFacetChartData)=>({
3900
3947
  ...prevFacetChartData,
3901
- filteredData: [
3902
- ...tempFilteredData,
3903
- ...selectedEnumNotInData
3904
- ],
3905
- filteredDataObj: Object.fromEntries([
3906
- ...tempFilteredData,
3907
- ...selectedEnumNotInData
3908
- ]),
3948
+ filteredData: filteredData,
3949
+ filteredDataObj: Object.fromEntries(filteredData),
3909
3950
  remainingValues,
3910
3951
  numberOfBarsToDisplay,
3911
3952
  isSuccess: true,
@@ -3931,8 +3972,9 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3931
3972
  useDeepCompareEffect(()=>{
3932
3973
  if (facetChartData.filteredData && facetChartData.filteredData.length > 0) {
3933
3974
  const obj = [
3934
- ...facetChartData.filteredData
3935
- ].sort(sortType.type === 'value' ? ([, a], [, b])=>sortType.direction === 'dsc' ? b - a : a - b : ([a], [b])=>sortType.direction === 'dsc' ? compareKeysDescending(a, b) : compareKeysAscending(a, b)).slice(0, !isGroupExpanded ? maxValuesToDisplay : undefined);
3975
+ ...facetChartData.filteredData.filter((x)=>!moveValuesToBottom.includes(x[0].toString())).sort(sortType.type === 'value' ? ([, a], [, b])=>sortType.direction === 'dsc' ? b - a : a - b : ([a], [b])=>sortType.direction === 'dsc' ? compareKeysDescending(a, b) : compareKeysAscending(a, b)),
3976
+ ...facetChartData.filteredData.filter((x)=>moveValuesToBottom.includes(x[0].toString()))
3977
+ ].slice(0, !isGroupExpanded ? maxValuesToDisplay : undefined);
3936
3978
  setSortedData(obj);
3937
3979
  if (updateVisibleValues) updateVisibleValues(obj);
3938
3980
  }
@@ -3975,7 +4017,7 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3975
4017
  children: /*#__PURE__*/ jsxs("div", {
3976
4018
  className: "flex items-center space-x-1 mt-1",
3977
4019
  children: [
3978
- /*#__PURE__*/ jsx(SegmentedControl, {
4020
+ /*#__PURE__*/ jsx(SegmentedControl$1, {
3979
4021
  classNames: {
3980
4022
  root: 'border-1 border-accent rounded-l-md rounded-r-md',
3981
4023
  control: 'p-0 m-0',
@@ -4145,7 +4187,7 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
4145
4187
  });
4146
4188
  };
4147
4189
 
4148
- const EnumFacet = ({ field, hooks, valueLabel, description, facetName, showPercent = true, hideIfEmpty = true, showSearch = true, showFlip = false, showSettings = false, startShowingData = true, dismissCallback = undefined, width = undefined, sharedWithIndices = undefined, header = {
4190
+ const EnumFacet = ({ field, hooks, valueLabel, description, facetName, showPercent = true, hideIfEmpty = true, showSearch = true, showFlip = false, showSettings = false, startShowingData = true, dismissCallback = undefined, width = undefined, sharedWithIndices = undefined, moveValuesToBottom = [], excludeValues = [], header = {
4149
4191
  Panel: FacetHeader,
4150
4192
  Label: FacetText,
4151
4193
  iconStyle: controlsIconStyle
@@ -4196,201 +4238,63 @@ const EnumFacet = ({ field, hooks, valueLabel, description, facetName, showPerce
4196
4238
  isFacetView: isFacetView,
4197
4239
  isSearching: isSearching,
4198
4240
  hideIfEmpty: hideIfEmpty,
4199
- showPercent: showPercent
4241
+ showPercent: showPercent,
4242
+ moveValuesToBottom: moveValuesToBottom,
4243
+ excludeValues: excludeValues
4200
4244
  })
4201
4245
  })
4202
4246
  ]
4203
4247
  });
4204
4248
  };
4205
4249
 
4206
- const instanceOfIncludesExcludes$1 = (op)=>[
4207
- 'in'
4208
- ].includes(op.operator); // TODO: Guppy does not support excludes
4209
- /**
4210
- * Extracts the operands if the operation isIncludes or Excludes. Returns an empty Array
4211
- * if filter is not the correct type.
4212
- * @param operation - filters to extract values from
4213
- */ const extractValues = (operation)=>{
4214
- if (operation && instanceOfIncludesExcludes$1(operation)) {
4215
- return operation.operands;
4216
- }
4217
- return [];
4218
- };
4219
- /**
4220
- * Exact value facet component
4221
- * @param field - field to facet on
4222
- * @param description - description of the facet
4223
- * @param facetName - name of the facet
4224
- * @param dismissCallback - callback function to dismiss the facet
4225
- * @param width - width of the facet
4226
- * @param hooks - hooks to use for the facet
4227
- * @param header - header components
4228
- * @category Facets
4229
- */ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks, header = {
4250
+ const createBucket = (field, lower, upper)=>({
4251
+ operator: 'and',
4252
+ operands: [
4253
+ {
4254
+ field,
4255
+ operator: '>=',
4256
+ operand: lower
4257
+ },
4258
+ {
4259
+ field,
4260
+ operator: '<=',
4261
+ operand: upper
4262
+ }
4263
+ ]
4264
+ });
4265
+ const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum = DEFAULT_MINIMUM, maximum = DEFAULT_MAXIMUM, showSearch = false, showFlip = false, showSettings = false, dismissCallback = undefined, width = undefined, header = {
4230
4266
  Panel: FacetHeader,
4231
4267
  Label: FacetText,
4232
4268
  iconStyle: controlsIconStyle
4233
4269
  } })=>{
4234
- const [textValue, setTextValue] = useState(''); // Handle the state of the TextInput
4235
- const clearFilters = hooks.useClearFilter();
4236
- const updateFacetFilters = hooks.useUpdateFacetFilters();
4237
- const facetTitle = facetName ? facetName : trimFirstFieldNameToTitle(field, true);
4238
- const facetValue = hooks.useGetFacetFilters(field);
4239
- const textValues = useMemo(()=>extractValues(facetValue), [
4240
- facetValue
4241
- ]);
4242
- const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4243
- const showFilters = isFilterExpanded === undefined || isFilterExpanded;
4244
- const setValues = (values)=>{
4245
- if (values.length > 0) {
4246
- if (facetValue && instanceOfIncludesExcludes$1(facetValue)) {
4247
- // updating facet value
4248
- updateFacetFilters(field, {
4249
- ...facetValue,
4250
- operands: values
4251
- });
4252
- }
4253
- if (facetValue === undefined) {
4254
- // TODO: Assuming Includes by default but this might change to Include|Excludes
4255
- updateFacetFilters(field, {
4256
- operator: 'in',
4257
- field: field,
4258
- operands: values
4259
- });
4260
- }
4261
- } else {
4262
- clearFilters(field);
4263
- }
4264
- };
4265
- const addValue = (s)=>{
4266
- if (s === '') return;
4267
- if (textValues.includes(s)) return;
4268
- setTextValue('');
4269
- setValues([
4270
- ...textValues,
4271
- s
4272
- ]);
4273
- };
4274
- const removeButton = (x)=>{
4275
- return /*#__PURE__*/ jsx(ActionIcon, {
4276
- size: "xs",
4277
- color: "white",
4278
- radius: "xl",
4279
- variant: "transparent",
4280
- onClick: ()=>setValues(textValues.filter((i)=>i !== x)),
4281
- children: /*#__PURE__*/ jsx(MdClose, {
4282
- size: 10,
4283
- "aria-label": "remove value from filter"
4284
- })
4285
- });
4286
- };
4287
- return /*#__PURE__*/ jsxs("div", {
4288
- className: `flex flex-col ${width ? width : 'mx-0'} bg-base-max relative border-base-lighter border-1 rounded-md text-xs transition`,
4289
- children: [
4290
- /*#__PURE__*/ jsx(FacetControlsHeader, {
4291
- field: field,
4292
- description: description,
4293
- hooks: hooks,
4294
- facetName: facetName,
4295
- dismissCallback: dismissCallback,
4296
- header: header
4297
- }),
4298
- /*#__PURE__*/ jsxs("div", {
4299
- className: showFilters ? 'h-full' : 'h-0 invisible',
4300
- "aria-hidden": !showFilters,
4301
- children: [
4302
- /*#__PURE__*/ jsxs("div", {
4303
- className: "flex flex-nowrap items-center p-2",
4304
- children: [
4305
- /*#__PURE__*/ jsx(TextInput, {
4306
- "data-testid": "textbox-add-filter-value",
4307
- size: "sm",
4308
- placeholder: `Enter ${facetTitle}`,
4309
- classNames: {
4310
- root: 'grow',
4311
- input: 'border-r-0 rounded-r-none py-1'
4312
- },
4313
- "aria-label": "enter value to add filter",
4314
- value: textValue,
4315
- onChange: (event)=>setTextValue(event.currentTarget.value)
4316
- }),
4317
- /*#__PURE__*/ jsx(ActionIcon, {
4318
- size: "lg",
4319
- "aria-label": "add string value",
4320
- className: "bg-accent text-accent-contrast border-base-min border-1 rounded-l-none h-[30px]",
4321
- onClick: ()=>{
4322
- if (textValue.length > 0) addValue(textValue.trim());
4323
- },
4324
- children: /*#__PURE__*/ jsx(FaPlus, {})
4325
- })
4326
- ]
4327
- }),
4328
- /*#__PURE__*/ jsx(Group, {
4329
- gap: "xs",
4330
- className: "px-2 py-2 max-h-96 overflow-y-auto",
4331
- "data-testid": "values group",
4332
- children: textValues.map((x)=>/*#__PURE__*/ jsx(Badge, {
4333
- size: "sm",
4334
- variant: "filled",
4335
- color: "accent",
4336
- rightSection: removeButton(x),
4337
- children: x
4338
- }, x))
4339
- })
4340
- ]
4341
- })
4342
- ]
4343
- });
4344
- };
4345
-
4346
- const createBucket = (field, lower, upper)=>({
4347
- operator: 'and',
4348
- operands: [
4349
- {
4350
- field,
4351
- operator: '>=',
4352
- operand: lower
4353
- },
4354
- {
4355
- field,
4356
- operator: '<=',
4357
- operand: upper
4358
- }
4359
- ]
4360
- });
4361
- const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum = DEFAULT_MINIMUM, maximum = DEFAULT_MAXIMUM, showSearch = false, showFlip = false, showSettings = false, dismissCallback = undefined, width = undefined, header = {
4362
- Panel: FacetHeader,
4363
- Label: FacetText,
4364
- iconStyle: controlsIconStyle
4365
- } })=>{
4366
- const { data, rangeFilters, isSuccess } = hooks.useGetFacetData(field);
4367
- const [minMaxValue, setMinMaxValue] = React__default.useState({
4368
- from: minimum,
4369
- to: maximum
4370
- });
4371
- const clearRangeFilterFromCohort = hooks.useClearFilter();
4372
- useCallback(()=>{
4373
- setMinMaxValue({
4374
- from: minimum,
4375
- to: maximum
4376
- });
4377
- clearRangeFilterFromCohort(field);
4378
- }, [
4379
- clearRangeFilterFromCohort,
4380
- field,
4381
- maximum,
4382
- minimum
4383
- ]);
4384
- const updateRangeFilter = hooks.useUpdateFacetFilters();
4385
- const updateFilters = useCallback((from, to)=>{
4386
- updateRangeFilter(field, createBucket(field, from, to));
4387
- setMinMaxValue({
4388
- from: from,
4389
- to: to
4390
- });
4391
- }, [
4392
- field,
4393
- updateRangeFilter
4270
+ const { data, rangeFilters, isSuccess } = hooks.useGetFacetData(field);
4271
+ const [minMaxValue, setMinMaxValue] = React__default.useState({
4272
+ from: minimum,
4273
+ to: maximum
4274
+ });
4275
+ const clearRangeFilterFromCohort = hooks.useClearFilter();
4276
+ useCallback(()=>{
4277
+ setMinMaxValue({
4278
+ from: minimum,
4279
+ to: maximum
4280
+ });
4281
+ clearRangeFilterFromCohort(field);
4282
+ }, [
4283
+ clearRangeFilterFromCohort,
4284
+ field,
4285
+ maximum,
4286
+ minimum
4287
+ ]);
4288
+ const updateRangeFilter = hooks.useUpdateFacetFilters();
4289
+ const updateFilters = useCallback((from, to)=>{
4290
+ updateRangeFilter(field, createBucket(field, from, to));
4291
+ setMinMaxValue({
4292
+ from: from,
4293
+ to: to
4294
+ });
4295
+ }, [
4296
+ field,
4297
+ updateRangeFilter
4394
4298
  ]);
4395
4299
  const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4396
4300
  const showFilters = isFilterExpanded === undefined || isFilterExpanded;
@@ -4471,7 +4375,7 @@ const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum
4471
4375
  });
4472
4376
  };
4473
4377
 
4474
- const instanceOfIncludesExcludes = (op)=>[
4378
+ const instanceOfIncludesExcludes$1 = (op)=>[
4475
4379
  'in'
4476
4380
  ].includes(op.operator); // TODO: Guppy does not support excludes
4477
4381
  const isOperandsObject = (obj)=>{
@@ -4520,7 +4424,7 @@ const isFacetEmpty = (op)=>{
4520
4424
  useDeepCompareEffect(()=>{
4521
4425
  if (!facetValue || isFacetEmpty(facetValue)) {
4522
4426
  setSelectedValues([]);
4523
- } else if (instanceOfIncludesExcludes(facetValue)) {
4427
+ } else if (instanceOfIncludesExcludes$1(facetValue)) {
4524
4428
  const filters = facetValue.operands.map((x)=>x.toString());
4525
4429
  setSelectedValues(filters);
4526
4430
  }
@@ -4580,6 +4484,556 @@ const isFacetEmpty = (op)=>{
4580
4484
  });
4581
4485
  };
4582
4486
 
4487
+ const instanceOfIncludesExcludes = (op)=>[
4488
+ 'in'
4489
+ ].includes(op.operator); // TODO: Guppy does not support excludes
4490
+ /**
4491
+ * Extracts the operands if the operation isIncludes or Excludes. Returns an empty Array
4492
+ * if filter is not the correct type.
4493
+ * @param operation - filters to extract values from
4494
+ */ const extractValues = (operation)=>{
4495
+ if (operation && instanceOfIncludesExcludes(operation)) {
4496
+ return operation.operands;
4497
+ }
4498
+ return [];
4499
+ };
4500
+ /**
4501
+ * Exact value facet component
4502
+ * @param field - field to facet on
4503
+ * @param description - description of the facet
4504
+ * @param facetName - name of the facet
4505
+ * @param dismissCallback - callback function to dismiss the facet
4506
+ * @param width - width of the facet
4507
+ * @param hooks - hooks to use for the facet
4508
+ * @param header - header components
4509
+ * @category Facets
4510
+ */ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks, header = {
4511
+ Panel: FacetHeader,
4512
+ Label: FacetText,
4513
+ iconStyle: controlsIconStyle
4514
+ } })=>{
4515
+ const [textValue, setTextValue] = useState(''); // Handle the state of the TextInput
4516
+ const clearFilters = hooks.useClearFilter();
4517
+ const updateFacetFilters = hooks.useUpdateFacetFilters();
4518
+ const facetTitle = facetName ? facetName : trimFirstFieldNameToTitle(field, true);
4519
+ const facetValue = hooks.useGetFacetFilters(field);
4520
+ const textValues = useMemo(()=>extractValues(facetValue), [
4521
+ facetValue
4522
+ ]);
4523
+ const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4524
+ const showFilters = isFilterExpanded === undefined || isFilterExpanded;
4525
+ const setValues = (values)=>{
4526
+ if (values.length > 0) {
4527
+ if (facetValue && instanceOfIncludesExcludes(facetValue)) {
4528
+ // updating facet value
4529
+ updateFacetFilters(field, {
4530
+ ...facetValue,
4531
+ operands: values
4532
+ });
4533
+ }
4534
+ if (facetValue === undefined) {
4535
+ // TODO: Assuming Includes by default but this might change to Include|Excludes
4536
+ updateFacetFilters(field, {
4537
+ operator: 'in',
4538
+ field: field,
4539
+ operands: values
4540
+ });
4541
+ }
4542
+ } else {
4543
+ clearFilters(field);
4544
+ }
4545
+ };
4546
+ const addValue = (s)=>{
4547
+ if (s === '') return;
4548
+ if (textValues.includes(s)) return;
4549
+ setTextValue('');
4550
+ setValues([
4551
+ ...textValues,
4552
+ s
4553
+ ]);
4554
+ };
4555
+ const removeButton = (x)=>{
4556
+ return /*#__PURE__*/ jsx(ActionIcon, {
4557
+ size: "xs",
4558
+ color: "white",
4559
+ radius: "xl",
4560
+ variant: "transparent",
4561
+ onClick: ()=>setValues(textValues.filter((i)=>i !== x)),
4562
+ children: /*#__PURE__*/ jsx(MdClose, {
4563
+ size: 10,
4564
+ "aria-label": "remove value from filter"
4565
+ })
4566
+ });
4567
+ };
4568
+ return /*#__PURE__*/ jsxs("div", {
4569
+ className: `flex flex-col ${width ? width : 'mx-0'} bg-base-max relative border-base-lighter border-1 rounded-md text-xs transition`,
4570
+ children: [
4571
+ /*#__PURE__*/ jsx(FacetControlsHeader, {
4572
+ field: field,
4573
+ description: description,
4574
+ hooks: hooks,
4575
+ facetName: facetName,
4576
+ dismissCallback: dismissCallback,
4577
+ header: header
4578
+ }),
4579
+ /*#__PURE__*/ jsxs("div", {
4580
+ className: showFilters ? 'h-full' : 'h-0 invisible',
4581
+ "aria-hidden": !showFilters,
4582
+ children: [
4583
+ /*#__PURE__*/ jsxs("div", {
4584
+ className: "flex flex-nowrap items-center p-2",
4585
+ children: [
4586
+ /*#__PURE__*/ jsx(TextInput, {
4587
+ "data-testid": "textbox-add-filter-value",
4588
+ size: "sm",
4589
+ placeholder: `Enter ${facetTitle}`,
4590
+ classNames: {
4591
+ root: 'grow',
4592
+ input: 'border-r-0 rounded-r-none py-1'
4593
+ },
4594
+ "aria-label": "enter value to add filter",
4595
+ value: textValue,
4596
+ onChange: (event)=>setTextValue(event.currentTarget.value)
4597
+ }),
4598
+ /*#__PURE__*/ jsx(ActionIcon, {
4599
+ size: "lg",
4600
+ "aria-label": "add string value",
4601
+ className: "bg-accent text-accent-contrast border-base-min border-1 rounded-l-none h-[30px]",
4602
+ onClick: ()=>{
4603
+ if (textValue.length > 0) addValue(textValue.trim());
4604
+ },
4605
+ children: /*#__PURE__*/ jsx(FaPlus, {})
4606
+ })
4607
+ ]
4608
+ }),
4609
+ /*#__PURE__*/ jsx(Group, {
4610
+ gap: "xs",
4611
+ className: "px-2 py-2 max-h-96 overflow-y-auto",
4612
+ "data-testid": "values group",
4613
+ children: textValues.map((x)=>/*#__PURE__*/ jsx(Badge, {
4614
+ size: "sm",
4615
+ variant: "filled",
4616
+ color: "accent",
4617
+ rightSection: removeButton(x),
4618
+ children: x
4619
+ }, x))
4620
+ })
4621
+ ]
4622
+ })
4623
+ ]
4624
+ });
4625
+ };
4626
+
4627
+ const createFacetCard = ({ facetDefinition, valueLabel, hooks: dataFunctions, facetNameFormatter, idPrefix, hideIfEmpty = false, width, showPercent = false, queryOptions })=>{
4628
+ const { field, type, description, label } = facetDefinition;
4629
+ const facetLabel = label ?? facetNameFormatter(facetDefinition.field);
4630
+ const valueTypeLabel = valueLabel === undefined || typeof valueLabel === 'string' ? valueLabel : valueLabel(queryOptions);
4631
+ return /*#__PURE__*/ jsx("div", {
4632
+ children: {
4633
+ enum: /*#__PURE__*/ jsx(EnumFacet, {
4634
+ valueLabel: valueTypeLabel,
4635
+ field: field,
4636
+ facetName: facetLabel,
4637
+ description: description,
4638
+ hideIfEmpty: hideIfEmpty,
4639
+ width: width,
4640
+ hooks: dataFunctions,
4641
+ showPercent: showPercent,
4642
+ sharedWithIndices: facetDefinition?.sharedWithIndices,
4643
+ moveValuesToBottom: facetDefinition?.moveValuesToBottom ?? [],
4644
+ excludeValues: facetDefinition?.excludeValues ?? []
4645
+ }, `${idPrefix}-enum-${field}`),
4646
+ range: /*#__PURE__*/ jsx(RangeFacet, {
4647
+ valueLabel: valueTypeLabel,
4648
+ field: field,
4649
+ facetName: facetLabel,
4650
+ description: description,
4651
+ hideIfEmpty: hideIfEmpty,
4652
+ width: width,
4653
+ hooks: dataFunctions,
4654
+ minimum: facetDefinition.range?.minimum,
4655
+ maximum: facetDefinition.range?.maximum,
4656
+ showSettings: showPercent,
4657
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4658
+ }, `${idPrefix}-range-${field}`),
4659
+ exact: /*#__PURE__*/ jsx(ExactValueFacet, {
4660
+ field: field,
4661
+ facetName: facetLabel,
4662
+ description: description,
4663
+ hideIfEmpty: hideIfEmpty,
4664
+ width: width,
4665
+ hooks: dataFunctions,
4666
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4667
+ }, `${idPrefix}-exact-${field}`),
4668
+ multiselect: /*#__PURE__*/ jsx(MultiSelectValueFacet, {
4669
+ field: field,
4670
+ facetName: facetLabel,
4671
+ description: description,
4672
+ hideIfEmpty: hideIfEmpty,
4673
+ width: width,
4674
+ hooks: dataFunctions,
4675
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4676
+ }, `${idPrefix}-exact-${field}`)
4677
+ }[type]
4678
+ }, `${idPrefix}-facet-${field}`);
4679
+ };
4680
+
4681
+ const FiltersPanel = ({ fields, dataFunctions, valueLabel })=>{
4682
+ return /*#__PURE__*/ jsx("div", {
4683
+ "data-testid": "filters-facets",
4684
+ className: "flex flex-col gap-y-4 w-full",
4685
+ children: fields.map((facetDefinition)=>{
4686
+ if (facetDefinition?.type === undefined) {
4687
+ console.warn('Facet definition missing type', facetDefinition);
4688
+ return null;
4689
+ }
4690
+ if (!(facetDefinition.type in dataFunctions)) return null;
4691
+ return createFacetCard({
4692
+ facetDefinition,
4693
+ valueLabel,
4694
+ hooks: dataFunctions[facetDefinition.type],
4695
+ facetNameFormatter: fieldNameToTitle,
4696
+ idPrefix: 'filters-panel',
4697
+ showPercent: false
4698
+ });
4699
+ })
4700
+ });
4701
+ };
4702
+
4703
+ const AccordionPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = Accessibility.ALL, showAccessLevel = false })=>{
4704
+ const coreDispatch = useCoreDispatch();
4705
+ const sharedFilters = useCoreSelector((state)=>selectSharedFilters(state));
4706
+ const theme = useMantineTheme();
4707
+ const shareFilters = useCoreSelector((state)=>selectShouldShareFilters(state));
4708
+ const allFiltersCollapsed = useCoreSelector((state)=>selectAllCohortFiltersCollapsed(state, index));
4709
+ const toggleAllFiltersExpanded = (expand)=>{
4710
+ coreDispatch(toggleCohortBuilderAllFilters({
4711
+ expand,
4712
+ index
4713
+ }));
4714
+ };
4715
+ const handleSharedFiltersChange = (value)=>{
4716
+ modals.openConfirmModal({
4717
+ title: 'Confirm change of shared filters mode',
4718
+ children: /*#__PURE__*/ jsx(Text, {
4719
+ size: "sm",
4720
+ 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.'
4721
+ }),
4722
+ labels: {
4723
+ confirm: 'Confirm',
4724
+ cancel: 'Cancel'
4725
+ },
4726
+ onConfirm: ()=>coreDispatch(setShouldShareFilters(value))
4727
+ });
4728
+ };
4729
+ return /*#__PURE__*/ jsxs(Stack, {
4730
+ align: "flex-start",
4731
+ children: [
4732
+ /*#__PURE__*/ jsxs(Group, {
4733
+ justify: "space-between",
4734
+ className: "w-full",
4735
+ children: [
4736
+ /*#__PURE__*/ jsx(Text, {
4737
+ size: "xl",
4738
+ fw: 800,
4739
+ children: "Filters"
4740
+ }),
4741
+ /*#__PURE__*/ jsx("button", {
4742
+ className: "text-primary text-sm font-normal",
4743
+ onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
4744
+ children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
4745
+ })
4746
+ ]
4747
+ }),
4748
+ /*#__PURE__*/ jsxs(Stack, {
4749
+ className: "bg-base-max py-4 px-2 h-full w-full",
4750
+ children: [
4751
+ Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxs(Group, {
4752
+ gap: "xs",
4753
+ justify: "space-between",
4754
+ children: [
4755
+ /*#__PURE__*/ jsxs("div", {
4756
+ className: "flex items-center space-x-1",
4757
+ children: [
4758
+ /*#__PURE__*/ jsx(Icon, {
4759
+ icon: "gen3:share",
4760
+ height: 16,
4761
+ width: 16,
4762
+ color: theme.colors.accent[4]
4763
+ }),
4764
+ /*#__PURE__*/ jsx(Text, {
4765
+ size: "sm",
4766
+ children: "Set the shared filters for all"
4767
+ }),
4768
+ /*#__PURE__*/ jsx(Icon, {
4769
+ icon: "gen3:info",
4770
+ height: 12,
4771
+ width: 12,
4772
+ color: theme.colors.accent[4]
4773
+ })
4774
+ ]
4775
+ }),
4776
+ /*#__PURE__*/ jsx(Switch, {
4777
+ checked: shareFilters,
4778
+ onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
4779
+ })
4780
+ ]
4781
+ }),
4782
+ /*#__PURE__*/ jsx(Accordion, {
4783
+ chevronPosition: "left",
4784
+ multiple: true,
4785
+ defaultValue: [
4786
+ filters?.tabs[0].title ?? 'Filters'
4787
+ ],
4788
+ children: filters.tabs.map((tab)=>{
4789
+ return /*#__PURE__*/ jsxs(Accordion.Item, {
4790
+ value: tab.title,
4791
+ children: [
4792
+ /*#__PURE__*/ jsx(Accordion.Control, {
4793
+ children: tab.title
4794
+ }),
4795
+ /*#__PURE__*/ jsx(Accordion.Panel, {
4796
+ classNames: {
4797
+ panel: 'p-0 m-0'
4798
+ },
4799
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsx(FiltersPanel, {
4800
+ fields: tab.fields.reduce((acc, field)=>{
4801
+ return [
4802
+ ...acc,
4803
+ facetDefinitions[field]
4804
+ ];
4805
+ }, []),
4806
+ dataFunctions: facetDataHooks,
4807
+ valueLabel: tabTitle
4808
+ }) : null
4809
+ })
4810
+ ]
4811
+ }, `${tab.title}`);
4812
+ })
4813
+ })
4814
+ ]
4815
+ })
4816
+ ]
4817
+ });
4818
+ };
4819
+
4820
+ const AccessData = [
4821
+ {
4822
+ value: Accessibility.ALL,
4823
+ label: 'All'
4824
+ },
4825
+ {
4826
+ value: Accessibility.ACCESSIBLE,
4827
+ label: 'Accessible'
4828
+ },
4829
+ {
4830
+ value: Accessibility.UNACCESSIBLE,
4831
+ label: 'Not Accessible'
4832
+ }
4833
+ ];
4834
+ const AccessLevelControl = ({ onChange, accessLevel })=>{
4835
+ const theme = useMantineTheme();
4836
+ return /*#__PURE__*/ jsx(SegmentedControl$1, {
4837
+ color: theme.colors.accent[5],
4838
+ data: AccessData,
4839
+ value: accessLevel,
4840
+ onChange: (val)=>{
4841
+ const accessibilityValue = AccessData.find((item)=>item.value === val)?.value || Accessibility.ALL;
4842
+ onChange(accessibilityValue);
4843
+ }
4844
+ });
4845
+ };
4846
+
4847
+ const DropdownPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = Accessibility.ALL, showAccessLevel = false })=>{
4848
+ const [value, setValue] = useState('0');
4849
+ const allFiltersCollapsed = useCoreSelector((state)=>selectAllCohortFiltersCollapsed(state, index));
4850
+ const sharedFilters = useCoreSelector((state)=>selectSharedFilters(state));
4851
+ const shareFilters = useCoreSelector((state)=>selectShouldShareFilters(state));
4852
+ const theme = useMantineTheme();
4853
+ const coreDispatch = useCoreDispatch();
4854
+ const toggleAllFiltersExpanded = (expand)=>{
4855
+ coreDispatch(toggleCohortBuilderAllFilters({
4856
+ expand,
4857
+ index
4858
+ }));
4859
+ };
4860
+ const items = useDeepCompareMemo(()=>filters.tabs.map((tab, idx)=>{
4861
+ return {
4862
+ label: tab.title,
4863
+ value: idx.toString()
4864
+ };
4865
+ }), [
4866
+ filters.tabs
4867
+ ]);
4868
+ const fields = filters.tabs[Number(value)].fields.reduce((acc, field)=>{
4869
+ return [
4870
+ ...acc,
4871
+ facetDefinitions[field]
4872
+ ];
4873
+ }, []);
4874
+ const handleSharedFiltersChange = (value)=>{
4875
+ modals.openConfirmModal({
4876
+ title: 'Confirm change of shared filters mode',
4877
+ children: /*#__PURE__*/ jsx(Text, {
4878
+ size: "sm",
4879
+ 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.'
4880
+ }),
4881
+ labels: {
4882
+ confirm: 'Confirm',
4883
+ cancel: 'Cancel'
4884
+ },
4885
+ onConfirm: ()=>coreDispatch(setShouldShareFilters(value))
4886
+ });
4887
+ };
4888
+ return /*#__PURE__*/ jsxs(Stack, {
4889
+ align: "flex-start",
4890
+ children: [
4891
+ /*#__PURE__*/ jsxs(Group, {
4892
+ justify: "space-between",
4893
+ className: "w-full",
4894
+ children: [
4895
+ /*#__PURE__*/ jsx(Text, {
4896
+ size: "xl",
4897
+ fw: 800,
4898
+ children: "Filters"
4899
+ }),
4900
+ /*#__PURE__*/ jsx("button", {
4901
+ className: "text-primary text-sm font-normal",
4902
+ onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
4903
+ children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
4904
+ })
4905
+ ]
4906
+ }),
4907
+ showAccessLevel ? /*#__PURE__*/ jsx(AccessLevelControl, {
4908
+ onChange: onAccessChange,
4909
+ accessLevel: accessLevel
4910
+ }) : null,
4911
+ /*#__PURE__*/ jsxs(Stack, {
4912
+ className: "bg-base-max py-4 px-2 h-full w-full",
4913
+ children: [
4914
+ Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxs(Group, {
4915
+ gap: "xs",
4916
+ justify: "space-between",
4917
+ children: [
4918
+ /*#__PURE__*/ jsxs("div", {
4919
+ className: "flex items-center space-x-1",
4920
+ children: [
4921
+ /*#__PURE__*/ jsx(Icon, {
4922
+ icon: "gen3:share",
4923
+ height: 16,
4924
+ width: 16,
4925
+ color: theme.colors.accent[4]
4926
+ }),
4927
+ /*#__PURE__*/ jsx(Text, {
4928
+ size: "sm",
4929
+ children: "Set the shared filters for all"
4930
+ }),
4931
+ /*#__PURE__*/ jsx(Tooltip, {
4932
+ label: "If enabled any filter set on this tab will be applied to every tab where occurs.",
4933
+ position: "top",
4934
+ withArrow: true,
4935
+ children: /*#__PURE__*/ jsx(Icon, {
4936
+ icon: "gen3:info",
4937
+ height: 12,
4938
+ width: 12,
4939
+ color: theme.colors.accent[4]
4940
+ })
4941
+ })
4942
+ ]
4943
+ }),
4944
+ /*#__PURE__*/ jsx(Switch, {
4945
+ checked: shareFilters,
4946
+ onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
4947
+ })
4948
+ ]
4949
+ }),
4950
+ filters.tabs.length > 1 && /*#__PURE__*/ jsx(Select, {
4951
+ classNames: {
4952
+ options: 'border-1 border-base-dark',
4953
+ option: 'hover:bg-primary-lightest'
4954
+ },
4955
+ withCheckIcon: false,
4956
+ data: items,
4957
+ value: value === null ? '0' : value,
4958
+ onChange: setValue
4959
+ }),
4960
+ Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsx(FiltersPanel, {
4961
+ fields: fields,
4962
+ dataFunctions: facetDataHooks,
4963
+ valueLabel: tabTitle
4964
+ }) : null
4965
+ ]
4966
+ })
4967
+ ]
4968
+ });
4969
+ };
4970
+
4971
+ const VerticalTabbedPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = Accessibility.ALL, showAccessLevel = false })=>{
4972
+ return /*#__PURE__*/ jsx("div", {
4973
+ children: /*#__PURE__*/ jsxs(Tabs, {
4974
+ variant: "pills",
4975
+ orientation: "vertical",
4976
+ keepMounted: false,
4977
+ defaultValue: filters?.tabs[0].title ?? 'Filters',
4978
+ children: [
4979
+ /*#__PURE__*/ jsx(Tabs.List, {
4980
+ children: filters.tabs.map((tab)=>{
4981
+ return /*#__PURE__*/ jsx(Tabs.Tab, {
4982
+ value: tab.title,
4983
+ children: tab.title
4984
+ }, `${tab.title}-tab`);
4985
+ })
4986
+ }),
4987
+ filters.tabs.map((tab)=>{
4988
+ return /*#__PURE__*/ jsx(Tabs.Panel, {
4989
+ value: tab.title,
4990
+ className: "w-1/4",
4991
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsx(FiltersPanel, {
4992
+ fields: tab.fields.reduce((acc, field)=>{
4993
+ return [
4994
+ ...acc,
4995
+ facetDefinitions[field]
4996
+ ];
4997
+ }, []),
4998
+ dataFunctions: facetDataHooks,
4999
+ valueLabel: tabTitle
5000
+ }) : null
5001
+ }, `filter-${tab.title}-tabPanel`);
5002
+ })
5003
+ ]
5004
+ })
5005
+ });
5006
+ };
5007
+ const SinglePanel = ({ filters, tabTitle, facetDefinitions, facetDataHooks })=>{
5008
+ return /*#__PURE__*/ jsx("div", {
5009
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsx(FiltersPanel, {
5010
+ fields: filters.tabs[0].fields.reduce((acc, field)=>{
5011
+ return [
5012
+ ...acc,
5013
+ facetDefinitions[field]
5014
+ ];
5015
+ }, []),
5016
+ dataFunctions: facetDataHooks,
5017
+ valueLabel: tabTitle
5018
+ }) : null
5019
+ });
5020
+ };
5021
+ const TabbedPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks })=>{
5022
+ return filters.tabs.length > 1 ? /*#__PURE__*/ jsx(VerticalTabbedPanel, {
5023
+ index: index,
5024
+ filters: filters,
5025
+ tabTitle: tabTitle,
5026
+ facetDefinitions: facetDefinitions,
5027
+ facetDataHooks: facetDataHooks
5028
+ }) : /*#__PURE__*/ jsx(SinglePanel, {
5029
+ index: index,
5030
+ filters: filters,
5031
+ tabTitle: tabTitle,
5032
+ facetDefinitions: facetDefinitions,
5033
+ facetDataHooks: facetDataHooks
5034
+ });
5035
+ };
5036
+
4583
5037
  /**
4584
5038
  * Scrolls to hash in url when component mounts and removes hash from url when component unmounts
4585
5039
  * @param valid_hashes - what hashes in url should trigger scroll
@@ -4601,58 +5055,6 @@ const isFacetEmpty = (op)=>{
4601
5055
  }, []);
4602
5056
  };
4603
5057
 
4604
- const createFacetCard = ({ facetDefinition, valueLabel, hooks: dataFunctions, facetNameFormatter, idPrefix, hideIfEmpty = false, width, showPercent = false, queryOptions })=>{
4605
- const { field, type, description, label } = facetDefinition;
4606
- const facetLabel = label ?? facetNameFormatter(facetDefinition.field);
4607
- const valueTypeLabel = valueLabel === undefined || typeof valueLabel === 'string' ? valueLabel : valueLabel(queryOptions);
4608
- return /*#__PURE__*/ jsx("div", {
4609
- children: {
4610
- enum: /*#__PURE__*/ jsx(EnumFacet, {
4611
- valueLabel: valueTypeLabel,
4612
- field: field,
4613
- facetName: facetLabel,
4614
- description: description,
4615
- hideIfEmpty: hideIfEmpty,
4616
- width: width,
4617
- hooks: dataFunctions,
4618
- showPercent: showPercent,
4619
- sharedWithIndices: facetDefinition?.sharedWithIndices
4620
- }, `${idPrefix}-enum-${field}`),
4621
- range: /*#__PURE__*/ jsx(RangeFacet, {
4622
- valueLabel: valueTypeLabel,
4623
- field: field,
4624
- facetName: facetLabel,
4625
- description: description,
4626
- hideIfEmpty: hideIfEmpty,
4627
- width: width,
4628
- hooks: dataFunctions,
4629
- minimum: facetDefinition.range?.minimum,
4630
- maximum: facetDefinition.range?.maximum,
4631
- showSettings: showPercent,
4632
- sharedWithIndices: facetDefinition?.sharedWithIndices
4633
- }, `${idPrefix}-range-${field}`),
4634
- exact: /*#__PURE__*/ jsx(ExactValueFacet, {
4635
- field: field,
4636
- facetName: facetLabel,
4637
- description: description,
4638
- hideIfEmpty: hideIfEmpty,
4639
- width: width,
4640
- hooks: dataFunctions,
4641
- sharedWithIndices: facetDefinition?.sharedWithIndices
4642
- }, `${idPrefix}-exact-${field}`),
4643
- multiselect: /*#__PURE__*/ jsx(MultiSelectValueFacet, {
4644
- field: field,
4645
- facetName: facetLabel,
4646
- description: description,
4647
- hideIfEmpty: hideIfEmpty,
4648
- width: width,
4649
- hooks: dataFunctions,
4650
- sharedWithIndices: facetDefinition?.sharedWithIndices
4651
- }, `${idPrefix}-exact-${field}`)
4652
- }[type]
4653
- }, `${idPrefix}-facet-${field}`);
4654
- };
4655
-
4656
5058
  const createFacetCards = ({ facets, hooks, facetNameFormatter, idPrefix, valueLabel, dismissCallback, hideIfEmpty, Chart, showPercent })=>{
4657
5059
  return facets.map((facetDefinition)=>{
4658
5060
  return createFacetCard({
@@ -7147,6 +7549,20 @@ const TableIcons = {
7147
7549
  })
7148
7550
  };
7149
7551
 
7552
+ const CompareFn = (fieldValue, cmpOp, value)=>{
7553
+ switch(cmpOp){
7554
+ case 'alwaysTrue':
7555
+ return true;
7556
+ case 'arrayNotEmpty':
7557
+ return Array.isArray(fieldValue) && fieldValue.length > 0;
7558
+ }
7559
+ };
7560
+ const isSelectable = (row, config)=>{
7561
+ if (!config) return false;
7562
+ if (!Object.hasOwn(row.original, config.field)) return false;
7563
+ const fieldValue = row.original[config.field];
7564
+ return CompareFn(fieldValue, config.comparer, config.value);
7565
+ };
7150
7566
  const extractCellValue = (func)=>({ cell, row })=>func({
7151
7567
  value: cell.getValue(),
7152
7568
  cell,
@@ -7179,6 +7595,13 @@ const DiscoveryTable = ({ data, hits, dataRequestStatus, setSorting, setPaginati
7179
7595
  }, [
7180
7596
  config.studyColumns
7181
7597
  ]);
7598
+ const checkIfRowIsSelectable = (row)=>{
7599
+ if (config.tableConfig?.selectableRows) return true;
7600
+ if (config.tableConfig?.selectableRowConfiguration) {
7601
+ return isSelectable(row, config.tableConfig.selectableRowConfiguration);
7602
+ }
7603
+ return false;
7604
+ };
7182
7605
  const table = useMantineReactTable({
7183
7606
  columns: cols,
7184
7607
  data: data ?? [],
@@ -7189,7 +7612,7 @@ const DiscoveryTable = ({ data, hits, dataRequestStatus, setSorting, setPaginati
7189
7612
  onPaginationChange: setPagination,
7190
7613
  onSortingChange: setSorting
7191
7614
  } : {},
7192
- enableRowSelection: config.tableConfig?.selectableRows ?? false,
7615
+ enableRowSelection: checkIfRowIsSelectable,
7193
7616
  rowCount: hits,
7194
7617
  icons: TableIcons,
7195
7618
  enableTopToolbar: false,
@@ -7489,7 +7912,7 @@ const AdvancedSearch = ({ advSearchFilters, setAdvancedSearchFilters })=>{
7489
7912
  /*#__PURE__*/ jsxs("div", {
7490
7913
  className: "flex flex-row justify-between items-center",
7491
7914
  children: [
7492
- /*#__PURE__*/ jsx(SegmentedControl, {
7915
+ /*#__PURE__*/ jsx(SegmentedControl$1, {
7493
7916
  data: [
7494
7917
  {
7495
7918
  label: 'AND',
@@ -8417,6 +8840,7 @@ const useSearchMetadata = ({ discoveryConfig, searchTerms, mdsData, isSuccess })
8417
8840
  uidField
8418
8841
  ],
8419
8842
  idField: uidField,
8843
+ tokenize: (string, _fieldName)=>string.split(' '),
8420
8844
  extractField: extractValue,
8421
8845
  // processTerm: (term) => suffixes(term, 3),
8422
8846
  searchOptions: {
@@ -9320,7 +9744,8 @@ registerDefaultDiscoveryDataLoaders();
9320
9744
  }) : null,
9321
9745
  discoveryConfig.features?.chartsSection?.enabled && /*#__PURE__*/ jsx(CollapsableCharts, {
9322
9746
  config: discoveryConfig.features?.chartsSection,
9323
- data: chartData
9747
+ data: chartData,
9748
+ isSuccess: dataRequestStatus.isSuccess
9324
9749
  }),
9325
9750
  /*#__PURE__*/ jsxs("div", {
9326
9751
  className: "flex items-center p-2 mb-4 bg-base-max rounded-lg",
@@ -9750,6 +10175,23 @@ const RenderParagraphsCell = ({ value })=>{
9750
10175
  }, i))
9751
10176
  });
9752
10177
  };
10178
+ const RenderIfArrayHasData = ({ value })=>{
10179
+ const content = value;
10180
+ if (isArray(content) && content.length > 0) {
10181
+ return /*#__PURE__*/ jsx(Icon, {
10182
+ icon: "gen3:checked-filled",
10183
+ height: 22,
10184
+ width: 22,
10185
+ className: "text-utility-success"
10186
+ });
10187
+ }
10188
+ return /*#__PURE__*/ jsx(Icon, {
10189
+ icon: "gen3:cancel-filled",
10190
+ height: 22,
10191
+ width: 22,
10192
+ className: "text-utility-error"
10193
+ });
10194
+ };
9753
10195
  // TODO Fix below
9754
10196
  // eslint-disable-next-line react/prop-types
9755
10197
  const DiscoveryRenderTagsCell = ({ value })=>{
@@ -9780,6 +10222,7 @@ const DiscoveryRenderTagsCell = ({ value })=>{
9780
10222
  const Gen3DiscoveryStandardCellRenderers = {
9781
10223
  array: {
9782
10224
  NegativePositive: RenderArrayCellNegativePositive$1,
10225
+ HasData: RenderIfArrayHasData,
9783
10226
  default: RenderArrayCell$1
9784
10227
  },
9785
10228
  string: {
@@ -12144,237 +12587,64 @@ const DownloadsPanel = ({ dropdowns, buttons, loginForDownload, index, totalCoun
12144
12587
  title: `${button.title} (Login Required)`,
12145
12588
  enabled: false
12146
12589
  }))
12147
- }
12148
- };
12149
- }, {});
12150
- }
12151
- return dropdownsToRender;
12152
- }, [
12153
- dropdowns,
12154
- loginRequired,
12155
- isUserLoggedIn
12156
- ]);
12157
- return dropdowns || buttons ? /*#__PURE__*/ jsxs("div", {
12158
- className: "flex space-x-1",
12159
- children: [
12160
- Object.values(dropdownsToRender).map((dropdown)=>{
12161
- return createDownloadMenuButton(dropdown, {
12162
- type: index,
12163
- totalCount,
12164
- fields,
12165
- filter,
12166
- accessibility: accessibility ?? Accessibility.ALL
12167
- });
12168
- }),
12169
- buttons.map((button)=>{
12170
- let disabled = false;
12171
- let actionFunction = NullButtonAction;
12172
- let actionArgs = {};
12173
- const buttonAction = button.action ?? button.type;
12174
- if (buttonAction) {
12175
- const actionItem = findButtonAction(buttonAction);
12176
- if (actionItem) {
12177
- const funcArgs = actionItem.args ?? {};
12178
- const func = actionItem.action;
12179
- actionFunction = func;
12180
- actionArgs = funcArgs ?? {};
12181
- }
12182
- }
12183
- if (loginRequired && !isUserLoggedIn) {
12184
- disabled = true;
12185
- }
12186
- return /*#__PURE__*/ jsx(CohortActionButton, {
12187
- activeText: 'Downloading...',
12188
- inactiveText: button.title,
12189
- tooltipText: button.tooltipText,
12190
- disabled: disabled || !button.enabled,
12191
- actionFunction: actionFunction,
12192
- actionArgs: {
12193
- ...actionArgs,
12194
- ...button.actionArgs ?? {},
12195
- type: index,
12196
- totalCount,
12197
- fields,
12198
- filter,
12199
- accessibility: accessibility ?? Accessibility.ALL
12200
- }
12201
- }, button.title);
12202
- })
12203
- ]
12204
- }) : /*#__PURE__*/ jsx(React__default.Fragment, {});
12205
- };
12206
-
12207
- const FiltersPanel = ({ fields, dataFunctions, valueLabel })=>{
12208
- return /*#__PURE__*/ jsx("div", {
12209
- "data-testid": "filters-facets",
12210
- className: "flex flex-col gap-y-4 w-full",
12211
- children: fields.map((facetDefinition)=>{
12212
- if (facetDefinition?.type === undefined) {
12213
- console.warn('Facet definition missing type', facetDefinition);
12214
- return null;
12215
- }
12216
- if (!(facetDefinition.type in dataFunctions)) return null;
12217
- return createFacetCard({
12218
- facetDefinition,
12219
- valueLabel,
12220
- hooks: dataFunctions[facetDefinition.type],
12221
- facetNameFormatter: fieldNameToTitle,
12222
- idPrefix: 'filters-panel',
12223
- showPercent: false
12224
- });
12225
- })
12226
- });
12227
- };
12228
-
12229
- const AccessData = [
12230
- {
12231
- value: Accessibility.ALL,
12232
- label: 'All'
12233
- },
12234
- {
12235
- value: Accessibility.ACCESSIBLE,
12236
- label: 'Accessible'
12237
- },
12238
- {
12239
- value: Accessibility.UNACCESSIBLE,
12240
- label: 'Not Accessible'
12241
- }
12242
- ];
12243
- const AccessLevelControl = ({ onChange, accessLevel })=>{
12244
- const theme = useMantineTheme();
12245
- return /*#__PURE__*/ jsx(SegmentedControl, {
12246
- color: theme.colors.accent[5],
12247
- data: AccessData,
12248
- value: accessLevel,
12249
- onChange: (val)=>{
12250
- const accessibilityValue = AccessData.find((item)=>item.value === val)?.value || Accessibility.ALL;
12251
- onChange(accessibilityValue);
12252
- }
12253
- });
12254
- };
12255
-
12256
- const DropdownPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = Accessibility.ALL, showAccessLevel = false })=>{
12257
- const [value, setValue] = useState('0');
12258
- const allFiltersCollapsed = useCoreSelector((state)=>selectAllCohortFiltersCollapsed(state, index));
12259
- const sharedFilters = useCoreSelector((state)=>selectSharedFilters(state));
12260
- const shareFilters = useCoreSelector((state)=>selectShouldShareFilters(state));
12261
- const theme = useMantineTheme();
12262
- const coreDispatch = useCoreDispatch();
12263
- const toggleAllFiltersExpanded = (expand)=>{
12264
- coreDispatch(toggleCohortBuilderAllFilters({
12265
- expand,
12266
- index
12267
- }));
12268
- };
12269
- const items = useDeepCompareMemo(()=>filters.tabs.map((tab, idx)=>{
12270
- return {
12271
- label: tab.title,
12272
- value: idx.toString()
12273
- };
12274
- }), [
12275
- filters.tabs
12276
- ]);
12277
- const fields = filters.tabs[Number(value)].fields.reduce((acc, field)=>{
12278
- return [
12279
- ...acc,
12280
- facetDefinitions[field]
12281
- ];
12282
- }, []);
12283
- const handleSharedFiltersChange = (value)=>{
12284
- modals.openConfirmModal({
12285
- title: 'Confirm change of shared filters mode',
12286
- children: /*#__PURE__*/ jsx(Text, {
12287
- size: "sm",
12288
- 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.'
12289
- }),
12290
- labels: {
12291
- confirm: 'Confirm',
12292
- cancel: 'Cancel'
12293
- },
12294
- onConfirm: ()=>coreDispatch(setShouldShareFilters(value))
12295
- });
12296
- };
12297
- return /*#__PURE__*/ jsxs(Stack, {
12298
- align: "flex-start",
12590
+ }
12591
+ };
12592
+ }, {});
12593
+ }
12594
+ return dropdownsToRender;
12595
+ }, [
12596
+ dropdowns,
12597
+ loginRequired,
12598
+ isUserLoggedIn
12599
+ ]);
12600
+ return dropdowns || buttons ? /*#__PURE__*/ jsxs("div", {
12601
+ className: "flex space-x-1",
12299
12602
  children: [
12300
- /*#__PURE__*/ jsxs(Group, {
12301
- justify: "space-between",
12302
- className: "w-full",
12303
- children: [
12304
- /*#__PURE__*/ jsx(Text, {
12305
- size: "xl",
12306
- fw: 800,
12307
- children: "Filters"
12308
- }),
12309
- /*#__PURE__*/ jsx("button", {
12310
- className: "text-primary text-sm font-normal",
12311
- onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
12312
- children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
12313
- })
12314
- ]
12603
+ Object.values(dropdownsToRender).map((dropdown)=>{
12604
+ return createDownloadMenuButton(dropdown, {
12605
+ type: index,
12606
+ totalCount,
12607
+ fields,
12608
+ filter,
12609
+ accessibility: accessibility ?? Accessibility.ALL
12610
+ });
12315
12611
  }),
12316
- showAccessLevel ? /*#__PURE__*/ jsx(AccessLevelControl, {
12317
- onChange: onAccessChange,
12318
- accessLevel: accessLevel
12319
- }) : null,
12320
- /*#__PURE__*/ jsxs(Stack, {
12321
- className: "bg-base-max py-4 px-2 h-full w-full",
12322
- children: [
12323
- Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxs(Group, {
12324
- gap: "xs",
12325
- justify: "space-between",
12326
- children: [
12327
- /*#__PURE__*/ jsxs("div", {
12328
- className: "flex items-center space-x-1",
12329
- children: [
12330
- /*#__PURE__*/ jsx(Icon, {
12331
- icon: "gen3:share",
12332
- height: 16,
12333
- width: 16,
12334
- color: theme.colors.accent[4]
12335
- }),
12336
- /*#__PURE__*/ jsx(Text, {
12337
- size: "sm",
12338
- children: "Set the shared filters for all"
12339
- }),
12340
- /*#__PURE__*/ jsx(Tooltip, {
12341
- label: "If enabled any filter set on this tab will be applied to every tab where occurs.",
12342
- position: "top",
12343
- withArrow: true,
12344
- children: /*#__PURE__*/ jsx(Icon, {
12345
- icon: "gen3:info",
12346
- height: 12,
12347
- width: 12,
12348
- color: theme.colors.accent[4]
12349
- })
12350
- })
12351
- ]
12352
- }),
12353
- /*#__PURE__*/ jsx(Switch, {
12354
- checked: shareFilters,
12355
- onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
12356
- })
12357
- ]
12358
- }),
12359
- filters.tabs.length > 1 && /*#__PURE__*/ jsx(Select, {
12360
- classNames: {
12361
- options: 'border-1 border-base-dark',
12362
- option: 'hover:bg-primary-lightest'
12363
- },
12364
- withCheckIcon: false,
12365
- data: items,
12366
- value: value === null ? '0' : value,
12367
- onChange: setValue
12368
- }),
12369
- Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsx(FiltersPanel, {
12370
- fields: fields,
12371
- dataFunctions: facetDataHooks,
12372
- valueLabel: tabTitle
12373
- }) : null
12374
- ]
12612
+ buttons.map((button)=>{
12613
+ let disabled = false;
12614
+ let actionFunction = NullButtonAction;
12615
+ let actionArgs = {};
12616
+ const buttonAction = button.action ?? button.type;
12617
+ if (buttonAction) {
12618
+ const actionItem = findButtonAction(buttonAction);
12619
+ if (actionItem) {
12620
+ const funcArgs = actionItem.args ?? {};
12621
+ const func = actionItem.action;
12622
+ actionFunction = func;
12623
+ actionArgs = funcArgs ?? {};
12624
+ }
12625
+ }
12626
+ if (loginRequired && !isUserLoggedIn) {
12627
+ disabled = true;
12628
+ }
12629
+ return /*#__PURE__*/ jsx(CohortActionButton, {
12630
+ activeText: 'Downloading...',
12631
+ inactiveText: button.title,
12632
+ tooltipText: button.tooltipText,
12633
+ disabled: disabled || !button.enabled,
12634
+ actionFunction: actionFunction,
12635
+ actionArgs: {
12636
+ ...actionArgs,
12637
+ ...button.actionArgs ?? {},
12638
+ type: index,
12639
+ totalCount,
12640
+ fields,
12641
+ filter,
12642
+ accessibility: accessibility ?? Accessibility.ALL
12643
+ }
12644
+ }, button.title);
12375
12645
  })
12376
12646
  ]
12377
- });
12647
+ }) : /*#__PURE__*/ jsx(React__default.Fragment, {});
12378
12648
  };
12379
12649
 
12380
12650
  const EmptyData = {};
@@ -12402,10 +12672,22 @@ const EmptyData = {};
12402
12672
  const isXl = useMediaQuery('(min-width: 1600px)');
12403
12673
  const [accessLevel, setAccessLevel] = useState(Accessibility.ALL);
12404
12674
  const sharedFiltersMap = useCoreSelector((state)=>selectSharedFilters(state));
12405
- let numCols = 3;
12406
- if (isSm) numCols = 1;
12407
- if (isMd) numCols = 2;
12408
- if (isXl) numCols = 4;
12675
+ const defaultDropdowns = useMemo(()=>dropdowns ?? {}, [
12676
+ dropdowns
12677
+ ]);
12678
+ const defaultButtons = useMemo(()=>buttons ?? [], [
12679
+ buttons
12680
+ ]);
12681
+ const numCols = useMemo(()=>{
12682
+ if (isSm) return 1;
12683
+ if (isMd) return 2;
12684
+ if (isXl) return 4;
12685
+ return 3;
12686
+ }, [
12687
+ isSm,
12688
+ isMd,
12689
+ isXl
12690
+ ]);
12409
12691
  const index = guppyConfig.dataType;
12410
12692
  const fields = useMemo(()=>getAllFieldsFromFilterConfigs(filters?.tabs ?? []), [
12411
12693
  filters?.tabs
@@ -12419,14 +12701,20 @@ const EmptyData = {};
12419
12701
  filters: cohortFilters,
12420
12702
  accessibility: accessLevel
12421
12703
  });
12422
- const { data: chartData, isSuccess: isChartSuccess, isFetching: isChartFetching, isError: isChartError } = useGetAggsNoFilterSelfQuery({
12423
- type: index,
12424
- fields: [
12704
+ const chartKeys = useDeepCompareMemo(()=>[
12425
12705
  ...Object.keys(chartsSection?.charts ?? {}),
12426
12706
  ...Object.keys(charts)
12427
- ],
12707
+ ], [
12708
+ chartsSection?.charts,
12709
+ charts
12710
+ ]);
12711
+ const { data: chartData, isSuccess: isChartSuccess, isFetching: isChartFetching, isError: isChartError } = useGetAggsNoFilterSelfQuery({
12712
+ type: index,
12713
+ fields: chartKeys,
12428
12714
  filters: cohortFilters,
12429
12715
  accessibility: accessLevel
12716
+ }, {
12717
+ skip: chartKeys.length === 0
12430
12718
  });
12431
12719
  const getEnumFacetData = useDeepCompareCallback((field)=>{
12432
12720
  let filters = undefined;
@@ -12449,7 +12737,7 @@ const EmptyData = {};
12449
12737
  isSuccess: isSuccess
12450
12738
  };
12451
12739
  }, [
12452
- cohortFilters,
12740
+ cohortFilters.root,
12453
12741
  data,
12454
12742
  isSuccess
12455
12743
  ]);
@@ -12598,8 +12886,8 @@ const EmptyData = {};
12598
12886
  className: "flex justify-between mb-2 ml-2",
12599
12887
  children: [
12600
12888
  /*#__PURE__*/ jsx(DownloadsPanel, {
12601
- dropdowns: dropdowns ?? {},
12602
- buttons: buttons ?? [],
12889
+ dropdowns: defaultDropdowns,
12890
+ buttons: defaultButtons,
12603
12891
  loginForDownload: loginForDownload,
12604
12892
  index: index,
12605
12893
  totalCount: counts ?? 0,
@@ -12618,7 +12906,8 @@ const EmptyData = {};
12618
12906
  ...chartsSection,
12619
12907
  charts: summaryCharts
12620
12908
  },
12621
- data: chartData ?? EmptyData
12909
+ data: chartData ?? EmptyData,
12910
+ isSuccess: isChartSuccess
12622
12911
  }) : /*#__PURE__*/ jsx(Charts, {
12623
12912
  charts: summaryCharts,
12624
12913
  data: chartData ?? EmptyData,
@@ -12672,6 +12961,9 @@ const TabsLayoutToComponentProp = (tabsLayout)=>{
12672
12961
  const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = 'left' })=>{
12673
12962
  const dispatch = useCoreDispatch();
12674
12963
  dispatch(setSharedFilters(sharedFiltersMap ?? {}));
12964
+ const configuration = useDeepCompareMemo(()=>explorerConfig, [
12965
+ explorerConfig
12966
+ ]);
12675
12967
  return /*#__PURE__*/ jsx("div", {
12676
12968
  className: "w-full",
12677
12969
  children: /*#__PURE__*/ jsxs(Tabs, {
@@ -12682,17 +12974,24 @@ const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = '
12682
12974
  /*#__PURE__*/ jsx(Tabs.List, {
12683
12975
  className: "w-full",
12684
12976
  justify: TabsLayoutToComponentProp(tabsLayout),
12685
- children: explorerConfig.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Tab, {
12977
+ children: configuration.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Tab, {
12686
12978
  value: panelConfig.tabTitle,
12687
12979
  children: panelConfig.tabTitle
12688
12980
  }, `${panelConfig.tabTitle}-tabList`))
12689
12981
  }),
12690
- explorerConfig.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Panel, {
12982
+ configuration.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Panel, {
12691
12983
  value: panelConfig.tabTitle,
12692
- children: /*#__PURE__*/ createElement(CohortPanel, {
12693
- ...panelConfig,
12694
- key: `${panelConfig.tabTitle}-CohortPanel`
12695
- })
12984
+ children: /*#__PURE__*/ jsx(CohortPanel, {
12985
+ guppyConfig: panelConfig.guppyConfig,
12986
+ chartsSection: panelConfig?.chartsSection,
12987
+ filters: panelConfig.filters,
12988
+ tabTitle: panelConfig.tabTitle,
12989
+ table: panelConfig.table,
12990
+ dropdowns: panelConfig.dropdowns,
12991
+ buttons: panelConfig.buttons,
12992
+ loginForDownload: panelConfig.loginForDownload,
12993
+ sharedFiltersMap: panelConfig.sharedFiltersMap
12994
+ }, `${panelConfig.tabTitle}-CohortPanel`)
12696
12995
  }, `${panelConfig.tabTitle}-tabPanel`))
12697
12996
  ]
12698
12997
  })
@@ -12812,6 +13111,18 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12812
13111
  cohortFilters.root,
12813
13112
  isSuccess
12814
13113
  ]);
13114
+ const EnumHookInstances = {
13115
+ useGetFacetData: getEnumFacetData,
13116
+ useUpdateFacetFilters: partial(useUpdateFilters$1, index),
13117
+ useGetFacetFilters: partial(useGetFacetFilters$1, index),
13118
+ useClearFilter: partial(useClearFilters$1, index),
13119
+ useFilterExpanded: partial(useFilterExpandedState$1, index),
13120
+ useToggleExpandFilter: partial(useToggleExpandFilter$1, index),
13121
+ useGetCombineMode: partial(useCohortFilterCombineState, index),
13122
+ useSetCombineMode: partial(useSetCohortFilterCombineState, index),
13123
+ useFieldNameToTitle: useFieldNameToTitle,
13124
+ useTotalCounts: undefined
13125
+ };
12815
13126
  const RangeHookInstances = {
12816
13127
  useGetFacetData: getRangeFacetData,
12817
13128
  useUpdateFacetFilters: partial(useUpdateFilters$1, index),
@@ -12826,38 +13137,9 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12826
13137
  const facetDataHooks = useDeepCompareMemo(()=>{
12827
13138
  return {
12828
13139
  // TODO: see if there a better way to do this
12829
- enum: {
12830
- useGetFacetData: getEnumFacetData,
12831
- useUpdateFacetFilters: partial(useUpdateFilters$1, index),
12832
- useGetFacetFilters: partial(useGetFacetFilters$1, index),
12833
- useClearFilter: partial(useClearFilters$1, index),
12834
- useFilterExpanded: partial(useFilterExpandedState$1, index),
12835
- useToggleExpandFilter: partial(useToggleExpandFilter$1, index),
12836
- useGetCombineMode: partial(useCohortFilterCombineState, index),
12837
- useSetCombineMode: partial(useSetCohortFilterCombineState, index),
12838
- useFieldNameToTitle: useFieldNameToTitle,
12839
- useTotalCounts: undefined
12840
- },
12841
- exact: {
12842
- useGetFacetData: getEnumFacetData,
12843
- useUpdateFacetFilters: partial(useUpdateFilters$1, index),
12844
- useGetFacetFilters: partial(useGetFacetFilters$1, index),
12845
- useClearFilter: partial(useClearFilters$1, index),
12846
- useFilterExpanded: partial(useFilterExpandedState$1, index),
12847
- useToggleExpandFilter: partial(useToggleExpandFilter$1, index),
12848
- useFieldNameToTitle: useFieldNameToTitle,
12849
- useTotalCounts: undefined
12850
- },
12851
- multiselect: {
12852
- useGetFacetData: getEnumFacetData,
12853
- useUpdateFacetFilters: partial(useUpdateFilters$1, index),
12854
- useGetFacetFilters: partial(useGetFacetFilters$1, index),
12855
- useClearFilter: partial(useClearFilters$1, index),
12856
- useFilterExpanded: partial(useFilterExpandedState$1, index),
12857
- useToggleExpandFilter: partial(useToggleExpandFilter$1, index),
12858
- useFieldNameToTitle: useFieldNameToTitle,
12859
- useTotalCounts: undefined
12860
- },
13140
+ enum: EnumHookInstances,
13141
+ exact: EnumHookInstances,
13142
+ multiselect: EnumHookInstances,
12861
13143
  range: RangeHookInstances,
12862
13144
  age: RangeHookInstances,
12863
13145
  year: RangeHookInstances,
@@ -12865,7 +13147,8 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12865
13147
  days: RangeHookInstances,
12866
13148
  percent: RangeHookInstances,
12867
13149
  datetime: RangeHookInstances,
12868
- toggle: RangeHookInstances
13150
+ toggle: RangeHookInstances,
13151
+ upload: EnumHookInstances
12869
13152
  };
12870
13153
  }, [
12871
13154
  getEnumFacetData,
@@ -13823,47 +14106,25 @@ const Workspace = ({ config })=>{
13823
14106
  };
13824
14107
 
13825
14108
  const TextDescription = ({ description })=>{
13826
- const [extend, setExtend] = useState(false);
13827
- const textRef = useRef(null);
13828
- const [isClamped, setClamped] = useState(false);
13829
- useEffect(()=>{
13830
- // Function that should be called on window resize
13831
- function handleResize() {
13832
- if (textRef && textRef.current) {
13833
- setClamped(textRef.current.scrollHeight > textRef.current.clientHeight);
13834
- }
13835
- }
13836
- // Add event listener to window resize
13837
- window.addEventListener('resize', handleResize);
13838
- // Remove event listener on cleanup
13839
- return ()=>window.removeEventListener('resize', handleResize);
13840
- }, []); // Empty array ensures that it would only run on mount
13841
- return /*#__PURE__*/ jsxs(Fragment, {
13842
- children: [
13843
- !extend ? /*#__PURE__*/ jsx(Text, {
13844
- ref: textRef,
13845
- size: "sm",
13846
- lineClamp: 4,
13847
- children: description
13848
- }) : /*#__PURE__*/ jsx(Text, {
13849
- size: "sm",
13850
- children: description
13851
- }),
13852
- isClamped && /*#__PURE__*/ jsx("button", {
13853
- onClick: ()=>setExtend((extend)=>!extend),
13854
- children: /*#__PURE__*/ jsxs("div", {
13855
- className: "flex text-xs font-semibold text-base-contrast-light",
13856
- children: [
13857
- !extend ? 'Extend Text' : 'Collapse Text',
13858
- ' ',
13859
- /*#__PURE__*/ jsx("div", {
13860
- className: "my-auto",
13861
- children: !extend ? /*#__PURE__*/ jsx(MdKeyboardArrowDown, {}) : /*#__PURE__*/ jsx(MdKeyboardArrowUp, {})
13862
- })
13863
- ]
14109
+ return /*#__PURE__*/ jsx(Spoiler, {
14110
+ maxHeight: 80,
14111
+ showLabel: /*#__PURE__*/ jsxs("span", {
14112
+ children: [
14113
+ "Extend Text ",
14114
+ /*#__PURE__*/ jsx(MdKeyboardArrowDown, {
14115
+ className: "inline"
13864
14116
  })
13865
- })
13866
- ]
14117
+ ]
14118
+ }),
14119
+ hideLabel: /*#__PURE__*/ jsxs("span", {
14120
+ children: [
14121
+ "Collapse Text ",
14122
+ /*#__PURE__*/ jsx(MdKeyboardArrowUp, {
14123
+ className: "inline"
14124
+ })
14125
+ ]
14126
+ }),
14127
+ children: description
13867
14128
  });
13868
14129
  };
13869
14130
 
@@ -13871,20 +14132,22 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
13871
14132
  return /*#__PURE__*/ jsxs(Stack, {
13872
14133
  align: "stretch",
13873
14134
  justify: "space-between",
13874
- className: "rounded-sm rounded-t-md bg-base-max p-0",
14135
+ className: "rounded-sm rounded-t-md bg-base-max p-0 h-full",
13875
14136
  children: [
13876
14137
  /*#__PURE__*/ jsxs("div", {
13877
- className: "h-full",
14138
+ className: "relative",
13878
14139
  children: [
13879
14140
  /*#__PURE__*/ jsx("div", {
13880
- className: "p-0 rounded-sm h-1/2 h-max-1/2",
13881
- children: /*#__PURE__*/ jsx(Image$1, {
13882
- component: Image,
13883
- src: `${image}`,
13884
- alt: `${title} image`,
13885
- height: 1000,
13886
- width: 1000,
13887
- radius: "md"
14141
+ className: "p-0 rounded-sm h-[200px] h-max-1/2 flex justify-center items-center relative overflow-hidden",
14142
+ children: /*#__PURE__*/ jsx("div", {
14143
+ children: /*#__PURE__*/ jsx(Image$1, {
14144
+ component: Image,
14145
+ src: `${image}`,
14146
+ alt: "",
14147
+ radius: "md",
14148
+ width: 500,
14149
+ height: 500
14150
+ })
13888
14151
  })
13889
14152
  }),
13890
14153
  /*#__PURE__*/ jsxs("div", {
@@ -13895,7 +14158,7 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
13895
14158
  children: /*#__PURE__*/ jsx(Image$1, {
13896
14159
  component: Image,
13897
14160
  src: `${icon}`,
13898
- alt: `${title} logo`,
14161
+ alt: "",
13899
14162
  width: 40,
13900
14163
  height: 40,
13901
14164
  radius: "lg"
@@ -16939,7 +17202,7 @@ const registerCohortDiscoveryApp = ()=>createGen3AppWithOwnStore({
16939
17202
  App: CohortDiscovery,
16940
17203
  id: AppId$1,
16941
17204
  name: _APP_NAME$2,
16942
- version: 'v1.0.0',
17205
+ version: _APP_VERSION$1,
16943
17206
  requiredEntityTypes: [],
16944
17207
  store: AppStore,
16945
17208
  context: AppContext
@@ -17350,7 +17613,7 @@ const ComparisonCard = ({ config, groundData, groundLabel, comparisonData, compa
17350
17613
  fw: 600,
17351
17614
  children: fieldNameToTitle(field)
17352
17615
  }),
17353
- /*#__PURE__*/ jsx(SegmentedControl, {
17616
+ /*#__PURE__*/ jsx(SegmentedControl$1, {
17354
17617
  value: viewType,
17355
17618
  onChange: setViewType,
17356
17619
  data: [
@@ -19131,6 +19394,98 @@ const registerMetadataSchemaApp = ()=>createGen3App({
19131
19394
  requiredEntityTypes: []
19132
19395
  });
19133
19396
 
19397
+ const ADDITIONAL_DOWNLOAD_MESSAGE = 'A previous download is being processed. Additional downloads may be started.';
19398
+ const DropdownWithIcon = ({ disableTargetWidth, LeftSection, RightSection = /*#__PURE__*/ jsx("div", {
19399
+ className: "border-l pl-1 -mr-2",
19400
+ children: /*#__PURE__*/ jsx(IoMdArrowDropdown, {
19401
+ size: "1.25em",
19402
+ "aria-hidden": "true",
19403
+ "data-testid": "dropdown-icon"
19404
+ })
19405
+ }), TargetButtonChildren, targetButtonDisabled, dropdownElements, menuLabelText, menuLabelCustomClass, customPosition, fullHeight, zIndex = 900, customTargetButtonDataTestId = undefined, targetButtonTooltip = undefined, buttonAriaLabel = undefined, closeOnItemClick = true })=>{
19406
+ const targetRef = useRef(null);
19407
+ return /*#__PURE__*/ jsxs(Menu, {
19408
+ width: !disableTargetWidth ? 'target' : null,
19409
+ ...customPosition && {
19410
+ position: customPosition
19411
+ },
19412
+ zIndex: zIndex,
19413
+ closeOnItemClick: closeOnItemClick,
19414
+ children: [
19415
+ /*#__PURE__*/ jsx(Menu.Target, {
19416
+ children: /*#__PURE__*/ jsx(Tooltip, {
19417
+ label: targetButtonTooltip,
19418
+ disabled: !targetButtonTooltip,
19419
+ children: /*#__PURE__*/ jsx(Button, {
19420
+ variant: "outline",
19421
+ color: "primary",
19422
+ className: `flex items-center bg-base-max border-primary data-disabled:opacity-50 data-disabled:bg-base-max data-disabled:text-primary ${focusStyles}`,
19423
+ ...LeftSection && {
19424
+ leftSection: LeftSection
19425
+ },
19426
+ rightSection: RightSection,
19427
+ disabled: targetButtonDisabled,
19428
+ classNames: {
19429
+ root: `${fullHeight ? 'h-full' : undefined}`
19430
+ },
19431
+ ref: targetRef,
19432
+ "aria-label": buttonAriaLabel,
19433
+ "data-testid": customTargetButtonDataTestId ?? 'menu-elem',
19434
+ children: TargetButtonChildren
19435
+ })
19436
+ })
19437
+ }),
19438
+ /*#__PURE__*/ jsxs(Menu.Dropdown, {
19439
+ "data-testid": "dropdown-menu-options",
19440
+ className: "border-1 border-secondary",
19441
+ children: [
19442
+ menuLabelText && /*#__PURE__*/ jsxs(Fragment, {
19443
+ children: [
19444
+ /*#__PURE__*/ jsx(Menu.Label, {
19445
+ className: menuLabelCustomClass ?? 'font-bold',
19446
+ "data-testid": "menu-label",
19447
+ children: menuLabelText
19448
+ }),
19449
+ /*#__PURE__*/ jsx(Menu.Divider, {})
19450
+ ]
19451
+ }),
19452
+ dropdownElements.map(({ title, onClick, icon, disabled, isLoading, loadingTooltip }, idx)=>{
19453
+ const menuItem = /*#__PURE__*/ jsx(Menu.Item, {
19454
+ onClick: ()=>{
19455
+ if (onClick) {
19456
+ onClick();
19457
+ }
19458
+ // This is done inorder to set the last focused element as the menu target element
19459
+ // This is done to return focus to the target element if the modal is closed with ESC
19460
+ if (targetRef?.current) {
19461
+ targetRef?.current?.focus();
19462
+ }
19463
+ },
19464
+ "data-testid": `${title}-${idx}`,
19465
+ leftSection: icon && icon,
19466
+ disabled: disabled,
19467
+ children: title
19468
+ }, `${title}-${idx}`);
19469
+ if (isLoading) {
19470
+ return /*#__PURE__*/ jsx(Tooltip, {
19471
+ label: loadingTooltip || ADDITIONAL_DOWNLOAD_MESSAGE,
19472
+ position: "right",
19473
+ withArrow: true,
19474
+ multiline: true,
19475
+ w: 400,
19476
+ children: /*#__PURE__*/ jsx("div", {
19477
+ children: menuItem
19478
+ })
19479
+ }, `${title}-${idx}`);
19480
+ }
19481
+ return menuItem;
19482
+ })
19483
+ ]
19484
+ })
19485
+ ]
19486
+ });
19487
+ };
19488
+
19134
19489
  const ActionButton = ({ title, enabled, type, leftIcon, rightIcon, tooltipText })=>{
19135
19490
  return /*#__PURE__*/ jsx(Tooltip, {
19136
19491
  label: tooltipText,
@@ -25590,5 +25945,5 @@ const staticNotebookAPI = async (req, res)=>{
25590
25945
  });
25591
25946
  };
25592
25947
 
25593
- export { AISearchPageGetServerSideProps, AccessLevel, ActionBar, ActionButton, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisCenterWithSections, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BAD_DATA_MESSAGE, Banner, BaseModal, Charts, CohortBuilder, CohortManager$1 as CohortManager, CollapsableCharts, CollapsableSidebar, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource$1 as ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DAYS_IN_YEAR, DEFAULT_MAXIMUM, DEFAULT_MINIMUM, DEFAULT_VISIBLE_ITEMS$1 as DEFAULT_VISIBLE_ITEMS, DataLibraryPage, DataLibraryPageGetServerSideProps, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, DropdownButton, EnumFacet, EnumFacetChart, ErrorCard, ExactValueFacet, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerPageGetServerSidePropsForConfigId, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FacetControlsHeader, FacetExpander, FacetSelector, FacetSortPanel, FacetTabs, FirstTimeModal, Footer, Gen3Button, Gen3ButtonReverse, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header$1 as Header, HoverLink, LandingPage, LandingPageGetServerSideProps, LoginButton$1 as LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, MinutesToMilliseconds, MultiSelectValueFacet, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryExpression, QueryExpressionContext, QueryExpressionSection, QueryPage, QueryPageGetServerSideProps, RangeFacet, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SessionExpiredModal, SinglePageStudyDetailsPanel, StaticNotebookIFrame, StaticNotebookViewer, StudyDetailsPanel, StudyGroup, StudyGroupPanel, StudyProvider, SubmissionPage, SubmissionPageGetServerSideProps, TabbedCohortBuilder, TabbedCohortBuilderPage, TabbedCohortBuilderPageGetServerSideProps, TagCloud, TailwindConfig, TopBar, UploadJSONButton, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, accessibleFieldName, addIntersectionToIncludes, addUnion, analysisApiCohortDiscovery, buildNested, capitalize, classifyFacets, compareKeysAscending, compareKeysDescending, computeRowSpan, convertMinutesToMilliseconds, convertPathsToTree, convertSecondsToMilliseconds, convertToStringArray, create10ColorAccessibleContrast, create10ColorPallet, createMantineTheme, credentialsLogin, credentialsLogout, extractObjectKey, extractRangeValues, focusStyles, getAllFieldsFromFilterConfigs, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isEnumFacetResponse, isHeaderMetadata, isPropertyKey, isTextTransform$1 as isTextTransform, mapFacetSortToSortType, processBucketData, processLabel$1 as processLabel, processRangeData, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortSimilarityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, registerMetadataSchemaApp, removeIntersectionFromEnum, removeKey$1 as removeKey, removeUnion, resourcePathFromProjectID, sessionLogout, sessionToken, staticNotebookAPI, stripTrailingSlash, toCountsString, toDisplayName, truncateString, unixTimeToString, updateFacetEnum, useClearFilters$1 as useClearFilters, useDiscoveryContext, useExtractEnumFilterValues, useExtractRangeFilterValues, useFieldNameToTitle, useGetFacetFilters$1 as useGetFacetFilters, useUpdateFilters$1 as useUpdateFilters, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
25948
+ export { AISearchPageGetServerSideProps, AccessLevel, AccordionPanel, ActionBar, ActionButton, AdminAuthZPageGetServerSideProps, AiSearch, AISearchPage as AiSearchPage, AnalysisCenter, AnalysisCenterWithSections, AnalysisEditorPage, AnalysisEditorPageGetServerSideProps, AnalysisPage, AnalysisPageGetServerSideProps, AuthzPage, BAD_DATA_MESSAGE, Banner, BaseModal, Charts, CohortBuilder, CohortManager$1 as CohortManager, CollapsableCharts, CollapsableSidebar, ColorThemePage, ColorThemePageGetServerSideProps, ContentSource$1 as ContentSource, CreateCredentialsAPIKeyModal, CrosswalkPage, CrosswalkPageGetServerSideProps, Custom404Page, DAYS_IN_YEAR, DEFAULT_MAXIMUM, DEFAULT_MINIMUM, DEFAULT_VISIBLE_ITEMS$1 as DEFAULT_VISIBLE_ITEMS, DataLibraryPage, DataLibraryPageGetServerSideProps, DictionaryPage, DictionaryPageGetServerSideProps, DiscoveryCellRendererFactory, DiscoveryProvider as DiscoveryConfigProvider, DiscoveryIndexPanel, DiscoveryPage, DiscoveryPageGetServerSideProps, DiscoveryRowRendererFactory, DropdownButton, DropdownPanel, DropdownWithIcon, EnumFacet, EnumFacetChart, ErrorCard, ExactValueFacet, ExplorerPage, ExplorerPageGetServerSideProps, ExplorerPageGetServerSidePropsForConfigId, ExplorerTableCellRendererFactory, ExplorerTableDetailsPanelFactory, FacetControlsHeader, FacetExpander, FacetSelector, FacetSortPanel, FacetTabs, FiltersPanel, FirstTimeModal, Footer, Gen3Button, Gen3ButtonReverse, Gen3Link, Gen3ModalsProvider, Gen3Provider, GqlQueryEditor$1 as GqlQueryEditor, Header$1 as Header, HoverLink, LandingPage, LandingPageGetServerSideProps, LoginButton$1 as LoginButton, LoginPage, LoginPageGetServerSideProps, LoginPanel, LoginProvidersPanel, MinutesToMilliseconds, MultiSelectValueFacet, NavPageLayout, NavigationBar, NavigationButton, NoAccessModal, NotebookLitePage, NotebookLitePageGetStaticProps, ProfilePage, ProfilePageGetServerSideProps, ProfileProvider, ProtectedContent, QueryExpression, QueryExpressionContext, QueryExpressionSection, QueryPage, QueryPageGetServerSideProps, RangeFacet, ReactECharts, ResourcesFilters, SPECIAL_CASE_FIELDS, SegmentedControl, SessionExpiredModal, SinglePageStudyDetailsPanel, StaticNotebookIFrame, StaticNotebookViewer, StudyDetailsPanel, StudyGroup, StudyGroupPanel, StudyProvider, SubmissionPage, SubmissionPageGetServerSideProps, TabbedCohortBuilder, TabbedCohortBuilderPage, TabbedCohortBuilderPageGetServerSideProps, TabbedPanel, TagCloud, TailwindConfig, TopBar, UploadJSONButton, User, Workspace, WorkspaceNoAccessPage, WorkspaceNoAccessPageServerSideProps, WorkspacePage, WorkspacePageGetServerSideProps, accessibleFieldName, addIntersectionToIncludes, addUnion, analysisApiCohortDiscovery, buildNested, capitalize, classifyFacets, compareKeysAscending, compareKeysDescending, computeRowSpan, convertMinutesToMilliseconds, convertPathsToTree, convertSecondsToMilliseconds, convertToStringArray, create10ColorAccessibleContrast, create10ColorPallet, createMantineTheme, credentialsLogin, credentialsLogout, extractObjectKey, extractRangeValues, focusStyles, getAllFieldsFromFilterConfigs, getCurrentUnixTimestamp, getNavPageLayoutPropsFromConfig, getParamsValueAsString, getTagInfo, hasOwnProperty, isArrayOfString, isEnumFacetResponse, isHeaderMetadata, isPropertyKey, isTextTransform$1 as isTextTransform, mapFacetSortToSortType, processBucketData, processLabel$1 as processLabel, processRangeData, processRangeKeyLabel, registerCohortBuilderDefaultPreviewRenderers, registerCohortDiscoveryApp, registerCohortSimilarityApp, registerDefaultDiscoveryDataLoaders, registerDiscoveryDefaultCellRenderers, registerDiscoveryDefaultStudyPreviewRenderers, registerExplorerDefaultCellRenderers, registerMetadataSchemaApp, removeIntersectionFromEnum, removeKey$1 as removeKey, removeUnion, resourcePathFromProjectID, sessionLogout, sessionToken, staticNotebookAPI, stripTrailingSlash, toCountsString, toDisplayName, truncateString, unixTimeToString, updateFacetEnum, useClearFilters$1 as useClearFilters, useDiscoveryContext, useExtractEnumFilterValues, useExtractRangeFilterValues, useFieldNameToTitle, useGetFacetFilters$1 as useGetFacetFilters, useUpdateFilters$1 as useUpdateFilters, userHasMethodForServiceOnResource$1 as userHasMethodForServiceOnResource };
25594
25949
  //# sourceMappingURL=index.js.map