@guardian/interactive-component-library 0.1.0-alpha.20 → 0.1.0-alpha.22
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,
|
|
4
|
-
import { useSyncExternalStore,
|
|
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 = "";
|
|
@@ -18,6 +18,8 @@ const defaultStyles$t = {
|
|
|
18
18
|
active
|
|
19
19
|
};
|
|
20
20
|
function mergeStyles(firstStyle, secondStyle) {
|
|
21
|
+
if (!firstStyle)
|
|
22
|
+
return secondStyle;
|
|
21
23
|
if (!secondStyle)
|
|
22
24
|
return firstStyle;
|
|
23
25
|
if (typeof firstStyle === "string") {
|
|
@@ -28,14 +30,7 @@ function mergeStyles(firstStyle, secondStyle) {
|
|
|
28
30
|
}
|
|
29
31
|
const allKeys = /* @__PURE__ */ new Set([...Object.keys(firstStyle), ...Object.keys(secondStyle)]);
|
|
30
32
|
const merged = Array.from(allKeys).reduce((result, key) => {
|
|
31
|
-
|
|
32
|
-
if (firstStyle && key in firstStyle) {
|
|
33
|
-
classNames.push(firstStyle[key]);
|
|
34
|
-
}
|
|
35
|
-
if (secondStyle && key in secondStyle) {
|
|
36
|
-
classNames.push(secondStyle[key]);
|
|
37
|
-
}
|
|
38
|
-
result[key] = classNames.join(" ");
|
|
33
|
+
result[key] = mergeStyles(firstStyle[key], secondStyle[key]);
|
|
39
34
|
return result;
|
|
40
35
|
}, {});
|
|
41
36
|
return merged;
|
|
@@ -44,9 +39,14 @@ const DIRECTION = {
|
|
|
44
39
|
up: "up",
|
|
45
40
|
down: "down"
|
|
46
41
|
};
|
|
42
|
+
const SIZE = {
|
|
43
|
+
small: "small",
|
|
44
|
+
large: "large"
|
|
45
|
+
};
|
|
47
46
|
function Chevron({
|
|
48
47
|
active: active2 = false,
|
|
49
48
|
direction = DIRECTION.down,
|
|
49
|
+
size = SIZE.small,
|
|
50
50
|
styles: styles2
|
|
51
51
|
}) {
|
|
52
52
|
const defaultStylesCopy = {
|
|
@@ -59,6 +59,15 @@ function Chevron({
|
|
|
59
59
|
defaultStylesCopy.group = mergeStyles(defaultStyles$t.group, defaultStyles$t.rotated);
|
|
60
60
|
}
|
|
61
61
|
styles2 = mergeStyles(defaultStylesCopy, styles2);
|
|
62
|
+
return size === SIZE.small ? jsx(SmallChevron, {
|
|
63
|
+
styles: styles2
|
|
64
|
+
}) : jsx(LargeChevron, {
|
|
65
|
+
styles: styles2
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function SmallChevron({
|
|
69
|
+
styles: styles2
|
|
70
|
+
}) {
|
|
62
71
|
return jsx("svg", {
|
|
63
72
|
width: "16",
|
|
64
73
|
height: "24",
|
|
@@ -78,15 +87,34 @@ function Chevron({
|
|
|
78
87
|
})
|
|
79
88
|
});
|
|
80
89
|
}
|
|
90
|
+
function LargeChevron({
|
|
91
|
+
styles: styles2
|
|
92
|
+
}) {
|
|
93
|
+
return jsx("svg", {
|
|
94
|
+
width: "15",
|
|
95
|
+
height: "19",
|
|
96
|
+
className: styles2.svg,
|
|
97
|
+
viewBox: "0 0 15 19",
|
|
98
|
+
fill: "none",
|
|
99
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100
|
+
children: jsx("g", {
|
|
101
|
+
className: styles2.group,
|
|
102
|
+
children: jsx("path", {
|
|
103
|
+
d: "M0.667809 7.5L6.81507 12.1053L8.18493 12.1053L14.3322 7.5L15 8.09868L7.84247 14.5L7.15753 14.5L-2.61693e-08 8.09868L0.667809 7.5Z",
|
|
104
|
+
className: styles2.path
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
}
|
|
81
109
|
const container$5 = "_container_jzalm_1";
|
|
82
110
|
const dot = "_dot_jzalm_6";
|
|
83
111
|
const circle$2 = "_circle_jzalm_13";
|
|
84
|
-
const text$
|
|
112
|
+
const text$3 = "_text_jzalm_17";
|
|
85
113
|
const defaultStyles$s = {
|
|
86
114
|
container: container$5,
|
|
87
115
|
dot,
|
|
88
116
|
circle: circle$2,
|
|
89
|
-
text: text$
|
|
117
|
+
text: text$3
|
|
90
118
|
};
|
|
91
119
|
const DOT_TYPE = {
|
|
92
120
|
round: "round",
|
|
@@ -187,7 +215,7 @@ function StackedBar({
|
|
|
187
215
|
x: config.x,
|
|
188
216
|
y: config.y,
|
|
189
217
|
textAnchor: config.textAnchor,
|
|
190
|
-
|
|
218
|
+
dominantBaseline: config.dominantBaseline,
|
|
191
219
|
children: config.value
|
|
192
220
|
}, `label-${i}`);
|
|
193
221
|
let totalWidth = 0;
|
|
@@ -198,7 +226,7 @@ function StackedBar({
|
|
|
198
226
|
x: itemWidth - 4,
|
|
199
227
|
y: height / 2,
|
|
200
228
|
textAnchor: "end",
|
|
201
|
-
|
|
229
|
+
dominantBaseline: "middle"
|
|
202
230
|
};
|
|
203
231
|
const value = jsxs("g", {
|
|
204
232
|
transform: `translate(${totalWidth}, 0)`,
|
|
@@ -225,7 +253,7 @@ function StackedBar({
|
|
|
225
253
|
y: height + 4,
|
|
226
254
|
value: d2.label,
|
|
227
255
|
textAnchor: "end",
|
|
228
|
-
|
|
256
|
+
dominantBaseline: "hanging"
|
|
229
257
|
};
|
|
230
258
|
totalW += itemWidth;
|
|
231
259
|
return labelConfig;
|
|
@@ -285,7 +313,7 @@ function createStore(initialStore) {
|
|
|
285
313
|
return () => {
|
|
286
314
|
listeners.delete(listener);
|
|
287
315
|
};
|
|
288
|
-
}, []);
|
|
316
|
+
}, [selectorFn]);
|
|
289
317
|
const syncedStore = useSyncExternalStore(subscribe, getStore, getServerStore);
|
|
290
318
|
return selectorFn(syncedStore);
|
|
291
319
|
}
|
|
@@ -392,20 +420,21 @@ function GradientDefs({
|
|
|
392
420
|
})
|
|
393
421
|
});
|
|
394
422
|
}
|
|
395
|
-
const button$
|
|
423
|
+
const button$5 = "_button_oqopj_1";
|
|
396
424
|
const svg$7 = "_svg_oqopj_15";
|
|
397
425
|
const defaultStyles$p = {
|
|
398
|
-
button: button$
|
|
426
|
+
button: button$5,
|
|
399
427
|
svg: svg$7
|
|
400
428
|
};
|
|
401
|
-
const InfoButton = ({
|
|
429
|
+
const InfoButton = forwardRef(({
|
|
402
430
|
onClick,
|
|
403
431
|
styles: styles2
|
|
404
|
-
}) => {
|
|
432
|
+
}, ref) => {
|
|
405
433
|
styles2 = mergeStyles({
|
|
406
434
|
...defaultStyles$p
|
|
407
435
|
}, styles2);
|
|
408
436
|
return jsx("button", {
|
|
437
|
+
ref,
|
|
409
438
|
class: styles2.button,
|
|
410
439
|
onClick,
|
|
411
440
|
children: jsx("svg", {
|
|
@@ -417,7 +446,7 @@ const InfoButton = ({
|
|
|
417
446
|
})
|
|
418
447
|
})
|
|
419
448
|
});
|
|
420
|
-
};
|
|
449
|
+
});
|
|
421
450
|
const svg$6 = "_svg_1v49v_1";
|
|
422
451
|
const circle$1 = "_circle_1v49v_5";
|
|
423
452
|
const pulse = "_pulse_1v49v_9";
|
|
@@ -450,9 +479,9 @@ const CircleIcon = ({
|
|
|
450
479
|
})
|
|
451
480
|
});
|
|
452
481
|
};
|
|
453
|
-
const text$
|
|
482
|
+
const text$2 = "_text_1okyv_1";
|
|
454
483
|
const defaultStyles$n = {
|
|
455
|
-
text: text$
|
|
484
|
+
text: text$2
|
|
456
485
|
};
|
|
457
486
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
458
487
|
function getDefaultExportFromCjs(x) {
|
|
@@ -990,11 +1019,11 @@ const SquareIcon = ({
|
|
|
990
1019
|
})
|
|
991
1020
|
});
|
|
992
1021
|
};
|
|
993
|
-
const button$
|
|
994
|
-
const icon = "_icon_1fees_6";
|
|
1022
|
+
const button$4 = "_button_1fees_1";
|
|
1023
|
+
const icon$2 = "_icon_1fees_6";
|
|
995
1024
|
const defaultStyles$h = {
|
|
996
|
-
button: button$
|
|
997
|
-
icon
|
|
1025
|
+
button: button$4,
|
|
1026
|
+
icon: icon$2
|
|
998
1027
|
};
|
|
999
1028
|
function ArrowButton({
|
|
1000
1029
|
direction = "right",
|
|
@@ -1026,10 +1055,10 @@ function ArrowButton({
|
|
|
1026
1055
|
})
|
|
1027
1056
|
});
|
|
1028
1057
|
}
|
|
1029
|
-
const button$
|
|
1058
|
+
const button$3 = "_button_3521c_1";
|
|
1030
1059
|
const buttonInner$1 = "_buttonInner_3521c_6";
|
|
1031
1060
|
const defaultStyles$g = {
|
|
1032
|
-
button: button$
|
|
1061
|
+
button: button$3,
|
|
1033
1062
|
buttonInner: buttonInner$1
|
|
1034
1063
|
};
|
|
1035
1064
|
function Button({
|
|
@@ -1049,12 +1078,12 @@ function Button({
|
|
|
1049
1078
|
})
|
|
1050
1079
|
});
|
|
1051
1080
|
}
|
|
1052
|
-
const button$
|
|
1081
|
+
const button$2 = "_button_125im_1";
|
|
1053
1082
|
const buttonBorder = "_buttonBorder_125im_11";
|
|
1054
1083
|
const svg$3 = "_svg_125im_19";
|
|
1055
1084
|
const path$3 = "_path_125im_25";
|
|
1056
1085
|
const defaultStyles$f = {
|
|
1057
|
-
button: button$
|
|
1086
|
+
button: button$2,
|
|
1058
1087
|
buttonBorder,
|
|
1059
1088
|
svg: svg$3,
|
|
1060
1089
|
path: path$3
|
|
@@ -1512,161 +1541,27 @@ const SlopeChart = ({
|
|
|
1512
1541
|
children: show && chart
|
|
1513
1542
|
});
|
|
1514
1543
|
};
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
}) => {
|
|
1524
|
-
const rect = currentTarget.getBoundingClientRect();
|
|
1525
|
-
const x = clientX - rect.left;
|
|
1526
|
-
const y = clientY - rect.top;
|
|
1527
|
-
requestAnimationFrame(() => {
|
|
1528
|
-
setTargetRect(rect);
|
|
1529
|
-
setPosition({
|
|
1530
|
-
x,
|
|
1531
|
-
y
|
|
1532
|
-
});
|
|
1533
|
-
setHoverActive(true);
|
|
1534
|
-
});
|
|
1535
|
-
};
|
|
1536
|
-
const onMouseOut = () => {
|
|
1537
|
-
requestAnimationFrame(() => {
|
|
1538
|
-
setHoverActive(false);
|
|
1539
|
-
});
|
|
1540
|
-
};
|
|
1541
|
-
useEffect(() => {
|
|
1542
|
-
setTargetRect(targetElement.getBoundingClientRect());
|
|
1543
|
-
if (trackPosition) {
|
|
1544
|
-
targetElement.addEventListener("mousemove", onMouseMove);
|
|
1545
|
-
targetElement.addEventListener("mouseout", onMouseOut);
|
|
1546
|
-
}
|
|
1547
|
-
return () => {
|
|
1548
|
-
if (trackPosition) {
|
|
1549
|
-
targetElement.removeEventListener("mousemove", onMouseMove);
|
|
1550
|
-
targetElement.removeEventListener("mouseout", onMouseOut);
|
|
1551
|
-
}
|
|
1552
|
-
};
|
|
1553
|
-
}, [targetElement, trackPosition]);
|
|
1554
|
-
return {
|
|
1555
|
-
targetRect,
|
|
1556
|
-
positionInTarget: position,
|
|
1557
|
-
hoverActive
|
|
1558
|
-
};
|
|
1559
|
-
};
|
|
1560
|
-
function n(n2) {
|
|
1561
|
-
return (r) => {
|
|
1562
|
-
n2.forEach((n3) => {
|
|
1563
|
-
"function" == typeof n3 ? n3(r) : null != n3 && (n3.current = r);
|
|
1564
|
-
});
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
var T, c;
|
|
1568
|
-
!function(e) {
|
|
1569
|
-
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";
|
|
1570
|
-
}(T || (T = {})), function(e) {
|
|
1571
|
-
e.ENTER = "onEnter", e.ENTERING = "onEntering", e.ENTERED = "onEntered", e.EXIT = "onExit", e.EXITING = "onExiting", e.EXITED = "onExited";
|
|
1572
|
-
}(c || (c = {}));
|
|
1573
|
-
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] };
|
|
1574
|
-
var u = (r) => {
|
|
1575
|
-
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();
|
|
1576
|
-
let d2 = false;
|
|
1577
|
-
const [f, D] = useState(() => (d2 = true, u2 ? A ? T.APPEAR : T.APPEAR_DONE : T.EXIT_DONE));
|
|
1578
|
-
useEffect(() => {
|
|
1579
|
-
var e;
|
|
1580
|
-
const { setTimeout: E, clearTimeout: t } = window, [n2, o, i] = s[f];
|
|
1581
|
-
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)), () => {
|
|
1582
|
-
t(_2.current);
|
|
1583
|
-
};
|
|
1584
|
-
}, [f, I]), useLayoutEffect(() => {
|
|
1585
|
-
d2 || D(u2 ? N2 ? T.ENTER : T.ENTER_DONE : l ? T.EXIT : T.EXIT_DONE);
|
|
1586
|
-
}, [u2]);
|
|
1587
|
-
const X = useMemo(() => {
|
|
1588
|
-
const e = {};
|
|
1589
|
-
return Object.values(T).forEach((r2) => {
|
|
1590
|
-
e[r2] = f === r2;
|
|
1591
|
-
}), e;
|
|
1592
|
-
}, [f]);
|
|
1593
|
-
if (!p2 && f === T.EXIT_DONE)
|
|
1594
|
-
return null;
|
|
1595
|
-
const O = c2(X, f);
|
|
1596
|
-
return cloneElement(O, { ref: n([P2, O.ref]) });
|
|
1597
|
-
};
|
|
1598
|
-
function N(e, r) {
|
|
1599
|
-
if (null == e)
|
|
1600
|
-
return {};
|
|
1601
|
-
var E, t, n2 = {}, o = Object.keys(e);
|
|
1602
|
-
for (t = 0; t < o.length; t++)
|
|
1603
|
-
r.indexOf(E = o[t]) >= 0 || (n2[E] = e[E]);
|
|
1604
|
-
return n2;
|
|
1544
|
+
function rectsIntersect(rect1, rect2) {
|
|
1545
|
+
if (rect1.width === 0 || rect1.height === 0 || rect2.width === 0 || rect2.height === 0) {
|
|
1546
|
+
return false;
|
|
1547
|
+
}
|
|
1548
|
+
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) {
|
|
1549
|
+
return false;
|
|
1550
|
+
}
|
|
1551
|
+
return true;
|
|
1605
1552
|
}
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
const { children: t, classNames: n2 } = E, o = N(E, p);
|
|
1609
|
-
return createElement(u, o, (r, E2) => {
|
|
1610
|
-
const { className: o2 } = t.props, i = useMemo(() => P(o2, ((e, r2) => {
|
|
1611
|
-
const E3 = _(e, r2);
|
|
1612
|
-
switch (e) {
|
|
1613
|
-
case T.APPEAR_ACTIVE:
|
|
1614
|
-
return P(_(T.APPEAR, r2), E3);
|
|
1615
|
-
case T.ENTER_ACTIVE:
|
|
1616
|
-
return P(_(T.ENTER, r2), E3);
|
|
1617
|
-
case T.EXIT_ACTIVE:
|
|
1618
|
-
return P(_(T.EXIT, r2), E3);
|
|
1619
|
-
default:
|
|
1620
|
-
return E3;
|
|
1621
|
-
}
|
|
1622
|
-
})(E2, n2)), [o2, n2, E2]);
|
|
1623
|
-
return cloneElement(t, { className: i });
|
|
1624
|
-
});
|
|
1625
|
-
};
|
|
1626
|
-
const transitionContainer$1 = "_transitionContainer_1gzlr_1";
|
|
1627
|
-
const modalBox$1 = "_modalBox_1gzlr_13";
|
|
1628
|
-
const enter$1 = "_enter_1gzlr_21";
|
|
1629
|
-
const exitDone$1 = "_exitDone_1gzlr_22";
|
|
1630
|
-
const enterActive$1 = "_enterActive_1gzlr_31";
|
|
1631
|
-
const exit$1 = "_exit_1gzlr_22";
|
|
1632
|
-
const styles$5 = {
|
|
1633
|
-
transitionContainer: transitionContainer$1,
|
|
1634
|
-
modalBox: modalBox$1,
|
|
1635
|
-
enter: enter$1,
|
|
1636
|
-
exitDone: exitDone$1,
|
|
1637
|
-
enterActive: enterActive$1,
|
|
1638
|
-
exit: exit$1
|
|
1639
|
-
};
|
|
1640
|
-
function Modal$1({
|
|
1641
|
-
visible = false,
|
|
1642
|
-
children
|
|
1643
|
-
}) {
|
|
1644
|
-
return jsx(d, {
|
|
1645
|
-
in: visible,
|
|
1646
|
-
duration: 300,
|
|
1647
|
-
classNames: styles$5,
|
|
1648
|
-
alwaysMounted: true,
|
|
1649
|
-
children: jsx("div", {
|
|
1650
|
-
class: styles$5.transitionContainer,
|
|
1651
|
-
children: jsx("div", {
|
|
1652
|
-
class: styles$5.modalBox,
|
|
1653
|
-
children
|
|
1654
|
-
})
|
|
1655
|
-
})
|
|
1656
|
-
});
|
|
1553
|
+
function pointInsideRect(point, rect) {
|
|
1554
|
+
return point.x >= rect.x && point.x <= rect.x + rect.width && point.y >= rect.y && point.y <= rect.y + rect.height;
|
|
1657
1555
|
}
|
|
1658
1556
|
const tooltip = "_tooltip_11t5d_1";
|
|
1659
1557
|
const defaultStyles$b = {
|
|
1660
1558
|
tooltip
|
|
1661
1559
|
};
|
|
1662
|
-
const TooltipType = {
|
|
1663
|
-
float: "float",
|
|
1664
|
-
modal: "modal"
|
|
1665
|
-
};
|
|
1666
1560
|
function Tooltip({
|
|
1667
1561
|
for: targetElement,
|
|
1668
|
-
|
|
1669
|
-
|
|
1562
|
+
touchRect,
|
|
1563
|
+
positionInTarget,
|
|
1564
|
+
show = true,
|
|
1670
1565
|
styles: styles2,
|
|
1671
1566
|
children
|
|
1672
1567
|
}) {
|
|
@@ -1677,29 +1572,19 @@ function Tooltip({
|
|
|
1677
1572
|
y: 0
|
|
1678
1573
|
});
|
|
1679
1574
|
const [displayElement, setDisplayElement] = useState(null);
|
|
1680
|
-
const
|
|
1681
|
-
const {
|
|
1682
|
-
targetRect,
|
|
1683
|
-
positionInTarget,
|
|
1684
|
-
hoverActive
|
|
1685
|
-
} = useTooltipTarget(targetElement, trackPosition);
|
|
1686
|
-
const tooltipRef = useRef(null);
|
|
1575
|
+
const tooltipRef = useRef();
|
|
1687
1576
|
styles2 = mergeStyles(defaultStyles$b, styles2);
|
|
1688
1577
|
useEffect(() => {
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
|
-
} else {
|
|
1695
|
-
throw new Error("renderIn prop needs to be a selector or ref (from useRef)");
|
|
1696
|
-
}
|
|
1697
|
-
setDisplayElement(element);
|
|
1698
|
-
}, [refOrSelector]);
|
|
1578
|
+
setDisplayElement(document.querySelector("body"));
|
|
1579
|
+
return () => {
|
|
1580
|
+
setDisplayElement(null);
|
|
1581
|
+
};
|
|
1582
|
+
}, []);
|
|
1699
1583
|
useLayoutEffect(() => {
|
|
1700
1584
|
if (!tooltipRef.current)
|
|
1701
1585
|
return;
|
|
1702
|
-
|
|
1586
|
+
const targetRect = targetElement.getBoundingClientRect();
|
|
1587
|
+
if (positionInTarget) {
|
|
1703
1588
|
const newPosition = tooltipPositionForPoint({
|
|
1704
1589
|
targetRect,
|
|
1705
1590
|
positionInTarget,
|
|
@@ -1707,35 +1592,32 @@ function Tooltip({
|
|
|
1707
1592
|
displayElement
|
|
1708
1593
|
});
|
|
1709
1594
|
setTooltipPosition(newPosition);
|
|
1710
|
-
} else if (!
|
|
1595
|
+
} else if (!positionInTarget) {
|
|
1711
1596
|
const newPosition = tooltipPositionForRect({
|
|
1712
1597
|
targetRect,
|
|
1598
|
+
touchRect,
|
|
1713
1599
|
tooltip: tooltipRef.current,
|
|
1714
1600
|
displayElement
|
|
1715
1601
|
});
|
|
1716
1602
|
setTooltipPosition(newPosition);
|
|
1717
1603
|
}
|
|
1718
|
-
}, [
|
|
1604
|
+
}, [targetElement, positionInTarget, displayElement, tooltipRef, touchRect]);
|
|
1719
1605
|
if (!displayElement)
|
|
1720
1606
|
return;
|
|
1721
|
-
const
|
|
1722
|
-
|
|
1723
|
-
display: displayTooltip ? "block" : "none",
|
|
1607
|
+
const fixedStyle = {
|
|
1608
|
+
display: show ? "block" : "none",
|
|
1724
1609
|
position: "fixed",
|
|
1725
1610
|
left: tooltipPosition.x,
|
|
1726
1611
|
top: tooltipPosition.y,
|
|
1727
1612
|
zIndex: 100
|
|
1728
1613
|
};
|
|
1729
|
-
const tooltip2 =
|
|
1614
|
+
const tooltip2 = jsx("div", {
|
|
1730
1615
|
ref: tooltipRef,
|
|
1731
1616
|
className: styles2.tooltip,
|
|
1732
1617
|
style: fixedStyle,
|
|
1733
|
-
children
|
|
1618
|
+
children
|
|
1734
1619
|
});
|
|
1735
|
-
return createPortal(
|
|
1736
|
-
visible: hoverActive,
|
|
1737
|
-
children: tooltip2
|
|
1738
|
-
}) : tooltip2, displayElement);
|
|
1620
|
+
return createPortal(tooltip2, displayElement);
|
|
1739
1621
|
}
|
|
1740
1622
|
function tooltipPositionForPoint({
|
|
1741
1623
|
targetRect,
|
|
@@ -1756,10 +1638,19 @@ function tooltipPositionForPoint({
|
|
|
1756
1638
|
if (newPosition.y + tooltipHeight > displayElementRect.bottom) {
|
|
1757
1639
|
newPosition.y -= tooltipHeight;
|
|
1758
1640
|
}
|
|
1641
|
+
if (newPosition.x <= displayElementRect.left) {
|
|
1642
|
+
newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
|
|
1643
|
+
}
|
|
1759
1644
|
return newPosition;
|
|
1760
1645
|
}
|
|
1761
1646
|
function tooltipPositionForRect({
|
|
1762
1647
|
targetRect,
|
|
1648
|
+
touchRect = {
|
|
1649
|
+
x: 0,
|
|
1650
|
+
y: 0,
|
|
1651
|
+
width: 0,
|
|
1652
|
+
height: 0
|
|
1653
|
+
},
|
|
1763
1654
|
tooltip: tooltip2,
|
|
1764
1655
|
displayElement
|
|
1765
1656
|
}) {
|
|
@@ -1769,6 +1660,15 @@ function tooltipPositionForRect({
|
|
|
1769
1660
|
};
|
|
1770
1661
|
const tooltipWidth = tooltip2.offsetWidth;
|
|
1771
1662
|
const tooltipHeight = tooltip2.offsetHeight;
|
|
1663
|
+
const tooltipRect = {
|
|
1664
|
+
...newPosition,
|
|
1665
|
+
width: tooltipWidth,
|
|
1666
|
+
height: tooltipHeight
|
|
1667
|
+
};
|
|
1668
|
+
if (rectsIntersect(tooltipRect, touchRect)) {
|
|
1669
|
+
newPosition.x = touchRect.x + touchRect.width / 2;
|
|
1670
|
+
newPosition.y = touchRect.y - tooltipHeight;
|
|
1671
|
+
}
|
|
1772
1672
|
const displayElementRect = displayElement.getBoundingClientRect();
|
|
1773
1673
|
if (newPosition.x + tooltipWidth > displayElementRect.right) {
|
|
1774
1674
|
newPosition.x = targetRect.left - tooltipWidth;
|
|
@@ -1776,12 +1676,15 @@ function tooltipPositionForRect({
|
|
|
1776
1676
|
if (newPosition.y - tooltipHeight < displayElementRect.top) {
|
|
1777
1677
|
newPosition.y = targetRect.bottom;
|
|
1778
1678
|
}
|
|
1679
|
+
if (newPosition.x <= displayElementRect.left) {
|
|
1680
|
+
newPosition.x = displayElementRect.left + displayElementRect.width / 2 - tooltipWidth / 2;
|
|
1681
|
+
}
|
|
1779
1682
|
return newPosition;
|
|
1780
1683
|
}
|
|
1781
|
-
const text$
|
|
1684
|
+
const text$1 = "_text_1b8t2_1";
|
|
1782
1685
|
const container$3 = "_container_1b8t2_10";
|
|
1783
1686
|
const defaultStyles$a = {
|
|
1784
|
-
text: text$
|
|
1687
|
+
text: text$1,
|
|
1785
1688
|
container: container$3
|
|
1786
1689
|
};
|
|
1787
1690
|
const ControlChange = ({
|
|
@@ -1839,7 +1742,7 @@ const defaultStyles$9 = {
|
|
|
1839
1742
|
displayColumn,
|
|
1840
1743
|
topRow
|
|
1841
1744
|
};
|
|
1842
|
-
const ToplineResult = ({
|
|
1745
|
+
const ToplineResult = forwardRef(({
|
|
1843
1746
|
name: name2,
|
|
1844
1747
|
secondaryName,
|
|
1845
1748
|
mainNumber: mainNumber2,
|
|
@@ -1850,8 +1753,9 @@ const ToplineResult = ({
|
|
|
1850
1753
|
abbreviation,
|
|
1851
1754
|
onMouseOver,
|
|
1852
1755
|
onInfoPress,
|
|
1853
|
-
showInfoButton = false
|
|
1854
|
-
|
|
1756
|
+
showInfoButton = false,
|
|
1757
|
+
infoButtonRef
|
|
1758
|
+
}, ref) => {
|
|
1855
1759
|
styles2 = mergeStyles({
|
|
1856
1760
|
...defaultStyles$9
|
|
1857
1761
|
}, styles2);
|
|
@@ -1859,6 +1763,7 @@ const ToplineResult = ({
|
|
|
1859
1763
|
return !secondaryName ? jsxs("div", {
|
|
1860
1764
|
class: styles2.toplineResult,
|
|
1861
1765
|
onMouseOver,
|
|
1766
|
+
ref,
|
|
1862
1767
|
children: [jsxs("div", {
|
|
1863
1768
|
class: styles2.topRow,
|
|
1864
1769
|
children: [jsx("span", {
|
|
@@ -1867,7 +1772,8 @@ const ToplineResult = ({
|
|
|
1867
1772
|
}), " ", showInfoButton && jsx("span", {
|
|
1868
1773
|
class: styles2.infoButton,
|
|
1869
1774
|
children: jsx(InfoButton, {
|
|
1870
|
-
onClick: onInfoPress
|
|
1775
|
+
onClick: onInfoPress,
|
|
1776
|
+
ref: infoButtonRef
|
|
1871
1777
|
})
|
|
1872
1778
|
})]
|
|
1873
1779
|
}), jsxs("div", {
|
|
@@ -1886,6 +1792,7 @@ const ToplineResult = ({
|
|
|
1886
1792
|
}) : jsxs("div", {
|
|
1887
1793
|
class: styles2.toplineResult,
|
|
1888
1794
|
onMouseOver,
|
|
1795
|
+
ref,
|
|
1889
1796
|
children: [jsxs("div", {
|
|
1890
1797
|
class: styles2.topRow,
|
|
1891
1798
|
children: [jsx("span", {
|
|
@@ -1917,7 +1824,7 @@ const ToplineResult = ({
|
|
|
1917
1824
|
})]
|
|
1918
1825
|
})]
|
|
1919
1826
|
});
|
|
1920
|
-
};
|
|
1827
|
+
});
|
|
1921
1828
|
const section = "_section_12aiu_9";
|
|
1922
1829
|
const borderTop = "_borderTop_12aiu_52";
|
|
1923
1830
|
const header = "_header_12aiu_56";
|
|
@@ -1952,11 +1859,11 @@ const PageSection = forwardRef(({
|
|
|
1952
1859
|
})]
|
|
1953
1860
|
});
|
|
1954
1861
|
});
|
|
1955
|
-
const text
|
|
1862
|
+
const text = "_text_lo5h3_1";
|
|
1956
1863
|
const axis = "_axis_lo5h3_6";
|
|
1957
1864
|
const bar = "_bar_lo5h3_10";
|
|
1958
1865
|
const defaultStyles$7 = {
|
|
1959
|
-
text
|
|
1866
|
+
text,
|
|
1960
1867
|
axis,
|
|
1961
1868
|
bar
|
|
1962
1869
|
};
|
|
@@ -2006,58 +1913,56 @@ const ColumnChart = ({
|
|
|
2006
1913
|
})]
|
|
2007
1914
|
});
|
|
2008
1915
|
};
|
|
2009
|
-
const
|
|
2010
|
-
const
|
|
2011
|
-
const title$
|
|
2012
|
-
const subtitle = "
|
|
2013
|
-
const
|
|
2014
|
-
const
|
|
2015
|
-
const
|
|
2016
|
-
const mugshot = "_mugshot_vd5ly_71";
|
|
1916
|
+
const container$2 = "_container_1snyq_1";
|
|
1917
|
+
const img = "_img_1snyq_7";
|
|
1918
|
+
const title$2 = "_title_1snyq_15";
|
|
1919
|
+
const subtitle = "_subtitle_1snyq_31";
|
|
1920
|
+
const small = "_small_1snyq_41";
|
|
1921
|
+
const blurb = "_blurb_1snyq_51";
|
|
1922
|
+
const footnote = "_footnote_1snyq_59";
|
|
2017
1923
|
const defaultStyles$6 = {
|
|
2018
|
-
text,
|
|
2019
1924
|
container: container$2,
|
|
2020
|
-
|
|
1925
|
+
img,
|
|
1926
|
+
title: title$2,
|
|
2021
1927
|
subtitle,
|
|
1928
|
+
small,
|
|
2022
1929
|
blurb,
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
1930
|
+
footnote
|
|
1931
|
+
};
|
|
1932
|
+
const SubtitleStyle = {
|
|
1933
|
+
small: "small",
|
|
1934
|
+
large: "large"
|
|
2026
1935
|
};
|
|
2027
1936
|
const PartyProfile = ({
|
|
2028
|
-
styles: styles2,
|
|
2029
1937
|
title: title2,
|
|
2030
1938
|
subtitle: subtitle2,
|
|
1939
|
+
subtitleStyle = SubtitleStyle.large,
|
|
2031
1940
|
blurb: blurb2,
|
|
1941
|
+
footnote: footnote2,
|
|
2032
1942
|
imgSrc,
|
|
2033
|
-
|
|
1943
|
+
styles: styles2
|
|
2034
1944
|
}) => {
|
|
2035
1945
|
styles2 = mergeStyles({
|
|
2036
1946
|
...defaultStyles$6
|
|
2037
1947
|
}, styles2);
|
|
2038
|
-
return
|
|
1948
|
+
return jsxs("div", {
|
|
2039
1949
|
class: styles2.container,
|
|
2040
|
-
children:
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
src: imgSrc,
|
|
2057
|
-
className: `${styles2.mugshot} bg-color--${abbreviation}`
|
|
2058
|
-
})
|
|
2059
|
-
})]
|
|
2060
|
-
})
|
|
1950
|
+
children: [jsx("img", {
|
|
1951
|
+
src: imgSrc,
|
|
1952
|
+
className: styles2.img
|
|
1953
|
+
}), jsx("h3", {
|
|
1954
|
+
className: styles2.title,
|
|
1955
|
+
children: title2
|
|
1956
|
+
}), jsx("div", {
|
|
1957
|
+
className: [styles2.subtitle, styles2[subtitleStyle]].join(" "),
|
|
1958
|
+
children: subtitle2
|
|
1959
|
+
}), jsx("div", {
|
|
1960
|
+
className: styles2.blurb,
|
|
1961
|
+
children: blurb2
|
|
1962
|
+
}), jsx("div", {
|
|
1963
|
+
className: styles2.footnote,
|
|
1964
|
+
children: footnote2
|
|
1965
|
+
})]
|
|
2061
1966
|
});
|
|
2062
1967
|
};
|
|
2063
1968
|
var epsilon$1 = 1e-6;
|
|
@@ -2472,7 +2377,7 @@ function useContainerSize(containerRef) {
|
|
|
2472
2377
|
}
|
|
2473
2378
|
const container$1 = "_container_cyrny_1";
|
|
2474
2379
|
const svg$1 = "_svg_cyrny_6";
|
|
2475
|
-
const styles$
|
|
2380
|
+
const styles$5 = {
|
|
2476
2381
|
container: container$1,
|
|
2477
2382
|
svg: svg$1
|
|
2478
2383
|
};
|
|
@@ -2720,7 +2625,7 @@ const Map$1 = forwardRef(({
|
|
|
2720
2625
|
const renderSVG = containerSize && !config.drawToCanvas;
|
|
2721
2626
|
return jsx("div", {
|
|
2722
2627
|
ref: containerRef,
|
|
2723
|
-
className: styles$
|
|
2628
|
+
className: styles$5.container,
|
|
2724
2629
|
style: containerStyle,
|
|
2725
2630
|
children: renderSVG && jsx(SVGMapProvider, {
|
|
2726
2631
|
id,
|
|
@@ -2772,7 +2677,7 @@ function ResultSummary({
|
|
|
2772
2677
|
}
|
|
2773
2678
|
const svg = "_svg_1dms8_1";
|
|
2774
2679
|
const path = "_path_1dms8_8";
|
|
2775
|
-
const styles$
|
|
2680
|
+
const styles$4 = {
|
|
2776
2681
|
svg,
|
|
2777
2682
|
path
|
|
2778
2683
|
};
|
|
@@ -2780,9 +2685,9 @@ function SearchIcon() {
|
|
|
2780
2685
|
return jsx("svg", {
|
|
2781
2686
|
viewBox: "0 0 20 20",
|
|
2782
2687
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2783
|
-
className: styles$
|
|
2688
|
+
className: styles$4.svg,
|
|
2784
2689
|
children: jsx("path", {
|
|
2785
|
-
className: styles$
|
|
2690
|
+
className: styles$4.path,
|
|
2786
2691
|
"fill-rule": "evenodd",
|
|
2787
2692
|
"clip-rule": "evenodd",
|
|
2788
2693
|
d: "M7.273 0c4.022 0 7.25 3.295 7.25 7.273a7.226 7.226 0 01-7.25 7.25C3.25 14.523 0 11.295 0 7.273 0 3.295 3.25 0 7.273 0zm0 1.84A5.403 5.403 0 001.84 7.274c0 3 2.409 5.454 5.432 5.454 3 0 5.454-2.454 5.454-5.454 0-3.023-2.454-5.432-5.454-5.432zM20 18.16l-5.432-5.432h-.932l-.909.91v.931L18.16 20 20 18.159z"
|
|
@@ -2927,11 +2832,13 @@ function SuggestionList({
|
|
|
2927
2832
|
})
|
|
2928
2833
|
});
|
|
2929
2834
|
}
|
|
2930
|
-
const refreshIndicator = "
|
|
2931
|
-
const
|
|
2932
|
-
const
|
|
2835
|
+
const refreshIndicator = "_refreshIndicator_3z0ji_9";
|
|
2836
|
+
const icon$1 = "_icon_3z0ji_17";
|
|
2837
|
+
const liveText = "_liveText_3z0ji_26";
|
|
2838
|
+
const refreshText = "_refreshText_3z0ji_27";
|
|
2933
2839
|
const defaultStyles$2 = {
|
|
2934
2840
|
refreshIndicator,
|
|
2841
|
+
icon: icon$1,
|
|
2935
2842
|
liveText,
|
|
2936
2843
|
refreshText
|
|
2937
2844
|
};
|
|
@@ -2942,8 +2849,11 @@ function RefreshIndicator({
|
|
|
2942
2849
|
styles2 = mergeStyles(defaultStyles$2, styles2);
|
|
2943
2850
|
return jsxs("div", {
|
|
2944
2851
|
className: styles2.refreshIndicator,
|
|
2945
|
-
children: [jsx(
|
|
2946
|
-
|
|
2852
|
+
children: [jsx("span", {
|
|
2853
|
+
className: styles2.icon,
|
|
2854
|
+
children: jsx(CircleIcon, {
|
|
2855
|
+
pulse: true
|
|
2856
|
+
})
|
|
2947
2857
|
}), jsx("span", {
|
|
2948
2858
|
className: styles2.liveText,
|
|
2949
2859
|
children: "LIVE"
|
|
@@ -2981,13 +2891,79 @@ function ResponsiveGrid({
|
|
|
2981
2891
|
})
|
|
2982
2892
|
});
|
|
2983
2893
|
}
|
|
2894
|
+
function n(n2) {
|
|
2895
|
+
return (r) => {
|
|
2896
|
+
n2.forEach((n3) => {
|
|
2897
|
+
"function" == typeof n3 ? n3(r) : null != n3 && (n3.current = r);
|
|
2898
|
+
});
|
|
2899
|
+
};
|
|
2900
|
+
}
|
|
2901
|
+
var T, c;
|
|
2902
|
+
!function(e) {
|
|
2903
|
+
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";
|
|
2904
|
+
}(T || (T = {})), function(e) {
|
|
2905
|
+
e.ENTER = "onEnter", e.ENTERING = "onEntering", e.ENTERED = "onEntered", e.EXIT = "onExit", e.EXITING = "onExiting", e.EXITED = "onExited";
|
|
2906
|
+
}(c || (c = {}));
|
|
2907
|
+
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] };
|
|
2908
|
+
var u = (r) => {
|
|
2909
|
+
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();
|
|
2910
|
+
let d2 = false;
|
|
2911
|
+
const [f, D] = useState(() => (d2 = true, u2 ? A ? T.APPEAR : T.APPEAR_DONE : T.EXIT_DONE));
|
|
2912
|
+
useEffect(() => {
|
|
2913
|
+
var e;
|
|
2914
|
+
const { setTimeout: E, clearTimeout: t } = window, [n2, o, i] = s[f];
|
|
2915
|
+
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)), () => {
|
|
2916
|
+
t(_2.current);
|
|
2917
|
+
};
|
|
2918
|
+
}, [f, I]), useLayoutEffect(() => {
|
|
2919
|
+
d2 || D(u2 ? N2 ? T.ENTER : T.ENTER_DONE : l ? T.EXIT : T.EXIT_DONE);
|
|
2920
|
+
}, [u2]);
|
|
2921
|
+
const X = useMemo(() => {
|
|
2922
|
+
const e = {};
|
|
2923
|
+
return Object.values(T).forEach((r2) => {
|
|
2924
|
+
e[r2] = f === r2;
|
|
2925
|
+
}), e;
|
|
2926
|
+
}, [f]);
|
|
2927
|
+
if (!p2 && f === T.EXIT_DONE)
|
|
2928
|
+
return null;
|
|
2929
|
+
const O = c2(X, f);
|
|
2930
|
+
return cloneElement(O, { ref: n([P2, O.ref]) });
|
|
2931
|
+
};
|
|
2932
|
+
function N(e, r) {
|
|
2933
|
+
if (null == e)
|
|
2934
|
+
return {};
|
|
2935
|
+
var E, t, n2 = {}, o = Object.keys(e);
|
|
2936
|
+
for (t = 0; t < o.length; t++)
|
|
2937
|
+
r.indexOf(E = o[t]) >= 0 || (n2[E] = e[E]);
|
|
2938
|
+
return n2;
|
|
2939
|
+
}
|
|
2940
|
+
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];
|
|
2941
|
+
var d = (E) => {
|
|
2942
|
+
const { children: t, classNames: n2 } = E, o = N(E, p);
|
|
2943
|
+
return createElement(u, o, (r, E2) => {
|
|
2944
|
+
const { className: o2 } = t.props, i = useMemo(() => P(o2, ((e, r2) => {
|
|
2945
|
+
const E3 = _(e, r2);
|
|
2946
|
+
switch (e) {
|
|
2947
|
+
case T.APPEAR_ACTIVE:
|
|
2948
|
+
return P(_(T.APPEAR, r2), E3);
|
|
2949
|
+
case T.ENTER_ACTIVE:
|
|
2950
|
+
return P(_(T.ENTER, r2), E3);
|
|
2951
|
+
case T.EXIT_ACTIVE:
|
|
2952
|
+
return P(_(T.EXIT, r2), E3);
|
|
2953
|
+
default:
|
|
2954
|
+
return E3;
|
|
2955
|
+
}
|
|
2956
|
+
})(E2, n2)), [o2, n2, E2]);
|
|
2957
|
+
return cloneElement(t, { className: i });
|
|
2958
|
+
});
|
|
2959
|
+
};
|
|
2984
2960
|
const transitionContainer = "_transitionContainer_wws3j_1";
|
|
2985
2961
|
const modalBox = "_modalBox_wws3j_13";
|
|
2986
2962
|
const enter = "_enter_wws3j_21";
|
|
2987
2963
|
const exitDone = "_exitDone_wws3j_22";
|
|
2988
2964
|
const enterActive = "_enterActive_wws3j_31";
|
|
2989
2965
|
const exit = "_exit_wws3j_22";
|
|
2990
|
-
const styles$
|
|
2966
|
+
const styles$3 = {
|
|
2991
2967
|
transitionContainer,
|
|
2992
2968
|
modalBox,
|
|
2993
2969
|
enter,
|
|
@@ -3010,21 +2986,123 @@ function Modal({
|
|
|
3010
2986
|
return createPortal(jsx(d, {
|
|
3011
2987
|
in: visible,
|
|
3012
2988
|
duration: 300,
|
|
3013
|
-
classNames: styles$
|
|
2989
|
+
classNames: styles$3,
|
|
3014
2990
|
children: jsx("div", {
|
|
3015
|
-
class: styles$
|
|
2991
|
+
class: styles$3.transitionContainer,
|
|
3016
2992
|
onClick,
|
|
3017
2993
|
style: {
|
|
3018
2994
|
pointerEvents: visible ? "auto" : "none"
|
|
3019
2995
|
},
|
|
3020
2996
|
children: jsx("div", {
|
|
3021
2997
|
ref: modalBoxRef,
|
|
3022
|
-
class: styles$
|
|
2998
|
+
class: styles$3.modalBox,
|
|
3023
2999
|
children
|
|
3024
3000
|
})
|
|
3025
3001
|
})
|
|
3026
3002
|
}), document.body);
|
|
3027
3003
|
}
|
|
3004
|
+
const button$1 = "_button_xeyqm_1";
|
|
3005
|
+
const icon = "_icon_xeyqm_17";
|
|
3006
|
+
const title$1 = "_title_xeyqm_22";
|
|
3007
|
+
const popout = "_popout_xeyqm_29";
|
|
3008
|
+
const hint = "_hint_xeyqm_44";
|
|
3009
|
+
const option = "_option_xeyqm_51";
|
|
3010
|
+
const optionIcon = "_optionIcon_xeyqm_71";
|
|
3011
|
+
const optionTitle = "_optionTitle_xeyqm_76";
|
|
3012
|
+
const optionDescription = "_optionDescription_xeyqm_84";
|
|
3013
|
+
const checkmark = "_checkmark_xeyqm_91";
|
|
3014
|
+
const checkmarkPath = "_checkmarkPath_xeyqm_97";
|
|
3015
|
+
const styles$2 = {
|
|
3016
|
+
button: button$1,
|
|
3017
|
+
icon,
|
|
3018
|
+
title: title$1,
|
|
3019
|
+
popout,
|
|
3020
|
+
hint,
|
|
3021
|
+
option,
|
|
3022
|
+
optionIcon,
|
|
3023
|
+
optionTitle,
|
|
3024
|
+
optionDescription,
|
|
3025
|
+
checkmark,
|
|
3026
|
+
checkmarkPath
|
|
3027
|
+
};
|
|
3028
|
+
function Dropdown({
|
|
3029
|
+
title: title2,
|
|
3030
|
+
hint: hint2,
|
|
3031
|
+
options,
|
|
3032
|
+
onSelect
|
|
3033
|
+
}) {
|
|
3034
|
+
const [expanded, setExpanded] = useState(true);
|
|
3035
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
3036
|
+
const onOptionClick = useCallback((option2, index2) => {
|
|
3037
|
+
setSelectedIndex(index2);
|
|
3038
|
+
if (onSelect)
|
|
3039
|
+
onSelect(option2, index2);
|
|
3040
|
+
}, [onSelect]);
|
|
3041
|
+
const iconForSelectedOption = useMemo(() => {
|
|
3042
|
+
const selectedOption = options[selectedIndex];
|
|
3043
|
+
return selectedOption.icon;
|
|
3044
|
+
}, [options, selectedIndex]);
|
|
3045
|
+
return jsxs("div", {
|
|
3046
|
+
children: [jsxs("button", {
|
|
3047
|
+
className: styles$2.button,
|
|
3048
|
+
onClick: () => setExpanded((current) => !current),
|
|
3049
|
+
children: [jsx("img", {
|
|
3050
|
+
src: iconForSelectedOption,
|
|
3051
|
+
className: styles$2.icon
|
|
3052
|
+
}), jsx("span", {
|
|
3053
|
+
className: styles$2.title,
|
|
3054
|
+
children: title2
|
|
3055
|
+
}), jsx(Chevron, {
|
|
3056
|
+
active: true,
|
|
3057
|
+
size: "large",
|
|
3058
|
+
direction: expanded ? "up" : "down"
|
|
3059
|
+
})]
|
|
3060
|
+
}), jsxs("div", {
|
|
3061
|
+
className: styles$2.popout,
|
|
3062
|
+
style: {
|
|
3063
|
+
visibility: expanded ? "visible" : "hidden"
|
|
3064
|
+
},
|
|
3065
|
+
children: [hint2 && jsx("p", {
|
|
3066
|
+
className: styles$2.hint,
|
|
3067
|
+
children: hint2
|
|
3068
|
+
}), options.map((option2, index2) => jsxs("button", {
|
|
3069
|
+
className: styles$2.option,
|
|
3070
|
+
onClick: () => onOptionClick(option2, index2),
|
|
3071
|
+
children: [jsx("img", {
|
|
3072
|
+
src: option2.icon,
|
|
3073
|
+
className: styles$2.optionIcon
|
|
3074
|
+
}), jsxs("div", {
|
|
3075
|
+
className: styles$2.optionText,
|
|
3076
|
+
children: [jsx("h4", {
|
|
3077
|
+
className: styles$2.optionTitle,
|
|
3078
|
+
children: option2.title
|
|
3079
|
+
}), jsx("p", {
|
|
3080
|
+
className: styles$2.optionDescription,
|
|
3081
|
+
children: option2.description
|
|
3082
|
+
})]
|
|
3083
|
+
}), index2 === selectedIndex && jsx("div", {
|
|
3084
|
+
className: styles$2.checkmark,
|
|
3085
|
+
children: jsx(Checkmark, {})
|
|
3086
|
+
})]
|
|
3087
|
+
}, option2.title))]
|
|
3088
|
+
})]
|
|
3089
|
+
});
|
|
3090
|
+
}
|
|
3091
|
+
function Checkmark() {
|
|
3092
|
+
return jsx("svg", {
|
|
3093
|
+
width: "11",
|
|
3094
|
+
height: "9",
|
|
3095
|
+
viewBox: "0 0 11 9",
|
|
3096
|
+
fill: "none",
|
|
3097
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3098
|
+
children: jsx("path", {
|
|
3099
|
+
"fill-rule": "evenodd",
|
|
3100
|
+
"clip-rule": "evenodd",
|
|
3101
|
+
d: "M0.631814 4.43687L0.0839844 4.9847L2.82313 8.8195H3.08335L10.9173 0.711624L10.3695 0.17749L3.08335 6.77884L0.631814 4.43687Z",
|
|
3102
|
+
className: styles$2.checkmarkPath
|
|
3103
|
+
})
|
|
3104
|
+
});
|
|
3105
|
+
}
|
|
3028
3106
|
const coalitionsWrapper = "_coalitionsWrapper_1ahqy_9";
|
|
3029
3107
|
const coalitionsContainer = "_coalitionsContainer_1ahqy_14";
|
|
3030
3108
|
const coalition = "_coalition_1ahqy_9";
|
|
@@ -3307,6 +3385,122 @@ function Ticker({
|
|
|
3307
3385
|
})]
|
|
3308
3386
|
});
|
|
3309
3387
|
}
|
|
3388
|
+
function useTouchOrHover() {
|
|
3389
|
+
const ref = useRef();
|
|
3390
|
+
const [position, setPosition] = useState();
|
|
3391
|
+
const [isActive, setIsActive] = useState(false);
|
|
3392
|
+
const [touchRect, setTouchRect] = useState();
|
|
3393
|
+
useEffect(() => {
|
|
3394
|
+
const element = ref.current;
|
|
3395
|
+
let touchCancelled = false;
|
|
3396
|
+
const touchStarted = (event) => {
|
|
3397
|
+
if (event.touches.length > 1)
|
|
3398
|
+
return;
|
|
3399
|
+
touchCancelled = false;
|
|
3400
|
+
const touch = event.touches[0];
|
|
3401
|
+
const {
|
|
3402
|
+
clientX,
|
|
3403
|
+
clientY
|
|
3404
|
+
} = touch;
|
|
3405
|
+
const rect = element.getBoundingClientRect();
|
|
3406
|
+
const point = {
|
|
3407
|
+
x: clientX - rect.left,
|
|
3408
|
+
y: clientY - rect.top
|
|
3409
|
+
};
|
|
3410
|
+
setPosition(point);
|
|
3411
|
+
const touchRect2 = {
|
|
3412
|
+
x: clientX - touch.radiusX,
|
|
3413
|
+
y: clientY - touch.radiusY,
|
|
3414
|
+
width: touch.radiusX * 2,
|
|
3415
|
+
height: touch.radiusY * 2
|
|
3416
|
+
};
|
|
3417
|
+
setTouchRect(touchRect2);
|
|
3418
|
+
setIsActive(true);
|
|
3419
|
+
event.stopPropagation();
|
|
3420
|
+
};
|
|
3421
|
+
const touchMoved = (event) => {
|
|
3422
|
+
if (touchCancelled || event.targetTouches.length !== 1)
|
|
3423
|
+
return;
|
|
3424
|
+
const touch = event.targetTouches[0];
|
|
3425
|
+
const {
|
|
3426
|
+
clientX,
|
|
3427
|
+
clientY
|
|
3428
|
+
} = touch;
|
|
3429
|
+
const rect = element.getBoundingClientRect();
|
|
3430
|
+
const point = {
|
|
3431
|
+
x: clientX - rect.left,
|
|
3432
|
+
y: clientY - rect.top
|
|
3433
|
+
};
|
|
3434
|
+
if (!event.cancelable || !pointInsideRect(point, rect)) {
|
|
3435
|
+
setIsActive(false);
|
|
3436
|
+
touchCancelled = true;
|
|
3437
|
+
} else {
|
|
3438
|
+
setPosition(point);
|
|
3439
|
+
setIsActive(true);
|
|
3440
|
+
}
|
|
3441
|
+
};
|
|
3442
|
+
const touchEnded = (event) => {
|
|
3443
|
+
if (event.cancelable) {
|
|
3444
|
+
event.preventDefault();
|
|
3445
|
+
}
|
|
3446
|
+
setIsActive(false);
|
|
3447
|
+
setPosition(null);
|
|
3448
|
+
};
|
|
3449
|
+
const mouseOver = (event) => {
|
|
3450
|
+
const {
|
|
3451
|
+
clientX,
|
|
3452
|
+
clientY
|
|
3453
|
+
} = event;
|
|
3454
|
+
const rect = element.getBoundingClientRect();
|
|
3455
|
+
const x = clientX - rect.left;
|
|
3456
|
+
const y = clientY - rect.top;
|
|
3457
|
+
setPosition({
|
|
3458
|
+
x,
|
|
3459
|
+
y
|
|
3460
|
+
});
|
|
3461
|
+
setIsActive(true);
|
|
3462
|
+
};
|
|
3463
|
+
const mouseMoved = (event) => {
|
|
3464
|
+
const {
|
|
3465
|
+
clientX,
|
|
3466
|
+
clientY
|
|
3467
|
+
} = event;
|
|
3468
|
+
const rect = element.getBoundingClientRect();
|
|
3469
|
+
const x = clientX - rect.left;
|
|
3470
|
+
const y = clientY - rect.top;
|
|
3471
|
+
setPosition({
|
|
3472
|
+
x,
|
|
3473
|
+
y
|
|
3474
|
+
});
|
|
3475
|
+
};
|
|
3476
|
+
const mouseOut = () => {
|
|
3477
|
+
setIsActive(false);
|
|
3478
|
+
setPosition(null);
|
|
3479
|
+
};
|
|
3480
|
+
element.addEventListener("touchstart", touchStarted);
|
|
3481
|
+
element.addEventListener("touchmove", touchMoved);
|
|
3482
|
+
element.addEventListener("touchend", touchEnded);
|
|
3483
|
+
element.addEventListener("touchcancel", touchEnded);
|
|
3484
|
+
element.addEventListener("mouseover", mouseOver);
|
|
3485
|
+
element.addEventListener("mousemove", mouseMoved);
|
|
3486
|
+
element.addEventListener("mouseout", mouseOut);
|
|
3487
|
+
return () => {
|
|
3488
|
+
element.removeEventListener("touchstart", touchStarted);
|
|
3489
|
+
element.removeEventListener("touchmove", touchMoved);
|
|
3490
|
+
element.removeEventListener("touchend", mouseOut);
|
|
3491
|
+
element.removeEventListener("touchcancel", mouseOut);
|
|
3492
|
+
element.removeEventListener("mouseover", touchStarted);
|
|
3493
|
+
element.removeEventListener("mousemove", mouseMoved);
|
|
3494
|
+
element.removeEventListener("mouseout", mouseOut);
|
|
3495
|
+
};
|
|
3496
|
+
}, []);
|
|
3497
|
+
return {
|
|
3498
|
+
touchOrHoverRef: ref,
|
|
3499
|
+
touchOrHoverIsActive: isActive,
|
|
3500
|
+
touchRect,
|
|
3501
|
+
positionInTarget: position
|
|
3502
|
+
};
|
|
3503
|
+
}
|
|
3310
3504
|
export {
|
|
3311
3505
|
AdSlot,
|
|
3312
3506
|
ArrowButton,
|
|
@@ -3319,6 +3513,7 @@ export {
|
|
|
3319
3513
|
ColumnChart,
|
|
3320
3514
|
Container,
|
|
3321
3515
|
ControlChange,
|
|
3516
|
+
Dropdown,
|
|
3322
3517
|
GradientIcon,
|
|
3323
3518
|
GridType,
|
|
3324
3519
|
InfoButton,
|
|
@@ -3344,7 +3539,9 @@ export {
|
|
|
3344
3539
|
Table,
|
|
3345
3540
|
Ticker,
|
|
3346
3541
|
Tooltip,
|
|
3347
|
-
|
|
3348
|
-
|
|
3542
|
+
ToplineResult,
|
|
3543
|
+
useContainerSize,
|
|
3544
|
+
useTouchOrHover,
|
|
3545
|
+
useWindowSize
|
|
3349
3546
|
};
|
|
3350
3547
|
//# sourceMappingURL=interactive-component-library.js.map
|