@czi-sds/data-viz 2.4.0 → 2.4.2

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.
@@ -1052,8 +1052,8 @@ const HOVER_THROTTLE_MS = 3 * 16.666;
1052
1052
  const COPIED_FEEDBACK_MS = 2e3;
1053
1053
  //#endregion
1054
1054
  //#region src/core/ProteinStructureViewer/components/SequenceView/style.ts
1055
- /** Height of the fade that masks residues scrolling under the panel header. */
1056
- const SCROLL_FADE_HEIGHT = 8;
1055
+ /** Height of the fades that mask residues scrolling past the panel's edges. */
1056
+ const SCROLL_FADE_HEIGHT = 10;
1057
1057
  const SequencePanel = (0, _emotion_styled.default)("div")`
1058
1058
  display: flex;
1059
1059
  flex-direction: column;
@@ -1167,8 +1167,9 @@ const ResidueCountValue = (0, _emotion_styled.default)("span")`
1167
1167
  `;
1168
1168
  /**
1169
1169
  * Scroll region for the residue grid. The `::before` fade masks residues as
1170
- * they scroll up under the header, so it has to start from whatever the panel
1171
- * is painted with or it leaves a mismatched strip.
1170
+ * they scroll up under the header and the `::after` fade masks them running off
1171
+ * the panel's bottom edge, so both have to start from whatever the panel is
1172
+ * painted with or they leave a mismatched strip.
1172
1173
  */
1173
1174
  const SequenceScroller = (0, _emotion_styled.default)("div")`
1174
1175
  position: relative;
@@ -1178,16 +1179,26 @@ const SequenceScroller = (0, _emotion_styled.default)("div")`
1178
1179
  ${(props) => {
1179
1180
  var _props$backgroundColo3, _semanticColors$base10;
1180
1181
  const semanticColors = (0, _czi_sds_components.getSemanticColors)(props);
1182
+ const surface = (_props$backgroundColo3 = props.backgroundColor) !== null && _props$backgroundColo3 !== void 0 ? _props$backgroundColo3 : semanticColors === null || semanticColors === void 0 || (_semanticColors$base10 = semanticColors.base) === null || _semanticColors$base10 === void 0 ? void 0 : _semanticColors$base10.surfacePrimary;
1181
1183
  return `
