@gen3/frontend 0.11.12 → 0.11.14

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 (82) hide show
  1. package/dist/cjs/index.js +344 -239
  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/Providers/Gen3Provider.d.ts +141 -4
  10. package/dist/dts/components/Providers/Gen3Provider.d.ts.map +1 -1
  11. package/dist/dts/components/charts/Charts.d.ts.map +1 -1
  12. package/dist/dts/components/charts/Charts.js +27 -31
  13. package/dist/dts/components/charts/Charts.js.map +1 -1
  14. package/dist/dts/components/charts/CollapsableCharts.d.ts +2 -2
  15. package/dist/dts/components/charts/CollapsableCharts.d.ts.map +1 -1
  16. package/dist/dts/components/charts/CollapsableCharts.js +2 -2
  17. package/dist/dts/components/charts/CollapsableCharts.js.map +1 -1
  18. package/dist/dts/components/charts/createChart.d.ts.map +1 -1
  19. package/dist/dts/components/charts/createChart.js +7 -12
  20. package/dist/dts/components/charts/createChart.js.map +1 -1
  21. package/dist/dts/components/charts/echarts/HorizontalBarChart.d.ts.map +1 -1
  22. package/dist/dts/components/charts/echarts/HorizontalBarChart.js +7 -4
  23. package/dist/dts/components/charts/echarts/HorizontalBarChart.js.map +1 -1
  24. package/dist/dts/components/facets/EnumFacet.d.ts +1 -1
  25. package/dist/dts/components/facets/EnumFacet.d.ts.map +1 -1
  26. package/dist/dts/components/facets/EnumFacet.js +6 -6
  27. package/dist/dts/components/facets/EnumFacet.js.map +1 -1
  28. package/dist/dts/components/facets/FacetEnumList.d.ts +2 -0
  29. package/dist/dts/components/facets/FacetEnumList.d.ts.map +1 -1
  30. package/dist/dts/components/facets/FacetEnumList.js +24 -18
  31. package/dist/dts/components/facets/FacetEnumList.js.map +1 -1
  32. package/dist/dts/components/facets/createFacetCard.d.ts.map +1 -1
  33. package/dist/dts/components/facets/createFacetCard.js +4 -4
  34. package/dist/dts/components/facets/createFacetCard.js.map +1 -1
  35. package/dist/dts/components/facets/types.d.ts +4 -0
  36. package/dist/dts/components/facets/types.d.ts.map +1 -1
  37. package/dist/dts/components/facets/types.js.map +1 -1
  38. package/dist/dts/components/facets/utils.d.ts.map +1 -1
  39. package/dist/dts/components/facets/utils.js +18 -0
  40. package/dist/dts/components/facets/utils.js.map +1 -1
  41. package/dist/dts/features/Analysis/AnalysisCard.d.ts.map +1 -1
  42. package/dist/dts/features/Analysis/AnalysisCard.js +1 -1
  43. package/dist/dts/features/Analysis/AnalysisCard.js.map +1 -1
  44. package/dist/dts/features/Analysis/AnalysisCard.stories.d.ts.map +1 -1
  45. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +14 -14
  46. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts.map +1 -1
  47. package/dist/dts/features/Analysis/TextDescription.d.ts.map +1 -1
  48. package/dist/dts/features/Analysis/TextDescription.js +3 -19
  49. package/dist/dts/features/Analysis/TextDescription.js.map +1 -1
  50. package/dist/dts/features/CohortBuilder/CohortBuilder.d.ts.map +1 -1
  51. package/dist/dts/features/CohortBuilder/CohortBuilder.js +3 -13
  52. package/dist/dts/features/CohortBuilder/CohortBuilder.js.map +1 -1
  53. package/dist/dts/features/CohortBuilder/CohortPanel.d.ts.map +1 -1
  54. package/dist/dts/features/CohortBuilder/CohortPanel.js +28 -21
  55. package/dist/dts/features/CohortBuilder/CohortPanel.js.map +1 -1
  56. package/dist/dts/features/CohortDiscovery/registerApp.js +1 -1
  57. package/dist/dts/features/CohortDiscovery/registerApp.js.map +1 -1
  58. package/dist/dts/features/CohortSimilarity/cohortSimilarityApi.d.ts +10 -10
  59. package/dist/dts/features/Discovery/DataLoaders/MDSAllLocal/DataLoader.d.ts.map +1 -1
  60. package/dist/dts/features/Discovery/DataLoaders/MDSAllLocal/DataLoader.js +1 -0
  61. package/dist/dts/features/Discovery/DataLoaders/MDSAllLocal/DataLoader.js.map +1 -1
  62. package/dist/dts/features/Discovery/DiscoveryIndexPanel.d.ts.map +1 -1
  63. package/dist/dts/features/Discovery/DiscoveryIndexPanel.js +1 -1
  64. package/dist/dts/features/Discovery/DiscoveryIndexPanel.js.map +1 -1
  65. package/dist/dts/features/Discovery/DiscoveryTable.d.ts.map +1 -1
  66. package/dist/dts/features/Discovery/DiscoveryTable.js +30 -5
  67. package/dist/dts/features/Discovery/DiscoveryTable.js.map +1 -1
  68. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.d.ts +1 -0
  69. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.d.ts.map +1 -1
  70. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.js +10 -0
  71. package/dist/dts/features/Discovery/TableRenderers/CellRenderers.js.map +1 -1
  72. package/dist/dts/features/Discovery/types.d.ts +7 -0
  73. package/dist/dts/features/Discovery/types.d.ts.map +1 -1
  74. package/dist/dts/features/Discovery/types.js.map +1 -1
  75. package/dist/dts/features/Navigation/NavigationBar.d.ts.map +1 -1
  76. package/dist/dts/features/Navigation/NavigationBar.js +3 -2
  77. package/dist/dts/features/Navigation/NavigationBar.js.map +1 -1
  78. package/dist/esm/index.js +345 -240
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/index.d.ts +170 -17
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/package.json +3 -3
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@ 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
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, Image as Image$1, NavLink, List, createTheme, Pagination, FileInput, CloseButton } from '@mantine/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';
@@ -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',
@@ -3800,7 +3828,7 @@ const OverflowTooltippedLabel = ({ children, label, className = 'flex-grow font-
3800
3828
  });
