@haniffalab/cherita-react 1.4.1-dev.2025-10-22.61540191 → 1.4.1-dev.2025-10-23.3179e534

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 (103) hide show
  1. package/dist/cjs/components/controls/Controls.js +38 -30
  2. package/dist/cjs/components/dotplot/Dotplot.js +40 -33
  3. package/dist/cjs/components/dotplot/DotplotControls.js +103 -83
  4. package/dist/cjs/components/full-page/FullPage.js +92 -69
  5. package/dist/cjs/components/full-page/PlotAlert.js +25 -16
  6. package/dist/cjs/components/full-page/PlotTypeSelector.js +43 -36
  7. package/dist/cjs/components/heatmap/Heatmap.js +40 -33
  8. package/dist/cjs/components/heatmap/HeatmapControls.js +6 -3
  9. package/dist/cjs/components/icons/DotPlotIcon.js +16 -10
  10. package/dist/cjs/components/icons/HeatmapIcon.js +17 -11
  11. package/dist/cjs/components/icons/MatrixPlotIcon.1.js +22 -16
  12. package/dist/cjs/components/icons/MatrixPlotIcon.js +22 -16
  13. package/dist/cjs/components/icons/ScatterplotIcon.1.js +21 -15
  14. package/dist/cjs/components/icons/ScatterplotIcon.js +21 -15
  15. package/dist/cjs/components/icons/ViolinPlotIcon.js +22 -14
  16. package/dist/cjs/components/matrixplot/Matrixplot.js +40 -33
  17. package/dist/cjs/components/matrixplot/MatrixplotControls.js +8 -5
  18. package/dist/cjs/components/obs-list/ObsItem.js +238 -190
  19. package/dist/cjs/components/obs-list/ObsList.js +106 -87
  20. package/dist/cjs/components/obs-list/ObsToolbar.js +2 -3
  21. package/dist/cjs/components/obsm-list/ObsmList.js +47 -32
  22. package/dist/cjs/components/offcanvas/index.js +61 -31
  23. package/dist/cjs/components/pseudospatial/Pseudospatial.js +46 -36
  24. package/dist/cjs/components/pseudospatial/PseudospatialToolbar.js +98 -68
  25. package/dist/cjs/components/scatterplot/Scatterplot.js +87 -65
  26. package/dist/cjs/components/scatterplot/ScatterplotControls.js +35 -27
  27. package/dist/cjs/components/scatterplot/SpatialControls.js +134 -107
  28. package/dist/cjs/components/scatterplot/Toolbox.js +41 -30
  29. package/dist/cjs/components/search-bar/SearchBar.js +157 -110
  30. package/dist/cjs/components/search-bar/SearchInfo.js +73 -47
  31. package/dist/cjs/components/search-bar/SearchResults.js +93 -71
  32. package/dist/cjs/components/toolbar/Toolbar.js +43 -34
  33. package/dist/cjs/components/var-list/VarItem.js +106 -79
  34. package/dist/cjs/components/var-list/VarList.js +67 -53
  35. package/dist/cjs/components/var-list/VarListToolbar.js +56 -51
  36. package/dist/cjs/components/var-list/VarSet.js +115 -97
  37. package/dist/cjs/components/violin/Violin.js +77 -58
  38. package/dist/cjs/components/violin/ViolinControls.js +8 -5
  39. package/dist/cjs/context/DatasetContext.js +20 -13
  40. package/dist/cjs/context/FilterContext.js +9 -7
  41. package/dist/cjs/context/SettingsContext.js +11 -9
  42. package/dist/cjs/context/ZarrDataContext.js +6 -5
  43. package/dist/cjs/utils/Histogram.js +35 -33
  44. package/dist/cjs/utils/ImageViewer.js +9 -6
  45. package/dist/cjs/utils/Legend.js +36 -29
  46. package/dist/cjs/utils/LoadingIndicators.js +14 -12
  47. package/dist/cjs/utils/Skeleton.js +10 -10
  48. package/dist/cjs/utils/StyledTooltip.js +7 -2
  49. package/dist/cjs/utils/VirtualizedList.js +32 -25
  50. package/dist/cjs/utils/errors.js +1 -1
  51. package/dist/css/cherita.css +6 -1
  52. package/dist/css/cherita.css.map +1 -1
  53. package/dist/esm/components/controls/Controls.js +38 -30
  54. package/dist/esm/components/dotplot/Dotplot.js +40 -33
  55. package/dist/esm/components/dotplot/DotplotControls.js +103 -82
  56. package/dist/esm/components/full-page/FullPage.js +92 -69
  57. package/dist/esm/components/full-page/PlotAlert.js +25 -16
  58. package/dist/esm/components/full-page/PlotTypeSelector.js +43 -36
  59. package/dist/esm/components/heatmap/Heatmap.js +40 -33
  60. package/dist/esm/components/heatmap/HeatmapControls.js +6 -2
  61. package/dist/esm/components/icons/DotPlotIcon.js +16 -10
  62. package/dist/esm/components/icons/HeatmapIcon.js +17 -11
  63. package/dist/esm/components/icons/MatrixPlotIcon.1.js +22 -16
  64. package/dist/esm/components/icons/MatrixPlotIcon.js +22 -16
  65. package/dist/esm/components/icons/ScatterplotIcon.1.js +21 -15
  66. package/dist/esm/components/icons/ScatterplotIcon.js +21 -15
  67. package/dist/esm/components/icons/ViolinPlotIcon.js +22 -14
  68. package/dist/esm/components/matrixplot/Matrixplot.js +40 -33
  69. package/dist/esm/components/matrixplot/MatrixplotControls.js +8 -4
  70. package/dist/esm/components/obs-list/ObsItem.js +237 -186
  71. package/dist/esm/components/obs-list/ObsList.js +106 -86
  72. package/dist/esm/components/obs-list/ObsToolbar.js +2 -2
  73. package/dist/esm/components/obsm-list/ObsmList.js +47 -31
  74. package/dist/esm/components/offcanvas/index.js +61 -31
  75. package/dist/esm/components/pseudospatial/Pseudospatial.js +46 -36
  76. package/dist/esm/components/pseudospatial/PseudospatialToolbar.js +98 -68
  77. package/dist/esm/components/scatterplot/Scatterplot.js +87 -64
  78. package/dist/esm/components/scatterplot/ScatterplotControls.js +35 -26
  79. package/dist/esm/components/scatterplot/SpatialControls.js +134 -106
  80. package/dist/esm/components/scatterplot/Toolbox.js +41 -29
  81. package/dist/esm/components/search-bar/SearchBar.js +157 -109
  82. package/dist/esm/components/search-bar/SearchInfo.js +73 -46
  83. package/dist/esm/components/search-bar/SearchResults.js +93 -70
  84. package/dist/esm/components/toolbar/Toolbar.js +43 -33
  85. package/dist/esm/components/var-list/VarItem.js +106 -78
  86. package/dist/esm/components/var-list/VarList.js +67 -52
  87. package/dist/esm/components/var-list/VarListToolbar.js +56 -50
  88. package/dist/esm/components/var-list/VarSet.js +115 -96
  89. package/dist/esm/components/violin/Violin.js +77 -58
  90. package/dist/esm/components/violin/ViolinControls.js +8 -4
  91. package/dist/esm/context/DatasetContext.js +20 -12
  92. package/dist/esm/context/FilterContext.js +9 -6
  93. package/dist/esm/context/SettingsContext.js +11 -8
  94. package/dist/esm/context/ZarrDataContext.js +6 -4
  95. package/dist/esm/utils/Histogram.js +35 -33
  96. package/dist/esm/utils/ImageViewer.js +9 -5
  97. package/dist/esm/utils/Legend.js +36 -28
  98. package/dist/esm/utils/LoadingIndicators.js +14 -11
  99. package/dist/esm/utils/Skeleton.js +10 -9
  100. package/dist/esm/utils/StyledTooltip.js +7 -2
  101. package/dist/esm/utils/VirtualizedList.js +32 -24
  102. package/dist/esm/utils/errors.js +1 -1
  103. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import { useState } from "react";
