@guardian/interactive-component-library 0.1.0-alpha.49 → 0.1.0-alpha.50
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.
|
@@ -2369,13 +2369,13 @@
|
|
|
2369
2369
|
return preact.cloneElement(t, { className: i });
|
|
2370
2370
|
});
|
|
2371
2371
|
};
|
|
2372
|
-
const transitionContainer = "
|
|
2373
|
-
const blur = "
|
|
2374
|
-
const modalBox = "
|
|
2375
|
-
const enter = "
|
|
2376
|
-
const exitDone = "
|
|
2377
|
-
const enterActive = "
|
|
2378
|
-
const
|
|
2372
|
+
const transitionContainer = "_transitionContainer_11twd_1";
|
|
2373
|
+
const blur = "_blur_11twd_11";
|
|
2374
|
+
const modalBox = "_modalBox_11twd_16";
|
|
2375
|
+
const enter = "_enter_11twd_25";
|
|
2376
|
+
const exitDone = "_exitDone_11twd_26";
|
|
2377
|
+
const enterActive = "_enterActive_11twd_37";
|
|
2378
|
+
const exit = "_exit_11twd_26";
|
|
2379
2379
|
const defaultStyles$3 = {
|
|
2380
2380
|
transitionContainer,
|
|
2381
2381
|
blur,
|
|
@@ -2383,11 +2383,12 @@
|
|
|
2383
2383
|
enter,
|
|
2384
2384
|
exitDone,
|
|
2385
2385
|
enterActive,
|
|
2386
|
-
|
|
2386
|
+
exit
|
|
2387
2387
|
};
|
|
2388
2388
|
function Modal({
|
|
2389
2389
|
visible = false,
|
|
2390
2390
|
blurBackground = true,
|
|
2391
|
+
alwaysMounted = false,
|
|
2391
2392
|
styles: styles2,
|
|
2392
2393
|
children,
|
|
2393
2394
|
onClickOutside
|
|
@@ -2414,10 +2415,11 @@
|
|
|
2414
2415
|
}, [onClick, visible]);
|
|
2415
2416
|
if (typeof document === "undefined")
|
|
2416
2417
|
return;
|
|
2417
|
-
return
|
|
2418
|
+
return jsxRuntime.jsx(d, {
|
|
2418
2419
|
in: visible,
|
|
2419
2420
|
duration: 300,
|
|
2420
2421
|
classNames: styles2,
|
|
2422
|
+
alwaysMounted,
|
|
2421
2423
|
children: jsxRuntime.jsx("div", {
|
|
2422
2424
|
className: [styles2.transitionContainer, blurBackground && styles2.blur, visible && styles2.visible].join(" "),
|
|
2423
2425
|
onClick,
|
|
@@ -2427,7 +2429,7 @@
|
|
|
2427
2429
|
children
|
|
2428
2430
|
})
|
|
2429
2431
|
})
|
|
2430
|
-
})
|
|
2432
|
+
});
|
|
2431
2433
|
}
|
|
2432
2434
|
const container$1 = "_container_6u92g_1";
|
|
2433
2435
|
const button$3 = "_button_6u92g_5";
|
|
@@ -3880,6 +3882,21 @@
|
|
|
3880
3882
|
};
|
|
3881
3883
|
return scaled;
|
|
3882
3884
|
}
|
|
3885
|
+
function sizeForElement(element) {
|
|
3886
|
+
const computedStyle = getComputedStyle(element);
|
|
3887
|
+
if (!computedStyle)
|
|
3888
|
+
return null;
|
|
3889
|
+
let size;
|
|
3890
|
+
const width = element.offsetWidth - parseFloat(computedStyle["borderLeftWidth"]) - parseFloat(computedStyle["paddingLeft"]) - parseFloat(computedStyle["paddingRight"]) - parseFloat(computedStyle["borderRightWidth"]);
|
|
3891
|
+
const height = element.offsetHeight - parseFloat(computedStyle["borderTopWidth"]) - parseFloat(computedStyle["paddingTop"]) - parseFloat(computedStyle["paddingBottom"]) - parseFloat(computedStyle["borderBottomWidth"]);
|
|
3892
|
+
if (!isNaN(width) && !isNaN(height)) {
|
|
3893
|
+
size = [width, height];
|
|
3894
|
+
if (!hasArea(size) && !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length)) {
|
|
3895
|
+
console.warn("No map visible because the map container's width or height are 0.");
|
|
3896
|
+
}
|
|
3897
|
+
}
|
|
3898
|
+
return size;
|
|
3899
|
+
}
|
|
3883
3900
|
function arrayEquals(arr1, arr2) {
|
|
3884
3901
|
const len1 = arr1.length;
|
|
3885
3902
|
if (len1 !== arr2.length) {
|
|
@@ -5917,7 +5934,9 @@
|
|
|
5917
5934
|
this._viewport.style.height = "100%";
|
|
5918
5935
|
this.target.appendChild(this._viewport);
|
|
5919
5936
|
this._renderer = new MapRenderer(this);
|
|
5920
|
-
this._resizeObserver = new ResizeObserver(() =>
|
|
5937
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
5938
|
+
this._updateSize();
|
|
5939
|
+
});
|
|
5921
5940
|
this._resizeObserver.observe(this.target);
|
|
5922
5941
|
this._viewport.addEventListener("touchmove", (event) => {
|
|
5923
5942
|
if (event.targetTouches.length < 2 && this.collaborativeGesturesEnabled) {
|
|
@@ -6063,22 +6082,11 @@
|
|
|
6063
6082
|
/** PRIVATE METHODS */
|
|
6064
6083
|
_updateSize() {
|
|
6065
6084
|
const targetElement = this.target;
|
|
6066
|
-
let
|
|
6067
|
-
if (targetElement) {
|
|
6068
|
-
const computedStyle = getComputedStyle(targetElement);
|
|
6069
|
-
const width = targetElement.offsetWidth - parseFloat(computedStyle["borderLeftWidth"]) - parseFloat(computedStyle["paddingLeft"]) - parseFloat(computedStyle["paddingRight"]) - parseFloat(computedStyle["borderRightWidth"]);
|
|
6070
|
-
const height = targetElement.offsetHeight - parseFloat(computedStyle["borderTopWidth"]) - parseFloat(computedStyle["paddingTop"]) - parseFloat(computedStyle["paddingBottom"]) - parseFloat(computedStyle["borderBottomWidth"]);
|
|
6071
|
-
if (!isNaN(width) && !isNaN(height)) {
|
|
6072
|
-
size = [width, height];
|
|
6073
|
-
if (!hasArea(size) && !!(targetElement.offsetWidth || targetElement.offsetHeight || targetElement.getClientRects().length)) {
|
|
6074
|
-
console.warn("No map visible because the map container's width or height are 0.");
|
|
6075
|
-
}
|
|
6076
|
-
}
|
|
6077
|
-
}
|
|
6085
|
+
let newSize = sizeForElement(targetElement);
|
|
6078
6086
|
const oldSize = this.size;
|
|
6079
|
-
if (
|
|
6080
|
-
this._size =
|
|
6081
|
-
this._updateViewportSize(
|
|
6087
|
+
if (newSize && (!oldSize || !arrayEquals(newSize, oldSize))) {
|
|
6088
|
+
this._size = newSize;
|
|
6089
|
+
this._updateViewportSize(newSize);
|
|
6082
6090
|
}
|
|
6083
6091
|
}
|
|
6084
6092
|
_updateViewportSize(size) {
|
|
@@ -6313,11 +6321,11 @@
|
|
|
6313
6321
|
};
|
|
6314
6322
|
}
|
|
6315
6323
|
}
|
|
6316
|
-
const mapContainer = "
|
|
6317
|
-
const helpTextContainer = "
|
|
6318
|
-
const helpText = "
|
|
6319
|
-
const desktopHelpText = "
|
|
6320
|
-
const mobileHelpText$1 = "
|
|
6324
|
+
const mapContainer = "_mapContainer_1ogf3_9";
|
|
6325
|
+
const helpTextContainer = "_helpTextContainer_1ogf3_15";
|
|
6326
|
+
const helpText = "_helpText_1ogf3_15";
|
|
6327
|
+
const desktopHelpText = "_desktopHelpText_1ogf3_40";
|
|
6328
|
+
const mobileHelpText$1 = "_mobileHelpText_1ogf3_48";
|
|
6321
6329
|
const styles$3 = {
|
|
6322
6330
|
mapContainer,
|
|
6323
6331
|
helpTextContainer,
|
|
@@ -6751,7 +6759,7 @@
|
|
|
6751
6759
|
this.fontWeight = (options == null ? void 0 : options.fontWeight) || "400";
|
|
6752
6760
|
this.lineHeight = (options == null ? void 0 : options.lineHeight) || 1.3;
|
|
6753
6761
|
this.color = (options == null ? void 0 : options.color) || "#121212";
|
|
6754
|
-
this.textShadow = (options == null ? void 0 : options.textShadow) || "1px 1px 0px
|
|
6762
|
+
this.textShadow = (options == null ? void 0 : options.textShadow) || "1px 1px 0px #f6f6f6, -1px -1px 0px #f6f6f6, -1px 1px 0px #f6f6f6, 1px -1px #f6f6f6";
|
|
6755
6763
|
}
|
|
6756
6764
|
}
|
|
6757
6765
|
var rbushKnn = { exports: {} };
|
|
@@ -7812,7 +7820,7 @@
|
|
|
7812
7820
|
className: styles.buttons,
|
|
7813
7821
|
children: [jsxRuntime.jsx(ArrowButton, {
|
|
7814
7822
|
onClick: () => setPageIndex((d2) => d2 + 1),
|
|
7815
|
-
disabled: pageIndex >= numberOfPages -
|
|
7823
|
+
disabled: pageIndex >= numberOfPages - 2
|
|
7816
7824
|
}), jsxRuntime.jsx(ArrowButton, {
|
|
7817
7825
|
direction: "left",
|
|
7818
7826
|
onClick: () => setPageIndex((d2) => d2 - 1),
|