@guardian/interactive-component-library 0.8.5 → 0.8.7
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.
- package/dist/components/molecules/canvas-map/lib/View.js +8 -3
- package/dist/components/molecules/control-change/index.js +11 -9
- package/dist/components/molecules/control-change/style.module.css.js +2 -2
- package/dist/components/molecules/result-summary/index.js +18 -14
- package/dist/style.css +7 -4
- package/package.json +1 -1
|
@@ -122,9 +122,14 @@ class View {
|
|
|
122
122
|
* @returns {Extent} - The extent relative to the current viewport
|
|
123
123
|
*/
|
|
124
124
|
projectExtent(extent) {
|
|
125
|
-
const [
|
|
126
|
-
const [
|
|
127
|
-
return new Extent(
|
|
125
|
+
const [x1, y1] = this.projection([extent.minX, extent.minY]);
|
|
126
|
+
const [x2, y2] = this.projection([extent.maxX, extent.maxY]);
|
|
127
|
+
return new Extent(
|
|
128
|
+
Math.min(x1, x2),
|
|
129
|
+
Math.min(y1, y2),
|
|
130
|
+
Math.max(x1, x2),
|
|
131
|
+
Math.max(y1, y2)
|
|
132
|
+
).scale(1 / this.pixelRatio);
|
|
128
133
|
}
|
|
129
134
|
invert(point) {
|
|
130
135
|
const { projection, pixelRatio, transform } = this.getState();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs,
|
|
1
|
+
import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
2
2
|
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
3
3
|
import "preact/hooks";
|
|
4
4
|
import { GradientIcon } from "../../particles/gradient-icon/index.js";
|
|
@@ -8,19 +8,21 @@ import "../../particles/relative-time-sentence/index.js";
|
|
|
8
8
|
import defaultStyles from "./style.module.css.js";
|
|
9
9
|
const ControlChange = ({ previous, next, text, styles }) => {
|
|
10
10
|
styles = mergeStyles({ ...defaultStyles }, styles);
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
let changeIcon;
|
|
12
|
+
if (previous && next && next !== previous) {
|
|
13
|
+
changeIcon = /* @__PURE__ */ jsx(
|
|
14
14
|
GradientIcon,
|
|
15
15
|
{
|
|
16
16
|
previous,
|
|
17
17
|
next,
|
|
18
|
-
styles: {
|
|
19
|
-
previous: styles.previous,
|
|
20
|
-
next: styles.next
|
|
21
|
-
}
|
|
18
|
+
styles: { previous: styles.previous, next: styles.next }
|
|
22
19
|
}
|
|
23
|
-
)
|
|
20
|
+
);
|
|
21
|
+
} else if (next) {
|
|
22
|
+
changeIcon = /* @__PURE__ */ jsx(CircleIcon, { styles: { circle: `fill-color--${next}` } });
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
|
|
25
|
+
changeIcon && /* @__PURE__ */ jsx(Fragment, { children: changeIcon }),
|
|
24
26
|
/* @__PURE__ */ jsx("strong", { className: styles.text, children: text })
|
|
25
27
|
] });
|
|
26
28
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
1
|
+
import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
2
2
|
import "preact/hooks";
|
|
3
3
|
import { mergeStyles } from "../../../styles/helpers/mergeStyles.js";
|
|
4
4
|
import "preact/compat";
|
|
@@ -35,25 +35,29 @@ function ResultSummary({
|
|
|
35
35
|
}) {
|
|
36
36
|
styles = mergeStyles({ ...defaultStyles }, styles);
|
|
37
37
|
if (isSlim) {
|
|
38
|
-
let
|
|
38
|
+
let changeIcon;
|
|
39
|
+
if (previous && next && next !== previous) {
|
|
40
|
+
changeIcon = /* @__PURE__ */ jsx(
|
|
41
|
+
GradientIcon,
|
|
42
|
+
{
|
|
43
|
+
previous,
|
|
44
|
+
next,
|
|
45
|
+
styles: { previous: styles.previous, next: styles.next }
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
} else if (next && !previous) {
|
|
49
|
+
changeIcon = /* @__PURE__ */ jsx(CircleIcon, { styles: { circle: `fill-color--${next}` } });
|
|
50
|
+
}
|
|
39
51
|
return /* @__PURE__ */ jsx(
|
|
40
52
|
"div",
|
|
41
53
|
{
|
|
42
54
|
className: `${styles.container} ${styles.containerSlim}`,
|
|
43
55
|
onClick,
|
|
44
56
|
children: /* @__PURE__ */ jsxs("p", { className: `${styles.titleSlim} ${lineClamp && styles.lineClamp}`, children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
next,
|
|
50
|
-
styles: {
|
|
51
|
-
previous: styles.previous,
|
|
52
|
-
next: styles.next
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
) : /* @__PURE__ */ jsx(CircleIcon, { styles: { circle: `fill-color--${next}` } }),
|
|
56
|
-
" ",
|
|
57
|
+
changeIcon && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
58
|
+
changeIcon,
|
|
59
|
+
" "
|
|
60
|
+
] }),
|
|
57
61
|
title,
|
|
58
62
|
" ",
|
|
59
63
|
/* @__PURE__ */ jsx(RelativeTimeSentence, { timeStamp: timestamp })
|
package/dist/style.css
CHANGED
|
@@ -1294,7 +1294,7 @@ body {
|
|
|
1294
1294
|
--news-grey-06: #f3f3f3;
|
|
1295
1295
|
--con: #0077b6;
|
|
1296
1296
|
--lab: #c70000;
|
|
1297
|
-
--libdem: #
|
|
1297
|
+
--libdem: #ff7f0f;
|
|
1298
1298
|
--green: #39a566;
|
|
1299
1299
|
--ukip: #bb3b80;
|
|
1300
1300
|
--snp: #f5dc00;
|
|
@@ -1314,7 +1314,7 @@ body {
|
|
|
1314
1314
|
--undeclared: #e7e7e7;
|
|
1315
1315
|
--con-2: #d4edff;
|
|
1316
1316
|
--lab-2: #ffdbd4;
|
|
1317
|
-
--libdem-2: #
|
|
1317
|
+
--libdem-2: #ffe2cd;
|
|
1318
1318
|
--green-2: #d3f2de;
|
|
1319
1319
|
--ukip-2: #ffe6f4;
|
|
1320
1320
|
--snp-2: #fff7c7;
|
|
@@ -2030,16 +2030,19 @@ body.android {
|
|
|
2030
2030
|
._tooltip_11t5d_1 {
|
|
2031
2031
|
pointer-events: none;
|
|
2032
2032
|
}
|
|
2033
|
-
.
|
|
2033
|
+
._text_lsh6d_1 {
|
|
2034
2034
|
color: var(--primary-text-color);
|
|
2035
2035
|
font-family: var(--text-sans);
|
|
2036
2036
|
font-size: var(--sans-small);
|
|
2037
2037
|
line-height: var(--sans-line-height);
|
|
2038
2038
|
font-weight: 700;
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
svg + ._text_lsh6d_1 {
|
|
2039
2042
|
margin-left: var(--space-1);
|
|
2040
2043
|
}
|
|
2041
2044
|
|
|
2042
|
-
.
|
|
2045
|
+
._container_lsh6d_13 {
|
|
2043
2046
|
font-weight: 700;
|
|
2044
2047
|
}
|
|
2045
2048
|
._wrapper_kh25l_1 {
|