@guardian/interactive-component-library 0.1.0-alpha.27 → 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
- styles: styles2,
211
- labelOverlapConfig = LabelOverlapConfig
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;