@gen3/frontend 0.11.11 → 0.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/dist/cjs/index.js +979 -722
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/MessageCards/ErrorMessage.js +1 -1
  4. package/dist/dts/components/MessageCards/ErrorMessage.js.map +1 -1
  5. package/dist/dts/components/facets/FacetSelectionModal.d.ts +1 -2
  6. package/dist/dts/components/facets/FacetSelectionModal.d.ts.map +1 -1
  7. package/dist/dts/components/facets/FacetSelectionModal.js.map +1 -1
  8. package/dist/dts/components/facets/FacetSelector.d.ts +1 -2
  9. package/dist/dts/components/facets/FacetSelector.d.ts.map +1 -1
  10. package/dist/dts/components/facets/FacetSelector.js +1 -1
  11. package/dist/dts/components/facets/FacetSelector.js.map +1 -1
  12. package/dist/dts/components/facets/FacetTabs.d.ts +1 -2
  13. package/dist/dts/components/facets/FacetTabs.d.ts.map +1 -1
  14. package/dist/dts/components/facets/FacetTabs.js.map +1 -1
  15. package/dist/dts/components/facets/FiltersPanel.d.ts +9 -0
  16. package/dist/dts/components/facets/FiltersPanel.d.ts.map +1 -0
  17. package/dist/dts/{features/CohortBuilder → components/facets}/FiltersPanel.js +3 -2
  18. package/dist/dts/components/facets/FiltersPanel.js.map +1 -0
  19. package/dist/dts/components/facets/Panels/AccordianPanel.d.ts.map +1 -0
  20. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/AccordianPanel.js +1 -1
  21. package/dist/dts/components/facets/Panels/AccordianPanel.js.map +1 -0
  22. package/dist/dts/components/facets/Panels/DropdownPanel.d.ts.map +1 -0
  23. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/DropdownPanel.js +3 -3
  24. package/dist/dts/components/facets/Panels/DropdownPanel.js.map +1 -0
  25. package/dist/dts/components/facets/Panels/TabbedPanel.d.ts +4 -0
  26. package/dist/dts/components/facets/Panels/TabbedPanel.d.ts.map +1 -0
  27. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/TabbedPanel.js +3 -2
  28. package/dist/dts/components/facets/Panels/TabbedPanel.js.map +1 -0
  29. package/dist/dts/components/facets/Panels/index.d.ts +5 -0
  30. package/dist/dts/components/facets/Panels/index.d.ts.map +1 -0
  31. package/dist/dts/components/facets/Panels/index.js +5 -0
  32. package/dist/dts/components/facets/Panels/index.js.map +1 -0
  33. package/dist/dts/{features/CohortBuilder → components/facets}/Panels/types.d.ts +4 -3
  34. package/dist/dts/components/facets/Panels/types.d.ts.map +1 -0
  35. package/dist/dts/components/facets/Panels/types.js.map +1 -0
  36. package/dist/dts/components/facets/createFacetCard.d.ts +1 -2
  37. package/dist/dts/components/facets/createFacetCard.d.ts.map +1 -1
  38. package/dist/dts/components/facets/createFacetCard.js.map +1 -1
  39. package/dist/dts/components/facets/createFacetCards.d.ts +1 -2
  40. package/dist/dts/components/facets/createFacetCards.d.ts.map +1 -1
  41. package/dist/dts/components/facets/createFacetCards.js.map +1 -1
  42. package/dist/dts/components/facets/index.d.ts +6 -1
  43. package/dist/dts/components/facets/index.d.ts.map +1 -1
  44. package/dist/dts/components/facets/index.js +6 -1
  45. package/dist/dts/components/facets/index.js.map +1 -1
  46. package/dist/dts/components/facets/types.d.ts +13 -2
  47. package/dist/dts/components/facets/types.d.ts.map +1 -1
  48. package/dist/dts/components/facets/utils.d.ts +2 -2
  49. package/dist/dts/components/facets/utils.d.ts.map +1 -1
  50. package/dist/dts/components/facets/utils.js +1 -1
  51. package/dist/dts/components/facets/utils.js.map +1 -1
  52. package/dist/dts/features/Analysis/AnalysisCard.js +1 -1
  53. package/dist/dts/features/Analysis/AnalysisCard.js.map +1 -1
  54. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +4 -4
  55. package/dist/dts/features/CohortBuilder/CohortManager/modals/SaveOrCreateEntityModal.js +1 -1
  56. package/dist/dts/features/CohortBuilder/CohortManager/modals/SaveOrCreateEntityModal.js.map +1 -1
  57. package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
  58. package/dist/dts/features/CohortBuilder/CohortPanel.js +1 -1
  59. package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
  60. package/dist/dts/features/CohortBuilder/ExplorerTable/ArrayCellRenderer.d.ts +1 -1
  61. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.d.ts.map +1 -1
  62. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js +16 -32
  63. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js.map +1 -1
  64. package/dist/dts/features/CohortBuilder/types.d.ts +2 -2
  65. package/dist/dts/features/CohortBuilder/types.d.ts.map +1 -1
  66. package/dist/dts/features/CohortBuilder/types.js.map +1 -1
  67. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts +2 -1
  68. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.d.ts.map +1 -1
  69. package/dist/dts/features/CohortDiscovery/ChartsAndFacetsPanel.js.map +1 -1
  70. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManagerSelectors.d.ts +16 -16
  71. package/dist/dts/features/CohortDiscovery/FacetDefinitionsSlice.d.ts +1 -1
  72. package/dist/dts/features/CohortDiscovery/FacetDefinitionsSlice.d.ts.map +1 -1
  73. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts +1 -2
  74. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.d.ts.map +1 -1
  75. package/dist/dts/features/CohortDiscovery/FilterPanels/EnumFacetPanel.js.map +1 -1
  76. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts +2 -2
  77. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.d.ts.map +1 -1
  78. package/dist/dts/features/CohortDiscovery/FilterPanels/createFacetPanel.js.map +1 -1
  79. package/dist/dts/features/CohortDiscovery/RequestManagerSlice.d.ts +7 -7
  80. package/dist/dts/features/CohortDiscovery/appApi.d.ts +2 -2
  81. package/dist/dts/index.d.ts +3 -1
  82. package/dist/dts/index.d.ts.map +1 -1
  83. package/dist/dts/index.js +3 -1
  84. package/dist/dts/index.js.map +1 -1
  85. package/dist/esm/index.js +980 -729
  86. package/dist/esm/index.js.map +1 -1
  87. package/dist/index.d.ts +134 -5
  88. package/dist/tsconfig.tsbuildinfo +1 -1
  89. package/package.json +3 -3
  90. package/dist/dts/api/staticNotebook/index.d.ts +0 -4
  91. package/dist/dts/api/staticNotebook/index.d.ts.map +0 -1
  92. package/dist/dts/api/staticNotebook/index.js +0 -118
  93. package/dist/dts/api/staticNotebook/index.js.map +0 -1
  94. package/dist/dts/api/staticNotebooks/index.d.ts +0 -4
  95. package/dist/dts/api/staticNotebooks/index.d.ts.map +0 -1
  96. package/dist/dts/api/staticNotebooks/index.js +0 -118
  97. package/dist/dts/api/staticNotebooks/index.js.map +0 -1
  98. package/dist/dts/features/CohortBuilder/FiltersPanel.d.ts +0 -10
  99. package/dist/dts/features/CohortBuilder/FiltersPanel.d.ts.map +0 -1
  100. package/dist/dts/features/CohortBuilder/FiltersPanel.js.map +0 -1
  101. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.d.ts.map +0 -1
  102. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.js.map +0 -1
  103. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.d.ts.map +0 -1
  104. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.js.map +0 -1
  105. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.d.ts +0 -3
  106. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.d.ts.map +0 -1
  107. package/dist/dts/features/CohortBuilder/Panels/TabbedPanel.js.map +0 -1
  108. package/dist/dts/features/CohortBuilder/Panels/types.d.ts.map +0 -1
  109. package/dist/dts/features/CohortBuilder/Panels/types.js.map +0 -1
  110. package/dist/dts/features/CohortDiscovery/CohortManager.d.ts +0 -6
  111. package/dist/dts/features/CohortDiscovery/CohortManager.d.ts.map +0 -1
  112. package/dist/dts/features/CohortDiscovery/CohortManager.js +0 -55
  113. package/dist/dts/features/CohortDiscovery/CohortManager.js.map +0 -1
  114. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.d.ts +0 -135
  115. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.d.ts.map +0 -1
  116. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.js +0 -40
  117. package/dist/dts/features/CohortDiscovery/CohortManagerSlice.js.map +0 -1
  118. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.d.ts +0 -3
  119. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.d.ts.map +0 -1
  120. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.js +0 -9
  121. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsPanel.js.map +0 -1
  122. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.d.ts +0 -7
  123. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.d.ts.map +0 -1
  124. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.js +0 -101
  125. package/dist/dts/features/CohortDiscovery/SaveCohorts/SavedCohortsTable.js.map +0 -1
  126. package/dist/dts/features/CohortDiscovery/appApiRTKQ.d.ts +0 -1
  127. package/dist/dts/features/CohortDiscovery/appApiRTKQ.d.ts.map +0 -1
  128. package/dist/dts/features/CohortDiscovery/appApiRTKQ.js +0 -101
  129. package/dist/dts/features/CohortDiscovery/appApiRTKQ.js.map +0 -1
  130. package/dist/dts/features/Discovery/Charts/ChartsPanel.d.ts +0 -9
  131. package/dist/dts/features/Discovery/Charts/ChartsPanel.d.ts.map +0 -1
  132. package/dist/dts/features/Discovery/Charts/ChartsPanel.js +0 -24
  133. package/dist/dts/features/Discovery/Charts/ChartsPanel.js.map +0 -1
  134. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.d.ts +0 -9
  135. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.d.ts.map +0 -1
  136. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.js +0 -24
  137. package/dist/dts/features/Discovery/Charts/CollapsableChartsPanel.js.map +0 -1
  138. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.d.ts +0 -9
  139. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.d.ts.map +0 -1
  140. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.js +0 -12
  141. package/dist/dts/features/Discovery/StudyDetails/DetailsAuthorizationIcon.js.map +0 -1
  142. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.d.ts +0 -19
  143. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.d.ts.map +0 -1
  144. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.js +0 -56
  145. package/dist/dts/features/Discovery/StudyDetails/RendererFactory.js.map +0 -1
  146. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.d.ts +0 -14
  147. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.d.ts.map +0 -1
  148. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.js +0 -44
  149. package/dist/dts/features/Discovery/StudyDetails/SinglePageStudyDetailsPanel.js.map +0 -1
  150. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.d.ts +0 -3
  151. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.d.ts.map +0 -1
  152. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.js +0 -37
  153. package/dist/dts/features/Discovery/StudyDetails/StudyDetails.js.map +0 -1
  154. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.d.ts +0 -10
  155. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.d.ts.map +0 -1
  156. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.js +0 -19
  157. package/dist/dts/features/Discovery/StudyDetails/StudyDetailsPanel.js.map +0 -1
  158. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.d.ts +0 -8
  159. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.d.ts.map +0 -1
  160. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.js +0 -31
  161. package/dist/dts/features/Discovery/StudyDetails/StudyGroup.js.map +0 -1
  162. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.d.ts +0 -9
  163. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.d.ts.map +0 -1
  164. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.js +0 -11
  165. package/dist/dts/features/Discovery/StudyDetails/StudyGroupPanel.js.map +0 -1
  166. package/dist/dts/features/Discovery/StudyDetails/StudyItems.d.ts +0 -5
  167. package/dist/dts/features/Discovery/StudyDetails/StudyItems.d.ts.map +0 -1
  168. package/dist/dts/features/Discovery/StudyDetails/StudyItems.js +0 -283
  169. package/dist/dts/features/Discovery/StudyDetails/StudyItems.js.map +0 -1
  170. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.d.ts +0 -10
  171. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.d.ts.map +0 -1
  172. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.js +0 -45
  173. package/dist/dts/features/Discovery/StudyPage/DownloadLinksPanel.js.map +0 -1
  174. package/dist/dts/features/Discovery/StudyPage/StudyPage.d.ts +0 -10
  175. package/dist/dts/features/Discovery/StudyPage/StudyPage.d.ts.map +0 -1
  176. package/dist/dts/features/Discovery/StudyPage/StudyPage.js +0 -11
  177. package/dist/dts/features/Discovery/StudyPage/StudyPage.js.map +0 -1
  178. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.d.ts +0 -9
  179. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.d.ts.map +0 -1
  180. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.js +0 -8
  181. package/dist/dts/features/Discovery/StudyPage/StudyPageGroup.js.map +0 -1
  182. package/dist/dts/features/StaticNotebook/StaticNotebook.d.ts +0 -4
  183. package/dist/dts/features/StaticNotebook/StaticNotebook.d.ts.map +0 -1
  184. package/dist/dts/features/StaticNotebook/StaticNotebook.js +0 -79
  185. package/dist/dts/features/StaticNotebook/StaticNotebook.js.map +0 -1
  186. package/dist/dts/lib/notebooks/index.d.ts +0 -3
  187. package/dist/dts/lib/notebooks/index.d.ts.map +0 -1
  188. package/dist/dts/lib/notebooks/index.js +0 -96
  189. package/dist/dts/lib/notebooks/index.js.map +0 -1
  190. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/AccordianPanel.d.ts +0 -0
  191. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/DropdownPanel.d.ts +0 -0
  192. /package/dist/dts/{features/CohortBuilder → components/facets}/Panels/types.js +0 -0