2
2
  import { faCrosshairs, faDrawPolygon, faHand, faList, faMinus, faPen, faPlus, faSearch, faSliders, faTrash } from "@fortawesome/free-solid-svg-icons";
3
3
  import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
4
4
  import { JoinInner } from "@mui/icons-material";
@@ -12,6 +12,7 @@ import { OffcanvasControls } from "../offcanvas";
12
12
  import { ScatterplotControls } from "./ScatterplotControls";
13
13
  import { BREAKPOINTS } from "../../constants/constants";
14
14
  import { useSettings, useSettingsDispatch } from "../../context/SettingsContext";
15
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
15
16
  export function SpatialControls(_ref) {
16
17
  var _features$features;
17
18
  let {
@@ -63,109 +64,136 @@ export function SpatialControls(_ref) {
63
64
  features: []
64
65
  });
65
66
  };
66
- const polygonControls = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
67
- active: settings.sliceBy.polygons,
68
- title: "Filter data with polygons",
69
- onClick: () => {
70
- setMode(() => ViewMode);
71
- dispatch({
72
- type: "toggle.slice.polygons"
73
- });
74
- }
75
- }, /*#__PURE__*/React.createElement(JoinInner, null)), /*#__PURE__*/React.createElement(Button, {
76
- title: "Delete selected polygons",
77
- onClick: () => {
78
- const newFeatures = features.features.filter((_f, i) => !selectedFeatureIndexes.includes(i));
79
- setFeatures({
80
- type: "FeatureCollection",
81
- features: newFeatures
82
- });
83
- },
84
- disabled: !selectedFeatureIndexes.length
85
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
86
- icon: faTrash
87
- })));
88
- return /*#__PURE__*/React.createElement("div", {
89
- className: "cherita-spatial-controls"
90
- }, (showObsBtn || showVarsBtn) && /*#__PURE__*/React.createElement(ButtonGroup, {
91
- vertical: true,
92
- className: "w-100 mb-1"
93
- }, showObsBtn && /*#__PURE__*/React.createElement(OverlayTrigger, {
94
- placement: "right",
95
- overlay: /*#__PURE__*/React.createElement(Tooltip, {
96
- id: "tooltip-obs"
97
- }, "Browse categories")
98
- }, /*#__PURE__*/React.createElement(Button, {
99
- onClick: () => setShowObs(true)
100
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
101
- icon: faList
102
- }))), showVarsBtn && /*#__PURE__*/React.createElement(OverlayTrigger, {
103
- placement: "right",
104
- overlay: /*#__PURE__*/React.createElement(Tooltip, {
105
- id: "tooltip-vars"
106
- }, "Search features")
107
- }, /*#__PURE__*/React.createElement(Button, {
108
- onClick: () => setShowVars(true)
109
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
110
- icon: faSearch
111
- })))), /*#__PURE__*/React.createElement(ButtonGroup, {
112
- vertical: true,
113
- className: "w-100"
114
- }, /*#__PURE__*/React.createElement(Button, {
115
- onClick: () => setMode(() => ViewMode),
116
- title: "Set dragging mode",
117
- active: mode === ViewMode
118
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
119
- icon: faHand
120
- })), /*#__PURE__*/React.createElement(Button, {
121
- onClick: increaseZoom,
122
- title: "Increase zoom"
123
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
124
- icon: faPlus
125
- })), /*#__PURE__*/React.createElement(Button, {
126
- onClick: decreaseZoom,
127
- title: "Decrease zoom"
128
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
129
- icon: faMinus
130
- })), /*#__PURE__*/React.createElement("div", {
131
- className: "border-bottom"
132
- }), " ", /*#__PURE__*/React.createElement(Button, {
133
- onClick: resetBounds,
134
- title: "Reset zoom and center"
135
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
136
- icon: faCrosshairs
137
- })), /*#__PURE__*/React.createElement(Dropdown, {
138
- as: ButtonGroup,
139
- className: "caret-off",
140
- drop: "end",
141
- onSelect: onSelect
142
- }, /*#__PURE__*/React.createElement(Dropdown.Toggle, {
143
- id: "dropdown-autoclose-outside",
144
- className: "caret-off ".concat(mode === DrawPolygonByDraggingMode || mode === ModifyMode ? "active" : "")
145
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
146
- icon: faDrawPolygon
147
- })), /*#__PURE__*/React.createElement(Dropdown.Menu, null, /*#__PURE__*/React.createElement(Dropdown.Header, null, "Polygon tools"), /*#__PURE__*/React.createElement(Dropdown.Item, {
148
- eventKey: "DrawPolygonByDraggingMode"
149
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
150
- icon: faDrawPolygon,
151
- className: "nav-icon"
152
- }), "Draw a polygon"), /*#__PURE__*/React.createElement(Dropdown.Item, {
153
- eventKey: "ModifyMode"
154
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
155
- icon: faPen,
156
- className: "nav-icon"
157
- }), "Modify polygons"), /*#__PURE__*/React.createElement(Dropdown.Item, {
158
- onClick: deleteFeatures
159
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
160
- icon: faTrash,
161
- className: "nav-icon"
162
- }), "Delete polygons"))), !!(features !== null && features !== void 0 && (_features$features = features.features) !== null && _features$features !== void 0 && _features$features.length) && polygonControls, /*#__PURE__*/React.createElement(Button, {
163
- onClick: handleShowControls
164
- }, /*#__PURE__*/React.createElement(FontAwesomeIcon, {
165
- icon: faSliders
166
- }))), /*#__PURE__*/React.createElement(OffcanvasControls, {
167
- show: showControls,
168
- handleClose: handleCloseControls,
169
- Controls: ScatterplotControls
170
- }));
67
+ const polygonControls = /*#__PURE__*/_jsxs(_Fragment, {
68
+ children: [/*#__PURE__*/_jsx(Button, {
69
+ active: settings.sliceBy.polygons,
70
+ title: "Filter data with polygons",
71
+ onClick: () => {
72
+ setMode(() => ViewMode);
73
+ dispatch({
74
+ type: "toggle.slice.polygons"
75
+ });
76
+ },
77
+ children: /*#__PURE__*/_jsx(JoinInner, {})
78
+ }), /*#__PURE__*/_jsx(Button, {
79
+ title: "Delete selected polygons",
80
+ onClick: () => {
81
+ const newFeatures = features.features.filter((_f, i) => !selectedFeatureIndexes.includes(i));
82
+ setFeatures({
83
+ type: "FeatureCollection",
84
+ features: newFeatures
85
+ });
86
+ },
87
+ disabled: !selectedFeatureIndexes.length,
88
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
89
+ icon: faTrash
90
+ })
91
+ })]
92
+ });
93
+ return /*#__PURE__*/_jsxs("div", {
94
+ className: "cherita-spatial-controls",
95
+ children: [(showObsBtn || showVarsBtn) && /*#__PURE__*/_jsxs(ButtonGroup, {
96
+ vertical: true,
97
+ className: "w-100 mb-1",
98
+ children: [showObsBtn && /*#__PURE__*/_jsx(OverlayTrigger, {
99
+ placement: "right",
100
+ overlay: /*#__PURE__*/_jsx(Tooltip, {
101
+ id: "tooltip-obs",
102
+ children: "Browse categories"
103
+ }),
104
+ children: /*#__PURE__*/_jsx(Button, {
105
+ onClick: () => setShowObs(true),
106
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
107
+ icon: faList
108
+ })
109
+ })
110
+ }), showVarsBtn && /*#__PURE__*/_jsx(OverlayTrigger, {
111
+ placement: "right",
112
+ overlay: /*#__PURE__*/_jsx(Tooltip, {
113
+ id: "tooltip-vars",
114
+ children: "Search features"
115
+ }),
116
+ children: /*#__PURE__*/_jsx(Button, {
117
+ onClick: () => setShowVars(true),
118
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
119
+ icon: faSearch
120
+ })
121
+ })
122
+ })]
123
+ }), /*#__PURE__*/_jsxs(ButtonGroup, {
124
+ vertical: true,
125
+ className: "w-100",
126
+ children: [/*#__PURE__*/_jsx(Button, {
127
+ onClick: () => setMode(() => ViewMode),
128
+ title: "Set dragging mode",
129
+ active: mode === ViewMode,
130
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
131
+ icon: faHand
132
+ })
133
+ }), /*#__PURE__*/_jsx(Button, {
134
+ onClick: increaseZoom,
135
+ title: "Increase zoom",
136
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
137
+ icon: faPlus
138
+ })
139
+ }), /*#__PURE__*/_jsx(Button, {
140
+ onClick: decreaseZoom,
141
+ title: "Decrease zoom",
142
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
143
+ icon: faMinus
144
+ })
145
+ }), /*#__PURE__*/_jsx("div", {
146
+ className: "border-bottom"
147
+ }), " ", /*#__PURE__*/_jsx(Button, {
148
+ onClick: resetBounds,
149
+ title: "Reset zoom and center",
150
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
151
+ icon: faCrosshairs
152
+ })
153
+ }), /*#__PURE__*/_jsxs(Dropdown, {
154
+ as: ButtonGroup,
155
+ className: "caret-off",
156
+ drop: "end",
157
+ onSelect: onSelect,
158
+ children: [/*#__PURE__*/_jsx(Dropdown.Toggle, {
159
+ id: "dropdown-autoclose-outside",
160
+ className: "caret-off ".concat(mode === DrawPolygonByDraggingMode || mode === ModifyMode ? "active" : ""),
161
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
162
+ icon: faDrawPolygon
163
+ })
164
+ }), /*#__PURE__*/_jsxs(Dropdown.Menu, {
165
+ children: [/*#__PURE__*/_jsx(Dropdown.Header, {
166
+ children: "Polygon tools"
167
+ }), /*#__PURE__*/_jsxs(Dropdown.Item, {
168
+ eventKey: "DrawPolygonByDraggingMode",
169
+ children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
170
+ icon: faDrawPolygon,
171
+ className: "nav-icon"
172
+ }), "Draw a polygon"]
173
+ }), /*#__PURE__*/_jsxs(Dropdown.Item, {
174
+ eventKey: "ModifyMode",
175
+ children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
176
+ icon: faPen,
177
+ className: "nav-icon"
178
+ }), "Modify polygons"]
179
+ }), /*#__PURE__*/_jsxs(Dropdown.Item, {
180
+ onClick: deleteFeatures,
181
+ children: [/*#__PURE__*/_jsx(FontAwesomeIcon, {
182
+ icon: faTrash,
183
+ className: "nav-icon"
184
+ }), "Delete polygons"]
185
+ })]
186
+ })]
187
+ }), !!(features !== null && features !== void 0 && (_features$features = features.features) !== null && _features$features !== void 0 && _features$features.length) && polygonControls, /*#__PURE__*/_jsx(Button, {
188
+ onClick: handleShowControls,
189
+ children: /*#__PURE__*/_jsx(FontAwesomeIcon, {
190
+ icon: faSliders
191
+ })
192
+ })]
193
+ }), /*#__PURE__*/_jsx(OffcanvasControls, {
194
+ show: showControls,
195
+ handleClose: handleCloseControls,
196
+ Controls: ScatterplotControls
197
+ })]
198
+ });
171
199
  }
