@databiosphere/findable-ui 27.0.0 → 28.0.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.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +17 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/chartView.js +1 -1
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.js +3 -2
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.d.ts +21 -0
- package/lib/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.js +34 -0
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.d.ts +2 -1
- package/lib/components/Index/components/EntitiesView/components/EntityList/entityList.js +3 -5
- package/lib/components/Index/components/EntitiesView/components/EntityList/types.d.ts +4 -1
- package/lib/components/Index/components/Hero/components/Summaries/stories/summaries.stories.d.ts +6 -0
- package/lib/components/Index/components/Hero/components/Summaries/{summaries.stories.js → stories/summaries.stories.js} +2 -6
- package/lib/components/Index/components/Hero/stories/hero.stories.d.ts +6 -0
- package/lib/components/Index/components/Hero/stories/hero.stories.js +16 -0
- package/lib/components/Index/index.d.ts +1 -1
- package/lib/components/Index/index.js +6 -2
- package/lib/components/Index/stories/index.stories.d.ts +6 -0
- package/lib/components/Index/stories/index.stories.js +17 -0
- package/lib/components/Index/table/coreOptions/columns/cellFactory.d.ts +9 -0
- package/lib/components/Index/table/coreOptions/columns/cellFactory.js +13 -0
- package/lib/components/Index/table/hook.d.ts +3 -0
- package/lib/components/Index/table/hook.js +166 -0
- package/lib/components/Index/table/types.d.ts +4 -0
- package/lib/components/Index/table/types.js +1 -0
- package/lib/components/Index/types.d.ts +6 -2
- package/lib/components/Table/table.d.ts +5 -20
- package/lib/components/Table/table.js +10 -138
- package/lib/components/TableCreator/tableCreator.d.ts +5 -7
- package/lib/components/TableCreator/tableCreator.js +3 -35
- package/lib/views/ExploreView/exploreView.js +1 -3
- package/package.json +1 -1
- package/src/components/Index/components/EntitiesView/components/ChartView/chartView.tsx +1 -1
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/plot.ts +4 -1
- package/src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils.ts +43 -0
- package/src/components/Index/components/EntitiesView/components/EntityList/entityList.tsx +7 -14
- package/src/components/Index/components/EntitiesView/components/EntityList/types.ts +5 -1
- package/src/components/Index/components/Hero/components/Summaries/{summaries.stories.tsx → stories/summaries.stories.tsx} +4 -8
- package/src/components/Index/components/Hero/stories/hero.stories.tsx +22 -0
- package/src/components/Index/index.tsx +21 -3
- package/src/components/Index/stories/index.stories.tsx +23 -0
- package/src/components/Index/table/coreOptions/columns/cellFactory.tsx +22 -0
- package/src/components/Index/table/hook.ts +234 -0
- package/src/components/Index/table/types.ts +5 -0
- package/src/components/Index/types.ts +6 -2
- package/src/components/Table/table.tsx +16 -199
- package/src/components/TableCreator/tableCreator.tsx +7 -79
- package/src/views/ExploreView/exploreView.tsx +4 -10
- package/tests/chart.test.tsx +19 -8
- package/tests/chartView.test.tsx +1 -1
- package/lib/components/Index/components/Hero/components/Summaries/summaries.stories.d.ts +0 -13
- package/lib/components/Index/components/Hero/hero.stories.d.ts +0 -23
- package/lib/components/Index/components/Hero/hero.stories.js +0 -22
- package/lib/components/Index/index.stories.d.ts +0 -6
- package/lib/components/Index/index.stories.js +0 -26
- package/src/components/Index/components/Hero/hero.stories.tsx +0 -28
- package/src/components/Index/index.stories.tsx +0 -31
package/tests/chart.test.tsx
CHANGED
|
@@ -2,7 +2,11 @@ import { composeStories } from "@storybook/react";
|
|
|
2
2
|
import { render, screen } from "@testing-library/react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { SelectCategoryValueView } from "../src/common/entities";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
getCategoryTotalCount,
|
|
7
|
+
getCountText,
|
|
8
|
+
parseTranslate,
|
|
9
|
+
} from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/barX/utils";
|
|
6
10
|
import { CHART_TEST_ID } from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/constants";
|
|
7
11
|
import * as stories from "../src/components/Index/components/EntitiesView/components/ChartView/components/Chart/stories/chart.stories";
|
|
8
12
|
import { PALETTE } from "../src/styles/common/constants/palette";
|
|
@@ -16,6 +20,7 @@ const { Default, Selected } = composeStories(stories);
|
|
|
16
20
|
|
|
17
21
|
const DATA = Default.args.selectCategoryValueViews || [];
|
|
18
22
|
const SELECTED_DATA = Selected.args.selectCategoryValueViews || [];
|
|
23
|
+
const TOTAL_COUNT = getCategoryTotalCount(DATA);
|
|
19
24
|
|
|
20
25
|
describe("Chart", () => {
|
|
21
26
|
describe("basic rendering", () => {
|
|
@@ -35,7 +40,7 @@ describe("Chart", () => {
|
|
|
35
40
|
});
|
|
36
41
|
|
|
37
42
|
describe("category labels and counts", () => {
|
|
38
|
-
const counts = DATA.map(mapCount);
|
|
43
|
+
const counts = DATA.map((d) => mapCount(d, TOTAL_COUNT));
|
|
39
44
|
const labels = DATA.map(mapLabel);
|
|
40
45
|
let countTextEls: NodeListOf<SVGElement>;
|
|
41
46
|
let labelTextEls: NodeListOf<SVGElement>;
|
|
@@ -127,7 +132,9 @@ describe("Chart", () => {
|
|
|
127
132
|
it("renders bars in descending order of count", () => {
|
|
128
133
|
render(<Default testId={CHART_TEST_ID} />);
|
|
129
134
|
// Order data by count in descending order.
|
|
130
|
-
const counts = [...DATA]
|
|
135
|
+
const counts = [...DATA]
|
|
136
|
+
.sort(sortByCount)
|
|
137
|
+
.map((d) => mapCount(d, TOTAL_COUNT));
|
|
131
138
|
// Sort count <text> elements by their transform’s translate‑Y (vertical) value, since they’re rendered in data order.
|
|
132
139
|
const countTextEls = getEls(CLASSNAMES.TEXT_COUNT, "text");
|
|
133
140
|
const textContents = [...countTextEls]
|
|
@@ -200,12 +207,16 @@ function isFillPrimaryMain(element: Element): boolean {
|
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
/**
|
|
203
|
-
* Maps the count of a category value
|
|
204
|
-
* @param categoryValueView -
|
|
205
|
-
* @
|
|
210
|
+
* Maps the count of a category value to a string representation.
|
|
211
|
+
* @param categoryValueView - The category value view to be processed.
|
|
212
|
+
* @param total - The total count associated with the category value.
|
|
213
|
+
* @returns The formatted count text for the category value.
|
|
206
214
|
*/
|
|
207
|
-
function mapCount(
|
|
208
|
-
|
|
215
|
+
function mapCount(
|
|
216
|
+
categoryValueView: SelectCategoryValueView,
|
|
217
|
+
total: number
|
|
218
|
+
): string {
|
|
219
|
+
return getCountText(categoryValueView, total);
|
|
209
220
|
}
|
|
210
221
|
|
|
211
222
|
/**
|
package/tests/chartView.test.tsx
CHANGED
|
@@ -35,7 +35,7 @@ describe("ChartView", () => {
|
|
|
35
35
|
} = Default;
|
|
36
36
|
["Biological Sex", "Genus Species"].forEach((category) => {
|
|
37
37
|
expect(
|
|
38
|
-
screen.getByText(new RegExp(`${entityName}
|
|
38
|
+
screen.getByText(new RegExp(`${entityName} by ${category}`))
|
|
39
39
|
).toBeDefined();
|
|
40
40
|
});
|
|
41
41
|
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react";
|
|
2
|
-
declare const meta: {
|
|
3
|
-
argTypes: {
|
|
4
|
-
summaries: {
|
|
5
|
-
control: "object";
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
component: ({ summaries }: import("./summaries").SummariesProps) => JSX.Element;
|
|
9
|
-
title: string;
|
|
10
|
-
};
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof meta>;
|
|
13
|
-
export declare const SummariesStory: Story;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react";
|
|
2
|
-
declare const meta: {
|
|
3
|
-
argTypes: {
|
|
4
|
-
Summaries: {
|
|
5
|
-
table: {
|
|
6
|
-
disable: true;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
title: {
|
|
10
|
-
table: {
|
|
11
|
-
disable: true;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
component: ({ SideBarButton, Summaries, title, }: import("./hero").HeroProps) => JSX.Element;
|
|
16
|
-
parameters: {
|
|
17
|
-
layout: string;
|
|
18
|
-
};
|
|
19
|
-
title: string;
|
|
20
|
-
};
|
|
21
|
-
export default meta;
|
|
22
|
-
type Story = StoryObj<typeof meta>;
|
|
23
|
-
export declare const HeroStory: Story;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Summaries } from "./components/Summaries/summaries";
|
|
3
|
-
import { SummariesStory } from "./components/Summaries/summaries.stories";
|
|
4
|
-
import { Hero } from "./hero";
|
|
5
|
-
const meta = {
|
|
6
|
-
argTypes: {
|
|
7
|
-
Summaries: { table: { disable: true } },
|
|
8
|
-
title: { table: { disable: true } },
|
|
9
|
-
},
|
|
10
|
-
component: Hero,
|
|
11
|
-
parameters: {
|
|
12
|
-
layout: "fullscreen",
|
|
13
|
-
},
|
|
14
|
-
title: "Components/Hero/ExploreView",
|
|
15
|
-
};
|
|
16
|
-
export default meta;
|
|
17
|
-
export const HeroStory = {
|
|
18
|
-
args: {
|
|
19
|
-
Summaries: React.createElement(Summaries, { ...SummariesStory.args }),
|
|
20
|
-
title: "Data Explorer",
|
|
21
|
-
},
|
|
22
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Summaries } from "./components/Hero/components/Summaries/summaries";
|
|
3
|
-
import { SummariesStory } from "./components/Hero/components/Summaries/summaries.stories";
|
|
4
|
-
import { Index } from "./index";
|
|
5
|
-
export default {
|
|
6
|
-
argTypes: {
|
|
7
|
-
Summaries: { table: { disable: true } },
|
|
8
|
-
Tabs: { table: { disable: true } },
|
|
9
|
-
list: { table: { disable: true } },
|
|
10
|
-
title: { table: { disable: true } },
|
|
11
|
-
},
|
|
12
|
-
component: Index,
|
|
13
|
-
parameters: {
|
|
14
|
-
layout: "fullscreen",
|
|
15
|
-
},
|
|
16
|
-
title: "Views/ExploreView",
|
|
17
|
-
};
|
|
18
|
-
export const IndexStory = {
|
|
19
|
-
args: {
|
|
20
|
-
Summaries: React.createElement(Summaries, { ...SummariesStory.args }),
|
|
21
|
-
Tabs: undefined,
|
|
22
|
-
chart: undefined,
|
|
23
|
-
list: undefined,
|
|
24
|
-
title: "Explore Data",
|
|
25
|
-
},
|
|
26
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Summaries } from "./components/Summaries/summaries";
|
|
4
|
-
import { SummariesStory } from "./components/Summaries/summaries.stories";
|
|
5
|
-
import { Hero } from "./hero";
|
|
6
|
-
|
|
7
|
-
const meta = {
|
|
8
|
-
argTypes: {
|
|
9
|
-
Summaries: { table: { disable: true } },
|
|
10
|
-
title: { table: { disable: true } },
|
|
11
|
-
},
|
|
12
|
-
component: Hero,
|
|
13
|
-
parameters: {
|
|
14
|
-
layout: "fullscreen",
|
|
15
|
-
},
|
|
16
|
-
title: "Components/Hero/ExploreView",
|
|
17
|
-
} satisfies Meta<typeof Hero>;
|
|
18
|
-
|
|
19
|
-
export default meta;
|
|
20
|
-
|
|
21
|
-
type Story = StoryObj<typeof meta>;
|
|
22
|
-
|
|
23
|
-
export const HeroStory: Story = {
|
|
24
|
-
args: {
|
|
25
|
-
Summaries: <Summaries {...SummariesStory.args} />,
|
|
26
|
-
title: "Data Explorer",
|
|
27
|
-
},
|
|
28
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Summaries } from "./components/Hero/components/Summaries/summaries";
|
|
4
|
-
import { SummariesStory } from "./components/Hero/components/Summaries/summaries.stories";
|
|
5
|
-
import { Index } from "./index";
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
argTypes: {
|
|
9
|
-
Summaries: { table: { disable: true } },
|
|
10
|
-
Tabs: { table: { disable: true } },
|
|
11
|
-
list: { table: { disable: true } },
|
|
12
|
-
title: { table: { disable: true } },
|
|
13
|
-
},
|
|
14
|
-
component: Index,
|
|
15
|
-
parameters: {
|
|
16
|
-
layout: "fullscreen",
|
|
17
|
-
},
|
|
18
|
-
title: "Views/ExploreView",
|
|
19
|
-
} as Meta<typeof Index>;
|
|
20
|
-
|
|
21
|
-
type Story = StoryObj<typeof Index>;
|
|
22
|
-
|
|
23
|
-
export const IndexStory: Story = {
|
|
24
|
-
args: {
|
|
25
|
-
Summaries: <Summaries {...SummariesStory.args} />,
|
|
26
|
-
Tabs: undefined,
|
|
27
|
-
chart: undefined,
|
|
28
|
-
list: undefined,
|
|
29
|
-
title: "Explore Data",
|
|
30
|
-
},
|
|
31
|
-
};
|