@haniffalab/cherita-react 0.2.1 → 1.0.0-dev.2025-03-07.aedc1788

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.
@@ -10,19 +10,22 @@ var _constants = require("../constants/constants");
10
10
  var _DatasetContext = require("../context/DatasetContext");
11
11
  var _zarrHelper = require("../helpers/zarr-helper");
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- const useObsmData = () => {
13
+ const useObsmData = (obsm = null) => {
14
14
  const dataset = (0, _DatasetContext.useDataset)();
15
+ obsm = obsm || dataset.selectedObsm;
15
16
  const [obsmParams, setObsmParams] = (0, _react.useState)({
16
17
  url: dataset.url,
17
- path: "obsm/" + dataset.selectedObsm
18
+ path: "obsm/" + obsm
18
19
  });
19
20
  (0, _react.useEffect)(() => {
20
21
  setObsmParams({
21
22
  url: dataset.url,
22
- path: "obsm/" + dataset.selectedObsm
23
+ path: "obsm/" + obsm
23
24
  });
24
- }, [dataset.url, dataset.selectedObsm]);
25
- return (0, _zarrHelper.useZarr)(obsmParams, null, _zarrHelper.GET_OPTIONS);
25
+ }, [dataset.url, obsm]);
26
+ return (0, _zarrHelper.useZarr)(obsmParams, null, _zarrHelper.GET_OPTIONS, {
27
+ enabled: !!obsm
28
+ });
26
29
  };
27
30
  exports.useObsmData = useObsmData;
28
31
  const meanData = (_i, data) => {
@@ -54,22 +57,27 @@ const useXData = (agg = meanData) => {
54
57
  };
55
58
  }));
56
59
  }, [dataset.url, dataset.selectedVar]);
57
- return (0, _zarrHelper.useMultipleZarr)(xParams, _zarrHelper.GET_OPTIONS, agg);
60
+ return (0, _zarrHelper.useMultipleZarr)(xParams, _zarrHelper.GET_OPTIONS, {
61
+ enabled: !!xParams.length
62
+ }, agg);
58
63
  };
59
64
  exports.useXData = useXData;
60
- const useObsData = () => {
65
+ const useObsData = (obs = null) => {
61
66
  const dataset = (0, _DatasetContext.useDataset)();
67
+ obs = obs || dataset.selectedObs;
62
68
  const [obsParams, setObsParams] = (0, _react.useState)({
63
69
  url: dataset.url,
64
- path: "obs/" + dataset.selectedObs?.name + (dataset.selectedObs?.type === _constants.OBS_TYPES.CATEGORICAL ? "/codes" : "")
70
+ path: "obs/" + obs?.name + (obs?.type === _constants.OBS_TYPES.CATEGORICAL ? "/codes" : "")
65
71
  });
66
72
  (0, _react.useEffect)(() => {
67
73
  setObsParams({
68
74
  url: dataset.url,
69
- path: "obs/" + dataset.selectedObs?.name + (dataset.selectedObs?.type === _constants.OBS_TYPES.CATEGORICAL ? "/codes" : "")
75
+ path: "obs/" + obs?.name + (obs?.type === _constants.OBS_TYPES.CATEGORICAL ? "/codes" : "")
70
76
  });
71
- }, [dataset.url, dataset.selectedObs]);
72
- return (0, _zarrHelper.useZarr)(obsParams, null, _zarrHelper.GET_OPTIONS);
77
+ }, [dataset.url, obs]);
78
+ return (0, _zarrHelper.useZarr)(obsParams, null, _zarrHelper.GET_OPTIONS, {
79
+ enabled: !!obs
80
+ });
73
81
  };
74
82
  exports.useObsData = useObsData;
75
83
  const useLabelObsData = () => {
@@ -90,6 +98,8 @@ const useLabelObsData = () => {
90
98
  };
91
99
  }));
92
100
  }, [dataset.labelObs, dataset.url]);
93
- return (0, _zarrHelper.useMultipleZarr)(labelObsParams, _zarrHelper.GET_OPTIONS);
101
+ return (0, _zarrHelper.useMultipleZarr)(labelObsParams, _zarrHelper.GET_OPTIONS, {
102
+ enabled: !!labelObsParams.length
103
+ });
94
104
  };
