@gen3/frontend 0.11.12 → 0.11.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/cjs/index.js +341 -237
  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/esm/index.js +342 -238
  76. package/dist/esm/index.js.map +1 -1
  77. package/dist/index.d.ts +170 -17
  78. package/dist/tsconfig.tsbuildinfo +1 -1
  79. 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,
@@ -7516,6 +7549,20 @@ const TableIcons = {
7516
7549
  })
7517
7550
  };
7518
7551
 
7552
+ const CompareFn = (fieldValue, cmpOp, value)=>{
7553
+ switch(cmpOp){
7554
+ case 'alwaysTrue':
7555
+ return true;
7556
+ case 'arrayNotEmpty':
7557
+ return Array.isArray(fieldValue) && fieldValue.length > 0;
7558
+ }
7559
+ };
7560
+ const isSelectable = (row, config)=>{
7561
+ if (!config) return false;
7562
+ if (!Object.hasOwn(row.original, config.field)) return false;
7563
+ const fieldValue = row.original[config.field];
7564
+ return CompareFn(fieldValue, config.comparer, config.value);
7565
+ };
7519
7566
  const extractCellValue = (func)=>({ cell, row })=>func({
7520
7567
  value: cell.getValue(),
7521
7568
  cell,
@@ -7548,6 +7595,13 @@ const DiscoveryTable = ({ data, hits, dataRequestStatus, setSorting, setPaginati
7548
7595
  }, [
7549
7596
  config.studyColumns
7550
7597
  ]);
7598
+ const checkIfRowIsSelectable = (row)=>{
7599
+ if (config.tableConfig?.selectableRows) return true;
7600
+ if (config.tableConfig?.selectableRowConfiguration) {
7601
+ return isSelectable(row, config.tableConfig.selectableRowConfiguration);
7602
+ }
7603
+ return false;
7604
+ };
7551
7605
  const table = useMantineReactTable({
7552
7606
  columns: cols,
7553
7607
  data: data ?? [],
@@ -7558,7 +7612,7 @@ const DiscoveryTable = ({ data, hits, dataRequestStatus, setSorting, setPaginati
7558
7612
  onPaginationChange: setPagination,
7559
7613
  onSortingChange: setSorting
7560
7614
  } : {},
7561
- enableRowSelection: config.tableConfig?.selectableRows ?? false,
7615
+ enableRowSelection: checkIfRowIsSelectable,
7562
7616
  rowCount: hits,
7563
7617
  icons: TableIcons,
7564
7618
  enableTopToolbar: false,
@@ -8786,6 +8840,7 @@ const useSearchMetadata = ({ discoveryConfig, searchTerms, mdsData, isSuccess })
8786
8840
  uidField
8787
8841
  ],
8788
8842
  idField: uidField,
8843
+ tokenize: (string, _fieldName)=>string.split(' '),
8789
8844
  extractField: extractValue,
8790
8845
  // processTerm: (term) => suffixes(term, 3),
8791
8846
  searchOptions: {
@@ -9689,7 +9744,8 @@ registerDefaultDiscoveryDataLoaders();
9689
9744
  }) : null,
9690
9745
  discoveryConfig.features?.chartsSection?.enabled && /*#__PURE__*/ jsx(CollapsableCharts, {
9691
9746
  config: discoveryConfig.features?.chartsSection,
9692
- data: chartData
9747
+ data: chartData,
9748
+ isSuccess: dataRequestStatus.isSuccess
9693
9749
  }),
9694
9750
  /*#__PURE__*/ jsxs("div", {
9695
9751
  className: "flex items-center p-2 mb-4 bg-base-max rounded-lg",
@@ -10119,6 +10175,23 @@ const RenderParagraphsCell = ({ value })=>{
10119
10175
  }, i))
10120
10176
  });
10121
10177
  };