@@ -1,38 +1,50 @@
1
- import React from "react";
2
1
  import { Button, ButtonGroup, OverlayTrigger, Tooltip } from "react-bootstrap";
3
2
  import { formatNumerical } from "../../utils/string";
4
3
  import { ObsmKeysList } from "../obsm-list/ObsmList";
4
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
5
  export function Toolbox(_ref) {
6
6
  let {
7
7
  mode,
8
8
  obsLength,
9
- slicedLength
9
+ slicedLength,
10
+ setHasObsm
10
11
  } = _ref;
11
- return /*#__PURE__*/React.createElement("div", {
12
- className: "cherita-toolbox"
13
- }, /*#__PURE__*/React.createElement(ButtonGroup, null, /*#__PURE__*/React.createElement(ObsmKeysList, null), (mode || !isNaN(obsLength)) && (mode !== null && !isNaN(slicedLength) && slicedLength !== obsLength ? /*#__PURE__*/React.createElement(OverlayTrigger, {
14
- placement: "top",
15
- overlay: /*#__PURE__*/React.createElement(Tooltip, {
16
- id: "tooltip-dropped-mode"
17
- }, "You have selected ", formatNumerical(slicedLength), " out of", " ", formatNumerical(obsLength), " cells")
18
- }, /*#__PURE__*/React.createElement(Button, {
19
- size: "sm",
20
- variant: "primary",
21
- style: {
22
- cursor: "default"
23
- },
24
- "aria-disabled": "true"
25
- }, formatNumerical(slicedLength), " of ", formatNumerical(obsLength), " ", "cells")) : /*#__PURE__*/React.createElement(OverlayTrigger, {
26
- placement: "top",
27
- overlay: /*#__PURE__*/React.createElement(Tooltip, {
28
- id: "tooltip-dropped-mode"
29
- }, "You are viewing ", formatNumerical(obsLength), " cells")
30
- }, /*#__PURE__*/React.createElement(Button, {
31
- size: "sm",
32
- variant: "primary",
33
- style: {
34
- cursor: "default"
35
- },
36
- "aria-disabled": "true"
37
- }, formatNumerical(obsLength), " cells")))));
12
+ return /*#__PURE__*/_jsx("div", {
13
+ className: "cherita-toolbox",
14
+ children: /*#__PURE__*/_jsxs(ButtonGroup, {
15
+ children: [/*#__PURE__*/_jsx(ObsmKeysList, {
16
+ setHasObsm: setHasObsm
17
+ }), (mode || !isNaN(obsLength)) && (mode !== null && !isNaN(slicedLength) && slicedLength !== obsLength ? /*#__PURE__*/_jsx(OverlayTrigger, {
18
+ placement: "top",
19
+ overlay: /*#__PURE__*/_jsxs(Tooltip, {
20
+ id: "tooltip-dropped-mode",
21
+ children: ["You have selected ", formatNumerical(slicedLength), " out of", " ", formatNumerical(obsLength), " cells"]
22
+ }),
23
+ children: /*#__PURE__*/_jsxs(Button, {
24
+ size: "sm",
25
+ variant: "primary",
26
+ style: {
27
+ cursor: "default"
28
+ },
29
+ "aria-disabled": "true",
30
+ children: [formatNumerical(slicedLength), " of ", formatNumerical(obsLength), " ", "cells"]
31
+ })
32
+ }) : /*#__PURE__*/_jsx(OverlayTrigger, {
33
+ placement: "top",
34
+ overlay: /*#__PURE__*/_jsxs(Tooltip, {
35
+ id: "tooltip-dropped-mode",
36
+ children: ["You are viewing ", formatNumerical(obsLength), " cells"]
37
+ }),
38
+ children: /*#__PURE__*/_jsxs(Button, {
39
+ size: "sm",
40
+ variant: "primary",
41
+ style: {
42
+ cursor: "default"
43
+ },
44
+ "aria-disabled": "true",
45
+ children: [formatNumerical(obsLength), " cells"]
46
+ })
47
+ }))]
48
+ })
49
+ });
38
50
  }
