@guardian/interactive-component-library 0.1.0-alpha.11 → 0.1.0-alpha.13

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.
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
2
- import { useRef, useState, useLayoutEffect, useId, useMemo, useEffect, useContext, useImperativeHandle } from "preact/hooks";
3
- import { createPortal, forwardRef } from "preact/compat";
4
- import { createElement, cloneElement, createContext, toChildArray } from "preact";
2
+ import { useRef, useState, useLayoutEffect, useCallback, useEffect, useMemo, useContext, useImperativeHandle } from "preact/hooks";
3
+ import { render, createElement, cloneElement, createContext, toChildArray } from "preact";
4
+ import { useSyncExternalStore, createPortal, forwardRef } from "preact/compat";
5
5
  import { scaleLinear as scaleLinear$1 } from "d3-scale";
6
6
  import { geoStream, geoAlbers, geoPath, geoMercator, geoContains } from "d3-geo";
7
7
  const main = "";
@@ -9,7 +9,7 @@ const group = "_group_nq9z3_1";
9
9
  const rotated = "_rotated_nq9z3_6";
10
10
  const path$4 = "_path_nq9z3_10";
11
11
  const active = "_active_nq9z3_14";
12
- const defaultStyles$q = {
12
+ const defaultStyles$r = {
13
13
  group,
14
14
  rotated,
15
15
  path: path$4,
@@ -48,13 +48,13 @@ function Chevron({
48
48
  styles: styles2
49
49
  }) {
50
50
  const defaultStylesCopy = {
51
- ...defaultStyles$q
51
+ ...defaultStyles$r
52
52
  };
53
53
  if (active2) {
54
- defaultStylesCopy.path = mergeStyles(defaultStyles$q.path, defaultStyles$q.active);
54
+ defaultStylesCopy.path = mergeStyles(defaultStyles$r.path, defaultStyles$r.active);
55
55
  }
56
56
  if (direction === DIRECTION.up) {
57
- defaultStylesCopy.group = mergeStyles(defaultStyles$q.group, defaultStyles$q.rotated);
57
+ defaultStylesCopy.group = mergeStyles(defaultStyles$r.group, defaultStyles$r.rotated);
58
58
  }
59
59
  styles2 = mergeStyles(defaultStylesCopy, styles2);
60
60
  return jsx("svg", {
@@ -77,12 +77,12 @@ function Chevron({
77
77
  }
78
78
  const container$4 = "_container_jzalm_1";
79
79
  const dot = "_dot_jzalm_6";
80
- const circle$1 = "_circle_jzalm_13";
80
+ const circle$2 = "_circle_jzalm_13";
81
81
  const text$4 = "_text_jzalm_17";
82
- const defaultStyles$p = {
82
+ const defaultStyles$q = {
83
83
  container: container$4,
84
84
  dot,
85
- circle: circle$1,
85
+ circle: circle$2,
86
86
  text: text$4
87
87
  };
88
88
  const DOT_TYPE = {
@@ -96,10 +96,10 @@ const LegendItem = ({
96
96
  abbreviation
97
97
  }) => {
98
98
  const defaultStylesCopy = {
99
- ...defaultStyles$p
99
+ ...defaultStyles$q
100
100
  };
101
101
  if (dotType === DOT_TYPE.round) {
102
- defaultStylesCopy.dot = mergeStyles(defaultStyles$p.dot, defaultStyles$p.circle);
102
+ defaultStylesCopy.dot = mergeStyles(defaultStyles$q.dot, defaultStyles$q.circle);
103
103
  }
104
104
  styles2 = mergeStyles(defaultStylesCopy, styles2);
105
105
  return jsxs("div", {
@@ -134,7 +134,7 @@ function isDarkColor(color) {
134
134
  const bar$2 = "_bar_wmb0k_1";
135
135
  const label$1 = "_label_wmb0k_5";
136
136
  const backgroundRect = "_backgroundRect_wmb0k_11";
137
- const defaultStyles$o = {
137
+ const defaultStyles$p = {
138
138
  bar: bar$2,
139
139
  label: label$1,
140
140
  backgroundRect
@@ -168,7 +168,7 @@ function StackedBar({
168
168
  setHideLabels(false);
169
169
  }, [stack, width, height]);
170
170
  styles2 = mergeStyles({
171
- ...defaultStyles$o
171
+ ...defaultStyles$p
172
172
  }, styles2);
173
173
  let totalWidth = 0;
174
174
  const content2 = stack.map((d2, index2) => {
@@ -224,62 +224,153 @@ function StackedBar({
224
224
  children: content2
225
225
  });
226
226
  }
227
- const svg$7 = "_svg_un4gp_1";
228
- const previous = "_previous_un4gp_7";
229
- const next = "_next_un4gp_11";
230
- const defaultStyles$n = {
231
- svg: svg$7,
227
+ function shouldUpdate(oldState, newState) {
228
+ if (oldState === newState)
229
+ return false;
230
+ if (isObj(oldState) && isObj(newState)) {
231
+ for (let key in newState) {
232
+ if (oldState[key] !== newState[key])
233
+ return true;
234
+ }
235
+ return false;
236
+ }
237
+ return true;
238
+ }
239
+ function isObj(obj) {
240
+ return typeof obj === "object" && !Array.isArray(obj) && obj !== null;
241
+ }
242
+ function createStore(initialStore) {
243
+ let store = initialStore;
244
+ const listeners = /* @__PURE__ */ new Set();
245
+ function useStore(selectorFn = (store2) => store2) {
246
+ const subscribe = useCallback((updater) => {
247
+ const listener = {
248
+ updater,
249
+ selectorFn
250
+ };
251
+ listeners.add(listener);
252
+ return () => {
253
+ listeners.delete(listener);
254
+ };
255
+ }, []);
256
+ const syncedStore = useSyncExternalStore(subscribe, getStore, getServerStore);
257
+ return selectorFn(syncedStore);
258
+ }
259
+ function setStore(action) {
260
+ const oldStore = store;
261
+ store = action instanceof Function ? action(store) : action;
262
+ listeners.forEach(({
263
+ selectorFn,
264
+ updater
265
+ }) => {
266
+ const oldState = selectorFn(oldStore);
267
+ const newState = selectorFn(store);
268
+ if (shouldUpdate(oldState, newState))
269
+ updater(() => newState);
270
+ });
271
+ }
272
+ function getStore() {
273
+ return store;
274
+ }
275
+ function getServerStore() {
276
+ return initialStore;
277
+ }
278
+ return [useStore, setStore, getStore];
279
+ }
280
+ const [useGradients, setGradients, getGradients] = createStore({});
281
+ const svg$8 = "_svg_1cajk_6";
282
+ const previous = "_previous_1cajk_12";
283
+ const next = "_next_1cajk_16";
284
+ const defaultStyles$o = {
285
+ svg: svg$8,
232
286
  previous,
233
287
  next
234
288
  };
235
- const GradientIcon = ({
236
- previous: previous2,
237
- next: next2,
238
- styles: styles2
239
- }) => {
240
- styles2 = mergeStyles({
241
- ...defaultStyles$n
242
- }, styles2);
243
- const gradientId = useId();
244
- return jsxs("svg", {
289
+ const GradientIcon = (props) => {
290
+ let {
291
+ previous: previous2,
292
+ next: next2,
293
+ styles: styles2
294
+ } = props;
295
+ styles2 = mergeStyles(defaultStyles$o, styles2);
296
+ const gradientId = `gv-gradient-def-${previous2}-${next2}`;
297
+ const gradients = useGradients();
298
+ useEffect(() => {
299
+ setGradients((current) => {
300
+ current[gradientId] = {
301
+ id: gradientId,
302
+ ...props
303
+ };
304
+ return current;
305
+ });
306
+ }, [gradientId, props]);
307
+ useEffect(() => {
308
+ let container2 = document.getElementById("gv-gradient-defs");
309
+ if (!container2) {
310
+ container2 = document.createElement("div");
311
+ container2.id = "gv-gradient-defs";
312
+ document.body.prepend(container2);
313
+ }
314
+ render(jsx(GradientDefs, {
315
+ gradients: Object.values(gradients)
316
+ }), container2);
317
+ }, [gradients]);
318
+ return jsx("svg", {
245
319
  class: styles2.svg,
246
320
  width: "24",
247
321
  height: "11",
248
322
  viewBox: "0 0 24 11",
249
323
  xmlns: "http://www.w3.org/2000/svg",
250
- children: [jsx("path", {
324
+ children: jsx("path", {
251
325
  d: "M0 5.434C0 2.43288 2.43288 0 5.434 0H5.69626C6.85818 0 7.9797 0.426401 8.84813 1.19834C10.6456 2.79612 13.3544 2.79612 15.1519 1.19834C16.0203 0.426401 17.1418 0 18.3037 0L18.566 0C21.5671 0 24 2.43288 24 5.434V5.566C24 8.56712 21.5671 11 18.566 11H18.3037C17.1418 11 16.0203 10.5736 15.1519 9.80166C13.3544 8.20388 10.6456 8.20388 8.84813 9.80166C7.9797 10.5736 6.85818 11 5.69626 11H5.434C2.43288 11 0 8.56712 0 5.566V5.434Z",
252
326
  fill: `url(#${gradientId})`
253
- }), jsx("defs", {
254
- children: jsxs("linearGradient", {
255
- id: gradientId,
256
- x1: "5.5",
257
- y1: "5.5",
258
- x2: "12",
259
- y2: "5.5",
260
- gradientUnits: "userSpaceOnUse",
261
- children: [jsx("stop", {
262
- class: `${styles2.previous} stop-color--${previous2}`
263
- }), jsx("stop", {
264
- class: `${styles2.next} stop-color--${next2}`,
265
- offset: "1"
266
- })]
267
- })
268
- })]
327
+ })
269
328
  });
270
329
  };
330
+ function GradientDefs({
331
+ gradients
332
+ }) {
333
+ return jsx("svg", {
334
+ width: "24",
335
+ height: "11",
336
+ viewBox: "0 0 24 11",
337
+ children: jsx("defs", {
338
+ children: gradients.map(({
339
+ id,
340
+ previous: previous2,
341
+ next: next2,
342
+ styles: styles2
343
+ }) => {
344
+ return jsxs("linearGradient", {
345
+ id,
346
+ x1: "5.5",
347
+ y1: "5.5",
348
+ x2: "12",
349
+ y2: "5.5",
350
+ gradientUnits: "userSpaceOnUse",
351
+ children: [jsx("stop", {
352
+ class: `${styles2 == null ? void 0 : styles2.previous} stop-color--${previous2}`
353
+ }), jsx("stop", {
354
+ class: `${styles2 == null ? void 0 : styles2.next} stop-color--${next2}`,
355
+ offset: "1"
356
+ })]
357
+ }, id);
358
+ })
359
+ })
360
+ });
361
+ }
271
362
  const button$4 = "_button_kpmyt_1";
272
- const svg$6 = "_svg_kpmyt_14";
273
- const defaultStyles$m = {
363
+ const svg$7 = "_svg_kpmyt_14";
364
+ const defaultStyles$n = {
274
365
  button: button$4,
275
- svg: svg$6
366
+ svg: svg$7
276
367
  };
277
368
  const InfoButton = ({
278
369
  onClick,
279
370
  styles: styles2
280
371
  }) => {
281
372
  styles2 = mergeStyles({
282
- ...defaultStyles$m
373
+ ...defaultStyles$n
283
374
  }, styles2);
284
375
  return jsx("button", {
285
376
  class: styles2.button,
@@ -294,28 +385,32 @@ const InfoButton = ({
294
385
  })
295
386
  });
296
387
  };
297
- const circleicon = "_circleicon_1ge2m_1";
298
- const rect = "_rect_1ge2m_7";
299
- const defaultStyles$l = {
300
- circleicon,
301
- rect
388
+ const svg$6 = "_svg_1v49v_1";
389
+ const circle$1 = "_circle_1v49v_5";
390
+ const pulse = "_pulse_1v49v_9";
391
+ const defaultStyles$m = {
392
+ svg: svg$6,
393
+ circle: circle$1,
394
+ pulse
302
395
  };
303
396
  const CircleIcon = ({
304
- abbreviation,
397
+ color,
398
+ pulse: pulse2 = false,
305
399
  styles: styles2
306
400
  }) => {
307
- styles2 = mergeStyles({
308
- ...defaultStyles$l
309
- }, styles2);
401
+ styles2 = mergeStyles(defaultStyles$m, styles2);
310
402
  return jsx("svg", {
311
- style: styles2.circleicon,
403
+ style: styles2.svg,
312
404
  fill: "none",
313
405
  height: "11",
314
406
  viewBox: "0 0 11 11",
315
407
  width: "11",
316
408
  xmlns: "http://www.w3.org/2000/svg",
317
409
  children: jsx("rect", {
318
- class: `${styles2.rect} fill-color--${abbreviation}`,
410
+ class: [styles2.circle, pulse2 && styles2.pulse].join(" "),
411
+ style: {
412
+ fill: color
413
+ },
319
414
  height: "11",
320
415
  rx: "5.5",
321
416
  width: "11"
@@ -323,7 +418,7 @@ const CircleIcon = ({
323
418
  });
324
419
  };
325
420
  const text$3 = "_text_1okyv_1";
326
- const defaultStyles$k = {
421
+ const defaultStyles$l = {
327
422
  text: text$3
328
423
  };
329
424
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -673,7 +768,7 @@ const RelativeTimeSentence = ({
673
768
  styles: styles2
674
769
  }) => {
675
770
  styles2 = mergeStyles({
676
- ...defaultStyles$k
771
+ ...defaultStyles$l
677
772
  }, styles2);
678
773
  let timeSince = dayjs(timeStamp).fromNow();
679
774
  return jsx("span", {
@@ -683,7 +778,7 @@ const RelativeTimeSentence = ({
683
778
  };
684
779
  const pageContainer = "_pageContainer_1s0yq_9";
685
780
  const sideBorders = "_sideBorders_1s0yq_42";
686
- const defaultStyles$j = {
781
+ const defaultStyles$k = {
687
782
  pageContainer,
688
783
  sideBorders
689
784
  };
@@ -695,14 +790,14 @@ function Container({
695
790
  const {
696
791
  pageContainer: pageContainer2,
697
792
  sideBorders: sideBordersStyle
698
- } = mergeStyles(defaultStyles$j, styles2);
793
+ } = mergeStyles(defaultStyles$k, styles2);
699
794
  return jsx("div", {
700
795
  className: [pageContainer2, sideBorders2 && sideBordersStyle].join(" "),
701
796
  children
702
797
  });
703
798
  }
704
799
  const bar$1 = "_bar_17pyf_9";
705
- const defaultStyles$i = {
800
+ const defaultStyles$j = {
706
801
  bar: bar$1
707
802
  };
708
803
  function ChangeBar({
@@ -720,7 +815,7 @@ function ChangeBar({
720
815
  let thisStyles = ` height: ${height}; width: ${barwidth}px; ${positive ? `left: ${posleft}` : `left: ${negleft}`}`;
721
816
  let thisColor = ` bg-color--${party}`;
722
817
  styles2 = mergeStyles({
723
- ...defaultStyles$i
818
+ ...defaultStyles$j
724
819
  }, styles2);
725
820
  return jsx("div", {
726
821
  className: styles2.wrapper,
@@ -735,7 +830,7 @@ const svg$5 = "_svg_886i1_9";
735
830
  const dividingLineColor = "_dividingLineColor_886i1_16";
736
831
  const square = "_square_886i1_20";
737
832
  const corner = "_corner_886i1_24";
738
- const defaultStyles$h = {
833
+ const defaultStyles$i = {
739
834
  svg: svg$5,
740
835
  dividingLineColor,
741
836
  square,
@@ -748,7 +843,7 @@ const SquareCutCornerIcon = ({
748
843
  styles: styles2
749
844
  }) => {
750
845
  styles2 = mergeStyles({
751
- ...defaultStyles$h
846
+ ...defaultStyles$i
752
847
  }, styles2);
753
848
  let cornerSize = squareSize * 0.625;
754
849
  let cornerMargin = squareSize < 100 ? squareSize / 6 : 10;
@@ -786,7 +881,7 @@ const stackedGridRotateItems0 = "_stackedGridRotateItems0_1e05o_13";
786
881
  const stackedGridRotateItems90 = "_stackedGridRotateItems90_1e05o_19";
787
882
  const stackedGridRotateItems180 = "_stackedGridRotateItems180_1e05o_25";
788
883
  const stackedGridRotateItems270 = "_stackedGridRotateItems270_1e05o_31";
789
- const defaultStyles$g = {
884
+ const defaultStyles$h = {
790
885
  stackedGridContainer,
791
886
  stackedGridRotateItems0,
792
887
  stackedGridRotateItems90,
@@ -825,7 +920,7 @@ const StackedGrid = ({
825
920
  width: containerWidth,
826
921
  transform: containerFlip
827
922
  };
828
- styles2 = mergeStyles(defaultStyles$g, styles2);
923
+ styles2 = mergeStyles(defaultStyles$h, styles2);
829
924
  return jsx("div", {
830
925
  style: flexStyles,
831
926
  className: `${styles2.stackedGridContainer} ${styles2[itemRotateClass]}`,
@@ -834,7 +929,7 @@ const StackedGrid = ({
834
929
  };
835
930
  const svg$4 = "_svg_l2fsl_9";
836
931
  const squareFill = "_squareFill_l2fsl_16";
837
- const defaultStyles$f = {
932
+ const defaultStyles$g = {
838
933
  svg: svg$4,
839
934
  squareFill
840
935
  };
@@ -844,7 +939,7 @@ const SquareIcon = ({
844
939
  styles: styles2
845
940
  }) => {
846
941
  styles2 = mergeStyles({
847
- ...defaultStyles$f
942
+ ...defaultStyles$g
848
943
  }, styles2);
849
944
  return jsx("svg", {
850
945
  width: size,
@@ -862,7 +957,7 @@ const SquareIcon = ({
862
957
  };
863
958
  const button$3 = "_button_1fees_1";
864
959
  const icon = "_icon_1fees_6";
865
- const defaultStyles$e = {
960
+ const defaultStyles$f = {
866
961
  button: button$3,
867
962
  icon
868
963
  };
@@ -872,7 +967,7 @@ function ArrowButton({
872
967
  styles: styles2,
873
968
  onClick
874
969
  }) {
875
- styles2 = mergeStyles(defaultStyles$e, styles2);
970
+ styles2 = mergeStyles(defaultStyles$f, styles2);
876
971
  return jsx("button", {
877
972
  className: styles2.button,
878
973
  disabled,
@@ -898,7 +993,7 @@ function ArrowButton({
898
993
  }
899
994
  const button$2 = "_button_19t7j_1";
900
995
  const buttonInner$1 = "_buttonInner_19t7j_6";
901
- const defaultStyles$d = {
996
+ const defaultStyles$e = {
902
997
  button: button$2,
903
998
  buttonInner: buttonInner$1
904
999
  };
@@ -908,7 +1003,7 @@ function Button({
908
1003
  styles: styles2,
909
1004
  children
910
1005
  }) {
911
- styles2 = mergeStyles(defaultStyles$d, styles2);
1006
+ styles2 = mergeStyles(defaultStyles$e, styles2);
912
1007
  return jsx("button", {
913
1008
  className: styles2.button,
914
1009
  "data-type": type,
@@ -923,7 +1018,7 @@ const button$1 = "_button_6w12u_1";
923
1018
  const buttonBorder = "_buttonBorder_6w12u_10";
924
1019
  const svg$3 = "_svg_6w12u_18";
925
1020
  const path$3 = "_path_6w12u_24";
926
- const defaultStyles$c = {
1021
+ const defaultStyles$d = {
927
1022
  button: button$1,
928
1023
  buttonBorder,
929
1024
  svg: svg$3,
@@ -934,7 +1029,7 @@ function CloseButton({
934
1029
  onClick,
935
1030
  styles: styles2
936
1031
  }) {
937
- styles2 = mergeStyles(defaultStyles$c, styles2);
1032
+ styles2 = mergeStyles(defaultStyles$d, styles2);
938
1033
  return jsx("button", {
939
1034
  className: [styles2.button, border && styles2.buttonBorder].join(" "),
940
1035
  onClick,
@@ -1077,7 +1172,7 @@ const headerCell = "_headerCell_1b75c_31";
1077
1172
  const headerCellButton = "_headerCellButton_1b75c_39";
1078
1173
  const bodyRow = "_bodyRow_1b75c_48";
1079
1174
  const bodyCell = "_bodyCell_1b75c_53";
1080
- const defaultStyles$b = {
1175
+ const defaultStyles$c = {
1081
1176
  table,
1082
1177
  hideHeader,
1083
1178
  hideHeaderNoBorder,
@@ -1118,7 +1213,7 @@ function Table({
1118
1213
  };
1119
1214
  });
1120
1215
  };
1121
- styles2 = mergeStyles(defaultStyles$b, styles2);
1216
+ styles2 = mergeStyles(defaultStyles$c, styles2);
1122
1217
  return jsxs("table", {
1123
1218
  className: styles2.table,
1124
1219
  children: [jsx("thead", {
@@ -1251,7 +1346,7 @@ const y1Label = "_y1Label_gj7pr_24";
1251
1346
  const y2Label = "_y2Label_gj7pr_28";
1252
1347
  const axis$1 = "_axis_gj7pr_32";
1253
1348
  const axisLabel = "_axisLabel_gj7pr_37";
1254
- const defaultStyles$a = {
1349
+ const defaultStyles$b = {
1255
1350
  slopeChartContainer,
1256
1351
  svg: svg$2,
1257
1352
  line,
@@ -1303,7 +1398,7 @@ const SlopeChart = ({
1303
1398
  return positionLabels(labels);
1304
1399
  }, [lines, y2Label2, yScale]);
1305
1400
  styles2 = mergeStyles({
1306
- ...defaultStyles$a
1401
+ ...defaultStyles$b
1307
1402
  }, styles2);
1308
1403
  const chart = jsx("svg", {
1309
1404
  class: styles2.svg,
@@ -1392,9 +1487,9 @@ const useTooltipTarget = (targetElement, trackPosition) => {
1392
1487
  clientY,
1393
1488
  currentTarget
1394
1489
  }) => {
1395
- const rect2 = currentTarget.getBoundingClientRect();
1396
- const x = clientX - rect2.left;
1397
- const y = clientY - rect2.top;
1490
+ const rect = currentTarget.getBoundingClientRect();
1491
+ const x = clientX - rect.left;
1492
+ const y = clientY - rect.top;
1398
1493
  requestAnimationFrame(() => {
1399
1494
  setPosition({
1400
1495
  x,
@@ -1526,7 +1621,7 @@ function Modal({
1526
1621
  });
1527
1622
  }
1528
1623
  const tooltip = "_tooltip_11t5d_1";
1529
- const defaultStyles$9 = {
1624
+ const defaultStyles$a = {
1530
1625
  tooltip
1531
1626
  };
1532
1627
  const TooltipType = {
@@ -1554,7 +1649,7 @@ function Tooltip({
1554
1649
  hoverActive
1555
1650
  } = useTooltipTarget(targetElement, trackPosition);
1556
1651
  const tooltipRef = useRef(null);
1557
- styles2 = mergeStyles(defaultStyles$9, styles2);
1652
+ styles2 = mergeStyles(defaultStyles$a, styles2);
1558
1653
  useEffect(() => {
1559
1654
  let element = null;
1560
1655
  if (typeof refOrSelector === "string") {
@@ -1649,7 +1744,7 @@ function tooltipPositionForRect({
1649
1744
  }
1650
1745
  const text$2 = "_text_1b8t2_1";
1651
1746
  const container$3 = "_container_1b8t2_10";
1652
- const defaultStyles$8 = {
1747
+ const defaultStyles$9 = {
1653
1748
  text: text$2,
1654
1749
  container: container$3
1655
1750
  };
@@ -1660,7 +1755,7 @@ const ControlChange = ({
1660
1755
  styles: styles2
1661
1756
  }) => {
1662
1757
  styles2 = mergeStyles({
1663
- ...defaultStyles$8
1758
+ ...defaultStyles$9
1664
1759
  }, styles2);
1665
1760
  let hasChanged = next2 !== previous2;
1666
1761
  return jsx("div", {
@@ -1674,9 +1769,8 @@ const ControlChange = ({
1674
1769
  next: styles2.next
1675
1770
  }
1676
1771
  }) : jsx(CircleIcon, {
1677
- abbreviation: next2,
1678
1772
  styles: {
1679
- rect: styles2.next
1773
+ circle: styles2.next || `fill-color--${next2}`
1680
1774
  }
1681
1775
  }), jsx("strong", {
1682
1776
  className: styles2.text,
@@ -1685,16 +1779,20 @@ const ControlChange = ({
1685
1779
  })
1686
1780
  });
1687
1781
  };
1688
- const toplineResult = "_toplineResult_lvw57_9";
1689
- const name = "_name_lvw57_12";
1690
- const displayNumbers = "_displayNumbers_lvw57_25";
1691
- const mainNumber = "_mainNumber_lvw57_34";
1692
- const secondaryNumber = "_secondaryNumber_lvw57_38";
1693
- const displayRow = "_displayRow_lvw57_45";
1694
- const displayColumn = "_displayColumn_lvw57_51";
1695
- const topRow = "_topRow_lvw57_55";
1696
- const defaultStyles$7 = {
1782
+ const toplineResult = "_toplineResult_w8o28_9";
1783
+ const primaryname = "_primaryname_w8o28_12";
1784
+ const secondaryname = "_secondaryname_w8o28_26";
1785
+ const name = "_name_w8o28_32";
1786
+ const displayNumbers = "_displayNumbers_w8o28_45";
1787
+ const mainNumber = "_mainNumber_w8o28_54";
1788
+ const secondaryNumber = "_secondaryNumber_w8o28_58";
1789
+ const displayRow = "_displayRow_w8o28_65";
1790
+ const displayColumn = "_displayColumn_w8o28_71";
1791
+ const topRow = "_topRow_w8o28_75";
1792
+ const defaultStyles$8 = {
1697
1793
  toplineResult,
1794
+ primaryname,
1795
+ secondaryname,
1698
1796
  name,
1699
1797
  displayNumbers,
1700
1798
  mainNumber,
@@ -1705,6 +1803,7 @@ const defaultStyles$7 = {
1705
1803
  };
1706
1804
  const ToplineResult = ({
1707
1805
  name: name2,
1806
+ secondaryName,
1708
1807
  mainNumber: mainNumber2,
1709
1808
  secondaryNumber: secondaryNumber2,
1710
1809
  styles: styles2,
@@ -1715,40 +1814,74 @@ const ToplineResult = ({
1715
1814
  showInfoButton = false
1716
1815
  }) => {
1717
1816
  styles2 = mergeStyles({
1718
- ...defaultStyles$7
1817
+ ...defaultStyles$8
1719
1818
  }, styles2);
1720
1819
  const displayStyle = displayRow2 ? styles2.displayRow : styles2.displayColumn;
1721
- return jsxs("div", {
1722
- class: styles2.toplineResult,
1723
- onMouseOver,
1724
- children: [jsxs("div", {
1725
- class: styles2.topRow,
1726
- children: [jsx("span", {
1727
- class: `${styles2.name} before-color--${abbreviation}`,
1728
- children: name2
1729
- }), " ", showInfoButton && jsx("span", {
1730
- class: styles2.infoButton,
1731
- children: jsx(InfoButton, {
1732
- onClick: onInfoPress
1733
- })
1734
- })]
1735
- }), jsxs("div", {
1736
- class: `${styles2.displayNumbers} ${displayStyle}`,
1737
- children: [jsx("div", {
1738
- class: styles2.mainNumber,
1739
- children: mainNumber2
1740
- }), jsx("div", {
1741
- class: styles2.secondaryNumber,
1742
- children: secondaryNumber2
1820
+ return !secondaryName ? jsxs(Fragment, {
1821
+ children: [" ", jsxs("div", {
1822
+ class: styles2.toplineResult,
1823
+ onMouseOver,
1824
+ children: [jsxs("div", {
1825
+ class: styles2.topRow,
1826
+ children: [jsx("span", {
1827
+ class: `${styles2.name} before-color--${abbreviation}`,
1828
+ children: name2
1829
+ }), " ", showInfoButton && jsx("span", {
1830
+ class: styles2.infoButton,
1831
+ children: jsx(InfoButton, {
1832
+ onClick: onInfoPress
1833
+ })
1834
+ })]
1835
+ }), jsxs("div", {
1836
+ class: `${styles2.displayNumbers} ${displayStyle}`,
1837
+ children: [jsx("div", {
1838
+ class: styles2.mainNumber,
1839
+ children: mainNumber2
1840
+ }), jsx("div", {
1841
+ class: styles2.secondaryNumber,
1842
+ children: secondaryNumber2
1843
+ })]
1743
1844
  })]
1744
1845
  })]
1846
+ }) : jsx(Fragment, {
1847
+ children: jsxs("div", {
1848
+ class: styles2.toplineResult,
1849
+ onMouseOver,
1850
+ children: [jsxs("div", {
1851
+ class: styles2.topRow,
1852
+ children: [jsx("span", {
1853
+ class: `${styles2.primaryname} before-color--${abbreviation}`,
1854
+ children: name2
1855
+ }), " ", showInfoButton && jsx("span", {
1856
+ class: styles2.infoButton,
1857
+ children: jsx(InfoButton, {
1858
+ onClick: onInfoPress
1859
+ })
1860
+ })]
1861
+ }), jsxs("div", {
1862
+ class: styles2.subhead,
1863
+ children: [jsx("span", {
1864
+ class: styles2.secondaryname,
1865
+ children: secondaryName
1866
+ }), " "]
1867
+ }), jsxs("div", {
1868
+ class: `${styles2.displayNumbers} ${displayStyle}`,
1869
+ children: [jsx("div", {
1870
+ class: styles2.mainNumber,
1871
+ children: mainNumber2
1872
+ }), jsx("div", {
1873
+ class: styles2.secondaryNumber,
1874
+ children: secondaryNumber2
1875
+ })]
1876
+ })]
1877
+ })
1745
1878
  });
1746
1879
  };
1747
- const section = "_section_te61d_9";
1748
- const borderTop = "_borderTop_te61d_13";
1749
- const header = "_header_te61d_45";
1750
- const content = "_content_te61d_65";
1751
- const defaultStyles$6 = {
1880
+ const section = "_section_12aiu_9";
1881
+ const borderTop = "_borderTop_12aiu_52";
1882
+ const header = "_header_12aiu_56";
1883
+ const content = "_content_12aiu_76";
1884
+ const defaultStyles$7 = {
1752
1885
  section,
1753
1886
  borderTop,
1754
1887
  header,
@@ -1757,14 +1890,18 @@ const defaultStyles$6 = {
1757
1890
  const PageSection = forwardRef(({
1758
1891
  children,
1759
1892
  styles: styles2,
1760
- borderTop: borderTop2 = false
1893
+ borderTop: borderTop2 = false,
1894
+ backgroundColor = "transparent"
1761
1895
  }, ref) => {
1762
1896
  styles2 = mergeStyles({
1763
- ...defaultStyles$6
1897
+ ...defaultStyles$7
1764
1898
  }, styles2);
1765
1899
  return jsxs("section", {
1766
1900
  ref,
1767
1901
  className: [styles2.section, borderTop2 && styles2.borderTop].join(" "),
1902
+ style: {
1903
+ "--background-color": backgroundColor
1904
+ },
1768
1905
  children: [jsx("div", {
1769
1906
  className: styles2.header,
1770
1907
  children: children.header
@@ -1777,7 +1914,7 @@ const PageSection = forwardRef(({
1777
1914
  const text$1 = "_text_lo5h3_1";
1778
1915
  const axis = "_axis_lo5h3_6";
1779
1916
  const bar = "_bar_lo5h3_10";
1780
- const defaultStyles$5 = {
1917
+ const defaultStyles$6 = {
1781
1918
  text: text$1,
1782
1919
  axis,
1783
1920
  bar
@@ -1792,17 +1929,16 @@ const ColumnChart = ({
1792
1929
  columnPadding,
1793
1930
  styles: styles2
1794
1931
  }) => {
1795
- styles2 = mergeStyles(defaultStyles$5, styles2);
1932
+ styles2 = mergeStyles(defaultStyles$6, styles2);
1796
1933
  const yScale = scaleLinear$1([maxValue, minValue], [0, chartHeight]);
1934
+ const totalColumnWidth = Number(columnWidth) + Number(columnPadding.left) + Number(columnPadding.right);
1797
1935
  return jsxs("svg", {
1798
1936
  width: chartWidth,
1799
1937
  height: chartHeight,
1800
- style: "",
1801
1938
  children: [columns.map((column, index2) => {
1802
1939
  const getHeight = (input2) => {
1803
1940
  return yScale(0) - yScale(input2);
1804
1941
  };
1805
- let totalColumnWidth = Number(columnWidth) + Number(columnPadding.left) + Number(columnPadding.right);
1806
1942
  return jsxs("g", {
1807
1943
  children: [jsx("rect", {
1808
1944
  x: index2 * totalColumnWidth,
@@ -1812,7 +1948,7 @@ const ColumnChart = ({
1812
1948
  fill: column.color,
1813
1949
  className: `${styles2.bar} fill-color--${column.id}`,
1814
1950
  id: column.id
1815
- }, index2), jsx("text", {
1951
+ }), jsx("text", {
1816
1952
  className: styles2.text,
1817
1953
  x: index2 * totalColumnWidth + 2,
1818
1954
  y: column.value < 0 ? yScale(0) - 6 : yScale(0) + 20,
@@ -1836,7 +1972,7 @@ const blurb = "_blurb_vd5ly_44";
1836
1972
  const leftCell = "_leftCell_vd5ly_55";
1837
1973
  const rightCell = "_rightCell_vd5ly_55";
1838
1974
  const mugshot = "_mugshot_vd5ly_71";
1839
- const defaultStyles$4 = {
1975
+ const defaultStyles$5 = {
1840
1976
  text,
1841
1977
  container: container$2,
1842
1978
  title: title$1,
@@ -1855,7 +1991,7 @@ const PartyProfile = ({
1855
1991
  abbreviation
1856
1992
  }) => {
1857
1993
  styles2 = mergeStyles({
1858
- ...defaultStyles$4
1994
+ ...defaultStyles$5
1859
1995
  }, styles2);
1860
1996
  return jsx("div", {
1861
1997
  class: styles2.container,
@@ -2164,7 +2300,7 @@ function SVGMapProvider({
2164
2300
  });
2165
2301
  }
2166
2302
  const path$1 = "_path_1cwd5_9";
2167
- const defaultStyles$3 = {
2303
+ const defaultStyles$4 = {
2168
2304
  path: path$1
2169
2305
  };
2170
2306
  function CompositionBorders({
@@ -2173,7 +2309,7 @@ function CompositionBorders({
2173
2309
  const {
2174
2310
  projection
2175
2311
  } = useContext(MapContext);
2176
- styles2 = mergeStyles(defaultStyles$3, styles2);
2312
+ styles2 = mergeStyles(defaultStyles$4, styles2);
2177
2313
  return jsx("path", {
2178
2314
  className: styles2.path,
2179
2315
  d: projection.getCompositionBorders()
@@ -2472,7 +2608,7 @@ const Map$1 = forwardRef(({
2472
2608
  });
2473
2609
  const container = "_container_azu4a_1";
2474
2610
  const paragraph = "_paragraph_azu4a_12";
2475
- const defaultStyles$2 = {
2611
+ const defaultStyles$3 = {
2476
2612
  container,
2477
2613
  paragraph
2478
2614
  };
@@ -2485,7 +2621,7 @@ function ResultSummary({
2485
2621
  styles: styles2
2486
2622
  }) {
2487
2623
  styles2 = mergeStyles({
2488
- ...defaultStyles$2
2624
+ ...defaultStyles$3
2489
2625
  }, styles2);
2490
2626
  return jsxs("div", {
2491
2627
  class: styles2.container,
@@ -2528,7 +2664,7 @@ const suggestions = "_suggestions_g5w44_36";
2528
2664
  const suggestion = "_suggestion_g5w44_36";
2529
2665
  const selected = "_selected_g5w44_59";
2530
2666
  const highlighted = "_highlighted_g5w44_63";
2531
- const defaultStyles$1 = {
2667
+ const defaultStyles$2 = {
2532
2668
  searchContainer,
2533
2669
  input,
2534
2670
  searchIcon,
@@ -2549,7 +2685,7 @@ function SearchInput({
2549
2685
  styles: styles2
2550
2686
  }) {
2551
2687
  var _a, _b, _c;
2552
- styles2 = mergeStyles(defaultStyles$1, styles2);
2688
+ styles2 = mergeStyles(defaultStyles$2, styles2);
2553
2689
  const inputRef = useRef(null);
2554
2690
  const [selectedIndex, setSelectedIndex] = useState(-1);
2555
2691
  const [suggestions2, setSuggestions] = useState();
@@ -2658,6 +2794,32 @@ function SuggestionList({
2658
2794
  })
2659
2795
  });
2660
2796
  }
2797
+ const refreshIndicator = "_refreshIndicator_u6lji_1";
2798
+ const liveText = "_liveText_u6lji_8";
2799
+ const refreshText = "_refreshText_u6lji_9";
2800
+ const defaultStyles$1 = {
2801
+ refreshIndicator,
2802
+ liveText,
2803
+ refreshText
2804
+ };
2805
+ function RefreshIndicator({
2806
+ text: text2,
2807
+ styles: styles2
2808
+ }) {
2809
+ styles2 = mergeStyles(defaultStyles$1, styles2);
2810
+ return jsxs("div", {
2811
+ className: styles2.refreshIndicator,
2812
+ children: [jsx(CircleIcon, {
2813
+ pulse: true
2814
+ }), jsx("span", {
2815
+ className: styles2.liveText,
2816
+ children: "LIVE"
2817
+ }), jsx("span", {
2818
+ className: styles2.refreshText,
2819
+ children: text2
2820
+ })]
2821
+ });
2822
+ }
2661
2823
  const coalitionsWrapper = "_coalitionsWrapper_1ahqy_9";
2662
2824
  const coalitionsContainer = "_coalitionsContainer_1ahqy_14";
2663
2825
  const coalition = "_coalition_1ahqy_9";
@@ -2961,6 +3123,7 @@ export {
2961
3123
  PageSection,
2962
3124
  PartyProfile,
2963
3125
  Projection,
3126
+ RefreshIndicator,
2964
3127
  RelativeTimeSentence,
2965
3128
  ResultSummary,
2966
3129
  SearchInput,