package/dist/cjs/index.js CHANGED
@@ -26,10 +26,12 @@ var defaultComposer = require('default-composer');
26
26
  var react = require('@iconify-icon/react');
27
27
  var echarts = require('echarts');
28
28
  var victory = require('victory');
29
- var fa = require('react-icons/fa');
30
29
  var tw = require('tailwind-styled-components');
30
+ var form = require('@mantine/form');
31
31
  var ri = require('react-icons/ri');
32
+ var fa = require('react-icons/fa');
32
33
  var pi = require('react-icons/pi');
34
+ var modals = require('@mantine/modals');
33
35
  var Image = require('next/image');
34
36
  var Link = require('next/link');
35
37
  var ai = require('react-icons/ai');
@@ -45,7 +47,6 @@ var uniq = require('lodash/uniq');
45
47
  var sum = require('lodash/sum');
46
48
  var lu = require('react-icons/lu');
47
49
  require('universal-cookie');
48
- var modals = require('@mantine/modals');
49
50
  var GraphiQL = require('graphiql');
50
51
  var router$1 = require('next/dist/client/router');
51
52
  var fs = require('fs');
@@ -56,7 +57,6 @@ var redux = require('redux');
56
57
  var toolkit = require('@reduxjs/toolkit');
57
58
  var idb = require('idb');
58
59
  var createWebStorage = require('redux-persist/lib/storage/createWebStorage');
59
- var form = require('@mantine/form');
60
60
  var dynamic = require('next/dynamic');
61
61
  var YAML = require('yaml');
62
62
  var filesize = require('filesize');
@@ -3417,6 +3417,173 @@ const DEFAULT_MAXIMUM = 100;
3417
3417
  const BAD_DATA_MESSAGE = 'No data for this field';
3418
3418
  const DAYS_IN_YEAR = 365.25;
3419
3419
 
