@gen3/frontend 0.11.1 → 0.11.11

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 +92 -30
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/dts/components/Buttons/ActionButton.js +1 -1
  4. package/dist/dts/components/Buttons/ActionButton.js.map +1 -1
  5. package/dist/dts/components/Buttons/DownloadButtons/JSONObjectDownloadButton.js +1 -1
  6. package/dist/dts/components/Buttons/DownloadButtons/JSONObjectDownloadButton.js.map +1 -1
  7. package/dist/dts/components/Buttons/DropdownButtons/DropdownButton.js +1 -1
  8. package/dist/dts/components/Buttons/DropdownButtons/DropdownButton.js.map +1 -1
  9. package/dist/dts/components/Buttons/UploadJSONButton.js +1 -1
  10. package/dist/dts/components/Buttons/UploadJSONButton.js.map +1 -1
  11. package/dist/dts/components/Providers/Gen3Provider.js +1 -1
  12. package/dist/dts/components/Providers/Gen3Provider.js.map +1 -1
  13. package/dist/dts/components/charts/Charts.js +1 -1
  14. package/dist/dts/components/charts/Charts.js.map +1 -1
  15. package/dist/dts/components/charts/echarts/HorizontalBarChart.d.ts +1 -1
  16. package/dist/dts/components/charts/echarts/HorizontalBarChart.d.ts.map +1 -1
  17. package/dist/dts/components/charts/echarts/HorizontalBarChart.js +8 -4
  18. package/dist/dts/components/charts/echarts/HorizontalBarChart.js.map +1 -1
  19. package/dist/dts/components/counts/CountsValue.d.ts.map +1 -1
  20. package/dist/dts/components/counts/CountsValue.js +2 -2
  21. package/dist/dts/components/counts/CountsValue.js.map +1 -1
  22. package/dist/dts/components/facets/FacetControlsHeader.js +1 -1
  23. package/dist/dts/components/facets/FacetControlsHeader.js.map +1 -1
  24. package/dist/dts/components/facets/FacetEnumList.js +1 -1
  25. package/dist/dts/components/facets/FacetEnumList.js.map +1 -1
  26. package/dist/dts/components/facets/FacetTabs.js +1 -1
  27. package/dist/dts/components/facets/FacetTabs.js.map +1 -1
  28. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts +14 -14
  29. package/dist/dts/features/Analysis/AnalysisCardCompact.stories.d.ts.map +1 -1
  30. package/dist/dts/features/CohortBuilder/CohortSelector.js +1 -1
  31. package/dist/dts/features/CohortBuilder/CohortSelector.js.map +1 -1
  32. package/dist/dts/features/CohortBuilder/DownloadsPanel.js +1 -1
  33. package/dist/dts/features/CohortBuilder/DownloadsPanel.js.map +1 -1
  34. package/dist/dts/features/CohortBuilder/ExplorerTable/SubTables/ExpandingSubtable.js +1 -1
  35. package/dist/dts/features/CohortBuilder/ExplorerTable/SubTables/ExpandingSubtable.js.map +1 -1
  36. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.js +1 -1
  37. package/dist/dts/features/CohortBuilder/Panels/AccordianPanel.js.map +1 -1
  38. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.js +1 -1
  39. package/dist/dts/features/CohortBuilder/Panels/DropdownPanel.js.map +1 -1
  40. package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionSection.js +1 -1
  41. package/dist/dts/features/CohortBuilder/QueryExpression/QueryExpressionSection.js.map +1 -1
  42. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.d.ts.map +1 -1
  43. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js +16 -9
  44. package/dist/dts/features/CohortBuilder/TabbedCohortBuilder.js.map +1 -1
  45. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js +1 -1
  46. package/dist/dts/features/CohortDiscovery/CohortManagment/CohortManager.js.map +1 -1
  47. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js +1 -1
  48. package/dist/dts/features/CohortDiscovery/SavedCohorts/SavedCohortsTable.js.map +1 -1
  49. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js +1 -1
  50. package/dist/dts/features/DataLibrary/DatasetAccordionControl.js.map +1 -1
  51. package/dist/dts/features/DataLibrary/SearchAndActions.js +1 -1
  52. package/dist/dts/features/DataLibrary/SearchAndActions.js.map +1 -1
  53. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js +1 -1
  54. package/dist/dts/features/DataLibrary/modals/SelectedItemsModal.js.map +1 -1
  55. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js +1 -1
  56. package/dist/dts/features/DataLibrary/tables/SelectedItemsTable.js.map +1 -1
  57. package/dist/dts/features/Dictionary/CategoryHeader.js +1 -1
  58. package/dist/dts/features/Dictionary/CategoryHeader.js.map +1 -1
  59. package/dist/dts/features/Discovery/types.d.ts +1 -0
  60. package/dist/dts/features/Discovery/types.d.ts.map +1 -1
  61. package/dist/dts/features/Discovery/types.js.map +1 -1
  62. package/dist/dts/features/Navigation/NavigationBarButton.d.ts.map +1 -1
  63. package/dist/dts/features/Navigation/NavigationBarButton.js +3 -3
  64. package/dist/dts/features/Navigation/NavigationBarButton.js.map +1 -1
  65. package/dist/dts/features/Navigation/TopBar/AccountButton.d.ts.map +1 -1
  66. package/dist/dts/features/Navigation/TopBar/AccountButton.js.map +1 -1
  67. package/dist/dts/features/Navigation/TopBar/IconButton.js +1 -1
  68. package/dist/dts/features/Navigation/TopBar/IconButton.js.map +1 -1
  69. package/dist/dts/features/Workspace/NotebookCard.js +1 -1
  70. package/dist/dts/features/Workspace/NotebookCard.js.map +1 -1
  71. package/dist/dts/pages/TabbedCohortBuilder/TabbedCohortBuilderPage.d.ts.map +1 -1
  72. package/dist/dts/pages/TabbedCohortBuilder/TabbedCohortBuilderPage.js +4 -2
  73. package/dist/dts/pages/TabbedCohortBuilder/TabbedCohortBuilderPage.js.map +1 -1
  74. package/dist/dts/utils/strings.d.ts +1 -0
  75. package/dist/dts/utils/strings.d.ts.map +1 -1
  76. package/dist/dts/utils/strings.js +29 -0
  77. package/dist/dts/utils/strings.js.map +1 -1
  78. package/dist/esm/index.js +92 -31
  79. package/dist/esm/index.js.map +1 -1
  80. package/dist/index.d.ts +3 -1
  81. package/dist/tsconfig.tsbuildinfo +1 -1
  82. package/package.json +5 -5
