@vitessce/biomarker-select 3.5.11 → 3.6.0

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.
@@ -1,7 +1,5 @@
1
1
  import React, { useRef, useEffect } from 'react';
2
- import { Grid, Button, TextField, Typography } from '@material-ui/core';
3
- import { Add as AddIcon, Info as InfoIcon } from '@material-ui/icons';
4
- import { Autocomplete } from '@material-ui/lab';
2
+ import { Grid, Button, TextField, Typography, Add as AddIcon, Info as InfoIcon, Autocomplete } from '@vitessce/styles';
5
3
  import { VariableSizeList } from 'react-window';
6
4
  import { useStyles } from './styles.js';
7
5
 
@@ -19,13 +17,21 @@ const OuterElementType = React.forwardRef((props, ref) => {
19
17
 
20
18
  function ListRow(props) {
21
19
  const { data, index, style } = props;
20
+ const dataSet = data[index];
21
+ const inlineStyle = {
22
+ ...style,
23
+ top: style.top + 8,
24
+ };
25
+
26
+ // This array is created by the renderOption function in the Autocomplete component.
27
+ const [props0, option] = dataSet;
28
+ const { key, ...optionProps } = props0;
22
29
 
23
- return React.cloneElement(data[index], {
24
- style: {
25
- ...style,
26
- top: style.top + 8,
27
- },
28
- });
30
+ return (
31
+ <Typography key={key} component="li" {...optionProps} noWrap style={inlineStyle}>
32
+ {option.label} ({option.nodeType})
33
+ </Typography>
34
+ );
29
35
  }
30
36
 
31
37
  function useResetCache(itemCount) {
@@ -72,7 +78,7 @@ export function SelectAgnostic(props) {
72
78
  currentModalityAgnosticSelection,
73
79
  setCurrentModalityAgnosticSelection,
74
80
  } = props;
75
- const classes = useStyles();
81
+ const { classes } = useStyles();
76
82
 
77
83
  const [selectedItem, setSelectedItem] = React.useState(null);
78
84
 
@@ -99,13 +105,13 @@ export function SelectAgnostic(props) {
99
105
  }
100
106
  return (
101
107
  <>
102
- <Grid item container xs={12}>
108
+ <Grid container size={12}>
103
109
  <Typography variant="h6">
104
110
  Search by gene, protein, pathway (by term name), or cell type:
105
111
  </Typography>
106
112
  </Grid>
107
- <Grid item container xs={12}>
108
- <Grid item xs={4}>
113
+ <Grid container size={12}>
114
+ <Grid size={4}>
109
115
  <Autocomplete
110
116
  options={potentialItems}
111
117
  autoComplete
@@ -116,16 +122,19 @@ export function SelectAgnostic(props) {
116
122
  renderInput={params => (
117
123
  <TextField label="Search" variant="outlined" onChange={handleChange} {...params} />
118
124
  )}
119
- ListboxComponent={ListboxComponent}
120
125
  getOptionLabel={option => option.label}
121
- renderOption={option => (
122
- <Typography noWrap>{option.label} ({option.nodeType})</Typography>
126
+ renderOption={(props0, option, state) => (
127
+ [props0, option, state.index]
123
128
  )}
129
+ slotProps={{
130
+ listbox: {
131
+ component: ListboxComponent,
132
+ },
133
+ }}
124
134
  />
125
135
  </Grid>
126
136
  <Grid
127
- item
128
- xs={8}
137
+ size={8}
129
138
  style={{
130
139
  border: selectedItem ? '1px solid gray' : '1px solid transparent',
131
140
  borderRadius: '4px',
@@ -133,13 +142,13 @@ export function SelectAgnostic(props) {
133
142
  >
134
143
  {selectedItem ? (
135
144
  <>
136
- <Grid container item xs={12}>
137
- <Grid item xs={9}>
145
+ <Grid container size={12}>
146
+ <Grid size={9}>
138
147
  <Typography variant="h4" title={selectedItem.term}>
139
148
  {selectedItem.label}
140
149
  </Typography>
141
150
  </Grid>
142
- <Grid item xs={3} style={{ position: 'relative' }}>
151
+ <Grid size={3} sx={{ position: 'relative' }}>
143
152
  <Button
144
153
  className={classes.selectButton}
145
154
  variant="contained"
@@ -150,11 +159,11 @@ export function SelectAgnostic(props) {
150
159
  </Button>
151
160
  </Grid>
152
161
  </Grid>
153
- <Grid container item xs={12}>
162
+ <Grid container size={12}>
154
163
  <InfoIcon />
155
164
  <Typography variant="h6">About this {selectedItem.nodeType}</Typography>
156
165
  </Grid>
157
- <Grid container item xs={12} key={selectedItem.term}>
166
+ <Grid container size={12} key={selectedItem.term}>
158
167
  <iframe
159
168
  title={`Embedded metadata page for ontology term ${selectedItem.term}`}
160
169
  src={`https://identifiers.org/${selectedItem.term}`}
@@ -1,7 +1,6 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { useQueries } from '@tanstack/react-query';
3
- import { Grid, FormHelperText, Typography, Select, FormControl } from '@material-ui/core';
4
- import { DataGrid } from '@mui/x-data-grid';
3
+ import { Grid, FormHelperText, Typography, NativeSelect, FormControl, DataGrid } from '@vitessce/styles';
5
4
  import { useStyles } from './styles.js';
6
5
 
7
6
 
@@ -20,6 +19,15 @@ const columns = [
20
19
  },
21
20
  ];
22
21
 
22
+ const initialState = {
23
+ pagination: {
24
+ paginationModel: {
25
+ pageSize: 10,
26
+ },
27
+ },
28
+ };
29
+ const pageSizeOptions = [10];
30
+
23
31
 
24
32
  export function SelectSpecific(props) {
25
33
  const {
@@ -28,7 +36,7 @@ export function SelectSpecific(props) {
28
36
  setCurrentModalitySpecificSelection,
29
37
  getEdges,
30
38
  } = props;
31
- const classes = useStyles();
39
+ const { classes } = useStyles();
32
40
 
33
41
  const queries = useQueries({
34
42
  queries: currentModalityAgnosticSelection?.map(item => ({
@@ -62,12 +70,15 @@ export function SelectSpecific(props) {
62
70
  // Derive the set of selected row ids from the
63
71
  // currentModalitySpecificSelection.
64
72
  const rowSelectionModel = useMemo(
65
- () => currentModalitySpecificSelection?.map(d => d.kgId) || [],
73
+ () => ({
74
+ ids: new Set(currentModalitySpecificSelection?.map(d => d.kgId) || []),
75
+ type: 'include',
76
+ }),
66
77
  [rows, currentModalitySpecificSelection],
67
78
  );
68
79
 
69
80
  function handleSelection(newRowSelectionModel) {
70
- const newSelection = newRowSelectionModel
81
+ const newSelection = Array.from(newRowSelectionModel.ids)
71
82
  .map(kgId => data.find(d => d.target.kgId === kgId)?.target)
72
83
  .filter(Boolean);
73
84
  setCurrentModalitySpecificSelection(newSelection);
@@ -75,14 +86,13 @@ export function SelectSpecific(props) {
75
86
 
76
87
  return (
77
88
  <>
78
- <Grid item xs={6}>
89
+ <Grid size={6}>
79
90
  <Typography variant="h6">Select a feature type:</Typography>
80
91
  </Grid>
81
- <Grid item container xs={6}>
82
- <Grid item>
92
+ <Grid container size={6}>
93
+ <Grid>
83
94
  <FormControl fullWidth>
84
- <Select
85
- native
95
+ <NativeSelect
86
96
  defaultValue="gene"
87
97
  classes={{ select: classes.selectInput }}
88
98
  inputProps={{
@@ -91,18 +101,19 @@ export function SelectSpecific(props) {
91
101
  }}
92
102
  >
93
103
  <option value="gene">Gene (RNA-seq)</option>
94
- </Select>
104
+ </NativeSelect>
95
105
  <FormHelperText>Feature type (experimental modality)</FormHelperText>
96
106
  </FormControl>
97
107
  </Grid>
98
108
  </Grid>
99
- <Grid item container xs={12} style={{ height: '450px' }}>
109
+ <Grid container size={12} sx={{ height: '450px' }}>
100
110
  <DataGrid
101
111
  rows={rows}
102
112
  columns={columns}
103
- pageSize={10}
113
+ initialState={initialState}
114
+ pageSizeOptions={pageSizeOptions}
104
115
  checkboxSelection
105
- onSelectionModelChange={handleSelection}
116
+ onRowSelectionModelChange={handleSelection}
106
117
  rowSelectionModel={rowSelectionModel}
107
118
  />
108
119
  </Grid>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Grid, RadioGroup, FormControl, FormLabel, Radio, FormControlLabel, Typography } from '@material-ui/core';
2
+ import { Grid, RadioGroup, FormControl, FormLabel, Radio, FormControlLabel, Typography } from '@vitessce/styles';
3
3
 
4
4
 
5
5
  export function SelectStratification(props) {
@@ -26,7 +26,7 @@ export function SelectStratification(props) {
26
26
  const hasStructuralRegionOptions = structuralRegionOptions && structuralRegionOptions.length > 0;
27
27
 
28
28
  return (
29
- <Grid item xs={12}>
29
+ <Grid size={12}>
30
30
  <Typography variant="h6">
31
31
  Select a stratification option:
32
32
  </Typography>
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect } from 'react';
2
- import { Stepper, Step, StepLabel, Button, Grid, Box, Typography } from '@material-ui/core';
2
+ import { Stepper, Step, StepLabel, Button, Grid, Box, Typography } from '@vitessce/styles';
3
3
  import { ConfirmatoryCart } from './cart.js';
4
4
  import { SelectAgnostic } from './select-agnostic.js';
5
5
  import { SelectSpecific } from './select-specific.js';
@@ -27,7 +27,7 @@ export function ConfirmatoryStepper(props) {
27
27
  stratifications,
28
28
  onFinish,
29
29
  } = props;
30
- const classes = useStyles();
30
+ const { classes } = useStyles();
31
31
  const [activeStep, setActiveStep] = React.useState(0);
32
32
  const [skipped, setSkipped] = React.useState(new Set());
33
33
 
@@ -77,8 +77,8 @@ export function ConfirmatoryStepper(props) {
77
77
 
78
78
 
79
79
  return (
80
- <Grid item container xs={12}>
81
- <Grid item container xs={12}>
80
+ <Grid container size={12}>
81
+ <Grid container size={12}>
82
82
  <Box className={classes.fullWidthBox}>
83
83
  <Stepper activeStep={activeStep}>
84
84
  {steps.map((label, index) => {
@@ -101,9 +101,9 @@ export function ConfirmatoryStepper(props) {
101
101
  </Stepper>
102
102
  </Box>
103
103
  </Grid>
104
- <Grid item container xs={12} style={{ marginTop: '20px' }} alignItems="flex-start">
104
+ <Grid container size={12} sx={{ marginTop: '20px' }} alignItems="flex-start">
105
105
  {/* Step contents to left of cart */}
106
- <Grid item container xs={8}>
106
+ <Grid container size={8}>
107
107
  {activeStep === steps.length ? (
108
108
  <>
109
109
  <Typography style={{ marginTop: '20px', marginBottom: '10px' }}>
@@ -161,7 +161,7 @@ export function ConfirmatoryStepper(props) {
161
161
  )}
162
162
  </Grid>
163
163
  {/* Cart */}
164
- <Grid item container xs={4}>
164
+ <Grid container size={4}>
165
165
  <ConfirmatoryCart
166
166
  currentModalityAgnosticSelection={currentModalityAgnosticSelection}
167
167
  setCurrentModalityAgnosticSelection={setCurrentModalityAgnosticSelection}
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect } from 'react';
2
- import { Stepper, Step, StepLabel, Button, Grid, Box, Typography } from '@material-ui/core';
2
+ import { Stepper, Step, StepLabel, Button, Grid, Box, Typography } from '@vitessce/styles';
3
3
  import { ConfirmatoryCart } from './cart.js';
4
4
  import { SelectStratification } from './select-stratification.js';
5
5
  import { useStyles } from './styles.js';
@@ -23,7 +23,7 @@ export function ExploratoryStepper(props) {
23
23
  stratifications,
24
24
  onFinish,
25
25
  } = props;
26
- const classes = useStyles();
26
+ const { classes } = useStyles();
27
27
  const [activeStep, setActiveStep] = React.useState(0);
28
28
  const [skipped, setSkipped] = React.useState(new Set());
29
29
 
@@ -73,8 +73,8 @@ export function ExploratoryStepper(props) {
73
73
 
74
74
 
75
75
  return (
76
- <Grid item container xs={12}>
77
- <Grid item container xs={12}>
76
+ <Grid container size={12}>
77
+ <Grid container size={12}>
78
78
  <Box className={classes.fullWidthBox}>
79
79
  <Stepper activeStep={activeStep}>
80
80
  {steps.map((label, index) => {
@@ -97,9 +97,9 @@ export function ExploratoryStepper(props) {
97
97
  </Stepper>
98
98
  </Box>
99
99
  </Grid>
100
- <Grid item container xs={12} style={{ marginTop: '20px' }} alignItems="flex-start">
100
+ <Grid container size={12} sx={{ marginTop: '20px' }} alignItems="flex-start">
101
101
  {/* Step contents to left of cart */}
102
- <Grid item container xs={8}>
102
+ <Grid container size={8}>
103
103
  {activeStep === steps.length ? (
104
104
  <>
105
105
  <Typography style={{ marginTop: '20px', marginBottom: '10px' }}>
@@ -127,7 +127,7 @@ export function ExploratoryStepper(props) {
127
127
  )}
128
128
  </Grid>
129
129
  {/* Cart */}
130
- <Grid item container xs={4}>
130
+ <Grid container size={4}>
131
131
  <ConfirmatoryCart
132
132
  currentModalityAgnosticSelection={currentModalityAgnosticSelection}
133
133
  setCurrentModalityAgnosticSelection={setCurrentModalityAgnosticSelection}
package/src/styles.js CHANGED
@@ -1,6 +1,6 @@
1
- import { makeStyles } from '@material-ui/core';
1
+ import { makeStyles } from '@vitessce/styles';
2
2
 
3
- export const useStyles = makeStyles(() => ({
3
+ export const useStyles = makeStyles()(() => ({
4
4
  header: {
5
5
  marginTop: '10px',
6
6
  marginBottom: '10px',