3801
3829
  };
3802
3830
 
3803
- 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 = [] })=>{
3804
3832
  const [isGroupExpanded, setIsGroupExpanded] = useState(false);
3805
3833
  const cardRef = useRef(null);
3806
3834
  const searchInputRef = useRef(null);
@@ -3857,7 +3885,7 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3857
3885
  ];
3858
3886
  updateFacetEnum(field, updated, updateFacetFilters, clearFilters, combineMode);
3859
3887
  } else {
3860
- const updated = selectedEnums?.filter((x)=>x != value);
3888
+ const updated = selectedEnums?.filter((x)=>x !== value);
3861
3889
  updateFacetEnum(field, updated ?? [], updateFacetFilters, clearFilters, combineMode);
3862
3890
  }
3863
3891
  };
@@ -3894,7 +3922,7 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3894
3922
  useDeepCompareEffect(()=>{
3895
3923
  if (isSuccess && data) {
3896
3924
  // get all the data except the missing and empty values
3897
- 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()));
3898
3926
  // it is possible that the selected enums are not in the data as their counts are 0
3899
3927
  // therefore we need to add them to the data
3900
3928
  const selectedEnumNotInData = selectedEnums ? selectedEnums.reduce((acc, curr)=>{
@@ -3909,16 +3937,16 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3909
3937
  const remainingValues = tempFilteredData.length + selectedEnumNotInData.length - maxValuesToDisplay;
3910
3938
  const cardStyle = calcCardStyle(remainingValues);
3911
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()));
3912
3946
  setFacetChartData((prevFacetChartData)=>({
3913
3947
  ...prevFacetChartData,
3914
- filteredData: [
3915
- ...tempFilteredData,
3916
- ...selectedEnumNotInData
3917
- ],
3918
- filteredDataObj: Object.fromEntries([
3919
- ...tempFilteredData,
3920
- ...selectedEnumNotInData
3921
- ]),
3948
+ filteredData: filteredData,
3949
+ filteredDataObj: Object.fromEntries(filteredData),
3922
3950
  remainingValues,
3923
3951
  numberOfBarsToDisplay,
3924
3952
  isSuccess: true,
@@ -3944,8 +3972,9 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
3944
3972
  useDeepCompareEffect(()=>{
3945
3973
  if (facetChartData.filteredData && facetChartData.filteredData.length > 0) {
3946
3974
  const obj = [
3947
- ...facetChartData.filteredData
3948
- ].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);
3949
3978
  setSortedData(obj);
3950
3979
  if (updateVisibleValues) updateVisibleValues(obj);
3951
3980
  }
@@ -4158,7 +4187,7 @@ const FacetEnumList = ({ field, facetName, hooks, valueLabel, isSettings = false
4158
4187
  });
4159
4188
  };
4160
4189
 
4161
- 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 = {
4162
4191
  Panel: FacetHeader,
4163
4192
  Label: FacetText,
4164
4193
  iconStyle: controlsIconStyle
@@ -4209,7 +4238,9 @@ const EnumFacet = ({ field, hooks, valueLabel, description, facetName, showPerce
4209
4238
  isFacetView: isFacetView,
4210
4239
  isSearching: isSearching,
4211
4240
  hideIfEmpty: hideIfEmpty,
4212
- showPercent: showPercent
4241
+ showPercent: showPercent,
4242
+ moveValuesToBottom: moveValuesToBottom,
4243
+ excludeValues: excludeValues
4213
4244
  })
4214
4245
  })
4215
4246
  ]
@@ -4608,7 +4639,9 @@ const createFacetCard = ({ facetDefinition, valueLabel, hooks: dataFunctions, fa
4608
4639
  width: width,
4609
4640
  hooks: dataFunctions,
4610
4641
  showPercent: showPercent,
4611
- sharedWithIndices: facetDefinition?.sharedWithIndices
4642
+ sharedWithIndices: facetDefinition?.sharedWithIndices,
4643
+ moveValuesToBottom: facetDefinition?.moveValuesToBottom ?? [],
4644
+ excludeValues: facetDefinition?.excludeValues ?? []
4612
4645
  }, `${idPrefix}-enum-${field}`),
4613
4646
  range: /*#__PURE__*/ jsx(RangeFacet, {
4614
4647
  valueLabel: valueTypeLabel,
@@ -6148,6 +6181,7 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
6148
6181
  root: 'flex bg-base-max border-b-1 border-base-dark',
6149
6182
  navigationPanel: 'font-heading',
6150
6183
  logoAndTitlePanel: 'flex justify-center items-center align-middle',
6184
+ buttons: '',
6151
6185
  login: 'pl-1 mr-6 bg-base-max text-base-contrast opacity-80 hover:opacity-100'
6152
6186
  };
6153
6187
  const mergedClassnames = mergeDefaultTailwindClassnames(classNamesDefaults, classNames);
@@ -6173,11 +6207,11 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
6173
6207
  className: "flex flex-grow"
6174
6208
  }),
6175
6209
  /*#__PURE__*/ jsx("div", {
6176
- className: `grid grid-cols-${items?.length} ${extractClassName('navigationPanel', mergedClassnames)}`,
6210
+ className: `flex flex-grow nowrap ${extractClassName('navigationPanel', mergedClassnames)}`,
6177
6211
  children: items.map((x, index)=>{
6178
6212
  const selectedStyle = current === x.href ? 'border-accent border-b-4 border-b-accent' : '';
6179
6213
  return /*#__PURE__*/ jsx("div", {
6180
- className: `first:border-l-1 border-r-1 border-base-dark ${selectedStyle}`,
6214
+ className: `first:border-l-1 border-r-1 flex-1 border-base-dark ${selectedStyle} ${extractClassName('buttons', mergedClassnames)}`,
6181
6215
  children: /*#__PURE__*/ jsx(NavigationBarButton, {
6182
6216
  tooltip: x.tooltip,
6183
6217
  icon: x.icon,
@@ -7516,6 +7550,20 @@ const TableIcons = {
7516
7550
  })
7517
7551
  };
7518
7552
 
7553
+ const CompareFn = (fieldValue, cmpOp, value)=>{
7554
+ switch(cmpOp){
7555
+ case 'alwaysTrue':
7556
+ return true;
7557
+ case 'arrayNotEmpty':
7558
+ return Array.isArray(fieldValue) && fieldValue.length > 0;
7559
+ }
7560
+ };
7561
+ const isSelectable = (row, config)=>{
7562
+ if (!config) return false;
7563
+ if (!Object.hasOwn(row.original, config.field)) return false;
7564
+ const fieldValue = row.original[config.field];
7565
+ return CompareFn(fieldValue, config.comparer, config.value);
7566
+ };
7519
7567
  const extractCellValue = (func)=>({ cell, row })=>func({
7520
7568
  value: cell.getValue(),
7521
7569
  cell,
@@ -7548,6 +7596,13 @@ const DiscoveryTable = ({ data, hits, dataRequestStatus, setSorting, setPaginati
7548
7596
  }, [
7549
7597
  config.studyColumns
7550
7598
  ]);
7599
+ const checkIfRowIsSelectable = (row)=>{
7600
+ if (config.tableConfig?.selectableRows) return true;
7601
+ if (config.tableConfig?.selectableRowConfiguration) {
7602
+ return isSelectable(row, config.tableConfig.selectableRowConfiguration);
7603
+ }
7604
+ return false;
7605
+ };
7551
7606
  const table = useMantineReactTable({
7552
7607
  columns: cols,
7553
7608
  data: data ?? [],
@@ -7558,7 +7613,7 @@ const DiscoveryTable = ({ data, hits, dataRequestStatus, setSorting, setPaginati
7558
7613
  onPaginationChange: setPagination,
7559
7614
  onSortingChange: setSorting
7560
7615
  } : {},
7561
- enableRowSelection: config.tableConfig?.selectableRows ?? false,
7616
+ enableRowSelection: checkIfRowIsSelectable,
7562
7617
  rowCount: hits,
7563
7618
  icons: TableIcons,
7564
7619
  enableTopToolbar: false,
@@ -8786,6 +8841,7 @@ const useSearchMetadata = ({ discoveryConfig, searchTerms, mdsData, isSuccess })
8786
8841
  uidField
8787
8842
  ],
8788
8843
  idField: uidField,
8844
+ tokenize: (string, _fieldName)=>string.split(' '),
8789
8845
  extractField: extractValue,
8790
8846
  // processTerm: (term) => suffixes(term, 3),
8791
8847
  searchOptions: {
@@ -9689,7 +9745,8 @@ registerDefaultDiscoveryDataLoaders();
9689
9745
  }) : null,
9690
9746
  discoveryConfig.features?.chartsSection?.enabled && /*#__PURE__*/ jsx(CollapsableCharts, {
9691
9747
  config: discoveryConfig.features?.chartsSection,
9692
- data: chartData
9748
+ data: chartData,
9749
+ isSuccess: dataRequestStatus.isSuccess
9693
9750
  }),
9694
9751
  /*#__PURE__*/ jsxs("div", {
9695
9752
  className: "flex items-center p-2 mb-4 bg-base-max rounded-lg",
@@ -10119,6 +10176,23 @@ const RenderParagraphsCell = ({ value })=>{
10119
10176
  }, i))
10120
10177
  });
10121
10178
  };
10179
+ const RenderIfArrayHasData = ({ value })=>{
10180
+ const content = value;
10181
+ if (isArray(content) && content.length > 0) {
10182
+ return /*#__PURE__*/ jsx(Icon, {
10183
+ icon: "gen3:checked-filled",
10184
+ height: 22,
10185
+ width: 22,
10186
+ className: "text-utility-success"
10187
+ });
10188
+ }
10189
+ return /*#__PURE__*/ jsx(Icon, {
10190
+ icon: "gen3:cancel-filled",
10191
+ height: 22,
10192
+ width: 22,
10193
+ className: "text-utility-error"
10194
+ });
10195
+ };
10122
10196
  // TODO Fix below
10123
10197
  // eslint-disable-next-line react/prop-types
10124
10198
  const DiscoveryRenderTagsCell = ({ value })=>{
@@ -10149,6 +10223,7 @@ const DiscoveryRenderTagsCell = ({ value })=>{
10149
10223
  const Gen3DiscoveryStandardCellRenderers = {
10150
10224
  array: {
10151
10225
  NegativePositive: RenderArrayCellNegativePositive$1,
10226
+ HasData: RenderIfArrayHasData,
10152
10227
  default: RenderArrayCell$1
10153
10228
  },
10154
10229
  string: {
@@ -12598,10 +12673,22 @@ const EmptyData = {};
12598
12673
  const isXl = useMediaQuery('(min-width: 1600px)');
12599
12674
  const [accessLevel, setAccessLevel] = useState(Accessibility.ALL);
12600
12675
  const sharedFiltersMap = useCoreSelector((state)=>selectSharedFilters(state));
12601
- let numCols = 3;
12602
- if (isSm) numCols = 1;
12603
- if (isMd) numCols = 2;
12604
- if (isXl) numCols = 4;
12676
+ const defaultDropdowns = useMemo(()=>dropdowns ?? {}, [
12677
+ dropdowns
12678
+ ]);
12679
+ const defaultButtons = useMemo(()=>buttons ?? [], [
12680
+ buttons
12681
+ ]);
12682
+ const numCols = useMemo(()=>{
12683
+ if (isSm) return 1;
12684
+ if (isMd) return 2;
12685
+ if (isXl) return 4;
12686
+ return 3;
12687
+ }, [
12688
+ isSm,
12689
+ isMd,
12690
+ isXl
12691
+ ]);
12605
12692
  const index = guppyConfig.dataType;
12606
12693
  const fields = useMemo(()=>getAllFieldsFromFilterConfigs(filters?.tabs ?? []), [
12607
12694
  filters?.tabs
@@ -12615,14 +12702,20 @@ const EmptyData = {};
12615
12702
  filters: cohortFilters,
12616
12703
  accessibility: accessLevel
12617
12704
  });
12618
- const { data: chartData, isSuccess: isChartSuccess, isFetching: isChartFetching, isError: isChartError } = useGetAggsNoFilterSelfQuery({
12619
- type: index,
12620
- fields: [
12705
+ const chartKeys = useDeepCompareMemo(()=>[
12621
12706
  ...Object.keys(chartsSection?.charts ?? {}),
12622
12707
  ...Object.keys(charts)
12623
- ],
12708
+ ], [
12709
+ chartsSection?.charts,
12710
+ charts
12711
+ ]);
12712
+ const { data: chartData, isSuccess: isChartSuccess, isFetching: isChartFetching, isError: isChartError } = useGetAggsNoFilterSelfQuery({
12713
+ type: index,
12714
+ fields: chartKeys,
12624
12715
  filters: cohortFilters,
12625
12716
  accessibility: accessLevel
12717
+ }, {
12718
+ skip: chartKeys.length === 0
12626
12719
  });
12627
12720
  const getEnumFacetData = useDeepCompareCallback((field)=>{
12628
12721
  let filters = undefined;
@@ -12645,7 +12738,7 @@ const EmptyData = {};
12645
12738
  isSuccess: isSuccess
12646
12739
  };
12647
12740
  }, [
12648
- cohortFilters,
12741
+ cohortFilters.root,
12649
12742
  data,
12650
12743
  isSuccess
12651
12744
  ]);
@@ -12794,8 +12887,8 @@ const EmptyData = {};
12794
12887
  className: "flex justify-between mb-2 ml-2",
12795
12888
  children: [
12796
12889
  /*#__PURE__*/ jsx(DownloadsPanel, {
12797
- dropdowns: dropdowns ?? {},
12798
- buttons: buttons ?? [],
12890
+ dropdowns: defaultDropdowns,
12891
+ buttons: defaultButtons,
12799
12892
  loginForDownload: loginForDownload,
12800
12893
  index: index,
12801
12894
  totalCount: counts ?? 0,
@@ -12814,7 +12907,8 @@ const EmptyData = {};
12814
12907
  ...chartsSection,
12815
12908
  charts: summaryCharts
12816
12909
  },
12817
- data: chartData ?? EmptyData
12910
+ data: chartData ?? EmptyData,
12911
+ isSuccess: isChartSuccess
12818
12912
  }) : /*#__PURE__*/ jsx(Charts, {
12819
12913
  charts: summaryCharts,
12820
12914
  data: chartData ?? EmptyData,
@@ -12868,6 +12962,9 @@ const TabsLayoutToComponentProp = (tabsLayout)=>{
12868
12962
  const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = 'left' })=>{
12869
12963
  const dispatch = useCoreDispatch();
12870
12964
  dispatch(setSharedFilters(sharedFiltersMap ?? {}));
12965
+ const configuration = useDeepCompareMemo(()=>explorerConfig, [
12966
+ explorerConfig
12967
+ ]);
12871
12968
  return /*#__PURE__*/ jsx("div", {
12872
12969
  className: "w-full",
12873
12970
  children: /*#__PURE__*/ jsxs(Tabs, {
@@ -12878,17 +12975,24 @@ const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = '
12878
12975
  /*#__PURE__*/ jsx(Tabs.List, {
12879
12976
  className: "w-full",
12880
12977
  justify: TabsLayoutToComponentProp(tabsLayout),
12881
- children: explorerConfig.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Tab, {
12978
+ children: configuration.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Tab, {
12882
12979
  value: panelConfig.tabTitle,
12883
12980
  children: panelConfig.tabTitle
12884
12981
  }, `${panelConfig.tabTitle}-tabList`))
12885
12982
  }),
12886
- explorerConfig.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Panel, {
12983
+ configuration.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Panel, {
12887
12984
  value: panelConfig.tabTitle,
12888
- children: /*#__PURE__*/ createElement(CohortPanel, {
12889
- ...panelConfig,
12890
- key: `${panelConfig.tabTitle}-CohortPanel`
12891
- })
12985
+ children: /*#__PURE__*/ jsx(CohortPanel, {
12986
+ guppyConfig: panelConfig.guppyConfig,
12987
+ chartsSection: panelConfig?.chartsSection,
12988
+ filters: panelConfig.filters,
12989
+ tabTitle: panelConfig.tabTitle,
12990
+ table: panelConfig.table,
12991
+ dropdowns: panelConfig.dropdowns,
12992
+ buttons: panelConfig.buttons,
12993
+ loginForDownload: panelConfig.loginForDownload,
12994
+ sharedFiltersMap: panelConfig.sharedFiltersMap
12995
+ }, `${panelConfig.tabTitle}-CohortPanel`)
12892
12996
  }, `${panelConfig.tabTitle}-tabPanel`))
12893
12997
  ]
12894
12998
  })
@@ -14003,47 +14107,25 @@ const Workspace = ({ config })=>{
14003
14107
  };
14004
14108
 
14005
14109
  const TextDescription = ({ description })=>{
14006
- const [extend, setExtend] = useState(false);
14007
- const textRef = useRef(null);
14008
- const [isClamped, setClamped] = useState(false);
14009
- useEffect(()=>{
14010
- // Function that should be called on window resize
14011
- function handleResize() {
14012
- if (textRef && textRef.current) {
14013
- setClamped(textRef.current.scrollHeight > textRef.current.clientHeight);
14014
- }
14015
- }
14016
- // Add event listener to window resize
14017
- window.addEventListener('resize', handleResize);
14018
- // Remove event listener on cleanup
14019
- return ()=>window.removeEventListener('resize', handleResize);
14020
- }, []); // Empty array ensures that it would only run on mount
14021
- return /*#__PURE__*/ jsxs(Fragment, {
14022
- children: [
14023
- !extend ? /*#__PURE__*/ jsx(Text, {
14024
- ref: textRef,
14025
- size: "sm",
14026
- lineClamp: 4,
14027
- children: description
14028
- }) : /*#__PURE__*/ jsx(Text, {
14029
- size: "sm",
14030
- children: description
14031
- }),
14032
- isClamped && /*#__PURE__*/ jsx("button", {
14033
- onClick: ()=>setExtend((extend)=>!extend),
14034
- children: /*#__PURE__*/ jsxs("div", {
14035
- className: "flex text-xs font-semibold text-base-contrast-light",
14036
- children: [
14037
- !extend ? 'Extend Text' : 'Collapse Text',
14038
- ' ',
14039
- /*#__PURE__*/ jsx("div", {
14040
- className: "my-auto",
14041
- children: !extend ? /*#__PURE__*/ jsx(MdKeyboardArrowDown, {}) : /*#__PURE__*/ jsx(MdKeyboardArrowUp, {})
14042
- })
14043
- ]
14110
+ return /*#__PURE__*/ jsx(Spoiler, {
14111
+ maxHeight: 80,
14112
+ showLabel: /*#__PURE__*/ jsxs("span", {
14113
+ children: [
14114
+ "Extend Text ",
14115
+ /*#__PURE__*/ jsx(MdKeyboardArrowDown, {
14116
+ className: "inline"
14044
14117
  })
14045
- })
14046
- ]
14118
+ ]
14119
+ }),
14120
+ hideLabel: /*#__PURE__*/ jsxs("span", {
14121
+ children: [
14122
+ "Collapse Text ",
14123
+ /*#__PURE__*/ jsx(MdKeyboardArrowUp, {
14124
+ className: "inline"
14125
+ })
14126
+ ]
14127
+ }),
14128
+ children: description
14047
14129
  });
14048
14130
  };
14049
14131
 
@@ -14051,20 +14133,22 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
14051
14133
  return /*#__PURE__*/ jsxs(Stack, {
14052
14134
  align: "stretch",
14053
14135
  justify: "space-between",
14054
- className: "rounded-sm rounded-t-md bg-base-max p-0",
14136
+ className: "rounded-sm rounded-t-md bg-base-max p-0 h-full",
14055
14137
  children: [
14056
14138
  /*#__PURE__*/ jsxs("div", {
14057
- className: "h-full",
14139
+ className: "relative",
14058
14140
  children: [
14059
14141
  /*#__PURE__*/ jsx("div", {
14060
- className: "p-0 rounded-sm h-1/2 h-max-1/2 flex justify-center items-center overflow-hidden",
14061
- children: /*#__PURE__*/ jsx(Image$1, {
14062
- component: Image,
14063
- src: `${image}`,
14064
- alt: `${title} image`,
14065
- height: 1000,
14066
- width: 1000,
14067
- radius: "md"
14142
+ className: "p-0 rounded-sm h-[200px] h-max-1/2 flex justify-center items-center relative overflow-hidden",
14143
+ children: /*#__PURE__*/ jsx("div", {
14144
+ children: /*#__PURE__*/ jsx(Image$1, {
14145
+ component: Image,
14146
+ src: `${image}`,
14147
+ alt: "",
14148
+ radius: "md",
14149
+ width: 500,
14150
+ height: 500
14151
+ })
14068
14152
  })
14069
14153
  }),
14070
14154
  /*#__PURE__*/ jsxs("div", {
@@ -14075,7 +14159,7 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
14075
14159
  children: /*#__PURE__*/ jsx(Image$1, {
14076
14160
  component: Image,
14077
14161
  src: `${icon}`,
14078
- alt: `${title} logo`,
14162
+ alt: "",
14079
14163
  width: 40,
14080
14164
  height: 40,
14081
14165
  radius: "lg"
@@ -17119,7 +17203,7 @@ const registerCohortDiscoveryApp = ()=>createGen3AppWithOwnStore({
17119
17203
  App: CohortDiscovery,
17120
17204
  id: AppId$1,
17121
17205
  name: _APP_NAME$2,
17122
- version: 'v1.0.0',
17206
+ version: _APP_VERSION$1,
17123
17207
  requiredEntityTypes: [],
17124
17208
  store: AppStore,
17125
17209
  context: AppContext
@@ -19311,45 +19395,44 @@ const registerMetadataSchemaApp = ()=>createGen3App({
19311
19395
  requiredEntityTypes: []
19312
19396
  });
19313
19397
 
19314
- const DropdownWithIcon = ({ disableTargetWidth, LeftIcon, RightIcon = /*#__PURE__*/ jsx(IoMdArrowDropdown, {
19315
- size: "1.25em",
19316
- "aria-hidden": "true",
19317
- "data-testid": "dropdown-icon"
19318
- }), TargetButtonChildren, targetButtonDisabled, dropdownElements, menuLabelText, menuLabelCustomClass, customPosition, fullHeight, zIndex = undefined, customDataTestId = undefined, tooltip = undefined, buttonAriaLabel = undefined })=>{
19398
+ const ADDITIONAL_DOWNLOAD_MESSAGE = 'A previous download is being processed. Additional downloads may be started.';
19399
+ const DropdownWithIcon = ({ disableTargetWidth, LeftSection, RightSection = /*#__PURE__*/ jsx("div", {
19400
+ className: "border-l pl-1 -mr-2",
19401
+ children: /*#__PURE__*/ jsx(IoMdArrowDropdown, {
19402
+ size: "1.25em",
19403
+ "aria-hidden": "true",
19404
+ "data-testid": "dropdown-icon"
19405
+ })
19406
+ }), TargetButtonChildren, targetButtonDisabled, dropdownElements, menuLabelText, menuLabelCustomClass, customPosition, fullHeight, zIndex = 900, customTargetButtonDataTestId = undefined, targetButtonTooltip = undefined, buttonAriaLabel = undefined, closeOnItemClick = true })=>{
19407
+ const targetRef = useRef(null);
19319
19408
  return /*#__PURE__*/ jsxs(Menu, {
19320
- width: disableTargetWidth ?? 'target',
19409
+ width: !disableTargetWidth ? 'target' : null,
19321
19410
  ...customPosition && {
19322
19411
  position: customPosition
19323
19412
  },
19324
- "data-testid": customDataTestId ?? 'menu-elem',
19325
19413
  zIndex: zIndex,
19414
+ closeOnItemClick: closeOnItemClick,
19326
19415
  children: [
19327
19416
  /*#__PURE__*/ jsx(Menu.Target, {
19328
- children: /*#__PURE__*/ jsx(Button, {
19329
- variant: "outline",
19330
- color: "primary",
19331
- className: `bg-base-max border-primary data-disabled:opacity-50 data-disabled:bg-base-max data-disabled:text-primary ${focusStyles}`,
19332
- ...LeftIcon && {
19333
- leftIcon: LeftIcon
19334
- },
19335
- rightSection: RightIcon,
19336
- disabled: targetButtonDisabled,
19337
- classNames: {
19338
- // rightIcon: 'border-l pl-1 -mr-2',
19339
- root: fullHeight ? 'h-full' : undefined
19340
- },
19341
- "aria-label": buttonAriaLabel,
19342
- children: /*#__PURE__*/ jsx("div", {
19343
- children: tooltip?.length && !targetButtonDisabled ? /*#__PURE__*/ jsx("div", {
19344
- children: /*#__PURE__*/ jsx(Tooltip, {
19345
- label: tooltip,
19346
- children: /*#__PURE__*/ jsx("div", {
19347
- children: TargetButtonChildren
19348
- })
19349
- })
19350
- }) : /*#__PURE__*/ jsx("div", {
19351
- children: TargetButtonChildren
19352
- })
19417
+ children: /*#__PURE__*/ jsx(Tooltip, {
19418
+ label: targetButtonTooltip,
19419
+ disabled: !targetButtonTooltip,
19420
+ children: /*#__PURE__*/ jsx(Button, {
19421
+ variant: "outline",
19422
+ color: "primary",
19423
+ className: `flex items-center bg-base-max border-primary data-disabled:opacity-50 data-disabled:bg-base-max data-disabled:text-primary ${focusStyles}`,
19424
+ ...LeftSection && {
19425
+ leftSection: LeftSection
19426
+ },
19427
+ rightSection: RightSection,
19428
+ disabled: targetButtonDisabled,
19429
+ classNames: {
19430
+ root: `${fullHeight ? 'h-full' : undefined}`
19431
+ },
19432
+ ref: targetRef,
19433
+ "aria-label": buttonAriaLabel,
19434
+ "data-testid": customTargetButtonDataTestId ?? 'menu-elem',
19435
+ children: TargetButtonChildren
19353
19436
  })
19354
19437
  })
19355
19438
  }),
@@ -19357,7 +19440,7 @@ const DropdownWithIcon = ({ disableTargetWidth, LeftIcon, RightIcon = /*#__PURE_
19357
19440
  "data-testid": "dropdown-menu-options",
19358
19441
  className: "border-1 border-secondary",
19359
19442
  children: [
19360
- menuLabelText && /*#__PURE__*/ jsxs(React__default.Fragment, {
19443
+ menuLabelText && /*#__PURE__*/ jsxs(Fragment, {
19361
19444
  children: [
19362
19445
  /*#__PURE__*/ jsx(Menu.Label, {
19363
19446
  className: menuLabelCustomClass ?? 'font-bold',
@@ -19367,15 +19450,37 @@ const DropdownWithIcon = ({ disableTargetWidth, LeftIcon, RightIcon = /*#__PURE_
19367
19450
  /*#__PURE__*/ jsx(Menu.Divider, {})
19368
19451
  ]
19369
19452
  }),
19370
- dropdownElements?.map(({ title, onClick, icon, disabled }, idx)=>/*#__PURE__*/ jsx(Menu.Item, {
19453
+ dropdownElements.map(({ title, onClick, icon, disabled, isLoading, loadingTooltip }, idx)=>{
19454
+ const menuItem = /*#__PURE__*/ jsx(Menu.Item, {
19371
19455
  onClick: ()=>{
19372
- if (onClick) onClick();
19456
+ if (onClick) {
19457
+ onClick();
19458
+ }
19459
+ // This is done inorder to set the last focused element as the menu target element
19460
+ // This is done to return focus to the target element if the modal is closed with ESC
19461
+ if (targetRef?.current) {
19462
+ targetRef?.current?.focus();
19463
+ }
19373
19464
  },
19374
19465
  "data-testid": `${title}-${idx}`,
19375
19466
  leftSection: icon && icon,
19376
19467
  disabled: disabled,
19377
19468
  children: title
19378
- }, `${title}-${idx}`))
19469
+ }, `${title}-${idx}`);
19470
+ if (isLoading) {
19471
+ return /*#__PURE__*/ jsx(Tooltip, {
19472
+ label: loadingTooltip || ADDITIONAL_DOWNLOAD_MESSAGE,
19473
+ position: "right",
19474
+ withArrow: true,
19475
+ multiline: true,
19476
+ w: 400,
19477
+ children: /*#__PURE__*/ jsx("div", {
19478
+ children: menuItem
19479
+ })
19480
+ }, `${title}-${idx}`);
19481
+ }
19482
+ return menuItem;
19483
+ })
19379
19484
  ]
19380
19485
  })
19381
19486
  ]