Skip to content

Commit 0dce776

Browse files
authored
Merge pull request #147 from UW-Macrostrat/postgrest-scroll-group
Postgrest scroll group fix dependency issue
2 parents 0c2f0ad + d5671b1 commit 0dce776

File tree

6 files changed

+51
-12
lines changed

6 files changed

+51
-12
lines changed

packages/ui-components/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## [4.4.2] - 2025-07-18
3+
## [4.4.3] - 2025-07-18
44

55
For PostgRESTInfiniteScrollView
66

packages/ui-components/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@macrostrat/ui-components",
3-
"version": "4.4.2",
3+
"version": "4.4.3",
44
"description": "UI components for React and Blueprint.js",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",
@@ -46,7 +46,6 @@
4646
"@blueprintjs/datetime2": "^2.3.11",
4747
"@blueprintjs/select": "^5.3.10",
4848
"@macrostrat/hyper": "^3.0.6",
49-
"@macrostrat/map-interface": "1.5.1",
5049
"@types/react": "^18.3.12",
5150
"@types/react-dom": "^18",
5251
"axios": "^1.7.9",

packages/ui-components/src/postgrest-infinite-scroll.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ import { InfiniteScrollProps, InfiniteScrollView } from "./infinite-scroll";
33
import { useAPIResult } from "./api";
44
import { useMemo, useState } from "react";
55
import { MultiSelect, ItemRenderer, ItemPredicate } from "@blueprintjs/select";
6-
import { MenuItem, Spinner, InputGroup } from "@blueprintjs/core";
6+
import {
7+
MenuItem,
8+
Spinner,
9+
InputGroup,
10+
Collapse,
11+
Icon,
12+
} from "@blueprintjs/core";
713
import styles from "./postgrest.module.sass";
8-
import { ExpansionPanel } from "@macrostrat/map-interface";
914

1015
const h = hyper.styled(styles);
1116

@@ -378,3 +383,23 @@ function GroupPanel(props) {
378383
],
379384
);
380385
}
386+
387+
function ExpansionPanel(props) {
388+
const { title, children, className } = props;
389+
const [isOpen, setOpen] = useState(false);
390+
391+
return h(
392+
"div.expansion-panel",
393+
{ className: `expansion-panel ${className || ""}` },
394+
[
395+
h("div.panel-header", { onClick: () => setOpen(!isOpen) }, [
396+
h("h2.title", title),
397+
h(Icon, {
398+
icon: isOpen ? "chevron-up" : "chevron-down",
399+
className: "expansion-panel-icon",
400+
}),
401+
]),
402+
h(Collapse, { isOpen }, h("div.child-container", children)),
403+
],
404+
);
405+
}

packages/ui-components/src/postgrest.module.sass

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,22 @@
99
flex: 1 1 auto
1010

1111
.toggles
12-
flex: 0 0 auto
12+
flex: 0 0 auto
13+
14+
.panel-header
15+
background-color: var(--secondary-background)
16+
width: 100%
17+
padding: .2em
18+
display: flex
19+
justify-content: space-between
20+
align-items: center
21+
cursor: pointer
22+
23+
&:hover
24+
background-color: var(--tertiary-color)
25+
26+
.title
27+
margin: 0
28+
29+
.child-container
30+
padding-left: .2em

packages/ui-components/stories/postgrest-infinite-scroll.stories.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,16 @@ Grouping.args = {
5353
ascending: true,
5454
route: "https://dev2.macrostrat.org/api/pg/autocomplete",
5555
delay: 100,
56-
toggles: h("h1", "Toggles here"),
5756
searchColumns: [{ value: "name", label: "Name" }],
5857
group_key: "type",
5958
groups: [
6059
{ value: "minerals", label: "Minerals" },
61-
{ value: "group", label: "Column groups" },
62-
{ value: "econ", label: "Economics" },
60+
{ value: "groups", label: "Column groups" },
61+
{ value: "econs", label: "Economics" },
6362
],
6463
itemComponent: (item) => {
6564
return h("div.item", { key: item.data.id }, [
6665
h("div.name", item.data.name),
67-
h("div.type", item.data.type),
6866
]);
6967
},
7068
};

yarn.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2484,7 +2484,7 @@ __metadata:
24842484
languageName: unknown
24852485
linkType: soft
24862486

2487-
"@macrostrat/map-interface@npm:1.5.1, @macrostrat/map-interface@workspace:*, @macrostrat/map-interface@workspace:^, @macrostrat/map-interface@workspace:packages/map-interface":
2487+
"@macrostrat/map-interface@workspace:*, @macrostrat/map-interface@workspace:^, @macrostrat/map-interface@workspace:packages/map-interface":
24882488
version: 0.0.0-use.local
24892489
resolution: "@macrostrat/map-interface@workspace:packages/map-interface"
24902490
dependencies:
@@ -2641,7 +2641,6 @@ __metadata:
26412641
"@blueprintjs/datetime2": "npm:^2.3.11"
26422642
"@blueprintjs/select": "npm:^5.3.10"
26432643
"@macrostrat/hyper": "npm:^3.0.6"
2644-
"@macrostrat/map-interface": "npm:1.5.1"
26452644
"@types/react": "npm:^18.3.12"
26462645
"@types/react-dom": "npm:^18"
26472646
axios: "npm:^1.7.9"

0 commit comments

Comments
 (0)