10178
+ const RenderIfArrayHasData = ({ value })=>{
10179
+ const content = value;
10180
+ if (isArray(content) && content.length > 0) {
10181
+ return /*#__PURE__*/ jsx(Icon, {
10182
+ icon: "gen3:checked-filled",
10183
+ height: 22,
10184
+ width: 22,
10185
+ className: "text-utility-success"
10186
+ });
10187
+ }
10188
+ return /*#__PURE__*/ jsx(Icon, {
10189
+ icon: "gen3:cancel-filled",
10190
+ height: 22,
10191
+ width: 22,
10192
+ className: "text-utility-error"
10193
+ });
10194
+ };
10122
10195
  // TODO Fix below
10123
10196
  // eslint-disable-next-line react/prop-types
10124
10197
  const DiscoveryRenderTagsCell = ({ value })=>{
@@ -10149,6 +10222,7 @@ const DiscoveryRenderTagsCell = ({ value })=>{
10149
10222
  const Gen3DiscoveryStandardCellRenderers = {
10150
10223
  array: {
10151
10224
  NegativePositive: RenderArrayCellNegativePositive$1,
10225
+ HasData: RenderIfArrayHasData,
10152
10226
  default: RenderArrayCell$1
10153
10227
  },
10154
10228
  string: {
@@ -12598,10 +12672,22 @@ const EmptyData = {};
12598
12672
  const isXl = useMediaQuery('(min-width: 1600px)');
12599
12673
  const [accessLevel, setAccessLevel] = useState(Accessibility.ALL);
12600
12674
  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;
12675
+ const defaultDropdowns = useMemo(()=>dropdowns ?? {}, [
12676
+ dropdowns
12677
+ ]);
12678
+ const defaultButtons = useMemo(()=>buttons ?? [], [
12679
+ buttons
12680
+ ]);
12681
+ const numCols = useMemo(()=>{
12682
+ if (isSm) return 1;
12683
+ if (isMd) return 2;
12684
+ if (isXl) return 4;
12685
+ return 3;
12686
+ }, [
12687
+ isSm,
12688
+ isMd,
12689
+ isXl
12690
+ ]);
12605
12691
  const index = guppyConfig.dataType;
12606
12692
  const fields = useMemo(()=>getAllFieldsFromFilterConfigs(filters?.tabs ?? []), [
12607
12693
  filters?.tabs
@@ -12615,14 +12701,20 @@ const EmptyData = {};
12615
12701
  filters: cohortFilters,
12616
12702
  accessibility: accessLevel
12617
12703
  });
12618
- const { data: chartData, isSuccess: isChartSuccess, isFetching: isChartFetching, isError: isChartError } = useGetAggsNoFilterSelfQuery({
12619
- type: index,
12620
- fields: [
12704
+ const chartKeys = useDeepCompareMemo(()=>[
12621
12705
  ...Object.keys(chartsSection?.charts ?? {}),
12622
12706
  ...Object.keys(charts)
12623
- ],
12707
+ ], [
12708
+ chartsSection?.charts,
12709
+ charts
12710
+ ]);
12711
+ const { data: chartData, isSuccess: isChartSuccess, isFetching: isChartFetching, isError: isChartError } = useGetAggsNoFilterSelfQuery({
12712
+ type: index,
12713
+ fields: chartKeys,
12624
12714
  filters: cohortFilters,
12625
12715
  accessibility: accessLevel
12716
+ }, {
12717
+ skip: chartKeys.length === 0
12626
12718
  });
12627
12719
  const getEnumFacetData = useDeepCompareCallback((field)=>{
12628
12720
  let filters = undefined;
@@ -12645,7 +12737,7 @@ const EmptyData = {};
12645
12737
  isSuccess: isSuccess
12646
12738
  };
12647
12739
  }, [
12648
- cohortFilters,
12740
+ cohortFilters.root,
12649
12741
  data,
12650
12742
  isSuccess
12651
12743
  ]);
@@ -12794,8 +12886,8 @@ const EmptyData = {};
12794
12886
  className: "flex justify-between mb-2 ml-2",
12795
12887
  children: [
12796
12888
  /*#__PURE__*/ jsx(DownloadsPanel, {
12797
- dropdowns: dropdowns ?? {},
12798
- buttons: buttons ?? [],
12889
+ dropdowns: defaultDropdowns,
12890
+ buttons: defaultButtons,
12799
12891
  loginForDownload: loginForDownload,
12800
12892
  index: index,
12801
12893
  totalCount: counts ?? 0,
@@ -12814,7 +12906,8 @@ const EmptyData = {};
12814
12906
  ...chartsSection,
12815
12907
  charts: summaryCharts
12816
12908
  },
12817
- data: chartData ?? EmptyData
12909
+ data: chartData ?? EmptyData,
12910
+ isSuccess: isChartSuccess
12818
12911
  }) : /*#__PURE__*/ jsx(Charts, {
12819
12912
  charts: summaryCharts,
12820
12913
  data: chartData ?? EmptyData,
@@ -12868,6 +12961,9 @@ const TabsLayoutToComponentProp = (tabsLayout)=>{
12868
12961
  const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = 'left' })=>{
12869
12962
  const dispatch = useCoreDispatch();
12870
12963
  dispatch(setSharedFilters(sharedFiltersMap ?? {}));
12964
+ const configuration = useDeepCompareMemo(()=>explorerConfig, [
12965
+ explorerConfig
12966
+ ]);
12871
12967
  return /*#__PURE__*/ jsx("div", {
12872
12968
  className: "w-full",
12873
12969
  children: /*#__PURE__*/ jsxs(Tabs, {
@@ -12878,17 +12974,24 @@ const CohortBuilder = ({ explorerConfig, sharedFiltersMap = null, tabsLayout = '
12878
12974
  /*#__PURE__*/ jsx(Tabs.List, {
12879
12975
  className: "w-full",
12880
12976
  justify: TabsLayoutToComponentProp(tabsLayout),
12881
- children: explorerConfig.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Tab, {
12977
+ children: configuration.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Tab, {
12882
12978
  value: panelConfig.tabTitle,
12883
12979
  children: panelConfig.tabTitle
12884
12980
  }, `${panelConfig.tabTitle}-tabList`))
12885
12981
  }),
12886
- explorerConfig.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Panel, {
12982
+ configuration.map((panelConfig)=>/*#__PURE__*/ jsx(Tabs.Panel, {
12887
12983
  value: panelConfig.tabTitle,
12888
- children: /*#__PURE__*/ createElement(CohortPanel, {
12889
- ...panelConfig,
12890
- key: `${panelConfig.tabTitle}-CohortPanel`
12891
- })
12984
+ children: /*#__PURE__*/ jsx(CohortPanel, {
12985
+ guppyConfig: panelConfig.guppyConfig,
12986
+ chartsSection: panelConfig?.chartsSection,
12987
+ filters: panelConfig.filters,
12988
+ tabTitle: panelConfig.tabTitle,
12989
+ table: panelConfig.table,
12990
+ dropdowns: panelConfig.dropdowns,
12991
+ buttons: panelConfig.buttons,
12992
+ loginForDownload: panelConfig.loginForDownload,
12993
+ sharedFiltersMap: panelConfig.sharedFiltersMap
12994
+ }, `${panelConfig.tabTitle}-CohortPanel`)
12892
12995
  }, `${panelConfig.tabTitle}-tabPanel`))
12893
12996
  ]
12894
12997
  })
@@ -14003,47 +14106,25 @@ const Workspace = ({ config })=>{
14003
14106
  };
14004
14107
 
14005
14108
  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
- ]
14109
+ return /*#__PURE__*/ jsx(Spoiler, {
14110
+ maxHeight: 80,
14111
+ showLabel: /*#__PURE__*/ jsxs("span", {
14112
+ children: [
14113
+ "Extend Text ",
14114
+ /*#__PURE__*/ jsx(MdKeyboardArrowDown, {
14115
+ className: "inline"
14044
14116
  })
14045
- })
14046
- ]
14117
+ ]
14118
+ }),
14119
+ hideLabel: /*#__PURE__*/ jsxs("span", {
14120
+ children: [
14121
+ "Collapse Text ",
14122
+ /*#__PURE__*/ jsx(MdKeyboardArrowUp, {
14123
+ className: "inline"
14124
+ })
14125
+ ]
14126
+ }),
14127
+ children: description
14047
14128
  });
14048
14129
  };
14049
14130
 
@@ -14051,20 +14132,22 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
14051
14132
  return /*#__PURE__*/ jsxs(Stack, {
14052
14133
  align: "stretch",
14053
14134
  justify: "space-between",
14054
- className: "rounded-sm rounded-t-md bg-base-max p-0",
14135
+ className: "rounded-sm rounded-t-md bg-base-max p-0 h-full",
14055
14136
  children: [
14056
14137
  /*#__PURE__*/ jsxs("div", {
14057
- className: "h-full",
14138
+ className: "relative",
14058
14139
  children: [
14059
14140
  /*#__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"
14141
+ className: "p-0 rounded-sm h-[200px] h-max-1/2 flex justify-center items-center relative overflow-hidden",
14142
+ children: /*#__PURE__*/ jsx("div", {
14143
+ children: /*#__PURE__*/ jsx(Image$1, {
14144
+ component: Image,
14145
+ src: `${image}`,
14146
+ alt: "",
14147
+ radius: "md",
14148
+ width: 500,
14149
+ height: 500
14150
+ })
14068
14151
  })
14069
14152
  }),
14070
14153
  /*#__PURE__*/ jsxs("div", {
@@ -14075,7 +14158,7 @@ const AnalysisCard = ({ title, description, type, icon, image, hasDemo, loginReq
14075
14158
  children: /*#__PURE__*/ jsx(Image$1, {
14076
14159
  component: Image,
14077
14160
  src: `${icon}`,
14078
- alt: `${title} logo`,
14161
+ alt: "",
14079
14162
  width: 40,
14080
14163
  height: 40,
14081
14164
  radius: "lg"
@@ -17119,7 +17202,7 @@ const registerCohortDiscoveryApp = ()=>createGen3AppWithOwnStore({
17119
17202
  App: CohortDiscovery,
17120
17203
  id: AppId$1,
17121
17204
  name: _APP_NAME$2,
17122
- version: 'v1.0.0',
17205
+ version: _APP_VERSION$1,
17123
17206
  requiredEntityTypes: [],
17124
17207
  store: AppStore,
17125
17208
  context: AppContext
@@ -19311,45 +19394,44 @@ const registerMetadataSchemaApp = ()=>createGen3App({
19311
19394
  requiredEntityTypes: []
19312
19395
  });
19313
19396
 
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 })=>{
19397
+ const ADDITIONAL_DOWNLOAD_MESSAGE = 'A previous download is being processed. Additional downloads may be started.';
19398
+ const DropdownWithIcon = ({ disableTargetWidth, LeftSection, RightSection = /*#__PURE__*/ jsx("div", {
19399
+ className: "border-l pl-1 -mr-2",
19400
+ children: /*#__PURE__*/ jsx(IoMdArrowDropdown, {
19401
+ size: "1.25em",
19402
+ "aria-hidden": "true",
19403
+ "data-testid": "dropdown-icon"
19404
+ })
19405
+ }), TargetButtonChildren, targetButtonDisabled, dropdownElements, menuLabelText, menuLabelCustomClass, customPosition, fullHeight, zIndex = 900, customTargetButtonDataTestId = undefined, targetButtonTooltip = undefined, buttonAriaLabel = undefined, closeOnItemClick = true })=>{
19406
+ const targetRef = useRef(null);
19319
19407
  return /*#__PURE__*/ jsxs(Menu, {
19320
- width: disableTargetWidth ?? 'target',
19408
+ width: !disableTargetWidth ? 'target' : null,
19321
19409
  ...customPosition && {
19322
19410
  position: customPosition
19323
19411
  },
19324
- "data-testid": customDataTestId ?? 'menu-elem',
19325
19412
  zIndex: zIndex,
19413
+ closeOnItemClick: closeOnItemClick,
19326
19414
  children: [
19327
19415
  /*#__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
- })
19416
+ children: /*#__PURE__*/ jsx(Tooltip, {
19417
+ label: targetButtonTooltip,
19418
+ disabled: !targetButtonTooltip,
19419
+ children: /*#__PURE__*/ jsx(Button, {
19420
+ variant: "outline",
19421
+ color: "primary",
19422
+ className: `flex items-center bg-base-max border-primary data-disabled:opacity-50 data-disabled:bg-base-max data-disabled:text-primary ${focusStyles}`,
19423
+ ...LeftSection && {
19424
+ leftSection: LeftSection
19425
+ },
19426
+ rightSection: RightSection,
19427
+ disabled: targetButtonDisabled,
19428
+ classNames: {
19429
+ root: `${fullHeight ? 'h-full' : undefined}`
19430
+ },
19431
+ ref: targetRef,
19432
+ "aria-label": buttonAriaLabel,
19433
+ "data-testid": customTargetButtonDataTestId ?? 'menu-elem',
19434
+ children: TargetButtonChildren
19353
19435
  })
19354
19436
  })
19355
19437
  }),
@@ -19357,7 +19439,7 @@ const DropdownWithIcon = ({ disableTargetWidth, LeftIcon, RightIcon = /*#__PURE_
19357
19439
  "data-testid": "dropdown-menu-options",
19358
19440
  className: "border-1 border-secondary",
19359
19441
  children: [
19360
- menuLabelText && /*#__PURE__*/ jsxs(React__default.Fragment, {
19442
+ menuLabelText && /*#__PURE__*/ jsxs(Fragment, {
19361
19443
  children: [
19362
19444
  /*#__PURE__*/ jsx(Menu.Label, {
19363
19445
  className: menuLabelCustomClass ?? 'font-bold',
@@ -19367,15 +19449,37 @@ const DropdownWithIcon = ({ disableTargetWidth, LeftIcon, RightIcon = /*#__PURE_
19367
19449
  /*#__PURE__*/ jsx(Menu.Divider, {})
19368
19450
  ]
19369
19451
  }),
19370
- dropdownElements?.map(({ title, onClick, icon, disabled }, idx)=>/*#__PURE__*/ jsx(Menu.Item, {
19452
+ dropdownElements.map(({ title, onClick, icon, disabled, isLoading, loadingTooltip }, idx)=>{
19453
+ const menuItem = /*#__PURE__*/ jsx(Menu.Item, {
19371
19454
  onClick: ()=>{
19372
- if (onClick) onClick();
19455
+ if (onClick) {
19456
+ onClick();
19457
+ }
19458
+ // This is done inorder to set the last focused element as the menu target element
19459
+ // This is done to return focus to the target element if the modal is closed with ESC
19460
+ if (targetRef?.current) {
19461
+ targetRef?.current?.focus();
19462
+ }
19373
19463
  },
19374
19464
  "data-testid": `${title}-${idx}`,
19375
19465
  leftSection: icon && icon,
19376
19466
  disabled: disabled,
19377
19467
  children: title
19378
- }, `${title}-${idx}`))
19468
+ }, `${title}-${idx}`);
19469
+ if (isLoading) {
19470
+ return /*#__PURE__*/ jsx(Tooltip, {
19471
+ label: loadingTooltip || ADDITIONAL_DOWNLOAD_MESSAGE,
19472
+ position: "right",
19473
+ withArrow: true,
19474
+ multiline: true,
19475
+ w: 400,
19476
+ children: /*#__PURE__*/ jsx("div", {
19477
+ children: menuItem
19478
+ })
19479
+ }, `${title}-${idx}`);
19480
+ }
19481
+ return menuItem;
19482
+ })
19379
19483
  ]
19380
19484
  })
19381
19485
  ]