@vitessce/tooltip 4.0.4 → 4.0.5
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.
- package/dist/index.js +2 -1
- package/dist-tsc/TooltipContent.d.ts.map +1 -1
- package/dist-tsc/TooltipContent.js +2 -1
- package/dist-tsc/TooltipContent.js.map +1 -1
- package/dist-tsc/TooltipContent.test.d.ts +2 -0
- package/dist-tsc/TooltipContent.test.d.ts.map +1 -0
- package/dist-tsc/TooltipContent.test.js +23 -0
- package/dist-tsc/TooltipContent.test.js.map +1 -0
- package/package.json +7 -4
- package/src/TooltipContent.js +2 -1
- package/src/TooltipContent.test.jsx +24 -0
package/dist/index.js
CHANGED
|
@@ -9924,6 +9924,7 @@ function cleanFeatureId(featureName) {
|
|
|
9924
9924
|
}
|
|
9925
9925
|
return featureName;
|
|
9926
9926
|
}
|
|
9927
|
+
const MISSING_VALUE_PLACEHOLDER = "---";
|
|
9927
9928
|
var loglevel$1 = { exports: {} };
|
|
9928
9929
|
var loglevel = loglevel$1.exports;
|
|
9929
9930
|
var hasRequiredLoglevel;
|
|
@@ -10205,7 +10206,7 @@ function TooltipContent(props) {
|
|
|
10205
10206
|
}
|
|
10206
10207
|
return transformInfoValues(info, featureType, featureLabelsMap);
|
|
10207
10208
|
}, [info, featureType, featureLabelsMap]);
|
|
10208
|
-
return /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("tbody", null, Object.entries(mappedInfo).map(([key, value]) => /* @__PURE__ */ React__default.createElement("tr", { key }, /* @__PURE__ */ React__default.createElement("th", null, key), /* @__PURE__ */ React__default.createElement("td", null, value)))));
|
|
10209
|
+
return /* @__PURE__ */ React__default.createElement("table", null, /* @__PURE__ */ React__default.createElement("tbody", null, Object.entries(mappedInfo).map(([key, value]) => /* @__PURE__ */ React__default.createElement("tr", { key }, /* @__PURE__ */ React__default.createElement("th", null, key), /* @__PURE__ */ React__default.createElement("td", null, value ?? MISSING_VALUE_PLACEHOLDER)))));
|
|
10209
10210
|
}
|
|
10210
10211
|
export {
|
|
10211
10212
|
Tooltip,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../src/TooltipContent.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../src/TooltipContent.js"],"names":[],"mappings":"AAIA,wDA0BC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
+
import { MISSING_VALUE_PLACEHOLDER } from '@vitessce/utils';
|
|
3
4
|
import { transformInfoValues } from './utils.js';
|
|
4
5
|
export default function TooltipContent(props) {
|
|
5
6
|
const { info, featureType, featureLabelsMap, } = props;
|
|
@@ -9,6 +10,6 @@ export default function TooltipContent(props) {
|
|
|
9
10
|
}
|
|
10
11
|
return transformInfoValues(info, featureType, featureLabelsMap);
|
|
11
12
|
}, [info, featureType, featureLabelsMap]);
|
|
12
|
-
return (_jsx("table", { children: _jsx("tbody", { children: Object.entries(mappedInfo).map(([key, value]) => (_jsxs("tr", { children: [_jsx("th", { children: key }), _jsx("td", { children: value })] }, key))) }) }));
|
|
13
|
+
return (_jsx("table", { children: _jsx("tbody", { children: Object.entries(mappedInfo).map(([key, value]) => (_jsxs("tr", { children: [_jsx("th", { children: key }), _jsx("td", { children: value ?? MISSING_VALUE_PLACEHOLDER })] }, key))) }) }));
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=TooltipContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipContent.js","sourceRoot":"","sources":["../src/TooltipContent.js"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEj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B,CAAC,CAAC,CAAC;IAE1C,OAAO,CACL,0BACE,0BACG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAChD,yBACE,uBAAK,GAAG,GAAM,EACd,uBAAK,KAAK,IAAI,yBAAyB,GAAM,KAFtC,GAAG,CAGP,CACN,CAAC,GACI,GACF,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipContent.test.d.ts","sourceRoot":"","sources":["../src/TooltipContent.test.jsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { describe, it, expect } from 'vitest';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import { MISSING_VALUE_PLACEHOLDER } from '@vitessce/utils';
|
|
6
|
+
import TooltipContent from './TooltipContent.js';
|
|
7
|
+
describe('TooltipContent.js', () => {
|
|
8
|
+
it('renders the shared placeholder for a missing value', async () => {
|
|
9
|
+
// An observation whose categorical label is missing has an undefined set name;
|
|
10
|
+
// the sets manager shows the placeholder for it, so the tooltip must too.
|
|
11
|
+
render(_jsx(TooltipContent, { info: { 'Cell ID': 'cell_1', 'Azimuth Label': undefined, Leiden: '3' } }));
|
|
12
|
+
expect(await screen.findByText('cell_1'));
|
|
13
|
+
expect(await screen.findByText('Azimuth Label'));
|
|
14
|
+
expect(await screen.findByText(MISSING_VALUE_PLACEHOLDER));
|
|
15
|
+
expect(await screen.findByText('3'));
|
|
16
|
+
});
|
|
17
|
+
it('keeps legitimate falsy values', async () => {
|
|
18
|
+
render(_jsx(TooltipContent, { info: { Count: 0, Flag: false } }));
|
|
19
|
+
expect(await screen.findByText('0'));
|
|
20
|
+
expect(screen.queryByText(MISSING_VALUE_PLACEHOLDER)).toBeNull();
|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MAAM,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/tooltip",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -16,12 +16,15 @@
|
|
|
16
16
|
"dist-tsc"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@vitessce/styles": "4.0.
|
|
20
|
-
"@vitessce/utils": "4.0.
|
|
21
|
-
"@vitessce/vit-s": "4.0.
|
|
19
|
+
"@vitessce/styles": "4.0.5",
|
|
20
|
+
"@vitessce/utils": "4.0.5",
|
|
21
|
+
"@vitessce/vit-s": "4.0.5"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
25
|
+
"@testing-library/react": "^16.3.0",
|
|
24
26
|
"react": "19.2.6",
|
|
27
|
+
"react-dom": "19.2.6",
|
|
25
28
|
"vite": "^7.0.0",
|
|
26
29
|
"vitest": "^3.1.4"
|
|
27
30
|
},
|
package/src/TooltipContent.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
+
import { MISSING_VALUE_PLACEHOLDER } from '@vitessce/utils';
|
|
2
3
|
import { transformInfoValues } from './utils.js';
|
|
3
4
|
|
|
4
5
|
export default function TooltipContent(props) {
|
|
@@ -21,7 +22,7 @@ export default function TooltipContent(props) {
|
|
|
21
22
|
{Object.entries(mappedInfo).map(([key, value]) => (
|
|
22
23
|
<tr key={key}>
|
|
23
24
|
<th>{key}</th>
|
|
24
|
-
<td>{value}</td>
|
|
25
|
+
<td>{value ?? MISSING_VALUE_PLACEHOLDER}</td>
|
|
25
26
|
</tr>
|
|
26
27
|
))}
|
|
27
28
|
</tbody>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { MISSING_VALUE_PLACEHOLDER } from '@vitessce/utils';
|
|
5
|
+
|
|
6
|
+
import TooltipContent from './TooltipContent.js';
|
|
7
|
+
|
|
8
|
+
describe('TooltipContent.js', () => {
|
|
9
|
+
it('renders the shared placeholder for a missing value', async () => {
|
|
10
|
+
// An observation whose categorical label is missing has an undefined set name;
|
|
11
|
+
// the sets manager shows the placeholder for it, so the tooltip must too.
|
|
12
|
+
render(<TooltipContent info={{ 'Cell ID': 'cell_1', 'Azimuth Label': undefined, Leiden: '3' }} />);
|
|
13
|
+
expect(await screen.findByText('cell_1'));
|
|
14
|
+
expect(await screen.findByText('Azimuth Label'));
|
|
15
|
+
expect(await screen.findByText(MISSING_VALUE_PLACEHOLDER));
|
|
16
|
+
expect(await screen.findByText('3'));
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('keeps legitimate falsy values', async () => {
|
|
20
|
+
render(<TooltipContent info={{ Count: 0, Flag: false }} />);
|
|
21
|
+
expect(await screen.findByText('0'));
|
|
22
|
+
expect(screen.queryByText(MISSING_VALUE_PLACEHOLDER)).toBeNull();
|
|
23
|
+
});
|
|
24
|
+
});
|