@guardian/interactive-component-library 0.7.12 → 0.7.14

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.
@@ -18,6 +18,14 @@ const ColumnChart = ({
18
18
  let marginBottom = minValue < 0 ? 0 : 40;
19
19
  return /* @__PURE__ */ jsxs("svg", { width: chartWidth, height: chartHeight + marginBottom, children: [
20
20
  columns.map((column, index) => {
21
+ let columnLabel;
22
+ if (typeof column.label === "string") {
23
+ columnLabel = column.label;
24
+ } else if (typeof column.label === "function") {
25
+ columnLabel = column.label();
26
+ } else {
27
+ throw new Error("Invalid column label type");
28
+ }
21
29
  const getHeight = (input) => {
22
30
  return yScale(0) - yScale(input);
23
31
  };
@@ -40,7 +48,7 @@ const ColumnChart = ({
40
48
  className: styles.text,
41
49
  x: index * totalColumnWidth + 2,
42
50
  y: column.value < 0 ? yScale(0) - 6 : yScale(0) + 20,
43
- children: column.label
51
+ children: columnLabel
44
52
  }
45
53
  )
46
54
  ] }, index);
@@ -17,11 +17,13 @@ const PartyProfile = ({
17
17
  }) => {
18
18
  styles = mergeStyles({ ...defaultStyles }, styles);
19
19
  return /* @__PURE__ */ jsxs("div", { className: styles.container, children: [
20
- /* @__PURE__ */ jsx("img", { src: imgSrc, className: styles.img, alt: imgAltText }),
21
- /* @__PURE__ */ jsx("h3", { className: styles.title, children: title }),
22
- /* @__PURE__ */ jsx("div", { className: [styles.subtitle, styles[subtitleStyle]].join(" "), children: subtitle }),
23
- /* @__PURE__ */ jsx("div", { className: styles.blurb, children: blurb }),
24
- /* @__PURE__ */ jsx("div", { className: styles.footnote, children: footnote })
20
+ /* @__PURE__ */ jsxs("div", { className: styles.copyColumn, children: [
21
+ /* @__PURE__ */ jsx("h3", { className: styles.title, children: title }),
22
+ /* @__PURE__ */ jsx("div", { className: [styles.subtitle, styles[subtitleStyle]].join(" "), children: subtitle }),
23
+ /* @__PURE__ */ jsx("div", { className: styles.blurb, children: blurb }),
24
+ /* @__PURE__ */ jsx("div", { className: styles.footnote, children: footnote })
25
+ ] }),
26
+ /* @__PURE__ */ jsx("img", { src: imgSrc, className: styles.img, alt: imgAltText })
25
27
  ] });
26
28
  };
27
29
  export {
@@ -1,12 +1,14 @@
1
- const container = "_container_hbk39_1";
2
- const img = "_img_hbk39_5";
3
- const title = "_title_hbk39_13";
4
- const subtitle = "_subtitle_hbk39_29";
5
- const small = "_small_hbk39_39";
6
- const blurb = "_blurb_hbk39_49";
7
- const footnote = "_footnote_hbk39_57";
1
+ const container = "_container_1nqng_1";
2
+ const copyColumn = "_copyColumn_1nqng_6";
3
+ const img = "_img_1nqng_10";
4
+ const title = "_title_1nqng_20";
5
+ const subtitle = "_subtitle_1nqng_36";
6
+ const small = "_small_1nqng_46";
7
+ const blurb = "_blurb_1nqng_56";
8
+ const footnote = "_footnote_1nqng_64";
8
9
  const defaultStyles = {
9
10
  container,
11
+ copyColumn,
10
12
  img,
11
13
  title,
12
14
  subtitle,
@@ -17,6 +19,7 @@ const defaultStyles = {
17
19
  export {
18
20
  blurb,
19
21
  container,
22
+ copyColumn,
20
23
  defaultStyles as default,
21
24
  footnote,
22
25
  img,
@@ -33,16 +33,10 @@ const ToplineResult = forwardRef(
33
33
  onMouseOut,
34
34
  ref,
35
35
  children: [
36
- /* @__PURE__ */ jsxs("div", { className: styles.topRow, children: [
37
- /* @__PURE__ */ jsx(
38
- "span",
39
- {
40
- className: `${styles.primaryname} before-color--${abbreviation}`,
41
- children: name
42
- }
43
- ),
36
+ /* @__PURE__ */ jsx("div", { className: `${styles.topRow} before-color--${abbreviation}`, children: /* @__PURE__ */ jsxs("span", { className: styles.primaryname, children: [
37
+ name,
44
38
  showInfoButton && /* @__PURE__ */ jsx("span", { className: styles.infoButton, children: /* @__PURE__ */ jsx(InfoButton, { onClick: onInfoPress, ref: infoButtonRef }) })
45
- ] }),
39
+ ] }) }),
46
40
  secondaryName && /* @__PURE__ */ jsx("div", { className: styles.subhead, children: /* @__PURE__ */ jsx("span", { className: styles.secondaryname, children: secondaryName }) }),
47
41
  /* @__PURE__ */ jsxs("div", { className: `${styles.displayNumbers} ${displayStyle}`, children: [
48
42
  /* @__PURE__ */ jsxs("div", { className: styles.mainNumber, children: [
@@ -1,17 +1,19 @@
1
- const toplineResult = "_toplineResult_1su0d_9";
2
- const primaryname = "_primaryname_1su0d_15";
3
- const secondaryname = "_secondaryname_1su0d_31";
4
- const name = "_name_1su0d_39";
5
- const displayNumbers = "_displayNumbers_1su0d_54";
6
- const mainNumber = "_mainNumber_1su0d_69";
7
- const mainNumberSuffix = "_mainNumberSuffix_1su0d_75";
8
- const secondaryNumber = "_secondaryNumber_1su0d_79";
9
- const displayRow = "_displayRow_1su0d_84";
10
- const displayColumn = "_displayColumn_1su0d_91";
11
- const topRow = "_topRow_1su0d_95";
1
+ const toplineResult = "_toplineResult_o4gtd_9";
2
+ const primaryname = "_primaryname_o4gtd_15";
3
+ const infoButton = "_infoButton_o4gtd_27";
4
+ const secondaryname = "_secondaryname_o4gtd_31";
5
+ const name = "_name_o4gtd_39";
6
+ const displayNumbers = "_displayNumbers_o4gtd_54";
7
+ const mainNumber = "_mainNumber_o4gtd_69";
8
+ const mainNumberSuffix = "_mainNumberSuffix_o4gtd_75";
9
+ const secondaryNumber = "_secondaryNumber_o4gtd_79";
10
+ const displayRow = "_displayRow_o4gtd_84";
11
+ const displayColumn = "_displayColumn_o4gtd_91";
12
+ const topRow = "_topRow_o4gtd_95";
12
13
  const defaultStyles = {
13
14
  toplineResult,
14
15
  primaryname,
16
+ infoButton,
15
17
  secondaryname,
16
18
  name,
17
19
  displayNumbers,
@@ -27,6 +29,7 @@ export {
27
29
  displayColumn,
28
30
  displayNumbers,
29
31
  displayRow,
32
+ infoButton,
30
33
  mainNumber,
31
34
  mainNumberSuffix,
32
35
  name,
package/dist/style.css CHANGED
@@ -2074,29 +2074,29 @@ body.android {
2074
2074
  --top-inset: 58px;
2075
2075
  }
2076
2076
 
2077
- ._toplineResult_1su0d_9 {
2077
+ ._toplineResult_o4gtd_9 {
2078
2078
  width: fit-content;
2079
2079
  display: flex;
2080
2080
  flex-direction: column;
2081
2081
  }
2082
2082
 
2083
- ._primaryname_1su0d_15 {
2083
+ ._primaryname_o4gtd_15 {
2084
2084
  color: var(--primary-text-color);
2085
2085
  font-family: var(--text-headline);
2086
2086
  font-size: var(--headline-xxxsmall);
2087
2087
  line-height: var(--headline-line-height);
2088
2088
  font-weight: 500;
2089
2089
  font-style: italic;
2090
+ display: inline-flex;
2091
+ align-items: center;
2092
+ gap: var(--space-1);
2090
2093
  }
2091
- ._primaryname_1su0d_15:before {
2092
- content: "";
2093
- height: 4px;
2094
- width: 2.2em;
2095
- border-radius: 50px;
2096
- display: block;
2094
+
2095
+ ._infoButton_o4gtd_27 {
2096
+ padding-top: var(--space-1);
2097
2097
  }
2098
2098
 
2099
- ._secondaryname_1su0d_31 {
2099
+ ._secondaryname_o4gtd_31 {
2100
2100
  color: var(--primary-text-color);
2101
2101
  font-family: var(--text-headline);
2102
2102
  font-size: var(--headline-xxxsmall);
@@ -2104,14 +2104,14 @@ body.android {
2104
2104
  line-height: var(--headline-line-height);
2105
2105
  }
2106
2106
 
2107
- ._name_1su0d_39 {
2107
+ ._name_o4gtd_39 {
2108
2108
  color: var(--primary-text-color);
2109
2109
  font-family: var(--text-headline);
2110
2110
  font-size: var(--headline-xxxsmall);
2111
2111
  line-height: var(--headline-line-height);
2112
2112
  font-weight: 500;
2113
2113
  }
2114
- ._name_1su0d_39:before {
2114
+ ._name_o4gtd_39:before {
2115
2115
  content: "";
2116
2116
  height: 4px;
2117
2117
  width: 2.2em;
@@ -2119,7 +2119,7 @@ body.android {
2119
2119
  display: block;
2120
2120
  }
2121
2121
 
2122
- ._displayNumbers_1su0d_54 {
2122
+ ._displayNumbers_o4gtd_54 {
2123
2123
  display: flex;
2124
2124
  align-items: baseline;
2125
2125
  margin-top: auto;
@@ -2130,51 +2130,54 @@ body.android {
2130
2130
  font-feature-settings: "lnum";
2131
2131
  line-height: var(--titlepiece-line-height);
2132
2132
  }
2133
- ._displayNumbers_1su0d_54 > div {
2133
+ ._displayNumbers_o4gtd_54 > div {
2134
2134
  flex-shrink: 0;
2135
2135
  }
2136
2136
 
2137
- ._mainNumber_1su0d_69 {
2137
+ ._mainNumber_o4gtd_69 {
2138
2138
  color: var(--primary-text-color);
2139
2139
  font-size: var(--titlepiece-xsmall);
2140
2140
  white-space: nowrap;
2141
2141
  }
2142
2142
 
2143
- ._mainNumberSuffix_1su0d_75 {
2143
+ ._mainNumberSuffix_o4gtd_75 {
2144
2144
  font-size: var(--titlepiece-xxxsmall);
2145
2145
  }
2146
2146
 
2147
- ._secondaryNumber_1su0d_79 {
2147
+ ._secondaryNumber_o4gtd_79 {
2148
2148
  color: var(--secondary-text-color-alt);
2149
2149
  font-size: var(--titlepiece-xxsmall);
2150
2150
  }
2151
2151
 
2152
- ._displayRow_1su0d_84 {
2152
+ ._displayRow_o4gtd_84 {
2153
2153
  flex-direction: row;
2154
2154
  }
2155
- ._displayRow_1su0d_84 ._mainNumber_1su0d_69 {
2155
+ ._displayRow_o4gtd_84 ._mainNumber_o4gtd_69 {
2156
2156
  margin-right: var(--space-0);
2157
2157
  }
2158
2158
 
2159
- ._displayColumn_1su0d_91 {
2159
+ ._displayColumn_o4gtd_91 {
2160
2160
  flex-direction: column;
2161
2161
  }
2162
2162
 
2163
- ._topRow_1su0d_95 {
2163
+ ._topRow_o4gtd_95 {
2164
2164
  width: fit-content;
2165
2165
  padding-bottom: 1px;
2166
- display: flex;
2167
- flex-direction: row;
2168
2166
  column-gap: var(--space-1);
2169
2167
  align-items: flex-end;
2170
2168
  }
2171
2169
  @media (min-width: 61.25em) {
2172
- ._topRow_1su0d_95 {
2170
+ ._topRow_o4gtd_95 {
2173
2171
  border-bottom: none;
2174
2172
  }
2175
2173
  }
2176
- ._topRow_1su0d_95 > * {
2174
+ ._topRow_o4gtd_95:before {
2175
+ content: "";
2176
+ height: 4px;
2177
+ width: 2.2em;
2178
+ border-radius: 50px;
2177
2179
  display: block;
2180
+ margin-bottom: 2px;
2178
2181
  }body {
2179
2182
  --top-inset: 0;
2180
2183
  }
@@ -2390,24 +2393,31 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2390
2393
 
2391
2394
  ._bar_1ci1k_10 {
2392
2395
  }
2393
- ._container_hbk39_1 {
2396
+ ._container_1nqng_1 {
2394
2397
  font-weight: 700;
2398
+ display: flex;
2395
2399
  }
2396
2400
 
2397
- ._img_hbk39_5 {
2398
- height: 140px;
2399
- width: 140px;
2401
+ ._copyColumn_1nqng_6 {
2402
+ display: block;
2403
+ }
2404
+
2405
+ ._img_1nqng_10 {
2406
+ height: 130px;
2407
+ width: 130px;
2400
2408
  border-radius: 50%;
2401
2409
  float: right;
2410
+ margin-top: var(--space-1);
2402
2411
  margin-left: var(--space-2);
2412
+ margin-right: var(--space-1);
2403
2413
  }
2404
2414
 
2405
- ._title_hbk39_13 {
2415
+ ._title_1nqng_20 {
2406
2416
  font-family: var(--text-headline);
2407
2417
  font-size: var(--headline-xsmall);
2408
2418
  color: var(--primary-text-color);
2409
2419
  font-weight: 500;
2410
- line-height: 1.1;
2420
+ line-height: 1.2;
2411
2421
 
2412
2422
  &:before {
2413
2423
  content: "";
@@ -2418,17 +2428,17 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2418
2428
  }
2419
2429
  }
2420
2430
 
2421
- ._subtitle_hbk39_29 {
2431
+ ._subtitle_1nqng_36 {
2422
2432
  font-family: var(--text-headline);
2423
2433
  font-size: var(--headline-xsmall);
2424
2434
  color: var(--primary-text-color);
2425
- line-height: var(--body-line-height);
2435
+ line-height: 1.2;
2426
2436
  font-style: italic;
2427
2437
  font-weight: 500;
2428
2438
  margin-bottom: 6px;
2429
2439
  }
2430
2440
 
2431
- ._small_hbk39_39 {
2441
+ ._small_1nqng_46 {
2432
2442
  font-family: var(--text-serif);
2433
2443
  font-size: var(--body-small);
2434
2444
  line-height: var(--body-line-height);
@@ -2438,7 +2448,7 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2438
2448
  margin-top: var(--space-1);
2439
2449
  }
2440
2450
 
2441
- ._blurb_hbk39_49 {
2451
+ ._blurb_1nqng_56 {
2442
2452
  font-family: var(--text-serif);
2443
2453
  font-size: var(--body-small);
2444
2454
  line-height: var(--body-line-height);
@@ -2446,7 +2456,7 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2446
2456
  font-weight: 300;
2447
2457
  }
2448
2458
 
2449
- ._footnote_hbk39_57 {
2459
+ ._footnote_1nqng_64 {
2450
2460
  font-family: var(--text-serif);
2451
2461
  font-size: var(--body-small);
2452
2462
  line-height: var(--body-line-height);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@guardian/interactive-component-library",
3
3
  "private": false,
4
- "version": "0.7.12",
4
+ "version": "0.7.14",
5
5
  "packageManager": "pnpm@8.4.0",
6
6
  "repository": {
7
7
  "type": "git",