@czi-sds/data-viz 2.2.0 → 2.4.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.
Files changed (39) hide show
  1. package/dist/HeatmapChart.cjs.d.ts +2 -0
  2. package/dist/HeatmapChart.cjs.js +8 -0
  3. package/dist/HeatmapChart.esm.d.ts +2 -0
  4. package/dist/HeatmapChart.esm.js +3 -0
  5. package/dist/ProteinStructureViewer.cjs.d.ts +2 -0
  6. package/dist/ProteinStructureViewer.cjs.js +14 -0
  7. package/dist/ProteinStructureViewer.esm.d.ts +2 -0
  8. package/dist/ProteinStructureViewer.esm.js +3 -0
  9. package/dist/StackedBarChart.cjs.d.ts +2 -0
  10. package/dist/StackedBarChart.cjs.js +8 -0
  11. package/dist/StackedBarChart.esm.d.ts +2 -0
  12. package/dist/StackedBarChart.esm.js +3 -0
  13. package/dist/colorScales.cjs.d.ts +2 -0
  14. package/dist/colorScales.cjs.js +6 -0
  15. package/dist/colorScales.esm.d.ts +2 -0
  16. package/dist/colorScales.esm.js +3 -0
  17. package/dist/index.cjs.d.ts +5 -735
  18. package/dist/index.cjs.js +16 -5465
  19. package/dist/index.esm.d.ts +5 -737
  20. package/dist/index.esm.js +5 -5423
  21. package/dist/shared/HeatmapChart.cjs.js +349 -0
  22. package/dist/shared/HeatmapChart.esm.js +342 -0
  23. package/dist/shared/ProteinStructureViewer.cjs.js +4780 -0
  24. package/dist/shared/ProteinStructureViewer.esm.js +4728 -0
  25. package/dist/shared/StackedBarChart.cjs.js +489 -0
  26. package/dist/shared/StackedBarChart.esm.js +483 -0
  27. package/dist/shared/colorScales.cjs.d.ts +45 -0
  28. package/dist/shared/colorScales.cjs.js +126 -0
  29. package/dist/shared/colorScales.esm.d.ts +45 -0
  30. package/dist/shared/colorScales.esm.js +103 -0
  31. package/dist/shared/index.cjs.d.ts +183 -0
  32. package/dist/shared/index.esm.d.ts +183 -0
  33. package/dist/shared/index2.cjs.d.ts +389 -0
  34. package/dist/shared/index2.esm.d.ts +391 -0
  35. package/dist/shared/index3.cjs.d.ts +166 -0
  36. package/dist/shared/index3.esm.d.ts +166 -0
  37. package/dist/shared/objectSpread2.cjs.js +124 -0
  38. package/dist/shared/objectSpread2.esm.js +85 -0
  39. package/package.json +64 -2
