@guardian/interactive-component-library 0.1.0-alpha.17 → 0.1.0-alpha.19

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,15 +1,17 @@
1
1
  import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
2
- import { useRef, useState, useLayoutEffect, useCallback, useEffect, useMemo, useContext, useImperativeHandle } from "preact/hooks";
2
+ import { useRef, useMemo, useCallback, useEffect, useState, useLayoutEffect, useContext, useImperativeHandle } from "preact/hooks";
3
3
  import { render, createElement, cloneElement, createContext, toChildArray } from "preact";
4
4
  import { useSyncExternalStore, createPortal, forwardRef } from "preact/compat";
5
5
  import { scaleLinear as scaleLinear$1 } from "d3-scale";
6
6
  import { geoStream, geoAlbers, geoPath, geoContains, geoMercator } from "d3-geo";
7
7
  const main = "";
8
- const group = "_group_nq9z3_1";
9
- const rotated = "_rotated_nq9z3_6";
10
- const path$4 = "_path_nq9z3_10";
11
- const active = "_active_nq9z3_14";
12
- const defaultStyles$s = {
8
+ const svg$9 = "_svg_b5io0_1";
9
+ const group = "_group_b5io0_5";
10
+ const rotated = "_rotated_b5io0_10";
11
+ const path$4 = "_path_b5io0_14";
12
+ const active = "_active_b5io0_18";
13
+ const defaultStyles$t = {
14
+ svg: svg$9,
13
15
  group,
14
16
  rotated,
15
17
  path: path$4,
@@ -48,19 +50,20 @@ function Chevron({
48
50
  styles: styles2
49
51
  }) {
50
52
  const defaultStylesCopy = {
51
- ...defaultStyles$s
53
+ ...defaultStyles$t
52
54
  };
53
55
  if (active2) {
54
- defaultStylesCopy.path = mergeStyles(defaultStyles$s.path, defaultStyles$s.active);
56
+ defaultStylesCopy.path = mergeStyles(defaultStyles$t.path, defaultStyles$t.active);
55
57
  }
56
58
  if (direction === DIRECTION.up) {
57
- defaultStylesCopy.group = mergeStyles(defaultStyles$s.group, defaultStyles$s.rotated);
59
+ defaultStylesCopy.group = mergeStyles(defaultStyles$t.group, defaultStyles$t.rotated);
58
60
  }
59
61
  styles2 = mergeStyles(defaultStylesCopy, styles2);
60
62
  return jsx("svg", {
61
63
  width: "16",
62
64
  height: "24",
63
65
  viewBox: "0 0 16 24",
66
+ className: styles2.svg,
64
67
  fill: "none",
65
68
  xmlns: "http://www.w3.org/2000/svg",
66
69
  children: jsx("g", {
@@ -75,12 +78,12 @@ function Chevron({
75
78
  })
76
79
  });
77
80
  }
78
- const container$4 = "_container_jzalm_1";
81
+ const container$5 = "_container_jzalm_1";
79
82
  const dot = "_dot_jzalm_6";
80
83
  const circle$2 = "_circle_jzalm_13";
81
84
  const text$4 = "_text_jzalm_17";
82
- const defaultStyles$r = {
83
- container: container$4,
85
+ const defaultStyles$s = {
86
+ container: container$5,
84
87
  dot,
85
88
  circle: circle$2,
86
89
  text: text$4
@@ -96,10 +99,10 @@ const LegendItem = ({
96
99
  abbreviation
97
100
  }) => {
98
101
  const defaultStylesCopy = {
99
- ...defaultStyles$r
102
+ ...defaultStyles$s
100
103
  };
101
104
  if (dotType === DOT_TYPE.round) {
102
- defaultStylesCopy.dot = mergeStyles(defaultStyles$r.dot, defaultStyles$r.circle);
105
+ defaultStylesCopy.dot = mergeStyles(defaultStyles$s.dot, defaultStyles$s.circle);
103
106
  }
104
107
  styles2 = mergeStyles(defaultStylesCopy, styles2);
105
108
  return jsxs("div", {
@@ -112,67 +115,93 @@ const LegendItem = ({
112
115
  })]
113
116
  });
114
117
  };
115
- function isDarkColor(color) {
116
- let r, g, b;
117
- if (color.match(/^rgb/)) {
118
- color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
119
- r = color[1];
120
- g = color[2];
121
- b = color[3];
122
- } else {
123
- color = +`0x${color.slice(1).replace(color.length < 5 && /./g, "$&$&")}`;
124
- r = color >> 16;
125
- g = color >> 8 & 255;
126
- b = color & 255;
127
- }
128
- const hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
129
- if (hsp > 140) {
130
- return false;
131
- }
132
- return true;
133
- }
134
- const bar$2 = "_bar_wmb0k_1";
135
- const label$1 = "_label_wmb0k_5";
136
- const backgroundRect = "_backgroundRect_wmb0k_11";
137
- const defaultStyles$q = {
118
+ const bar$2 = "_bar_bf839_1";
119
+ const label$1 = "_label_bf839_5";
120
+ const backgroundRect = "_backgroundRect_bf839_11";
121
+ const defaultStyles$r = {
138
122
  bar: bar$2,
139
123
  label: label$1,
140
124
  backgroundRect
141
125
  };
126
+ function preventOverlap(labelPositions, iteration = 0, labelSize = 12, coordinate = "y") {
127
+ const maxIterations = 10;
128
+ let totalOverlap = 0;
129
+ for (let index2 = 1; index2 < labelPositions.length; index2++) {
130
+ const previousElement = labelPositions[index2 - 1];
131
+ const element = labelPositions[index2];
132
+ const overlap = previousElement[coordinate] - (element[coordinate] - labelSize);
133
+ if (overlap < 0) {
134
+ continue;
135
+ }
136
+ previousElement[coordinate] -= overlap / 2;
137
+ element[coordinate] += overlap / 2;
138
+ totalOverlap += overlap;
139
+ }
140
+ if (totalOverlap > 0 && iteration < maxIterations) {
141
+ return preventOverlap(labelPositions, iteration + 1);
142
+ }
143
+ return labelPositions;
144
+ }
145
+ function uniqueBy(array, key) {
146
+ return [...array.reduce((map, d2) => map.set(d2[key], d2), /* @__PURE__ */ new Map()).values()];
147
+ }
148
+ function positionLabels(labels, coordinate = "y") {
149
+ labels = uniqueBy(labels, "value");
150
+ labels.sort((a, b) => a[coordinate] - b[coordinate]);
151
+ return preventOverlap(labels);
152
+ }
153
+ function scaleLinear(domain, range) {
154
+ const [domainMin, domainMax] = domain;
155
+ const [rangeMin, rangeMax] = range;
156
+ const slope = (rangeMax - rangeMin) / (domainMax - domainMin);
157
+ const intercept = rangeMin - slope * domainMin;
158
+ return function(x) {
159
+ return slope * x + intercept;
160
+ };
161
+ }
162
+ const LabelType = {
163
+ hanging: "hanging",
164
+ inline: "inline"
165
+ };
142
166
  function StackedBar({
143
167
  stack,
144
168
  width,
145
169
  height,
170
+ hideLabels = false,
171
+ labelType = LabelType.hanging,
146
172
  showBackgroundRect = false,
147
173
  createSVG = true,
148
174
  styles: styles2
149
175
  }) {
150
176
  const rectElements = useRef([]);
151
177
  const textElements = useRef([]);
152
- const [hideLabels, setHideLabels] = useState(true);
153
- useLayoutEffect(() => {
154
- for (let index2 = 0; index2 < stack.length; index2++) {
155
- const rectElement = rectElements.current[index2];
156
- const textElement = textElements.current[index2];
157
- const paddingX = 8;
158
- const hideText = textElement.getBBox().width + paddingX > rectElement.getBBox().width;
159
- const rectStyle = window.getComputedStyle(rectElement);
160
- const rectColor = rectStyle.getPropertyValue("fill");
161
- const textColor = isDarkColor(rectColor) ? "#FFF" : "#121212";
162
- textElement.style.fill = textColor;
163
- if (hideText) {
164
- setHideLabels(true);
165
- return;
166
- }
167
- }
168
- setHideLabels(false);
169
- }, [stack, width, height]);
170
178
  styles2 = mergeStyles({
171
- ...defaultStyles$q
179
+ ...defaultStyles$r
172
180
  }, styles2);
181
+ const svgHeight = labelType === LabelType.hanging ? height + 20 : height;
182
+ const renderLabel = (config, i) => jsx("text", {
183
+ ref: (element) => textElements.current[i] = element,
184
+ "text-rendering": "optimizeLegibility",
185
+ className: styles2.label,
186
+ style: {
187
+ display: "visible"
188
+ },
189
+ x: config.x,
190
+ y: config.y,
191
+ textAnchor: config.textAnchor,
192
+ alignmentBaseline: config.alignmentBaseline,
193
+ children: config.value
194
+ }, `label-${i}`);
173
195
  let totalWidth = 0;
174
196
  const content2 = stack.map((d2, index2) => {
175
197
  const itemWidth = d2.fraction * width;
198
+ const labelConfig = {
199
+ value: d2.label,
200
+ x: itemWidth - 4,
201
+ y: height / 2,
202
+ textAnchor: "end",
203
+ alignmentBaseline: "central"
204
+ };
176
205
  const value = jsxs("g", {
177
206
  transform: `translate(${totalWidth}, 0)`,
178
207
  children: [jsx("rect", {
@@ -184,23 +213,28 @@ function StackedBar({
184
213
  fill: d2.fill
185
214
  },
186
215
  "shape-rendering": "crispEdges"
187
- }), jsx("text", {
188
- ref: (element) => textElements.current[index2] = element,
189
- x: itemWidth - 4,
190
- y: height / 2,
191
- "text-anchor": "end",
192
- "alignment-baseline": "central",
193
- "text-rendering": "optimizeLegibility",
194
- className: styles2.label,
195
- style: {
196
- visibility: hideLabels ? "hidden" : "visible"
197
- },
198
- children: d2.label
199
- })]
216
+ }), labelType === LabelType.inline && !hideLabels && renderLabel(labelConfig, index2)]
200
217
  }, index2);
201
218
  totalWidth += itemWidth;
202
219
  return value;
203
220
  });
221
+ const hangingLabelConfig = useMemo(() => {
222
+ let totalW = 0;
223
+ let labels = stack.map((d2) => {
224
+ const itemWidth = d2.fraction * width;
225
+ const labelConfig = {
226
+ x: itemWidth + totalW,
227
+ y: height + 4,
228
+ value: d2.label,
229
+ textAnchor: "end",
230
+ alignmentBaseline: "hanging"
231
+ };
232
+ console.log(labelConfig);
233
+ totalW += itemWidth;
234
+ return labelConfig;
235
+ });
236
+ return preventOverlap(labels, 0, 20, "x");
237
+ }, [stack, height, width]);
204
238
  const backgroundRect2 = jsx("g", {
205
239
  children: jsx("rect", {
206
240
  x: "0",
@@ -214,14 +248,16 @@ function StackedBar({
214
248
  return jsxs("svg", {
215
249
  overflow: "hidden",
216
250
  width,
217
- height,
218
- viewBox: `0 0 ${width} ${height}`,
251
+ height: svgHeight,
252
+ viewBox: `0 0 ${width} ${svgHeight}`,
219
253
  xmlns: "http://www.w3.org/2000/svg",
220
- children: [showBackgroundRect && backgroundRect2, content2]
254
+ children: [showBackgroundRect && backgroundRect2, jsxs("g", {
255
+ children: [content2, labelType === LabelType.hanging && !hideLabels && hangingLabelConfig.map((config, i) => renderLabel(config, i))]
256
+ })]
221
257
  });
222
258
  }
223
- return jsx(Fragment, {
224
- children: content2
259
+ return jsxs("g", {
260
+ children: [content2, labelType === LabelType.hanging && !hideLabels && hangingLabelConfig.map((config, i) => renderLabel(config, i))]
225
261
  });
226
262
  }
227
263
  function shouldUpdate(oldState, newState) {
@@ -281,7 +317,7 @@ const [useGradients, setGradients, getGradients] = createStore({});
281
317
  const svg$8 = "_svg_1cajk_6";
282
318
  const previous = "_previous_1cajk_12";
283
319
  const next = "_next_1cajk_16";
284
- const defaultStyles$p = {
320
+ const defaultStyles$q = {
285
321
  svg: svg$8,
286
322
  previous,
287
323
  next
@@ -292,7 +328,7 @@ const GradientIcon = (props) => {
292
328
  next: next2,
293
329
  styles: styles2
294
330
  } = props;
295
- styles2 = mergeStyles(defaultStyles$p, styles2);
331
+ styles2 = mergeStyles(defaultStyles$q, styles2);
296
332
  const gradientId = `gv-gradient-def-${previous2}-${next2}`;
297
333
  const gradients = useGradients();
298
334
  useEffect(() => {
@@ -359,9 +395,9 @@ function GradientDefs({
359
395
  })
360
396
  });
361
397
  }
362
- const button$4 = "_button_kpmyt_1";
363
- const svg$7 = "_svg_kpmyt_14";
364
- const defaultStyles$o = {
398
+ const button$4 = "_button_oqopj_1";
399
+ const svg$7 = "_svg_oqopj_15";
400
+ const defaultStyles$p = {
365
401
  button: button$4,
366
402
  svg: svg$7
367
403
  };
@@ -370,7 +406,7 @@ const InfoButton = ({
370
406
  styles: styles2
371
407
  }) => {
372
408
  styles2 = mergeStyles({
373
- ...defaultStyles$o
409
+ ...defaultStyles$p
374
410
  }, styles2);
375
411
  return jsx("button", {
376
412
  class: styles2.button,
@@ -388,7 +424,7 @@ const InfoButton = ({
388
424
  const svg$6 = "_svg_1v49v_1";
389
425
  const circle$1 = "_circle_1v49v_5";
390
426
  const pulse = "_pulse_1v49v_9";
391
- const defaultStyles$n = {
427
+ const defaultStyles$o = {
392
428
  svg: svg$6,
393
429
  circle: circle$1,
394
430
  pulse
@@ -398,7 +434,7 @@ const CircleIcon = ({
398
434
  pulse: pulse2 = false,
399
435
  styles: styles2
400
436
  }) => {
401
- styles2 = mergeStyles(defaultStyles$n, styles2);
437
+ styles2 = mergeStyles(defaultStyles$o, styles2);
402
438
  return jsx("svg", {
403
439
  style: styles2.svg,
404
440
  fill: "none",
@@ -418,7 +454,7 @@ const CircleIcon = ({
418
454
  });
419
455
  };
420
456
  const text$3 = "_text_1okyv_1";
421
- const defaultStyles$m = {
457
+ const defaultStyles$n = {
422
458
  text: text$3
423
459
  };
424
460
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -768,7 +804,7 @@ const RelativeTimeSentence = ({
768
804
  styles: styles2
769
805
  }) => {
770
806
  styles2 = mergeStyles({
771
- ...defaultStyles$m
807
+ ...defaultStyles$n
772
808
  }, styles2);
773
809
  let timeSince = dayjs(timeStamp).fromNow();
774
810
  return jsx("span", {
@@ -778,7 +814,7 @@ const RelativeTimeSentence = ({
778
814
  };
779
815
  const pageContainer = "_pageContainer_1s0yq_9";
780
816
  const sideBorders = "_sideBorders_1s0yq_42";
781
- const defaultStyles$l = {
817
+ const defaultStyles$m = {
782
818
  pageContainer,
783
819
  sideBorders
784
820
  };
@@ -790,15 +826,19 @@ function Container({
790
826
  const {
791
827
  pageContainer: pageContainer2,
792
828
  sideBorders: sideBordersStyle
793
- } = mergeStyles(defaultStyles$l, styles2);
829
+ } = mergeStyles(defaultStyles$m, styles2);
794
830
  return jsx("div", {
795
831
  className: [pageContainer2, sideBorders2 && sideBordersStyle].join(" "),
796
832
  children
797
833
  });
798
834
  }
799
- const bar$1 = "_bar_17pyf_9";
800
- const defaultStyles$k = {
801
- bar: bar$1
835
+ const wrapper = "_wrapper_5oj1x_9";
836
+ const bar$1 = "_bar_5oj1x_14";
837
+ const zero = "_zero_5oj1x_19";
838
+ const defaultStyles$l = {
839
+ wrapper,
840
+ bar: bar$1,
841
+ zero
802
842
  };
803
843
  function ChangeBar({
804
844
  fraction,
@@ -814,23 +854,27 @@ function ChangeBar({
814
854
  let posleft = `${centre}px`;
815
855
  let thisStyles = ` height: ${height}; width: ${barwidth}px; ${positive ? `left: ${posleft}` : `left: ${negleft}`}`;
816
856
  let thisColor = ` bg-color--${party}`;
857
+ let zeroStyles = ` height: ${height};`;
817
858
  styles2 = mergeStyles({
818
- ...defaultStyles$k
859
+ ...defaultStyles$l
819
860
  }, styles2);
820
- return jsx("div", {
861
+ return jsxs("div", {
821
862
  className: styles2.wrapper,
822
863
  style: `width: ${width}px`,
823
- children: jsx("div", {
864
+ children: [jsx("div", {
824
865
  className: styles2.bar.concat(thisColor),
825
866
  style: thisStyles
826
- })
867
+ }), jsx("div", {
868
+ className: styles2.zero,
869
+ style: zeroStyles
870
+ })]
827
871
  });
828
872
  }
829
873
  const svg$5 = "_svg_886i1_9";
830
874
  const dividingLineColor = "_dividingLineColor_886i1_16";
831
875
  const square = "_square_886i1_20";
832
876
  const corner = "_corner_886i1_24";
833
- const defaultStyles$j = {
877
+ const defaultStyles$k = {
834
878
  svg: svg$5,
835
879
  dividingLineColor,
836
880
  square,
@@ -843,7 +887,7 @@ const SquareCutCornerIcon = ({
843
887
  styles: styles2
844
888
  }) => {
845
889
  styles2 = mergeStyles({
846
- ...defaultStyles$j
890
+ ...defaultStyles$k
847
891
  }, styles2);
848
892
  let cornerSize = squareSize * 0.625;
849
893
  let cornerMargin = squareSize < 100 ? squareSize / 6 : 10;
@@ -876,12 +920,12 @@ const SquareCutCornerIcon = ({
876
920
  })
877
921
  });
878
922
  };
879
- const stackedGridContainer = "_stackedGridContainer_1e05o_1";
880
- const stackedGridRotateItems0 = "_stackedGridRotateItems0_1e05o_13";
881
- const stackedGridRotateItems90 = "_stackedGridRotateItems90_1e05o_19";
882
- const stackedGridRotateItems180 = "_stackedGridRotateItems180_1e05o_25";
883
- const stackedGridRotateItems270 = "_stackedGridRotateItems270_1e05o_31";
884
- const defaultStyles$i = {
923
+ const stackedGridContainer = "_stackedGridContainer_6whof_1";
924
+ const stackedGridRotateItems0 = "_stackedGridRotateItems0_6whof_11";
925
+ const stackedGridRotateItems90 = "_stackedGridRotateItems90_6whof_17";
926
+ const stackedGridRotateItems180 = "_stackedGridRotateItems180_6whof_23";
927
+ const stackedGridRotateItems270 = "_stackedGridRotateItems270_6whof_29";
928
+ const defaultStyles$j = {
885
929
  stackedGridContainer,
886
930
  stackedGridRotateItems0,
887
931
  stackedGridRotateItems90,
@@ -907,29 +951,23 @@ const getContainerFlip = (fromBottom, fromLeft) => {
907
951
  const StackedGrid = ({
908
952
  fromLeft,
909
953
  fromBottom,
910
- containerWidth,
911
954
  children,
912
955
  styles: styles2
913
956
  }) => {
914
957
  let containerFlip = getContainerFlip(fromBottom, fromLeft);
915
958
  let itemRotateClass = getItemRotate(fromBottom, fromLeft);
916
- let flexStyles = {
917
- display: "flex",
918
- flexDirection: "row",
919
- flexWrap: "wrap",
920
- width: containerWidth,
921
- transform: containerFlip
922
- };
923
- styles2 = mergeStyles(defaultStyles$i, styles2);
959
+ styles2 = mergeStyles(defaultStyles$j, styles2);
924
960
  return jsx("div", {
925
- style: flexStyles,
961
+ style: {
962
+ transform: containerFlip
963
+ },
926
964
  className: `${styles2.stackedGridContainer} ${styles2[itemRotateClass]}`,
927
965
  children
928
966
  });
929
967
  };
930
968
  const svg$4 = "_svg_l2fsl_9";
931
969
  const squareFill = "_squareFill_l2fsl_16";
932
- const defaultStyles$h = {
970
+ const defaultStyles$i = {
933
971
  svg: svg$4,
934
972
  squareFill
935
973
  };
@@ -939,7 +977,7 @@ const SquareIcon = ({
939
977
  styles: styles2
940
978
  }) => {
941
979
  styles2 = mergeStyles({
942
- ...defaultStyles$h
980
+ ...defaultStyles$i
943
981
  }, styles2);
944
982
  return jsx("svg", {
945
983
  width: size,
@@ -957,7 +995,7 @@ const SquareIcon = ({
957
995
  };
958
996
  const button$3 = "_button_1fees_1";
959
997
  const icon = "_icon_1fees_6";
960
- const defaultStyles$g = {
998
+ const defaultStyles$h = {
961
999
  button: button$3,
962
1000
  icon
963
1001
  };
@@ -967,7 +1005,7 @@ function ArrowButton({
967
1005
  styles: styles2,
968
1006
  onClick
969
1007
  }) {
970
- styles2 = mergeStyles(defaultStyles$g, styles2);
1008
+ styles2 = mergeStyles(defaultStyles$h, styles2);
971
1009
  return jsx("button", {
972
1010
  className: styles2.button,
973
1011
  disabled,
@@ -991,9 +1029,9 @@ function ArrowButton({
991
1029
  })
992
1030
  });
993
1031
  }
994
- const button$2 = "_button_19t7j_1";
995
- const buttonInner$1 = "_buttonInner_19t7j_6";
996
- const defaultStyles$f = {
1032
+ const button$2 = "_button_3521c_1";
1033
+ const buttonInner$1 = "_buttonInner_3521c_6";
1034
+ const defaultStyles$g = {
997
1035
  button: button$2,
998
1036
  buttonInner: buttonInner$1
999
1037
  };
@@ -1003,7 +1041,7 @@ function Button({
1003
1041
  styles: styles2,
1004
1042
  children
1005
1043
  }) {
1006
- styles2 = mergeStyles(defaultStyles$f, styles2);
1044
+ styles2 = mergeStyles(defaultStyles$g, styles2);
1007
1045
  return jsx("button", {
1008
1046
  className: styles2.button,
1009
1047
  "data-type": type,
@@ -1014,11 +1052,11 @@ function Button({
1014
1052
  })
1015
1053
  });
1016
1054
  }
1017
- const button$1 = "_button_6w12u_1";
1018
- const buttonBorder = "_buttonBorder_6w12u_10";
1019
- const svg$3 = "_svg_6w12u_18";
1020
- const path$3 = "_path_6w12u_24";
1021
- const defaultStyles$e = {
1055
+ const button$1 = "_button_125im_1";
1056
+ const buttonBorder = "_buttonBorder_125im_11";
1057
+ const svg$3 = "_svg_125im_19";
1058
+ const path$3 = "_path_125im_25";
1059
+ const defaultStyles$f = {
1022
1060
  button: button$1,
1023
1061
  buttonBorder,
1024
1062
  svg: svg$3,
@@ -1029,7 +1067,7 @@ function CloseButton({
1029
1067
  onClick,
1030
1068
  styles: styles2
1031
1069
  }) {
1032
- styles2 = mergeStyles(defaultStyles$e, styles2);
1070
+ styles2 = mergeStyles(defaultStyles$f, styles2);
1033
1071
  return jsx("button", {
1034
1072
  className: [styles2.button, border && styles2.buttonBorder].join(" "),
1035
1073
  onClick,
@@ -1047,6 +1085,39 @@ function CloseButton({
1047
1085
  })
1048
1086
  });
1049
1087
  }
1088
+ const container$4 = "_container_tq3ke_1";
1089
+ const slot = "_slot_tq3ke_5";
1090
+ const defaultStyles$e = {
1091
+ container: container$4,
1092
+ slot
1093
+ };
1094
+ function AdSlot({
1095
+ name: name2,
1096
+ sizeMapping,
1097
+ styles: styles2
1098
+ }) {
1099
+ var _a, _b, _c;
1100
+ const slotId = `dfp-ad--${name2}`;
1101
+ styles2 = mergeStyles(defaultStyles$e, styles2);
1102
+ const mobileSizes = (_a = sizeMapping.mobile) == null ? void 0 : _a.map((size) => size.join(",")).join("|");
1103
+ const tabletSizes = (_b = sizeMapping.tablet) == null ? void 0 : _b.map((size) => size.join(",")).join("|");
1104
+ const desktopSizes = (_c = sizeMapping.desktop) == null ? void 0 : _c.map((size) => size.join(",")).join("|");
1105
+ return jsx("div", {
1106
+ className: ["ad-slot-container", styles2.container].join(" "),
1107
+ children: jsx("div", {
1108
+ id: slotId,
1109
+ className: ["js-ad-slot", "ad-slot", "interactive-ad-slot", styles2.slot].join(" "),
1110
+ "data-link-name": `ad slot ${name2}`,
1111
+ "data-name": `${name2}`,
1112
+ "data-label-show": "true",
1113
+ "ad-label-text": "Advertisement",
1114
+ "aria-hidden": "true",
1115
+ "data-mobile": mobileSizes,
1116
+ "data-tablet": tabletSizes,
1117
+ "data-desktop": desktopSizes
1118
+ })
1119
+ });
1120
+ }
1050
1121
  const sortAscending = (accessor) => {
1051
1122
  return (a, b) => {
1052
1123
  const valueA = a[accessor];
@@ -1165,13 +1236,13 @@ class CellModel {
1165
1236
  return this.row[this.column.accessor].toString();
1166
1237
  }
1167
1238
  }
1168
- const table = "_table_1b75c_9";
1169
- const hideHeader = "_hideHeader_1b75c_18";
1170
- const hideHeaderNoBorder = "_hideHeaderNoBorder_1b75c_27";
1171
- const headerCell = "_headerCell_1b75c_31";
1172
- const headerCellButton = "_headerCellButton_1b75c_39";
1173
- const bodyRow = "_bodyRow_1b75c_48";
1174
- const bodyCell = "_bodyCell_1b75c_53";
1239
+ const table = "_table_1dg64_9";
1240
+ const hideHeader = "_hideHeader_1dg64_19";
1241
+ const hideHeaderNoBorder = "_hideHeaderNoBorder_1dg64_28";
1242
+ const headerCell = "_headerCell_1dg64_32";
1243
+ const headerCellButton = "_headerCellButton_1dg64_40";
1244
+ const bodyRow = "_bodyRow_1dg64_49";
1245
+ const bodyCell = "_bodyCell_1dg64_54";
1175
1246
  const defaultStyles$d = {
1176
1247
  table,
1177
1248
  hideHeader,
@@ -1216,6 +1287,8 @@ function Table({
1216
1287
  styles2 = mergeStyles(defaultStyles$d, styles2);
1217
1288
  return jsxs("table", {
1218
1289
  className: styles2.table,
1290
+ cellSpacing: 0,
1291
+ cellPadding: 0,
1219
1292
  children: [jsx("thead", {
1220
1293
  className: hideHeader2 && styles2.hideHeader,
1221
1294
  children: jsx("tr", {
@@ -1273,42 +1346,6 @@ function HeaderCell({
1273
1346
  })]
1274
1347
  });
1275
1348
  }
1276
- function preventOverlap(labelPositions, iteration = 0, labelHeight = 12) {
1277
- const maxIterations = 10;
1278
- let totalOverlap = 0;
1279
- for (let index2 = 1; index2 < labelPositions.length; index2++) {
1280
- const previousElement = labelPositions[index2 - 1];
1281
- const element = labelPositions[index2];
1282
- const overlap = previousElement.y - (element.y - labelHeight);
1283
- if (overlap < 0) {
1284
- continue;
1285
- }
1286
- previousElement.y -= overlap / 2;
1287
- element.y += overlap / 2;
1288
- totalOverlap += overlap;
1289
- }
1290
- if (totalOverlap > 0 && iteration < maxIterations) {
1291
- return preventOverlap(labelPositions, iteration + 1);
1292
- }
1293
- return labelPositions;
1294
- }
1295
- function uniqueBy(array, key) {
1296
- return [...array.reduce((map, d2) => map.set(d2[key], d2), /* @__PURE__ */ new Map()).values()];
1297
- }
1298
- function positionLabels(labels) {
1299
- labels = uniqueBy(labels, "value");
1300
- labels.sort((a, b) => a.y - b.y);
1301
- return preventOverlap(labels);
1302
- }
1303
- function scaleLinear(domain, range) {
1304
- const [domainMin, domainMax] = domain;
1305
- const [rangeMin, rangeMax] = range;
1306
- const slope = (rangeMax - rangeMin) / (domainMax - domainMin);
1307
- const intercept = rangeMin - slope * domainMin;
1308
- return function(x) {
1309
- return slope * x + intercept;
1310
- };
1311
- }
1312
1349
  function useWindowSize() {
1313
1350
  const [windowSize, setWindowSize] = useState(() => {
1314
1351
  if (typeof window === "undefined")
@@ -1772,7 +1809,7 @@ const ControlChange = ({
1772
1809
  }
1773
1810
  }) : jsx(CircleIcon, {
1774
1811
  styles: {
1775
- circle: styles2.next || `fill-color--${next2}`
1812
+ circle: `fill-color--${next2}`
1776
1813
  }
1777
1814
  }), jsx("strong", {
1778
1815
  className: styles2.text,
@@ -1781,16 +1818,17 @@ const ControlChange = ({
1781
1818
  })
1782
1819
  });
1783
1820
  };
1784
- const toplineResult = "_toplineResult_w8o28_9";
1785
- const primaryname = "_primaryname_w8o28_12";
1786
- const secondaryname = "_secondaryname_w8o28_26";
1787
- const name = "_name_w8o28_32";
1788
- const displayNumbers = "_displayNumbers_w8o28_45";
1789
- const mainNumber = "_mainNumber_w8o28_54";
1790
- const secondaryNumber = "_secondaryNumber_w8o28_58";
1791
- const displayRow = "_displayRow_w8o28_65";
1792
- const displayColumn = "_displayColumn_w8o28_71";
1793
- const topRow = "_topRow_w8o28_75";
1821
+ const toplineResult = "_toplineResult_49z3u_9";
1822
+ const primaryname = "_primaryname_49z3u_14";
1823
+ const secondaryname = "_secondaryname_49z3u_29";
1824
+ const name = "_name_49z3u_36";
1825
+ const displayNumbers = "_displayNumbers_49z3u_50";
1826
+ const mainNumber = "_mainNumber_49z3u_61";
1827
+ const mainNumberSuffix = "_mainNumberSuffix_49z3u_66";
1828
+ const secondaryNumber = "_secondaryNumber_49z3u_69";
1829
+ const displayRow = "_displayRow_49z3u_76";
1830
+ const displayColumn = "_displayColumn_49z3u_82";
1831
+ const topRow = "_topRow_49z3u_86";
1794
1832
  const defaultStyles$9 = {
1795
1833
  toplineResult,
1796
1834
  primaryname,
@@ -1798,6 +1836,7 @@ const defaultStyles$9 = {
1798
1836
  name,
1799
1837
  displayNumbers,
1800
1838
  mainNumber,
1839
+ mainNumberSuffix,
1801
1840
  secondaryNumber,
1802
1841
  displayRow,
1803
1842
  displayColumn,
@@ -1807,6 +1846,7 @@ const ToplineResult = ({
1807
1846
  name: name2,
1808
1847
  secondaryName,
1809
1848
  mainNumber: mainNumber2,
1849
+ mainNumberSuffix: mainNumberSuffix2,
1810
1850
  secondaryNumber: secondaryNumber2,
1811
1851
  styles: styles2,
1812
1852
  displayRow: displayRow2 = false,
@@ -1819,64 +1859,66 @@ const ToplineResult = ({
1819
1859
  ...defaultStyles$9
1820
1860
  }, styles2);
1821
1861
  const displayStyle = displayRow2 ? styles2.displayRow : styles2.displayColumn;
1822
- return !secondaryName ? jsxs(Fragment, {
1823
- children: [" ", jsxs("div", {
1824
- class: styles2.toplineResult,
1825
- onMouseOver,
1862
+ return !secondaryName ? jsxs("div", {
1863
+ class: styles2.toplineResult,
1864
+ onMouseOver,
1865
+ children: [jsxs("div", {
1866
+ class: styles2.topRow,
1867
+ children: [jsx("span", {
1868
+ class: `${styles2.name} before-color--${abbreviation}`,
1869
+ children: name2
1870
+ }), " ", showInfoButton && jsx("span", {
1871
+ class: styles2.infoButton,
1872
+ children: jsx(InfoButton, {
1873
+ onClick: onInfoPress
1874
+ })
1875
+ })]
1876
+ }), jsxs("div", {
1877
+ class: `${styles2.displayNumbers} ${displayStyle}`,
1826
1878
  children: [jsxs("div", {
1827
- class: styles2.topRow,
1828
- children: [jsx("span", {
1829
- class: `${styles2.name} before-color--${abbreviation}`,
1830
- children: name2
1831
- }), " ", showInfoButton && jsx("span", {
1832
- class: styles2.infoButton,
1833
- children: jsx(InfoButton, {
1834
- onClick: onInfoPress
1835
- })
1836
- })]
1837
- }), jsxs("div", {
1838
- class: `${styles2.displayNumbers} ${displayStyle}`,
1839
- children: [jsx("div", {
1840
- class: styles2.mainNumber,
1841
- children: mainNumber2
1842
- }), jsx("div", {
1843
- class: styles2.secondaryNumber,
1844
- children: secondaryNumber2
1879
+ class: styles2.mainNumber,
1880
+ children: [mainNumber2, mainNumberSuffix2 && jsx("span", {
1881
+ className: styles2.mainNumberSuffix,
1882
+ children: mainNumberSuffix2
1845
1883
  })]
1884
+ }), jsx("div", {
1885
+ class: styles2.secondaryNumber,
1886
+ children: secondaryNumber2
1846
1887
  })]
1847
1888
  })]
1848
- }) : jsx(Fragment, {
1849
- children: jsxs("div", {
1850
- class: styles2.toplineResult,
1851
- onMouseOver,
1889
+ }) : jsxs("div", {
1890
+ class: styles2.toplineResult,
1891
+ onMouseOver,
1892
+ children: [jsxs("div", {
1893
+ class: styles2.topRow,
1894
+ children: [jsx("span", {
1895
+ class: `${styles2.primaryname} before-color--${abbreviation}`,
1896
+ children: name2
1897
+ }), " ", showInfoButton && jsx("span", {
1898
+ class: styles2.infoButton,
1899
+ children: jsx(InfoButton, {
1900
+ onClick: onInfoPress
1901
+ })
1902
+ })]
1903
+ }), jsxs("div", {
1904
+ class: styles2.subhead,
1905
+ children: [jsx("span", {
1906
+ class: styles2.secondaryname,
1907
+ children: secondaryName
1908
+ }), " "]
1909
+ }), jsxs("div", {
1910
+ class: `${styles2.displayNumbers} ${displayStyle}`,
1852
1911
  children: [jsxs("div", {
1853
- class: styles2.topRow,
1854
- children: [jsx("span", {
1855
- class: `${styles2.primaryname} before-color--${abbreviation}`,
1856
- children: name2
1857
- }), " ", showInfoButton && jsx("span", {
1858
- class: styles2.infoButton,
1859
- children: jsx(InfoButton, {
1860
- onClick: onInfoPress
1861
- })
1862
- })]
1863
- }), jsxs("div", {
1864
- class: styles2.subhead,
1865
- children: [jsx("span", {
1866
- class: styles2.secondaryname,
1867
- children: secondaryName
1868
- }), " "]
1869
- }), jsxs("div", {
1870
- class: `${styles2.displayNumbers} ${displayStyle}`,
1871
- children: [jsx("div", {
1872
- class: styles2.mainNumber,
1873
- children: mainNumber2
1874
- }), jsx("div", {
1875
- class: styles2.secondaryNumber,
1876
- children: secondaryNumber2
1912
+ class: styles2.mainNumber,
1913
+ children: [mainNumber2, mainNumberSuffix2 && jsx("span", {
1914
+ className: styles2.mainNumberSuffix,
1915
+ children: mainNumberSuffix2
1877
1916
  })]
1917
+ }), jsx("div", {
1918
+ class: styles2.secondaryNumber,
1919
+ children: secondaryNumber2
1878
1920
  })]
1879
- })
1921
+ })]
1880
1922
  });
1881
1923
  };
1882
1924
  const section = "_section_12aiu_9";
@@ -2750,14 +2792,14 @@ function SearchIcon() {
2750
2792
  })
2751
2793
  });
2752
2794
  }
2753
- const searchContainer = "_searchContainer_g5w44_1";
2754
- const input = "_input_g5w44_5";
2755
- const searchIcon = "_searchIcon_g5w44_21";
2756
- const clearButton = "_clearButton_g5w44_30";
2757
- const suggestions = "_suggestions_g5w44_36";
2758
- const suggestion = "_suggestion_g5w44_36";
2759
- const selected = "_selected_g5w44_59";
2760
- const highlighted = "_highlighted_g5w44_63";
2795
+ const searchContainer = "_searchContainer_1883t_1";
2796
+ const input = "_input_1883t_5";
2797
+ const searchIcon = "_searchIcon_1883t_23";
2798
+ const clearButton = "_clearButton_1883t_32";
2799
+ const suggestions = "_suggestions_1883t_38";
2800
+ const suggestion = "_suggestion_1883t_38";
2801
+ const selected = "_selected_1883t_61";
2802
+ const highlighted = "_highlighted_1883t_65";
2761
2803
  const defaultStyles$3 = {
2762
2804
  searchContainer,
2763
2805
  input,
@@ -3158,15 +3200,15 @@ function Gradient() {
3158
3200
  })]
3159
3201
  });
3160
3202
  }
3161
- const ticker = "_ticker_fyd8z_9";
3162
- const tickerItems = "_tickerItems_fyd8z_19";
3163
- const tickerScroll = "_tickerScroll_fyd8z_24";
3164
- const tickerItem = "_tickerItem_fyd8z_19";
3165
- const controls = "_controls_fyd8z_46";
3166
- const gradient = "_gradient_fyd8z_61";
3167
- const buttons = "_buttons_fyd8z_75";
3168
- const button = "_button_fyd8z_75";
3169
- const buttonInner = "_buttonInner_fyd8z_101";
3203
+ const ticker = "_ticker_1as05_9";
3204
+ const tickerItems = "_tickerItems_1as05_21";
3205
+ const tickerScroll = "_tickerScroll_1as05_26";
3206
+ const tickerItem = "_tickerItem_1as05_21";
3207
+ const controls = "_controls_1as05_48";
3208
+ const gradient = "_gradient_1as05_63";
3209
+ const buttons = "_buttons_1as05_75";
3210
+ const button = "_button_1as05_75";
3211
+ const buttonInner = "_buttonInner_1as05_100";
3170
3212
  const styles = {
3171
3213
  ticker,
3172
3214
  tickerItems,
@@ -3243,7 +3285,7 @@ function Ticker({
3243
3285
  },
3244
3286
  children: [jsx("div", {
3245
3287
  className: styles.gradient,
3246
- children: !expanded && jsx(Gradient, {})
3288
+ children: jsx(Gradient, {})
3247
3289
  }), jsxs("div", {
3248
3290
  className: styles.buttons,
3249
3291
  children: [jsx(ArrowButton, {
@@ -3257,18 +3299,19 @@ function Ticker({
3257
3299
  }), jsx("div", {
3258
3300
  className: styles.button,
3259
3301
  children: jsx(Button, {
3260
- type: "small",
3302
+ type: "regular",
3261
3303
  styles: {
3262
3304
  buttonInner: styles.buttonInner
3263
3305
  },
3264
3306
  onClick: toggleExpandedState,
3265
- children: expanded ? "Show less" : `Show ${maxItems} most recent`
3307
+ children: expanded ? "Show fewer" : `Show ${maxItems} most recent`
3266
3308
  })
3267
3309
  })]
3268
3310
  })]
3269
3311
  });
3270
3312
  }
3271
3313
  export {
3314
+ AdSlot,
3272
3315
  ArrowButton,
3273
3316
  Button,
3274
3317
  ChangeBar,
@@ -3282,6 +3325,7 @@ export {
3282
3325
  GradientIcon,
3283
3326
  GridType,
3284
3327
  InfoButton,
3328
+ LabelType,
3285
3329
  LegendItem,
3286
3330
  Map$1 as Map,
3287
3331
  MapConfiguration,