@@ -3,7 +3,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
3
3
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
5
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
- import React, { useState } from "react";
6
+ import { useState } from "react";
7
7
  import CloseIcon from "@mui/icons-material/Close";
8
8
  import SearchIcon from "@mui/icons-material/Search";
9
9
  import _ from "lodash";
@@ -16,6 +16,7 @@ import Tab from "react-bootstrap/Tab";
16
16
  import { DiseaseInfo, VarInfo } from "./SearchInfo";
17
17
  import { DiseasesSearchResults, VarSearchResults } from "./SearchResults";
18
18
  import { COLOR_ENCODINGS } from "../../constants/constants";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
20
  const select = (dispatch, item) => {
20
21
  dispatch({
21
22
  type: "select.var",
@@ -74,98 +75,136 @@ export function SearchModal(_ref2) {
74
75
  });
75
76
  const [varResultsLength, setVarResultsLength] = useState(null);
76
77
  const [diseaseResultsLength, setDiseaseResultsLength] = useState(null);
77
- return /*#__PURE__*/React.createElement(Modal, {
78
+ return /*#__PURE__*/_jsxs(Modal, {
78
79
  show: show,
79
80
  onHide: handleClose,
80
- size: "xl"
81
- }, /*#__PURE__*/React.createElement(Modal.Header, {
82
- className: "bg-primary"
83
- }, /*#__PURE__*/React.createElement(Container, {
84
- className: "gx-0"
85
- }, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
86
- xs: 12
87
- }, /*#__PURE__*/React.createElement(Form, {
88
- onSubmit: e => {
89
- e.preventDefault();
90
- }
91
- }, /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement("div", {
92
- className: "d-flex align-items-center"
93
- }, /*#__PURE__*/React.createElement(InputGroup, null, /*#__PURE__*/React.createElement(InputGroup.Text, null, /*#__PURE__*/React.createElement(SearchIcon, null)), /*#__PURE__*/React.createElement(Form.Control, {
94
- autoFocus: true,
95
- type: "text",
96
- placeholder: "Search " + displayText,
97
- value: text,
98
- onChange: e => {
99
- setText(e.target.value);
100
- setSelectedResult({
101
- var: null,
102
- disease: null
103
- });
104
- setVarResultsLength(null);
105
- setDiseaseResultsLength(null);
106
- }
107
- }), /*#__PURE__*/React.createElement(Button, {
108
- variant: "light",
109
- onClick: handleClose
110
- }, /*#__PURE__*/React.createElement(CloseIcon, null)))))))))), /*#__PURE__*/React.createElement(Modal.Body, {
111
- className: "p-0"
112
- }, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Col, {
113
- xs: 12,
114
- md: 8
115
- }, /*#__PURE__*/React.createElement(Tab.Container, {
116
- activeKey: tab,
117
- onSelect: k => setTab(k)
118
- }, /*#__PURE__*/React.createElement(Row, {
119
- className: "w-100"
120
- }, /*#__PURE__*/React.createElement(Col, {
121
- sm: 3,
122
- className: "py-3 border-end"
123
- }, /*#__PURE__*/React.createElement(Nav, {
124
- variant: "pills",
125
- className: "flex-column"
126
- }, searchVar && /*#__PURE__*/React.createElement(Nav.Item, null, /*#__PURE__*/React.createElement(Nav.Link, {
127
- eventKey: FEATURE_TYPE.VAR
128
- }, "Genes", " ", !!varResultsLength && "(".concat(varResultsLength, ")"))), searchDiseases && /*#__PURE__*/React.createElement(Nav.Item, null, /*#__PURE__*/React.createElement(Nav.Link, {
129
- eventKey: FEATURE_TYPE.DISEASE
130
- }, "Diseases", " ", !!diseaseResultsLength && "(".concat(diseaseResultsLength, ")"))))), /*#__PURE__*/React.createElement(Col, {
131
- sm: 9,
132
- className: "py-3"
133
- }, /*#__PURE__*/React.createElement(Tab.Content, null, searchVar && /*#__PURE__*/React.createElement(Tab.Pane, {
134
- eventKey: FEATURE_TYPE.VAR
135
- }, /*#__PURE__*/React.createElement(VarSearchResults, {
136
- text: text,
137
- handleSelect: handleSelect,
138
- selectedResult: selectedResult.var,
139
- setSelectedResult: item => setSelectedResult(prev => {
140
- return _objectSpread(_objectSpread({}, prev), {}, {
141
- var: item
142
- });
143
- }),
144
- setResultsLength: setVarResultsLength
145
- })), searchDiseases && /*#__PURE__*/React.createElement(Tab.Pane, {
146
- eventKey: FEATURE_TYPE.DISEASE
147
- }, /*#__PURE__*/React.createElement(DiseasesSearchResults, {
148
- text: text,
149
- selectedResult: selectedResult.disease,
150
- setSelectedResult: item => setSelectedResult(prev => {
151
- return _objectSpread(_objectSpread({}, prev), {}, {
152
- disease: item
153
- });
154
- }),
155
- setResultsLength: setDiseaseResultsLength
156
- }))))))), /*#__PURE__*/React.createElement(Col, {
157
- xs: 12,
158
- md: 4,
159
- className: "bg-light p-3 search-modal-info"
160
- }, selectedResult[tab] ? tab === FEATURE_TYPE.DISEASE ? /*#__PURE__*/React.createElement(DiseaseInfo, {
161
- disease: selectedResult.disease,
162
- handleSelect: handleSelect,
163
- addVarSet: addVarSet
164
- }) : /*#__PURE__*/React.createElement(VarInfo, {
165
- varItem: selectedResult.var
166
- }) : /*#__PURE__*/React.createElement("div", {
167
- className: "text-muted"
168
- }, "No result selected"))))));
81
+ size: "xl",
82
+ children: [/*#__PURE__*/_jsx(Modal.Header, {
83
+ className: "bg-primary",
84
+ children: /*#__PURE__*/_jsx(Container, {
85
+ className: "gx-0",
86
+ children: /*#__PURE__*/_jsx(Row, {
87
+ children: /*#__PURE__*/_jsx(Col, {
88
+ xs: 12,
89
+ children: /*#__PURE__*/_jsx(Form, {
90
+ onSubmit: e => {
91
+ e.preventDefault();
92
+ },
93
+ children: /*#__PURE__*/_jsx(FormGroup, {
94
+ children: /*#__PURE__*/_jsx("div", {
95
+ className: "d-flex align-items-center",
96
+ children: /*#__PURE__*/_jsxs(InputGroup, {
97
+ children: [/*#__PURE__*/_jsx(InputGroup.Text, {
98
+ children: /*#__PURE__*/_jsx(SearchIcon, {})
99
+ }), /*#__PURE__*/_jsx(Form.Control, {
100
+ autoFocus: true,
101
+ type: "text",
102
+ placeholder: "Search " + displayText,
103
+ value: text,
104
+ onChange: e => {
105
+ setText(e.target.value);
106
+ setSelectedResult({
107
+ var: null,
108
+ disease: null
109
+ });
110
+ setVarResultsLength(null);
111
+ setDiseaseResultsLength(null);
112
+ }
113
+ }), /*#__PURE__*/_jsx(Button, {
114
+ variant: "light",
115
+ onClick: handleClose,
116
+ children: /*#__PURE__*/_jsx(CloseIcon, {})
117
+ })]
118
+ })
119
+ })
120
+ })
121
+ })
122
+ })
123
+ })
124
+ })
125
+ }), /*#__PURE__*/_jsx(Modal.Body, {
126
+ className: "p-0",
127
+ children: /*#__PURE__*/_jsx(Container, {
128
+ children: /*#__PURE__*/_jsxs(Row, {
129
+ children: [/*#__PURE__*/_jsx(Col, {
130
+ xs: 12,
131
+ md: 8,
132
+ children: /*#__PURE__*/_jsx(Tab.Container, {
133
+ activeKey: tab,
134
+ onSelect: k => setTab(k),
135
+ children: /*#__PURE__*/_jsxs(Row, {
136
+ className: "w-100",
137
+ children: [/*#__PURE__*/_jsx(Col, {
138
+ sm: 3,
139
+ className: "py-3 border-end",
140
+ children: /*#__PURE__*/_jsxs(Nav, {
141
+ variant: "pills",
142
+ className: "flex-column",
143
+ children: [searchVar && /*#__PURE__*/_jsx(Nav.Item, {
144
+ children: /*#__PURE__*/_jsxs(Nav.Link, {
145
+ eventKey: FEATURE_TYPE.VAR,
146
+ children: ["Genes", " ", !!varResultsLength && "(".concat(varResultsLength, ")")]
147
+ })
148
+ }), searchDiseases && /*#__PURE__*/_jsx(Nav.Item, {
149
+ children: /*#__PURE__*/_jsxs(Nav.Link, {
150
+ eventKey: FEATURE_TYPE.DISEASE,
151
+ children: ["Diseases", " ", !!diseaseResultsLength && "(".concat(diseaseResultsLength, ")")]
152
+ })
153
+ })]
154
+ })
155
+ }), /*#__PURE__*/_jsx(Col, {
156
+ sm: 9,
157
+ className: "py-3",
158
+ children: /*#__PURE__*/_jsxs(Tab.Content, {
159
+ children: [searchVar && /*#__PURE__*/_jsx(Tab.Pane, {
160
+ eventKey: FEATURE_TYPE.VAR,
161
+ children: /*#__PURE__*/_jsx(VarSearchResults, {
162
+ text: text,
163
+ handleSelect: handleSelect,
164
+ selectedResult: selectedResult.var,
165
+ setSelectedResult: item => setSelectedResult(prev => {
166
+ return _objectSpread(_objectSpread({}, prev), {}, {
167
+ var: item
168
+ });
169
+ }),
170
+ setResultsLength: setVarResultsLength
171
+ })
172
+ }), searchDiseases && /*#__PURE__*/_jsx(Tab.Pane, {
173
+ eventKey: FEATURE_TYPE.DISEASE,
174
+ children: /*#__PURE__*/_jsx(DiseasesSearchResults, {
175
+ text: text,
176
+ selectedResult: selectedResult.disease,
177
+ setSelectedResult: item => setSelectedResult(prev => {
178
+ return _objectSpread(_objectSpread({}, prev), {}, {
179
+ disease: item
180
+ });
181
+ }),
182
+ setResultsLength: setDiseaseResultsLength
183
+ })
184
+ })]
185
+ })
186
+ })]
187
+ })
188
+ })
189
+ }), /*#__PURE__*/_jsx(Col, {
190
+ xs: 12,
191
+ md: 4,
192
+ className: "bg-light p-3 search-modal-info",
193
+ children: selectedResult[tab] ? tab === FEATURE_TYPE.DISEASE ? /*#__PURE__*/_jsx(DiseaseInfo, {
194
+ disease: selectedResult.disease,
195
+ handleSelect: handleSelect,
196
+ addVarSet: addVarSet
197
+ }) : /*#__PURE__*/_jsx(VarInfo, {
198
+ varItem: selectedResult.var
199
+ }) : /*#__PURE__*/_jsx("div", {
200
+ className: "text-muted",
201
+ children: "No result selected"
202
+ })
203
+ })]
204
+ })
205
+ })
206
+ })]
207
+ });
169
208
  }
