@guardian/interactive-component-library 0.7.12 → 0.7.13

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);
@@ -1,10 +1,10 @@
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_1y4nt_1";
2
+ const img = "_img_1y4nt_5";
3
+ const title = "_title_1y4nt_15";
4
+ const subtitle = "_subtitle_1y4nt_31";
5
+ const small = "_small_1y4nt_41";
6
+ const blurb = "_blurb_1y4nt_51";
7
+ const footnote = "_footnote_1y4nt_59";
8
8
  const defaultStyles = {
9
9
  container,
10
10
  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,19 +2393,21 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2390
2393
 
2391
2394
  ._bar_1ci1k_10 {
2392
2395
  }
2393
- ._container_hbk39_1 {
2396
+ ._container_1y4nt_1 {
2394
2397
  font-weight: 700;
2395
2398
  }
2396
2399
 
2397
- ._img_hbk39_5 {
2398
- height: 140px;
2399
- width: 140px;
2400
+ ._img_1y4nt_5 {
2401
+ height: 130px;
2402
+ width: 130px;
2400
2403
  border-radius: 50%;
2401
2404
  float: right;
2405
+ margin-top: var(--space-1);
2402
2406
  margin-left: var(--space-2);
2407
+ margin-right: var(--space-1);
2403
2408
  }
2404
2409
 
2405
- ._title_hbk39_13 {
2410
+ ._title_1y4nt_15 {
2406
2411
  font-family: var(--text-headline);
2407
2412
  font-size: var(--headline-xsmall);
2408
2413
  color: var(--primary-text-color);
@@ -2418,7 +2423,7 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2418
2423
  }
2419
2424
  }
2420
2425
 
2421
- ._subtitle_hbk39_29 {
2426
+ ._subtitle_1y4nt_31 {
2422
2427
  font-family: var(--text-headline);
2423
2428
  font-size: var(--headline-xsmall);
2424
2429
  color: var(--primary-text-color);
@@ -2428,7 +2433,7 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2428
2433
  margin-bottom: 6px;
2429
2434
  }
2430
2435
 
2431
- ._small_hbk39_39 {
2436
+ ._small_1y4nt_41 {
2432
2437
  font-family: var(--text-serif);
2433
2438
  font-size: var(--body-small);
2434
2439
  line-height: var(--body-line-height);
@@ -2438,7 +2443,7 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2438
2443
  margin-top: var(--space-1);
2439
2444
  }
2440
2445
 
2441
- ._blurb_hbk39_49 {
2446
+ ._blurb_1y4nt_51 {
2442
2447
  font-family: var(--text-serif);
2443
2448
  font-size: var(--body-small);
2444
2449
  line-height: var(--body-line-height);
@@ -2446,7 +2451,7 @@ body ._header_1xpz0_150._fullWidth_1xpz0_39 {
2446
2451
  font-weight: 300;
2447
2452
  }
2448
2453
 
2449
- ._footnote_hbk39_57 {
2454
+ ._footnote_1y4nt_59 {
2450
2455
  font-family: var(--text-serif);
2451
2456
  font-size: var(--body-small);
2452
2457
  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.13",
5
5
  "packageManager": "pnpm@8.4.0",
6
6
  "repository": {
7
7
  "type": "git",