package/dist/cjs/index.js CHANGED
@@ -23,7 +23,7 @@ var reactCookie = require('react-cookie');
23
23
  var FileSaver = require('file-saver');
24
24
  var hooks = require('@mantine/hooks');
25
25
  var defaultComposer = require('default-composer');
26
- var react = require('@iconify/react');
26
+ var react = require('@iconify-icon/react');
27
27
  var echarts = require('echarts');
28
28
  var victory = require('victory');
29
29
  var fa = require('react-icons/fa');
@@ -629,6 +629,27 @@ const toDisplayName = (field)=>{
629
629
  if (!fieldName) return 'NotSet';
630
630
  return fieldName.split('_').map((w)=>lodash.capitalize(w)).join(' ');
631
631
  };
632
+ /*
633
+ Function to convert counts to a string with units
634
+ For example: count = 100 units = 'cases' => '100 Cases'
635
+ Function should handle pluralization
636
+ */ const toCountsString = (counts, units)=>{
637
+ if (!counts) return `No ${lodash.capitalize(pluralize(units))}`;
638
+ // return a string with counts and units handling pluralization
639
+ const unitDisplay = counts === 1 ? units : pluralize(units);
640
+ return `${counts.toLocaleString()} ${lodash.capitalize(unitDisplay)}`;
641
+ };
642
+ // Helper function to handle basic pluralization
643
+ const pluralize = (word)=>{
644
+ // Handle special cases
645
+ if (word.endsWith('y')) {
646
+ return word.slice(0, -1) + 'ies';
647
+ } else if (word.endsWith('s') || word.endsWith('x') || word.endsWith('z') || word.endsWith('ch') || word.endsWith('sh')) {
648
+ return word + 'es';
649
+ } else {
650
+ return word + 's';
651
+ }
652
+ };
632
653
 
