@guardian/interactive-component-library 0.1.0-alpha.25 → 0.1.0-alpha.27
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.
|
@@ -1497,19 +1497,21 @@ function HeaderCell({
|
|
|
1497
1497
|
})]
|
|
1498
1498
|
});
|
|
1499
1499
|
}
|
|
1500
|
-
const slopeChartContainer = "
|
|
1501
|
-
const svg$2 = "
|
|
1502
|
-
const line$1 = "
|
|
1503
|
-
const
|
|
1504
|
-
const
|
|
1505
|
-
const
|
|
1506
|
-
const
|
|
1507
|
-
const
|
|
1508
|
-
const
|
|
1500
|
+
const slopeChartContainer = "_slopeChartContainer_nmjjj_1";
|
|
1501
|
+
const svg$2 = "_svg_nmjjj_5";
|
|
1502
|
+
const line$1 = "_line_nmjjj_9";
|
|
1503
|
+
const lineWhite = "_lineWhite_nmjjj_14";
|
|
1504
|
+
const circle = "_circle_nmjjj_19";
|
|
1505
|
+
const label = "_label_nmjjj_23";
|
|
1506
|
+
const y1Label = "_y1Label_nmjjj_29";
|
|
1507
|
+
const y2Label = "_y2Label_nmjjj_33";
|
|
1508
|
+
const axis$1 = "_axis_nmjjj_37";
|
|
1509
|
+
const axisLabel = "_axisLabel_nmjjj_42";
|
|
1509
1510
|
const defaultStyles$d = {
|
|
1510
1511
|
slopeChartContainer,
|
|
1511
1512
|
svg: svg$2,
|
|
1512
1513
|
line: line$1,
|
|
1514
|
+
lineWhite,
|
|
1513
1515
|
circle,
|
|
1514
1516
|
label,
|
|
1515
1517
|
y1Label,
|
|
@@ -1590,6 +1592,12 @@ const SlopeChart = ({
|
|
|
1590
1592
|
}, line2.styles);
|
|
1591
1593
|
return jsxs("g", {
|
|
1592
1594
|
children: [jsx("line", {
|
|
1595
|
+
x1: 0,
|
|
1596
|
+
y1: yScale(line2.y1),
|
|
1597
|
+
x2: contentWidth,
|
|
1598
|
+
y2: yScale(line2.y2),
|
|
1599
|
+
className: `${itemStyles.lineWhite}`
|
|
1600
|
+
}), jsx("line", {
|
|
1593
1601
|
x1: 0,
|
|
1594
1602
|
y1: yScale(line2.y1),
|
|
1595
1603
|
x2: contentWidth,
|
|
@@ -1950,10 +1958,10 @@ const ToplineResult = forwardRef(({
|
|
|
1950
1958
|
})]
|
|
1951
1959
|
});
|
|
1952
1960
|
});
|
|
1953
|
-
const section = "
|
|
1954
|
-
const borderTop = "
|
|
1955
|
-
const header = "
|
|
1956
|
-
const content = "
|
|
1961
|
+
const section = "_section_4s2t4_9";
|
|
1962
|
+
const borderTop = "_borderTop_4s2t4_52";
|
|
1963
|
+
const header = "_header_4s2t4_56";
|
|
1964
|
+
const content = "_content_4s2t4_77";
|
|
1957
1965
|
const defaultStyles$8 = {
|
|
1958
1966
|
section,
|
|
1959
1967
|
borderTop,
|
|
@@ -2046,13 +2054,13 @@ const ColumnChart = ({
|
|
|
2046
2054
|
})]
|
|
2047
2055
|
});
|
|
2048
2056
|
};
|
|
2049
|
-
const container$3 = "
|
|
2050
|
-
const img = "
|
|
2051
|
-
const title$2 = "
|
|
2052
|
-
const subtitle = "
|
|
2053
|
-
const small = "
|
|
2054
|
-
const blurb = "
|
|
2055
|
-
const footnote = "
|
|
2057
|
+
const container$3 = "_container_hbk39_1";
|
|
2058
|
+
const img = "_img_hbk39_5";
|
|
2059
|
+
const title$2 = "_title_hbk39_13";
|
|
2060
|
+
const subtitle = "_subtitle_hbk39_29";
|
|
2061
|
+
const small = "_small_hbk39_39";
|
|
2062
|
+
const blurb = "_blurb_hbk39_49";
|
|
2063
|
+
const footnote = "_footnote_hbk39_57";
|
|
2056
2064
|
const defaultStyles$6 = {
|
|
2057
2065
|
container: container$3,
|
|
2058
2066
|
img,
|
|
@@ -2073,6 +2081,7 @@ const PartyProfile = ({
|
|
|
2073
2081
|
blurb: blurb2,
|
|
2074
2082
|
footnote: footnote2,
|
|
2075
2083
|
imgSrc,
|
|
2084
|
+
imgAltText,
|
|
2076
2085
|
styles: styles2
|
|
2077
2086
|
}) => {
|
|
2078
2087
|
styles2 = mergeStyles({
|
|
@@ -2082,7 +2091,8 @@ const PartyProfile = ({
|
|
|
2082
2091
|
class: styles2.container,
|
|
2083
2092
|
children: [jsx("img", {
|
|
2084
2093
|
src: imgSrc,
|
|
2085
|
-
className: styles2.img
|
|
2094
|
+
className: styles2.img,
|
|
2095
|
+
alt: imgAltText
|
|
2086
2096
|
}), jsx("h3", {
|
|
2087
2097
|
className: styles2.title,
|
|
2088
2098
|
children: title2
|
|
@@ -3132,18 +3142,19 @@ function Modal({
|
|
|
3132
3142
|
})
|
|
3133
3143
|
}), document.body);
|
|
3134
3144
|
}
|
|
3135
|
-
const container = "
|
|
3136
|
-
const button$1 = "
|
|
3137
|
-
const icon = "
|
|
3138
|
-
const title$1 = "
|
|
3139
|
-
const popout = "
|
|
3140
|
-
const hint = "
|
|
3141
|
-
const
|
|
3142
|
-
const
|
|
3143
|
-
const
|
|
3144
|
-
const
|
|
3145
|
-
const
|
|
3146
|
-
const
|
|
3145
|
+
const container = "_container_1enis_1";
|
|
3146
|
+
const button$1 = "_button_1enis_6";
|
|
3147
|
+
const icon = "_icon_1enis_22";
|
|
3148
|
+
const title$1 = "_title_1enis_27";
|
|
3149
|
+
const popout = "_popout_1enis_34";
|
|
3150
|
+
const hint = "_hint_1enis_51";
|
|
3151
|
+
const groupHeader = "_groupHeader_1enis_58";
|
|
3152
|
+
const option = "_option_1enis_65";
|
|
3153
|
+
const optionIcon = "_optionIcon_1enis_86";
|
|
3154
|
+
const optionTitle = "_optionTitle_1enis_91";
|
|
3155
|
+
const optionDescription = "_optionDescription_1enis_99";
|
|
3156
|
+
const checkmark = "_checkmark_1enis_106";
|
|
3157
|
+
const checkmarkPath = "_checkmarkPath_1enis_112";
|
|
3147
3158
|
const styles$2 = {
|
|
3148
3159
|
container,
|
|
3149
3160
|
button: button$1,
|
|
@@ -3151,6 +3162,7 @@ const styles$2 = {
|
|
|
3151
3162
|
title: title$1,
|
|
3152
3163
|
popout,
|
|
3153
3164
|
hint,
|
|
3165
|
+
groupHeader,
|
|
3154
3166
|
option,
|
|
3155
3167
|
optionIcon,
|
|
3156
3168
|
optionTitle,
|
|
@@ -3175,10 +3187,29 @@ function Dropdown({
|
|
|
3175
3187
|
if (collapseOnSelect)
|
|
3176
3188
|
setExpanded(false);
|
|
3177
3189
|
}, [onSelect]);
|
|
3190
|
+
const optionGroups = useMemo(() => {
|
|
3191
|
+
const containsOptionGroups = "options" in options[0];
|
|
3192
|
+
if (!containsOptionGroups) {
|
|
3193
|
+
return [{
|
|
3194
|
+
options
|
|
3195
|
+
}];
|
|
3196
|
+
}
|
|
3197
|
+
let optionIndex = 0;
|
|
3198
|
+
for (const group2 of options) {
|
|
3199
|
+
for (const option2 of group2.options) {
|
|
3200
|
+
option2.index = optionIndex;
|
|
3201
|
+
optionIndex++;
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
return options;
|
|
3205
|
+
}, options);
|
|
3206
|
+
const flatOptions = useMemo(() => {
|
|
3207
|
+
return optionGroups.map((group2) => group2.options).flat();
|
|
3208
|
+
}, [optionGroups]);
|
|
3178
3209
|
const iconForSelectedOption = useMemo(() => {
|
|
3179
|
-
const selectedOption =
|
|
3210
|
+
const selectedOption = flatOptions[selectedIndex];
|
|
3180
3211
|
return selectedOption.icon;
|
|
3181
|
-
}, [
|
|
3212
|
+
}, [flatOptions, selectedIndex]);
|
|
3182
3213
|
return jsxs("div", {
|
|
3183
3214
|
className: styles$2.container,
|
|
3184
3215
|
children: [jsxs("button", {
|
|
@@ -3203,9 +3234,28 @@ function Dropdown({
|
|
|
3203
3234
|
children: [hint2 && jsx("p", {
|
|
3204
3235
|
className: styles$2.hint,
|
|
3205
3236
|
children: hint2
|
|
3206
|
-
}),
|
|
3237
|
+
}), optionGroups.map((group2) => jsx(OptionGroup, {
|
|
3238
|
+
...group2,
|
|
3239
|
+
selectedIndex,
|
|
3240
|
+
onOptionClick
|
|
3241
|
+
}))]
|
|
3242
|
+
})]
|
|
3243
|
+
});
|
|
3244
|
+
}
|
|
3245
|
+
function OptionGroup({
|
|
3246
|
+
title: title2,
|
|
3247
|
+
options,
|
|
3248
|
+
selectedIndex,
|
|
3249
|
+
onOptionClick
|
|
3250
|
+
}) {
|
|
3251
|
+
return jsxs(Fragment, {
|
|
3252
|
+
children: [title2 && jsx("span", {
|
|
3253
|
+
className: styles$2.groupHeader,
|
|
3254
|
+
children: title2
|
|
3255
|
+
}), options.map((option2) => {
|
|
3256
|
+
return jsxs("button", {
|
|
3207
3257
|
className: styles$2.option,
|
|
3208
|
-
onClick: () => onOptionClick(option2,
|
|
3258
|
+
onClick: () => onOptionClick(option2, option2.index),
|
|
3209
3259
|
children: [jsx("img", {
|
|
3210
3260
|
src: option2.icon,
|
|
3211
3261
|
className: styles$2.optionIcon
|
|
@@ -3218,11 +3268,11 @@ function Dropdown({
|
|
|
3218
3268
|
className: styles$2.optionDescription,
|
|
3219
3269
|
children: option2.description
|
|
3220
3270
|
})]
|
|
3221
|
-
}),
|
|
3271
|
+
}), option2.index === selectedIndex && jsx("div", {
|
|
3222
3272
|
className: styles$2.checkmark,
|
|
3223
3273
|
children: jsx(Checkmark, {})
|
|
3224
3274
|
})]
|
|
3225
|
-
}, option2.title)
|
|
3275
|
+
}, option2.title);
|
|
3226
3276
|
})]
|
|
3227
3277
|
});
|
|
3228
3278
|
}
|