@guardian/interactive-component-library 0.1.0-alpha.26 → 0.1.0-alpha.28
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.
|
@@ -207,8 +207,9 @@ function StackedBar({
|
|
|
207
207
|
labelType = LabelType.inline,
|
|
208
208
|
showBackgroundRect = false,
|
|
209
209
|
createSVG = true,
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
labelOverlapConfig = LabelOverlapConfig,
|
|
211
|
+
border = false,
|
|
212
|
+
styles: styles2
|
|
212
213
|
}) {
|
|
213
214
|
const rectElements = useRef([]);
|
|
214
215
|
const textElements = useRef([]);
|
|
@@ -216,6 +217,9 @@ function StackedBar({
|
|
|
216
217
|
...defaultStyles$t
|
|
217
218
|
}, styles2);
|
|
218
219
|
const svgHeight = labelType === LabelType.hanging && !hideLabels ? height + 20 : height;
|
|
220
|
+
const cleanBorderAbbr = (abbrText) => {
|
|
221
|
+
return abbrText.split("-")[0];
|
|
222
|
+
};
|
|
219
223
|
const renderLabel = (config, i) => jsx("text", {
|
|
220
224
|
ref: (element) => textElements.current[i] = element,
|
|
221
225
|
"text-rendering": "optimizeLegibility",
|
|
@@ -245,11 +249,12 @@ function StackedBar({
|
|
|
245
249
|
ref: (element) => rectElements.current[index2] = element,
|
|
246
250
|
width: itemWidth,
|
|
247
251
|
height,
|
|
248
|
-
className: `${styles2.bar} fill-color--${d2.abbreviation}`,
|
|
252
|
+
className: `${styles2.bar} fill-color--${d2.abbreviation} ${border && "stroke-color--" + cleanBorderAbbr(d2.abbreviation)}`,
|
|
249
253
|
style: {
|
|
250
254
|
fill: d2.fill
|
|
251
255
|
},
|
|
252
256
|
"shape-rendering": "crispEdges"
|
|
257
|
+
// stroke={border && var()}
|
|
253
258
|
}), labelType === LabelType.inline && !hideLabels && renderLabel(labelConfig, index2)]
|
|
254
259
|
}, index2);
|
|
255
260
|
totalWidth += itemWidth;
|
|
@@ -1497,19 +1502,21 @@ function HeaderCell({
|
|
|
1497
1502
|
})]
|
|
1498
1503
|
});
|
|
1499
1504
|
}
|
|
1500
|
-
const slopeChartContainer = "
|
|
1501
|
-
const svg$2 = "
|
|
1502
|
-
const line$1 = "
|
|
1503
|
-
const
|
|
1504
|
-
const
|
|
1505
|
-
const
|
|
1506
|
-
const
|
|
1507
|
-
const
|
|
1508
|
-
const
|
|
1505
|
+
const slopeChartContainer = "_slopeChartContainer_nmjjj_1";
|
|
1506
|
+
const svg$2 = "_svg_nmjjj_5";
|
|
1507
|
+
const line$1 = "_line_nmjjj_9";
|
|
1508
|
+
const lineWhite = "_lineWhite_nmjjj_14";
|
|
1509
|
+
const circle = "_circle_nmjjj_19";
|
|
1510
|
+
const label = "_label_nmjjj_23";
|
|
1511
|
+
const y1Label = "_y1Label_nmjjj_29";
|
|
1512
|
+
const y2Label = "_y2Label_nmjjj_33";
|
|
1513
|
+
const axis$1 = "_axis_nmjjj_37";
|
|
1514
|
+
const axisLabel = "_axisLabel_nmjjj_42";
|
|
1509
1515
|
const defaultStyles$d = {
|
|
1510
1516
|
slopeChartContainer,
|
|
1511
1517
|
svg: svg$2,
|
|
1512
1518
|
line: line$1,
|
|
1519
|
+
lineWhite,
|
|
1513
1520
|
circle,
|
|
1514
1521
|
label,
|
|
1515
1522
|
y1Label,
|
|
@@ -1590,6 +1597,12 @@ const SlopeChart = ({
|
|
|
1590
1597
|
}, line2.styles);
|
|
1591
1598
|
return jsxs("g", {
|
|
1592
1599
|
children: [jsx("line", {
|
|
1600
|
+
x1: 0,
|
|
1601
|
+
y1: yScale(line2.y1),
|
|
1602
|
+
x2: contentWidth,
|
|
1603
|
+
y2: yScale(line2.y2),
|
|
1604
|
+
className: `${itemStyles.lineWhite}`
|
|
1605
|
+
}), jsx("line", {
|
|
1593
1606
|
x1: 0,
|
|
1594
1607
|
y1: yScale(line2.y1),
|
|
1595
1608
|
x2: contentWidth,
|
|
@@ -1950,10 +1963,10 @@ const ToplineResult = forwardRef(({
|
|
|
1950
1963
|
})]
|
|
1951
1964
|
});
|
|
1952
1965
|
});
|
|
1953
|
-
const section = "
|
|
1954
|
-
const borderTop = "
|
|
1955
|
-
const header = "
|
|
1956
|
-
const content = "
|
|
1966
|
+
const section = "_section_4s2t4_9";
|
|
1967
|
+
const borderTop = "_borderTop_4s2t4_52";
|
|
1968
|
+
const header = "_header_4s2t4_56";
|
|
1969
|
+
const content = "_content_4s2t4_77";
|
|
1957
1970
|
const defaultStyles$8 = {
|
|
1958
1971
|
section,
|
|
1959
1972
|
borderTop,
|
|
@@ -2046,13 +2059,13 @@ const ColumnChart = ({
|
|
|
2046
2059
|
})]
|
|
2047
2060
|
});
|
|
2048
2061
|
};
|
|
2049
|
-
const container$3 = "
|
|
2050
|
-
const img = "
|
|
2051
|
-
const title$2 = "
|
|
2052
|
-
const subtitle = "
|
|
2053
|
-
const small = "
|
|
2054
|
-
const blurb = "
|
|
2055
|
-
const footnote = "
|
|
2062
|
+
const container$3 = "_container_hbk39_1";
|
|
2063
|
+
const img = "_img_hbk39_5";
|
|
2064
|
+
const title$2 = "_title_hbk39_13";
|
|
2065
|
+
const subtitle = "_subtitle_hbk39_29";
|
|
2066
|
+
const small = "_small_hbk39_39";
|
|
2067
|
+
const blurb = "_blurb_hbk39_49";
|
|
2068
|
+
const footnote = "_footnote_hbk39_57";
|
|
2056
2069
|
const defaultStyles$6 = {
|
|
2057
2070
|
container: container$3,
|
|
2058
2071
|
img,
|
|
@@ -2073,6 +2086,7 @@ const PartyProfile = ({
|
|
|
2073
2086
|
blurb: blurb2,
|
|
2074
2087
|
footnote: footnote2,
|
|
2075
2088
|
imgSrc,
|
|
2089
|
+
imgAltText,
|
|
2076
2090
|
styles: styles2
|
|
2077
2091
|
}) => {
|
|
2078
2092
|
styles2 = mergeStyles({
|
|
@@ -2082,7 +2096,8 @@ const PartyProfile = ({
|
|
|
2082
2096
|
class: styles2.container,
|
|
2083
2097
|
children: [jsx("img", {
|
|
2084
2098
|
src: imgSrc,
|
|
2085
|
-
className: styles2.img
|
|
2099
|
+
className: styles2.img,
|
|
2100
|
+
alt: imgAltText
|
|
2086
2101
|
}), jsx("h3", {
|
|
2087
2102
|
className: styles2.title,
|
|
2088
2103
|
children: title2
|
|
@@ -3239,7 +3254,7 @@ function OptionGroup({
|
|
|
3239
3254
|
onOptionClick
|
|
3240
3255
|
}) {
|
|
3241
3256
|
return jsxs(Fragment, {
|
|
3242
|
-
children: [title2 && jsx("
|
|
3257
|
+
children: [title2 && jsx("span", {
|
|
3243
3258
|
className: styles$2.groupHeader,
|
|
3244
3259
|
children: title2
|
|
3245
3260
|
}), options.map((option2) => {
|