633
654
  const isArrayOfString = (value)=>{
634
655
  return Array.isArray(value) && value.every((element)=>typeof element === 'string');
@@ -2496,10 +2517,11 @@ const HorizontalBarChart = ({ data, valueType, total, showLegendInChart = true }
2496
2517
  const chartDefinition = React.useMemo(()=>{
2497
2518
  return {
2498
2519
  tooltip: {
2499
- trigger: 'axis',
2500
- axisPointer: {
2501
- // Use axis to trigger tooltip
2502
- type: 'shadow'
2520
+ trigger: 'item',
2521
+ formatter: function(param) {
2522
+ const p = lodash.isArray(param) && param.length > 0 ? param[0] : param;
2523
+ const colorSquare = `<span style="display:inline-block; width:10px; height:10px; background-color:${p.color}; margin-right:5px;"></span>`;
2524
+ return `${colorSquare}${p.seriesName}: <b>${p.value}</b>`;
2503
2525
  }
2504
2526
  },
2505
2527
  legend: {
@@ -4842,7 +4864,7 @@ const FacetGroup = ({ facets, children })=>{
4842
4864
  const availableFields = facets.map((f)=>f.field);
4843
4865
  useScrollToHash(availableFields, false);
4844
4866
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
4845
- className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 w-content gap-4 my-4 ml-2 w-full",
4867
+ className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 3xl:grid-cols-5 w-content gap-4 ml-2 w-full",
4846
4868
  "data-testid": "title-cohort-builder-facet-groups",
4847
4869
  children: children
4848
4870
  });
@@ -5708,11 +5730,10 @@ const NavigationLogo = ({ src, title, description, width, height, divider = fals
5708
5730
  * @param iconHeight - the height of the icon
5709
5731
  * @param classNames - the class names to use for root, label, icon/tooltip and arrow'
5710
5732
  * @param noBasePath - set to true to avoid prepending a basePath to the link
5711
- */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '27px', classNames = {}, noBasePath = false })=>{
5733
+ */ const NavigationBarButton = ({ tooltip, icon, href, name, iconHeight = '32px', classNames = {}, noBasePath = false })=>{
5712
5734
  const classNamesDefaults = {
5713
- root: 'flex flex-col flex-nowrap px-3 py-2 pt-4 items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100',
5735
+ root: 'flex flex-col flex-nowrap px-3 py-2 pt-4 justify-between items-center align-center text-primary hover:text-accent opacity-80 hover:opacity-100',
5714
5736
  label: 'pt-1.5 body-typo font-heading text-sm text-nowrap',
5715
- icon: 'mt-0.5 ml-1',
5716
5737
  ...TooltipStyle
5717
5738
  };
5718
5739
  const mergedClassnames = mergeDefaultTailwindClassnames(classNamesDefaults, classNames);
@@ -11614,7 +11635,7 @@ const CountsValue = ({ label, isSuccess, counts })=>{
11614
11635
  p: "xs",
11615
11636
  withBorder: true,
11616
11637
  className: "bg-primary text-primary-contrast font-heading text-md font-semibold",
11617
- children: `${counts?.toLocaleString() ?? '...'} ${label}`
11638
+ children: toCountsString(counts, label)
11618
11639
  })
11619
11640
  ]
11620
11641
  });
@@ -12729,6 +12750,11 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12729
12750
  filters: cohortFilters,
12730
12751
  accessibility: accessLevel
12731
12752
  });
12753
+ const { data: counts, isSuccess: isCountSuccess, isError } = core.useGetCountsQuery({
12754
+ type: index,
12755
+ filters: cohortFilters,
12756
+ accessibility: accessLevel
12757
+ });
12732
12758
  const [facetDefinitions, setFacetDefinitions] = React.useState({});
12733
12759
  React.useEffect(()=>{
12734
12760
  // Check if the router initiated the change
@@ -12866,25 +12892,42 @@ const TabbedCohortBuilder = ({ index, tabsConfiguration })=>{
12866
12892
  getRangeFacetData,
12867
12893
  index
12868
12894
  ]);
12869
- return /*#__PURE__*/ jsxRuntime.jsx(FacetTabs, {
12870
- activeTab: activeTab,
12871
- setActiveTab: setActiveTab,
12872
- facetDefinitions: facetDefinitions,
12873
- tabsConfig: tabsConfig,
12874
- usedFacets: cohortBuilderFilters,
12875
- hooks: facetDataHooks,
12876
- customFacetHooks: {
12877
- useCustomFacets,
12878
- useAvailableCustomFacets: (usedFacets, onlyFiltersWithValues, queryOptions)=>({
12879
- data: {},
12880
- isSuccess: true
12881
- }),
12882
- useAddCustomFilter: ()=>(filter)=>{},
12883
- useRemoveCustomFilter: ()=>(filter)=>{}
12895
+ return /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
12896
+ gap: "xs",
12897
+ align: "stretch",
12898
+ classNames: {
12899
+ root: 'w-full'
12884
12900
  },
12885
- getFacetLabel: ()=>'Cases',
12886
- cardScrollMargin: calculateStickyHeaderHeight(),
12887
- useFieldNameToTitle: useFieldNameToTitle
12901
+ children: [
12902
+ /*#__PURE__*/ jsxRuntime.jsx(core$1.Group, {
12903
+ justify: "flex-end",
12904
+ children: /*#__PURE__*/ jsxRuntime.jsx(CountsValue, {
12905
+ label: index,
12906
+ counts: counts,
12907
+ isSuccess: isCountSuccess
12908
+ })
12909
+ }),
12910
+ /*#__PURE__*/ jsxRuntime.jsx(FacetTabs, {
12911
+ activeTab: activeTab,
12912
+ setActiveTab: setActiveTab,
12913
+ facetDefinitions: facetDefinitions,
12914
+ tabsConfig: tabsConfig,
12915
+ usedFacets: cohortBuilderFilters,
12916
+ hooks: facetDataHooks,
12917
+ customFacetHooks: {
12918
+ useCustomFacets,
12919
+ useAvailableCustomFacets: (usedFacets, onlyFiltersWithValues, queryOptions)=>({
12920
+ data: {},
12921
+ isSuccess: true
12922
+ }),
12923
+ useAddCustomFilter: ()=>(filter)=>{},
12924
+ useRemoveCustomFilter: ()=>(filter)=>{}
12925
+ },
12926
+ getFacetLabel: ()=>'Cases',
12927
+ cardScrollMargin: calculateStickyHeaderHeight(),
12928
+ useFieldNameToTitle: useFieldNameToTitle
12929
+ })
12930
+ ]
12888
12931
  });
12889
12932
  };
12890
12933
 
@@ -25081,8 +25124,26 @@ const TabbedCohortBuilderPage = ({ headerProps, footerProps, configuration })=>{
25081
25124
  content: 'Tabbed Cohort Builder Page',
25082
25125
  key: 'gen3-tabbed-cohort-builder-page'
25083
25126
  },
25084
- children: /*#__PURE__*/ jsxRuntime.jsx(TabbedCohortBuilder, {
25085
- ...configuration
25127
+ children: /*#__PURE__*/ jsxRuntime.jsxs(core$1.Stack, {
25128
+ align: "stretch",
25129
+ classNames: {
25130
+ root: 'w-full'
25131
+ },
25132
+ children: [
25133
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
25134
+ className: "w-full flex-col flex gap-4 fixed bg-white z-10",
25135
+ children: /*#__PURE__*/ jsxRuntime.jsx(CohortManager$1, {
25136
+ index: configuration.index
25137
+ })
25138
+ }),
25139
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
25140
+ className: "w-full mt-40 mr-4",
25141
+ children: /*#__PURE__*/ jsxRuntime.jsx(TabbedCohortBuilder, {
25142
+ ...configuration,
25143
+ index: configuration.index
25144
+ })
25145
+ })
25146
+ ]
25086
25147
  })
25087
25148
  });
25088
25149
  };
@@ -25722,6 +25783,7 @@ exports.sessionLogout = sessionLogout;
25722
25783
  exports.sessionToken = sessionToken;
25723
25784
  exports.staticNotebookAPI = staticNotebookAPI;
25724
25785
  exports.stripTrailingSlash = stripTrailingSlash;
25786
+ exports.toCountsString = toCountsString;
25725
25787
  exports.toDisplayName = toDisplayName;
25726
25788
  exports.truncateString = truncateString;
25727
25789
  exports.unixTimeToString = unixTimeToString;