@guardian/interactive-component-library 0.1.0-alpha.31 → 0.1.0-alpha.33
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.
|
@@ -141,12 +141,14 @@
|
|
|
141
141
|
})]
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
|
-
const bar$2 = "
|
|
145
|
-
const label$1 = "
|
|
146
|
-
const
|
|
144
|
+
const bar$2 = "_bar_1jxh9_1";
|
|
145
|
+
const label$1 = "_label_1jxh9_5";
|
|
146
|
+
const labelStroke = "_labelStroke_1jxh9_11";
|
|
147
|
+
const backgroundRect = "_backgroundRect_1jxh9_17";
|
|
147
148
|
const defaultStyles$u = {
|
|
148
149
|
bar: bar$2,
|
|
149
150
|
label: label$1,
|
|
151
|
+
labelStroke,
|
|
150
152
|
backgroundRect
|
|
151
153
|
};
|
|
152
154
|
function preventOverlap(labelPositions, iteration = 0, labelSize = 12, coordinate = "y", moveBothLabels = true) {
|
|
@@ -219,7 +221,7 @@
|
|
|
219
221
|
const renderLabel = (config, i) => jsxRuntime.jsx("text", {
|
|
220
222
|
ref: (element) => textElements.current[i] = element,
|
|
221
223
|
"text-rendering": "optimizeLegibility",
|
|
222
|
-
className: styles2.label
|
|
224
|
+
className: `${styles2.label} ${config.hasStroke ? styles2.labelStroke : ""}`,
|
|
223
225
|
style: {
|
|
224
226
|
display: "visible"
|
|
225
227
|
},
|
|
@@ -271,6 +273,10 @@
|
|
|
271
273
|
});
|
|
272
274
|
return preventOverlap(labels, 0, labelOverlapConfig.labelSize, "x", labelOverlapConfig.moveBothLabels);
|
|
273
275
|
}, [stack, height, width]);
|
|
276
|
+
const strokedHangingLabelConfig = hooks.useMemo(() => [...hangingLabelConfig].map((l) => ({
|
|
277
|
+
...l,
|
|
278
|
+
hasStroke: true
|
|
279
|
+
})), [hangingLabelConfig]);
|
|
274
280
|
const backgroundRect2 = jsxRuntime.jsx("g", {
|
|
275
281
|
children: jsxRuntime.jsx("rect", {
|
|
276
282
|
x: "0",
|
|
@@ -288,7 +294,7 @@
|
|
|
288
294
|
viewBox: `0 0 ${width} ${svgHeight}`,
|
|
289
295
|
xmlns: "http://www.w3.org/2000/svg",
|
|
290
296
|
children: [showBackgroundRect && backgroundRect2, jsxRuntime.jsxs("g", {
|
|
291
|
-
children: [content2, labelType === LabelType.hanging && !hideLabels && hangingLabelConfig.map((config, i) => renderLabel(config, i))]
|
|
297
|
+
children: [content2, labelType === LabelType.hanging && !hideLabels && strokedHangingLabelConfig.map((config, i) => renderLabel(config, i)), labelType === LabelType.hanging && !hideLabels && hangingLabelConfig.map((config, i) => renderLabel(config, i))]
|
|
292
298
|
})]
|
|
293
299
|
});
|
|
294
300
|
}
|
|
@@ -475,7 +481,10 @@
|
|
|
475
481
|
numberOfRows,
|
|
476
482
|
type = WaffleType.circle,
|
|
477
483
|
idAccessor,
|
|
478
|
-
onMouseOver
|
|
484
|
+
onMouseOver = () => {
|
|
485
|
+
},
|
|
486
|
+
onClick = () => {
|
|
487
|
+
},
|
|
479
488
|
styles: styles2
|
|
480
489
|
}) => {
|
|
481
490
|
const containerRef = hooks.useRef();
|
|
@@ -500,6 +509,7 @@
|
|
|
500
509
|
attributes = {
|
|
501
510
|
id: unit2[idAccessor] || `w-${j}`,
|
|
502
511
|
onMouseOver: (e) => onMouseOver(unit2, e),
|
|
512
|
+
onClick: (e) => onClick(unit2, e),
|
|
503
513
|
class: `${styles2.unit} ${unit2.class}`,
|
|
504
514
|
height: unitHeight,
|
|
505
515
|
width: unitWidth,
|
|
@@ -510,6 +520,7 @@
|
|
|
510
520
|
attributes = {
|
|
511
521
|
id: unit2[idAccessor] || `w-${j}`,
|
|
512
522
|
onMouseOver: (e) => onMouseOver(unit2, e),
|
|
523
|
+
onClick: (e) => onClick(unit2, e),
|
|
513
524
|
class: `${styles2.unit} ${unit2.class}`,
|
|
514
525
|
r: unitWidth / 2,
|
|
515
526
|
transform: `translate(${unitWidth * Math.floor(j / numberOfRows) + unitWidth / 2}, ${unitHeight * (j % numberOfRows) + unitHeight / 2})`
|
|
@@ -1933,11 +1944,11 @@
|
|
|
1933
1944
|
})]
|
|
1934
1945
|
});
|
|
1935
1946
|
});
|
|
1936
|
-
const borderTop = "
|
|
1937
|
-
const section = "
|
|
1938
|
-
const fullWidth = "
|
|
1939
|
-
const header = "
|
|
1940
|
-
const content = "
|
|
1947
|
+
const borderTop = "_borderTop_1b1s0_9";
|
|
1948
|
+
const section = "_section_1b1s0_13";
|
|
1949
|
+
const fullWidth = "_fullWidth_1b1s0_56";
|
|
1950
|
+
const header = "_header_1b1s0_95";
|
|
1951
|
+
const content = "_content_1b1s0_132";
|
|
1941
1952
|
const defaultStyles$9 = {
|
|
1942
1953
|
borderTop,
|
|
1943
1954
|
section,
|
|
@@ -2140,14 +2151,14 @@
|
|
|
2140
2151
|
})
|
|
2141
2152
|
});
|
|
2142
2153
|
}
|
|
2143
|
-
const searchContainer = "
|
|
2144
|
-
const input = "
|
|
2145
|
-
const searchIcon = "
|
|
2146
|
-
const clearButton = "
|
|
2147
|
-
const suggestions = "
|
|
2148
|
-
const suggestion = "
|
|
2149
|
-
const selected$1 = "
|
|
2150
|
-
const highlighted = "
|
|
2154
|
+
const searchContainer = "_searchContainer_116es_1";
|
|
2155
|
+
const input = "_input_116es_5";
|
|
2156
|
+
const searchIcon = "_searchIcon_116es_27";
|
|
2157
|
+
const clearButton = "_clearButton_116es_36";
|
|
2158
|
+
const suggestions = "_suggestions_116es_42";
|
|
2159
|
+
const suggestion = "_suggestion_116es_42";
|
|
2160
|
+
const selected$1 = "_selected_116es_68";
|
|
2161
|
+
const highlighted = "_highlighted_116es_72";
|
|
2151
2162
|
const defaultStyles$5 = {
|
|
2152
2163
|
searchContainer,
|
|
2153
2164
|
input,
|
|
@@ -2186,6 +2197,7 @@
|
|
|
2186
2197
|
onSelectSuggestion(suggestions2[selectedIndex]);
|
|
2187
2198
|
} else if (event.key === "Enter") {
|
|
2188
2199
|
onSubmit(inputRef.current.value);
|
|
2200
|
+
inputRef.current.blur();
|
|
2189
2201
|
}
|
|
2190
2202
|
}
|
|
2191
2203
|
async function inputChanged(input2) {
|
|
@@ -2201,7 +2213,7 @@
|
|
|
2201
2213
|
inputRef.current.value = suggestion2.text;
|
|
2202
2214
|
inputRef.current.blur();
|
|
2203
2215
|
}
|
|
2204
|
-
const showClearButton = ((_a = inputRef.current) == null ? void 0 : _a.value) && ((_b = inputRef.current) == null ? void 0 : _b.value) !== "";
|
|
2216
|
+
const showClearButton = ((_a = inputRef.current) == null ? void 0 : _a.value) && ((_b = inputRef.current) == null ? void 0 : _b.value) !== "" || inputValue && inputValue !== "";
|
|
2205
2217
|
return jsxRuntime.jsxs("div", {
|
|
2206
2218
|
className: styles2.searchContainer,
|
|
2207
2219
|
children: [jsxRuntime.jsx("input", {
|
|
@@ -2441,6 +2453,8 @@
|
|
|
2441
2453
|
}
|
|
2442
2454
|
};
|
|
2443
2455
|
}, [onClick, visible]);
|
|
2456
|
+
if (typeof document === "undefined")
|
|
2457
|
+
return;
|
|
2444
2458
|
return compat.createPortal(jsxRuntime.jsx(d, {
|
|
2445
2459
|
in: visible,
|
|
2446
2460
|
duration: 300,
|
|
@@ -3711,10 +3725,10 @@
|
|
|
3711
3725
|
})
|
|
3712
3726
|
});
|
|
3713
3727
|
}
|
|
3714
|
-
const zoomControl$
|
|
3728
|
+
const zoomControl$2 = "_zoomControl_1qhlz_1";
|
|
3715
3729
|
const button$2 = "_button_1qhlz_7";
|
|
3716
3730
|
const styles$5 = {
|
|
3717
|
-
zoomControl: zoomControl$
|
|
3731
|
+
zoomControl: zoomControl$2,
|
|
3718
3732
|
button: button$2
|
|
3719
3733
|
};
|
|
3720
3734
|
function ZoomControl$1({
|
|
@@ -3758,15 +3772,15 @@
|
|
|
3758
3772
|
}, [children]);
|
|
3759
3773
|
return organisedChildren;
|
|
3760
3774
|
}
|
|
3761
|
-
const container = "
|
|
3762
|
-
const svg = "
|
|
3763
|
-
const controls$1 = "
|
|
3764
|
-
const zoomControl$
|
|
3775
|
+
const container = "_container_1ta61_1";
|
|
3776
|
+
const svg = "_svg_1ta61_7";
|
|
3777
|
+
const controls$1 = "_controls_1ta61_13";
|
|
3778
|
+
const zoomControl$1 = "_zoomControl_1ta61_21";
|
|
3765
3779
|
const styles$4 = {
|
|
3766
3780
|
container,
|
|
3767
3781
|
svg,
|
|
3768
3782
|
controls: controls$1,
|
|
3769
|
-
zoomControl: zoomControl$
|
|
3783
|
+
zoomControl: zoomControl$1
|
|
3770
3784
|
};
|
|
3771
3785
|
const _Projection = {
|
|
3772
3786
|
geoAlbersUKComposite: geoAlbersUk(),
|
|
@@ -3887,10 +3901,11 @@
|
|
|
3887
3901
|
return size[0] > 0 && size[1] > 0;
|
|
3888
3902
|
}
|
|
3889
3903
|
function sizeMinusPadding(size, padding) {
|
|
3904
|
+
let newSize = [...size];
|
|
3890
3905
|
if (padding) {
|
|
3891
|
-
|
|
3906
|
+
newSize = [size[0] - padding.left - padding.right, size[1] - padding.top - padding.bottom];
|
|
3892
3907
|
}
|
|
3893
|
-
return
|
|
3908
|
+
return newSize;
|
|
3894
3909
|
}
|
|
3895
3910
|
function scaleSize(size, ratio, dest) {
|
|
3896
3911
|
if (dest === void 0) {
|
|
@@ -3903,8 +3918,8 @@
|
|
|
3903
3918
|
function scalePadding(padding, ratio) {
|
|
3904
3919
|
const scaled = {
|
|
3905
3920
|
top: Math.round(padding.top * ratio),
|
|
3906
|
-
right: Math.round(padding.
|
|
3907
|
-
bottom: Math.round(padding.
|
|
3921
|
+
right: Math.round(padding.right * ratio),
|
|
3922
|
+
bottom: Math.round(padding.bottom * ratio),
|
|
3908
3923
|
left: Math.round(padding.left * ratio)
|
|
3909
3924
|
};
|
|
3910
3925
|
return scaled;
|
|
@@ -4616,17 +4631,18 @@
|
|
|
4616
4631
|
return;
|
|
4617
4632
|
listenersForEvent.delete(listenerKey);
|
|
4618
4633
|
}
|
|
4619
|
-
dispatch(eventType) {
|
|
4634
|
+
dispatch(eventType, payload) {
|
|
4620
4635
|
const listenersForEvent = this._listenersByEvent.get(eventType);
|
|
4621
4636
|
if (!listenersForEvent)
|
|
4622
4637
|
return;
|
|
4623
4638
|
listenersForEvent.forEach((callback) => {
|
|
4624
|
-
callback(this.target);
|
|
4639
|
+
callback(this.target, payload);
|
|
4625
4640
|
});
|
|
4626
4641
|
}
|
|
4627
4642
|
}
|
|
4628
|
-
const
|
|
4629
|
-
CHANGE: "change"
|
|
4643
|
+
const MapEvent = {
|
|
4644
|
+
CHANGE: "change",
|
|
4645
|
+
ZOOM: "zoom"
|
|
4630
4646
|
};
|
|
4631
4647
|
var noop = { value: () => {
|
|
4632
4648
|
} };
|
|
@@ -5932,6 +5948,7 @@
|
|
|
5932
5948
|
this.view = options.view;
|
|
5933
5949
|
this.target = options.target;
|
|
5934
5950
|
this.layers = [];
|
|
5951
|
+
this.dispatcher = new Dispatcher(this);
|
|
5935
5952
|
this._viewport = document.createElement("div");
|
|
5936
5953
|
this._viewport.style.position = "relative";
|
|
5937
5954
|
this._viewport.style.overflow = "hidden";
|
|
@@ -5958,9 +5975,9 @@
|
|
|
5958
5975
|
}).on("zoom", (event) => {
|
|
5959
5976
|
this.view.transform = event.transform;
|
|
5960
5977
|
this._requestRender();
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
}
|
|
5978
|
+
this.dispatcher.dispatch(MapEvent.ZOOM, {
|
|
5979
|
+
currentZoomLevel: event.transform.k
|
|
5980
|
+
});
|
|
5964
5981
|
});
|
|
5965
5982
|
d3Selection.select(this._viewport).call(this._zoomBehaviour);
|
|
5966
5983
|
}
|
|
@@ -5991,7 +6008,7 @@
|
|
|
5991
6008
|
addLayers(layers) {
|
|
5992
6009
|
this.layers = this.layers.concat(layers);
|
|
5993
6010
|
layers.forEach((layer) => {
|
|
5994
|
-
layer.on(
|
|
6011
|
+
layer.on(MapEvent.CHANGE, () => {
|
|
5995
6012
|
this._requestRender();
|
|
5996
6013
|
});
|
|
5997
6014
|
});
|
|
@@ -6166,12 +6183,12 @@
|
|
|
6166
6183
|
}
|
|
6167
6184
|
// map size in pixels (i.e. scaled by device pixel ratio)
|
|
6168
6185
|
get mapSize() {
|
|
6169
|
-
return
|
|
6186
|
+
return scaleSize(this.viewPortSize, this.pixelRatio);
|
|
6170
6187
|
}
|
|
6171
|
-
// padding in pixels (i.e. scaled by device pixel ratio)
|
|
6172
6188
|
get padding() {
|
|
6173
6189
|
return this._padding;
|
|
6174
6190
|
}
|
|
6191
|
+
// padding in pixels (i.e. scaled by device pixel ratio)
|
|
6175
6192
|
get scaledPadding() {
|
|
6176
6193
|
const scaledPadding = {
|
|
6177
6194
|
...this._padding
|
|
@@ -6228,12 +6245,13 @@
|
|
|
6228
6245
|
}
|
|
6229
6246
|
// get extent for drawn map
|
|
6230
6247
|
getMapExtent() {
|
|
6231
|
-
const
|
|
6232
|
-
const
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6248
|
+
const mapSizeInPixels = this.mapSize;
|
|
6249
|
+
const paddingInPixels = this.scaledPadding;
|
|
6250
|
+
return [[paddingInPixels.left, paddingInPixels.top], sizeMinusPadding(mapSizeInPixels, {
|
|
6251
|
+
...paddingInPixels,
|
|
6252
|
+
left: 0,
|
|
6253
|
+
top: 0
|
|
6254
|
+
})];
|
|
6237
6255
|
}
|
|
6238
6256
|
// visible extent in map coordinates
|
|
6239
6257
|
getVisibleExtent(transform, projection) {
|
|
@@ -6256,6 +6274,90 @@
|
|
|
6256
6274
|
};
|
|
6257
6275
|
}
|
|
6258
6276
|
}
|
|
6277
|
+
const mapContainer = "_mapContainer_y5eeh_9";
|
|
6278
|
+
const helpTextContainer = "_helpTextContainer_y5eeh_15";
|
|
6279
|
+
const helpText = "_helpText_y5eeh_15";
|
|
6280
|
+
const highlight = "_highlight_y5eeh_40";
|
|
6281
|
+
const styles$3 = {
|
|
6282
|
+
mapContainer,
|
|
6283
|
+
helpTextContainer,
|
|
6284
|
+
helpText,
|
|
6285
|
+
highlight
|
|
6286
|
+
};
|
|
6287
|
+
const Map$1 = compat.forwardRef(({
|
|
6288
|
+
config,
|
|
6289
|
+
onLoad,
|
|
6290
|
+
children
|
|
6291
|
+
}, ref) => {
|
|
6292
|
+
const {
|
|
6293
|
+
layers
|
|
6294
|
+
} = children;
|
|
6295
|
+
const [map, setMap] = hooks.useState();
|
|
6296
|
+
const [hideDefaultHelpText, setHideDefaultHelpText] = hooks.useState(false);
|
|
6297
|
+
const [zoomHelpText, setZoomHelpText] = hooks.useState("");
|
|
6298
|
+
const [highlightHelpText, setHighlightHelpText] = hooks.useState(false);
|
|
6299
|
+
hooks.useEffect(() => {
|
|
6300
|
+
const map2 = new Map$2({
|
|
6301
|
+
view: new View(config.view),
|
|
6302
|
+
target: targetRef.current
|
|
6303
|
+
});
|
|
6304
|
+
map2.addLayers(layers);
|
|
6305
|
+
setMap(map2);
|
|
6306
|
+
if (ref)
|
|
6307
|
+
ref.current = map2;
|
|
6308
|
+
onLoad && onLoad(map2);
|
|
6309
|
+
const zoomHelpText2 = navigator.userAgent.indexOf("Mac") !== -1 ? "Use ⌘ + scroll to zoom" : "Use Ctrl + scroll to zoom";
|
|
6310
|
+
setZoomHelpText(zoomHelpText2);
|
|
6311
|
+
return () => {
|
|
6312
|
+
if (ref)
|
|
6313
|
+
ref.current = null;
|
|
6314
|
+
setMap(null);
|
|
6315
|
+
};
|
|
6316
|
+
}, []);
|
|
6317
|
+
hooks.useEffect(() => {
|
|
6318
|
+
if (!map)
|
|
6319
|
+
return;
|
|
6320
|
+
let timeoutID;
|
|
6321
|
+
map.onFilterEvent(() => {
|
|
6322
|
+
if (timeoutID)
|
|
6323
|
+
clearTimeout(timeoutID);
|
|
6324
|
+
setHighlightHelpText(true);
|
|
6325
|
+
timeoutID = setTimeout(() => {
|
|
6326
|
+
setHighlightHelpText();
|
|
6327
|
+
}, 1e3);
|
|
6328
|
+
});
|
|
6329
|
+
map.onZoomEvent((zoomLevel) => {
|
|
6330
|
+
setHideDefaultHelpText(zoomLevel > 1);
|
|
6331
|
+
});
|
|
6332
|
+
return () => {
|
|
6333
|
+
if (timeoutID)
|
|
6334
|
+
clearTimeout(timeoutID);
|
|
6335
|
+
};
|
|
6336
|
+
}, [map]);
|
|
6337
|
+
hooks.useEffect(() => {
|
|
6338
|
+
if (map && layers !== map.layers) {
|
|
6339
|
+
map.setLayers(layers);
|
|
6340
|
+
}
|
|
6341
|
+
}, [map, layers]);
|
|
6342
|
+
const targetRef = hooks.useRef();
|
|
6343
|
+
const hideHelpText = hideDefaultHelpText && !highlightHelpText;
|
|
6344
|
+
const helpText2 = highlightHelpText ? zoomHelpText : config.defaultHelpText;
|
|
6345
|
+
return jsxRuntime.jsx("div", {
|
|
6346
|
+
ref: targetRef,
|
|
6347
|
+
className: styles$3.mapContainer,
|
|
6348
|
+
children: jsxRuntime.jsx("div", {
|
|
6349
|
+
className: styles$3.helpTextContainer,
|
|
6350
|
+
style: {
|
|
6351
|
+
opacity: hideHelpText ? 0 : 1
|
|
6352
|
+
},
|
|
6353
|
+
"aria-hidden": true,
|
|
6354
|
+
children: jsxRuntime.jsx("p", {
|
|
6355
|
+
className: [styles$3.helpText, highlightHelpText && styles$3.highlight].join(" "),
|
|
6356
|
+
children: helpText2
|
|
6357
|
+
})
|
|
6358
|
+
})
|
|
6359
|
+
});
|
|
6360
|
+
});
|
|
6259
6361
|
function IconMinus() {
|
|
6260
6362
|
return jsxRuntime.jsx("svg", {
|
|
6261
6363
|
width: "22",
|
|
@@ -6303,10 +6405,10 @@
|
|
|
6303
6405
|
})
|
|
6304
6406
|
});
|
|
6305
6407
|
}
|
|
6306
|
-
const zoomControl
|
|
6408
|
+
const zoomControl = "_zoomControl_13wd1_1";
|
|
6307
6409
|
const button$1 = "_button_13wd1_7";
|
|
6308
|
-
const styles$
|
|
6309
|
-
zoomControl
|
|
6410
|
+
const styles$2 = {
|
|
6411
|
+
zoomControl,
|
|
6310
6412
|
button: button$1
|
|
6311
6413
|
};
|
|
6312
6414
|
function ZoomControl({
|
|
@@ -6328,17 +6430,17 @@
|
|
|
6328
6430
|
onReset(event);
|
|
6329
6431
|
};
|
|
6330
6432
|
return jsxRuntime.jsxs("div", {
|
|
6331
|
-
className: styles$
|
|
6433
|
+
className: styles$2.zoomControl,
|
|
6332
6434
|
children: [jsxRuntime.jsx("button", {
|
|
6333
|
-
className: styles$
|
|
6435
|
+
className: styles$2.button,
|
|
6334
6436
|
onClick: _onZoomIn,
|
|
6335
6437
|
children: jsxRuntime.jsx(IconPlus, {})
|
|
6336
6438
|
}), jsxRuntime.jsx("button", {
|
|
6337
|
-
className: styles$
|
|
6439
|
+
className: styles$2.button,
|
|
6338
6440
|
onClick: _onZoomOut,
|
|
6339
6441
|
children: jsxRuntime.jsx(IconMinus, {})
|
|
6340
6442
|
}), jsxRuntime.jsx("button", {
|
|
6341
|
-
className: styles$
|
|
6443
|
+
className: styles$2.button,
|
|
6342
6444
|
onClick: _onReset,
|
|
6343
6445
|
disabled: !resetEnabled,
|
|
6344
6446
|
children: jsxRuntime.jsx(IconReset, {
|
|
@@ -6347,101 +6449,6 @@
|
|
|
6347
6449
|
})]
|
|
6348
6450
|
});
|
|
6349
6451
|
}
|
|
6350
|
-
const mapContainer = "_mapContainer_aknz0_9";
|
|
6351
|
-
const helpTextContainer = "_helpTextContainer_aknz0_15";
|
|
6352
|
-
const helpText = "_helpText_aknz0_15";
|
|
6353
|
-
const highlight = "_highlight_aknz0_40";
|
|
6354
|
-
const zoomControl = "_zoomControl_aknz0_45";
|
|
6355
|
-
const styles$2 = {
|
|
6356
|
-
mapContainer,
|
|
6357
|
-
helpTextContainer,
|
|
6358
|
-
helpText,
|
|
6359
|
-
highlight,
|
|
6360
|
-
zoomControl
|
|
6361
|
-
};
|
|
6362
|
-
const Map$1 = compat.forwardRef(({
|
|
6363
|
-
config,
|
|
6364
|
-
children
|
|
6365
|
-
}, ref) => {
|
|
6366
|
-
const {
|
|
6367
|
-
controls: controls2,
|
|
6368
|
-
layers
|
|
6369
|
-
} = children;
|
|
6370
|
-
const [map, setMap] = hooks.useState();
|
|
6371
|
-
const [currentZoomLevel, setCurrentZoomLevel] = hooks.useState(1);
|
|
6372
|
-
const [hideDefaultHelpText, setHideDefaultHelpText] = hooks.useState(false);
|
|
6373
|
-
const [zoomHelpText, setZoomHelpText] = hooks.useState("");
|
|
6374
|
-
const [highlightHelpText, setHighlightHelpText] = hooks.useState(false);
|
|
6375
|
-
hooks.useEffect(() => {
|
|
6376
|
-
const map2 = new Map$2({
|
|
6377
|
-
view: new View(config.view),
|
|
6378
|
-
target: targetRef.current
|
|
6379
|
-
});
|
|
6380
|
-
map2.addLayers(layers);
|
|
6381
|
-
setMap(map2);
|
|
6382
|
-
if (ref)
|
|
6383
|
-
ref.current = map2;
|
|
6384
|
-
const zoomHelpText2 = navigator.userAgent.indexOf("Mac") !== -1 ? "Use ⌘ + scroll to zoom" : "Use Ctrl + scroll to zoom";
|
|
6385
|
-
setZoomHelpText(zoomHelpText2);
|
|
6386
|
-
return () => {
|
|
6387
|
-
if (ref)
|
|
6388
|
-
ref.current = null;
|
|
6389
|
-
setMap(null);
|
|
6390
|
-
};
|
|
6391
|
-
}, []);
|
|
6392
|
-
hooks.useEffect(() => {
|
|
6393
|
-
if (!map)
|
|
6394
|
-
return;
|
|
6395
|
-
let timeoutID;
|
|
6396
|
-
map.onFilterEvent(() => {
|
|
6397
|
-
if (timeoutID)
|
|
6398
|
-
clearTimeout(timeoutID);
|
|
6399
|
-
setHighlightHelpText(true);
|
|
6400
|
-
timeoutID = setTimeout(() => {
|
|
6401
|
-
setHighlightHelpText();
|
|
6402
|
-
}, 1e3);
|
|
6403
|
-
});
|
|
6404
|
-
map.onZoomEvent((zoomLevel) => {
|
|
6405
|
-
setCurrentZoomLevel(zoomLevel);
|
|
6406
|
-
setHideDefaultHelpText(zoomLevel > 1);
|
|
6407
|
-
});
|
|
6408
|
-
return () => {
|
|
6409
|
-
if (timeoutID)
|
|
6410
|
-
clearTimeout(timeoutID);
|
|
6411
|
-
};
|
|
6412
|
-
}, [map]);
|
|
6413
|
-
hooks.useEffect(() => {
|
|
6414
|
-
if (map && layers !== map.layers) {
|
|
6415
|
-
map.setLayers(layers);
|
|
6416
|
-
}
|
|
6417
|
-
}, [map, layers]);
|
|
6418
|
-
const targetRef = hooks.useRef();
|
|
6419
|
-
const hideHelpText = hideDefaultHelpText && !highlightHelpText;
|
|
6420
|
-
const helpText2 = highlightHelpText ? zoomHelpText : config.defaultHelpText;
|
|
6421
|
-
return jsxRuntime.jsxs("div", {
|
|
6422
|
-
ref: targetRef,
|
|
6423
|
-
className: styles$2.mapContainer,
|
|
6424
|
-
children: [jsxRuntime.jsx("div", {
|
|
6425
|
-
className: styles$2.helpTextContainer,
|
|
6426
|
-
style: {
|
|
6427
|
-
opacity: hideHelpText ? 0 : 1
|
|
6428
|
-
},
|
|
6429
|
-
"aria-hidden": true,
|
|
6430
|
-
children: jsxRuntime.jsx("p", {
|
|
6431
|
-
className: [styles$2.helpText, highlightHelpText && styles$2.highlight].join(" "),
|
|
6432
|
-
children: helpText2
|
|
6433
|
-
})
|
|
6434
|
-
}), jsxRuntime.jsx("div", {
|
|
6435
|
-
className: styles$2.zoomControl,
|
|
6436
|
-
children: jsxRuntime.jsx(ZoomControl, {
|
|
6437
|
-
resetEnabled: currentZoomLevel > 1,
|
|
6438
|
-
onZoomIn: () => map.zoomIn(),
|
|
6439
|
-
onZoomOut: () => map.zoomOut(),
|
|
6440
|
-
onReset: () => map.zoomTo(1)
|
|
6441
|
-
})
|
|
6442
|
-
})]
|
|
6443
|
-
});
|
|
6444
|
-
});
|
|
6445
6452
|
const Projection = {
|
|
6446
6453
|
geoAlbersUKComposite: geoAlbersUk(),
|
|
6447
6454
|
geoAlbersEngland: d3Geo.geoAlbers().center([0, 52.7]).rotate([1.1743, 0]).parallels([50, 54]),
|
|
@@ -6785,7 +6792,7 @@
|
|
|
6785
6792
|
});
|
|
6786
6793
|
}
|
|
6787
6794
|
this._features = features;
|
|
6788
|
-
this.dispatcher.dispatch(
|
|
6795
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6789
6796
|
}
|
|
6790
6797
|
}
|
|
6791
6798
|
class TextLayer {
|
|
@@ -6828,7 +6835,7 @@
|
|
|
6828
6835
|
}
|
|
6829
6836
|
set style(style) {
|
|
6830
6837
|
this._style = style;
|
|
6831
|
-
this.dispatcher.dispatch(
|
|
6838
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6832
6839
|
}
|
|
6833
6840
|
getExtent() {
|
|
6834
6841
|
if (this._extent)
|
|
@@ -6966,9 +6973,9 @@
|
|
|
6966
6973
|
this._source.tearDown();
|
|
6967
6974
|
}
|
|
6968
6975
|
this._source = source;
|
|
6969
|
-
source.on(
|
|
6976
|
+
source.on(MapEvent.CHANGE, () => {
|
|
6970
6977
|
this._extent = null;
|
|
6971
|
-
this.dispatcher.dispatch(
|
|
6978
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6972
6979
|
});
|
|
6973
6980
|
}
|
|
6974
6981
|
setRawProjection(projection) {
|
|
@@ -6987,7 +6994,7 @@
|
|
|
6987
6994
|
}
|
|
6988
6995
|
set style(style) {
|
|
6989
6996
|
this._style = style;
|
|
6990
|
-
this.dispatcher.dispatch(
|
|
6997
|
+
this.dispatcher.dispatch(MapEvent.CHANGE);
|
|
6991
6998
|
}
|
|
6992
6999
|
getStyleFunction() {
|
|
6993
7000
|
const style = this.style;
|
|
@@ -7519,7 +7526,8 @@
|
|
|
7519
7526
|
stack: list.stack,
|
|
7520
7527
|
width: list.width,
|
|
7521
7528
|
height: barChartHeight,
|
|
7522
|
-
createSVG: true
|
|
7529
|
+
createSVG: true,
|
|
7530
|
+
styles: styles2
|
|
7523
7531
|
})]
|
|
7524
7532
|
}, index);
|
|
7525
7533
|
};
|
|
@@ -7652,7 +7660,7 @@
|
|
|
7652
7660
|
}, []);
|
|
7653
7661
|
hooks.useLayoutEffect(() => {
|
|
7654
7662
|
const tickerItemsContainer = tickerItemsRef.current;
|
|
7655
|
-
const hideButtons2 = windowSize.width >= 480 ? tickerScrollRef.current.scrollWidth <= tickerItemsContainer.clientWidth :
|
|
7663
|
+
const hideButtons2 = windowSize.width >= 480 ? tickerScrollRef.current.scrollWidth <= tickerItemsContainer.clientWidth : childArray.length < 3;
|
|
7656
7664
|
setHideButtons(hideButtons2);
|
|
7657
7665
|
}, [windowSize, setHideButtons]);
|
|
7658
7666
|
function toggleExpandedState() {
|
|
@@ -7842,6 +7850,7 @@
|
|
|
7842
7850
|
exports2.Container = Container;
|
|
7843
7851
|
exports2.ControlChange = ControlChange;
|
|
7844
7852
|
exports2.Controls = Controls;
|
|
7853
|
+
exports2.Dispatcher = Dispatcher;
|
|
7845
7854
|
exports2.Dropdown = Dropdown;
|
|
7846
7855
|
exports2.Fill = Fill;
|
|
7847
7856
|
exports2.FirstPastThePostWaffle = FirstPastThePostWaffle;
|
|
@@ -7854,6 +7863,7 @@
|
|
|
7854
7863
|
exports2.LegendItem = LegendItem;
|
|
7855
7864
|
exports2.Map = Map$1;
|
|
7856
7865
|
exports2.MapConfiguration = MapConfiguration;
|
|
7866
|
+
exports2.MapEvent = MapEvent;
|
|
7857
7867
|
exports2.MapLayers = MapLayers;
|
|
7858
7868
|
exports2.Modal = Modal;
|
|
7859
7869
|
exports2.PageSection = PageSection;
|
|
@@ -7883,6 +7893,7 @@
|
|
|
7883
7893
|
exports2.VectorSource = VectorSource;
|
|
7884
7894
|
exports2.Waffle = Waffle;
|
|
7885
7895
|
exports2.WaffleType = WaffleType;
|
|
7896
|
+
exports2.ZoomControl = ZoomControl;
|
|
7886
7897
|
exports2._Projection = _Projection;
|
|
7887
7898
|
exports2.bboxFeature = bboxFeature;
|
|
7888
7899
|
exports2.interpolateFeatures = interpolateFeatures;
|