From b20f2a343c9aee92b55d5e17a85e2d2218cbfa2c Mon Sep 17 00:00:00 2001 From: dleadbetter <> Date: Fri, 16 Feb 2024 12:57:05 -0500 Subject: [PATCH] RC #251 - Publishing v1.2.0-beta.9; Testing removing useMap hook from "geospatial" package --- packages/controlled-vocabulary/package.json | 6 +++--- packages/core-data/package.json | 6 +++--- packages/core-data/src/components/PlaceMarker.js | 2 ++ packages/geospatial/package.json | 4 ++-- .../geospatial/src/components/LocationMarker.js | 15 ++++++++++----- packages/semantic-ui/package.json | 4 ++-- packages/shared/package.json | 2 +- .../src/geospatial/LocationMarker.stories.js | 3 ++- packages/user-defined-fields/package.json | 6 +++--- packages/visualize/package.json | 2 +- react-components.json | 2 +- 11 files changed, 30 insertions(+), 22 deletions(-) diff --git a/packages/controlled-vocabulary/package.json b/packages/controlled-vocabulary/package.json index d8b5e43d..970669ae 100644 --- a/packages/controlled-vocabulary/package.json +++ b/packages/controlled-vocabulary/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/controlled-vocabulary", - "version": "1.2.0-beta.8", + "version": "1.2.0-beta.9", "description": "A package of components to allow user to configure dropdown elements. Use with the \"controlled_vocabulary\" gem.", "license": "MIT", "main": "./build/index.js", @@ -12,8 +12,8 @@ "build": "webpack --mode production && flow-copy-source -v src types" }, "dependencies": { - "@performant-software/semantic-components": "^1.2.0-beta.8", - "@performant-software/shared-components": "^1.2.0-beta.8", + "@performant-software/semantic-components": "^1.2.0-beta.9", + "@performant-software/shared-components": "^1.2.0-beta.9", "i18next": "^21.9.2", "semantic-ui-react": "^2.1.2", "underscore": "^1.13.2" diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 0c048965..a5553b73 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/core-data", - "version": "1.2.0-beta.8", + "version": "1.2.0-beta.9", "description": "A package of components used for Core Data", "license": "MIT", "main": "./build/index.js", @@ -9,6 +9,8 @@ "build": "webpack --mode production && flow-copy-source -v src types" }, "dependencies": { + "@peripleo/maplibre": "^0.3.3", + "@performant-software/geospatial": "^1.2.0-beta.8", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-dialog": "^1.0.5", "@samvera/clover-iiif": "^2.3.2", @@ -20,8 +22,6 @@ "underscore": "^1.13.2" }, "peerDependencies": { - "@peripleo/maplibre": "^0.3.3", - "@performant-software/geospatial": "^1.2.0-beta.8", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js index 9a0ba749..e793f987 100644 --- a/packages/core-data/src/components/PlaceMarker.js +++ b/packages/core-data/src/components/PlaceMarker.js @@ -1,5 +1,6 @@ // @flow +import { useMap } from '@peripleo/maplibre'; import { LocationMarker } from '@performant-software/geospatial'; import React, { useCallback, useEffect, useState } from 'react'; @@ -52,6 +53,7 @@ const PlaceMarker = (props: Props) => { return ( ); }; diff --git a/packages/geospatial/package.json b/packages/geospatial/package.json index 23551395..1b0de5da 100644 --- a/packages/geospatial/package.json +++ b/packages/geospatial/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/geospatial", - "version": "1.2.0-beta.8", + "version": "1.2.0-beta.9", "description": "TODO: ADD", "license": "MIT", "main": "./build/index.js", @@ -10,6 +10,7 @@ }, "dependencies": { "@mapbox/mapbox-gl-draw": "^1.4.3", + "@peripleo/maplibre": "^0.3.3", "@radix-ui/react-accordion": "^1.1.2", "@radix-ui/react-dialog": "^1.0.5", "@samvera/clover-iiif": "^2.3.2", @@ -22,7 +23,6 @@ "underscore": "^1.13.6" }, "peerDependencies": { - "@peripleo/maplibre": "^0.3.3", "react": ">= 16.13.1 < 19.0.0", "react-dom": ">= 16.13.1 < 19.0.0" }, diff --git a/packages/geospatial/src/components/LocationMarker.js b/packages/geospatial/src/components/LocationMarker.js index 40e069db..ac07fe89 100644 --- a/packages/geospatial/src/components/LocationMarker.js +++ b/packages/geospatial/src/components/LocationMarker.js @@ -1,7 +1,7 @@ // @flow -import React, { useEffect } from 'react'; -import { MixedGeoJSONLayer, PulsingMarkerLayer, useMap } from '@peripleo/maplibre'; +import React, { useEffect, useMemo } from 'react'; +import { MixedGeoJSONLayer, PulsingMarkerLayer, type Map } from '@peripleo/maplibre'; import { DEFAULT_FILL_STYLE, DEFAULT_POINT_STYLE, DEFAULT_STROKE_STYLE } from '../utils/MapStyles'; import MapUtils from '../utils/Map'; @@ -29,7 +29,12 @@ type Props = { /** * GeoJSON layer stroke style */ - strokeStyle?: { [key: string]: any } + strokeStyle?: { [key: string]: any }, + + /** + * Hook used to retrieve the map instance. + */ + useMap?: () => Map }; const DEFAULT_BUFFER = 2; @@ -38,7 +43,7 @@ const DEFAULT_BUFFER = 2; * This component renders a location marker to be used in a Peripleo context. */ const LocationMarker = (props: Props) => { - const map = useMap(); + const map = useMemo(() => props.useMap(), [props.useMap]); /** * Sets the bounding box on the map. @@ -48,7 +53,7 @@ const LocationMarker = (props: Props) => { const boundingBox = MapUtils.getBoundingBox(props.data, props.buffer); map.fitBounds(boundingBox); } - }, [props.buffer, props.data]); + }, [map, props.buffer, props.data]); return ( <> diff --git a/packages/semantic-ui/package.json b/packages/semantic-ui/package.json index 0ed5f61d..d3d8b8ae 100644 --- a/packages/semantic-ui/package.json +++ b/packages/semantic-ui/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/semantic-components", - "version": "1.2.0-beta.8", + "version": "1.2.0-beta.9", "description": "A package of shared components based on the Semantic UI Framework.", "license": "MIT", "main": "./build/index.js", @@ -12,7 +12,7 @@ "build": "webpack --mode production && flow-copy-source -v src types" }, "dependencies": { - "@performant-software/shared-components": "^1.2.0-beta.8", + "@performant-software/shared-components": "^1.2.0-beta.9", "@react-google-maps/api": "^2.8.1", "axios": "^0.26.1", "i18next": "^19.4.4", diff --git a/packages/shared/package.json b/packages/shared/package.json index 5e8db5b4..b2cae768 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/shared-components", - "version": "1.2.0-beta.8", + "version": "1.2.0-beta.9", "description": "A package of shared, framework agnostic, components.", "license": "MIT", "main": "./build/index.js", diff --git a/packages/storybook/src/geospatial/LocationMarker.stories.js b/packages/storybook/src/geospatial/LocationMarker.stories.js index 0e6c37a6..069d65d9 100644 --- a/packages/storybook/src/geospatial/LocationMarker.stories.js +++ b/packages/storybook/src/geospatial/LocationMarker.stories.js @@ -1,7 +1,7 @@ // @flow import { Peripleo, Controls } from '@peripleo/peripleo'; -import { Map, Zoom } from '@peripleo/maplibre'; +import { Map, Zoom, useMap } from '@peripleo/maplibre'; import React from 'react'; import LocationMarker from '../../../geospatial/src/components/LocationMarker'; import mapStyle from '../data/MapStyles.json'; @@ -35,6 +35,7 @@ export const Default = () => ( 31.4252249 ] }} + useMap={useMap} /> diff --git a/packages/user-defined-fields/package.json b/packages/user-defined-fields/package.json index e4eadc50..accb2e7a 100644 --- a/packages/user-defined-fields/package.json +++ b/packages/user-defined-fields/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/user-defined-fields", - "version": "1.2.0-beta.8", + "version": "1.2.0-beta.9", "description": "A package of components used for allowing end users to define fields on models. Use with the \"user_defined_fields\" gem.", "license": "MIT", "main": "./build/index.js", @@ -9,8 +9,8 @@ "build": "webpack --mode production && flow-copy-source -v src types" }, "dependencies": { - "@performant-software/semantic-components": "^1.2.0-beta.8", - "@performant-software/shared-components": "^1.2.0-beta.8", + "@performant-software/semantic-components": "^1.2.0-beta.9", + "@performant-software/shared-components": "^1.2.0-beta.9", "i18next": "^21.9.1", "semantic-ui-react": "^2.1.2", "underscore": "^1.13.2" diff --git a/packages/visualize/package.json b/packages/visualize/package.json index 8eb125e6..5b956251 100644 --- a/packages/visualize/package.json +++ b/packages/visualize/package.json @@ -1,6 +1,6 @@ { "name": "@performant-software/visualize", - "version": "1.2.0-beta.8", + "version": "1.2.0-beta.9", "description": "A package of components used for data visualization", "license": "MIT", "main": "./build/index.js", diff --git a/react-components.json b/react-components.json index a9c38727..67ac3146 100644 --- a/react-components.json +++ b/react-components.json @@ -8,5 +8,5 @@ "packages/user-defined-fields", "packages/visualize" ], - "version": "1.2.0-beta.8" + "version": "1.2.0-beta.9" }