95
105
  exports.useLabelObsData = useLabelObsData;
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@haniffalab/cherita-react",
3
- "version": "0.2.1",
4
- "author": "",
5
- "license": "",
3
+ "version": "1.0.0-dev.2025-03-07.aedc1788",
4
+ "author": "Haniffa Lab",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "react",
8
+ "bioinformatics",
9
+ "visualization"
10
+ ],
6
11
  "main": "dist/index.js",
7
12
  "module": "dist/index.js",
8
13
  "style": "dist/css/cherita.css",
@@ -22,15 +27,15 @@
22
27
  "@mui/x-charts": "^7.7.1",
23
28
  "@nebula.gl/editor": "^1.0.4",
24
29
  "@nebula.gl/layers": "^1.0.4",
25
- "@tanstack/query-sync-storage-persister": "^4.36.1",
26
- "@tanstack/react-query": "^4.36.1",
27
- "@tanstack/react-query-persist-client": "^4.36.1",
30
+ "@tanstack/query-sync-storage-persister": "5.66",
31
+ "@tanstack/react-query": "5.66",
32
+ "@tanstack/react-query-persist-client": "5.66",
28
33
  "@tanstack/react-virtual": "^3.7.0",
29
34
  "@turf/turf": "^7.0.0",
30
35
  "@uidotdev/usehooks": "^2.4.1",
31
- "bootstrap": "^5.3.0",
32
- "deck.gl": "^8.9.19",
33
- "jquery": "^3.7.0",
36
+ "bootstrap": "^5.3.3",
37
+ "deck.gl": "8.8.27",
38
+ "jquery": "^3.7.1",
34
39
  "nebula.gl": "^1.0.4",
35
40
  "numbro": "^2.5.0",
36
41
  "plotly.js": "^2.23.2",
@@ -45,24 +50,24 @@
45
50
  "react-dom": "^18.2.0"
46
51
  },
47
52
  "devDependencies": {
48
- "@testing-library/dom": "^10.4.0",
49
- "@testing-library/jest-dom": "^6.6.3",
50
- "@testing-library/react": "^16.2.0",
51
- "babel-jest": "^29.7.0",
52
53
  "@babel/cli": "^7.22.5",
53
54
  "@babel/core": "^7.22.5",
54
55
  "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
55
56
  "@babel/preset-env": "^7.22.5",
56
57
  "@babel/preset-react": "^7.22.5",
58
+ "@testing-library/dom": "^10.4.0",
59
+ "@testing-library/jest-dom": "^6.6.3",
60
+ "@testing-library/react": "^16.2.0",
61
+ "babel-jest": "^29.7.0",
57
62
  "cpx": "^1.5.0",
58
63
  "eslint": "^8.42.0",
59
64
  "eslint-config-prettier": "^8.8.0",
60
65
  "eslint-config-react-app": "^7.0.1",
66
+ "eslint-plugin-import": "^2.29.1",
61
67
  "jest": "^29.7.0",
62
68
  "jest-environment-jsdom": "^29.7.0",
63
- "eslint-plugin-import": "^2.29.1",
64
69
  "prettier": "^3.3.3",
65
- "sass": "^1.79.5",
70
+ "sass": "1.77.6",
66
71
  "stylelint": "^16.10.0",
67
72
  "stylelint-config-prettier": "^9.0.5",
68
73
  "stylelint-config-standard-scss": "^13.1.0"
@@ -70,14 +75,15 @@
70
75
  "scripts": {
71
76
  "build:babel": "babel src/lib --out-dir dist --copy-files",
72
77
  "build:scss": "sass --load-path=node_modules src/scss/cherita-bootstrap.scss dist/css/cherita.css",
73
- "copy:scss": "cpx src/scss/**/* scss",
78
+ "copy:scss": "cpx 'src/scss/**/*' 'scss'",
74
79
  "build": "npm run build:babel && npm run build:scss && npm run copy:scss",
75
80
  "test": "jest --watchAll",
76
81
  "test:ci": "jest --coverage --ci --no-watch",
77
82
  "lint:scss": "stylelint 'src/**/*.scss' --fix",
78
83
  "lint:js": "eslint 'src/**/*.js' --fix",
79
84
  "lint": "npm run lint:scss && npm run lint:js",
80
- "start-demo": "npm run dev --prefix sites/demo"
85
+ "start-demo": "npm run dev --prefix sites/demo",
86
+ "reinstall": "rm -rf node_modules package-lock.json && npm install"
81
87
  },
82
88
  "eslintConfig": {
83
89
  "extends": [
@@ -97,7 +103,7 @@
97
103
  "last 1 safari version"
98
104
  ]
99
105
  },
100
- "description": "",
106
+ "description": "React component library designed for data visualisation and analysis of single-cell and spatial multi-omics data.",
101
107
  "repository": {
102
108
  "type": "git",
103
109
  "url": "git+https://github.com/haniffalab/cherita-react.git"
@@ -105,5 +111,6 @@
105
111
  "bugs": {
106
112
  "url": "https://github.com/haniffalab/cherita-react/issues"
107
113
  },
108
- "homepage": "https://github.com/haniffalab/cherita-react#readme"
109
- }
114
+ "homepage": "https://github.com/haniffalab/cherita-react#readme",
115
+ "prereleaseSha": "aedc178896f6254f95f7a5588a15636eb7b7f27a"
116
+ }
package/scss/cherita.scss CHANGED
@@ -1,3 +1,8 @@
1
+ @import "components/layouts";
2
+ @import "components/plots";
3
+ @import "components/scrollbars";
4
+ @import "components/plotly";
5
+
1
6
  .loading-spinner {
2
7
  @extend .bg-light;
3
8
 
@@ -24,25 +29,6 @@
24
29
  overflow: hidden;
25
30
  }