170
209
  export function SearchBar(_ref3) {
171
210
  let {
@@ -175,22 +214,31 @@ export function SearchBar(_ref3) {
175
214
  const [text, setText] = useState("");
176
215
  const displayText = [...(searchVar ? ["features"] : []), ...(searchDiseases ? ["diseases"] : [])].join(" and ");
177
216
  const [showModal, setShowModal] = useState(false);
178
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Form, {
179
- onSubmit: e => {
180
- e.preventDefault();
181
- }
182
- }, /*#__PURE__*/React.createElement(FormGroup, null, /*#__PURE__*/React.createElement(InputGroup, null, /*#__PURE__*/React.createElement(InputGroup.Text, null, /*#__PURE__*/React.createElement(SearchIcon, null)), /*#__PURE__*/React.createElement(Form.Control, {
183
- onClick: () => setShowModal(true),
184
- type: "text",
185
- placeholder: "Search " + displayText,
186
- defaultValue: text
187
- })))), /*#__PURE__*/React.createElement(SearchModal, {
188
- show: showModal,
189
- text: text,
190
- setText: setText,
191
- displayText: displayText,
192
- searchVar: searchVar,
193
- searchDiseases: searchDiseases,
194
- handleClose: () => setShowModal(false)
195
- }));
217
+ return /*#__PURE__*/_jsxs("div", {
218
+ children: [/*#__PURE__*/_jsx(Form, {
219
+ onSubmit: e => {
220
+ e.preventDefault();
221
+ },
222
+ children: /*#__PURE__*/_jsx(FormGroup, {
223
+ children: /*#__PURE__*/_jsxs(InputGroup, {
224
+ children: [/*#__PURE__*/_jsx(InputGroup.Text, {
225
+ children: /*#__PURE__*/_jsx(SearchIcon, {})
226
+ }), /*#__PURE__*/_jsx(Form.Control, {
227
+ onClick: () => setShowModal(true),
228
+ type: "text",
229
+ placeholder: "Search " + displayText,
230
+ defaultValue: text
231
+ })]
232
+ })
233
+ })
234
+ }), /*#__PURE__*/_jsx(SearchModal, {
235
+ show: showModal,
236
+ text: text,
237
+ setText: setText,
238
+ displayText: displayText,
239
+ searchVar: searchVar,
240
+ searchDiseases: searchDiseases,
241
+ handleClose: () => setShowModal(false)
242
+ })]
243
+ });
196
244
  }