@vitessce/layer-controller 3.1.1 → 3.1.3

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 (44) hide show
  1. package/dist/{deflate-806a8813.js → deflate-460ebda8.js} +1 -1
  2. package/dist/{index-f05b8dd7.js → index-7295e6e7.js} +561 -108
  3. package/dist/index.js +1 -1
  4. package/dist/{jpeg-ad5bae1d.js → jpeg-5e6a02ae.js} +1 -1
  5. package/dist/{lerc-588ff773.js → lerc-f147b9b3.js} +1 -1
  6. package/dist/{lzw-8827a384.js → lzw-328dcf22.js} +1 -1
  7. package/dist/{packbits-88aef591.js → packbits-d1842d12.js} +1 -1
  8. package/dist/{raw-86577f38.js → raw-e59a20ba.js} +1 -1
  9. package/dist/{webimage-c9cb4e30.js → webimage-30f949aa.js} +1 -1
  10. package/dist-tsc/BitmaskChannelController.d.ts.map +1 -1
  11. package/dist-tsc/BitmaskChannelController.js +1 -1
  12. package/dist-tsc/ChannelOptions.d.ts.map +1 -1
  13. package/dist-tsc/ChannelOptions.js +1 -1
  14. package/dist-tsc/ColorPalette.d.ts.map +1 -1
  15. package/dist-tsc/ColorPalette.js +1 -1
  16. package/dist-tsc/ImageAddButton.d.ts.map +1 -1
  17. package/dist-tsc/ImageAddButton.js +1 -1
  18. package/dist-tsc/LayerController.d.ts.map +1 -1
  19. package/dist-tsc/LayerController.js +6 -5
  20. package/dist-tsc/LayerOptions.d.ts.map +1 -1
  21. package/dist-tsc/LayerOptions.js +19 -13
  22. package/dist-tsc/RasterChannelController.d.ts.map +1 -1
  23. package/dist-tsc/RasterChannelController.js +6 -1
  24. package/dist-tsc/VectorLayerController.d.ts.map +1 -1
  25. package/dist-tsc/VectorLayerController.js +4 -1
  26. package/dist-tsc/VolumeOptions.d.ts.map +1 -1
  27. package/dist-tsc/VolumeOptions.js +3 -2
  28. package/dist-tsc/shared-channel-controls.d.ts.map +1 -1
  29. package/dist-tsc/shared-channel-controls.js +2 -2
  30. package/dist-tsc/styles.d.ts +1 -0
  31. package/dist-tsc/styles.d.ts.map +1 -1
  32. package/dist-tsc/styles.js +9 -0
  33. package/package.json +6 -6
  34. package/src/BitmaskChannelController.js +5 -1
  35. package/src/ChannelOptions.js +14 -3
  36. package/src/ColorPalette.js +2 -1
  37. package/src/ImageAddButton.js +1 -0
  38. package/src/LayerController.js +13 -4
  39. package/src/LayerOptions.js +39 -16
  40. package/src/RasterChannelController.js +11 -1
  41. package/src/VectorLayerController.js +10 -1
  42. package/src/VolumeOptions.js +5 -1
  43. package/src/shared-channel-controls.js +2 -0
  44. package/src/styles.js +10 -0
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, L, V } from "./index-f05b8dd7.js";
1
+ import { a, L, V } from "./index-7295e6e7.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f05b8dd7.js";
1
+ import { B as BaseDecoder } from "./index-7295e6e7.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-f05b8dd7.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-7295e6e7.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f05b8dd7.js";
1
+ import { B as BaseDecoder } from "./index-7295e6e7.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f05b8dd7.js";
1
+ import { B as BaseDecoder } from "./index-7295e6e7.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f05b8dd7.js";
1
+ import { B as BaseDecoder } from "./index-7295e6e7.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f05b8dd7.js";
1
+ import { B as BaseDecoder } from "./index-7295e6e7.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1 +1 @@
1
- {"version":3,"file":"BitmaskChannelController.d.ts","sourceRoot":"","sources":["../src/BitmaskChannelController.js"],"names":[],"mappings":";AAKA;;;;;;;;;GASG;AACH;;;;;;;;gBA4CC"}
1
+ {"version":3,"file":"BitmaskChannelController.d.ts","sourceRoot":"","sources":["../src/BitmaskChannelController.js"],"names":[],"mappings":";AAKA;;;;;;;;;GASG;AACH;;;;;;;;gBAgDC"}
@@ -25,6 +25,6 @@ function BitmaskChannelController({ visibility = false, dimName, channelOptions,
25
25
  * e.g { channel: 2 } // channel dimension, third channel
26
26
  */
27
27
  const createSelection = index => ({ [dimName]: index });
28
- return (_jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { item: true, xs: 2, children: _jsx(ChannelVisibilityCheckbox, { color: [220, 220, 220], checked: visibility, toggle: () => handlePropertyChange('visible', !visibility) }) }), _jsx(Grid, { item: true, xs: 9, children: _jsx(ChannelSelectionDropdown, { handleChange: v => handlePropertyChange('selection', createSelection(v)), selectionIndex: selectionIndex, disableOptions: disableOptions, channelOptions: channelOptions }) }), _jsx(Grid, { item: true, xs: 1, children: _jsx(IconButton, { onClick: handleChannelRemove, style: { padding: '6px 6px 6px 0px' }, children: _jsx(RemoveCircleIcon, {}) }) })] }));
28
+ return (_jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { item: true, xs: 2, children: _jsx(ChannelVisibilityCheckbox, { color: [220, 220, 220], checked: visibility, toggle: () => handlePropertyChange('visible', !visibility) }) }), _jsx(Grid, { item: true, xs: 9, children: _jsx(ChannelSelectionDropdown, { handleChange: v => handlePropertyChange('selection', createSelection(v)), selectionIndex: selectionIndex, disableOptions: disableOptions, channelOptions: channelOptions }) }), _jsx(Grid, { item: true, xs: 1, children: _jsx(IconButton, { onClick: handleChannelRemove, style: { padding: '6px 6px 6px 0px' }, "aria-label": "Remove channel", children: _jsx(RemoveCircleIcon, {}) }) })] }));
29
29
  }