26
31
 
27
- .cherita-navbar {
28
- @extend .mx-1;
29
- @extend .my-2;
30
- @extend .d-block;
31
- @extend .d-xl-none;
32
-
33
- position: absolute;
34
- z-index: 11;
35
- top: 0;
36
- left: 0;
37
- right: 0;
38
- border-radius: 0.25rem;
39
- }
40
-
41
- .cherita-container .cherita-navbar-item > .dropdown-menu {
42
- height: var(--dropdown-height);
43
- overflow: hidden scroll;
44
- }
45
-
46
32
  /* Scrollbar styling */
47
33
 
48
34
  /* Works on Firefox */
@@ -79,14 +65,6 @@
79
65
  height: 100%;
80
66
  }
81
67
 
82
- .cherita-spatial-controls {
83
- position: absolute;
84
- z-index: 10;
85
- top: 1rem;
86
- left: 1rem;
87
- width: 3rem;
88
- }
89
-
90
68
  .cherita-spatial-footer {
91
69
  position: absolute;
92
70
  z-index: 10;
@@ -208,12 +186,30 @@
208
186
  .value-count-badge {
209
187
  color: #000000 !important;
210
188
  background-color: #dedede !important;
189
+ font-weight: lighter;
211
190
  }
212
191
 
192
+ .filtered-value-count-badge {
193
+ color: #ffffff !important;
194
+ // background-color: $alt-color !important;
195
+ font-weight: normal;
196
+ }
197
+
198
+ $gauge-padding: 0.15rem;
199
+
213
200
  .value-pct-gauge-container {
201
+ position: relative;
214
202
  width: 1.5rem;
215
203
  height: 1.5rem;
216
- padding: 0.2rem;
204
+ padding: $gauge-padding;
205
+ }
206
+
207
+ .pct-gauge {
208
+ position: absolute !important;
209
+ top: $gauge-padding;
210
+ left: $gauge-padding;
211
+ width: calc(100% - $gauge-padding * 2) !important;
212
+ height: calc(100% - $gauge-padding * 2) !important;
217
213
  }
218
214
 
219
215
  .feature-histogram-container {
@@ -258,12 +254,6 @@
258
254
  margin: 0;
259
255
  }
260
256
 
261
- .cherita-app {
262
- @extend .container-fluid;
263
-
264
- position: relative;
265
- }
266
-
267
257
  .cherita-app-plot {
268
258
  @extend .col;
269
259
  @extend .col-12;
@@ -275,19 +265,6 @@
275
265
  max-height: 100%;
276
266
  }
277
267
 
278
- .cherita-app-obs {
279
- @extend .col;
280
- @extend .d-none;
281
- @extend .d-lg-block;
282
- @extend .col-lg-4;
283
- @extend .col-xl-3;
284
- @extend .col-xxl-3;
285
-
286
- border-right: 5px solid #f5f5f5;
287
- overflow-y: scroll;
288
- height: 100%;
289
- }
290
-
291
268
  .cherita-app-var {
292
269
  @extend .p-3;
293
270
  @extend .col;
@@ -352,3 +329,68 @@
352
329
  .deck-tooltip {
353
330
  z-index: 100 !important;
354
331
  }
332
+
333
+ .pseudospatial-reference-img {
334
+ width: 100%;
335
+ height: 100%;
336
+ object-fit: contain; /* Keeps the image inside its allocated space */
337
+ }
338
+
339
+ .cherita-pseudospatial-controls {
340
+ position: absolute;
341
+ z-index: 10;
342
+ bottom: 1rem;
343
+ left: 1rem;
344
+ }
345
+
346
+ /* Styling the obs-accordion-header */
347
+ .obs-accordion {
348
+ margin-bottom: 10px; /* Space between each accordion */
349
+ }
350
+
351
+ .obs-accordion-header {
352
+ @extend .btn;
353
+ @extend .btn-light-primary !optional;
354
+ @extend .btn-light;
355
+ @extend .text-primary;
356
+
357
+ display: flex;
358
+ align-items: center; /* Center the content vertically */
359
+ margin: 10px 10px 0 10px;
360
+ padding: 8px 12px; /* Adjust padding for spacing */
361
+ border-radius: 8px; /* Optional: rounded corners */
362
+ transition: background-color 0.3s ease; /* Smooth transition for background change */
363
+ cursor: pointer;
364
+
365
+ .obs-accordion-header-chevron {
366
+ display: flex;
367
+ justify-content: center;
368
+ align-items: center;
369
+ width: 20px; /* Fixed width to prevent layout shifts */
370
+ height: 20px; /* Ensures a consistent square */
371
+ margin-right: 10px;
372
+ }
373
+ .obs-accordion-header-title {
374
+ font-size: 1rem;
375
+ width: 100%;
376
+ display: flex;
377
+ justify-content: space-between;
378
+ align-items: center;
379
+ }
380
+
381
+ &.active {
382
+ @extend .btn-primary;
383
+ @extend .text-light;
384
+ }
385
+ &:hover {
386
+ background-color: var(--geeks-btn-hover-bg);
387
+ border-color: var(--geeks-btn-hover-border-color);
388
+ }
389
+ }
390
+
391
+ .obs-accordion-body {
392
+ @extend .card;
393
+
394
+ margin: 10px;
395
+ position: relative;
396
+ }
@@ -0,0 +1,101 @@
1
+ .cherita-app {
2
+ position: relative;
3
+ }
4
+
5
+ .cherita-app .cherita-navbar {
6
+ @extend .m-3;
7
+ @extend .d-block;
8
+ @extend .d-xl-none;
9
+
10
+ position: absolute;
11
+ z-index: 11;
12
+ top: 0;
13
+ left: 0;
14
+ right: 0;
15
+ border-radius: 0.25rem;
16
+ @media (min-width: 992px) and (max-width: 1199px) {
17
+ margin-left: calc(33.33333333% + 1rem) !important;
18
+ }
19
+ }
20
+
21
+ .cherita-app-canvas {
22
+ position: relative;
23
+ }
24
+
25
+ .cherita-app-obs {
26
+ @extend .col;
27
+ @extend .d-none;
28
+ @extend .d-lg-block;
29
+ @extend .col-lg-4;
30
+ @extend .col-xl-3;
31
+ @extend .col-xxl-3;
32
+
33
+ overflow-y: scroll;
34
+ }
35
+
36
+ .cherita-app-sidebar {
37
+ @extend .d-none;
38
+ @extend .d-xl-flex;
39
+
40
+ width: 20%;
41
+ position: relative;
42
+
43
+ .card {
44
+ width: 100%;
45
+ }
46
+
47
+ .card-body {
48
+ overflow-y: hidden;
49
+ }
50
+
51
+ .sidebar-pseudospatial {
52
+ padding: 10px;
53
+ border-bottom: 1px solid #dee2e6;
54
+
55
+ .cherita-legend {
56
+ margin: 0 auto;
57
+ }
58
+ }
59
+
60
+ .sidebar-features {
61
+ padding: 10px;
62
+ margin-bottom: 10px;
63
+ overflow-y: auto;
64
+ }
65
+
66
+ .accordion-header-wrapper {
67
+ cursor: pointer;
68
+ padding: var(--geeks-accordion-btn-padding-y)
69
+ var(--geeks-accordion-btn-padding-x);
70
+ color: var(--geeks-accordion-btn-color);
71
+ background-color: var(--geeks-accordion-btn-bg);
72
+ border: 0;
73
+ border-radius: 0;
74
+ transition: var(--geeks-accordion-transition);
75
+ display: flex;
76
+ align-items: center;
77
+ width: 100%;
78
+
79
+ &:after {
80
+ content: "";
81
+ flex-shrink: 0;
82
+ width: var(--geeks-accordion-btn-icon-width);
83
+ height: var(--geeks-accordion-btn-icon-width);
84
+ margin-left: 8px;
85
+ background-image: var(--geeks-accordion-btn-icon);
86
+ background-repeat: no-repeat;
87
+ background-size: var(--geeks-accordion-btn-icon-width);
88
+ transition: var(--geeks-accordion-btn-icon-transition);
89
+ }
90
+ }
91
+
92
+ .accordion-header-wrapper:not(.collapsed) {
93
+ color: var(--geeks-accordion-active-color);
94
+ background-color: var(--geeks-accordion-active-bg);
95
+
96
+ &:after {
97
+ background-image: var(--geeks-accordion-btn-active-icon);
98
+ transform: var(--geeks-accordion-btn-icon-transform);
99
+ }
100
+ }
101
+ }
@@ -0,0 +1,30 @@
1
+ .js-plotly-plot .plotly .modebar {
2
+ border-radius: 5px;
3
+ background-color: rgba(0, 0, 0, 0.6);
4
+ padding: 0 4px !important;
5
+
6
+ .modebar-group {
7
+ margin: 0 !important;
8
+ padding: 0 !important;
9
+ background-color: transparent !important;
10
+
11
+ .modebar-btn {
12
+ fill: white !important; /* Ensures white icons */
13
+ color: white !important; /* Ensures text/icons are visible */
14
+ position: relative;
15
+ font-size: 16px;
16
+ padding: 4px;
17
+ height: auto;
18
+ cursor: pointer;
19
+ line-height: normal;
20
+
21
+ svg {
22
+ position: relative;
23
+ top: auto;
24
+ bottom: auto;
25
+ left: auto;
26
+ right: auto;
27
+ }
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,13 @@
1
+ .cherita-spatial-controls {
2
+ position: absolute;
3
+ z-index: 10;
4
+ top: 1rem;
5
+ left: 1rem;
6
+ width: 3rem;
7
+ }
8
+
9
+ @media (max-width: 1199.98px) {
10
+ .cherita-spatial-controls {
11
+ top: 5rem;
12
+ }
13
+ }
@@ -0,0 +1,18 @@
1
+ .modern-scrollbars::-webkit-scrollbar {
2
+ width: 20px;
3
+ }
4
+
5
+ .modern-scrollbars::-webkit-scrollbar-track {
6
+ background-color: transparent;
7
+ }
8
+
9
+ .modern-scrollbars::-webkit-scrollbar-thumb {
10
+ background-color: #d6dee1;
11
+ border-radius: 20px;
12
+ border: 6px solid transparent;
13
+ background-clip: content-box;
14
+ }
15
+
16
+ .modern-scrollbars::-webkit-scrollbar-thumb:hover {
17
+ background-color: #a8bbbf;
18
+ }
@@ -1,11 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PseudospatialControls = PseudospatialControls;
7
- var _react = _interopRequireDefault(require("react"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- function PseudospatialControls() {
10
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
11
- }