@guardian/interactive-component-library 0.1.0-alpha.31 → 0.1.0-alpha.32
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.
|
@@ -145,12 +145,14 @@ const LegendItem = ({
|
|
|
145
145
|
})]
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
|
-
const bar$2 = "
|
|
149
|
-
const label$1 = "
|
|
150
|
-
const
|
|
148
|
+
const bar$2 = "_bar_1jxh9_1";
|
|
149
|
+
const label$1 = "_label_1jxh9_5";
|
|
150
|
+
const labelStroke = "_labelStroke_1jxh9_11";
|
|
151
|
+
const backgroundRect = "_backgroundRect_1jxh9_17";
|
|
151
152
|
const defaultStyles$u = {
|
|
152
153
|
bar: bar$2,
|
|
153
154
|
label: label$1,
|
|
155
|
+
labelStroke,
|
|
154
156
|
backgroundRect
|
|
155
157
|
};
|
|
156
158
|
function preventOverlap(labelPositions, iteration = 0, labelSize = 12, coordinate = "y", moveBothLabels = true) {
|
|
@@ -223,7 +225,7 @@ function StackedBar({
|
|
|
223
225
|
const renderLabel = (config, i) => jsx("text", {
|
|
224
226
|
ref: (element) => textElements.current[i] = element,
|
|
225
227
|
"text-rendering": "optimizeLegibility",
|
|
226
|
-
className: styles2.label
|
|
228
|
+
className: `${styles2.label} ${config.hasStroke ? styles2.labelStroke : ""}`,
|
|
227
229
|
style: {
|
|
228
230
|
display: "visible"
|
|
229
231
|
},
|
|
@@ -275,6 +277,10 @@ function StackedBar({
|
|
|
275
277
|
});
|
|
276
278
|
return preventOverlap(labels, 0, labelOverlapConfig.labelSize, "x", labelOverlapConfig.moveBothLabels);
|
|
277
279
|
}, [stack, height, width]);
|
|
280
|
+
const strokedHangingLabelConfig = useMemo(() => [...hangingLabelConfig].map((l) => ({
|
|
281
|
+
...l,
|
|
282
|
+
hasStroke: true
|
|
283
|
+
})), [hangingLabelConfig]);
|
|
278
284
|
const backgroundRect2 = jsx("g", {
|
|
279
285
|
children: jsx("rect", {
|
|
280
286
|
x: "0",
|
|
@@ -292,7 +298,7 @@ function StackedBar({
|
|
|
292
298
|
viewBox: `0 0 ${width} ${svgHeight}`,
|
|
293
299
|
xmlns: "http://www.w3.org/2000/svg",
|
|
294
300
|
children: [showBackgroundRect && backgroundRect2, jsxs("g", {
|
|
295
|
-
children: [content2, labelType === LabelType.hanging && !hideLabels && hangingLabelConfig.map((config, i) => renderLabel(config, i))]
|
|
301
|
+
children: [content2, labelType === LabelType.hanging && !hideLabels && strokedHangingLabelConfig.map((config, i) => renderLabel(config, i)), labelType === LabelType.hanging && !hideLabels && hangingLabelConfig.map((config, i) => renderLabel(config, i))]
|
|
296
302
|
})]
|
|
297
303
|
});
|
|
298
304
|
}
|
|
@@ -1937,11 +1943,11 @@ const ToplineResult = forwardRef(({
|
|
|
1937
1943
|
})]
|
|
1938
1944
|
});
|
|
1939
1945
|
});
|
|
1940
|
-
const borderTop = "
|
|
1941
|
-
const section = "
|
|
1942
|
-
const fullWidth = "
|
|
1943
|
-
const header = "
|
|
1944
|
-
const content = "
|
|
1946
|
+
const borderTop = "_borderTop_1b1s0_9";
|
|
1947
|
+
const section = "_section_1b1s0_13";
|
|
1948
|
+
const fullWidth = "_fullWidth_1b1s0_56";
|
|
1949
|
+
const header = "_header_1b1s0_95";
|
|
1950
|
+
const content = "_content_1b1s0_132";
|
|
1945
1951
|
const defaultStyles$9 = {
|
|
1946
1952
|
borderTop,
|
|
1947
1953
|
section,
|
|
@@ -2144,14 +2150,14 @@ function SearchIcon() {
|
|
|
2144
2150
|
})
|
|
2145
2151
|
});
|
|
2146
2152
|
}
|
|
2147
|
-
const searchContainer = "
|
|
2148
|
-
const input = "
|
|
2149
|
-
const searchIcon = "
|
|
2150
|
-
const clearButton = "
|
|
2151
|
-
const suggestions = "
|
|
2152
|
-
const suggestion = "
|
|
2153
|
-
const selected$1 = "
|
|
2154
|
-
const highlighted = "
|
|
2153
|
+
const searchContainer = "_searchContainer_116es_1";
|
|
2154
|
+
const input = "_input_116es_5";
|
|
2155
|
+
const searchIcon = "_searchIcon_116es_27";
|
|
2156
|
+
const clearButton = "_clearButton_116es_36";
|
|
2157
|
+
const suggestions = "_suggestions_116es_42";
|
|
2158
|
+
const suggestion = "_suggestion_116es_42";
|
|
2159
|
+
const selected$1 = "_selected_116es_68";
|
|
2160
|
+
const highlighted = "_highlighted_116es_72";
|
|
2155
2161
|
const defaultStyles$5 = {
|
|
2156
2162
|
searchContainer,
|
|
2157
2163
|
input,
|
|
@@ -2190,6 +2196,7 @@ function SearchInput({
|
|
|
2190
2196
|
onSelectSuggestion(suggestions2[selectedIndex]);
|
|
2191
2197
|
} else if (event.key === "Enter") {
|
|
2192
2198
|
onSubmit(inputRef.current.value);
|
|
2199
|
+
inputRef.current.blur();
|
|
2193
2200
|
}
|
|
2194
2201
|
}
|
|
2195
2202
|
async function inputChanged(input2) {
|
|
@@ -2205,7 +2212,7 @@ function SearchInput({
|
|
|
2205
2212
|
inputRef.current.value = suggestion2.text;
|
|
2206
2213
|
inputRef.current.blur();
|
|
2207
2214
|
}
|
|
2208
|
-
const showClearButton = ((_a = inputRef.current) == null ? void 0 : _a.value) && ((_b = inputRef.current) == null ? void 0 : _b.value) !== "";
|
|
2215
|
+
const showClearButton = ((_a = inputRef.current) == null ? void 0 : _a.value) && ((_b = inputRef.current) == null ? void 0 : _b.value) !== "" || inputValue && inputValue !== "";
|
|
2209
2216
|
return jsxs("div", {
|
|
2210
2217
|
className: styles2.searchContainer,
|
|
2211
2218
|
children: [jsx("input", {
|
|
@@ -2445,6 +2452,8 @@ function Modal({
|
|
|
2445
2452
|
}
|
|
2446
2453
|
};
|
|
2447
2454
|
}, [onClick, visible]);
|
|
2455
|
+
if (typeof document === "undefined")
|
|
2456
|
+
return;
|
|
2448
2457
|
return createPortal(jsx(d, {
|
|
2449
2458
|
in: visible,
|
|
2450
2459
|
duration: 300,
|
|
@@ -3715,10 +3724,10 @@ function IconPlus$1() {
|
|
|
3715
3724
|
})
|
|
3716
3725
|
});
|
|
3717
3726
|
}
|
|
3718
|
-
const zoomControl$
|
|
3727
|
+
const zoomControl$2 = "_zoomControl_1qhlz_1";
|
|
3719
3728
|
const button$2 = "_button_1qhlz_7";
|
|
3720
3729
|
const styles$5 = {
|
|
3721
|
-
zoomControl: zoomControl$
|
|
3730
|
+
zoomControl: zoomControl$2,
|
|
3722
3731
|
button: button$2
|
|
3723
3732
|
};
|
|
3724
3733
|
function ZoomControl$1({
|
|
@@ -3762,15 +3771,15 @@ function useOrganisedChildren(children) {
|
|
|
3762
3771
|
}, [children]);
|
|
3763
3772
|
return organisedChildren;
|
|
3764
3773
|
}
|
|
3765
|
-
const container = "
|
|
3766
|
-
const svg = "
|
|
3767
|
-
const controls$1 = "
|
|
3768
|
-
const zoomControl$
|
|
3774
|
+
const container = "_container_1ta61_1";
|
|
3775
|
+
const svg = "_svg_1ta61_7";
|
|
3776
|
+
const controls$1 = "_controls_1ta61_13";
|
|
3777
|
+
const zoomControl$1 = "_zoomControl_1ta61_21";
|
|
3769
3778
|
const styles$4 = {
|
|
3770
3779
|
container,
|
|
3771
3780
|
svg,
|
|
3772
3781
|
controls: controls$1,
|
|
3773
|
-
zoomControl: zoomControl$
|
|
3782
|
+
zoomControl: zoomControl$1
|
|
3774
3783
|
};
|
|
3775
3784
|
const _Projection = {
|
|
3776
3785
|
geoAlbersUKComposite: geoAlbersUk(),
|
|
@@ -3891,10 +3900,11 @@ function hasArea(size) {
|
|
|
3891
3900
|
return size[0] > 0 && size[1] > 0;
|
|
3892
3901
|
}
|
|
3893
3902
|
function sizeMinusPadding(size, padding) {
|
|
3903
|
+
let newSize = [...size];
|
|
3894
3904
|
if (padding) {
|
|
3895
|
-
|
|
3905
|
+
newSize = [size[0] - padding.left - padding.right, size[1] - padding.top - padding.bottom];
|
|
3896
3906
|
}
|
|
3897
|
-
return
|
|
3907
|
+
return newSize;
|
|
3898
3908
|
}
|
|
3899
3909
|
function scaleSize(size, ratio, dest) {
|
|
3900
3910
|
if (dest === void 0) {
|
|
@@ -3907,8 +3917,8 @@ function scaleSize(size, ratio, dest) {
|
|
|
3907
3917
|
function scalePadding(padding, ratio) {
|
|
3908
3918
|
const scaled = {
|
|
3909
3919
|
top: Math.round(padding.top * ratio),
|
|
3910
|
-
right: Math.round(padding.
|
|
3911
|
-
bottom: Math.round(padding.
|
|
3920
|
+
right: Math.round(padding.right * ratio),
|
|
3921
|
+
bottom: Math.round(padding.bottom * ratio),
|
|
3912
3922
|
left: Math.round(padding.left * ratio)
|
|
3913
3923
|
};
|
|
3914
3924
|
return scaled;
|
|
@@ -4620,17 +4630,18 @@ class Dispatcher {
|
|
|
4620
4630
|
return;
|
|
4621
4631
|
listenersForEvent.delete(listenerKey);
|
|
4622
4632
|
}
|
|
4623
|
-
dispatch(eventType) {
|
|
4633
|
+
dispatch(eventType, payload) {
|
|
4624
4634
|
const listenersForEvent = this._listenersByEvent.get(eventType);
|
|
4625
4635
|
if (!listenersForEvent)
|
|
4626
4636
|
return;
|
|
4627
4637
|
listenersForEvent.forEach((callback) => {
|
|
4628
|
-
callback(this.target);
|
|
4638
|
+
callback(this.target, payload);
|
|
4629
4639
|
});
|
|
4630
4640
|
}
|
|
4631
4641
|
}
|
|
4632
|
-
const
|
|
4633
|
-
CHANGE: "change"
|
|
4642
|
+
const MapEvent = {
|
|
4643
|
+
CHANGE: "change",
|
|
4644
|
+
ZOOM: "zoom"
|
|
4634
4645
|
};
|
|
4635
4646
|
var noop = { value: () => {
|
|
4636
4647
|
} };
|
|
@@ -5936,6 +5947,7 @@ let Map$2 = class Map2 {
|
|
|
5936
5947
|
this.view = options.view;
|
|
5937
5948
|
this.target = options.target;
|
|
5938
5949
|
this.layers = [];
|
|
5950
|
+
this.dispatcher = new Dispatcher(this);
|
|
5939
5951
|
this._viewport = document.createElement("div");
|
|
5940
5952
|
this._viewport.style.position = "relative";
|
|
5941
5953
|
this._viewport.style.overflow = "hidden";
|
|
@@ -5962,9 +5974,9 @@ let Map$2 = class Map2 {
|
|
|
5962
5974
|
}).on("zoom", (event) => {
|
|
5963
5975
|
this.view.transform = event.transform;
|
|
5964
5976
|
this._requestRender();
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
}
|
|
5977
|
+
this.dispatcher.dispatch(MapEvent.ZOOM, {
|
|
5978
|
+
currentZoomLevel: event.transform.k
|
|
5979
|
+
});
|
|
5968
5980
|
});
|
|
5969
5981
|
select(this._viewport).call(this._zoomBehaviour);
|
|
5970
5982
|
}
|
|
@@ -5995,7 +6007,7 @@ let Map$2 = class Map2 {
|
|
|
5995
6007
|
addLayers(layers) {
|
|
5996
6008
|
this.layers = this.layers.concat(layers);
|
|
5997
6009
|
layers.forEach((layer) => {
|
|
5998
|
-
layer.on(
|
|
6010
|
+
layer.on(MapEvent.CHANGE, () => {
|
|
5999
6011
|
this._requestRender();
|
|
6000
6012
|
});
|
|
6001
6013
|
});
|
|
@@ -6170,12 +6182,12 @@ class View {
|
|
|
6170
6182
|
}
|
|
6171
6183
|
// map size in pixels (i.e. scaled by device pixel ratio)
|
|
6172
6184
|
get mapSize() {
|
|
6173
|
-
return
|
|
6185
|
+
return scaleSize(this.viewPortSize, this.pixelRatio);
|
|
6174
6186
|
}
|
|
6175
|
-
// padding in pixels (i.e. scaled by device pixel ratio)
|
|
6176
6187
|
get padding() {
|
|
6177
6188
|
return this._padding;
|
|
6178
6189
|
}
|
|
6190
|
+
// padding in pixels (i.e. scaled by device pixel ratio)
|
|
6179
6191
|
get scaledPadding() {
|
|
6180
6192
|
const scaledPadding = {
|
|
6181
6193
|
...this._padding
|
|
@@ -6232,12 +6244,13 @@ class View {
|
|
|
6232
6244
|
}
|
|
6233
6245
|
// get extent for drawn map
|
|
6234
6246
|
getMapExtent() {
|
|
6235
|
-
const
|
|
6236
|
-
const
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6247
|
+
const mapSizeInPixels = this.mapSize;
|
|
6248
|
+
const paddingInPixels = this.scaledPadding;
|
|
6249
|
+
return [[paddingInPixels.left, paddingInPixels.top], sizeMinusPadding(mapSizeInPixels, {
|
|
6250
|
+
...paddingInPixels,
|
|
6251
|
+
left: 0,
|
|
6252
|
+
top: 0
|
|
6253
|
+
})];
|
|
6241
6254
|
}
|
|
6242
6255
|
// visible extent in map coordinates
|
|
6243
6256
|
getVisibleExtent(transform, projection) {
|
|
@@ -6260,6 +6273,90 @@ class View {
|
|
|
6260
6273
|
};
|
|
6261
6274
|
}
|
|
6262
6275
|
}
|
|
6276
|
+
const mapContainer = "_mapContainer_y5eeh_9";
|
|
6277
|
+
const helpTextContainer = "_helpTextContainer_y5eeh_15";
|
|
6278
|
+
const helpText = "_helpText_y5eeh_15";
|
|
6279
|
+
const highlight = "_highlight_y5eeh_40";
|
|
6280
|
+
const styles$3 = {
|
|
6281
|
+
mapContainer,
|
|
6282
|
+
helpTextContainer,
|
|
6283
|
+
helpText,
|
|
6284
|
+
highlight
|
|
6285
|
+
};
|
|
6286
|
+
const Map$1 = forwardRef(({
|
|
6287
|
+
config,
|
|
6288
|
+
onLoad,
|
|
6289
|
+
children
|
|
6290
|
+
}, ref) => {
|
|
6291
|
+
const {
|
|
6292
|
+
layers
|
|
6293
|
+
} = children;
|
|
6294
|
+
const [map, setMap] = useState();
|
|
6295
|
+
const [hideDefaultHelpText, setHideDefaultHelpText] = useState(false);
|
|
6296
|
+
const [zoomHelpText, setZoomHelpText] = useState("");
|
|
6297
|
+
const [highlightHelpText, setHighlightHelpText] = useState(false);
|
|
6298
|
+
useEffect(() => {
|
|
6299
|
+
const map2 = new Map$2({
|
|
6300
|
+
view: new View(config.view),
|
|
6301
|
+
target: targetRef.current
|
|
6302
|
+
});
|
|
6303
|
+
map2.addLayers(layers);
|
|
6304
|
+
setMap(map2);
|
|
6305
|
+
if (ref)
|
|
6306
|
+
ref.current = map2;
|
|
6307
|
+
onLoad && onLoad(map2);
|
|
6308
|
+
const zoomHelpText2 = navigator.userAgent.indexOf("Mac") !== -1 ? "Use ⌘ + scroll to zoom" : "Use Ctrl + scroll to zoom";
|
|
6309
|
+
setZoomHelpText(zoomHelpText2);
|
|
6310
|
+
return () => {
|
|
6311
|
+
if (ref)
|
|
6312
|
+
ref.current = null;
|
|
6313
|
+
setMap(null);
|
|
6314
|
+
};
|
|
6315
|
+
}, []);
|
|
6316
|
+
useEffect(() => {
|
|
6317
|
+
if (!map)
|
|
6318
|
+
return;
|
|
6319
|
+
let timeoutID;
|
|
6320
|
+
map.onFilterEvent(() => {
|
|
6321
|
+
if (timeoutID)
|
|
6322
|
+
clearTimeout(timeoutID);
|
|
6323
|
+
setHighlightHelpText(true);
|
|
6324
|
+
timeoutID = setTimeout(() => {
|
|
6325
|
+
setHighlightHelpText();
|
|
6326
|
+
}, 1e3);
|
|
6327
|
+
});
|
|
6328
|
+
map.onZoomEvent((zoomLevel) => {
|
|
6329
|
+
setHideDefaultHelpText(zoomLevel > 1);
|
|
6330
|
+
});
|
|
6331
|
+
return () => {
|
|
6332
|
+
if (timeoutID)
|
|
6333
|
+
clearTimeout(timeoutID);
|
|
6334
|
+
};
|
|
6335
|
+
}, [map]);
|
|
6336
|
+
useEffect(() => {
|
|
6337
|
+
if (map && layers !== map.layers) {
|
|
6338
|
+
map.setLayers(layers);
|
|
6339
|
+
}
|
|
6340
|
+
}, [map, layers]);
|
|
6341
|
+
const targetRef = useRef();
|
|
6342
|
+
const hideHelpText = hideDefaultHelpText && !highlightHelpText;
|
|
6343
|
+
const helpText2 = highlightHelpText ? zoomHelpText : config.defaultHelpText;
|
|
6344
|
+
return jsx("div", {
|
|
6345
|
+
ref: targetRef,
|
|
6346
|
+
className: styles$3.mapContainer,
|
|
6347
|
+
children: jsx("div", {
|
|
6348
|
+
className: styles$3.helpTextContainer,
|
|
6349
|
+
style: {
|
|
6350
|
+
opacity: hideHelpText ? 0 : 1
|
|
6351
|
+
},
|
|
6352
|
+
"aria-hidden": true,
|
|
6353
|
+
children: jsx("p", {
|
|
6354
|
+
className: [styles$3.helpText, highlightHelpText && styles$3.highlight].join(" "),
|
|
6355
|
+
children: helpText2
|
|
6356
|
+
})
|
|
6357
|
+
})
|
|
6358
|
+
});
|
|
6359
|
+
});
|
|
6263
6360
|
function IconMinus() {
|
|
6264
6361
|
return jsx("svg", {
|
|
6265
6362
|
width: "22",
|
|
@@ -6307,10 +6404,10 @@ function IconReset({
|
|
|
6307
6404
|
})
|
|
6308
6405
|
});
|
|
6309
6406
|
}
|
|
6310
|
-
const zoomControl
|
|
6407
|
+
const zoomControl = "_zoomControl_13wd1_1";
|
|
6311
6408
|
const button$1 = "_button_13wd1_7";
|
|
6312
|
-
const styles$
|
|
6313
|
-
zoomControl
|
|
6409
|
+
const styles$2 = {
|
|
6410
|
+
zoomControl,
|
|
6314
6411
|
button: button$1
|
|
6315
6412
|
};
|
|
6316
6413
|
function ZoomControl({
|
|
@@ -6332,17 +6429,17 @@ function ZoomControl({
|
|
|
6332
6429
|
onReset(event);
|
|
6333
6430
|
};
|
|
6334
6431
|
return jsxs("div", {
|
|
6335
|
-
className: styles$
|
|
6432
|
+
className: styles$2.zoomControl,
|
|
6336
6433
|
children: [jsx("button", {
|
|
6337
|
-
className: styles$
|
|
6434
|
+
className: styles$2.button,
|
|
6338
6435
|
onClick: _onZoomIn,
|
|
6339
6436
|
children: jsx(IconPlus, {})
|
|
6340
6437
|
}), jsx("button", {
|
|
6341
|
-
className: styles$
|
|
6438
|
+
className: styles$2.button,
|
|
6342
6439
|
onClick: _onZoomOut,
|
|
6343
6440
|
children: jsx(IconMinus, {})
|
|
6344
6441
|
}), jsx("button", {
|
|
6345
|
-
className: styles$
|
|
6442
|
+
className: styles$2.button,
|
|
6346
6443
|
onClick: _onReset,
|
|
6347
6444
|
disabled: !resetEnabled,
|
|
6348
6445
|
children: jsx(IconReset, {
|
|
@@ -6351,101 +6448,6 @@ function ZoomControl({
|
|
|
6351
6448
|
})]
|
|
6352
6449
|
});
|
|
6353
6450
|
}
|
|
6354
|
-
const mapContainer = "_mapContainer_aknz0_9";
|
|
6355
|
-
const helpTextContainer = "_helpTextContainer_aknz0_15";
|
|
6356
|
-
const helpText = "_helpText_aknz0_15";
|
|
6357
|
-
const highlight = "_highlight_aknz0_40";
|
|
6358
|
-
const zoomControl = "_zoomControl_aknz0_45";
|
|
6359
|
-
const styles$2 = {
|
|
6360
|
-
mapContainer,
|
|
6361
|
-
helpTextContainer,
|
|
6362
|
-
helpText,
|
|
6363
|
-
highlight,
|
|
6364
|
-
zoomControl
|
|
6365
|
-
};
|
|
6366
|
-
const Map$1 = forwardRef(({
|
|
6367
|
-
config,
|
|
6368
|
-
children
|
|
6369
|
-
}, ref) => {
|
|
6370
|
-
const {
|
|
6371
|
-
controls: controls2,
|
|
6372
|
-
layers
|
|
6373
|
-
} = children;
|
|
6374
|
-
const [map, setMap] = useState();
|
|
6375
|
-
const [currentZoomLevel, setCurrentZoomLevel] = useState(1);
|
|
6376
|
-
const [hideDefaultHelpText, setHideDefaultHelpText] = useState(false);
|
|
6377
|
-
const [zoomHelpText, setZoomHelpText] = useState("");
|
|
6378
|
-
const [highlightHelpText, setHighlightHelpText] = useState(false);
|
|
6379
|
-
useEffect(() => {
|
|
6380
|
-
const map2 = new Map$2({
|
|
6381
|
-
view: new View(config.view),
|
|
6382
|
-
target: targetRef.current
|
|
6383
|
-
});
|
|
6384
|
-
map2.addLayers(layers);
|
|
6385
|
-
setMap(map2);
|
|
6386
|
-
if (ref)
|
|
6387
|
-
ref.current = map2;
|
|
6388
|
-
const zoomHelpText2 = navigator.userAgent.indexOf("Mac") !== -1 ? "Use ⌘ + scroll to zoom" : "Use Ctrl + scroll to zoom";
|
|
6389
|
-
setZoomHelpText(zoomHelpText2);
|
|
6390
|
-
return () => {
|
|
6391
|
-
if (ref)
|
|
6392
|
-
ref.current = null;
|
|
6393
|
-
setMap(null);
|
|
6394
|
-
};
|
|
6395
|
-
}, []);
|
|
6396
|
-
useEffect(() => {
|
|
6397
|
-
if (!map)
|
|
6398
|
-
return;
|
|
6399
|
-
let timeoutID;
|
|
6400
|
-
map.onFilterEvent(() => {
|
|
6401
|
-
if (timeoutID)
|
|
6402
|
-
clearTimeout(timeoutID);
|
|
6403
|
-
setHighlightHelpText(true);
|
|
6404
|
-
timeoutID = setTimeout(() => {
|
|
6405
|
-
setHighlightHelpText();
|
|
6406
|
-
}, 1e3);
|
|
6407
|
-
});
|
|
6408
|
-
map.onZoomEvent((zoomLevel) => {
|
|
6409
|
-
setCurrentZoomLevel(zoomLevel);
|
|
6410
|
-
setHideDefaultHelpText(zoomLevel > 1);
|
|
6411
|
-
});
|
|
6412
|
-
return () => {
|
|
6413
|
-
if (timeoutID)
|
|
6414
|
-
clearTimeout(timeoutID);
|
|
6415
|
-
};
|
|
6416
|
-
}, [map]);
|
|
6417
|
-
useEffect(() => {
|
|
6418
|
-
if (map && layers !== map.layers) {
|
|
6419
|
-
map.setLayers(layers);
|
|
6420
|
-
}
|
|
6421
|
-
}, [map, layers]);
|
|
6422
|
-
const targetRef = useRef();
|
|
6423
|
-
const hideHelpText = hideDefaultHelpText && !highlightHelpText;
|
|
6424
|
-
const helpText2 = highlightHelpText ? zoomHelpText : config.defaultHelpText;
|
|
6425
|
-
return jsxs("div", {
|
|
6426
|
-
ref: targetRef,
|
|
6427
|
-
className: styles$2.mapContainer,
|
|
6428
|
-
children: [jsx("div", {
|
|
6429
|
-
className: styles$2.helpTextContainer,
|
|
6430
|
-
style: {
|
|
6431
|
-
opacity: hideHelpText ? 0 : 1
|
|
6432
|
-
},
|
|
6433
|
-
"aria-hidden": true,
|
|
6434
|
-
children: jsx("p", {
|
|
6435
|
-
className: [styles$2.helpText, highlightHelpText && styles$2.highlight].join(" "),
|
|
6436
|
-
children: helpText2
|
|
6437
|
-
})
|
|
6438
|
-
}), jsx("div", {
|
|
6439
|
-
className: styles$2.zoomControl,
|
|
6440
|
-
children: jsx(ZoomControl, {
|
|
6441
|
-
resetEnabled: currentZoomLevel > 1,
|
|
6442
|
-
onZoomIn: () => map.zoomIn(),
|
|
6443
|
-
onZoomOut: () => map.zoomOut(),
|
|
6444
|
-
onReset: () => map.zoomTo(1)
|
|
6445
|
-
})
|
|
6446
|
-
})]
|
|
6447
|
-
});
|
|
6448
|
-
});
|
|
6449
6451
|
const Projection = {
|
|
6450
6452
|
geoAlbersUKComposite: geoAlbersUk(),
|
|
6451
6453
|
geoAlbersEngland: geoAlbers().center([0, 52.7]).rotate([1.1743, 0]).parallels([50, 54]),
|
|
@@ -6789,7 +6791,7 @@ class VectorSource {
|
|
|
6789
6791
|
});
|
|
6790
6792
|
}
|
|
6791
6793
|
this._features = features;
|
|
6792
|
-
this.dispatcher.dispatch(
|
|
6794
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6793
6795
|
}
|
|
6794
6796
|
}
|
|
6795
6797
|
class TextLayer {
|
|
@@ -6832,7 +6834,7 @@ class TextLayer {
|
|
|
6832
6834
|
}
|
|
6833
6835
|
set style(style2) {
|
|
6834
6836
|
this._style = style2;
|
|
6835
|
-
this.dispatcher.dispatch(
|
|
6837
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6836
6838
|
}
|
|
6837
6839
|
getExtent() {
|
|
6838
6840
|
if (this._extent)
|
|
@@ -6970,9 +6972,9 @@ class VectorLayer {
|
|
|
6970
6972
|
this._source.tearDown();
|
|
6971
6973
|
}
|
|
6972
6974
|
this._source = source;
|
|
6973
|
-
source.on(
|
|
6975
|
+
source.on(MapEvent.CHANGE, () => {
|
|
6974
6976
|
this._extent = null;
|
|
6975
|
-
this.dispatcher.dispatch(
|
|
6977
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6976
6978
|
});
|
|
6977
6979
|
}
|
|
6978
6980
|
setRawProjection(projection) {
|
|
@@ -6991,7 +6993,7 @@ class VectorLayer {
|
|
|
6991
6993
|
}
|
|
6992
6994
|
set style(style2) {
|
|
6993
6995
|
this._style = style2;
|
|
6994
|
-
this.dispatcher.dispatch(
|
|
6996
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6995
6997
|
}
|
|
6996
6998
|
getStyleFunction() {
|
|
6997
6999
|
const style2 = this.style;
|
|
@@ -7656,7 +7658,7 @@ function Ticker({
|
|
|
7656
7658
|
}, []);
|
|
7657
7659
|
useLayoutEffect(() => {
|
|
7658
7660
|
const tickerItemsContainer = tickerItemsRef.current;
|
|
7659
|
-
const hideButtons2 = windowSize.width >= 480 ? tickerScrollRef.current.scrollWidth <= tickerItemsContainer.clientWidth :
|
|
7661
|
+
const hideButtons2 = windowSize.width >= 480 ? tickerScrollRef.current.scrollWidth <= tickerItemsContainer.clientWidth : childArray.length < 3;
|
|
7660
7662
|
setHideButtons(hideButtons2);
|
|
7661
7663
|
}, [windowSize, setHideButtons]);
|
|
7662
7664
|
function toggleExpandedState() {
|
|
@@ -7847,6 +7849,7 @@ export {
|
|
|
7847
7849
|
Container,
|
|
7848
7850
|
ControlChange,
|
|
7849
7851
|
Controls,
|
|
7852
|
+
Dispatcher,
|
|
7850
7853
|
Dropdown,
|
|
7851
7854
|
Fill,
|
|
7852
7855
|
FirstPastThePostWaffle,
|
|
@@ -7859,6 +7862,7 @@ export {
|
|
|
7859
7862
|
LegendItem,
|
|
7860
7863
|
Map$1 as Map,
|
|
7861
7864
|
MapConfiguration,
|
|
7865
|
+
MapEvent,
|
|
7862
7866
|
MapLayers,
|
|
7863
7867
|
Modal,
|
|
7864
7868
|
PageSection,
|
|
@@ -7888,6 +7892,7 @@ export {
|
|
|
7888
7892
|
VectorSource,
|
|
7889
7893
|
Waffle,
|
|
7890
7894
|
WaffleType,
|
|
7895
|
+
ZoomControl,
|
|
7891
7896
|
_Projection,
|
|
7892
7897
|
bboxFeature,
|
|
7893
7898
|
interpolateFeatures,
|