30
30
  export default BitmaskChannelController;
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelOptions.d.ts","sourceRoot":"","sources":["../src/ChannelOptions.js"],"names":[],"mappings":";AAoBA;;;;;GAKG;AACH;;;;gBAgCC"}
1
+ {"version":3,"file":"ChannelOptions.d.ts","sourceRoot":"","sources":["../src/ChannelOptions.js"],"names":[],"mappings":";AAoBA;;;;;GAKG;AACH;;;;gBA2CC"}
@@ -33,6 +33,6 @@ function ChannelOptions({ handlePropertyChange, handleChannelRemove, handleIQRUp
33
33
  setOpen(false);
34
34
  handleChannelRemove();
35
35
  };
36
- return (_jsxs(PopperMenu, { open: open, setOpen: setOpen, buttonIcon: _jsx(MoreVertIcon, { fontSize: "small" }), buttonClassName: classes.menuButton, children: [_jsx(MenuItem, { dense: true, disableGutters: true, onClick: handleRemove, children: _jsx(MuiSpan, { children: "Remove" }) }), _jsx(MenuItem, { dense: true, disableGutters: true, onClick: handleIQRUpdate, children: _jsx(MuiSpan, { children: "Use IQR" }) }), _jsx(MenuItem, { dense: true, disableGutters: true, className: classes.colors, children: _jsx(ColorPalette, { handleChange: handleColorSelect }) })] }));
36
+ return (_jsxs(PopperMenu, { open: open, setOpen: setOpen, buttonIcon: _jsx(MoreVertIcon, { fontSize: "small" }), buttonClassName: classes.menuButton, "aria-label": "Open channel options menu", children: [_jsx(MenuItem, { dense: true, disableGutters: true, onClick: handleRemove, "aria-label": "Click to remove channel", children: _jsx(MuiSpan, { children: "Remove" }) }), _jsx(MenuItem, { dense: true, disableGutters: true, onClick: handleIQRUpdate, "aria-label": "Click to use IQR for channel", children: _jsx(MuiSpan, { children: "Use IQR" }) }), _jsx(MenuItem, { dense: true, disableGutters: true, className: classes.colors, "aria-label": "Click to select color for channel", children: _jsx(ColorPalette, { handleChange: handleColorSelect }) })] }));
37
37
  }
38
38
  export default ChannelOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPalette.d.ts","sourceRoot":"","sources":["../src/ColorPalette.js"],"names":[],"mappings":";AA0BA;;gBAmBC"}
1
+ {"version":3,"file":"ColorPalette.d.ts","sourceRoot":"","sources":["../src/ColorPalette.js"],"names":[],"mappings":";AA0BA;;gBAoBC"}
@@ -25,6 +25,6 @@ const useStyles = makeStyles(theme => ({
25
25
  }));
26
26
  const ColorPalette = ({ handleChange }) => {
27
27
  const classes = useStyles();
28
- return (_jsx("div", { className: classes.paletteContainer, "aria-label": "color-swatch", children: VIEWER_PALETTE.map(color => (_jsx(IconButton, { className: classes.button, onClick: () => handleChange(color), children: _jsx(LensIcon, { fontSize: "small", style: { color: `rgb(${color})` }, className: classes.icon }) }, color))) }));
28
+ return (_jsx("div", { className: classes.paletteContainer, "aria-label": "Color swatch", children: VIEWER_PALETTE.map(color => (_jsx(IconButton, { className: classes.button, onClick: () => handleChange(color), "aria-label": `Change color to ${color}`, children: _jsx(LensIcon, { fontSize: "small", style: { color: `rgb(${color})` }, className: classes.icon }) }, color))) }));
29
29
  };
30
30
  export default ColorPalette;
@@ -1 +1 @@
1
- {"version":3,"file":"ImageAddButton.d.ts","sourceRoot":"","sources":["../src/ImageAddButton.js"],"names":[],"mappings":";AAsBA;;;uBAyBC"}
1
+ {"version":3,"file":"ImageAddButton.d.ts","sourceRoot":"","sources":["../src/ImageAddButton.js"],"names":[],"mappings":";AAsBA;;;uBA0BC"}
@@ -22,6 +22,6 @@ function ImageAddButton({ imageOptions, handleImageAdd }) {
22
22
  };
23
23
  if (!imageOptions)
24
24
  return null;
25
- return (_jsx(PopperMenu, { open: open, setOpen: setOpen, buttonIcon: _jsx(ImageAddIcon, {}), buttonClassName: classes.addButton, placement: "bottom-start", children: imageOptions.map((imgData, i) => (_jsx(MenuItem, { dense: true, onClick: () => handleAdd(i), children: _jsx("span", { children: imgData.name }) }, imgData.name))) }));
25
+ return (_jsx(PopperMenu, { open: open, setOpen: setOpen, buttonIcon: _jsx(ImageAddIcon, {}), buttonClassName: classes.addButton, placement: "bottom-start", "aria-label": "Add image menu", children: imageOptions.map((imgData, i) => (_jsx(MenuItem, { dense: true, onClick: () => handleAdd(i), children: _jsx("span", { children: imgData.name }) }, imgData.name))) }));
26
26
  }
27
27
  export default ImageAddButton;
@@ -1 +1 @@
1
- {"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"AA2EA;;;;;;;GAOG;AACH,iEA8gBC"}
1
+ {"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"AA2EA;;;;;;;GAOG;AACH,iEAuhBC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { useState, useRef, useEffect } from 'react';
2
+ import React, { useState, useRef, useEffect, useId } from 'react';
3
3
  import { viv } from '@vitessce/gl';
4
4
  import { GLOBAL_LABELS, getSourceFromLoader, isRgb, } from '@vitessce/spatial-utils';
5
5
  import { Grid, Button, Slider, Tabs, Tab, InputLabel, Accordion, AccordionDetails, AccordionSummary, } from '@material-ui/core';
@@ -57,6 +57,7 @@ export default function LayerController(props) {
57
57
  channelRef.current = channels;
58
58
  return undefined;
59
59
  }, [channels]);
60
+ const layerControlsId = useId();
60
61
  const firstSelection = channels[0]?.selection || {};
61
62
  const { data, channels: channelOptions } = loader;
62
63
  const [tab, setTab] = useState(0);
@@ -280,12 +281,12 @@ export default function LayerController(props) {
280
281
  ? null
281
282
  : channelControllers, isRgb(loader, channels) && disableChannelsIfRgbDetected ? null : (_jsx(Button, { disabled: channels.length === viv.MAX_CHANNELS, onClick: handleChannelAdd, fullWidth: true, variant: "outlined", style: buttonStyles, startIcon: _jsx(AddIcon, {}), size: "small", children: "Add Channel" }))] }));
