@treely/strapi-slices 8.2.4 → 8.2.6
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.cjs +38 -26
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +38 -26
- package/dist/index.js.map +2 -2
- package/dist/slices/HeroWithHighlights/HeroWithHighlights.d.ts +2 -1
- package/dist/slices/HeroWithHighlights/HeroWithHighlights.d.ts.map +1 -1
- package/dist/slices/ProjectsMap/ProjectsMap.d.ts.map +1 -1
- package/dist/slices/Redirect/Redirect.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4941,7 +4941,6 @@ var ProjectsMap = ({
|
|
|
4941
4941
|
const map = (0, import_react34.useRef)(null);
|
|
4942
4942
|
const animationIntervalRef = (0, import_react34.useRef)(null);
|
|
4943
4943
|
const [featureCollection, setFeatureCollection] = (0, import_react34.useState)(null);
|
|
4944
|
-
const [isLoading, setIsLoading] = (0, import_react34.useState)(false);
|
|
4945
4944
|
const initialBboxRef = (0, import_react34.useRef)(null);
|
|
4946
4945
|
const [isMapReady, setIsMapReady] = (0, import_react34.useState)(false);
|
|
4947
4946
|
const [strapiProjects, setStrapiProjects] = (0, import_react34.useState)(null);
|
|
@@ -4964,15 +4963,12 @@ var ProjectsMap = ({
|
|
|
4964
4963
|
}, [locale, strapiProjects]);
|
|
4965
4964
|
const fetchProjectsData = (0, import_react34.useCallback)(
|
|
4966
4965
|
async (bbox) => {
|
|
4967
|
-
setIsLoading(true);
|
|
4968
4966
|
try {
|
|
4969
4967
|
const fpmData = await getFpmProjectsByBbox_default(bbox);
|
|
4970
4968
|
const mergedData = strapiProjects ? mergeProjectData_default(fpmData, strapiProjects) : fpmData;
|
|
4971
4969
|
setFeatureCollection(mergedData);
|
|
4972
4970
|
} catch (error) {
|
|
4973
4971
|
console.error("Error fetching projects:", error);
|
|
4974
|
-
} finally {
|
|
4975
|
-
setIsLoading(false);
|
|
4976
4972
|
}
|
|
4977
4973
|
},
|
|
4978
4974
|
[strapiProjects]
|
|
@@ -5246,7 +5242,7 @@ var ProjectsMap = ({
|
|
|
5246
5242
|
const bounds = new import_mapbox_gl.default.LngLatBounds([west, south], [east, north]);
|
|
5247
5243
|
const center = bounds.getCenter();
|
|
5248
5244
|
initialCenter = [center.lng, center.lat];
|
|
5249
|
-
initialZoom = 6;
|
|
5245
|
+
initialZoom = slice.defaultZoomLevel ?? 6;
|
|
5250
5246
|
}
|
|
5251
5247
|
map.current = new import_mapbox_gl.default.Map({
|
|
5252
5248
|
container: mapContainer.current,
|
|
@@ -5254,25 +5250,17 @@ var ProjectsMap = ({
|
|
|
5254
5250
|
center: initialCenter,
|
|
5255
5251
|
zoom: initialZoom,
|
|
5256
5252
|
maxZoom: MAPBOX_MAX_ZOOM,
|
|
5257
|
-
minZoom: slice.minZoomLevel
|
|
5253
|
+
minZoom: slice.minZoomLevel,
|
|
5254
|
+
cooperativeGestures: true
|
|
5258
5255
|
});
|
|
5259
5256
|
map.current.addControl(new import_mapbox_gl.default.NavigationControl(), "top-right");
|
|
5260
5257
|
map.current.on("load", () => {
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
const bbox = initialBboxRef.current || FALLBACK_BBOX;
|
|
5264
|
-
const [west, south, east, north] = bbox.split(",").map(Number);
|
|
5265
|
-
const bounds = new import_mapbox_gl.default.LngLatBounds([west, south], [east, north]);
|
|
5266
|
-
map.current?.fitBounds(bounds, { padding: 20 });
|
|
5267
|
-
}
|
|
5268
|
-
});
|
|
5269
|
-
map.current.on("moveend", () => {
|
|
5270
|
-
if (initialBboxRef.current) {
|
|
5271
|
-
debouncedUpdateBbox();
|
|
5258
|
+
if (map.current?.getLayer("road-number-shield")) {
|
|
5259
|
+
map.current?.setLayoutProperty("road-number-shield", "visibility", "none");
|
|
5272
5260
|
}
|
|
5261
|
+
setIsMapReady(true);
|
|
5273
5262
|
});
|
|
5274
5263
|
return () => {
|
|
5275
|
-
debouncedUpdateBbox.cancel();
|
|
5276
5264
|
if (animationIntervalRef.current) {
|
|
5277
5265
|
clearInterval(animationIntervalRef.current);
|
|
5278
5266
|
}
|
|
@@ -5282,9 +5270,17 @@ var ProjectsMap = ({
|
|
|
5282
5270
|
}, [
|
|
5283
5271
|
slice.defaultCenterCoordinates,
|
|
5284
5272
|
slice.defaultZoomLevel,
|
|
5285
|
-
slice.minZoomLevel
|
|
5286
|
-
debouncedUpdateBbox
|
|
5273
|
+
slice.minZoomLevel
|
|
5287
5274
|
]);
|
|
5275
|
+
(0, import_react34.useEffect)(() => {
|
|
5276
|
+
if (!map.current || !isMapReady) return;
|
|
5277
|
+
const currentMap = map.current;
|
|
5278
|
+
currentMap.on("moveend", debouncedUpdateBbox);
|
|
5279
|
+
return () => {
|
|
5280
|
+
debouncedUpdateBbox.cancel();
|
|
5281
|
+
currentMap.off("moveend", debouncedUpdateBbox);
|
|
5282
|
+
};
|
|
5283
|
+
}, [isMapReady, debouncedUpdateBbox]);
|
|
5288
5284
|
(0, import_react34.useEffect)(() => {
|
|
5289
5285
|
fetchStrapiData();
|
|
5290
5286
|
}, [fetchStrapiData]);
|
|
@@ -5313,12 +5309,11 @@ var ProjectsMap = ({
|
|
|
5313
5309
|
if (map.current) {
|
|
5314
5310
|
map.current.easeTo({
|
|
5315
5311
|
center: [userLoc.lon, userLoc.lat],
|
|
5316
|
-
zoom: 10,
|
|
5312
|
+
zoom: slice.defaultZoomLevel ?? 10,
|
|
5317
5313
|
duration: 1500
|
|
5318
5314
|
});
|
|
5319
5315
|
const buffer = 1;
|
|
5320
5316
|
const bbox = `${userLoc.lon - buffer},${userLoc.lat - buffer},${userLoc.lon + buffer},${userLoc.lat + buffer}`;
|
|
5321
|
-
initialBboxRef.current = bbox;
|
|
5322
5317
|
fetchProjectsData(bbox);
|
|
5323
5318
|
}
|
|
5324
5319
|
},
|
|
@@ -5388,8 +5383,7 @@ var ProjectsMap = ({
|
|
|
5388
5383
|
overflow: "hidden",
|
|
5389
5384
|
boxShadow: ["md", null, null, "none"]
|
|
5390
5385
|
}
|
|
5391
|
-
)
|
|
5392
|
-
isLoading && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_boemly34.Box, { children: "Loading projects..." })
|
|
5386
|
+
)
|
|
5393
5387
|
] })
|
|
5394
5388
|
] });
|
|
5395
5389
|
};
|
|
@@ -8856,12 +8850,30 @@ var VARIANTS5 = {
|
|
|
8856
8850
|
white: { backgroundColor: "white", titleColor: "primary.900" },
|
|
8857
8851
|
gray: { backgroundColor: "primary.50", titleColor: "primary.900" }
|
|
8858
8852
|
};
|
|
8853
|
+
var getMobileSize = (size) => {
|
|
8854
|
+
const sizeMap = {
|
|
8855
|
+
"7xl": "4xl",
|
|
8856
|
+
"6xl": "3xl",
|
|
8857
|
+
"5xl": "2xl",
|
|
8858
|
+
"4xl": "xl",
|
|
8859
|
+
"3xl": "lg",
|
|
8860
|
+
"2xl": "md",
|
|
8861
|
+
"xl": "sm",
|
|
8862
|
+
"lg": "xs",
|
|
8863
|
+
"md": "xs",
|
|
8864
|
+
"sm": "xs",
|
|
8865
|
+
"xs": "xs"
|
|
8866
|
+
};
|
|
8867
|
+
return sizeMap[size];
|
|
8868
|
+
};
|
|
8859
8869
|
var HeroWithHighlights = ({
|
|
8860
8870
|
slice
|
|
8861
8871
|
}) => {
|
|
8862
8872
|
const parts = parseTitle(slice.title);
|
|
8863
8873
|
const variant = slice.variant || "white";
|
|
8864
8874
|
const textAlign = slice.textAlign || "left";
|
|
8875
|
+
const desktopSize = slice.headingSize || "3xl";
|
|
8876
|
+
const mobileSize = getMobileSize(desktopSize);
|
|
8865
8877
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
8866
8878
|
import_boemly61.Box,
|
|
8867
8879
|
{
|
|
@@ -8875,7 +8887,7 @@ var HeroWithHighlights = ({
|
|
|
8875
8887
|
import_boemly61.Heading,
|
|
8876
8888
|
{
|
|
8877
8889
|
as: slice.headingLevel || "h1",
|
|
8878
|
-
size: [
|
|
8890
|
+
size: [mobileSize, desktopSize],
|
|
8879
8891
|
color: VARIANTS5[variant].titleColor,
|
|
8880
8892
|
lineHeight: "1.3",
|
|
8881
8893
|
fontWeight: "600",
|
|
@@ -8936,7 +8948,7 @@ var Redirect = ({ slice }) => {
|
|
|
8936
8948
|
router.asPath,
|
|
8937
8949
|
router.query
|
|
8938
8950
|
);
|
|
8939
|
-
|
|
8951
|
+
window.location.replace(redirectUrl);
|
|
8940
8952
|
}, [slice.url, router]);
|
|
8941
8953
|
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, {});
|
|
8942
8954
|
};
|