@@ -0,0 +1,166 @@
1
+ /// <reference types="react" />
2
+ import { HTMLAttributes } from "react";
3
+ import { DiscreteColorGeneratorOptions, TooltipTableContentProps } from "@czi-sds/components";
4
+
5
+ //#region src/core/StackedBarChart/StackedBarChart.types.d.ts
6
+ interface StackedBarChartDataItem {
7
+ /**
8
+ * The segment's label in the legend, and the key the animations track it by.
9
+ * Must be unique within the chart.
10
+ */
11
+ name: string;
12
+ /**
13
+ * The quantity the segment stands for.
14
+ */
15
+ value: number;
16
+ /**
17
+ * Any CSS color. Without it the segment takes a generated palette color,
18
+ * which can shift as categories come and go.
19
+ */
20
+ color?: string;
21
+ /**
22
+ * A unit for this item's counted value, for data that mixes units across
23
+ * categories.
24
+ */
25
+ unit?: string;
26
+ /**
27
+ * Takes the segment and its legend item out of every interaction: no hover,
28
+ * no tooltip, no selection.
29
+ * @default false
30
+ */
31
+ disabled?: boolean;
32
+ /**
33
+ * Content for a TooltipTable shown above the segment on hover. Use it for the
34
+ * breakdown behind the number; a segment without it has no tooltip.
35
+ */
36
+ tooltip?: TooltipTableContentProps;
37
+ }
38
+ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
39
+ /**
40
+ * A heading above the bar. It is also what makes room for the badge; with no
41
+ * title, no badge is drawn.
42
+ */
43
+ title?: string;
44
+ /**
45
+ * Overrides the badge text, which otherwise counts the data and the selection
46
+ * ("7", or "3 of 7").
47
+ */
48
+ badge?: string;
49
+ /**
50
+ * Removes the badge, leaving the title on its own.
51
+ * @default false
52
+ */
53
+ hideBadge?: boolean;
54
+ /**
55
+ * The segments, in the order they are drawn.
56
+ */
57
+ data: StackedBarChartDataItem[];
58
+ /**
59
+ * Any CSS width; a number is read as pixels. It sets the width of the whole
60
+ * chart, legend included.
61
+ * @default 100%
62
+ */
63
+ width?: number | string;
64
+ /**
65
+ * Height of the bar in pixels. Values below 1 are clamped to 1, so the bar
66
+ * cannot disappear.
67
+ * @default 16
68
+ */
69
+ barHeight?: number;
70
+ /**
71
+ * Draws the legend below the bar. It is the only place segment names appear,
72
+ * and the only part of the chart a keyboard can reach.
73
+ * @default true
74
+ */
75
+ showLegend?: boolean;
76
+ /**
77
+ * Shows each item's value beside its name in the legend.
78
+ * @default true
79
+ */
80
+ showLegendValues?: boolean;
81
+ /**
82
+ * "percentage" shows the segment's share of the bar, rounded. "count" shows
83
+ * the raw value followed by the item's unit, or the chart's unit if the item
84
+ * has none.
85
+ * @default "percentage"
86
+ */
87
+ legendValueFormat?: "percentage" | "count";
88
+ /**
89
+ * Indices into data that are currently selected. The chart is controlled: it
90
+ * draws this and never changes it.
91
+ */
92
+ selectedIndices?: number[];
93
+ /**
94
+ * Called with the next selection when a segment or legend item is clicked.
95
+ * Without it, clicking selects nothing.
96
+ */
97
+ onSelectionChange?: (selectedIndices: number[], selectedData: StackedBarChartDataItem[]) => void;
98
+ /**
99
+ * Called when the pointer enters a segment. The chart already syncs its own
100
+ * hover highlight between bar and legend, so this is for driving something
101
+ * outside it.
102
+ */
103
+ onSegmentMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
104
+ /**
105
+ * Called when the pointer leaves a segment.
106
+ */
107
+ onSegmentMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
108
+ /**
109
+ * Called when the pointer enters a legend item.
110
+ */
111
+ onLegendItemMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
112
+ /**
113
+ * Called when the pointer leaves a legend item.
114
+ */
115
+ onLegendItemMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
116
+ /**
117
+ * Fires on a segment click, alongside any selection change rather than
118
+ * instead of it.
119
+ */
120
+ onSegmentClick?: (item: StackedBarChartDataItem, index: number) => void;
121
+ /**
122
+ * The same, for a click on a legend item.
123
+ */
124
+ onLegendItemClick?: (item: StackedBarChartDataItem, index: number) => void;
125
+ /**
126
+ * What a selection does to the unselected segments: fade them to 20% opacity,
127
+ * or drop them from the bar and let the rest take the space.
128
+ * @default "dim"
129
+ */
130
+ selectionBehavior?: "dim" | "hide";
131
+ /**
132
+ * Whether the bar shows a breakdown of the data (segments always fill it) or
133
+ * progress towards maxAmount.
134
+ * @default "proportional"
135
+ */
136
+ mode?: "proportional" | "cumulative";
137
+ /**
138
+ * Cumulative mode only. The value the full bar represents. Any difference
139
+ * between it and the sum of the data is drawn as the Remaining segment.
140
+ */
141
+ maxAmount?: number;
142
+ /**
143
+ * Name of the grey gap segment in cumulative mode.
144
+ * @default "Remaining"
145
+ */
146
+ remainingLabel?: string;
147
+ /**
148
+ * A unit for the Remaining segment's value alone.
149
+ */
150
+ remainingUnit?: string;
151
+ /**
152
+ * The unit appended to counted values, for items that do not carry one of
153
+ * their own.
154
+ */
155
+ unit?: string;
156
+ /**
157
+ * Tunes the generated palette (start hue, rotations, lightness range, gamma).
158
+ * Items with their own color are untouched by it.
159
+ */
160
+ colorGeneratorOptions?: DiscreteColorGeneratorOptions;
161
+ }
162
+ //#endregion
163
+ //#region src/core/StackedBarChart/index.d.ts
164
+ declare const StackedBarChart: (props: StackedBarChartProps) => JSX.Element;
165
+ //#endregion
166
+ export { StackedBarChartDataItem as n, StackedBarChartProps as r, StackedBarChart as t };
@@ -0,0 +1,124 @@
1
+ "use client";
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectWithoutPropertiesLoose.js
25
+ function _objectWithoutPropertiesLoose(r, e) {
26
+ if (null == r) return {};
27
+ var t = {};
28
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
29
+ if (e.includes(n)) continue;
30
+ t[n] = r[n];
31
+ }
32
+ return t;
33
+ }
34
+ //#endregion
35
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectWithoutProperties.js
36
+ function _objectWithoutProperties(e, t) {
37
+ if (null == e) return {};
38
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
39
+ if (Object.getOwnPropertySymbols) {
40
+ var s = Object.getOwnPropertySymbols(e);
41
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
42
+ }
43
+ return i;
44
+ }
45
+ //#endregion
46
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
47
+ function _typeof(o) {
48
+ "@babel/helpers - typeof";
49
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
50
+ return typeof o;
51
+ } : function(o) {
52
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
53
+ }, _typeof(o);
54
+ }
55
+ //#endregion
56
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
57
+ function toPrimitive(t, r) {
58
+ if ("object" != _typeof(t) || !t) return t;
59
+ var e = t[Symbol.toPrimitive];
60
+ if (void 0 !== e) {
61
+ var i = e.call(t, r || "default");
62
+ if ("object" != _typeof(i)) return i;
63
+ throw new TypeError("@@toPrimitive must return a primitive value.");
64
+ }
65
+ return ("string" === r ? String : Number)(t);
66
+ }
67
+ //#endregion
68
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
69
+ function toPropertyKey(t) {
70
+ var i = toPrimitive(t, "string");
71
+ return "symbol" == _typeof(i) ? i : i + "";
72
+ }
73
+ //#endregion
74
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
75
+ function _defineProperty(e, r, t) {
76
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
77
+ value: t,
78
+ enumerable: !0,
79
+ configurable: !0,
80
+ writable: !0
81
+ }) : e[r] = t, e;
82
+ }
83
+ //#endregion
84
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectSpread2.js
85
+ function ownKeys(e, r) {
86
+ var t = Object.keys(e);
87
+ if (Object.getOwnPropertySymbols) {
88
+ var o = Object.getOwnPropertySymbols(e);
89
+ r && (o = o.filter(function(r) {
90
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
91
+ })), t.push.apply(t, o);
92
+ }
93
+ return t;
94
+ }
95
+ function _objectSpread2(e) {
96
+ for (var r = 1; r < arguments.length; r++) {
97
+ var t = null != arguments[r] ? arguments[r] : {};
98
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
99
+ _defineProperty(e, r, t[r]);
100
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
101
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
102
+ });
103
+ }
104
+ return e;
105
+ }
106
+ //#endregion
107
+ Object.defineProperty(exports, "__toESM", {
108
+ enumerable: true,
109
+ get: function() {
110
+ return __toESM;
111
+ }
112
+ });
113
+ Object.defineProperty(exports, "_objectSpread2", {
114
+ enumerable: true,
115
+ get: function() {
116
+ return _objectSpread2;
117
+ }
118
+ });
119
+ Object.defineProperty(exports, "_objectWithoutProperties", {
120
+ enumerable: true,
121
+ get: function() {
122
+ return _objectWithoutProperties;
123
+ }
124
+ });
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectWithoutPropertiesLoose.js
3
+ function _objectWithoutPropertiesLoose(r, e) {
4
+ if (null == r) return {};
5
+ var t = {};
6
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
7
+ if (e.includes(n)) continue;
8
+ t[n] = r[n];
9
+ }
10
+ return t;
11
+ }
12
+ //#endregion
13
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectWithoutProperties.js
14
+ function _objectWithoutProperties(e, t) {
15
+ if (null == e) return {};
16
+ var o, r, i = _objectWithoutPropertiesLoose(e, t);
17
+ if (Object.getOwnPropertySymbols) {
18
+ var s = Object.getOwnPropertySymbols(e);
19
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
20
+ }
21
+ return i;
22
+ }
23
+ //#endregion
24
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
25
+ function _typeof(o) {
26
+ "@babel/helpers - typeof";
27
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
28
+ return typeof o;
29
+ } : function(o) {
30
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
31
+ }, _typeof(o);
32
+ }
33
+ //#endregion
34
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
35
+ function toPrimitive(t, r) {
36
+ if ("object" != _typeof(t) || !t) return t;
37
+ var e = t[Symbol.toPrimitive];
38
+ if (void 0 !== e) {
39
+ var i = e.call(t, r || "default");
40
+ if ("object" != _typeof(i)) return i;
41
+ throw new TypeError("@@toPrimitive must return a primitive value.");
42
+ }
43
+ return ("string" === r ? String : Number)(t);
44
+ }
45
+ //#endregion
46
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
47
+ function toPropertyKey(t) {
48
+ var i = toPrimitive(t, "string");
49
+ return "symbol" == _typeof(i) ? i : i + "";
50
+ }
51
+ //#endregion
52
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
53
+ function _defineProperty(e, r, t) {
54
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
55
+ value: t,
56
+ enumerable: !0,
57
+ configurable: !0,
58
+ writable: !0
59
+ }) : e[r] = t, e;
60
+ }
61
+ //#endregion
62
+ //#region \0@oxc-project+runtime@0.134.0/helpers/esm/objectSpread2.js
63
+ function ownKeys(e, r) {
64
+ var t = Object.keys(e);
65
+ if (Object.getOwnPropertySymbols) {
66
+ var o = Object.getOwnPropertySymbols(e);
67
+ r && (o = o.filter(function(r) {
68
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
69
+ })), t.push.apply(t, o);
70
+ }
71
+ return t;
72
+ }
73
+ function _objectSpread2(e) {
74
+ for (var r = 1; r < arguments.length; r++) {
75
+ var t = null != arguments[r] ? arguments[r] : {};
76
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
77
+ _defineProperty(e, r, t[r]);
78
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
79
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
80
+ });
81
+ }
82
+ return e;
83
+ }
84
+ //#endregion
85
+ export { _objectWithoutProperties as n, _objectSpread2 as t };
package/package.json CHANGED
@@ -1,9 +1,63 @@
1
1
  {
2
2
  "name": "@czi-sds/data-viz",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "main": "dist/index.cjs.js",
5
5
  "types": "dist/index.cjs.d.ts",
6
6
  "module": "dist/index.esm.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": {
10
+ "types": "./dist/index.esm.d.ts",
11
+ "default": "./dist/index.esm.js"
12
+ },
13
+ "require": {
14
+ "types": "./dist/index.cjs.d.ts",
15
+ "default": "./dist/index.cjs.js"
16
+ }
17
+ },
18
+ "./HeatmapChart": {
19
+ "import": {
20
+ "types": "./dist/HeatmapChart.esm.d.ts",
21
+ "default": "./dist/HeatmapChart.esm.js"
22
+ },
23
+ "require": {
24
+ "types": "./dist/HeatmapChart.cjs.d.ts",
25
+ "default": "./dist/HeatmapChart.cjs.js"
26
+ }
27
+ },
28
+ "./ProteinStructureViewer": {
29
+ "import": {
30
+ "types": "./dist/ProteinStructureViewer.esm.d.ts",
31
+ "default": "./dist/ProteinStructureViewer.esm.js"
32
+ },
33
+ "require": {
34
+ "types": "./dist/ProteinStructureViewer.cjs.d.ts",
35
+ "default": "./dist/ProteinStructureViewer.cjs.js"
36
+ }
37
+ },
38
+ "./StackedBarChart": {
39
+ "import": {
40
+ "types": "./dist/StackedBarChart.esm.d.ts",
41
+ "default": "./dist/StackedBarChart.esm.js"
42
+ },
43
+ "require": {
44
+ "types": "./dist/StackedBarChart.cjs.d.ts",
45
+ "default": "./dist/StackedBarChart.cjs.js"
46
+ }
47
+ },
48
+ "./colorScales": {
49
+ "import": {
50
+ "types": "./dist/colorScales.esm.d.ts",
51
+ "default": "./dist/colorScales.esm.js"
52
+ },
53
+ "require": {
54
+ "types": "./dist/colorScales.cjs.d.ts",
55
+ "default": "./dist/colorScales.cjs.js"
56
+ }
57
+ },
58
+ "./dist/*": "./dist/*",
59
+ "./package.json": "./package.json"
60
+ },
7
61
  "author": "",
8
62
  "homepage": "https://github.com/chanzuckerberg/sci-components/tree/main/packages/sci-data-viz#readme",
9
63
  "description": "2023 Science Initiative Data Visualization Component Library",
@@ -67,6 +121,14 @@
67
121
  "react-dom": ">=18.0.0",
68
122
  "rxjs": "^7.8.2"
69
123
  },
124
+ "peerDependenciesMeta": {
125
+ "molstar": {
126
+ "optional": true
127
+ },
128
+ "rxjs": {
129
+ "optional": true
130
+ }
131
+ },
70
132
  "devDependencies": {
71
133
  "@reduxjs/toolkit": "^2.1.0",
72
134
  "@types/chroma-js": "^3.1.2",
@@ -84,5 +146,5 @@
84
146
  "echarts": "^6.0.0",
85
147
  "lodash": "^4.17.21"
86
148
  },
87
- "gitHead": "d2e4320c4fe8a6a90abde1ce2633faa76d4c73fa"
149
+ "gitHead": "07207d9c4e45054e5c3cde8d6241c8d1442b1d71"
88
150
  }