282
283
  return (_jsxs(Accordion, { className: controllerSectionClasses.layerControllerRoot, onChange: (e, expanded) => !disabled
283
- && setIsExpanded(expanded && e?.target?.attributes?.role?.value === 'presentation'), TransitionProps: { enter: false }, expanded: !disabled && isExpanded, children: [_jsx(AccordionSummary, { classes: {
284
+ && setIsExpanded(expanded && e?.target?.attributes?.role?.value === 'presentation'), TransitionProps: { enter: false }, expanded: !disabled && isExpanded, id: `layer-controls-accordion-${layerControlsId}`, children: [_jsx(AccordionSummary, { classes: {
284
285
  root: accordionClasses.accordionSummaryRoot,
285
286
  content: accordionClasses.content,
286
287
  expanded: accordionClasses.expanded,
287
288
  expandIcon: accordionClasses.expandIcon,
288
- }, expandIcon: _jsx(ExpandMoreIcon, { role: "presentation" }), "aria-controls": `layer-${name}-controls`, children: _jsxs(Grid, { container: true, direction: "column", m: 1, justifyContent: "center", children: [_jsxs(Grid, { item: true, classes: { item: overflowEllipsisGridClasses.item }, children: [_jsx(Button, { onClick: (e) => {
289
+ }, expandIcon: _jsx(ExpandMoreIcon, { role: "presentation" }), "aria-controls": `layer-${name}-controls`, "aria-expanded": isExpanded, children: _jsxs(Grid, { container: true, direction: "column", m: 1, justifyContent: "center", children: [_jsxs(Grid, { item: true, classes: { item: overflowEllipsisGridClasses.item }, children: [_jsx(Button, { "aria-label": "Toggle layer visibility", onClick: (e) => {
289
290
  if (!disabled) {
290
291
  // Needed to prevent affecting the expansion panel from changing
291
292
  e.stopPropagation();
@@ -297,12 +298,12 @@ export default function LayerController(props) {
297
298
  marginBottom: 2,
298
299
  padding: 0,
299
300
  minWidth: 0,
300
- }, children: _jsx(Visibility, {}) }), name] }), !disabled && !isExpanded && !use3d && (_jsxs(Grid, { container: true, direction: "row", alignItems: "center", justifyContent: "center", children: [_jsx(Grid, { item: true, xs: 6, children: _jsx(InputLabel, { htmlFor: `layer-${name}-opacity-closed`, classes: { root: inputLabelClasses.inputLabelRoot }, children: "Opacity:" }) }), _jsx(Grid, { item: true, xs: 6, children: _jsx(Slider, { id: `layer-${name}-opacity-closed`, value: opacity, onChange: (e, v) => setOpacity(v), valueLabelDisplay: "auto", getAriaLabel: () => 'opacity slider', min: 0, max: 1, step: 0.01, orientation: "horizontal" }) })] }))] }) }), _jsxs(AccordionDetails, { classes: { root: accordionClasses.accordionDetailsRoot }, children: [useVolumeTabs ? (_jsxs(_Fragment, { children: [_jsxs(Tabs, { value: tab, onChange: handleTabChange, "aria-label": "simple tabs example", style: { height: '24px', minHeight: '24px' }, children: [_jsx(Tab, { label: "Channels", style: {
301
+ }, children: _jsx(Visibility, {}) }), name] }), !disabled && !isExpanded && !use3d && (_jsxs(Grid, { container: true, direction: "row", alignItems: "center", justifyContent: "center", children: [_jsx(Grid, { item: true, xs: 6, children: _jsx(InputLabel, { htmlFor: `layer-${name}-opacity-closed`, classes: { root: inputLabelClasses.inputLabelRoot }, children: "Opacity:" }) }), _jsx(Grid, { item: true, xs: 6, children: _jsx(Slider, { id: `layer-${name}-opacity-closed`, value: opacity, onChange: (e, v) => setOpacity(v), valueLabelDisplay: "auto", "aria-label": `Adjust opacity for layer ${name}`, min: 0, max: 1, step: 0.01, orientation: "horizontal" }) })] }))] }) }), _jsxs(AccordionDetails, { classes: { root: accordionClasses.accordionDetailsRoot }, id: `layer-${name}-controls`, children: [useVolumeTabs ? (_jsxs(_Fragment, { children: [_jsxs(Tabs, { value: tab, onChange: handleTabChange, "aria-label": "Change the layer tab type", style: { height: '24px', minHeight: '24px' }, children: [_jsx(Tab, { label: "Channels", "aria-label": "Channels tab", style: {
301
302
  fontSize: '.75rem',
302
303
  bottom: 12,
303
304
  width: '50%',
304
305
  minWidth: '50%',
305
- }, disableRipple: true }), _jsx(Tab, { label: "Volume", style: {
306
+ }, disableRipple: true }), _jsx(Tab, { label: "Volume", "aria-label": "Volume tab", style: {
306
307
  fontSize: '.75rem',
307
308
  bottom: 12,
308
309
  width: '50%',
@@ -1 +1 @@
1
- {"version":3,"file":"LayerOptions.d.ts","sourceRoot":"","sources":["../src/LayerOptions.js"],"names":[],"mappings":";AAgUA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA4HC"}
1
+ {"version":3,"file":"LayerOptions.d.ts","sourceRoot":"","sources":["../src/LayerOptions.js"],"names":[],"mappings":";AA0UA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyIC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React from 'react';
2
+ import React, { useId } from 'react';
3
3
  import { range } from 'lodash-es';
4
4
  import { Matrix4 } from 'math.gl';
5
5
  import { Grid, Slider, InputLabel, Select, Checkbox } from '@material-ui/core';
@@ -7,7 +7,7 @@ import { viv } from '@vitessce/gl';
7
7
  import { DEFAULT_RASTER_DOMAIN_TYPE } from '@vitessce/spatial-utils';
8
8
  import { COLORMAP_OPTIONS, canLoadResolution, formatBytes, getStatsForResolution, } from '@vitessce/utils';
9
9
  import { getBoundingCube, getMultiSelectionStats, } from './utils.js';
10
- import { useSelectionSliderStyles, useSelectStyles } from './styles.js';
10
+ import { useSelectionSliderStyles, useSelectStyles, useChannelSliderStyles } from './styles.js';
11
11
  const DOMAIN_OPTIONS = ['Full', 'Min/Max'];
12
12
  /**
13
13
  * Wrapper for the dropdown that selects a colormap (None, viridis, magma, etc.).
@@ -94,7 +94,7 @@ function VolumeDropdown({ loader: loaderWithMeta, handleMultiPropertyChange, res
94
94
  };
95
95
  const { labels, shape } = Array.isArray(loader) ? loader[0] : loader;
96
96
  const hasZStack = shape[labels.indexOf('z')] > 1;
97
- return (_jsx(_Fragment, { children: _jsxs(Select, { native: true, value: currResolution, onChange: e => handleChange(e.target.value === '2D' ? e.target.value : Number(e.target.value)), classes: { root: classes.selectRoot }, children: [_jsx("option", { value: "2D", children: "2D Visualization" }, "2D"), Array.from({ length: loader.length })
97
+ return (_jsx(_Fragment, { children: _jsxs(Select, { native: true, value: currResolution, onChange: e => handleChange(e.target.value === '2D' ? e.target.value : Number(e.target.value)), inputProps: { 'aria-label': 'Resolution selector' }, classes: { root: classes.selectRoot }, children: [_jsx("option", { value: "2D", children: "2D Visualization" }, "2D"), Array.from({ length: loader.length })
98
98
  .fill(0)
99
99
  // eslint-disable-next-line no-unused-vars
100
100
  .map((_, resolution) => {
@@ -116,9 +116,9 @@ function VolumeDropdown({ loader: loaderWithMeta, handleMultiPropertyChange, res
116
116
  */
117
117
  function ColormapSelect({ value, inputId, handleChange }) {
118
118
  const classes = useSelectStyles();
119
- return (_jsxs(Select, { native: true, onChange: e => handleChange(e.target.value === '' ? null : e.target.value), value: value, inputProps: { name: 'colormap', id: inputId }, style: { width: '100%' }, classes: { root: classes.selectRoot }, children: [_jsx("option", { "aria-label": "None", value: "", children: "None" }), COLORMAP_OPTIONS.map(name => (_jsx("option", { value: name, children: name }, name)))] }));
119
+ return (_jsxs(Select, { native: true, onChange: e => handleChange(e.target.value === '' ? null : e.target.value), value: value, inputProps: { name: 'colormap', id: inputId, 'aria-label': 'Colormap selector' }, style: { width: '100%' }, classes: { root: classes.selectRoot }, children: [_jsx("option", { "aria-label": "None", value: "", children: "None" }), COLORMAP_OPTIONS.map(name => (_jsx("option", { value: name, children: name }, name)))] }));
120
120
  }
121
- function TransparentColorCheckbox({ value, handleChange }) {
121
+ function TransparentColorCheckbox({ value, inputId, handleChange }) {
122
122
  return (_jsx(Checkbox, { style: { float: 'left', padding: 0 }, color: "default", onChange: () => {
123
123
  if (value) {
124
124
  handleChange(null);
@@ -126,15 +126,16 @@ function TransparentColorCheckbox({ value, handleChange }) {
126
126
  else {
127
127
  handleChange([0, 0, 0]);
128
128
  }
129
- }, checked: Boolean(value) }));
129
+ }, checked: Boolean(value), id: inputId, inputProps: { 'aria-label': 'Enable or disable color transparency' } }));
130
130
  }
131
131
  /**
132
132
  * Wrapper for the slider that updates opacity.
133
133
  * @prop {string} value Currently selected value between 0 and 1.
134
134
  * @prop {function} handleChange Callback for every change in opacity.
135
135
  */
136
- function OpacitySlider({ value, handleChange }) {
137
- return (_jsx(Slider, { value: value, onChange: (e, v) => handleChange(v), valueLabelDisplay: "auto", getAriaLabel: () => 'opacity slider', min: 0, max: 1, step: 0.01, orientation: "horizontal", style: { marginTop: '7px' } }));
136
+ function OpacitySlider({ value, inputId, handleChange }) {
137
+ const classes = useChannelSliderStyles();
138
+ return (_jsx(Slider, { classes: { valueLabel: classes.valueLabel }, value: value, onChange: (e, v) => handleChange(v), valueLabelDisplay: "auto", "aria-label": "Layer opacity slider", id: inputId, min: 0, max: 1, step: 0.01, orientation: "horizontal" }));
138
139
  }
139
140
  /**
140
141
  * Wrapper for the dropdown that chooses the domain type.
@@ -144,7 +145,7 @@ function OpacitySlider({ value, handleChange }) {
144
145
  */
145
146
  function SliderDomainSelector({ value, inputId, handleChange }) {
146
147
  const classes = useSelectStyles();
147
- return (_jsx(Select, { native: true, onChange: e => handleChange(e.target.value), value: value, inputProps: { name: 'domain-selector', id: inputId }, style: { width: '100%' }, classes: { root: classes.selectRoot }, children: DOMAIN_OPTIONS.map(name => (_jsx("option", { value: name, children: name }, name))) }));
148
+ return (_jsx(Select, { native: true, onChange: e => handleChange(e.target.value), value: value, id: inputId, inputProps: { name: 'domain-selector', 'aria-label': 'Domain type selector' }, style: { width: '100%' }, classes: { root: classes.selectRoot }, children: DOMAIN_OPTIONS.map(name => (_jsx("option", { value: name, children: name }, name))) }));
148
149
  }
149
150
  /**
150
151
  * Wrapper for the slider that chooses global selections (z, t etc.).
@@ -153,7 +154,7 @@ function SliderDomainSelector({ value, inputId, handleChange }) {
153
154
  * @prop {function} handleChange Callback for every change in selection.
154
155
  * @prop {function} possibleValues All available values for the field.
155
156
  */
156
- function GlobalSelectionSlider({ field, value, handleChange, possibleValues, }) {
157
+ function GlobalSelectionSlider({ field, value, inputId, handleChange, possibleValues, }) {
157
158
  const classes = useSelectionSliderStyles();
158
159
  return (_jsx(Slider, { classes: { root: classes.selectionSliderRoot, markActive: classes.markActive }, value: value,
159
160
  // See https://github.com/hms-dbmi/viv/issues/176 for why
@@ -162,7 +163,7 @@ function GlobalSelectionSlider({ field, value, handleChange, possibleValues, })
162
163
  handleChange({ selection: { [field]: newValue }, event });
163
164
  }, onChangeCommitted: (event, newValue) => {
164
165
  handleChange({ selection: { [field]: newValue }, event });
165
- }, valueLabelDisplay: "auto", getAriaLabel: () => `${field} slider`, marks: possibleValues.map(val => ({ value: val })), min: Number(possibleValues[0]), max: Number(possibleValues.slice(-1)), orientation: "horizontal", step: null }));
166
+ }, valueLabelDisplay: "auto", "aria-label": `${field} slider`, id: inputId, marks: possibleValues.map(val => ({ value: val })), min: Number(possibleValues[0]), max: Number(possibleValues.slice(-1)), orientation: "horizontal", step: null }));
166
167
  }
167
168
  /**
168
169
  * Wrapper for each of the options to show its name and then its UI component.
@@ -196,13 +197,18 @@ function LayerOptions({ colormap, opacity, handleColormapChange, handleOpacityCh
196
197
  const hasViewableResolutions = Boolean(Array.from({
197
198
  length: loader.data.length,
198
199
  }).filter((_, res) => canLoadResolution(loader.data, res)).length);
200
+ const globalSelectionSliderId = useId();
201
+ const colormapSelectId = useId();
202
+ const domainSelectorId = useId();
203
+ const opacitySliderId = useId();
204
+ const zeroTransparentId = useId();
199
205
  return (_jsxs(Grid, { container: true, direction: "column", style: { width: '100%' }, children: [hasZStack
200
206
  && !disable3d
201
207
  && hasViewableResolutions
202
208
  && (_jsx(VolumeDropdown, { loader: loader, handleSliderChange: handleSliderChange, handleDomainChange: handleDomainChange, channels: channels, handleMultiPropertyChange: handleMultiPropertyChange, resolution: resolution, disable3d: disable3d, setRasterLayerCallback: setRasterLayerCallback, setAreAllChannelsLoading: setAreAllChannelsLoading, setViewState: setViewState, spatialHeight: spatialHeight, spatialWidth: spatialWidth, use3d: use3d, modelMatrix: modelMatrix })), hasDimensionsAndChannels
203
209
  && !use3d
204
- && globalControlLabels.map(field => shape[labels.indexOf(field)] > 1 && (_jsx(LayerOption, { name: field, inputId: `${field}-slider`, children: _jsx(GlobalSelectionSlider, { field: field, value: globalLabelValues[field], handleChange: handleGlobalChannelsSelectionChange, possibleValues: range(shape[labels.indexOf(field)]) }) }, field))), !disableChannelsIfRgbDetected ? (_jsxs(_Fragment, { children: [shouldShowColormap && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Colormap", inputId: "colormap-select", children: _jsx(ColormapSelect, { value: colormap || '', inputId: "colormap-select", handleChange: handleColormapChange }) }) })), shouldShowDomain && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Domain", inputId: "domain-selector", children: _jsx(SliderDomainSelector, { value: domainType || DEFAULT_RASTER_DOMAIN_TYPE, handleChange: (value) => {
210
+ && globalControlLabels.map(field => shape[labels.indexOf(field)] > 1 && (_jsx(LayerOption, { name: field, inputId: `${field}-${globalSelectionSliderId}`, children: _jsx(GlobalSelectionSlider, { field: field, inputId: `${field}-${globalSelectionSliderId}`, value: globalLabelValues[field], handleChange: handleGlobalChannelsSelectionChange, possibleValues: range(shape[labels.indexOf(field)]) }) }, field))), !disableChannelsIfRgbDetected ? (_jsxs(_Fragment, { children: [shouldShowColormap && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Colormap", inputId: colormapSelectId, children: _jsx(ColormapSelect, { value: colormap || '', inputId: colormapSelectId, handleChange: handleColormapChange }) }) })), shouldShowDomain && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Domain", inputId: domainSelectorId, children: _jsx(SliderDomainSelector, { value: domainType || DEFAULT_RASTER_DOMAIN_TYPE, inputId: domainSelectorId, handleChange: (value) => {
205
211
  handleDomainChange(value);
206
- } }) }) }))] })) : null, !use3d && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Opacity", inputId: "opacity-slider", children: _jsx(OpacitySlider, { value: opacity, handleChange: handleOpacityChange }) }) })), shouldShowTransparentColor && !use3d && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Zero Transparent", inputId: "transparent-color-selector", children: _jsx(TransparentColorCheckbox, { value: transparentColor, handleChange: handleTransparentColorChange }) }) }))] }));
212
+ } }) }) }))] })) : null, !use3d && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Opacity", inputId: opacitySliderId, children: _jsx(OpacitySlider, { value: opacity, handleChange: handleOpacityChange, inputId: opacitySliderId }) }) })), shouldShowTransparentColor && !use3d && (_jsx(Grid, { item: true, children: _jsx(LayerOption, { name: "Zero Transparent", inputId: zeroTransparentId, children: _jsx(TransparentColorCheckbox, { value: transparentColor, handleChange: handleTransparentColorChange, inputId: zeroTransparentId }) }) }))] }));
207
213
  }
208
214
  export default LayerOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"RasterChannelController.d.ts","sourceRoot":"","sources":["../src/RasterChannelController.js"],"names":[],"mappings":";AAqFA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;gBA+IC"}
1
+ {"version":3,"file":"RasterChannelController.d.ts","sourceRoot":"","sources":["../src/RasterChannelController.js"],"names":[],"mappings":";AA8FA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;gBAgJC"}
@@ -7,6 +7,7 @@ import ChannelOptions from './ChannelOptions.js';
7
7
  import { DOMAINS } from './constants.js';
8
8
  import { getMultiSelectionStats, toRgbUIString } from './utils.js';
9
9
  import { ChannelSelectionDropdown, ChannelVisibilityCheckbox, } from './shared-channel-controls.js';
10
+ import { useChannelSliderStyles } from './styles.js';
10
11
  function abbreviateNumber(value) {
11
12
  // Return an abbreviated representation of value, in 5 characters or less.
12
13
  const maxLength = 5;
@@ -46,8 +47,12 @@ function ChannelSlider({ color, slider = [0, 0], handleChange, domain = [0, 0],
46
47
  sliderCopy[1] = max;
47
48
  }
48
49
  const handleChangeDebounced = useCallback(debounce(handleChange, 3, { trailing: true }), [handleChange]);
50
+ const classes = useChannelSliderStyles();
49
51
  const step = max - min < 500 && dtype.startsWith('Float') ? (max - min) / 500 : 1;
50
- return (_jsx(Slider, { value: slider, valueLabelFormat: abbreviateNumber, onChange: (e, v) => handleChangeDebounced(v), valueLabelDisplay: "auto", getAriaLabel: () => `${color}-${slider}`, min: min, max: max, step: step, orientation: "horizontal", style: { color, marginTop: '7px' }, disabled: disabled }));
52
+ return (_jsx(Slider, { classes: { valueLabel: classes.valueLabel }, value: slider, valueLabelFormat: abbreviateNumber, onChange: (e, v) => handleChangeDebounced(v), valueLabelDisplay: "auto", getAriaLabel: (index) => {
53
+ const labelPrefix = index === 0 ? 'Low value slider' : 'High value slider';
54
+ return `${labelPrefix} for ${color} colormap channel`;
55
+ }, getAriaValueText: () => `Current colormap values: ${color}-${slider}`, min: min, max: max, step: step, orientation: "horizontal", style: { color, marginTop: '7px' }, disabled: disabled }));
51
56
  }
52
57
  /**
53
58
  * Controller for the handling the colormapping sliders.
@@ -1 +1 @@
1
- {"version":3,"file":"VectorLayerController.d.ts","sourceRoot":"","sources":["../src/VectorLayerController.js"],"names":[],"mappings":"AAKA,uEAuDC"}
1
+ {"version":3,"file":"VectorLayerController.d.ts","sourceRoot":"","sources":["../src/VectorLayerController.js"],"names":[],"mappings":"AAKA,uEAgEC"}
@@ -22,5 +22,8 @@ export default function VectorLayerController(props) {
22
22
  return (_jsx(Grid, { item: true, style: { marginTop: '10px' }, children: _jsxs(Paper, { className: classes.layerControllerRoot, children: [_jsx(Typography, { style: {
23
23
  padding: '15px 8px 0px 8px',
24
24
  marginBottom: '-5px',
25
- }, children: label }), _jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { item: true, xs: 2, children: _jsx(Checkbox, { color: "primary", checked: isOn, onChange: (e, v) => handleCheckBoxChange(v) }) }), _jsx(Grid, { item: true, xs: 9, style: { paddingRight: '8px' }, children: _jsx(Slider, { value: slider, min: 0, max: 1, step: 0.001, onChange: (e, v) => handleSliderChange(v), style: { marginTop: '7px' }, orientation: "horizontal" }) })] })] }) }));
25
+ }, children: label }), _jsxs(Grid, { container: true, direction: "row", justifyContent: "space-between", children: [_jsx(Grid, { item: true, xs: 2, children: _jsx(Checkbox, { color: "primary", checked: isOn, onChange: (e, v) => handleCheckBoxChange(v), inputProps: { 'aria-label': 'Show or hide vector layer' } }) }), _jsx(Grid, { item: true, xs: 9, style: { paddingRight: '8px' }, children: _jsx(Slider, { value: slider, min: 0, max: 1, step: 0.001, onChange: (e, v) => handleSliderChange(v), style: { marginTop: '7px' }, orientation: "horizontal", getAriaLabel: (index) => {
26
+ const labelPrefix = index === 0 ? 'Low value slider' : 'High value slider';
27
+ return `${labelPrefix} for ${label} layer controller`;
28
+ } }) })] })] }) }));
26
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"VolumeOptions.d.ts","sourceRoot":"","sources":["../src/VolumeOptions.js"],"names":[],"mappings":";AAqLA;;;;;;;;;;;;;gBAqCC"}
1
+ {"version":3,"file":"VolumeOptions.d.ts","sourceRoot":"","sources":["../src/VolumeOptions.js"],"names":[],"mappings":";AAyLA;;;;;;;;;;;;;gBAqCC"}
@@ -43,8 +43,8 @@ const Slicer = ({ xSlice, ySlice, zSlice, handleSlicerSetting, loader, use3d, })
43
43
  ],
44
44
  ];
45
45
  const classes = useSlicerStyles();
46
- const Slicers = sliceValuesAndSetSliceFunctions.map(([val, setVal, label, [min, max]]) => (_jsxs(Grid, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [_jsx(Grid, { item: true, xs: 1, children: _jsxs(Typography, { className: !use3d ? classes.disabled : classes.enabled, style: { marginBottom: 0 }, children: [label, ":"] }) }), _jsx(Grid, { item: true, xs: 11, children: _jsx(Slider, { disabled: !use3d, className: !use3d ? classes.disabled : classes.enabled, value: val, onChange: (e, v) => setVal(v), valueLabelDisplay: "auto", valueLabelFormat: v => abbreviateNumber(v), getAriaLabel: () => `${label} slider`, min: min, max: max, step: 0.005, orientation: "horizontal" }) })] }, label)));
47
- return (_jsxs(_Fragment, { children: [_jsxs(Typography, { className: !use3d ? classes.disabled : classes.enabled, style: { marginTop: 16, marginBottom: 0 }, children: ["Clipping Planes:", ' '] }), ' ', Slicers] }));
46
+ const Slicers = sliceValuesAndSetSliceFunctions.map(([val, setVal, label, [min, max]]) => (_jsxs(Grid, { container: true, direction: "row", justifyContent: "flex-start", alignItems: "center", children: [_jsx(Grid, { item: true, xs: 1, children: _jsxs(Typography, { className: !use3d ? classes.disabled : classes.enabled, style: { marginBottom: 0 }, variant: "h2", children: [label, ":"] }) }), _jsx(Grid, { item: true, xs: 11, children: _jsx(Slider, { disabled: !use3d, className: !use3d ? classes.disabled : classes.enabled, value: val, onChange: (e, v) => setVal(v), valueLabelDisplay: "auto", valueLabelFormat: v => abbreviateNumber(v), "aria-label": `Volume options ${label} slider`, min: min, max: max, step: 0.005, orientation: "horizontal" }) })] }, label)));
47
+ return (_jsxs(_Fragment, { children: [_jsxs(Typography, { className: !use3d ? classes.disabled : classes.enabled, style: { marginTop: 16, marginBottom: 0 }, variant: "h2", children: ["Clipping Planes:", ' '] }), ' ', Slicers] }));
48
48
  };
49
49
  const renderingOptions = Object.values(viv.RENDERING_MODES);
50
50
  function RenderingModeSelect({ handleRenderingModeChange, renderingMode, use3d, }) {
@@ -54,6 +54,7 @@ function RenderingModeSelect({ handleRenderingModeChange, renderingMode, use3d,
54
54
  return (_jsxs(FormControl, { fullWidth: true, children: [_jsx(InputLabel, { htmlFor: "rendering-mode-select", children: "Rendering Mode" }), _jsx(Select, { native: true, onChange: e => handleRenderingModeChange(e.target.value), value: use3d ? renderingMode : '', inputProps: {
55
55
  name: 'rendering-mode',
56
56
  id: 'rendering-mode-select',
57
+ 'aria-label': 'Select rendering mode option',
57
58
  }, disabled: !use3d, classes: { root: classes.selectRoot }, children: options.map(name => (_jsx("option", { value: name, children: name }, name))) })] }));
58
59
  }
59
60
  const ReCenterButton = ({ setViewState, use3d, spatialHeight, spatialWidth, loader, modelMatrix, }) => (_jsx(Grid, { item: true, xs: "auto", children: _jsx(Button, { onClick: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"shared-channel-controls.d.ts","sourceRoot":"","sources":["../src/shared-channel-controls.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH;;;;;gBAqBC;AAED;;;;;;GAMG;AACH;;;;;gBAWC"}
1
+ {"version":3,"file":"shared-channel-controls.d.ts","sourceRoot":"","sources":["../src/shared-channel-controls.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH;;;;;gBAsBC;AAED;;;;;;GAMG;AACH;;;;;gBAYC"}
@@ -11,7 +11,7 @@ import { useSelectStyles } from './styles.js';
11
11
  */
12
12
  export function ChannelSelectionDropdown({ handleChange, disabled, channelOptions, selectionIndex, }) {
13
13
  const classes = useSelectStyles();
14
- return (_jsx(Select, { classes: { root: classes.selectRoot }, native: true, value: selectionIndex, onChange: e => handleChange(Number(e.target.value)), children: channelOptions.map((opt, i) => (_jsx("option", { disabled: disabled, value: i, children: opt }, opt))) }));
14
+ return (_jsx(Select, { classes: { root: classes.selectRoot }, native: true, value: selectionIndex, onChange: e => handleChange(Number(e.target.value)), inputProps: { 'aria-label': 'Select a channel' }, children: channelOptions.map((opt, i) => (_jsx("option", { disabled: disabled, value: i, children: opt }, opt))) }));
15
15
  }
16
16
  /**
17
17
  * Checkbox for toggling on/off of a channel.
@@ -21,5 +21,5 @@ export function ChannelSelectionDropdown({ handleChange, disabled, channelOption
21
21
  * @prop {function} toggle Callback for toggling on/off.
22
22
  */
23
23
  export function ChannelVisibilityCheckbox({ color, checked, toggle, disabled, }) {
24
- return (_jsx(Checkbox, { onChange: toggle, checked: checked, disabled: disabled, style: { color, '&$checked': { color } } }));
24
+ return (_jsx(Checkbox, { onChange: toggle, checked: checked, disabled: disabled, style: { color, '&$checked': { color } }, inputProps: { 'aria-label': 'Toggle on or off a channel' } }));
25
25
  }
@@ -1,4 +1,5 @@
1
1
  export function MuiSpan(props: any): import(".pnpm/@types+react@18.2.7/node_modules/@types/react").JSX.Element;
2
+ export const useChannelSliderStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"valueLabel">;
2
3
  export const useSelectStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"selectRoot">;
3
4
  export const useControllerSectionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"layerControllerRoot">;
4
5
  export const useAccordionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<never>;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.js"],"names":[],"mappings":"AAWA,+GAIC;AAED,wHAMI;AAOJ,4IAKI;AAEJ,oHAqBI;AAEJ,gIAII;AAEJ,gIAOI;AAEJ,yJAOI"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.js"],"names":[],"mappings":"AAqBA,+GAIC;AAdD,+HAQI;AAQJ,wHAMI;AAOJ,4IAKI;AAEJ,oHAqBI;AAEJ,gIAII;AAEJ,gIAOI;AAEJ,yJAOI"}
@@ -8,6 +8,15 @@ const useSpanStyles = makeStyles(() => ({
8
8
  paddingRight: '2px',
9
9
  },
10
10
  }));
11
+ export const useChannelSliderStyles = makeStyles(theme => ({
12
+ valueLabel: {
13
+ marginTop: '7px',
14
+ '& span': {
15
+ color: theme.palette.secondaryForeground,
16
+ backgroundColor: theme.palette.secondaryBackgroundDim, // Change color here
17
+ },
18
+ },
19
+ }));
11
20
  export function MuiSpan(props) {
12
21
  const { children } = props;
13
22
  const classes = useSpanStyles();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/layer-controller",
3
- "version": "3.1.1",
3
+ "version": "3.1.3",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,11 +20,11 @@
20
20
  "@material-ui/icons": "~4.11.2",
21
21
  "lodash-es": "^4.17.21",
22
22
  "math.gl": "^3.5.6",
23
- "@vitessce/constants-internal": "3.1.1",
24
- "@vitessce/gl": "3.1.1",
25
- "@vitessce/spatial-utils": "3.1.1",
26
- "@vitessce/utils": "3.1.1",
27
- "@vitessce/vit-s": "3.1.1"
23
+ "@vitessce/constants-internal": "3.1.3",
24
+ "@vitessce/spatial-utils": "3.1.3",
25
+ "@vitessce/utils": "3.1.3",
26
+ "@vitessce/gl": "3.1.3",
27
+ "@vitessce/vit-s": "3.1.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "react": "^18.0.0",
@@ -51,7 +51,11 @@ function BitmaskChannelController({
51
51
  />
52
52
  </Grid>
53
53
  <Grid item xs={1}>
54
- <IconButton onClick={handleChannelRemove} style={{ padding: '6px 6px 6px 0px' }}>
54
+ <IconButton
55
+ onClick={handleChannelRemove}
56
+ style={{ padding: '6px 6px 6px 0px' }}
57
+ aria-label="Remove channel"
58
+ >
55
59
  <RemoveCircleIcon />
56
60
  </IconButton>
57
61
  </Grid>
@@ -44,14 +44,25 @@ function ChannelOptions({ handlePropertyChange, handleChannelRemove, handleIQRUp
44
44
  setOpen={setOpen}
45
45
  buttonIcon={<MoreVertIcon fontSize="small" />}
46
46
  buttonClassName={classes.menuButton}
47
+ aria-label="Open channel options menu"
47
48
  >
48
- <MenuItem dense disableGutters onClick={handleRemove}>
49
+ <MenuItem dense disableGutters onClick={handleRemove} aria-label="Click to remove channel">
49
50
  <MuiSpan>Remove</MuiSpan>
50
51
  </MenuItem>
51
- <MenuItem dense disableGutters onClick={handleIQRUpdate}>
52
+ <MenuItem
53
+ dense
54
+ disableGutters
55
+ onClick={handleIQRUpdate}
56
+ aria-label="Click to use IQR for channel"
57
+ >
52
58
  <MuiSpan>Use IQR</MuiSpan>
53
59
  </MenuItem>
54
- <MenuItem dense disableGutters className={classes.colors}>
60
+ <MenuItem
61
+ dense
62
+ disableGutters
63
+ className={classes.colors}
64
+ aria-label="Click to select color for channel"
65
+ >
55
66
  <ColorPalette handleChange={handleColorSelect} />
56
67
  </MenuItem>
57
68
  </PopperMenu>
@@ -27,12 +27,13 @@ const useStyles = makeStyles(theme => ({
27
27
  const ColorPalette = ({ handleChange }) => {
28
28
  const classes = useStyles();
29
29
  return (
30
- <div className={classes.paletteContainer} aria-label="color-swatch">
30
+ <div className={classes.paletteContainer} aria-label="Color swatch">
31
31
  {VIEWER_PALETTE.map(color => (
32
32
  <IconButton
33
33
  className={classes.button}
34
34
  key={color}
35
35
  onClick={() => handleChange(color)}
36
+ aria-label={`Change color to ${color}`}
36
37
  >
37
38
  <LensIcon
38
39
  fontSize="small"
@@ -37,6 +37,7 @@ function ImageAddButton({ imageOptions, handleImageAdd }) {
37
37
  buttonIcon={<ImageAddIcon />}
38
38
  buttonClassName={classes.addButton}
39
39
  placement="bottom-start"
40
+ aria-label="Add image menu"
40
41
  >
41
42
  {imageOptions.map((imgData, i) => (
42
43
  <MenuItem dense key={imgData.name} onClick={() => handleAdd(i)}>
@@ -1,4 +1,4 @@
1
- import React, { useState, useRef, useEffect } from 'react';
1
+ import React, { useState, useRef, useEffect, useId } from 'react';
2
2
  import { viv } from '@vitessce/gl';
3
3
  import {
4
4
  GLOBAL_LABELS, getSourceFromLoader, isRgb,
@@ -127,6 +127,7 @@ export default function LayerController(props) {
127
127
  return undefined;
128
128
  }, [channels]);
129
129
 
130
+ const layerControlsId = useId();
130
131
  const firstSelection = channels[0]?.selection || {};
131
132
 
132
133
  const { data, channels: channelOptions } = loader;
@@ -476,6 +477,7 @@ export default function LayerController(props) {
476
477
  }
477
478
  TransitionProps={{ enter: false }}
478
479
  expanded={!disabled && isExpanded}
480
+ id={`layer-controls-accordion-${layerControlsId}`}
479
481
  >
480
482
  <AccordionSummary
481
483
  classes={{
@@ -486,10 +488,12 @@ export default function LayerController(props) {
486
488
  }}
487
489
  expandIcon={<ExpandMoreIcon role="presentation" />}
488
490
  aria-controls={`layer-${name}-controls`}
491
+ aria-expanded={isExpanded}
489
492
  >
490
493
  <Grid container direction="column" m={1} justifyContent="center">
491
494
  <Grid item classes={{ item: overflowEllipsisGridClasses.item }}>
492
495
  <Button
496
+ aria-label="Toggle layer visibility"
493
497
  onClick={(e) => {
494
498
  if (!disabled) {
495
499
  // Needed to prevent affecting the expansion panel from changing
@@ -530,7 +534,7 @@ export default function LayerController(props) {
530
534
  value={opacity}
531
535
  onChange={(e, v) => setOpacity(v)}
532
536
  valueLabelDisplay="auto"
533
- getAriaLabel={() => 'opacity slider'}
537
+ aria-label={`Adjust opacity for layer ${name}`}
534
538
  min={0}
535
539
  max={1}
536
540
  step={0.01}
@@ -541,17 +545,21 @@ export default function LayerController(props) {
541
545
  )}
542
546
  </Grid>
543
547
  </AccordionSummary>
544
- <AccordionDetails classes={{ root: accordionClasses.accordionDetailsRoot }}>
548
+ <AccordionDetails
549
+ classes={{ root: accordionClasses.accordionDetailsRoot }}
550
+ id={`layer-${name}-controls`}
551
+ >
545
552
  {useVolumeTabs ? (
546
553
  <>
547
554
  <Tabs
548
555
  value={tab}
549
556
  onChange={handleTabChange}
550
- aria-label="simple tabs example"
557
+ aria-label="Change the layer tab type"
551
558
  style={{ height: '24px', minHeight: '24px' }}
552
559
  >
553
560
  <Tab
554
561
  label="Channels"
562
+ aria-label="Channels tab"
555
563
  style={{
556
564
  fontSize: '.75rem',
557
565
  bottom: 12,
@@ -562,6 +570,7 @@ export default function LayerController(props) {
562
570
  />
563
571
  <Tab
564
572
  label="Volume"
573
+ aria-label="Volume tab"
565
574
  style={{
566
575
  fontSize: '.75rem',
567
576
  bottom: 12,