1182
- &::before {
1184
+ &::before,
1185
+ &::after {
1183
1186
  content: "";
1184
1187
  position: absolute;
1185
1188
  inset-inline: 0;
1186
- top: 0;
1187
1189
  z-index: 10;
1188
1190
  height: ${SCROLL_FADE_HEIGHT}px;
1189
1191
  pointer-events: none;
1190
- background: linear-gradient(to bottom, ${(_props$backgroundColo3 = props.backgroundColor) !== null && _props$backgroundColo3 !== void 0 ? _props$backgroundColo3 : semanticColors === null || semanticColors === void 0 || (_semanticColors$base10 = semanticColors.base) === null || _semanticColors$base10 === void 0 ? void 0 : _semanticColors$base10.surfacePrimary}, transparent);
1192
+ }
1193
+
1194
+ &::before {
1195
+ top: 0;
1196
+ background: linear-gradient(to bottom, ${surface}, transparent);
1197
+ }
1198
+
1199
+ &::after {
1200
+ bottom: 0;
1201
+ background: linear-gradient(to top, ${surface}, transparent);
1191
1202
  }
1192
1203
  `;
1193
1204
  }}
@@ -2065,12 +2076,14 @@ const MAIN_AXIS_OFFSET = -((_getSpaces$m = (_getSpaces = (0, _czi_sds_components
2065
2076
  * only the tooltip, not the residue grid.
2066
2077
  */
2067
2078
  const ResidueTooltip = (0, react.forwardRef)((_props, ref) => {
2068
- var _getSemanticColors;
2079
+ var _semanticColors$base, _semanticColors$base2;
2069
2080
  const [{ anchorEl, label }, setState] = (0, react.useState)({
2070
2081
  anchorEl: null,
2071
2082
  label: ""
2072
2083
  });
2073
- const residueTooltipBackgroundColor = (_getSemanticColors = (0, _czi_sds_components.getSemanticColors)({ theme: (0, _mui_material.useTheme)() })) === null || _getSemanticColors === void 0 || (_getSemanticColors = _getSemanticColors.base) === null || _getSemanticColors === void 0 ? void 0 : _getSemanticColors.backgroundPrimary;
2084
+ const semanticColors = (0, _czi_sds_components.getSemanticColors)({ theme: (0, _mui_material.useTheme)() });
2085
+ const residueTooltipBackgroundColor = semanticColors === null || semanticColors === void 0 || (_semanticColors$base = semanticColors.base) === null || _semanticColors$base === void 0 ? void 0 : _semanticColors$base.backgroundPrimary;
2086
+ const residueTooltipTextColor = semanticColors === null || semanticColors === void 0 || (_semanticColors$base2 = semanticColors.base) === null || _semanticColors$base2 === void 0 ? void 0 : _semanticColors$base2.textPrimary;
2074
2087
  (0, react.useImperativeHandle)(ref, () => ({
2075
2088
  hide: () => setState((prev) => prev.anchorEl === null ? prev : require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, prev), {}, { anchorEl: null })),
2076
2089
  show: (nextAnchorEl, nextLabel) => setState({
@@ -2091,7 +2104,10 @@ const ResidueTooltip = (0, react.forwardRef)((_props, ref) => {
2091
2104
  options: { offset: [0, MAIN_AXIS_OFFSET] }
2092
2105
  }]
2093
2106
  },
2094
- tooltip: { style: { backgroundColor: residueTooltipBackgroundColor } },
2107
+ tooltip: { style: {
2108
+ backgroundColor: residueTooltipBackgroundColor,
2109
+ color: residueTooltipTextColor
2110
+ } },
2095
2111
  arrow: { style: { color: residueTooltipBackgroundColor } }
2096
2112
  },
2097
2113
  title: label,
@@ -2689,6 +2705,7 @@ function useCameraReset() {
2689
2705
  }
2690
2706
  //#endregion
2691
2707
  //#region src/core/ProteinStructureViewer/components/Viewport/style.ts
2708
+ const _excluded$1 = ["showAxes"];
2692
2709
  /**
2693
2710
  * Pinned to the lower-left of the viewport, clear of the sequence panel below
2694
2711
  * and the axes widget in the corner.
@@ -2700,14 +2717,15 @@ function useCameraReset() {
2700
2717
  */
2701
2718
  const ViewportButtonStack = (0, _emotion_styled.default)("div")`
2702
2719
  position: absolute;
2703
- bottom: 48px;
2704
2720
  z-index: 10;
2705
2721
  display: flex;
2706
2722
  flex-direction: column;
2707
2723
 
2708
2724
  ${(props) => {
2709
- const spaces = (0, _czi_sds_components.getSpaces)(props);
2725
+ const { showAxes } = props;
2726
+ const spaces = (0, _czi_sds_components.getSpaces)(require_objectSpread2._objectWithoutProperties(props, _excluded$1));
2710
2727
  return `
2728
+ bottom: ${showAxes ? 48 : spaces === null || spaces === void 0 ? void 0 : spaces.m}px;
2711
2729
  left: ${spaces === null || spaces === void 0 ? void 0 : spaces.m}px;
2712
2730
  gap: ${spaces === null || spaces === void 0 ? void 0 : spaces.xxs}px;
2713
2731
  `;
@@ -2759,37 +2777,40 @@ function createViewportView(viewSettings) {
2759
2777
  }),
2760
2778
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mui_material_styles.ThemeProvider, {
2761
2779
  theme,
2762
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ViewportButtonStack, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2763
- hidden: !showAxes || !cameraChanged,
2764
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_czi_sds_components.Tooltip, {
2780
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ViewportButtonStack, {
2781
+ showAxes,
2782
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2783
+ hidden: !cameraChanged,
2784
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_czi_sds_components.Tooltip, {
2785
+ arrow: true,
2786
+ placement: "right",
2787
+ title: "Reset camera",
2788
+ textAlign: "left",
2789
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_czi_sds_components.Button, {
2790
+ "aria-label": "Reset camera",
2791
+ onClick: resetCamera,
2792
+ sdsStyle: "minimal",
2793
+ sdsType: "secondary",
2794
+ size: "medium",
2795
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_phosphor_icons_react.ArrowCounterClockwiseIcon, {})
2796
+ })
2797
+ })
2798
+ }), download && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_czi_sds_components.Tooltip, {
2765
2799
  arrow: true,
2766
2800
  placement: "right",
2767
- title: "Reset camera",
2801
+ title: "Download image",
2768
2802
  textAlign: "left",
2769
2803
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_czi_sds_components.Button, {
2770
- "aria-label": "Reset camera",
2771
- onClick: resetCamera,
2804
+ "aria-label": "Download image of the structure",
2805
+ disabled: downloading,
2806
+ onClick: captureImage,
2772
2807
  sdsStyle: "minimal",
2773
2808
  sdsType: "secondary",
2774
2809
  size: "medium",
2775
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_phosphor_icons_react.ArrowCounterClockwiseIcon, {})
2810
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_phosphor_icons_react.ApertureIcon, {})
2776
2811
  })