3420
+ const SegmentedControl = (props)=>{
3421
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.SegmentedControl, {
3422
+ classNames: {
3423
+ root: 'bg-base-max h-fit p-0',
3424
+ indicator: 'opacity-0',
3425
+ control: 'z-0 rounded-none border-0 [&:nth-child(2)>label]:rounded-l-md [&:last-child>label]:rounded-r-md [&:last-child>label]:border-r-1',
3426
+ label: `${props?.padding ? `p-${props.padding}` : 'p-0'} text-primary font-semibold data-active:text-base-max data-active:bg-primary data-disabled:bg-base-lightest data-disabled:text-base-lighter
3427
+ border-1 border-r-0 !border-primary rounded-none data-disabled:!border-base-lighter`
3428
+ },
3429
+ ...props
3430
+ });
3431
+ };
3432
+
3433
+ const ExpanderLabel = tw.div`
3434
+ text-accent-content-darker
3435
+ p-1
3436
+ font-bold
3437
+ cursor-pointer
3438
+ text-xs
3439
+ font-content
3440
+ `;
3441
+ /**
3442
+ * Component which manages the compact/expanded state of a FacetCard
3443
+ * @param remainingValues - number of remaining values when compact "show 4"
3444
+ * @param isGroupExpanded - true if expanded, false if compact
3445
+ * @param onShowChanged - callback to call when the expand/compact button is clicked
3446
+ */ const FacetExpander = ({ remainingValues, isGroupExpanded, onShowChanged })=>{
3447
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
3448
+ className: `mt-3 flex flex-row justify-end ${remainingValues > 0 && 'border-t-2'} p-1.5`,
3449
+ children: remainingValues > 0 && !isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3450
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3451
+ "data-testid": "plus-icon",
3452
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3453
+ className: "flex flex-row flex-nowrap items-center ",
3454
+ children: [
3455
+ /*#__PURE__*/ jsxRuntime.jsx(md.MdAddCircle, {
3456
+ className: "text-accent",
3457
+ size: "1rem",
3458
+ "aria-hidden": "true"
3459
+ }, "show-more"),
3460
+ /*#__PURE__*/ jsxRuntime.jsxs(ExpanderLabel, {
3461
+ children: [
3462
+ remainingValues,
3463
+ " more"
3464
+ ]
3465
+ })
3466
+ ]
3467
+ })
3468
+ }) : isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3469
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3470
+ "data-testid": "minus-icon",
3471
+ children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3472
+ className: "flex flex-row flex-nowrap items-center",
3473
+ children: [
3474
+ /*#__PURE__*/ jsxRuntime.jsx(md.MdRemoveCircle, {
3475
+ className: "text-accent",
3476
+ size: "1rem",
3477
+ onClick: ()=>onShowChanged(!isGroupExpanded),
3478
+ "aria-hidden": "true"
3479
+ }, "show-less"),
3480
+ /*#__PURE__*/ jsxRuntime.jsx(ExpanderLabel, {
3481
+ children: "show less"
3482
+ })
3483
+ ]
3484
+ })
3485
+ }) : null
3486
+ });
3487
+ };
3488
+
3489
+ const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
3490
+ if (sortTypeAndDirection.type === 'alpha') {
3491
+ return sortTypeAndDirection.direction === 'asc' ? `The ${field} names are now sorted alphabetically ascending` : `The ${field} names are now sorted alphabetically descending`;
3492
+ } else {
3493
+ return sortTypeAndDirection.direction === 'asc' ? `The ${field} ${valueLabel} are now sorted numerically ascending` : `The ${field} ${valueLabel} are now sorted numerically descending`;
3494
+ }
3495
+ };
3496
+ /**
3497
+ * FacetCards "sort" header supporting sort by A-Z or by Value both ascending and descending
3498
+ * @param sortType - current sort type
3499
+ * @param valueLabel - Value labels, typically "case" "file"
3500
+ * @param setSort - sets the sort type and direction
3501
+ * @param field - specifies the facet table name
3502
+ */ const FacetSortPanel = ({ sortType, valueLabel, setSort, field })=>{
3503
+ const liveRegionRef = React.useRef(null);
3504
+ const [sortingStatus, setSortingStatus] = React.useState('');
3505
+ React.useEffect(()=>{
3506
+ if (sortingStatus && liveRegionRef?.current) {
3507
+ liveRegionRef.current.textContent = sortingStatus;
3508
+ }
3509
+ }, [
3510
+ sortingStatus
3511
+ ]);
3512
+ const [NameSortIcon, nameIconSize] = sortType.type === 'alpha' ? sortType.direction === 'asc' ? [
3513
+ pi.PiCaretUpFill,
3514
+ '0.75rem'
3515
+ ] : [
3516
+ pi.PiCaretDownFill,
3517
+ '0.75rem'
3518
+ ] : [
3519
+ pi.PiCaretUpDownFill,
3520
+ '1rem'
3521
+ ];
3522
+ const [ValueSortIcon, valueIconSize] = sortType.type === 'value' ? sortType.direction === 'asc' ? [
3523
+ pi.PiCaretUpFill,
3524
+ '0.75rem'
3525
+ ] : [
3526
+ pi.PiCaretDownFill,
3527
+ '0.75rem'
3528
+ ] : [
3529
+ pi.PiCaretUpDownFill,
3530
+ '1rem'
3531
+ ];
3532
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
3533
+ className: "flex flex-row items-center justify-between flex-wrap py-1 px-2 mb-1 border-b-2",
3534
+ children: [
3535
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3536
+ className: "pl-0 ml-0 api-hovered:accent",
3537
+ variant: "transparent",
3538
+ size: "compact-xs",
3539
+ color: "base-contrast.5",
3540
+ onClick: ()=>{
3541
+ const direction = sortType.type === 'alpha' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3542
+ const sortObj = {
3543
+ type: 'alpha',
3544
+ direction
3545
+ };
3546
+ setSort(sortObj);
3547
+ setSortingStatus(sortTypeToAriaDescription(sortObj, 'Name', field));
3548
+ },
3549
+ rightSection: /*#__PURE__*/ jsxRuntime.jsx(NameSortIcon, {
3550
+ size: nameIconSize,
3551
+ "aria-hidden": "true"
3552
+ }),
3553
+ "aria-label": "Sort name alphabetically",
3554
+ children: "Name"
3555
+ }),
3556
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3557
+ className: "pr-0 mr-0",
3558
+ variant: "transparent",
3559
+ size: "compact-xs",
3560
+ color: "base-contrast.5",
3561
+ onClick: ()=>{
3562
+ const direction = sortType.type === 'value' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3563
+ const sortObj = {
3564
+ type: 'value',
3565
+ direction
3566
+ };
3567
+ setSort(sortObj);
3568
+ setSortingStatus(sortTypeToAriaDescription(sortObj, valueLabel, field));
3569
+ },
3570
+ rightSection: /*#__PURE__*/ jsxRuntime.jsx(ValueSortIcon, {
3571
+ size: valueIconSize,
3572
+ "aria-hidden": "true"
3573
+ }),
3574
+ "aria-label": `Sort ${valueLabel} numerically`,
3575
+ children: valueLabel
3576
+ }),
3577
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
3578
+ id: `${field}-liveRegion`,
3579
+ "aria-live": "polite",
3580
+ ref: liveRegionRef,
3581
+ className: "sr-only"
3582
+ })
3583
+ ]
3584
+ });
3585
+ };
3586
+
3420
3587
  const FacetIconButton = tw.button`
3421
3588
  text-base-max
3422
3589
  font-bold
@@ -3623,217 +3790,63 @@ flex items-start justify-between items-center flex-nowrap bg-secondary px-1.5 ro
3623
3790
  });
3624
3791
  };
3625
3792
 
3626
- const sortTypeToAriaDescription = (sortTypeAndDirection, valueLabel, field)=>{
3627
- if (sortTypeAndDirection.type === 'alpha') {
3628
- return sortTypeAndDirection.direction === 'asc' ? `The ${field} names are now sorted alphabetically ascending` : `The ${field} names are now sorted alphabetically descending`;
3629
- } else {
3630
- return sortTypeAndDirection.direction === 'asc' ? `The ${field} ${valueLabel} are now sorted numerically ascending` : `The ${field} ${valueLabel} are now sorted numerically descending`;
3631
- }
3793
+ const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
3794
+ const [showTooltip, setShowTooltip] = React.useState(false);
3795
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
3796
+ label: label,
3797
+ disabled: !showTooltip,
3798
+ position: "top-start",
3799
+ offset: 5,
3800
+ multiline: true,
3801
+ withArrow: true,
3802
+ arrowOffset: 20,
3803
+ classNames: {
3804
+ tooltip: 'bg-base-min bg-opacity-90 text-base-contrast-min shadow-lg font-content font-medium text-xs',
3805
+ arrow: 'bg-base-min bg-opacity-90'
3806
+ },
3807
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
3808
+ className: `${className} truncate ... `,
3809
+ ref: (el)=>{
3810
+ if (el) {
3811
+ if (el.clientWidth < el.scrollWidth) {
3812
+ setShowTooltip(true);
3813
+ } else {
3814
+ setShowTooltip(false);
3815
+ }
3816
+ }
3817
+ },
3818
+ children: children
3819
+ })
3820
+ });
3632
3821
  };
3633
- /**
3634
- * FacetCards "sort" header supporting sort by A-Z or by Value both ascending and descending
3635
- * @param sortType - current sort type
3636
- * @param valueLabel - Value labels, typically "case" "file"
3637
- * @param setSort - sets the sort type and direction
3638
- * @param field - specifies the facet table name
3639
- */ const FacetSortPanel = ({ sortType, valueLabel, setSort, field })=>{
3640
- const liveRegionRef = React.useRef(null);
3641
- const [sortingStatus, setSortingStatus] = React.useState('');
3822
+
3823
+ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true, sort = 'value-dsc' })=>{
3824
+ const [isGroupExpanded, setIsGroupExpanded] = React.useState(false);
3825
+ const cardRef = React.useRef(null);
3826
+ const searchInputRef = React.useRef(null);
3827
+ const settingRef = React.useRef(null);
3828
+ const [searchTerm, setSearchTerm] = React.useState('');
3829
+ // const [combineMode, setCombineMode] = useState<'or' | 'and'>('or');
3830
+ const { data, enumFilters, combineMode, isSuccess, error } = hooks.useGetFacetData(field);
3831
+ const [selectedEnums, setSelectedEnums] = React.useState(enumFilters ?? []);
3832
+ const totalCount = hooks?.useTotalCounts ? hooks.useTotalCounts() : 1;
3833
+ const clearFilters = hooks.useClearFilter();
3834
+ const updateFacetFilters = hooks.useUpdateFacetFilters();
3835
+ const isFilterExpanded = hooks?.useFilterExpanded && hooks.useFilterExpanded(field);
3836
+ const showFilters = isFilterExpanded === undefined || isFilterExpanded;
3837
+ const [sortedData, setSortedData] = React.useState([]);
3838
+ const [sortType, setSortType] = React.useState(mapFacetSortToSortType(sort));
3839
+ const theme = core$1.useMantineTheme();
3840
+ const updateVisibleValues = hooks?.updateVisibleValues;
3642
3841
  React.useEffect(()=>{
3643
- if (sortingStatus && liveRegionRef?.current) {
3644
- liveRegionRef.current.textContent = sortingStatus;
3842
+ if (isSearching) {
3843
+ searchInputRef?.current?.focus();
3844
+ } else if (searchTerm.length > 0) {
3845
+ setSearchTerm('');
3645
3846
  }
3646
3847
  }, [
3647
- sortingStatus
3648
- ]);
3649
- const [NameSortIcon, nameIconSize] = sortType.type === 'alpha' ? sortType.direction === 'asc' ? [
3650
- pi.PiCaretUpFill,
3651
- '0.75rem'
3652
- ] : [
3653
- pi.PiCaretDownFill,
3654
- '0.75rem'
3655
- ] : [
3656
- pi.PiCaretUpDownFill,
3657
- '1rem'
3658
- ];
3659
- const [ValueSortIcon, valueIconSize] = sortType.type === 'value' ? sortType.direction === 'asc' ? [
3660
- pi.PiCaretUpFill,
3661
- '0.75rem'
3662
- ] : [
3663
- pi.PiCaretDownFill,
3664
- '0.75rem'
3665
- ] : [
3666
- pi.PiCaretUpDownFill,
3667
- '1rem'
3668
- ];
3669
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
3670
- className: "flex flex-row items-center justify-between flex-wrap py-1 px-2 mb-1 border-b-2",
3671
- children: [
3672
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3673
- className: "pl-0 ml-0 api-hovered:accent",
3674
- variant: "transparent",
3675
- size: "compact-xs",
3676
- color: "base-contrast.5",
3677
- onClick: ()=>{
3678
- const direction = sortType.type === 'alpha' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3679
- const sortObj = {
3680
- type: 'alpha',
3681
- direction
3682
- };
3683
- setSort(sortObj);
3684
- setSortingStatus(sortTypeToAriaDescription(sortObj, 'Name', field));
3685
- },
3686
- rightSection: /*#__PURE__*/ jsxRuntime.jsx(NameSortIcon, {
3687
- size: nameIconSize,
3688
- "aria-hidden": "true"
3689
- }),
3690
- "aria-label": "Sort name alphabetically",
3691
- children: "Name"
3692
- }),
3693
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
3694
- className: "pr-0 mr-0",
3695
- variant: "transparent",
3696
- size: "compact-xs",
3697
- color: "base-contrast.5",
3698
- onClick: ()=>{
3699
- const direction = sortType.type === 'value' && sortType.direction === 'asc' ? 'dsc' : 'asc';
3700
- const sortObj = {
3701
- type: 'value',
3702
- direction
3703
- };
3704
- setSort(sortObj);
3705
- setSortingStatus(sortTypeToAriaDescription(sortObj, valueLabel, field));
3706
- },
3707
- rightSection: /*#__PURE__*/ jsxRuntime.jsx(ValueSortIcon, {
3708
- size: valueIconSize,
3709
- "aria-hidden": "true"
3710
- }),
3711
- "aria-label": `Sort ${valueLabel} numerically`,
3712
- children: valueLabel
3713
- }),
3714
- /*#__PURE__*/ jsxRuntime.jsx("span", {
3715
- id: `${field}-liveRegion`,
3716
- "aria-live": "polite",
3717
- ref: liveRegionRef,
3718
- className: "sr-only"
3719
- })
3720
- ]
3721
- });
3722
- };
3723
-
3724
- const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-heading text-md pt-0.5' })=>{
3725
- const [showTooltip, setShowTooltip] = React.useState(false);
3726
- return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
3727
- label: label,
3728
- disabled: !showTooltip,
3729
- position: "top-start",
3730
- offset: 5,
3731
- multiline: true,
3732
- withArrow: true,
3733
- arrowOffset: 20,
3734
- classNames: {
3735
- tooltip: 'bg-base-min bg-opacity-90 text-base-contrast-min shadow-lg font-content font-medium text-xs',
3736
- arrow: 'bg-base-min bg-opacity-90'
3737
- },
3738
- children: /*#__PURE__*/ jsxRuntime.jsx("div", {
3739
- className: `${className} truncate ... `,
3740
- ref: (el)=>{
3741
- if (el) {
3742
- if (el.clientWidth < el.scrollWidth) {
3743
- setShowTooltip(true);
3744
- } else {
3745
- setShowTooltip(false);
3746
- }
3747
- }
3748
- },
3749
- children: children
3750
- })
3751
- });
3752
- };
3753
-
3754
- const ExpanderLabel = tw.div`
3755
- text-accent-content-darker
3756
- p-1
3757
- font-bold
3758
- cursor-pointer
3759
- text-xs
3760
- font-content
3761
- `;
3762
- /**
3763
- * Component which manages the compact/expanded state of a FacetCard
3764
- * @param remainingValues - number of remaining values when compact "show 4"
3765
- * @param isGroupExpanded - true if expanded, false if compact
3766
- * @param onShowChanged - callback to call when the expand/compact button is clicked
3767
- */ const FacetExpander = ({ remainingValues, isGroupExpanded, onShowChanged })=>{
3768
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
3769
- className: `mt-3 flex flex-row justify-end ${remainingValues > 0 && 'border-t-2'} p-1.5`,
3770
- children: remainingValues > 0 && !isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3771
- onClick: ()=>onShowChanged(!isGroupExpanded),
3772
- "data-testid": "plus-icon",
3773
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3774
- className: "flex flex-row flex-nowrap items-center ",
3775
- children: [
3776
- /*#__PURE__*/ jsxRuntime.jsx(md.MdAddCircle, {
3777
- className: "text-accent",
3778
- size: "1rem",
3779
- "aria-hidden": "true"
3780
- }, "show-more"),
3781
- /*#__PURE__*/ jsxRuntime.jsxs(ExpanderLabel, {
3782
- children: [
3783
- remainingValues,
3784
- " more"
3785
- ]
3786
- })
3787
- ]
3788
- })
3789
- }) : isGroupExpanded ? /*#__PURE__*/ jsxRuntime.jsx("button", {
3790
- onClick: ()=>onShowChanged(!isGroupExpanded),
3791
- "data-testid": "minus-icon",
3792
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
3793
- className: "flex flex-row flex-nowrap items-center",
3794
- children: [
3795
- /*#__PURE__*/ jsxRuntime.jsx(md.MdRemoveCircle, {
3796
- className: "text-accent",
3797
- size: "1rem",
3798
- onClick: ()=>onShowChanged(!isGroupExpanded),
3799
- "aria-hidden": "true"
3800
- }, "show-less"),
3801
- /*#__PURE__*/ jsxRuntime.jsx(ExpanderLabel, {
3802
- children: "show less"
3803
- })
3804
- ]
3805
- })
3806
- }) : null
3807
- });
3808
- };
3809
-
3810
- const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false, isFacetView = true, isSearching = false, showPercent = false, hideIfEmpty = false, showSorting = true, sort = 'value-dsc' })=>{
3811
- const [isGroupExpanded, setIsGroupExpanded] = React.useState(false);
3812
- const cardRef = React.useRef(null);
3813
- const searchInputRef = React.useRef(null);
3814
- const settingRef = React.useRef(null);
3815
- const [searchTerm, setSearchTerm] = React.useState('');
3816
- // const [combineMode, setCombineMode] = useState<'or' | 'and'>('or');
3817
- const { data, enumFilters, combineMode, isSuccess, error } = hooks.useGetFacetData(field);
3818
- const [selectedEnums, setSelectedEnums] = React.useState(enumFilters ?? []);
3819
- const totalCount = hooks?.useTotalCounts ? hooks.useTotalCounts() : 1;
3820
- const clearFilters = hooks.useClearFilter();
3821
- const updateFacetFilters = hooks.useUpdateFacetFilters();
3822
- const isFilterExpanded = hooks?.useFilterExpanded && hooks.useFilterExpanded(field);
3823
- const showFilters = isFilterExpanded === undefined || isFilterExpanded;
3824
- const [sortedData, setSortedData] = React.useState([]);
3825
- const [sortType, setSortType] = React.useState(mapFacetSortToSortType(sort));
3826
- const theme = core$1.useMantineTheme();
3827
- const updateVisibleValues = hooks?.updateVisibleValues;
3828
- React.useEffect(()=>{
3829
- if (isSearching) {
3830
- searchInputRef?.current?.focus();
3831
- } else if (searchTerm.length > 0) {
3832
- setSearchTerm('');
3833
- }
3834
- }, [
3835
- isSearching,
3836
- searchTerm
3848
+ isSearching,
3849
+ searchTerm
3837
3850
  ]);
3838
3851
  React.useEffect(()=>{
3839
3852
  if (isSettings) {
@@ -4223,194 +4236,54 @@ const EnumFacet = ({ field, hooks, valueLabel, description, facetName, showPerce
4223
4236
  });
4224
4237
  };
4225
4238
 
4226
- const instanceOfIncludesExcludes$1 = (op)=>[
4227
- 'in'
4228
- ].includes(op.operator); // TODO: Guppy does not support excludes
4229
- /**
4230
- * Extracts the operands if the operation isIncludes or Excludes. Returns an empty Array
4231
- * if filter is not the correct type.
4232
- * @param operation - filters to extract values from
4233
- */ const extractValues = (operation)=>{
4234
- if (operation && instanceOfIncludesExcludes$1(operation)) {
4235
- return operation.operands;
4236
- }
4237
- return [];
4238
- };
4239
- /**
4240
- * Exact value facet component
4241
- * @param field - field to facet on
4242
- * @param description - description of the facet
4243
- * @param facetName - name of the facet
4244
- * @param dismissCallback - callback function to dismiss the facet
4245
- * @param width - width of the facet
4246
- * @param hooks - hooks to use for the facet
4247
- * @param header - header components
4248
- * @category Facets
4249
- */ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks, header = {
4239
+ const createBucket = (field, lower, upper)=>({
4240
+ operator: 'and',
4241
+ operands: [
4242
+ {
4243
+ field,
4244
+ operator: '>=',
4245
+ operand: lower
4246
+ },
4247
+ {
4248
+ field,
4249
+ operator: '<=',
4250
+ operand: upper
4251
+ }
4252
+ ]
4253
+ });
4254
+ const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum = DEFAULT_MINIMUM, maximum = DEFAULT_MAXIMUM, showSearch = false, showFlip = false, showSettings = false, dismissCallback = undefined, width = undefined, header = {
4250
4255
  Panel: FacetHeader,
4251
4256
  Label: FacetText,
4252
4257
  iconStyle: controlsIconStyle
4253
4258
  } })=>{
4254
- const [textValue, setTextValue] = React.useState(''); // Handle the state of the TextInput
4255
- const clearFilters = hooks.useClearFilter();
4256
- const updateFacetFilters = hooks.useUpdateFacetFilters();
4257
- const facetTitle = facetName ? facetName : core.trimFirstFieldNameToTitle(field, true);
4258
- const facetValue = hooks.useGetFacetFilters(field);
4259
- const textValues = React.useMemo(()=>extractValues(facetValue), [
4260
- facetValue
4261
- ]);
4262
- const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4263
- const showFilters = isFilterExpanded === undefined || isFilterExpanded;
4264
- const setValues = (values)=>{
4265
- if (values.length > 0) {
4266
- if (facetValue && instanceOfIncludesExcludes$1(facetValue)) {
4267
- // updating facet value
4268
- updateFacetFilters(field, {
4269
- ...facetValue,
4270
- operands: values
4271
- });
4272
- }
4273
- if (facetValue === undefined) {
4274
- // TODO: Assuming Includes by default but this might change to Include|Excludes
4275
- updateFacetFilters(field, {
4276
- operator: 'in',
4277
- field: field,
4278
- operands: values
4279
- });
4280
- }
4281
- } else {
4282
- clearFilters(field);
4283
- }
4284
- };
4285
- const addValue = (s)=>{
4286
- if (s === '') return;
4287
- if (textValues.includes(s)) return;
4288
- setTextValue('');
4289
- setValues([
4290
- ...textValues,
4291
- s
4292
- ]);
4293
- };
4294
- const removeButton = (x)=>{
4295
- return /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4296
- size: "xs",
4297
- color: "white",
4298
- radius: "xl",
4299
- variant: "transparent",
4300
- onClick: ()=>setValues(textValues.filter((i)=>i !== x)),
4301
- children: /*#__PURE__*/ jsxRuntime.jsx(md.MdClose, {
4302
- size: 10,
4303
- "aria-label": "remove value from filter"
4304
- })
4305
- });
4306
- };
4307
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
4308
- className: `flex flex-col ${width ? width : 'mx-0'} bg-base-max relative border-base-lighter border-1 rounded-md text-xs transition`,
4309
- children: [
4310
- /*#__PURE__*/ jsxRuntime.jsx(FacetControlsHeader, {
4311
- field: field,
4312
- description: description,
4313
- hooks: hooks,
4314
- facetName: facetName,
4315
- dismissCallback: dismissCallback,
4316
- header: header
4317
- }),
4318
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
4319
- className: showFilters ? 'h-full' : 'h-0 invisible',
4320
- "aria-hidden": !showFilters,
4321
- children: [
4322
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
4323
- className: "flex flex-nowrap items-center p-2",
4324
- children: [
4325
- /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
4326
- "data-testid": "textbox-add-filter-value",
4327
- size: "sm",
4328
- placeholder: `Enter ${facetTitle}`,
4329
- classNames: {
4330
- root: 'grow',
4331
- input: 'border-r-0 rounded-r-none py-1'
4332
- },
4333
- "aria-label": "enter value to add filter",
4334
- value: textValue,
4335
- onChange: (event)=>setTextValue(event.currentTarget.value)
4336
- }),
4337
- /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4338
- size: "lg",
4339
- "aria-label": "add string value",
4340
- className: "bg-accent text-accent-contrast border-base-min border-1 rounded-l-none h-[30px]",
4341
- onClick: ()=>{
4342
- if (textValue.length > 0) addValue(textValue.trim());
4343
- },
4344
- children: /*#__PURE__*/ jsxRuntime.jsx(fa.FaPlus, {})
4345
- })
4346
- ]
4347
- }),
4348
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
4349
- gap: "xs",
4350
- className: "px-2 py-2 max-h-96 overflow-y-auto",
4351
- "data-testid": "values group",
4352
- children: textValues.map((x)=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Badge, {
4353
- size: "sm",
4354
- variant: "filled",
4355
- color: "accent",
4356
- rightSection: removeButton(x),
4357
- children: x
4358
- }, x))
4359
- })
4360
- ]
4361
- })
4362
- ]
4363
- });
4364
- };
4365
-
4366
- const createBucket = (field, lower, upper)=>({
4367
- operator: 'and',
4368
- operands: [
4369
- {
4370
- field,
4371
- operator: '>=',
4372
- operand: lower
4373
- },
4374
- {
4375
- field,
4376
- operator: '<=',
4377
- operand: upper
4378
- }
4379
- ]
4380
- });
4381
- const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum = DEFAULT_MINIMUM, maximum = DEFAULT_MAXIMUM, showSearch = false, showFlip = false, showSettings = false, dismissCallback = undefined, width = undefined, header = {
4382
- Panel: FacetHeader,
4383
- Label: FacetText,
4384
- iconStyle: controlsIconStyle
4385
- } })=>{
4386
- const { data, rangeFilters, isSuccess } = hooks.useGetFacetData(field);
4387
- const [minMaxValue, setMinMaxValue] = React.useState({
4388
- from: minimum,
4389
- to: maximum
4390
- });
4391
- const clearRangeFilterFromCohort = hooks.useClearFilter();
4392
- React.useCallback(()=>{
4393
- setMinMaxValue({
4394
- from: minimum,
4395
- to: maximum
4396
- });
4397
- clearRangeFilterFromCohort(field);
4398
- }, [
4399
- clearRangeFilterFromCohort,
4400
- field,
4401
- maximum,
4402
- minimum
4403
- ]);
4404
- const updateRangeFilter = hooks.useUpdateFacetFilters();
4405
- const updateFilters = React.useCallback((from, to)=>{
4406
- updateRangeFilter(field, createBucket(field, from, to));
4407
- setMinMaxValue({
4408
- from: from,
4409
- to: to
4410
- });
4411
- }, [
4412
- field,
4413
- updateRangeFilter
4259
+ const { data, rangeFilters, isSuccess } = hooks.useGetFacetData(field);
4260
+ const [minMaxValue, setMinMaxValue] = React.useState({
4261
+ from: minimum,
4262
+ to: maximum
4263
+ });
4264
+ const clearRangeFilterFromCohort = hooks.useClearFilter();
4265
+ React.useCallback(()=>{
4266
+ setMinMaxValue({
4267
+ from: minimum,
4268
+ to: maximum
4269
+ });
4270
+ clearRangeFilterFromCohort(field);
4271
+ }, [
4272
+ clearRangeFilterFromCohort,
4273
+ field,
4274
+ maximum,
4275
+ minimum
4276
+ ]);
4277
+ const updateRangeFilter = hooks.useUpdateFacetFilters();
4278
+ const updateFilters = React.useCallback((from, to)=>{
4279
+ updateRangeFilter(field, createBucket(field, from, to));
4280
+ setMinMaxValue({
4281
+ from: from,
4282
+ to: to
4283
+ });
4284
+ }, [
4285
+ field,
4286
+ updateRangeFilter
4414
4287
  ]);
4415
4288
  const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4416
4289
  const showFilters = isFilterExpanded === undefined || isFilterExpanded;
@@ -4491,7 +4364,7 @@ const RangeFacet = ({ field, hooks, valueLabel, description, facetName, minimum
4491
4364
  });
4492
4365
  };
4493
4366
 
4494
- const instanceOfIncludesExcludes = (op)=>[
4367
+ const instanceOfIncludesExcludes$1 = (op)=>[
4495
4368
  'in'
4496
4369
  ].includes(op.operator); // TODO: Guppy does not support excludes
4497
4370
  const isOperandsObject = (obj)=>{
@@ -4540,7 +4413,7 @@ const isFacetEmpty = (op)=>{
4540
4413
  useDeepCompare.useDeepCompareEffect(()=>{
4541
4414
  if (!facetValue || isFacetEmpty(facetValue)) {
4542
4415
  setSelectedValues([]);
4543
- } else if (instanceOfIncludesExcludes(facetValue)) {
4416
+ } else if (instanceOfIncludesExcludes$1(facetValue)) {
4544
4417
  const filters = facetValue.operands.map((x)=>x.toString());
4545
4418
  setSelectedValues(filters);
4546
4419
  }
@@ -4577,29 +4450,577 @@ const isFacetEmpty = (op)=>{
4577
4450
  size: "sm",
4578
4451
  placeholder: `Enter ${facetTitle}`,
4579
4452
  classNames: {
4580
- root: 'grow',
4581
- input: 'border-r-0 rounded-r-none py-1'
4582
- },
4583
- comboboxProps: {
4584
- shadow: 'md'
4453
+ root: 'grow',
4454
+ input: 'border-r-0 rounded-r-none py-1'
4455
+ },
4456
+ comboboxProps: {
4457
+ shadow: 'md'
4458
+ },
4459
+ "aria-label": "enter value to add filter",
4460
+ value: selectedValues,
4461
+ onChange: setSelectedValues,
4462
+ searchable: true,
4463
+ data: dataValues,
4464
+ limit: 10,
4465
+ maxDropdownHeight: 200,
4466
+ hidePickedOptions: true,
4467
+ withScrollArea: false,
4468
+ mt: "md"
4469
+ })
4470
+ })
4471
+ })
4472
+ ]
4473
+ });
4474
+ };
4475
+
4476
+ const instanceOfIncludesExcludes = (op)=>[
4477
+ 'in'
4478
+ ].includes(op.operator); // TODO: Guppy does not support excludes
4479
+ /**
4480
+ * Extracts the operands if the operation isIncludes or Excludes. Returns an empty Array
4481
+ * if filter is not the correct type.
4482
+ * @param operation - filters to extract values from
4483
+ */ const extractValues = (operation)=>{
4484
+ if (operation && instanceOfIncludesExcludes(operation)) {
4485
+ return operation.operands;
4486
+ }
4487
+ return [];
4488
+ };
4489
+ /**
4490
+ * Exact value facet component
4491
+ * @param field - field to facet on
4492
+ * @param description - description of the facet
4493
+ * @param facetName - name of the facet
4494
+ * @param dismissCallback - callback function to dismiss the facet
4495
+ * @param width - width of the facet
4496
+ * @param hooks - hooks to use for the facet
4497
+ * @param header - header components
4498
+ * @category Facets
4499
+ */ const ExactValueFacet = ({ field, description, facetName = undefined, dismissCallback = undefined, width = undefined, hooks, header = {
4500
+ Panel: FacetHeader,
4501
+ Label: FacetText,
4502
+ iconStyle: controlsIconStyle
4503
+ } })=>{
4504
+ const [textValue, setTextValue] = React.useState(''); // Handle the state of the TextInput
4505
+ const clearFilters = hooks.useClearFilter();
4506
+ const updateFacetFilters = hooks.useUpdateFacetFilters();
4507
+ const facetTitle = facetName ? facetName : core.trimFirstFieldNameToTitle(field, true);
4508
+ const facetValue = hooks.useGetFacetFilters(field);
4509
+ const textValues = React.useMemo(()=>extractValues(facetValue), [
4510
+ facetValue
4511
+ ]);
4512
+ const isFilterExpanded = hooks.useFilterExpanded && hooks.useFilterExpanded(field);
4513
+ const showFilters = isFilterExpanded === undefined || isFilterExpanded;
4514
+ const setValues = (values)=>{
4515
+ if (values.length > 0) {
4516
+ if (facetValue && instanceOfIncludesExcludes(facetValue)) {
4517
+ // updating facet value
4518
+ updateFacetFilters(field, {
4519
+ ...facetValue,
4520
+ operands: values
4521
+ });
4522
+ }
4523
+ if (facetValue === undefined) {
4524
+ // TODO: Assuming Includes by default but this might change to Include|Excludes
4525
+ updateFacetFilters(field, {
4526
+ operator: 'in',
4527
+ field: field,
4528
+ operands: values
4529
+ });
4530
+ }
4531
+ } else {
4532
+ clearFilters(field);
4533
+ }
4534
+ };
4535
+ const addValue = (s)=>{
4536
+ if (s === '') return;
4537
+ if (textValues.includes(s)) return;
4538
+ setTextValue('');
4539
+ setValues([
4540
+ ...textValues,
4541
+ s
4542
+ ]);
4543
+ };
4544
+ const removeButton = (x)=>{
4545
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4546
+ size: "xs",
4547
+ color: "white",
4548
+ radius: "xl",
4549
+ variant: "transparent",
4550
+ onClick: ()=>setValues(textValues.filter((i)=>i !== x)),
4551
+ children: /*#__PURE__*/ jsxRuntime.jsx(md.MdClose, {
4552
+ size: 10,
4553
+ "aria-label": "remove value from filter"
4554
+ })
4555
+ });
4556
+ };
4557
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
4558
+ className: `flex flex-col ${width ? width : 'mx-0'} bg-base-max relative border-base-lighter border-1 rounded-md text-xs transition`,
4559
+ children: [
4560
+ /*#__PURE__*/ jsxRuntime.jsx(FacetControlsHeader, {
4561
+ field: field,
4562
+ description: description,
4563
+ hooks: hooks,
4564
+ facetName: facetName,
4565
+ dismissCallback: dismissCallback,
4566
+ header: header
4567
+ }),
4568
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4569
+ className: showFilters ? 'h-full' : 'h-0 invisible',
4570
+ "aria-hidden": !showFilters,
4571
+ children: [
4572
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4573
+ className: "flex flex-nowrap items-center p-2",
4574
+ children: [
4575
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.TextInput, {
4576
+ "data-testid": "textbox-add-filter-value",
4577
+ size: "sm",
4578
+ placeholder: `Enter ${facetTitle}`,
4579
+ classNames: {
4580
+ root: 'grow',
4581
+ input: 'border-r-0 rounded-r-none py-1'
4582
+ },
4583
+ "aria-label": "enter value to add filter",
4584
+ value: textValue,
4585
+ onChange: (event)=>setTextValue(event.currentTarget.value)
4586
+ }),
4587
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.ActionIcon, {
4588
+ size: "lg",
4589
+ "aria-label": "add string value",
4590
+ className: "bg-accent text-accent-contrast border-base-min border-1 rounded-l-none h-[30px]",
4591
+ onClick: ()=>{
4592
+ if (textValue.length > 0) addValue(textValue.trim());
4593
+ },
4594
+ children: /*#__PURE__*/ jsxRuntime.jsx(fa.FaPlus, {})
4595
+ })
4596
+ ]
4597
+ }),
4598
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
4599
+ gap: "xs",
4600
+ className: "px-2 py-2 max-h-96 overflow-y-auto",
4601
+ "data-testid": "values group",
4602
+ children: textValues.map((x)=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Badge, {
4603
+ size: "sm",
4604
+ variant: "filled",
4605
+ color: "accent",
4606
+ rightSection: removeButton(x),
4607
+ children: x
4608
+ }, x))
4609
+ })
4610
+ ]
4611
+ })
4612
+ ]
4613
+ });
4614
+ };
4615
+
4616
+ const createFacetCard = ({ facetDefinition, valueLabel, hooks: dataFunctions, facetNameFormatter, idPrefix, hideIfEmpty = false, width, showPercent = false, queryOptions })=>{
4617
+ const { field, type, description, label } = facetDefinition;
4618
+ const facetLabel = label ?? facetNameFormatter(facetDefinition.field);
4619
+ const valueTypeLabel = valueLabel === undefined || typeof valueLabel === 'string' ? valueLabel : valueLabel(queryOptions);
4620
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4621
+ children: {
4622
+ enum: /*#__PURE__*/ jsxRuntime.jsx(EnumFacet, {
4623
+ valueLabel: valueTypeLabel,
4624
+ field: field,
4625
+ facetName: facetLabel,
4626
+ description: description,
4627
+ hideIfEmpty: hideIfEmpty,
4628
+ width: width,
4629
+ hooks: dataFunctions,
4630
+ showPercent: showPercent,
4631
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4632
+ }, `${idPrefix}-enum-${field}`),
4633
+ range: /*#__PURE__*/ jsxRuntime.jsx(RangeFacet, {
4634
+ valueLabel: valueTypeLabel,
4635
+ field: field,
4636
+ facetName: facetLabel,
4637
+ description: description,
4638
+ hideIfEmpty: hideIfEmpty,
4639
+ width: width,
4640
+ hooks: dataFunctions,
4641
+ minimum: facetDefinition.range?.minimum,
4642
+ maximum: facetDefinition.range?.maximum,
4643
+ showSettings: showPercent,
4644
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4645
+ }, `${idPrefix}-range-${field}`),
4646
+ exact: /*#__PURE__*/ jsxRuntime.jsx(ExactValueFacet, {
4647
+ field: field,
4648
+ facetName: facetLabel,
4649
+ description: description,
4650
+ hideIfEmpty: hideIfEmpty,
4651
+ width: width,
4652
+ hooks: dataFunctions,
4653
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4654
+ }, `${idPrefix}-exact-${field}`),
4655
+ multiselect: /*#__PURE__*/ jsxRuntime.jsx(MultiSelectValueFacet, {
4656
+ field: field,
4657
+ facetName: facetLabel,
4658
+ description: description,
4659
+ hideIfEmpty: hideIfEmpty,
4660
+ width: width,
4661
+ hooks: dataFunctions,
4662
+ sharedWithIndices: facetDefinition?.sharedWithIndices
4663
+ }, `${idPrefix}-exact-${field}`)
4664
+ }[type]
4665
+ }, `${idPrefix}-facet-${field}`);
4666
+ };
4667
+
4668
+ const FiltersPanel = ({ fields, dataFunctions, valueLabel })=>{
4669
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4670
+ "data-testid": "filters-facets",
4671
+ className: "flex flex-col gap-y-4 w-full",
4672
+ children: fields.map((facetDefinition)=>{
4673
+ if (facetDefinition?.type === undefined) {
4674
+ console.warn('Facet definition missing type', facetDefinition);
4675
+ return null;
4676
+ }
4677
+ if (!(facetDefinition.type in dataFunctions)) return null;
4678
+ return createFacetCard({
4679
+ facetDefinition,
4680
+ valueLabel,
4681
+ hooks: dataFunctions[facetDefinition.type],
4682
+ facetNameFormatter: core.fieldNameToTitle,
4683
+ idPrefix: 'filters-panel',
4684
+ showPercent: false
4685
+ });
4686
+ })
4687
+ });
4688
+ };
4689
+
4690
+ const AccordionPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
4691
+ const coreDispatch = core.useCoreDispatch();
4692
+ const sharedFilters = core.useCoreSelector((state)=>core.selectSharedFilters(state));
4693
+ const theme = core$1.useMantineTheme();
4694
+ const shareFilters = core.useCoreSelector((state)=>core.selectShouldShareFilters(state));
4695
+ const allFiltersCollapsed = core.useCoreSelector((state)=>core.selectAllCohortFiltersCollapsed(state, index));
4696
+ const toggleAllFiltersExpanded = (expand)=>{
4697
+ coreDispatch(core.toggleCohortBuilderAllFilters({
4698
+ expand,
4699
+ index
4700
+ }));
4701
+ };
4702
+ const handleSharedFiltersChange = (value)=>{
4703
+ modals.modals.openConfirmModal({
4704
+ title: 'Confirm change of shared filters mode',
4705
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4706
+ size: "sm",
4707
+ children: value ? 'Switching to Shared Filters mode will apply all selected filters across all indices.' : 'Switching to Unshared Filters mode will stop syncing filters but will not remove them.'
4708
+ }),
4709
+ labels: {
4710
+ confirm: 'Confirm',
4711
+ cancel: 'Cancel'
4712
+ },
4713
+ onConfirm: ()=>coreDispatch(core.setShouldShareFilters(value))
4714
+ });
4715
+ };
4716
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4717
+ align: "flex-start",
4718
+ children: [
4719
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4720
+ justify: "space-between",
4721
+ className: "w-full",
4722
+ children: [
4723
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4724
+ size: "xl",
4725
+ fw: 800,
4726
+ children: "Filters"
4727
+ }),
4728
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
4729
+ className: "text-primary text-sm font-normal",
4730
+ onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
4731
+ children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
4732
+ })
4733
+ ]
4734
+ }),
4735
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4736
+ className: "bg-base-max py-4 px-2 h-full w-full",
4737
+ children: [
4738
+ Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4739
+ gap: "xs",
4740
+ justify: "space-between",
4741
+ children: [
4742
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4743
+ className: "flex items-center space-x-1",
4744
+ children: [
4745
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4746
+ icon: "gen3:share",
4747
+ height: 16,
4748
+ width: 16,
4749
+ color: theme.colors.accent[4]
4750
+ }),
4751
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4752
+ size: "sm",
4753
+ children: "Set the shared filters for all"
4754
+ }),
4755
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4756
+ icon: "gen3:info",
4757
+ height: 12,
4758
+ width: 12,
4759
+ color: theme.colors.accent[4]
4760
+ })
4761
+ ]
4762
+ }),
4763
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Switch, {
4764
+ checked: shareFilters,
4765
+ onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
4766
+ })
4767
+ ]
4768
+ }),
4769
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion, {
4770
+ chevronPosition: "left",
4771
+ multiple: true,
4772
+ defaultValue: [
4773
+ filters?.tabs[0].title ?? 'Filters'
4774
+ ],
4775
+ children: filters.tabs.map((tab)=>{
4776
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Accordion.Item, {
4777
+ value: tab.title,
4778
+ children: [
4779
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Control, {
4780
+ children: tab.title
4781
+ }),
4782
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Accordion.Panel, {
4783
+ classNames: {
4784
+ panel: 'p-0 m-0'
4785
+ },
4786
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4787
+ fields: tab.fields.reduce((acc, field)=>{
4788
+ return [
4789
+ ...acc,
4790
+ facetDefinitions[field]
4791
+ ];
4792
+ }, []),
4793
+ dataFunctions: facetDataHooks,
4794
+ valueLabel: tabTitle
4795
+ }) : null
4796
+ })
4797
+ ]
4798
+ }, `${tab.title}`);
4799
+ })
4800
+ })
4801
+ ]
4802
+ })
4803
+ ]
4804
+ });
4805
+ };
4806
+
4807
+ const AccessData = [
4808
+ {
4809
+ value: core.Accessibility.ALL,
4810
+ label: 'All'
4811
+ },
4812
+ {
4813
+ value: core.Accessibility.ACCESSIBLE,
4814
+ label: 'Accessible'
4815
+ },
4816
+ {
4817
+ value: core.Accessibility.UNACCESSIBLE,
4818
+ label: 'Not Accessible'
4819
+ }
4820
+ ];
4821
+ const AccessLevelControl = ({ onChange, accessLevel })=>{
4822
+ const theme = core$1.useMantineTheme();
4823
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.SegmentedControl, {
4824
+ color: theme.colors.accent[5],
4825
+ data: AccessData,
4826
+ value: accessLevel,
4827
+ onChange: (val)=>{
4828
+ const accessibilityValue = AccessData.find((item)=>item.value === val)?.value || core.Accessibility.ALL;
4829
+ onChange(accessibilityValue);
4830
+ }
4831
+ });
4832
+ };
4833
+
4834
+ const DropdownPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
4835
+ const [value, setValue] = React.useState('0');
4836
+ const allFiltersCollapsed = core.useCoreSelector((state)=>core.selectAllCohortFiltersCollapsed(state, index));
4837
+ const sharedFilters = core.useCoreSelector((state)=>core.selectSharedFilters(state));
4838
+ const shareFilters = core.useCoreSelector((state)=>core.selectShouldShareFilters(state));
4839
+ const theme = core$1.useMantineTheme();
4840
+ const coreDispatch = core.useCoreDispatch();
4841
+ const toggleAllFiltersExpanded = (expand)=>{
4842
+ coreDispatch(core.toggleCohortBuilderAllFilters({
4843
+ expand,
4844
+ index
4845
+ }));
4846
+ };
4847
+ const items = useDeepCompare.useDeepCompareMemo(()=>filters.tabs.map((tab, idx)=>{
4848
+ return {
4849
+ label: tab.title,
4850
+ value: idx.toString()
4851
+ };
4852
+ }), [
4853
+ filters.tabs
4854
+ ]);
4855
+ const fields = filters.tabs[Number(value)].fields.reduce((acc, field)=>{
4856
+ return [
4857
+ ...acc,
4858
+ facetDefinitions[field]
4859
+ ];
4860
+ }, []);
4861
+ const handleSharedFiltersChange = (value)=>{
4862
+ modals.modals.openConfirmModal({
4863
+ title: 'Confirm change of shared filters mode',
4864
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4865
+ size: "sm",
4866
+ children: value ? 'Switching to Shared Filters mode will apply all selected filters across all indices.' : 'Switching to Unshared Filters mode will stop syncing filters but will not remove them.'
4867
+ }),
4868
+ labels: {
4869
+ confirm: 'Confirm',
4870
+ cancel: 'Cancel'
4871
+ },
4872
+ onConfirm: ()=>coreDispatch(core.setShouldShareFilters(value))
4873
+ });
4874
+ };
4875
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4876
+ align: "flex-start",
4877
+ children: [
4878
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4879
+ justify: "space-between",
4880
+ className: "w-full",
4881
+ children: [
4882
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4883
+ size: "xl",
4884
+ fw: 800,
4885
+ children: "Filters"
4886
+ }),
4887
+ /*#__PURE__*/ jsxRuntime.jsx("button", {
4888
+ className: "text-primary text-sm font-normal",
4889
+ onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
4890
+ children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
4891
+ })
4892
+ ]
4893
+ }),
4894
+ showAccessLevel ? /*#__PURE__*/ jsxRuntime.jsx(AccessLevelControl, {
4895
+ onChange: onAccessChange,
4896
+ accessLevel: accessLevel
4897
+ }) : null,
4898
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
4899
+ className: "bg-base-max py-4 px-2 h-full w-full",
4900
+ children: [
4901
+ Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
4902
+ gap: "xs",
4903
+ justify: "space-between",
4904
+ children: [
4905
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
4906
+ className: "flex items-center space-x-1",
4907
+ children: [
4908
+ /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4909
+ icon: "gen3:share",
4910
+ height: 16,
4911
+ width: 16,
4912
+ color: theme.colors.accent[4]
4913
+ }),
4914
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
4915
+ size: "sm",
4916
+ children: "Set the shared filters for all"
4917
+ }),
4918
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
4919
+ label: "If enabled any filter set on this tab will be applied to every tab where occurs.",
4920
+ position: "top",
4921
+ withArrow: true,
4922
+ children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
4923
+ icon: "gen3:info",
4924
+ height: 12,
4925
+ width: 12,
4926
+ color: theme.colors.accent[4]
4927
+ })
4928
+ })
4929
+ ]
4930
+ }),
4931
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Switch, {
4932
+ checked: shareFilters,
4933
+ onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
4934
+ })
4935
+ ]
4936
+ }),
4937
+ filters.tabs.length > 1 && /*#__PURE__*/ jsxRuntime.jsx(core$1.Select, {
4938
+ classNames: {
4939
+ options: 'border-1 border-base-dark',
4940
+ option: 'hover:bg-primary-lightest'
4585
4941
  },
4586
- "aria-label": "enter value to add filter",
4587
- value: selectedValues,
4588
- onChange: setSelectedValues,
4589
- searchable: true,
4590
- data: dataValues,
4591
- limit: 10,
4592
- maxDropdownHeight: 200,
4593
- hidePickedOptions: true,
4594
- withScrollArea: false,
4595
- mt: "md"
4596
- })
4597
- })
4942
+ withCheckIcon: false,
4943
+ data: items,
4944
+ value: value === null ? '0' : value,
4945
+ onChange: setValue
4946
+ }),
4947
+ Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4948
+ fields: fields,
4949
+ dataFunctions: facetDataHooks,
4950
+ valueLabel: tabTitle
4951
+ }) : null
4952
+ ]
4598
4953
  })
4599
4954
  ]
4600
4955
  });
4601
4956
  };
4602
4957
 
4958
+ const VerticalTabbedPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
4959
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4960
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Tabs, {
4961
+ variant: "pills",
4962
+ orientation: "vertical",
4963
+ keepMounted: false,
4964
+ defaultValue: filters?.tabs[0].title ?? 'Filters',
4965
+ children: [
4966
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Tabs.List, {
4967
+ children: filters.tabs.map((tab)=>{
4968
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tabs.Tab, {
4969
+ value: tab.title,
4970
+ children: tab.title
4971
+ }, `${tab.title}-tab`);
4972
+ })
4973
+ }),
4974
+ filters.tabs.map((tab)=>{
4975
+ return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tabs.Panel, {
4976
+ value: tab.title,
4977
+ className: "w-1/4",
4978
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4979
+ fields: tab.fields.reduce((acc, field)=>{
4980
+ return [
4981
+ ...acc,
4982
+ facetDefinitions[field]
4983
+ ];
4984
+ }, []),
4985
+ dataFunctions: facetDataHooks,
4986
+ valueLabel: tabTitle
4987
+ }) : null
4988
+ }, `filter-${tab.title}-tabPanel`);
4989
+ })
4990
+ ]
4991
+ })
4992
+ });
4993
+ };
4994
+ const SinglePanel = ({ filters, tabTitle, facetDefinitions, facetDataHooks })=>{
4995
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
4996
+ children: Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
4997
+ fields: filters.tabs[0].fields.reduce((acc, field)=>{
4998
+ return [
4999
+ ...acc,
5000
+ facetDefinitions[field]
5001
+ ];
5002
+ }, []),
5003
+ dataFunctions: facetDataHooks,
5004
+ valueLabel: tabTitle
5005
+ }) : null
5006
+ });
5007
+ };
5008
+ const TabbedPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks })=>{
5009
+ return filters.tabs.length > 1 ? /*#__PURE__*/ jsxRuntime.jsx(VerticalTabbedPanel, {
5010
+ index: index,
5011
+ filters: filters,
5012
+ tabTitle: tabTitle,
5013
+ facetDefinitions: facetDefinitions,
5014
+ facetDataHooks: facetDataHooks
5015
+ }) : /*#__PURE__*/ jsxRuntime.jsx(SinglePanel, {
5016
+ index: index,
5017
+ filters: filters,
5018
+ tabTitle: tabTitle,
5019
+ facetDefinitions: facetDefinitions,
5020
+ facetDataHooks: facetDataHooks
5021
+ });
5022
+ };
5023
+
4603
5024
  /**
4604
5025
  * Scrolls to hash in url when component mounts and removes hash from url when component unmounts
4605
5026
  * @param valid_hashes - what hashes in url should trigger scroll
@@ -4621,58 +5042,6 @@ const isFacetEmpty = (op)=>{
4621
5042
  }, []);
4622
5043
  };
4623
5044
 
4624
- const createFacetCard = ({ facetDefinition, valueLabel, hooks: dataFunctions, facetNameFormatter, idPrefix, hideIfEmpty = false, width, showPercent = false, queryOptions })=>{
4625
- const { field, type, description, label } = facetDefinition;
4626
- const facetLabel = label ?? facetNameFormatter(facetDefinition.field);
4627
- const valueTypeLabel = valueLabel === undefined || typeof valueLabel === 'string' ? valueLabel : valueLabel(queryOptions);
4628
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
4629
- children: {
4630
- enum: /*#__PURE__*/ jsxRuntime.jsx(EnumFacet, {
4631
- valueLabel: valueTypeLabel,
4632
- field: field,
4633
- facetName: facetLabel,
4634
- description: description,
4635
- hideIfEmpty: hideIfEmpty,
4636
- width: width,
4637
- hooks: dataFunctions,
4638
- showPercent: showPercent,
4639
- sharedWithIndices: facetDefinition?.sharedWithIndices
4640
- }, `${idPrefix}-enum-${field}`),
4641
- range: /*#__PURE__*/ jsxRuntime.jsx(RangeFacet, {
4642
- valueLabel: valueTypeLabel,
4643
- field: field,
4644
- facetName: facetLabel,
4645
- description: description,
4646
- hideIfEmpty: hideIfEmpty,
4647
- width: width,
4648
- hooks: dataFunctions,
4649
- minimum: facetDefinition.range?.minimum,
4650
- maximum: facetDefinition.range?.maximum,
4651
- showSettings: showPercent,
4652
- sharedWithIndices: facetDefinition?.sharedWithIndices
4653
- }, `${idPrefix}-range-${field}`),
4654
- exact: /*#__PURE__*/ jsxRuntime.jsx(ExactValueFacet, {
4655
- field: field,
4656
- facetName: facetLabel,
4657
- description: description,
4658
- hideIfEmpty: hideIfEmpty,
4659
- width: width,
4660
- hooks: dataFunctions,
4661
- sharedWithIndices: facetDefinition?.sharedWithIndices
4662
- }, `${idPrefix}-exact-${field}`),
4663
- multiselect: /*#__PURE__*/ jsxRuntime.jsx(MultiSelectValueFacet, {
4664
- field: field,
4665
- facetName: facetLabel,
4666
- description: description,
4667
- hideIfEmpty: hideIfEmpty,
4668
- width: width,
4669
- hooks: dataFunctions,
4670
- sharedWithIndices: facetDefinition?.sharedWithIndices
4671
- }, `${idPrefix}-exact-${field}`)
4672
- }[type]
4673
- }, `${idPrefix}-facet-${field}`);
4674
- };
4675
-
4676
5045
  const createFacetCards = ({ facets, hooks, facetNameFormatter, idPrefix, valueLabel, dismissCallback, hideIfEmpty, Chart, showPercent })=>{
4677
5046
  return facets.map((facetDefinition)=>{
4678
5047
  return createFacetCard({
@@ -12166,235 +12535,62 @@ const DownloadsPanel = ({ dropdowns, buttons, loginForDownload, index, totalCoun
12166
12535
  }))
12167
12536
  }
12168
12537
  };
12169
- }, {});
12170
- }
12171
- return dropdownsToRender;
12172
- }, [
12173
- dropdowns,
12174
- loginRequired,
12175
- isUserLoggedIn
12176
- ]);
12177
- return dropdowns || buttons ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
12178
- className: "flex space-x-1",
12179
- children: [
12180
- Object.values(dropdownsToRender).map((dropdown)=>{
12181
- return createDownloadMenuButton(dropdown, {
12182
- type: index,
12183
- totalCount,
12184
- fields,
12185
- filter,
12186
- accessibility: accessibility ?? core.Accessibility.ALL
12187
- });
12188
- }),
12189
- buttons.map((button)=>{
12190
- let disabled = false;
12191
- let actionFunction = NullButtonAction;
12192
- let actionArgs = {};
12193
- const buttonAction = button.action ?? button.type;
12194
- if (buttonAction) {
12195
- const actionItem = findButtonAction(buttonAction);
12196
- if (actionItem) {
12197
- const funcArgs = actionItem.args ?? {};
12198
- const func = actionItem.action;
12199
- actionFunction = func;
12200
- actionArgs = funcArgs ?? {};
12201
- }
12202
- }
12203
- if (loginRequired && !isUserLoggedIn) {
12204
- disabled = true;
12205
- }
12206
- return /*#__PURE__*/ jsxRuntime.jsx(CohortActionButton, {
12207
- activeText: 'Downloading...',
12208
- inactiveText: button.title,
12209
- tooltipText: button.tooltipText,
12210
- disabled: disabled || !button.enabled,
12211
- actionFunction: actionFunction,
12212
- actionArgs: {
12213
- ...actionArgs,
12214
- ...button.actionArgs ?? {},
12215
- type: index,
12216
- totalCount,
12217
- fields,
12218
- filter,
12219
- accessibility: accessibility ?? core.Accessibility.ALL
12220
- }
12221
- }, button.title);
12222
- })
12223
- ]
12224
- }) : /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {});
12225
- };
12226
-
12227
- const FiltersPanel = ({ fields, dataFunctions, valueLabel })=>{
12228
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
12229
- "data-testid": "filters-facets",
12230
- className: "flex flex-col gap-y-4 w-full",
12231
- children: fields.map((facetDefinition)=>{
12232
- if (facetDefinition?.type === undefined) {
12233
- console.warn('Facet definition missing type', facetDefinition);
12234
- return null;
12235
- }
12236
- if (!(facetDefinition.type in dataFunctions)) return null;
12237
- return createFacetCard({
12238
- facetDefinition,
12239
- valueLabel,
12240
- hooks: dataFunctions[facetDefinition.type],
12241
- facetNameFormatter: core.fieldNameToTitle,
12242
- idPrefix: 'filters-panel',
12243
- showPercent: false
12244
- });
12245
- })
12246
- });
12247
- };
12248
-
12249
- const AccessData = [
12250
- {
12251
- value: core.Accessibility.ALL,
12252
- label: 'All'
12253
- },
12254
- {
12255
- value: core.Accessibility.ACCESSIBLE,
12256
- label: 'Accessible'
12257
- },
12258
- {
12259
- value: core.Accessibility.UNACCESSIBLE,
12260
- label: 'Not Accessible'
12261
- }
12262
- ];
12263
- const AccessLevelControl = ({ onChange, accessLevel })=>{
12264
- const theme = core$1.useMantineTheme();
12265
- return /*#__PURE__*/ jsxRuntime.jsx(core$1.SegmentedControl, {
12266
- color: theme.colors.accent[5],
12267
- data: AccessData,
12268
- value: accessLevel,
12269
- onChange: (val)=>{
12270
- const accessibilityValue = AccessData.find((item)=>item.value === val)?.value || core.Accessibility.ALL;
12271
- onChange(accessibilityValue);
12538
+ }, {});
12272
12539
  }
12273
- });
12274
- };
12275
-
12276
- const DropdownPanel = ({ index, filters, tabTitle, facetDefinitions, facetDataHooks, onAccessChange = (value)=>null, accessLevel = core.Accessibility.ALL, showAccessLevel = false })=>{
12277
- const [value, setValue] = React.useState('0');
12278
- const allFiltersCollapsed = core.useCoreSelector((state)=>core.selectAllCohortFiltersCollapsed(state, index));
12279
- const sharedFilters = core.useCoreSelector((state)=>core.selectSharedFilters(state));
12280
- const shareFilters = core.useCoreSelector((state)=>core.selectShouldShareFilters(state));
12281
- const theme = core$1.useMantineTheme();
12282
- const coreDispatch = core.useCoreDispatch();
12283
- const toggleAllFiltersExpanded = (expand)=>{
12284
- coreDispatch(core.toggleCohortBuilderAllFilters({
12285
- expand,
12286
- index
12287
- }));
12288
- };
12289
- const items = useDeepCompare.useDeepCompareMemo(()=>filters.tabs.map((tab, idx)=>{
12290
- return {
12291
- label: tab.title,
12292
- value: idx.toString()
12293
- };
12294
- }), [
12295
- filters.tabs
12540
+ return dropdownsToRender;
12541
+ }, [
12542
+ dropdowns,
12543
+ loginRequired,
12544
+ isUserLoggedIn
12296
12545
  ]);
12297
- const fields = filters.tabs[Number(value)].fields.reduce((acc, field)=>{
12298
- return [
12299
- ...acc,
12300
- facetDefinitions[field]
12301
- ];
12302
- }, []);
12303
- const handleSharedFiltersChange = (value)=>{
12304
- modals.modals.openConfirmModal({
12305
- title: 'Confirm change of shared filters mode',
12306
- children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
12307
- size: "sm",
12308
- 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.'
12309
- }),
12310
- labels: {
12311
- confirm: 'Confirm',
12312
- cancel: 'Cancel'
12313
- },
12314
- onConfirm: ()=>coreDispatch(core.setShouldShareFilters(value))
12315
- });
12316
- };
12317
- return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
12318
- align: "flex-start",
12546
+ return dropdowns || buttons ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
12547
+ className: "flex space-x-1",
12319
12548
  children: [
12320
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
12321
- justify: "space-between",
12322
- className: "w-full",
12323
- children: [
12324
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
12325
- size: "xl",
12326
- fw: 800,
12327
- children: "Filters"
12328
- }),
12329
- /*#__PURE__*/ jsxRuntime.jsx("button", {
12330
- className: "text-primary text-sm font-normal",
12331
- onClick: ()=>toggleAllFiltersExpanded(allFiltersCollapsed),
12332
- children: allFiltersCollapsed ? 'Expand All' : 'Collapse All'
12333
- })
12334
- ]
12549
+ Object.values(dropdownsToRender).map((dropdown)=>{
12550
+ return createDownloadMenuButton(dropdown, {
12551
+ type: index,
12552
+ totalCount,
12553
+ fields,
12554
+ filter,
12555
+ accessibility: accessibility ?? core.Accessibility.ALL
12556
+ });
12335
12557
  }),
12336
- showAccessLevel ? /*#__PURE__*/ jsxRuntime.jsx(AccessLevelControl, {
12337
- onChange: onAccessChange,
12338
- accessLevel: accessLevel
12339
- }) : null,
12340
- /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
12341
- className: "bg-base-max py-4 px-2 h-full w-full",
12342
- children: [
12343
- Object.keys(sharedFilters).length > 0 && /*#__PURE__*/ jsxRuntime.jsxs(core$1.Group, {
12344
- gap: "xs",
12345
- justify: "space-between",
12346
- children: [
12347
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
12348
- className: "flex items-center space-x-1",
12349
- children: [
12350
- /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
12351
- icon: "gen3:share",
12352
- height: 16,
12353
- width: 16,
12354
- color: theme.colors.accent[4]
12355
- }),
12356
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Text, {
12357
- size: "sm",
12358
- children: "Set the shared filters for all"
12359
- }),
12360
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
12361
- label: "If enabled any filter set on this tab will be applied to every tab where occurs.",
12362
- position: "top",
12363
- withArrow: true,
12364
- children: /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
12365
- icon: "gen3:info",
12366
- height: 12,
12367
- width: 12,
12368
- color: theme.colors.accent[4]
12369
- })
12370
- })
12371
- ]
12372
- }),
12373
- /*#__PURE__*/ jsxRuntime.jsx(core$1.Switch, {
12374
- checked: shareFilters,
12375
- onChange: (event)=>handleSharedFiltersChange(event.currentTarget.checked)
12376
- })
12377
- ]
12378
- }),
12379
- filters.tabs.length > 1 && /*#__PURE__*/ jsxRuntime.jsx(core$1.Select, {
12380
- classNames: {
12381
- options: 'border-1 border-base-dark',
12382
- option: 'hover:bg-primary-lightest'
12383
- },
12384
- withCheckIcon: false,
12385
- data: items,
12386
- value: value === null ? '0' : value,
12387
- onChange: setValue
12388
- }),
12389
- Object.keys(facetDefinitions).length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(FiltersPanel, {
12390
- fields: fields,
12391
- dataFunctions: facetDataHooks,
12392
- valueLabel: tabTitle
12393
- }) : null
12394
- ]
12558
+ buttons.map((button)=>{
12559
+ let disabled = false;
12560
+ let actionFunction = NullButtonAction;
12561
+ let actionArgs = {};
12562
+ const buttonAction = button.action ?? button.type;
12563
+ if (buttonAction) {
12564
+ const actionItem = findButtonAction(buttonAction);
12565
+ if (actionItem) {
12566
+ const funcArgs = actionItem.args ?? {};
12567
+ const func = actionItem.action;
12568
+ actionFunction = func;
12569
+ actionArgs = funcArgs ?? {};
12570
+ }
12571
+ }
12572
+ if (loginRequired && !isUserLoggedIn) {
12573
+ disabled = true;
12574
+ }
12575
+ return /*#__PURE__*/ jsxRuntime.jsx(CohortActionButton, {
12576
+ activeText: 'Downloading...',
12577
+ inactiveText: button.title,
12578
+ tooltipText: button.tooltipText,
12579
+ disabled: disabled || !button.enabled,
12580
+ actionFunction: actionFunction,
12581
+ actionArgs: {
12582
+ ...actionArgs,
12583
+ ...button.actionArgs ?? {},
12584
+ type: index,
12585
+ totalCount,
12586
+ fields,
12587
+ filter,
12588
+ accessibility: accessibility ?? core.Accessibility.ALL
12589
+ }
12590
+ }, button.title);
12395
12591
  })
12396
12592
  ]
12397
- });
12593
+ }) : /*#__PURE__*/ jsxRuntime.jsx(React.Fragment, {});
12398
12594
  };
12399
12595
 
12400
12596
  const EmptyData = {};
@@ -12832,6 +13028,18 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12832
13028
  cohortFilters.root,
12833
13029
  isSuccess
12834
13030
  ]);
13031
+ const EnumHookInstances = {
13032
+ useGetFacetData: getEnumFacetData,
13033
+ useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
13034
+ useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
13035
+ useClearFilter: lodash.partial(useClearFilters$1, index),
13036
+ useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
13037
+ useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
13038
+ useGetCombineMode: lodash.partial(useCohortFilterCombineState, index),
13039
+ useSetCombineMode: lodash.partial(useSetCohortFilterCombineState, index),
13040
+ useFieldNameToTitle: useFieldNameToTitle,
13041
+ useTotalCounts: undefined
13042
+ };
12835
13043
  const RangeHookInstances = {
12836
13044
  useGetFacetData: getRangeFacetData,
12837
13045
  useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
@@ -12846,38 +13054,9 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12846
13054
  const facetDataHooks = useDeepCompare.useDeepCompareMemo(()=>{
12847
13055
  return {
12848
13056
  // TODO: see if there a better way to do this
12849
- enum: {
12850
- useGetFacetData: getEnumFacetData,
12851
- useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
12852
- useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
12853
- useClearFilter: lodash.partial(useClearFilters$1, index),
12854
- useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
12855
- useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
12856
- useGetCombineMode: lodash.partial(useCohortFilterCombineState, index),
12857
- useSetCombineMode: lodash.partial(useSetCohortFilterCombineState, index),
12858
- useFieldNameToTitle: useFieldNameToTitle,
12859
- useTotalCounts: undefined
12860
- },
12861
- exact: {
12862
- useGetFacetData: getEnumFacetData,
12863
- useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
12864
- useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
12865
- useClearFilter: lodash.partial(useClearFilters$1, index),
12866
- useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
12867
- useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
12868
- useFieldNameToTitle: useFieldNameToTitle,
12869
- useTotalCounts: undefined
12870
- },
12871
- multiselect: {
12872
- useGetFacetData: getEnumFacetData,
12873
- useUpdateFacetFilters: lodash.partial(useUpdateFilters$1, index),
12874
- useGetFacetFilters: lodash.partial(useGetFacetFilters$1, index),
12875
- useClearFilter: lodash.partial(useClearFilters$1, index),
12876
- useFilterExpanded: lodash.partial(useFilterExpandedState$1, index),
12877
- useToggleExpandFilter: lodash.partial(useToggleExpandFilter$1, index),
12878
- useFieldNameToTitle: useFieldNameToTitle,
12879
- useTotalCounts: undefined
12880
- },
13057
+ enum: EnumHookInstances,
13058
+ exact: EnumHookInstances,
13059
+ multiselect: EnumHookInstances,
12881
13060
  range: RangeHookInstances,
12882
13061
  age: RangeHookInstances,
12883
13062
  year: RangeHookInstances,
@@ -12885,7 +13064,8 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12885
13064
  days: RangeHookInstances,
12886
13065
  percent: RangeHookInstances,
12887
13066
  datetime: RangeHookInstances,
12888
- toggle: RangeHookInstances
13067
+ toggle: RangeHookInstances,
13068
+ upload: EnumHookInstances
12889
13069
  };
12890
13070
  }, [
12891
13071
  getEnumFacetData,
@@ -13897,7 +14077,7 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
13897
14077
  className: "h-full",
13898
14078
  children: [
13899
14079
  /*#__PURE__*/ jsxRuntime.jsx("div", {
13900
- className: "p-0 rounded-sm h-1/2 h-max-1/2",
14080
+ className: "p-0 rounded-sm h-1/2 h-max-1/2 flex justify-center items-center overflow-hidden",
13901
14081
  children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Image, {
13902
14082
  component: Image,
13903
14083
  src: `${image}`,
@@ -19151,6 +19331,77 @@ const registerMetadataSchemaApp = ()=>core.createGen3App({
19151
19331
  requiredEntityTypes: []
19152
19332
  });
19153
19333
 
19334
+ const DropdownWithIcon = ({ disableTargetWidth, LeftIcon, RightIcon = /*#__PURE__*/ jsxRuntime.jsx(io.IoMdArrowDropdown, {
19335
+ size: "1.25em",
19336
+ "aria-hidden": "true",
19337
+ "data-testid": "dropdown-icon"
19338
+ }), TargetButtonChildren, targetButtonDisabled, dropdownElements, menuLabelText, menuLabelCustomClass, customPosition, fullHeight, zIndex = undefined, customDataTestId = undefined, tooltip = undefined, buttonAriaLabel = undefined })=>{
19339
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Menu, {
19340
+ width: disableTargetWidth ?? 'target',
19341
+ ...customPosition && {
19342
+ position: customPosition
19343
+ },
19344
+ "data-testid": customDataTestId ?? 'menu-elem',
19345
+ zIndex: zIndex,
19346
+ children: [
19347
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Target, {
19348
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Button, {
19349
+ variant: "outline",
19350
+ color: "primary",
19351
+ className: `bg-base-max border-primary data-disabled:opacity-50 data-disabled:bg-base-max data-disabled:text-primary ${focusStyles}`,
19352
+ ...LeftIcon && {
19353
+ leftIcon: LeftIcon
19354
+ },
19355
+ rightSection: RightIcon,
19356
+ disabled: targetButtonDisabled,
19357
+ classNames: {
19358
+ // rightIcon: 'border-l pl-1 -mr-2',
19359
+ root: fullHeight ? 'h-full' : undefined
19360
+ },
19361
+ "aria-label": buttonAriaLabel,
19362
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
19363
+ children: tooltip?.length && !targetButtonDisabled ? /*#__PURE__*/ jsxRuntime.jsx("div", {
19364
+ children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
19365
+ label: tooltip,
19366
+ children: /*#__PURE__*/ jsxRuntime.jsx("div", {
19367
+ children: TargetButtonChildren
19368
+ })
19369
+ })
19370
+ }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
19371
+ children: TargetButtonChildren
19372
+ })
19373
+ })
19374
+ })
19375
+ }),
19376
+ /*#__PURE__*/ jsxRuntime.jsxs(core$1.Menu.Dropdown, {
19377
+ "data-testid": "dropdown-menu-options",
19378
+ className: "border-1 border-secondary",
19379
+ children: [
19380
+ menuLabelText && /*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
19381
+ children: [
19382
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Label, {
19383
+ className: menuLabelCustomClass ?? 'font-bold',
19384
+ "data-testid": "menu-label",
19385
+ children: menuLabelText
19386
+ }),
19387
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Divider, {})
19388
+ ]
19389
+ }),
19390
+ dropdownElements?.map(({ title, onClick, icon, disabled }, idx)=>/*#__PURE__*/ jsxRuntime.jsx(core$1.Menu.Item, {
19391
+ onClick: ()=>{
19392
+ if (onClick) onClick();
19393
+ },
19394
+ "data-testid": `${title}-${idx}`,
19395
+ leftSection: icon && icon,
19396
+ disabled: disabled,
19397
+ children: title
19398
+ }, `${title}-${idx}`))
19399
+ ]
19400
+ })
19401
+ ]
19402
+ });
19403
+ };
19404
+
19154
19405
  const ActionButton = ({ title, enabled, type, leftIcon, rightIcon, tooltipText })=>{
19155
19406
  return /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
19156
19407
  label: tooltipText,
@@ -25612,6 +25863,7 @@ const staticNotebookAPI = async (req, res)=>{
25612
25863
 
25613
25864
  exports.AISearchPageGetServerSideProps = AISearchPageGetServerSideProps;
25614
25865
  exports.AccessLevel = AccessLevel;
25866
+ exports.AccordionPanel = AccordionPanel;
25615
25867
  exports.ActionBar = ActionBar;
25616
25868
  exports.ActionButton = ActionButton;
25617
25869
  exports.AdminAuthZPageGetServerSideProps = AdminAuthZPageGetServerSideProps;
@@ -25654,6 +25906,8 @@ exports.DiscoveryPage = DiscoveryPage;
25654
25906
  exports.DiscoveryPageGetServerSideProps = DiscoveryPageGetServerSideProps;
25655
25907
  exports.DiscoveryRowRendererFactory = DiscoveryRowRendererFactory;
25656
25908
  exports.DropdownButton = DropdownButton;
25909
+ exports.DropdownPanel = DropdownPanel;
25910
+ exports.DropdownWithIcon = DropdownWithIcon;
25657
25911
  exports.EnumFacet = EnumFacet;
25658
25912
  exports.EnumFacetChart = EnumFacetChart;
25659
25913
  exports.ErrorCard = ErrorCard;
@@ -25668,6 +25922,7 @@ exports.FacetExpander = FacetExpander;
25668
25922
  exports.FacetSelector = FacetSelector;
25669
25923
  exports.FacetSortPanel = FacetSortPanel;
25670
25924
  exports.FacetTabs = FacetTabs;
25925
+ exports.FiltersPanel = FiltersPanel;
25671
25926
  exports.FirstTimeModal = FirstTimeModal;
25672
25927
  exports.Footer = Footer;
25673
25928
  exports.Gen3Button = Gen3Button;
@@ -25706,6 +25961,7 @@ exports.RangeFacet = RangeFacet;
25706
25961
  exports.ReactECharts = ReactECharts;
25707
25962
  exports.ResourcesFilters = ResourcesFilters;
25708
25963
  exports.SPECIAL_CASE_FIELDS = SPECIAL_CASE_FIELDS;
25964
+ exports.SegmentedControl = SegmentedControl;
25709
25965
  exports.SessionExpiredModal = SessionExpiredModal;
25710
25966
  exports.SinglePageStudyDetailsPanel = SinglePageStudyDetailsPanel;
25711
25967
  exports.StaticNotebookIFrame = StaticNotebookIFrame;
@@ -25719,6 +25975,7 @@ exports.SubmissionPageGetServerSideProps = SubmissionPageGetServerSideProps;
25719
25975
  exports.TabbedCohortBuilder = TabbedCohortBuilder;
25720
25976
  exports.TabbedCohortBuilderPage = TabbedCohortBuilderPage;
25721
25977
  exports.TabbedCohortBuilderPageGetServerSideProps = TabbedCohortBuilderPageGetServerSideProps;
25978
+ exports.TabbedPanel = TabbedPanel;
25722
25979
  exports.TagCloud = TagCloud;
25723
25980
  exports.TailwindConfig = TailwindConfig;
25724
25981
  exports.TopBar = TopBar;