@guardian/interactive-component-library 0.1.0-alpha.21 → 0.1.0-alpha.23

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
2
  import { useRef, useMemo, useCallback, useEffect, useState, useLayoutEffect, useContext, useImperativeHandle } from "preact/hooks";
3
- import { render, createElement, cloneElement, createContext, toChildArray } from "preact";
4
- import { useSyncExternalStore, createPortal, forwardRef } from "preact/compat";
3
+ import { render, createContext, toChildArray, cloneElement, createElement } from "preact";
4
+ import { useSyncExternalStore, forwardRef, createPortal } 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 = "";
@@ -10,7 +10,7 @@ const group = "_group_b5io0_5";
10
10
  const rotated = "_rotated_b5io0_10";
11
11
  const path$4 = "_path_b5io0_14";
12
12
  const active = "_active_b5io0_18";
13
- const defaultStyles$t = {
13
+ const defaultStyles$v = {
14
14
  svg: svg$9,
15
15
  group,
16
16
  rotated,
@@ -50,13 +50,13 @@ function Chevron({
50
50
  styles: styles2
51
51
  }) {
52
52
  const defaultStylesCopy = {
53
- ...defaultStyles$t
53
+ ...defaultStyles$v
54
54
  };
55
55
  if (active2) {
56
- defaultStylesCopy.path = mergeStyles(defaultStyles$t.path, defaultStyles$t.active);
56
+ defaultStylesCopy.path = mergeStyles(defaultStyles$v.path, defaultStyles$v.active);
57
57
  }
58
58
  if (direction === DIRECTION.up) {
59
- defaultStylesCopy.group = mergeStyles(defaultStyles$t.group, defaultStyles$t.rotated);
59
+ defaultStylesCopy.group = mergeStyles(defaultStyles$v.group, defaultStyles$v.rotated);
60
60
  }
61
61
  styles2 = mergeStyles(defaultStylesCopy, styles2);
62
62
  return size === SIZE.small ? jsx(SmallChevron, {
@@ -106,12 +106,12 @@ function LargeChevron({
106
106
  })
107
107
  });
108
108
  }
109
- const container$5 = "_container_jzalm_1";
109
+ const container$7 = "_container_jzalm_1";
110
110
  const dot = "_dot_jzalm_6";
111
111
  const circle$2 = "_circle_jzalm_13";
112
112
  const text$3 = "_text_jzalm_17";
113
- const defaultStyles$s = {
114
- container: container$5,
113
+ const defaultStyles$u = {
114
+ container: container$7,
115
115
  dot,
116
116
  circle: circle$2,
117
117
  text: text$3
@@ -127,10 +127,10 @@ const LegendItem = ({
127
127
  abbreviation
128
128
  }) => {
129
129
  const defaultStylesCopy = {
130
- ...defaultStyles$s
130
+ ...defaultStyles$u
131
131
  };
132
132
  if (dotType === DOT_TYPE.round) {
133
- defaultStylesCopy.dot = mergeStyles(defaultStyles$s.dot, defaultStyles$s.circle);
133
+ defaultStylesCopy.dot = mergeStyles(defaultStyles$u.dot, defaultStyles$u.circle);
134
134
  }
135
135
  styles2 = mergeStyles(defaultStylesCopy, styles2);
136
136
  return jsxs("div", {
@@ -146,7 +146,7 @@ const LegendItem = ({
146
146
  const bar$2 = "_bar_bf839_1";
147
147
  const label$1 = "_label_bf839_5";
148
148
  const backgroundRect = "_backgroundRect_bf839_11";
149
- const defaultStyles$r = {
149
+ const defaultStyles$t = {
150
150
  bar: bar$2,
151
151
  label: label$1,
152
152
  backgroundRect
@@ -202,7 +202,7 @@ function StackedBar({
202
202
  const rectElements = useRef([]);
203
203
  const textElements = useRef([]);
204
204
  styles2 = mergeStyles({
205
- ...defaultStyles$r
205
+ ...defaultStyles$t
206
206
  }, styles2);
207
207
  const svgHeight = labelType === LabelType.hanging && !hideLabels ? height + 20 : height;
208
208
  const renderLabel = (config, i) => jsx("text", {
@@ -342,7 +342,7 @@ const [useGradients, setGradients, getGradients] = createStore({});
342
342
  const svg$8 = "_svg_1cajk_6";
343
343
  const previous = "_previous_1cajk_12";
344
344
  const next = "_next_1cajk_16";
345
- const defaultStyles$q = {
345
+ const defaultStyles$s = {
346
346
  svg: svg$8,
347
347
  previous,
348
348
  next
@@ -353,7 +353,7 @@ const GradientIcon = (props) => {
353
353
  next: next2,
354
354
  styles: styles2
355
355
  } = props;
356
- styles2 = mergeStyles(defaultStyles$q, styles2);
356
+ styles2 = mergeStyles(defaultStyles$s, styles2);
357
357
  const gradientId = `gv-gradient-def-${previous2}-${next2}`;
358
358
  const gradients = useGradients();
359
359
  useEffect(() => {
@@ -420,20 +420,135 @@ function GradientDefs({
420
420
  })
421
421
  });
422
422
  }
423
+ const unit = "_unit_mo5d9_1";
424
+ const container$6 = "_container_mo5d9_6";
425
+ const defaultStyles$r = {
426
+ unit,
427
+ container: container$6
428
+ };
429
+ function useWindowSize() {
430
+ const [windowSize, setWindowSize] = useState(() => {
431
+ if (typeof window === "undefined")
432
+ return {
433
+ width: 0,
434
+ height: 0
435
+ };
436
+ return {
437
+ width: window.innerWidth,
438
+ height: window.innerHeight
439
+ };
440
+ });
441
+ useEffect(() => {
442
+ if (typeof window === "undefined")
443
+ return;
444
+ function handleResize() {
445
+ setWindowSize({
446
+ width: window.innerWidth,
447
+ height: window.innerHeight
448
+ });
449
+ }
450
+ window.addEventListener("resize", handleResize);
451
+ return () => {
452
+ window.removeEventListener("resize", handleResize);
453
+ };
454
+ }, []);
455
+ return windowSize;
456
+ }
457
+ function useContainerSize(containerRef) {
458
+ const windowSize = useWindowSize();
459
+ const [containerSize, setContainerSize] = useState();
460
+ useLayoutEffect(() => {
461
+ const container2 = containerRef.current;
462
+ if (!container2)
463
+ return;
464
+ setContainerSize({
465
+ width: container2.clientWidth,
466
+ height: container2.clientHeight
467
+ });
468
+ }, [containerRef, windowSize]);
469
+ return containerSize;
470
+ }
471
+ const WaffleType = {
472
+ circle: "circle",
473
+ square: "square"
474
+ };
475
+ const WaffleUnit = ({
476
+ type,
477
+ attributes
478
+ }) => type === WaffleType.square ? jsx("rect", {
479
+ ...attributes
480
+ }) : jsx("circle", {
481
+ ...attributes
482
+ });
483
+ const Waffle = ({
484
+ units,
485
+ numberOfRows,
486
+ type = WaffleType.circle,
487
+ idAccessor,
488
+ onMouseOver,
489
+ styles: styles2
490
+ }) => {
491
+ const containerRef = useRef();
492
+ const containerSize = useContainerSize(containerRef);
493
+ const width = containerSize ? containerSize.width : 0;
494
+ const total = units.length;
495
+ const columns = Math.ceil(total / numberOfRows);
496
+ const unitWidth = width / columns;
497
+ const unitHeight = unitWidth;
498
+ const height = numberOfRows * unitHeight;
499
+ styles2 = mergeStyles(defaultStyles$r, styles2);
500
+ return jsx("div", {
501
+ ref: containerRef,
502
+ className: styles2.container,
503
+ children: containerSize && jsx("svg", {
504
+ viewBox: `0 0 ${width} ${height}`,
505
+ class: styles2.svg,
506
+ children: jsx("g", {
507
+ children: units.map((unit2, j) => {
508
+ let attributes;
509
+ if (type === WaffleType.square) {
510
+ attributes = {
511
+ id: unit2[idAccessor] || `w-${j}`,
512
+ onMouseOver: (e) => onMouseOver(unit2, e),
513
+ class: `${styles2.unit} ${unit2.class}`,
514
+ height: unitHeight,
515
+ width: unitWidth,
516
+ x: unitWidth * Math.floor(j / numberOfRows),
517
+ y: unitHeight * (j % numberOfRows)
518
+ };
519
+ } else {
520
+ attributes = {
521
+ id: unit2[idAccessor] || `w-${j}`,
522
+ onMouseOver: (e) => onMouseOver(unit2, e),
523
+ class: `${styles2.unit} ${unit2.class}`,
524
+ r: unitWidth / 2,
525
+ transform: `translate(${unitWidth * Math.floor(j / numberOfRows) + unitWidth / 2}, ${unitHeight * (j % numberOfRows) + unitHeight / 2})`
526
+ };
527
+ }
528
+ return jsx(WaffleUnit, {
529
+ type,
530
+ attributes
531
+ }, `wu-${j}`);
532
+ })
533
+ })
534
+ })
535
+ });
536
+ };
423
537
  const button$5 = "_button_oqopj_1";
424
538
  const svg$7 = "_svg_oqopj_15";
425
- const defaultStyles$p = {
539
+ const defaultStyles$q = {
426
540
  button: button$5,
427
541
  svg: svg$7
428
542
  };
429
- const InfoButton = ({
543
+ const InfoButton = forwardRef(({
430
544
  onClick,
431
545
  styles: styles2
432
- }) => {
546
+ }, ref) => {
433
547
  styles2 = mergeStyles({
434
- ...defaultStyles$p
548
+ ...defaultStyles$q
435
549
  }, styles2);
436
550
  return jsx("button", {
551
+ ref,
437
552
  class: styles2.button,
438
553
  onClick,
439
554
  children: jsx("svg", {
@@ -445,11 +560,11 @@ const InfoButton = ({
445
560
  })
446
561
  })
447
562
  });
448
- };
563
+ });
449
564
  const svg$6 = "_svg_1v49v_1";
450
565
  const circle$1 = "_circle_1v49v_5";
451
566
  const pulse = "_pulse_1v49v_9";
452
- const defaultStyles$o = {
567
+ const defaultStyles$p = {
453
568
  svg: svg$6,
454
569
  circle: circle$1,
455
570
  pulse
@@ -459,7 +574,7 @@ const CircleIcon = ({
459
574
  pulse: pulse2 = false,
460
575
  styles: styles2
461
576
  }) => {
462
- styles2 = mergeStyles(defaultStyles$o, styles2);
577
+ styles2 = mergeStyles(defaultStyles$p, styles2);
463
578
  return jsx("svg", {
464
579
  style: styles2.svg,
465
580
  fill: "none",
@@ -479,7 +594,7 @@ const CircleIcon = ({
479
594
  });
480
595
  };
481
596
  const text$2 = "_text_1okyv_1";
482
- const defaultStyles$n = {
597
+ const defaultStyles$o = {
483
598
  text: text$2
484
599
  };
485
600
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
@@ -829,7 +944,7 @@ const RelativeTimeSentence = ({
829
944
  styles: styles2
830
945
  }) => {
831
946
  styles2 = mergeStyles({
832
- ...defaultStyles$n
947
+ ...defaultStyles$o
833
948
  }, styles2);
834
949
  let timeSince = dayjs(timeStamp).fromNow();
835
950
  return jsx("span", {
@@ -839,7 +954,7 @@ const RelativeTimeSentence = ({
839
954
  };
840
955
  const pageContainer = "_pageContainer_1s0yq_9";
841
956
  const sideBorders = "_sideBorders_1s0yq_42";
842
- const defaultStyles$m = {
957
+ const defaultStyles$n = {
843
958
  pageContainer,
844
959
  sideBorders
845
960
  };
@@ -851,17 +966,17 @@ function Container({
851
966
  const {
852
967
  pageContainer: pageContainer2,
853
968
  sideBorders: sideBordersStyle
854
- } = mergeStyles(defaultStyles$m, styles2);
969
+ } = mergeStyles(defaultStyles$n, styles2);
855
970
  return jsx("div", {
856
971
  className: [pageContainer2, sideBorders2 && sideBordersStyle].join(" "),
857
972
  children
858
973
  });
859
974
  }
860
- const wrapper = "_wrapper_5oj1x_9";
975
+ const wrapper$1 = "_wrapper_5oj1x_9";
861
976
  const bar$1 = "_bar_5oj1x_14";
862
977
  const zero = "_zero_5oj1x_19";
863
- const defaultStyles$l = {
864
- wrapper,
978
+ const defaultStyles$m = {
979
+ wrapper: wrapper$1,
865
980
  bar: bar$1,
866
981
  zero
867
982
  };
@@ -881,7 +996,7 @@ function ChangeBar({
881
996
  let thisColor = ` bg-color--${party}`;
882
997
  let zeroStyles = ` height: ${height};`;
883
998
  styles2 = mergeStyles({
884
- ...defaultStyles$l
999
+ ...defaultStyles$m
885
1000
  }, styles2);
886
1001
  return jsxs("div", {
887
1002
  className: styles2.wrapper,
@@ -899,7 +1014,7 @@ const svg$5 = "_svg_886i1_9";
899
1014
  const dividingLineColor = "_dividingLineColor_886i1_16";
900
1015
  const square = "_square_886i1_20";
901
1016
  const corner = "_corner_886i1_24";
902
- const defaultStyles$k = {
1017
+ const defaultStyles$l = {
903
1018
  svg: svg$5,
904
1019
  dividingLineColor,
905
1020
  square,
@@ -912,7 +1027,7 @@ const SquareCutCornerIcon = ({
912
1027
  styles: styles2
913
1028
  }) => {
914
1029
  styles2 = mergeStyles({
915
- ...defaultStyles$k
1030
+ ...defaultStyles$l
916
1031
  }, styles2);
917
1032
  let cornerSize = squareSize * 0.625;
918
1033
  let cornerMargin = squareSize < 100 ? squareSize / 6 : 10;
@@ -950,7 +1065,7 @@ const stackedGridRotateItems0 = "_stackedGridRotateItems0_6whof_11";
950
1065
  const stackedGridRotateItems90 = "_stackedGridRotateItems90_6whof_17";
951
1066
  const stackedGridRotateItems180 = "_stackedGridRotateItems180_6whof_23";
952
1067
  const stackedGridRotateItems270 = "_stackedGridRotateItems270_6whof_29";
953
- const defaultStyles$j = {
1068
+ const defaultStyles$k = {
954
1069
  stackedGridContainer,
955
1070
  stackedGridRotateItems0,
956
1071
  stackedGridRotateItems90,
@@ -981,7 +1096,7 @@ const StackedGrid = ({
981
1096
  }) => {
982
1097
  let containerFlip = getContainerFlip(fromBottom, fromLeft);
983
1098
  let itemRotateClass = getItemRotate(fromBottom, fromLeft);
984
- styles2 = mergeStyles(defaultStyles$j, styles2);
1099
+ styles2 = mergeStyles(defaultStyles$k, styles2);
985
1100
  return jsx("div", {
986
1101
  style: {
987
1102
  transform: containerFlip
@@ -992,7 +1107,7 @@ const StackedGrid = ({
992
1107
  };
993
1108
  const svg$4 = "_svg_l2fsl_9";
994
1109
  const squareFill = "_squareFill_l2fsl_16";
995
- const defaultStyles$i = {
1110
+ const defaultStyles$j = {
996
1111
  svg: svg$4,
997
1112
  squareFill
998
1113
  };
@@ -1002,7 +1117,7 @@ const SquareIcon = ({
1002
1117
  styles: styles2
1003
1118
  }) => {
1004
1119
  styles2 = mergeStyles({
1005
- ...defaultStyles$i
1120
+ ...defaultStyles$j
1006
1121
  }, styles2);
1007
1122
  return jsx("svg", {
1008
1123
  width: size,
@@ -1020,7 +1135,7 @@ const SquareIcon = ({
1020
1135
  };
1021
1136
  const button$4 = "_button_1fees_1";
1022
1137
  const icon$2 = "_icon_1fees_6";
1023
- const defaultStyles$h = {
1138
+ const defaultStyles$i = {
1024
1139
  button: button$4,
1025
1140
  icon: icon$2
1026
1141
  };
@@ -1030,7 +1145,7 @@ function ArrowButton({
1030
1145
  styles: styles2,
1031
1146
  onClick
1032
1147
  }) {
1033
- styles2 = mergeStyles(defaultStyles$h, styles2);
1148
+ styles2 = mergeStyles(defaultStyles$i, styles2);
1034
1149
  return jsx("button", {
1035
1150
  className: styles2.button,
1036
1151
  disabled,
@@ -1056,7 +1171,7 @@ function ArrowButton({
1056
1171
  }
1057
1172
  const button$3 = "_button_3521c_1";
1058
1173
  const buttonInner$1 = "_buttonInner_3521c_6";
1059
- const defaultStyles$g = {
1174
+ const defaultStyles$h = {
1060
1175
  button: button$3,
1061
1176
  buttonInner: buttonInner$1
1062
1177
  };
@@ -1066,7 +1181,7 @@ function Button({
1066
1181
  styles: styles2,
1067
1182
  children
1068
1183
  }) {
1069
- styles2 = mergeStyles(defaultStyles$g, styles2);
1184
+ styles2 = mergeStyles(defaultStyles$h, styles2);
1070
1185
  return jsx("button", {
1071
1186
  className: styles2.button,
1072
1187
  "data-type": type,
@@ -1081,7 +1196,7 @@ const button$2 = "_button_125im_1";
1081
1196
  const buttonBorder = "_buttonBorder_125im_11";
1082
1197
  const svg$3 = "_svg_125im_19";
1083
1198
  const path$3 = "_path_125im_25";
1084
- const defaultStyles$f = {
1199
+ const defaultStyles$g = {
1085
1200
  button: button$2,
1086
1201
  buttonBorder,
1087
1202
  svg: svg$3,
@@ -1092,7 +1207,7 @@ function CloseButton({
1092
1207
  onClick,
1093
1208
  styles: styles2
1094
1209
  }) {
1095
- styles2 = mergeStyles(defaultStyles$f, styles2);
1210
+ styles2 = mergeStyles(defaultStyles$g, styles2);
1096
1211
  return jsx("button", {
1097
1212
  className: [styles2.button, border && styles2.buttonBorder].join(" "),
1098
1213
  onClick,
@@ -1110,10 +1225,10 @@ function CloseButton({
1110
1225
  })
1111
1226
  });
1112
1227
  }
1113
- const container$4 = "_container_tq3ke_1";
1228
+ const container$5 = "_container_tq3ke_1";
1114
1229
  const slot = "_slot_tq3ke_5";
1115
- const defaultStyles$e = {
1116
- container: container$4,
1230
+ const defaultStyles$f = {
1231
+ container: container$5,
1117
1232
  slot
1118
1233
  };
1119
1234
  function AdSlot({
@@ -1123,7 +1238,7 @@ function AdSlot({
1123
1238
  }) {
1124
1239
  var _a, _b, _c;
1125
1240
  const slotId = `dfp-ad--${name2}`;
1126
- styles2 = mergeStyles(defaultStyles$e, styles2);
1241
+ styles2 = mergeStyles(defaultStyles$f, styles2);
1127
1242
  const mobileSizes = (_a = sizeMapping.mobile) == null ? void 0 : _a.map((size) => size.join(",")).join("|");
1128
1243
  const tabletSizes = (_b = sizeMapping.tablet) == null ? void 0 : _b.map((size) => size.join(",")).join("|");
1129
1244
  const desktopSizes = (_c = sizeMapping.desktop) == null ? void 0 : _c.map((size) => size.join(",")).join("|");
@@ -1268,7 +1383,7 @@ const headerCell = "_headerCell_1dg64_32";
1268
1383
  const headerCellButton = "_headerCellButton_1dg64_40";
1269
1384
  const bodyRow = "_bodyRow_1dg64_49";
1270
1385
  const bodyCell = "_bodyCell_1dg64_54";
1271
- const defaultStyles$d = {
1386
+ const defaultStyles$e = {
1272
1387
  table,
1273
1388
  hideHeader,
1274
1389
  hideHeaderNoBorder,
@@ -1309,7 +1424,7 @@ function Table({
1309
1424
  };
1310
1425
  });
1311
1426
  };
1312
- styles2 = mergeStyles(defaultStyles$d, styles2);
1427
+ styles2 = mergeStyles(defaultStyles$e, styles2);
1313
1428
  return jsxs("table", {
1314
1429
  className: styles2.table,
1315
1430
  cellSpacing: 0,
@@ -1371,47 +1486,19 @@ function HeaderCell({
1371
1486
  })]
1372
1487
  });
1373
1488
  }
1374
- function useWindowSize() {
1375
- const [windowSize, setWindowSize] = useState(() => {
1376
- if (typeof window === "undefined")
1377
- return {
1378
- width: 0,
1379
- height: 0
1380
- };
1381
- return {
1382
- width: window.innerWidth,
1383
- height: window.innerHeight
1384
- };
1385
- });
1386
- useEffect(() => {
1387
- if (typeof window === "undefined")
1388
- return;
1389
- function handleResize() {
1390
- setWindowSize({
1391
- width: window.innerWidth,
1392
- height: window.innerHeight
1393
- });
1394
- }
1395
- window.addEventListener("resize", handleResize);
1396
- return () => {
1397
- window.removeEventListener("resize", handleResize);
1398
- };
1399
- }, []);
1400
- return windowSize;
1401
- }
1402
1489
  const slopeChartContainer = "_slopeChartContainer_gj7pr_1";
1403
1490
  const svg$2 = "_svg_gj7pr_5";
1404
- const line = "_line_gj7pr_9";
1491
+ const line$1 = "_line_gj7pr_9";
1405
1492
  const circle = "_circle_gj7pr_14";
1406
1493
  const label = "_label_gj7pr_18";
1407
1494
  const y1Label = "_y1Label_gj7pr_24";
1408
1495
  const y2Label = "_y2Label_gj7pr_28";
1409
1496
  const axis$1 = "_axis_gj7pr_32";
1410
1497
  const axisLabel = "_axisLabel_gj7pr_37";
1411
- const defaultStyles$c = {
1498
+ const defaultStyles$d = {
1412
1499
  slopeChartContainer,
1413
1500
  svg: svg$2,
1414
- line,
1501
+ line: line$1,
1415
1502
  circle,
1416
1503
  label,
1417
1504
  y1Label,
@@ -1460,7 +1547,7 @@ const SlopeChart = ({
1460
1547
  return positionLabels(labels);
1461
1548
  }, [lines, y2Label2, yScale]);
1462
1549
  styles2 = mergeStyles({
1463
- ...defaultStyles$c
1550
+ ...defaultStyles$d
1464
1551
  }, styles2);
1465
1552
  const chart = jsx("svg", {
1466
1553
  class: styles2.svg,
@@ -1540,161 +1627,27 @@ const SlopeChart = ({
1540
1627
  children: show && chart
1541
1628
  });
1542
1629
  };
1543
- const useTooltipTarget = (targetElement, trackPosition) => {
1544
- const [targetRect, setTargetRect] = useState();
1545
- const [position, setPosition] = useState(null);
1546
- const [hoverActive, setHoverActive] = useState(false);
1547
- const onMouseMove = ({
1548
- clientX,
1549
- clientY,
1550
- currentTarget
1551
- }) => {
1552
- const rect = currentTarget.getBoundingClientRect();
1553
- const x = clientX - rect.left;
1554
- const y = clientY - rect.top;
1555
- requestAnimationFrame(() => {
1556
- setTargetRect(rect);
1557
- setPosition({
1558
- x,
1559
- y
1560
- });
1561
- setHoverActive(true);
1562
- });
1563
- };
1564
- const onMouseOut = () => {
1565
- requestAnimationFrame(() => {
1566
- setHoverActive(false);
1567
- });
1568
- };
1569
- useEffect(() => {
1570
- setTargetRect(targetElement.getBoundingClientRect());
1571
- if (trackPosition) {
1572
- targetElement.addEventListener("mousemove", onMouseMove);
1573
- targetElement.addEventListener("mouseout", onMouseOut);
1574
- }
1575
- return () => {
1576
- if (trackPosition) {
1577
- targetElement.removeEventListener("mousemove", onMouseMove);
1578
- targetElement.removeEventListener("mouseout", onMouseOut);
1579
- }
1580
- };
1581
- }, [targetElement, trackPosition]);
1582
- return {
1583
- targetRect,
1584
- positionInTarget: position,
1585
- hoverActive
1586
- };
1587
- };
1588
- function n(n2) {
1589
- return (r) => {
1590
- n2.forEach((n3) => {
1591
- "function" == typeof n3 ? n3(r) : null != n3 && (n3.current = r);
1592
- });
1593
- };
1594
- }
1595
- var T, c;
1596
- !function(e) {
1597
- e.APPEAR = "appear", e.APPEAR_ACTIVE = "appearActive", e.APPEAR_DONE = "appearDone", e.ENTER = "enter", e.ENTER_ACTIVE = "enterActive", e.ENTER_DONE = "enterDone", e.EXIT = "exit", e.EXIT_ACTIVE = "exitActive", e.EXIT_DONE = "exitDone";
1598
- }(T || (T = {})), function(e) {
1599
- e.ENTER = "onEnter", e.ENTERING = "onEntering", e.ENTERED = "onEntered", e.EXIT = "onExit", e.EXITING = "onExiting", e.EXITED = "onExited";
1600
- }(c || (c = {}));
1601
- const s = { [T.APPEAR]: [c.ENTER, T.APPEAR_ACTIVE], [T.APPEAR_ACTIVE]: [c.ENTERING, T.APPEAR_DONE, true], [T.APPEAR_DONE]: [c.ENTERED], [T.ENTER]: [c.ENTER, T.ENTER_ACTIVE], [T.ENTER_ACTIVE]: [c.ENTERING, T.ENTER_DONE, true], [T.ENTER_DONE]: [c.ENTERED], [T.EXIT]: [c.EXIT, T.EXIT_ACTIVE], [T.EXIT_ACTIVE]: [c.EXITING, T.EXIT_DONE, true], [T.EXIT_DONE]: [c.EXITED] };
1602
- var u = (r) => {
1603
- const { children: c2, in: u2 = false, appear: A = false, enter: N2 = true, exit: l = true, duration: I = 500, alwaysMounted: p2 = false, addEndListener: R2 } = r, P2 = useRef(), _2 = useRef();
1604
- let d2 = false;
1605
- const [f, D] = useState(() => (d2 = true, u2 ? A ? T.APPEAR : T.APPEAR_DONE : T.EXIT_DONE));
1606
- useEffect(() => {
1607
- var e;
1608
- const { setTimeout: E, clearTimeout: t } = window, [n2, o, i] = s[f];
1609
- return null == (e = r[n2]) || e.call(r, P2.current), o && (i ? R2 ? R2(P2.current, () => D(o)) : _2.current = E(D, I, o) : D(o)), () => {
1610
- t(_2.current);
1611
- };
1612
- }, [f, I]), useLayoutEffect(() => {
1613
- d2 || D(u2 ? N2 ? T.ENTER : T.ENTER_DONE : l ? T.EXIT : T.EXIT_DONE);
1614
- }, [u2]);
1615
- const X = useMemo(() => {
1616
- const e = {};
1617
- return Object.values(T).forEach((r2) => {
1618
- e[r2] = f === r2;
1619
- }), e;
1620
- }, [f]);
1621
- if (!p2 && f === T.EXIT_DONE)
1622
- return null;
1623
- const O = c2(X, f);
1624
- return cloneElement(O, { ref: n([P2, O.ref]) });
1625
- };
1626
- function N(e, r) {
1627
- if (null == e)
1628
- return {};
1629
- var E, t, n2 = {}, o = Object.keys(e);
1630
- for (t = 0; t < o.length; t++)
1631
- r.indexOf(E = o[t]) >= 0 || (n2[E] = e[E]);
1632
- return n2;
1630
+ function rectsIntersect(rect1, rect2) {
1631
+ if (rect1.width === 0 || rect1.height === 0 || rect2.width === 0 || rect2.height === 0) {
1632
+ return false;
1633
+ }
1634
+ if (rect1.x + rect1.width <= rect2.x || rect2.x + rect2.width <= rect1.x || rect1.y + rect1.height <= rect2.y || rect2.y + rect2.height <= rect1.y) {
1635
+ return false;
1636
+ }
1637
+ return true;
1633
1638
  }
1634
- const p = ["children", "classNames"], R = { [T.APPEAR]: "-appear", [T.APPEAR_ACTIVE]: "-appear-active", [T.APPEAR_DONE]: "-appear-done", [T.ENTER]: "-enter", [T.ENTER_ACTIVE]: "-enter-active", [T.ENTER_DONE]: "-enter-done", [T.EXIT]: "-exit", [T.EXIT_ACTIVE]: "-exit-active", [T.EXIT_DONE]: "-exit-done" }, P = (...e) => e.filter((e2) => !!e2).join(" "), _ = (e, r) => "string" == typeof r ? `${r}${R[e]}` : r[e];
1635
- var d = (E) => {
1636
- const { children: t, classNames: n2 } = E, o = N(E, p);
1637
- return createElement(u, o, (r, E2) => {
1638
- const { className: o2 } = t.props, i = useMemo(() => P(o2, ((e, r2) => {
1639
- const E3 = _(e, r2);
1640
- switch (e) {
1641
- case T.APPEAR_ACTIVE:
1642
- return P(_(T.APPEAR, r2), E3);
1643
- case T.ENTER_ACTIVE:
1644
- return P(_(T.ENTER, r2), E3);
1645
- case T.EXIT_ACTIVE:
1646
- return P(_(T.EXIT, r2), E3);
1647
- default:
1648
- return E3;
1649
- }
1650
- })(E2, n2)), [o2, n2, E2]);
1651
- return cloneElement(t, { className: i });
1652
- });
1653
- };
1654
- const transitionContainer$1 = "_transitionContainer_1gzlr_1";
1655
- const modalBox$1 = "_modalBox_1gzlr_13";
1656
- const enter$1 = "_enter_1gzlr_21";
1657
- const exitDone$1 = "_exitDone_1gzlr_22";
1658
- const enterActive$1 = "_enterActive_1gzlr_31";
1659
- const exit$1 = "_exit_1gzlr_22";
1660
- const styles$6 = {
1661
- transitionContainer: transitionContainer$1,
1662
- modalBox: modalBox$1,
1663
- enter: enter$1,
1664
- exitDone: exitDone$1,
1665
- enterActive: enterActive$1,
1666
- exit: exit$1
1667
- };
1668
- function Modal$1({
1669
- visible = false,
1670
- children
1671
- }) {
1672
- return jsx(d, {
1673
- in: visible,
1674
- duration: 300,
1675
- classNames: styles$6,
1676
- alwaysMounted: true,
1677
- children: jsx("div", {
1678
- class: styles$6.transitionContainer,
1679
- children: jsx("div", {
1680
- class: styles$6.modalBox,
1681
- children
1682
- })
1683
- })
1684
- });
1639
+ function pointInsideRect(point, rect) {
1640
+ return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
1685
1641
  }
1686
1642
  const tooltip = "_tooltip_11t5d_1";
1687
- const defaultStyles$b = {
1643
+ const defaultStyles$c = {
1688
1644
  tooltip
1689
1645
  };
1690
- const TooltipType = {
1691
- float: "float",
1692
- modal: "modal"
1693
- };
1694
1646
  function Tooltip({
1695
1647
  for: targetElement,
1696
- renderIn: refOrSelector,
1697
- type = TooltipType.float,
1648
+ touchRect,
1649
+ positionInTarget,
1650
+ show = true,
1698
1651
  styles: styles2,
1699
1652
  children
1700
1653
  }) {
@@ -1705,29 +1658,19 @@ function Tooltip({
1705
1658
  y: 0
1706
1659
  });
1707
1660
  const [displayElement, setDisplayElement] = useState(null);
1708
- const trackPosition = typeof children === "function";
1709
- const {
1710
- targetRect,
1711
- positionInTarget,
1712
- hoverActive
1713
- } = useTooltipTarget(targetElement, trackPosition);
1714
- const tooltipRef = useRef(null);
1715
- styles2 = mergeStyles(defaultStyles$b, styles2);
1661
+ const tooltipRef = useRef();
1662
+ styles2 = mergeStyles(defaultStyles$c, styles2);
1716
1663
  useEffect(() => {
1717
- let element = null;
1718
- if (typeof refOrSelector === "string") {
1719
- element = document.querySelector(refOrSelector);
1720
- } else if ("current" in refOrSelector) {
1721
- element = refOrSelector.current;
1722
- } else {
1723
- throw new Error("renderIn prop needs to be a selector or ref (from useRef)");
1724
- }
1725
- setDisplayElement(element);
1726
- }, [refOrSelector]);
1664
+ setDisplayElement(document.querySelector("body"));
1665
+ return () => {
1666
+ setDisplayElement(null);
1667
+ };
1668
+ }, []);
1727
1669
  useLayoutEffect(() => {
1728
1670
  if (!tooltipRef.current)
1729
1671
  return;
1730
- if (trackPosition && positionInTarget) {
1672
+ const targetRect = targetElement.getBoundingClientRect();
1673
+ if (positionInTarget) {
1731
1674
  const newPosition = tooltipPositionForPoint({
1732
1675
  targetRect,
1733
1676
  positionInTarget,
@@ -1735,35 +1678,32 @@ function Tooltip({
1735
1678
  displayElement
1736
1679
  });
1737
1680
  setTooltipPosition(newPosition);
1738
- } else if (!trackPosition) {
1681
+ } else if (!positionInTarget) {
1739
1682
  const newPosition = tooltipPositionForRect({
1740
1683
  targetRect,
1684
+ touchRect,
1741
1685
  tooltip: tooltipRef.current,
1742
1686
  displayElement
1743
1687
  });
1744
1688
  setTooltipPosition(newPosition);
1745
1689
  }
1746
- }, [trackPosition, targetRect, positionInTarget, displayElement, tooltipRef]);
1690
+ }, [targetElement, positionInTarget, displayElement, tooltipRef, touchRect]);
1747
1691
  if (!displayElement)
1748
1692
  return;
1749
- const displayTooltip = hoverActive || !trackPosition;
1750
- const fixedStyle = type === TooltipType.modal ? {} : {
1751
- display: displayTooltip ? "block" : "none",
1693
+ const fixedStyle = {
1694
+ display: show ? "block" : "none",
1752
1695
  position: "fixed",
1753
1696
  left: tooltipPosition.x,
1754
1697
  top: tooltipPosition.y,
1755
1698
  zIndex: 100
1756
1699
  };
1757
- const tooltip2 = jsxs("div", {
1700
+ const tooltip2 = jsx("div", {
1758
1701
  ref: tooltipRef,
1759
1702
  className: styles2.tooltip,
1760
1703
  style: fixedStyle,
1761
- children: [positionInTarget && children(positionInTarget), !trackPosition && children]
1704
+ children
1762
1705
  });
1763
- return createPortal(type === TooltipType.modal ? jsx(Modal$1, {
1764
- visible: hoverActive,
1765
- children: tooltip2
1766
- }) : tooltip2, displayElement);
1706
+ return createPortal(tooltip2, displayElement);
1767
1707
  }
1768
1708
  function tooltipPositionForPoint({
1769
1709
  targetRect,
@@ -1784,10 +1724,19 @@ function tooltipPositionForPoint({
1784
1724
  if (newPosition.y + tooltipHeight > displayElementRect.bottom) {
1785
1725
  newPosition.y -= tooltipHeight;
1786
1726
  }
1727
+ if (newPosition.x <= displayElementRect.left) {
1728
+ newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
1729
+ }
1787
1730
  return newPosition;
1788
1731
  }
1789
1732
  function tooltipPositionForRect({
1790
1733
  targetRect,
1734
+ touchRect = {
1735
+ x: 0,
1736
+ y: 0,
1737
+ width: 0,
1738
+ height: 0
1739
+ },
1791
1740
  tooltip: tooltip2,
1792
1741
  displayElement
1793
1742
  }) {
@@ -1797,6 +1746,15 @@ function tooltipPositionForRect({
1797
1746
  };
1798
1747
  const tooltipWidth = tooltip2.offsetWidth;
1799
1748
  const tooltipHeight = tooltip2.offsetHeight;
1749
+ const tooltipRect = {
1750
+ ...newPosition,
1751
+ width: tooltipWidth,
1752
+ height: tooltipHeight
1753
+ };
1754
+ if (rectsIntersect(tooltipRect, touchRect)) {
1755
+ newPosition.x = touchRect.x + touchRect.width / 2;
1756
+ newPosition.y = touchRect.y - tooltipHeight;
1757
+ }
1800
1758
  const displayElementRect = displayElement.getBoundingClientRect();
1801
1759
  if (newPosition.x + tooltipWidth > displayElementRect.right) {
1802
1760
  newPosition.x = targetRect.left - tooltipWidth;
@@ -1804,13 +1762,16 @@ function tooltipPositionForRect({
1804
1762
  if (newPosition.y - tooltipHeight < displayElementRect.top) {
1805
1763
  newPosition.y = targetRect.bottom;
1806
1764
  }
1765
+ if (newPosition.x <= displayElementRect.left) {
1766
+ newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
1767
+ }
1807
1768
  return newPosition;
1808
1769
  }
1809
1770
  const text$1 = "_text_1b8t2_1";
1810
- const container$3 = "_container_1b8t2_10";
1811
- const defaultStyles$a = {
1771
+ const container$4 = "_container_1b8t2_10";
1772
+ const defaultStyles$b = {
1812
1773
  text: text$1,
1813
- container: container$3
1774
+ container: container$4
1814
1775
  };
1815
1776
  const ControlChange = ({
1816
1777
  previous: previous2,
@@ -1819,7 +1780,7 @@ const ControlChange = ({
1819
1780
  styles: styles2
1820
1781
  }) => {
1821
1782
  styles2 = mergeStyles({
1822
- ...defaultStyles$a
1783
+ ...defaultStyles$b
1823
1784
  }, styles2);
1824
1785
  let hasChanged = next2 !== previous2;
1825
1786
  return jsx("div", {
@@ -1843,6 +1804,34 @@ const ControlChange = ({
1843
1804
  })
1844
1805
  });
1845
1806
  };
1807
+ const wrapper = "_wrapper_8vo05_1";
1808
+ const line = "_line_8vo05_5";
1809
+ const halfLineText = "_halfLineText_8vo05_15";
1810
+ const defaultStyles$a = {
1811
+ wrapper,
1812
+ line,
1813
+ halfLineText
1814
+ };
1815
+ const FirstPastThePostWaffle = ({
1816
+ styles: styles2,
1817
+ children,
1818
+ lineOverHang
1819
+ }) => {
1820
+ styles2 = mergeStyles(defaultStyles$a, styles2);
1821
+ return jsxs("div", {
1822
+ class: styles2.wrapper,
1823
+ children: [jsx("p", {
1824
+ style: {
1825
+ height: lineOverHang + 20
1826
+ },
1827
+ class: styles2.halfLineText,
1828
+ children: children.halfLineText
1829
+ }), jsx("div", {
1830
+ class: styles2.line,
1831
+ children: " "
1832
+ }), children.waffle]
1833
+ });
1834
+ };
1846
1835
  const toplineResult = "_toplineResult_49z3u_9";
1847
1836
  const primaryname = "_primaryname_49z3u_14";
1848
1837
  const secondaryname = "_secondaryname_49z3u_29";
@@ -1867,7 +1856,7 @@ const defaultStyles$9 = {
1867
1856
  displayColumn,
1868
1857
  topRow
1869
1858
  };
1870
- const ToplineResult = ({
1859
+ const ToplineResult = forwardRef(({
1871
1860
  name: name2,
1872
1861
  secondaryName,
1873
1862
  mainNumber: mainNumber2,
@@ -1878,8 +1867,9 @@ const ToplineResult = ({
1878
1867
  abbreviation,
1879
1868
  onMouseOver,
1880
1869
  onInfoPress,
1881
- showInfoButton = false
1882
- }) => {
1870
+ showInfoButton = false,
1871
+ infoButtonRef
1872
+ }, ref) => {
1883
1873
  styles2 = mergeStyles({
1884
1874
  ...defaultStyles$9
1885
1875
  }, styles2);
@@ -1887,6 +1877,7 @@ const ToplineResult = ({
1887
1877
  return !secondaryName ? jsxs("div", {
1888
1878
  class: styles2.toplineResult,
1889
1879
  onMouseOver,
1880
+ ref,
1890
1881
  children: [jsxs("div", {
1891
1882
  class: styles2.topRow,
1892
1883
  children: [jsx("span", {
@@ -1895,7 +1886,8 @@ const ToplineResult = ({
1895
1886
  }), " ", showInfoButton && jsx("span", {
1896
1887
  class: styles2.infoButton,
1897
1888
  children: jsx(InfoButton, {
1898
- onClick: onInfoPress
1889
+ onClick: onInfoPress,
1890
+ ref: infoButtonRef
1899
1891
  })
1900
1892
  })]
1901
1893
  }), jsxs("div", {
@@ -1914,6 +1906,7 @@ const ToplineResult = ({
1914
1906
  }) : jsxs("div", {
1915
1907
  class: styles2.toplineResult,
1916
1908
  onMouseOver,
1909
+ ref,
1917
1910
  children: [jsxs("div", {
1918
1911
  class: styles2.topRow,
1919
1912
  children: [jsx("span", {
@@ -1945,7 +1938,7 @@ const ToplineResult = ({
1945
1938
  })]
1946
1939
  })]
1947
1940
  });
1948
- };
1941
+ });
1949
1942
  const section = "_section_12aiu_9";
1950
1943
  const borderTop = "_borderTop_12aiu_52";
1951
1944
  const header = "_header_12aiu_56";
@@ -1965,14 +1958,22 @@ const PageSection = forwardRef(({
1965
1958
  styles2 = mergeStyles({
1966
1959
  ...defaultStyles$8
1967
1960
  }, styles2);
1961
+ const [minHeight, setMinHeight] = useState("auto");
1962
+ const headerRef = useRef();
1963
+ useLayoutEffect(() => {
1964
+ const headerElement = headerRef.current;
1965
+ setMinHeight(headerElement.offsetHeight);
1966
+ }, [children]);
1968
1967
  return jsxs("section", {
1969
1968
  ref,
1970
1969
  className: [styles2.section, borderTop2 && styles2.borderTop].join(" "),
1971
1970
  style: {
1972
- "--background-color": backgroundColor
1971
+ "--background-color": backgroundColor,
1972
+ minHeight
1973
1973
  },
1974
1974
  children: [jsx("div", {
1975
1975
  className: styles2.header,
1976
+ ref: headerRef,
1976
1977
  children: children.header
1977
1978
  }), jsx("div", {
1978
1979
  className: styles2.content,
@@ -2034,7 +2035,7 @@ const ColumnChart = ({
2034
2035
  })]
2035
2036
  });
2036
2037
  };
2037
- const container$2 = "_container_1snyq_1";
2038
+ const container$3 = "_container_1snyq_1";
2038
2039
  const img = "_img_1snyq_7";
2039
2040
  const title$2 = "_title_1snyq_15";
2040
2041
  const subtitle = "_subtitle_1snyq_31";
@@ -2042,7 +2043,7 @@ const small = "_small_1snyq_41";
2042
2043
  const blurb = "_blurb_1snyq_51";
2043
2044
  const footnote = "_footnote_1snyq_59";
2044
2045
  const defaultStyles$6 = {
2045
- container: container$2,
2046
+ container: container$3,
2046
2047
  img,
2047
2048
  title: title$2,
2048
2049
  subtitle,
@@ -2482,24 +2483,10 @@ function SVGRenderer({
2482
2483
  })
2483
2484
  });
2484
2485
  }
2485
- function useContainerSize(containerRef) {
2486
- const windowSize = useWindowSize();
2487
- const [containerSize, setContainerSize] = useState();
2488
- useLayoutEffect(() => {
2489
- const container2 = containerRef.current;
2490
- if (!container2)
2491
- return;
2492
- setContainerSize({
2493
- width: container2.clientWidth,
2494
- height: container2.clientHeight
2495
- });
2496
- }, [containerRef, windowSize]);
2497
- return containerSize;
2498
- }
2499
- const container$1 = "_container_cyrny_1";
2486
+ const container$2 = "_container_cyrny_1";
2500
2487
  const svg$1 = "_svg_cyrny_6";
2501
2488
  const styles$5 = {
2502
- container: container$1,
2489
+ container: container$2,
2503
2490
  svg: svg$1
2504
2491
  };
2505
2492
  function dynamicPropValue(prop, d2, index2) {
@@ -2765,10 +2752,10 @@ const Map$1 = forwardRef(({
2765
2752
  })
2766
2753
  });
2767
2754
  });
2768
- const container = "_container_azu4a_1";
2755
+ const container$1 = "_container_azu4a_1";
2769
2756
  const paragraph = "_paragraph_azu4a_12";
2770
2757
  const defaultStyles$4 = {
2771
- container,
2758
+ container: container$1,
2772
2759
  paragraph
2773
2760
  };
2774
2761
  function ResultSummary({
@@ -3012,6 +2999,72 @@ function ResponsiveGrid({
3012
2999
  })
3013
3000
  });
3014
3001
  }
3002
+ function n(n2) {
3003
+ return (r) => {
3004
+ n2.forEach((n3) => {
3005
+ "function" == typeof n3 ? n3(r) : null != n3 && (n3.current = r);
3006
+ });
3007
+ };
3008
+ }
3009
+ var T, c;
3010
+ !function(e) {
3011
+ e.APPEAR = "appear", e.APPEAR_ACTIVE = "appearActive", e.APPEAR_DONE = "appearDone", e.ENTER = "enter", e.ENTER_ACTIVE = "enterActive", e.ENTER_DONE = "enterDone", e.EXIT = "exit", e.EXIT_ACTIVE = "exitActive", e.EXIT_DONE = "exitDone";
3012
+ }(T || (T = {})), function(e) {
3013
+ e.ENTER = "onEnter", e.ENTERING = "onEntering", e.ENTERED = "onEntered", e.EXIT = "onExit", e.EXITING = "onExiting", e.EXITED = "onExited";
3014
+ }(c || (c = {}));
3015
+ const s = { [T.APPEAR]: [c.ENTER, T.APPEAR_ACTIVE], [T.APPEAR_ACTIVE]: [c.ENTERING, T.APPEAR_DONE, true], [T.APPEAR_DONE]: [c.ENTERED], [T.ENTER]: [c.ENTER, T.ENTER_ACTIVE], [T.ENTER_ACTIVE]: [c.ENTERING, T.ENTER_DONE, true], [T.ENTER_DONE]: [c.ENTERED], [T.EXIT]: [c.EXIT, T.EXIT_ACTIVE], [T.EXIT_ACTIVE]: [c.EXITING, T.EXIT_DONE, true], [T.EXIT_DONE]: [c.EXITED] };
3016
+ var u = (r) => {
3017
+ const { children: c2, in: u2 = false, appear: A = false, enter: N2 = true, exit: l = true, duration: I = 500, alwaysMounted: p2 = false, addEndListener: R2 } = r, P2 = useRef(), _2 = useRef();
3018
+ let d2 = false;
3019
+ const [f, D] = useState(() => (d2 = true, u2 ? A ? T.APPEAR : T.APPEAR_DONE : T.EXIT_DONE));
3020
+ useEffect(() => {
3021
+ var e;
3022
+ const { setTimeout: E, clearTimeout: t } = window, [n2, o, i] = s[f];
3023
+ return null == (e = r[n2]) || e.call(r, P2.current), o && (i ? R2 ? R2(P2.current, () => D(o)) : _2.current = E(D, I, o) : D(o)), () => {
3024
+ t(_2.current);
3025
+ };
3026
+ }, [f, I]), useLayoutEffect(() => {
3027
+ d2 || D(u2 ? N2 ? T.ENTER : T.ENTER_DONE : l ? T.EXIT : T.EXIT_DONE);
3028
+ }, [u2]);
3029
+ const X = useMemo(() => {
3030
+ const e = {};
3031
+ return Object.values(T).forEach((r2) => {
3032
+ e[r2] = f === r2;
3033
+ }), e;
3034
+ }, [f]);
3035
+ if (!p2 && f === T.EXIT_DONE)
3036
+ return null;
3037
+ const O = c2(X, f);
3038
+ return cloneElement(O, { ref: n([P2, O.ref]) });
3039
+ };
3040
+ function N(e, r) {
3041
+ if (null == e)
3042
+ return {};
3043
+ var E, t, n2 = {}, o = Object.keys(e);
3044
+ for (t = 0; t < o.length; t++)
3045
+ r.indexOf(E = o[t]) >= 0 || (n2[E] = e[E]);
3046
+ return n2;
3047
+ }
3048
+ const p = ["children", "classNames"], R = { [T.APPEAR]: "-appear", [T.APPEAR_ACTIVE]: "-appear-active", [T.APPEAR_DONE]: "-appear-done", [T.ENTER]: "-enter", [T.ENTER_ACTIVE]: "-enter-active", [T.ENTER_DONE]: "-enter-done", [T.EXIT]: "-exit", [T.EXIT_ACTIVE]: "-exit-active", [T.EXIT_DONE]: "-exit-done" }, P = (...e) => e.filter((e2) => !!e2).join(" "), _ = (e, r) => "string" == typeof r ? `${r}${R[e]}` : r[e];
3049
+ var d = (E) => {
3050
+ const { children: t, classNames: n2 } = E, o = N(E, p);
3051
+ return createElement(u, o, (r, E2) => {
3052
+ const { className: o2 } = t.props, i = useMemo(() => P(o2, ((e, r2) => {
3053
+ const E3 = _(e, r2);
3054
+ switch (e) {
3055
+ case T.APPEAR_ACTIVE:
3056
+ return P(_(T.APPEAR, r2), E3);
3057
+ case T.ENTER_ACTIVE:
3058
+ return P(_(T.ENTER, r2), E3);
3059
+ case T.EXIT_ACTIVE:
3060
+ return P(_(T.EXIT, r2), E3);
3061
+ default:
3062
+ return E3;
3063
+ }
3064
+ })(E2, n2)), [o2, n2, E2]);
3065
+ return cloneElement(t, { className: i });
3066
+ });
3067
+ };
3015
3068
  const transitionContainer = "_transitionContainer_wws3j_1";
3016
3069
  const modalBox = "_modalBox_wws3j_13";
3017
3070
  const enter = "_enter_wws3j_21";
@@ -3056,18 +3109,20 @@ function Modal({
3056
3109
  })
3057
3110
  }), document.body);
3058
3111
  }
3059
- const button$1 = "_button_xeyqm_1";
3060
- const icon = "_icon_xeyqm_17";
3061
- const title$1 = "_title_xeyqm_22";
3062
- const popout = "_popout_xeyqm_29";
3063
- const hint = "_hint_xeyqm_44";
3064
- const option = "_option_xeyqm_51";
3065
- const optionIcon = "_optionIcon_xeyqm_71";
3066
- const optionTitle = "_optionTitle_xeyqm_76";
3067
- const optionDescription = "_optionDescription_xeyqm_84";
3068
- const checkmark = "_checkmark_xeyqm_91";
3069
- const checkmarkPath = "_checkmarkPath_xeyqm_97";
3112
+ const container = "_container_iozsb_1";
3113
+ const button$1 = "_button_iozsb_6";
3114
+ const icon = "_icon_iozsb_22";
3115
+ const title$1 = "_title_iozsb_27";
3116
+ const popout = "_popout_iozsb_34";
3117
+ const hint = "_hint_iozsb_51";
3118
+ const option = "_option_iozsb_58";
3119
+ const optionIcon = "_optionIcon_iozsb_79";
3120
+ const optionTitle = "_optionTitle_iozsb_84";
3121
+ const optionDescription = "_optionDescription_iozsb_92";
3122
+ const checkmark = "_checkmark_iozsb_99";
3123
+ const checkmarkPath = "_checkmarkPath_iozsb_105";
3070
3124
  const styles$2 = {
3125
+ container,
3071
3126
  button: button$1,
3072
3127
  icon,
3073
3128
  title: title$1,
@@ -3098,6 +3153,7 @@ function Dropdown({
3098
3153
  return selectedOption.icon;
3099
3154
  }, [options, selectedIndex]);
3100
3155
  return jsxs("div", {
3156
+ className: styles$2.container,
3101
3157
  children: [jsxs("button", {
3102
3158
  className: styles$2.button,
3103
3159
  onClick: () => setExpanded((current) => !current),
@@ -3440,6 +3496,122 @@ function Ticker({
3440
3496
  })]
3441
3497
  });
3442
3498
  }
3499
+ function useTouchOrHover() {
3500
+ const ref = useRef();
3501
+ const [position, setPosition] = useState();
3502
+ const [isActive, setIsActive] = useState(false);
3503
+ const [touchRect, setTouchRect] = useState();
3504
+ useEffect(() => {
3505
+ const element = ref.current;
3506
+ let touchCancelled = false;
3507
+ const touchStarted = (event) => {
3508
+ if (event.touches.length > 1)
3509
+ return;
3510
+ touchCancelled = false;
3511
+ const touch = event.touches[0];
3512
+ const {
3513
+ clientX,
3514
+ clientY
3515
+ } = touch;
3516
+ const rect = element.getBoundingClientRect();
3517
+ const point = {
3518
+ x: clientX - rect.left,
3519
+ y: clientY - rect.top
3520
+ };
3521
+ setPosition(point);
3522
+ const touchRect2 = {
3523
+ x: clientX - touch.radiusX,
3524
+ y: clientY - touch.radiusY,
3525
+ width: touch.radiusX * 2,
3526
+ height: touch.radiusY * 2
3527
+ };
3528
+ setTouchRect(touchRect2);
3529
+ setIsActive(true);
3530
+ event.stopPropagation();
3531
+ };
3532
+ const touchMoved = (event) => {
3533
+ if (touchCancelled || event.targetTouches.length !== 1)
3534
+ return;
3535
+ const touch = event.targetTouches[0];
3536
+ const {
3537
+ clientX,
3538
+ clientY
3539
+ } = touch;
3540
+ const rect = element.getBoundingClientRect();
3541
+ const point = {
3542
+ x: clientX - rect.left,
3543
+ y: clientY - rect.top
3544
+ };
3545
+ if (!event.cancelable || !pointInsideRect(point, rect)) {
3546
+ setIsActive(false);
3547
+ touchCancelled = true;
3548
+ } else {
3549
+ setPosition(point);
3550
+ setIsActive(true);
3551
+ }
3552
+ };
3553
+ const touchEnded = (event) => {
3554
+ if (event.cancelable) {
3555
+ event.preventDefault();
3556
+ }
3557
+ setIsActive(false);
3558
+ setPosition(null);
3559
+ };
3560
+ const mouseOver = (event) => {
3561
+ const {
3562
+ clientX,
3563
+ clientY
3564
+ } = event;
3565
+ const rect = element.getBoundingClientRect();
3566
+ const x = clientX - rect.left;
3567
+ const y = clientY - rect.top;
3568
+ setPosition({
3569
+ x,
3570
+ y
3571
+ });
3572
+ setIsActive(true);
3573
+ };
3574
+ const mouseMoved = (event) => {
3575
+ const {
3576
+ clientX,
3577
+ clientY
3578
+ } = event;
3579
+ const rect = element.getBoundingClientRect();
3580
+ const x = clientX - rect.left;
3581
+ const y = clientY - rect.top;
3582
+ setPosition({
3583
+ x,
3584
+ y
3585
+ });
3586
+ };
3587
+ const mouseOut = () => {
3588
+ setIsActive(false);
3589
+ setPosition(null);
3590
+ };
3591
+ element.addEventListener("touchstart", touchStarted);
3592
+ element.addEventListener("touchmove", touchMoved);
3593
+ element.addEventListener("touchend", touchEnded);
3594
+ element.addEventListener("touchcancel", touchEnded);
3595
+ element.addEventListener("mouseover", mouseOver);
3596
+ element.addEventListener("mousemove", mouseMoved);
3597
+ element.addEventListener("mouseout", mouseOut);
3598
+ return () => {
3599
+ element.removeEventListener("touchstart", touchStarted);
3600
+ element.removeEventListener("touchmove", touchMoved);
3601
+ element.removeEventListener("touchend", mouseOut);
3602
+ element.removeEventListener("touchcancel", mouseOut);
3603
+ element.removeEventListener("mouseover", touchStarted);
3604
+ element.removeEventListener("mousemove", mouseMoved);
3605
+ element.removeEventListener("mouseout", mouseOut);
3606
+ };
3607
+ }, []);
3608
+ return {
3609
+ touchOrHoverRef: ref,
3610
+ touchOrHoverIsActive: isActive,
3611
+ touchRect,
3612
+ positionInTarget: position
3613
+ };
3614
+ }
3443
3615
  export {
3444
3616
  AdSlot,
3445
3617
  ArrowButton,
@@ -3453,6 +3625,7 @@ export {
3453
3625
  Container,
3454
3626
  ControlChange,
3455
3627
  Dropdown,
3628
+ FirstPastThePostWaffle,
3456
3629
  GradientIcon,
3457
3630
  GridType,
3458
3631
  InfoButton,
@@ -3478,7 +3651,11 @@ export {
3478
3651
  Table,
3479
3652
  Ticker,
3480
3653
  Tooltip,
3481
- TooltipType,
3482
- ToplineResult
3654
+ ToplineResult,
3655
+ Waffle,
3656
+ WaffleType,
3657
+ useContainerSize,
3658
+ useTouchOrHover,
3659
+ useWindowSize
3483
3660
  };
3484
3661
  //# sourceMappingURL=interactive-component-library.js.map