2777
- })
2778
- }), download && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_czi_sds_components.Tooltip, {
2779
- arrow: true,
2780
- placement: "right",
2781
- title: "Download image",
2782
- textAlign: "left",
2783
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_czi_sds_components.Button, {
2784
- "aria-label": "Download image of the structure",
2785
- disabled: downloading,
2786
- onClick: captureImage,
2787
- sdsStyle: "minimal",
2788
- sdsType: "secondary",
2789
- size: "medium",
2790
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_phosphor_icons_react.ApertureIcon, {})
2791
- })
2792
- })] })
2812
+ })]
2813
+ })
2793
2814
  })
2794
2815
  ] });
2795
2816
  };
@@ -1051,8 +1051,8 @@ const HOVER_THROTTLE_MS = 3 * 16.666;
1051
1051
  const COPIED_FEEDBACK_MS = 2e3;
1052
1052
  //#endregion
1053
1053
  //#region src/core/ProteinStructureViewer/components/SequenceView/style.ts
1054
- /** Height of the fade that masks residues scrolling under the panel header. */
1055
- const SCROLL_FADE_HEIGHT = 8;
1054
+ /** Height of the fades that mask residues scrolling past the panel's edges. */
1055
+ const SCROLL_FADE_HEIGHT = 10;
1056
1056
  const SequencePanel = styled("div")`
1057
1057
  display: flex;
1058
1058
  flex-direction: column;
@@ -1166,8 +1166,9 @@ const ResidueCountValue = styled("span")`
1166
1166
  `;
1167
1167
  /**
1168
1168
  * Scroll region for the residue grid. The `::before` fade masks residues as
1169
- * they scroll up under the header, so it has to start from whatever the panel
1170
- * is painted with or it leaves a mismatched strip.
1169
+ * they scroll up under the header and the `::after` fade masks them running off
1170
+ * the panel's bottom edge, so both have to start from whatever the panel is
1171
+ * painted with or they leave a mismatched strip.
1171
1172
  */
1172
1173
  const SequenceScroller = styled("div")`
1173
1174
  position: relative;
@@ -1177,16 +1178,26 @@ const SequenceScroller = styled("div")`
1177
1178
  ${(props) => {
1178
1179
  var _props$backgroundColo3, _semanticColors$base10;
1179
1180
  const semanticColors = getSemanticColors(props);
1181
+ const surface = (_props$backgroundColo3 = props.backgroundColor) !== null && _props$backgroundColo3 !== void 0 ? _props$backgroundColo3 : semanticColors === null || semanticColors === void 0 || (_semanticColors$base10 = semanticColors.base) === null || _semanticColors$base10 === void 0 ? void 0 : _semanticColors$base10.surfacePrimary;
1180
1182
  return `
