@macrostrat/map-interface 1.1.0 → 1.2.1

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 (193) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/container.72611900.js +134 -0
  3. package/dist/cjs/container.72611900.js.map +1 -0
  4. package/dist/cjs/context-panel.8c4b009c.js +88 -0
  5. package/dist/cjs/context-panel.8c4b009c.js.map +1 -0
  6. package/dist/cjs/controls.7ce3e95c.js +79 -0
  7. package/dist/cjs/controls.7ce3e95c.js.map +1 -0
  8. package/dist/cjs/dev.7499151f.js +33 -0
  9. package/dist/cjs/dev.7499151f.js.map +1 -0
  10. package/dist/cjs/expansion-panel.08532cee.js +134 -0
  11. package/dist/cjs/expansion-panel.08532cee.js.map +1 -0
  12. package/dist/cjs/hash-string.62e84f08.js +67 -0
  13. package/dist/cjs/hash-string.62e84f08.js.map +1 -0
  14. package/dist/cjs/header.58c5c012.js +104 -0
  15. package/dist/cjs/header.58c5c012.js.map +1 -0
  16. package/dist/cjs/headers.20eae5f7.js +29 -0
  17. package/dist/cjs/headers.20eae5f7.js.map +1 -0
  18. package/dist/cjs/helpers.0f72ddaf.js +190 -0
  19. package/dist/cjs/helpers.0f72ddaf.js.map +1 -0
  20. package/dist/cjs/index.js +51 -0
  21. package/dist/cjs/index.js.map +1 -0
  22. package/dist/cjs/location-info.92e70042.js +119 -0
  23. package/dist/cjs/location-info.92e70042.js.map +1 -0
  24. package/dist/cjs/location-panel.c95f5e96.js +66 -0
  25. package/dist/cjs/location-panel.c95f5e96.js.map +1 -0
  26. package/dist/cjs/main.module.02c4de16.css +86 -0
  27. package/dist/cjs/main.module.02c4de16.css.map +1 -0
  28. package/dist/cjs/main.module.3f2b7c9f.js +38 -0
  29. package/dist/cjs/main.module.3f2b7c9f.js.map +1 -0
  30. package/dist/cjs/main.module.4ecbaaa5.js +62 -0
  31. package/dist/cjs/main.module.4ecbaaa5.js.map +1 -0
  32. package/dist/cjs/main.module.62939ea7.js +167 -0
  33. package/dist/cjs/main.module.62939ea7.js.map +1 -0
  34. package/dist/cjs/main.module.92978d8b.css +52 -0
  35. package/dist/cjs/main.module.92978d8b.css.map +1 -0
  36. package/dist/cjs/main.module.becc2fe7.css +92 -0
  37. package/dist/cjs/main.module.becc2fe7.css.map +1 -0
  38. package/dist/cjs/main.module.ccec47df.js +50 -0
  39. package/dist/cjs/main.module.ccec47df.js.map +1 -0
  40. package/dist/cjs/main.module.e958948e.js +26 -0
  41. package/dist/cjs/main.module.e958948e.js.map +1 -0
  42. package/dist/{index.css → cjs/main.module.f085a193.css} +9 -397
  43. package/dist/cjs/main.module.f085a193.css.map +1 -0
  44. package/dist/cjs/main.module.ff1b1aca.css +179 -0
  45. package/dist/cjs/main.module.ff1b1aca.css.map +1 -0
  46. package/dist/cjs/map-page.190b6723.js +182 -0
  47. package/dist/cjs/map-page.190b6723.js.map +1 -0
  48. package/dist/cjs/map-view.93363b41.js +167 -0
  49. package/dist/cjs/map-view.93363b41.js.map +1 -0
  50. package/dist/cjs/terrain.90f76b4e.js +59 -0
  51. package/dist/cjs/terrain.90f76b4e.js.map +1 -0
  52. package/dist/cjs/tile-extent.06a4b2ed.js +51 -0
  53. package/dist/cjs/tile-extent.06a4b2ed.js.map +1 -0
  54. package/dist/cjs/utils.09cef979.js +36 -0
  55. package/dist/cjs/utils.09cef979.js.map +1 -0
  56. package/dist/cjs/utils.26f02633.js +46 -0
  57. package/dist/cjs/utils.26f02633.js.map +1 -0
  58. package/dist/cjs/vector-tile-features.456f887b.js +268 -0
  59. package/dist/cjs/vector-tile-features.456f887b.js.map +1 -0
  60. package/dist/cjs/xray.a23f8660.js +89 -0
  61. package/dist/cjs/xray.a23f8660.js.map +1 -0
  62. package/dist/esm/container.16bde261.js +126 -0
  63. package/dist/esm/container.16bde261.js.map +1 -0
  64. package/dist/esm/context-panel.c288c5cd.js +81 -0
  65. package/dist/esm/context-panel.c288c5cd.js.map +1 -0
  66. package/dist/esm/controls.f757ce16.js +74 -0
  67. package/dist/esm/controls.f757ce16.js.map +1 -0
  68. package/dist/esm/dev.ccb6e774.js +13 -0
  69. package/dist/esm/dev.ccb6e774.js.map +1 -0
  70. package/dist/esm/expansion-panel.feff0e62.js +123 -0
  71. package/dist/esm/expansion-panel.feff0e62.js.map +1 -0
  72. package/dist/esm/hash-string.836601b2.js +61 -0
  73. package/dist/esm/hash-string.836601b2.js.map +1 -0
  74. package/dist/esm/header.0f535ab1.js +99 -0
  75. package/dist/esm/header.0f535ab1.js.map +1 -0
  76. package/dist/esm/headers.b25ff414.js +24 -0
  77. package/dist/esm/headers.b25ff414.js.map +1 -0
  78. package/dist/esm/helpers.fb1d7227.js +176 -0
  79. package/dist/esm/helpers.fb1d7227.js.map +1 -0
  80. package/dist/{types.d.ts → esm/index.d.ts} +102 -51
  81. package/dist/esm/index.d.ts.map +1 -0
  82. package/dist/esm/index.js +25 -0
  83. package/dist/esm/index.js.map +1 -0
  84. package/dist/esm/location-info.5543bb05.js +89 -0
  85. package/dist/esm/location-info.5543bb05.js.map +1 -0
  86. package/dist/esm/location-panel.0b1f4ed2.js +58 -0
  87. package/dist/esm/location-panel.0b1f4ed2.js.map +1 -0
  88. package/dist/esm/main.module.5eb366de.js +52 -0
  89. package/dist/esm/main.module.5eb366de.js.map +1 -0
  90. package/dist/esm/main.module.67a908da.js +40 -0
  91. package/dist/esm/main.module.67a908da.js.map +1 -0
  92. package/dist/esm/main.module.89579666.js +64 -0
  93. package/dist/esm/main.module.89579666.js.map +1 -0
  94. package/dist/esm/main.module.9c57cc95.js +28 -0
  95. package/dist/esm/main.module.9c57cc95.js.map +1 -0
  96. package/dist/esm/main.module.f70e002b.js +169 -0
  97. package/dist/esm/main.module.f70e002b.js.map +1 -0
  98. package/dist/esm/map-page.b953c404.js +175 -0
  99. package/dist/esm/map-page.b953c404.js.map +1 -0
  100. package/dist/esm/map-view.a3fe6257.js +161 -0
  101. package/dist/esm/map-view.a3fe6257.js.map +1 -0
  102. package/dist/esm/terrain.f65cf7c5.js +54 -0
  103. package/dist/esm/terrain.f65cf7c5.js.map +1 -0
  104. package/dist/esm/tile-extent.ca526996.js +46 -0
  105. package/dist/esm/tile-extent.ca526996.js.map +1 -0
  106. package/dist/esm/utils.122d1f2d.js +28 -0
  107. package/dist/esm/utils.122d1f2d.js.map +1 -0
  108. package/dist/esm/utils.d40349f0.js +40 -0
  109. package/dist/esm/utils.d40349f0.js.map +1 -0
  110. package/dist/esm/vector-tile-features.e1a24df0.js +258 -0
  111. package/dist/esm/vector-tile-features.e1a24df0.js.map +1 -0
  112. package/dist/esm/xray.c0663c25.js +83 -0
  113. package/dist/esm/xray.c0663c25.js.map +1 -0
  114. package/dist/node/container.abd6f0d2.js +2 -0
  115. package/dist/node/container.abd6f0d2.js.map +1 -0
  116. package/dist/node/context-panel.7c2f42c9.js +2 -0
  117. package/dist/node/context-panel.7c2f42c9.js.map +1 -0
  118. package/dist/node/controls.ffb44307.js +2 -0
  119. package/dist/node/controls.ffb44307.js.map +1 -0
  120. package/dist/node/dev.15b4cdb0.js +2 -0
  121. package/dist/node/dev.15b4cdb0.js.map +1 -0
  122. package/dist/node/expansion-panel.1553938f.js +2 -0
  123. package/dist/node/expansion-panel.1553938f.js.map +1 -0
  124. package/dist/node/hash-string.3fc8ceb0.js +2 -0
  125. package/dist/node/hash-string.3fc8ceb0.js.map +1 -0
  126. package/dist/node/header.5f15d599.js +2 -0
  127. package/dist/node/header.5f15d599.js.map +1 -0
  128. package/dist/node/headers.0d494ac2.js +2 -0
  129. package/dist/node/headers.0d494ac2.js.map +1 -0
  130. package/dist/node/helpers.6bda171f.js +2 -0
  131. package/dist/node/helpers.6bda171f.js.map +1 -0
  132. package/dist/node/index.js +2 -0
  133. package/dist/node/index.js.map +1 -0
  134. package/dist/node/location-info.9f59aad3.js +2 -0
  135. package/dist/node/location-info.9f59aad3.js.map +1 -0
  136. package/dist/node/location-panel.d22d21fa.js +2 -0
  137. package/dist/node/location-panel.d22d21fa.js.map +1 -0
  138. package/dist/node/main.module.24615279.js +2 -0
  139. package/dist/node/main.module.24615279.js.map +1 -0
  140. package/dist/node/main.module.29a15f3d.css +2 -0
  141. package/dist/node/main.module.29a15f3d.css.map +1 -0
  142. package/dist/node/main.module.2cc98713.css +2 -0
  143. package/dist/node/main.module.2cc98713.css.map +1 -0
  144. package/dist/node/main.module.434acaf9.js +2 -0
  145. package/dist/node/main.module.434acaf9.js.map +1 -0
  146. package/dist/node/main.module.61b261c8.css +2 -0
  147. package/dist/node/main.module.61b261c8.css.map +1 -0
  148. package/dist/node/main.module.78d7f40f.js +2 -0
  149. package/dist/node/main.module.78d7f40f.js.map +1 -0
  150. package/dist/node/main.module.89f269c7.css +2 -0
  151. package/dist/node/main.module.89f269c7.css.map +1 -0
  152. package/dist/node/main.module.d4e98e60.js +2 -0
  153. package/dist/node/main.module.d4e98e60.js.map +1 -0
  154. package/dist/node/main.module.e200d631.js +2 -0
  155. package/dist/node/main.module.e200d631.js.map +1 -0
  156. package/dist/node/main.module.f0530add.css +2 -0
  157. package/dist/node/main.module.f0530add.css.map +1 -0
  158. package/dist/node/map-page.0b19d49e.js +2 -0
  159. package/dist/node/map-page.0b19d49e.js.map +1 -0
  160. package/dist/node/map-view.c6746dca.js +2 -0
  161. package/dist/node/map-view.c6746dca.js.map +1 -0
  162. package/dist/node/terrain.96ae432a.js +2 -0
  163. package/dist/node/terrain.96ae432a.js.map +1 -0
  164. package/dist/node/tile-extent.28db5d2c.js +2 -0
  165. package/dist/node/tile-extent.28db5d2c.js.map +1 -0
  166. package/dist/node/utils.274d0452.js +2 -0
  167. package/dist/node/utils.274d0452.js.map +1 -0
  168. package/dist/node/utils.dd92f725.js +2 -0
  169. package/dist/node/utils.dd92f725.js.map +1 -0
  170. package/dist/node/vector-tile-features.c02e240c.js +2 -0
  171. package/dist/node/vector-tile-features.c02e240c.js.map +1 -0
  172. package/dist/node/xray.bce11e7b.js +2 -0
  173. package/dist/node/xray.bce11e7b.js.map +1 -0
  174. package/package.json +28 -36
  175. package/src/container.ts +29 -21
  176. package/src/context-panel/index.ts +4 -4
  177. package/src/context-panel/main.module.sass +1 -1
  178. package/src/dev/main.module.sass +16 -0
  179. package/src/dev/map-page.ts +19 -4
  180. package/src/dev/vector-tile-features.ts +44 -13
  181. package/src/location-panel/header.ts +27 -8
  182. package/src/location-panel/index.ts +4 -2
  183. package/src/location-panel/main.module.sass +7 -0
  184. package/src/main.module.sass +4 -1
  185. package/src/map-view/index.ts +1 -1
  186. package/dist/index.cjs.css +0 -961
  187. package/dist/index.cjs.css.map +0 -1
  188. package/dist/index.cjs.js +0 -1954
  189. package/dist/index.cjs.js.map +0 -1
  190. package/dist/index.css.map +0 -1
  191. package/dist/index.js +0 -1945
  192. package/dist/index.js.map +0 -1
  193. package/dist/types.d.ts.map +0 -1
@@ -13,7 +13,7 @@ export function LoadingButton({
13
13
  isLoading = false,
14
14
  onClick,
15
15
  active = false,
16
- large = false,
16
+ large = true,
17
17
  icon = "menu",
18
18
  style,
19
19
  }) {
@@ -37,13 +37,13 @@ type AnyChildren = React.ReactNode;
37
37
 
38
38
  export interface FloatingNavbarProps {
39
39
  className?: string;
40
- children: AnyChildren;
40
+ children?: AnyChildren;
41
41
  headerElement?: AnyChildren;
42
42
  title?: AnyChildren;
43
43
  statusElement?: AnyChildren;
44
44
  rightElement?: AnyChildren;
45
- height: number | string;
46
- width: number | string;
45
+ height?: number | string;
46
+ width?: number | string;
47
47
  style?: object;
48
48
  }
49
49
 
@@ -11,7 +11,7 @@
11
11
  .searchbar
12
12
  width: 100%
13
13
  background-color: var(--panel-background-color)
14
- border-radius: 5px
14
+ border-radius: var(--map-panel-border-radius, 5px)
15
15
  padding: var(--navbar-padding, 10px)
16
16
  display: flex
17
17
  flex-direction: row
@@ -5,22 +5,35 @@
5
5
  .key-value
6
6
  display: inline-block
7
7
  margin-right: 1em
8
+
8
9
  .key
9
10
  font-weight: bold
10
11
  font-size: 0.9em
12
+
11
13
  &:after
12
14
  content: ': '
15
+
13
16
  .value
14
17
  font-size: 0.9em
15
18
 
16
19
  .feature-properties
17
20
  position: relative
21
+
18
22
  &:before
19
23
  content: "–"
20
24
  position: absolute
21
25
  top: 4px
22
26
  left: 0
23
27
 
28
+ .controls
29
+ display: flex
30
+ flex-direction: row
31
+ align-items: flex-end
32
+ position: absolute
33
+ top: 0
34
+ right: 0
35
+ gap: 0.5em
36
+
24
37
  .feature-header h3
25
38
  margin-bottom: 0
26
39
  margin-top: 0.5em
@@ -28,6 +41,7 @@
28
41
  .feature-group
29
42
  border-bottom: 1px solid var(--panel-rule-inner)
30
43
  margin-bottom: 0.5em
44
+
31
45
  &:last-child
32
46
  border-bottom: none
33
47
 
@@ -35,11 +49,13 @@
35
49
  display: flex
36
50
  flex-direction: row
37
51
  align-items: baseline
52
+
38
53
  h3
39
54
  margin-right: 0.5em
40
55
 
41
56
  .opacity-slider
42
57
  margin: 0 1em 0.5em
58
+
43
59
  :global
44
60
  .bp5-slider-handle .bp5-slider-label
45
61
  background-color: var(--secondary-color)
@@ -21,14 +21,15 @@ import { MapPosition } from "@macrostrat/mapbox-utils";
21
21
 
22
22
  export const h = hyper.styled(styles);
23
23
 
24
- export function MapInspector({
24
+ export function MapInspectorV2({
25
25
  title = "Map inspector",
26
26
  headerElement = null,
27
27
  transformRequest = null,
28
28
  mapPosition = null,
29
29
  mapboxToken = null,
30
30
  overlayStyle = null,
31
- children,
31
+ controls = null,
32
+ children = null,
32
33
  style,
33
34
  bounds = null,
34
35
  focusedSource = null,
@@ -40,6 +41,7 @@ export function MapInspector({
40
41
  transformRequest?: mapboxgl.TransformRequestFunction;
41
42
  title?: string;
42
43
  style?: mapboxgl.Style | string;
44
+ controls?: React.ReactNode;
43
45
  children?: React.ReactNode;
44
46
  mapboxToken?: string;
45
47
  overlayStyle?: mapboxgl.Style | string;
@@ -49,7 +51,7 @@ export function MapInspector({
49
51
  mapPosition?: MapPosition;
50
52
  bounds?: [number, number, number, number];
51
53
  fitViewport?: boolean;
52
- styleType: "standard" | "macrostrat";
54
+ styleType?: "standard" | "macrostrat";
53
55
  }) {
54
56
  /* We apply a custom style to the panel container when we are interacting
55
57
  with the search bar, so that we can block map interactions until search
@@ -147,7 +149,7 @@ export function MapInspector({
147
149
  title,
148
150
  }),
149
151
  contextPanel: h(PanelCard, [
150
- children,
152
+ controls,
151
153
  h(Switch, {
152
154
  checked: xRay,
153
155
  label: "X-ray mode",
@@ -180,10 +182,23 @@ export function MapInspector({
180
182
  setPosition: onSelectPosition,
181
183
  }),
182
184
  h(TileExtentLayer, { tile, color: isEnabled ? "white" : "black" }),
185
+ children,
183
186
  ]
184
187
  )
185
188
  );
186
189
  }
187
190
 
191
+ function MapInspector(props) {
192
+ const { children, controls, ...rest } = props;
193
+ /** Compatibility wrapper for MapInspectorV2 */
194
+ // React warning about this legacy usage
195
+ console.warn("MapInspector is deprecated. Use MapInspectorV2 instead");
196
+
197
+ return h(MapInspectorV2, {
198
+ ...rest,
199
+ controls: [children, controls],
200
+ });
201
+ }
202
+
188
203
  // Legacy export
189
204
  export const DevMapPage = MapInspector;
@@ -1,17 +1,24 @@
1
- import { Spinner, Switch } from "@blueprintjs/core";
1
+ import { Spinner, Switch, Button, Intent } from "@blueprintjs/core";
2
2
  import { useMapRef, useMapStatus } from "@macrostrat/mapbox-react";
3
3
  import mapboxgl from "mapbox-gl";
4
4
  import hyper from "@macrostrat/hyper";
5
5
  import styles from "./main.module.sass";
6
- import { useEffect, useState } from "react";
7
- import { JSONView, usePrevious } from "@macrostrat/ui-components";
6
+ import { useCallback, useEffect, useRef, useState } from "react";
7
+ import { JSONView } from "@macrostrat/ui-components";
8
8
  import { group } from "d3-array";
9
9
  import { ExpansionPanel } from "../expansion-panel";
10
10
 
11
11
  const h = hyper.styled(styles);
12
12
 
13
13
  export function FeatureProperties({ data, ...rest }) {
14
- return h("div.feature-properties", [
14
+ // Instead of managing hover state with CSS, we use a state variable,
15
+ // so that the button re-renders when the state changes
16
+ const [showControls, setShowControls] = useState(false);
17
+ const onMouseEnter = useCallback(() => setShowControls(true), []);
18
+ const onMouseLeave = useCallback(() => setShowControls(false), []);
19
+
20
+ return h("div.feature-properties", { onMouseEnter, onMouseLeave }, [
21
+ h.if(showControls)("div.controls", h(CopyJSONButton, { data })),
15
22
  h(JSONView, {
16
23
  data,
17
24
  hideRoot: true,
@@ -27,6 +34,21 @@ export function FeatureRecord({ feature }) {
27
34
  ]);
28
35
  }
29
36
 
37
+ function CopyJSONButton({ data }) {
38
+ const [copied, setCopied] = useState(false);
39
+ return h(Button, {
40
+ icon: copied ? "tick" : "clipboard",
41
+ intent: copied ? Intent.SUCCESS : Intent.NONE,
42
+ minimal: true,
43
+ small: true,
44
+ onClick() {
45
+ navigator.clipboard.writeText(JSON.stringify(data, null, 2));
46
+ setCopied(true);
47
+ },
48
+ });
49
+ }
50
+
51
+ /** This component wraps queryRenderedFeatures to get features at a given location */
30
52
  export function FeatureSelectionHandler({
31
53
  selectedLocation,
32
54
  setFeatures,
@@ -37,8 +59,10 @@ export function FeatureSelectionHandler({
37
59
  radius?: number;
38
60
  }) {
39
61
  const mapRef = useMapRef();
40
- const { isLoading } = useMapStatus();
41
- const prevLocation = usePrevious(selectedLocation);
62
+ const isLoading = useMapStatus((s) => s.isLoading);
63
+ const isInitialized = useMapStatus((s) => s.isInitialized);
64
+ const prevLocation = useRef(null);
65
+ const prevFeatures = useRef([]);
42
66
 
43
67
  useEffect(() => {
44
68
  const map = mapRef?.current;
@@ -48,8 +72,18 @@ export function FeatureSelectionHandler({
48
72
  return;
49
73
  }
50
74
 
75
+ if (!isInitialized) return;
76
+
77
+ const hasPreviouslyLoadedFeatures = prevFeatures.current.length > 0;
78
+
79
+ const locationMemo = JSON.stringify(selectedLocation);
80
+ if (locationMemo == prevLocation.current && hasPreviouslyLoadedFeatures)
81
+ return;
82
+
83
+ prevLocation.current = locationMemo;
84
+
51
85
  // Don't update if the location hasn't changed
52
- if (selectedLocation == prevLocation) return;
86
+ //if (selectedLocation == prevLocation) return;
53
87
 
54
88
  const r = radius;
55
89
  const pt = map.project(selectedLocation);
@@ -59,8 +93,9 @@ export function FeatureSelectionHandler({
59
93
  [pt.x + r, pt.y + r],
60
94
  ];
61
95
  const features = map.queryRenderedFeatures(bbox);
96
+ prevFeatures.current = features ?? [];
62
97
  setFeatures(features);
63
- }, [mapRef.current, prevLocation?.current, selectedLocation, isLoading]);
98
+ }, [isInitialized, selectedLocation, isLoading]);
64
99
 
65
100
  return null;
66
101
  }
@@ -143,11 +178,7 @@ function UnitNumber({ value, unit, precision = 1 }) {
143
178
  ]);
144
179
  }
145
180
 
146
- export function FeaturePanel({
147
- features,
148
- focusedSource = null,
149
- focusedSourceTitle = null,
150
- }) {
181
+ export function FeaturePanel({ features, focusedSource = null }) {
151
182
  if (features == null) return null;
152
183
 
153
184
  let focusedSourcePanel = null;
@@ -11,14 +11,16 @@ import {
11
11
 
12
12
  const h = hyper.styled(styles);
13
13
 
14
- function PositionButton({ position, showCopyLink = false }) {
14
+ function PositionButton({ position, bounds, showCopyLink = false }) {
15
15
  const focusState = useFocusState(position);
16
16
 
17
17
  const copyLinkIsVisible = isCentered(focusState) && showCopyLink;
18
18
 
19
19
  return h("div.position-controls", [
20
- h(LocationFocusButton, { location: position, focusState }, []),
21
- h.if(copyLinkIsVisible)(CopyLinkButton, { itemName: "position" }),
20
+ h(LocationFocusButton, { location: position, bounds, focusState }, []),
21
+ h.if(copyLinkIsVisible && position != null)(CopyLinkButton, {
22
+ itemName: "position",
23
+ }),
22
24
  ]);
23
25
  }
24
26
 
@@ -66,26 +68,39 @@ function CopyLinkButton({ itemName, children, onClick, ...rest }) {
66
68
  }
67
69
 
68
70
  export interface InfoDrawerHeaderProps {
69
- onClose: () => void;
70
- position: mapboxgl.LngLat;
71
+ onClose?: () => void;
72
+ position?: mapboxgl.LngLat;
71
73
  zoom?: number;
72
74
  elevation?: number;
73
75
  showCopyPositionButton?: boolean;
76
+ bounds?: mapboxgl.LngLatBounds;
74
77
  }
75
78
 
76
79
  export function InfoDrawerHeader(props: InfoDrawerHeaderProps) {
77
80
  const {
78
81
  onClose,
79
82
  position,
83
+ bounds,
80
84
  zoom = 7,
81
85
  elevation,
82
86
  showCopyPositionButton,
87
+ children,
83
88
  } = props;
84
89
 
90
+ let leftButton = null;
91
+ if (bounds != null || position != null) {
92
+ leftButton = h(PositionButton, {
93
+ position,
94
+ bounds,
95
+ showCopyLink: showCopyPositionButton,
96
+ });
97
+ }
98
+
85
99
  return h("header.location-panel-header", [
86
- h(PositionButton, { position, showCopyLink: showCopyPositionButton }),
100
+ leftButton,
101
+ children,
87
102
  h("div.spacer"),
88
- h(LngLatCoords, {
103
+ h.if(position != null)(LngLatCoords, {
89
104
  position,
90
105
  zoom,
91
106
  className: "infodrawer-header-item",
@@ -94,6 +109,10 @@ export function InfoDrawerHeader(props: InfoDrawerHeaderProps) {
94
109
  elevation,
95
110
  className: "infodrawer-header-item",
96
111
  }),
97
- h(Button, { minimal: true, icon: "cross", onClick: onClose }),
112
+ h.if(onClose != null)(Button, {
113
+ minimal: true,
114
+ icon: "cross",
115
+ onClick: onClose,
116
+ }),
98
117
  ]);
99
118
  }
@@ -1,15 +1,15 @@
1
- import { Card } from "@blueprintjs/core";
2
1
  import hyper from "@macrostrat/hyper";
3
2
  import { InfoDrawerHeader, InfoDrawerHeaderProps } from "./header";
4
3
  import classNames from "classnames";
5
4
  import styles from "./main.module.sass";
6
5
  import { ErrorBoundary } from "@macrostrat/ui-components";
6
+ import { PanelCard } from "../container";
7
7
 
8
8
  const h = hyper.styled(styles);
9
9
 
10
10
  export function InfoDrawerContainer(props) {
11
11
  const className = classNames("infodrawer", props.className);
12
- return h(Card, { ...props, className });
12
+ return h(PanelCard, { ...props, className });
13
13
  }
14
14
 
15
15
  interface BaseInfoDrawerProps extends InfoDrawerHeaderProps {
@@ -42,6 +42,8 @@ export function BaseInfoDrawer(props: BaseInfoDrawerProps) {
42
42
  ]);
43
43
  }
44
44
 
45
+ export const DetailsPanel = BaseInfoDrawer;
46
+
45
47
  export function LocationPanel(props) {
46
48
  const { children, className, loading = false, ...rest } = props;
47
49
  const cls = classNames("location-panel", className, { loading });
@@ -10,6 +10,7 @@
10
10
  flex-direction: row
11
11
  align-items: center
12
12
  gap: 1em
13
+ min-height: 40px
13
14
  border-bottom: 1px solid var(--panel-rule-color)
14
15
 
15
16
  .spacer
@@ -21,6 +22,12 @@
21
22
  .position-controls :global(.bp5-button)
22
23
  font-size: 12px !important
23
24
 
25
+ // Text elements should
26
+ h1, h2, h3, h4, h5, h6, p
27
+ margin: 0
28
+ &:first-child
29
+ margin-left: 10px
30
+
24
31
  .infodrawer-header-item
25
32
  font-size: 12px
26
33
 
@@ -5,6 +5,7 @@
5
5
  width: 100%
6
6
  height: 100%
7
7
  overflow: hidden
8
+ --map-panel-border-radius: 4px
8
9
 
9
10
  &.show-panel-outlines
10
11
  .map-view-container
@@ -101,7 +102,7 @@
101
102
  position: absolute
102
103
 
103
104
 
104
- .context-panel-holder>:global(.bp5-card)
105
+ .context-panel-holder > :global(.bp5-card)
105
106
  padding: 10px
106
107
  background-color: var(--panel-background-color)
107
108
 
@@ -109,6 +110,7 @@
109
110
  padding: 10px
110
111
  background-color: var(--panel-background-color)
111
112
  overflow: hidden
113
+ border-radius: var(--map-panel-border-radius)
112
114
 
113
115
  & > :last-child
114
116
  margin-bottom: 0
@@ -394,6 +396,7 @@
394
396
  display: flex
395
397
  flex-direction: column
396
398
 
399
+
397
400
  &.adaptive-width
398
401
  width: var(--map-context-stack-width, none)
399
402
  max-width: var(--map-context-stack-max-width, none)
@@ -3,7 +3,6 @@ import {
3
3
  useMapRef,
4
4
  useMapDispatch,
5
5
  useMapPosition,
6
- useMapStatus,
7
6
  } from "@macrostrat/mapbox-react";
8
7
  import {
9
8
  mapViewInfo,
@@ -129,6 +128,7 @@ export function MapView(props: MapViewProps) {
129
128
  style,
130
129
  projection,
131
130
  mapPosition,
131
+ transformRequest,
132
132
  ...rest,
133
133
  });
134
134
  dispatch({ type: "set-map", payload: map });