1181
- &::before {
1183
+ &::before,
1184
+ &::after {
1182
1185
  content: "";
1183
1186
  position: absolute;
1184
1187
  inset-inline: 0;
1185
- top: 0;
1186
1188
  z-index: 10;
1187
1189
  height: ${SCROLL_FADE_HEIGHT}px;
1188
1190
  pointer-events: none;
1189
- background: linear-gradient(to bottom, ${(_props$backgroundColo3 = props.backgroundColor) !== null && _props$backgroundColo3 !== void 0 ? _props$backgroundColo3 : semanticColors === null || semanticColors === void 0 || (_semanticColors$base10 = semanticColors.base) === null || _semanticColors$base10 === void 0 ? void 0 : _semanticColors$base10.surfacePrimary}, transparent);
1191
+ }
1192
+
1193
+ &::before {
1194
+ top: 0;
1195
+ background: linear-gradient(to bottom, ${surface}, transparent);
1196
+ }
1197
+
1198
+ &::after {
1199
+ bottom: 0;
1200
+ background: linear-gradient(to top, ${surface}, transparent);
1190
1201
  }
1191
1202
  `;
1192
1203
  }}
@@ -2064,12 +2075,14 @@ const MAIN_AXIS_OFFSET = -((_getSpaces$m = (_getSpaces = getSpaces({ theme: defa
2064
2075
  * only the tooltip, not the residue grid.
2065
2076
  */
2066
2077
  const ResidueTooltip = forwardRef((_props, ref) => {
2067
- var _getSemanticColors;
2078
+ var _semanticColors$base, _semanticColors$base2;
2068
2079
  const [{ anchorEl, label }, setState] = useState({
2069
2080
  anchorEl: null,
2070
2081
  label: ""
2071
2082
  });
2072
- const residueTooltipBackgroundColor = (_getSemanticColors = getSemanticColors({ theme: useTheme$1() })) === null || _getSemanticColors === void 0 || (_getSemanticColors = _getSemanticColors.base) === null || _getSemanticColors === void 0 ? void 0 : _getSemanticColors.backgroundPrimary;
2083
+ const semanticColors = getSemanticColors({ theme: useTheme$1() });
2084
+ const residueTooltipBackgroundColor = semanticColors === null || semanticColors === void 0 || (_semanticColors$base = semanticColors.base) === null || _semanticColors$base === void 0 ? void 0 : _semanticColors$base.backgroundPrimary;
2085
+ const residueTooltipTextColor = semanticColors === null || semanticColors === void 0 || (_semanticColors$base2 = semanticColors.base) === null || _semanticColors$base2 === void 0 ? void 0 : _semanticColors$base2.textPrimary;
2073
2086
  useImperativeHandle(ref, () => ({
2074
2087
  hide: () => setState((prev) => prev.anchorEl === null ? prev : _objectSpread2(_objectSpread2({}, prev), {}, { anchorEl: null })),
2075
2088
  show: (nextAnchorEl, nextLabel) => setState({
@@ -2090,7 +2103,10 @@ const ResidueTooltip = forwardRef((_props, ref) => {
2090
2103
  options: { offset: [0, MAIN_AXIS_OFFSET] }
2091
2104
  }]
2092
2105
  },
2093
- tooltip: { style: { backgroundColor: residueTooltipBackgroundColor } },
2106
+ tooltip: { style: {
2107
+ backgroundColor: residueTooltipBackgroundColor,
2108
+ color: residueTooltipTextColor
2109
+ } },
2094
2110
  arrow: { style: { color: residueTooltipBackgroundColor } }
2095
2111
  },
2096
2112
  title: label,
@@ -2688,6 +2704,7 @@ function useCameraReset() {
2688
2704
  }
2689
2705
  //#endregion
2690
2706
  //#region src/core/ProteinStructureViewer/components/Viewport/style.ts
2707
+ const _excluded$1 = ["showAxes"];
2691
2708
  /**
2692
2709
  * Pinned to the lower-left of the viewport, clear of the sequence panel below
2693
2710
  * and the axes widget in the corner.
@@ -2699,14 +2716,15 @@ function useCameraReset() {
2699
2716
  */
2700
2717
  const ViewportButtonStack = styled("div")`
2701
2718
  position: absolute;
2702
- bottom: 48px;
2703
2719
  z-index: 10;
2704
2720
  display: flex;
2705
2721
  flex-direction: column;
2706
2722
 
2707
2723
  ${(props) => {
2708
- const spaces = getSpaces(props);
2724
+ const { showAxes } = props;
2725
+ const spaces = getSpaces(_objectWithoutProperties(props, _excluded$1));
2709
2726
  return `
2727
+ bottom: ${showAxes ? 48 : spaces === null || spaces === void 0 ? void 0 : spaces.m}px;
2710
2728
  left: ${spaces === null || spaces === void 0 ? void 0 : spaces.m}px;
2711
2729
  gap: ${spaces === null || spaces === void 0 ? void 0 : spaces.xxs}px;
2712
2730
  `;
@@ -2758,37 +2776,40 @@ function createViewportView(viewSettings) {
2758
2776
  }),
2759
2777
  /* @__PURE__ */ jsx(ThemeProvider, {
2760
2778
  theme,
2761
- children: /* @__PURE__ */ jsxs(ViewportButtonStack, { children: [/* @__PURE__ */ jsx("div", {
2762
- hidden: !showAxes || !cameraChanged,
2763
- children: /* @__PURE__ */ jsx(Tooltip, {
2779
+ children: /* @__PURE__ */ jsxs(ViewportButtonStack, {
2780
+ showAxes,
2781
+ children: [/* @__PURE__ */ jsx("div", {
2782
+ hidden: !cameraChanged,
2783
+ children: /* @__PURE__ */ jsx(Tooltip, {
2784
+ arrow: true,
2785
+ placement: "right",
2786
+ title: "Reset camera",
2787
+ textAlign: "left",
2788
+ children: /* @__PURE__ */ jsx(Button, {
2789
+ "aria-label": "Reset camera",
2790
+ onClick: resetCamera,
2791
+ sdsStyle: "minimal",
2792
+ sdsType: "secondary",
2793
+ size: "medium",
2794
+ children: /* @__PURE__ */ jsx(ArrowCounterClockwiseIcon, {})
2795
+ })
2796
+ })
2797
+ }), download && /* @__PURE__ */ jsx(Tooltip, {
2764
2798
  arrow: true,
2765
2799
  placement: "right",
2766
- title: "Reset camera",
2800
+ title: "Download image",
2767
2801
  textAlign: "left",
2768
2802
  children: /* @__PURE__ */ jsx(Button, {
2769
- "aria-label": "Reset camera",
2770
- onClick: resetCamera,
2803
+ "aria-label": "Download image of the structure",
2804
+ disabled: downloading,
2805
+ onClick: captureImage,
2771
2806
  sdsStyle: "minimal",
2772
2807
  sdsType: "secondary",
2773
2808
  size: "medium",
2774
- children: /* @__PURE__ */ jsx(ArrowCounterClockwiseIcon, {})
2809
+ children: /* @__PURE__ */ jsx(ApertureIcon, {})
2775
2810
  })
2776
- })
2777
- }), download && /* @__PURE__ */ jsx(Tooltip, {
2778
- arrow: true,
2779
- placement: "right",
2780
- title: "Download image",
2781
- textAlign: "left",
2782
- children: /* @__PURE__ */ jsx(Button, {
2783
- "aria-label": "Download image of the structure",
2784
- disabled: downloading,
2785
- onClick: captureImage,
2786
- sdsStyle: "minimal",
2787
- sdsType: "secondary",
2788
- size: "medium",
2789
- children: /* @__PURE__ */ jsx(ApertureIcon, {})
2790
- })
2791
- })] })
2811
+ })]
2812
+ })
2792
2813
  })
2793
2814
  ] });
2794
2815
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@czi-sds/data-viz",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.cjs.d.ts",
6
6
  "module": "dist/index.esm.js",
@@ -58,6 +58,7 @@
58
58
  "./dist/*": "./dist/*",
59
59
  "./package.json": "./package.json"
60
60
  },
61
+ "sideEffects": false,
61
62
  "author": "",
62
63
  "homepage": "https://github.com/chanzuckerberg/sci-components/tree/main/packages/sci-data-viz#readme",
63
64
  "description": "2023 Science Initiative Data Visualization Component Library",
@@ -146,5 +147,5 @@
146
147
  "echarts": "^6.0.0",
147
148
  "lodash": "^4.17.21"
148
149
  },
149
- "gitHead": "07207d9c4e45054e5c3cde8d6241c8d1442b1d71"
150
+ "gitHead": "4fb1150d51f5cde0b88503ca0146eba3b53f1ab1"
150
151
  }