@react-magma/charts 14.2.1 → 15.0.0-next.0

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.
Files changed (87) hide show
  1. package/dist/charts.js +1511 -111
  2. package/dist/charts.js.map +1 -1
  3. package/dist/charts.modern.module.js +1513 -114
  4. package/dist/charts.modern.module.js.map +1 -1
  5. package/dist/charts.umd.js +48975 -28130
  6. package/dist/charts.umd.js.map +1 -1
  7. package/dist/components/CarbonChart/CarbonChart.d.ts +1 -1
  8. package/dist/components/CarbonChart/CarbonChartArea.stories.d.ts +310 -0
  9. package/dist/components/CarbonChart/CarbonChartAreaStacked.stories.d.ts +136 -0
  10. package/dist/components/CarbonChart/CarbonChartBar.stories.d.ts +232 -0
  11. package/dist/components/CarbonChart/CarbonChartBarFloating.stories.d.ts +82 -0
  12. package/dist/components/CarbonChart/CarbonChartBarGrouped.stories.d.ts +234 -0
  13. package/dist/components/CarbonChart/CarbonChartBarStacked.stories.d.ts +266 -0
  14. package/dist/components/CarbonChart/CarbonChartBoxplot.stories.d.ts +53 -0
  15. package/dist/components/CarbonChart/CarbonChartBubble.stories.d.ts +196 -0
  16. package/dist/components/CarbonChart/CarbonChartBullet.stories.d.ts +35 -0
  17. package/dist/components/CarbonChart/CarbonChartCombo.stories.d.ts +580 -0
  18. package/dist/components/CarbonChart/CarbonChartDonut.stories.d.ts +120 -0
  19. package/dist/components/CarbonChart/CarbonChartGauge.stories.d.ts +43 -0
  20. package/dist/components/CarbonChart/CarbonChartHistogram.stories.d.ts +89 -0
  21. package/dist/components/CarbonChart/CarbonChartLine.stories.d.ts +577 -0
  22. package/dist/components/CarbonChart/CarbonChartLollipop.stories.d.ts +55 -0
  23. package/dist/components/CarbonChart/CarbonChartMeter.stories.d.ts +127 -0
  24. package/dist/components/CarbonChart/CarbonChartPie.stories.d.ts +101 -0
  25. package/dist/components/CarbonChart/CarbonChartRadar.stories.d.ts +98 -0
  26. package/dist/components/CarbonChart/CarbonChartScatter.stories.d.ts +173 -0
  27. package/dist/components/CarbonChart/CarbonChartSparkline.stories.d.ts +51 -0
  28. package/dist/components/CarbonChart/CarbonChartStep.stories.d.ts +38 -0
  29. package/dist/components/ChartTable/ChartTable.stories.d.ts +166 -0
  30. package/dist/components/LineChart/Chart.d.ts +27 -0
  31. package/dist/components/LineChart/ChartDataTable.d.ts +17 -0
  32. package/dist/components/LineChart/CustomAxisComponent.d.ts +3 -0
  33. package/dist/components/LineChart/CustomPointComponent.d.ts +17 -0
  34. package/dist/components/LineChart/DataTable.d.ts +5 -0
  35. package/dist/components/LineChart/GraphTooltip.d.ts +3 -0
  36. package/dist/components/LineChart/LegendButton.d.ts +6 -0
  37. package/dist/components/LineChart/LineChart.d.ts +67 -0
  38. package/dist/components/LineChart/LineChart.stories.d.ts +113 -0
  39. package/dist/components/LineChart/index.d.ts +1 -0
  40. package/dist/components/LineChart/magma-charts.d.ts +1 -0
  41. package/dist/index.d.ts +1 -0
  42. package/package.json +19 -22
  43. package/src/components/CarbonChart/CarbonChart.test.js +185 -172
  44. package/src/components/CarbonChart/CarbonChart.tsx +19 -18
  45. package/src/components/CarbonChart/CarbonChartArea.stories.tsx +5 -3
  46. package/src/components/CarbonChart/CarbonChartAreaStacked.stories.tsx +5 -3
  47. package/src/components/CarbonChart/CarbonChartBar.stories.tsx +5 -3
  48. package/src/components/CarbonChart/CarbonChartBarFloating.stories.tsx +5 -3
  49. package/src/components/CarbonChart/CarbonChartBarGrouped.stories.tsx +5 -3
  50. package/src/components/CarbonChart/CarbonChartBarStacked.stories.tsx +5 -3
  51. package/src/components/CarbonChart/CarbonChartBoxplot.stories.tsx +5 -3
  52. package/src/components/CarbonChart/CarbonChartBubble.stories.tsx +5 -3
  53. package/src/components/CarbonChart/CarbonChartBullet.stories.tsx +5 -3
  54. package/src/components/CarbonChart/CarbonChartCombo.stories.tsx +5 -3
  55. package/src/components/CarbonChart/CarbonChartDonut.stories.tsx +5 -3
  56. package/src/components/CarbonChart/CarbonChartGauge.stories.tsx +5 -3
  57. package/src/components/CarbonChart/CarbonChartHistogram.stories.tsx +5 -3
  58. package/src/components/CarbonChart/CarbonChartLine.stories.tsx +5 -3
  59. package/src/components/CarbonChart/CarbonChartLollipop.stories.tsx +5 -3
  60. package/src/components/CarbonChart/CarbonChartMeter.stories.tsx +5 -3
  61. package/src/components/CarbonChart/CarbonChartPie.stories.tsx +5 -3
  62. package/src/components/CarbonChart/CarbonChartRadar.stories.tsx +5 -3
  63. package/src/components/CarbonChart/CarbonChartScatter.stories.tsx +5 -3
  64. package/src/components/CarbonChart/CarbonChartSparkline.stories.tsx +5 -3
  65. package/src/components/CarbonChart/CarbonChartStep.stories.tsx +5 -3
  66. package/src/components/ChartTable/ChartDataTable.tsx +0 -3
  67. package/src/components/ChartTable/ChartMoreOptionsButton.tsx +0 -1
  68. package/src/components/ChartTable/ChartTable.test.js +0 -8
  69. package/src/components/ChartTable/ChartTableButton.tsx +0 -1
  70. package/src/components/ChartTable/ChartToolbar.tsx +0 -1
  71. package/src/components/ChartTable/chartToolbarI18n.ts +1 -1
  72. package/src/components/LineChart/Chart.tsx +241 -0
  73. package/src/components/LineChart/ChartDataTable.test.js +165 -0
  74. package/src/components/LineChart/ChartDataTable.tsx +135 -0
  75. package/src/components/LineChart/CustomAxisComponent.tsx +30 -0
  76. package/src/components/LineChart/CustomPointComponent.tsx +93 -0
  77. package/src/components/LineChart/DataTable.tsx +57 -0
  78. package/src/components/LineChart/GraphTooltip.tsx +100 -0
  79. package/src/components/LineChart/LegendButton.tsx +77 -0
  80. package/src/components/LineChart/LineChart.stories.tsx +399 -0
  81. package/src/components/LineChart/LineChart.test.js +501 -0
  82. package/src/components/LineChart/LineChart.tsx +669 -0
  83. package/src/components/LineChart/index.ts +1 -0
  84. package/src/components/LineChart/magma-charts.ts +279 -0
  85. package/src/components/LineChart/test/exampleChartData.js +289 -0
  86. package/src/hooks/useCarbonModalFocusManagement.ts +0 -12
  87. package/src/index.ts +1 -0
package/dist/charts.js CHANGED
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var chartsReact = require('@carbon/charts-react');
5
- var styled = require('@emotion/styled');
4
+ var react = require('@emotion/react');
6
5
  var reactMagmaDom = require('react-magma-dom');
7
6
  var reactMagmaIcons = require('react-magma-icons');
7
+ var styled = require('@emotion/styled');
8
+ var victory = require('victory');
9
+ var chartsReact = require('@carbon/charts-react');
8
10
 
9
11
  function _interopNamespaceDefault(e) {
10
12
  var n = Object.create(null);
@@ -65,14 +67,13 @@ function __rest(s, e) {
65
67
  return t;
66
68
  }
67
69
 
68
- function __spreadArray(to, from, pack) {
69
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
70
- if (ar || !(i in from)) {
71
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
72
- ar[i] = from[i];
73
- }
74
- }
75
- return to.concat(ar || Array.prototype.slice.call(from));
70
+ /** @deprecated */
71
+ function __spreadArrays() {
72
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
73
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
74
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
75
+ r[k] = a[j];
76
+ return r;
76
77
  }
77
78
 
78
79
  function __makeTemplateObject(cooked, raw) {
@@ -84,6 +85,752 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
84
85
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
85
86
  };
86
87
 
88
+ function toCamelCase(str) {
89
+ return str
90
+ .toLowerCase()
91
+ .replace(/[^a-z 0-9]/gi, '')
92
+ .replace(/(?:^\w|[A-Z]|\b\w)/g, function (ltr, index) {
93
+ return index === 0 ? ltr.toLowerCase() : ltr.toUpperCase();
94
+ })
95
+ .replace(/\s+/g, '');
96
+ }
97
+ var ChartDataTable$1 = function (props) {
98
+ var _a = props.data, data = _a === void 0 ? [] : _a, _b = props.xData, xKeyValue = _b.keyValue, xAxisLabel = _b.label, xTickFormat = _b.tickFormat, xTickValues = _b.tickValues, _c = props.yData, yKeyValue = _c.keyValue, yTickFormat = _c.tickFormat;
99
+ var _d = React__namespace.useState({
100
+ columns: [],
101
+ rows: [],
102
+ }), dataForTable = _d[0], setDataForTable = _d[1];
103
+ React__namespace.useEffect(function () {
104
+ setDataForTable(convertData());
105
+ }, [data]);
106
+ function convertData() {
107
+ var xField = toCamelCase((xKeyValue || xAxisLabel || 'x'));
108
+ var xTickValuesArray = data.reduce(function (valuesArray, _a) {
109
+ var dataset = _a.data;
110
+ dataset.forEach(function (datum) {
111
+ var value = datum.x || (xKeyValue && datum[xKeyValue]);
112
+ !valuesArray.includes(value) && valuesArray.push(value);
113
+ });
114
+ return valuesArray;
115
+ }, []);
116
+ var baseTableData = {
117
+ columns: xTickValuesArray.length > 0
118
+ ? [
119
+ {
120
+ field: xField,
121
+ header: xAxisLabel || xKeyValue || 'X',
122
+ isRowHeader: true,
123
+ },
124
+ ]
125
+ : [],
126
+ rows: xTickValuesArray.reduce(function (agg, tick, index) {
127
+ var _a;
128
+ var tickValue = xTickValues &&
129
+ typeof tick === 'number' &&
130
+ xTickValues.length === xTickValuesArray.length
131
+ ? xTickFormat && typeof xTickFormat === 'function'
132
+ ? xTickFormat(xTickValues[tick - 1])
133
+ : xTickValues[tick - 1]
134
+ : xTickFormat && Array.isArray(xTickFormat)
135
+ ? xTickFormat[tick - 1]
136
+ : xTickFormat && typeof xTickFormat === 'function'
137
+ ? xTickFormat(tick)
138
+ : tick;
139
+ agg.push((_a = {},
140
+ _a[xField] = tickValue,
141
+ _a.id = index,
142
+ _a));
143
+ return agg;
144
+ }, []),
145
+ };
146
+ return data.reduce(function (tableData, datum) {
147
+ var header = datum.name, dataset = datum.data;
148
+ var field = toCamelCase(header);
149
+ tableData.columns.push({
150
+ field: field,
151
+ header: header,
152
+ });
153
+ dataset.forEach(function (d, i) {
154
+ var _a;
155
+ var yValue = d.y !== undefined ? d.y : yKeyValue && d[yKeyValue];
156
+ tableData.rows[i] = __assign(__assign({}, tableData.rows[i]), (_a = { id: baseTableData.rows.length > 0 ? i + 1 : i }, _a[field] = yTickFormat && typeof yTickFormat === 'function'
157
+ ? yTickFormat(yValue)
158
+ : yValue, _a));
159
+ });
160
+ return tableData;
161
+ }, baseTableData);
162
+ }
163
+ return (React__namespace.createElement(reactMagmaDom.Card, null, dataForTable.rows.length > 0 ? (React__namespace.createElement(reactMagmaDom.Datagrid, { hasPagination: false, columns: dataForTable.columns, rows: dataForTable.rows })) : (React__namespace.createElement(reactMagmaDom.Spinner, null))));
164
+ };
165
+
166
+ var CustomAxisComponent = function (_a) {
167
+ var events = _a.events, props = __rest(_a, ["events"]);
168
+ return (React__namespace.createElement("g", null,
169
+ React__namespace.createElement(victory.LineSegment, __assign({}, props, { events: events, style: {
170
+ strokeWidth: '50px',
171
+ stroke: 'transparent',
172
+ } })),
173
+ React__namespace.createElement(victory.LineSegment, __assign({}, props, { events: events, style: {
174
+ strokeWidth: '1px',
175
+ stroke: 'black',
176
+ strokeOpacity: '0.2',
177
+ } }))));
178
+ };
179
+
180
+ var CustomScatterDataComponent = function (props) {
181
+ var datum = props.datum, pointIndex = props.index, lineIndex = props.lineIndex, pointRefArray = props.pointRefArray, registerPoint = props.registerPoint, unregisterPoint = props.unregisterPoint, other = __rest(props, ["datum", "index", "lineIndex", "pointRefArray", "registerPoint", "unregisterPoint"]);
182
+ return (React__namespace.createElement(victory.Point, __assign({}, other, { ariaLabel: datum.label, pathComponent: React__namespace.createElement(CustomPointComponent, { lineIndex: lineIndex, pointIndex: pointIndex, pointRefArray: pointRefArray, registerPoint: registerPoint, unregisterPoint: unregisterPoint }), role: "button", tabIndex: 0 })));
183
+ };
184
+ var CustomPointComponent = function (props) {
185
+ var lineIndex = props.lineIndex, pointRefArray = props.pointRefArray, pointIndex = props.pointIndex, registerPoint = props.registerPoint, unregisterPoint = props.unregisterPoint, other = __rest(props, ["lineIndex", "pointRefArray", "pointIndex", "registerPoint", "unregisterPoint"]);
186
+ var forceUpdate = reactMagmaDom.useForceUpdate();
187
+ var ref = React__namespace.useRef(null);
188
+ React__namespace.useEffect(function () {
189
+ registerPoint(pointRefArray, ref);
190
+ forceUpdate();
191
+ return function () {
192
+ return unregisterPoint(pointRefArray, ref);
193
+ };
194
+ }, []);
195
+ return (React__namespace.createElement("path", __assign({ ref: ref, "data-line-index": lineIndex, "data-point-index": pointIndex }, other)));
196
+ };
197
+
198
+ var StyledGraphTooltip = styled(reactMagmaDom.StyledTooltip)(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n background: ", ";\n border: 1px solid ", ";\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);\n box-sizing: border-box;\n color: ", ";\n font-size: ", ";\n font-weight: normal;\n line-height: ", ";\n margin: 0;\n padding: 8px;\n width: fit-content;\n div {\n margin-bottom: 8px;\n display: flex;\n align-items: flex-start;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n"], ["\n background: ", ";\n border: 1px solid ", ";\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);\n box-sizing: border-box;\n color: ", ";\n font-size: ", ";\n font-weight: normal;\n line-height: ", ";\n margin: 0;\n padding: 8px;\n width: fit-content;\n div {\n margin-bottom: 8px;\n display: flex;\n align-items: flex-start;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n"])), function (props) { return props.theme.colors.neutral100; }, function (props) { return props.theme.colors.neutral300; }, function (props) { return props.theme.colors.neutral; }, function (props) { return props.theme.typeScale.size02.fontSize; }, function (props) { return props.theme.typeScale.size02.lineHeight; });
199
+ var TooltipColorSwatch = styled.span(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n background: ", ";\n border: ", ";\n border-radius: 4px;\n height: 20px;\n width: 20px;\n margin-right: 8px;\n"], ["\n background: ", ";\n border: ", ";\n border-radius: 4px;\n height: 20px;\n width: 20px;\n margin-right: 8px;\n"])), function (props) { return props.color; }, function (props) { return (props.color ? 'none' : '3px solid black'); });
200
+ var GraphTooltip = function (props) {
201
+ var datum = props.datum, index = props.index, showTooltip = props.showTooltip, x = props.x, y = props.y;
202
+ var theme = React__namespace.useContext(reactMagmaDom.ThemeContext);
203
+ var linePointIndex = index + "-" + datum.index;
204
+ return showTooltip === linePointIndex ? (React__namespace.createElement("g", { style: { pointerEvents: 'none' } },
205
+ React__namespace.createElement("foreignObject", { x: x, y: y, width: "275", height: "100%" },
206
+ React__namespace.createElement(StyledGraphTooltip, { position: reactMagmaDom.TooltipPosition.top, role: "tooltip", theme: theme },
207
+ React__namespace.createElement("div", null,
208
+ React__namespace.createElement(TooltipColorSwatch, { color: theme.iterableColors[index] }),
209
+ React__namespace.createElement("span", null, datum.label)),
210
+ React__namespace.createElement(reactMagmaDom.TooltipArrow, { theme: theme }))))) : null;
211
+ };
212
+ var AxisTooltip = function (props) {
213
+ var x = props.x, y = props.y, activePoints = props.activePoints, hiddenData = props.hiddenData, dataLength = props.dataLength;
214
+ var pointsIndexes = Array.from(Array(dataLength - 0), function (_, i) { return i + 0; }).filter(function (i) { return !hiddenData.includes(i); });
215
+ var theme = React__namespace.useContext(reactMagmaDom.ThemeContext);
216
+ return (React__namespace.createElement("g", { style: { pointerEvents: 'none' } },
217
+ React__namespace.createElement("foreignObject", { x: x, y: y, width: "275", height: "100%" },
218
+ React__namespace.createElement(StyledGraphTooltip, { "data-testid": "axis-tooltip", position: reactMagmaDom.TooltipPosition.top, role: "tooltip", theme: theme },
219
+ activePoints.map(function (point, i) { return (React__namespace.createElement("div", { key: i },
220
+ React__namespace.createElement(TooltipColorSwatch, { color: theme.iterableColors[pointsIndexes[i]] }),
221
+ React__namespace.createElement("span", null, point.label))); }),
222
+ React__namespace.createElement(reactMagmaDom.TooltipArrow, { theme: theme })))));
223
+ };
224
+ var templateObject_1$5, templateObject_2$5;
225
+
226
+ var LegendButton = React__namespace.forwardRef(function (props, ref) {
227
+ props.children; var color = props.color, dataIndex = props.dataIndex, isHidden = props.isHidden, onClick = props.onClick, name = props.name, focusCurrentLine = props.focusCurrentLine, resetLineFocus = props.resetLineFocus, other = __rest(props, ["children", "color", "dataIndex", "isHidden", "onClick", "name", "focusCurrentLine", "resetLineFocus"]);
228
+ function handleClick() {
229
+ onClick && typeof onClick === 'function' && onClick(dataIndex);
230
+ if (!isHidden) {
231
+ resetLineFocus &&
232
+ typeof resetLineFocus === 'function' &&
233
+ resetLineFocus();
234
+ }
235
+ }
236
+ function handleOnMouseEnterOrFocus() {
237
+ if (!isHidden) {
238
+ focusCurrentLine &&
239
+ typeof focusCurrentLine === 'function' &&
240
+ focusCurrentLine(dataIndex);
241
+ }
242
+ }
243
+ var theme = React__namespace.useContext(reactMagmaDom.ThemeContext);
244
+ return (React__namespace.createElement("div", { style: { display: 'inline-flex' }, onMouseEnter: handleOnMouseEnterOrFocus, onMouseLeave: resetLineFocus },
245
+ React__namespace.createElement(reactMagmaDom.Checkbox, __assign({ checked: !isHidden, color: color, containerStyle: {
246
+ alignItems: 'center',
247
+ border: '0',
248
+ boxShadow: '0 0 0',
249
+ color: theme.colors.neutral,
250
+ display: 'inline-flex',
251
+ margin: '0 36px 20px 0',
252
+ padding: '0',
253
+ }, inputStyle: {
254
+ border: color ? "none" : "2px solid " + theme.colors.neutral800,
255
+ borderRadius: '4px',
256
+ }, labelText: name, onBlur: resetLineFocus, onClick: handleClick, onFocus: handleOnMouseEnterOrFocus, ref: ref, theme: theme }, other))));
257
+ });
258
+
259
+ // *
260
+ // * Colors
261
+ // *
262
+ // const yellow200 = '#FFF59D';
263
+ // const deepOrange600 = '#F4511E';
264
+ // const lime300 = '#DCE775';
265
+ // const lightGreen500 = '#8BC34A';
266
+ // const teal700 = '#00796B';
267
+ // const cyan900 = '#006064';
268
+ // const colors = [
269
+ // '#0085CC',
270
+ // '#E0004D',
271
+ // '#FA6600',
272
+ // '#48A200',
273
+ // '#B12FAD',
274
+ // '#00A393',
275
+ // ];
276
+ var colors = [
277
+ '#00507A',
278
+ '#8F0033',
279
+ '#B84900',
280
+ '#255200',
281
+ '#711E6E',
282
+ '#005249',
283
+ ];
284
+ var blueGrey50 = '#DFDFDF';
285
+ var blueGrey300 = '#8F8F8F';
286
+ var blueGrey700 = '#3F3F3F';
287
+ var grey900 = 'pink';
288
+ // *
289
+ // * Typography
290
+ // *
291
+ var sansSerif = '"Work Sans",Helvetica,sans-serif';
292
+ var letterSpacing = 'normal';
293
+ var fontSize = 12;
294
+ // *
295
+ // * Layout
296
+ // *
297
+ var padding = 8;
298
+ var baseProps = {
299
+ width: 350,
300
+ height: 350,
301
+ padding: 50,
302
+ };
303
+ // *
304
+ // * Labels
305
+ // *
306
+ var baseLabelStyles = {
307
+ fontFamily: sansSerif,
308
+ fontSize: fontSize,
309
+ letterSpacing: letterSpacing,
310
+ padding: padding,
311
+ fill: blueGrey700,
312
+ stroke: 'transparent',
313
+ strokeWidth: 0,
314
+ };
315
+ var centeredLabelStyles = __assign({ textAnchor: 'middle' }, baseLabelStyles);
316
+ // *
317
+ // * Strokes
318
+ // *
319
+ // const strokeDasharray = '10, 5';
320
+ var strokeLinecap = 'round';
321
+ var strokeLinejoin = 'round';
322
+ var magmaTheme = {
323
+ area: __assign({ style: {
324
+ data: {
325
+ fill: grey900,
326
+ },
327
+ labels: baseLabelStyles,
328
+ } }, baseProps),
329
+ axis: __assign({ style: {
330
+ axis: {
331
+ fill: 'transparent',
332
+ stroke: blueGrey300,
333
+ strokeWidth: 1,
334
+ strokeLinecap: strokeLinecap,
335
+ strokeLinejoin: strokeLinejoin,
336
+ },
337
+ axisLabel: __assign(__assign({}, centeredLabelStyles), { padding: padding, stroke: 'transparent' }),
338
+ grid: {
339
+ fill: 'none',
340
+ stroke: '#dfdfdf',
341
+ //strokeDasharray,
342
+ strokeLinecap: strokeLinecap,
343
+ strokeLinejoin: strokeLinejoin,
344
+ pointerEvents: 'painted',
345
+ },
346
+ ticks: {
347
+ fill: 'transparent',
348
+ size: 0,
349
+ stroke: blueGrey300,
350
+ strokeWidth: 0,
351
+ strokeLinecap: strokeLinecap,
352
+ strokeLinejoin: strokeLinejoin,
353
+ },
354
+ tickLabels: __assign(__assign({}, baseLabelStyles), { fill: blueGrey700 }),
355
+ } }, baseProps),
356
+ polarDependentAxis: {
357
+ style: {
358
+ ticks: {
359
+ fill: 'transparent',
360
+ size: 1,
361
+ stroke: 'transparent',
362
+ },
363
+ },
364
+ },
365
+ bar: __assign({ style: {
366
+ data: {
367
+ fill: blueGrey700,
368
+ padding: padding,
369
+ strokeWidth: 0,
370
+ },
371
+ labels: baseLabelStyles,
372
+ } }, baseProps),
373
+ boxplot: __assign({ style: {
374
+ max: { padding: padding, stroke: blueGrey700, strokeWidth: 1 },
375
+ maxLabels: __assign(__assign({}, baseLabelStyles), { padding: 3 }),
376
+ median: { padding: padding, stroke: blueGrey700, strokeWidth: 1 },
377
+ medianLabels: __assign(__assign({}, baseLabelStyles), { padding: 3 }),
378
+ min: { padding: padding, stroke: blueGrey700, strokeWidth: 1 },
379
+ minLabels: __assign(__assign({}, baseLabelStyles), { padding: 3 }),
380
+ q1: { padding: padding, fill: blueGrey700 },
381
+ q1Labels: __assign(__assign({}, baseLabelStyles), { padding: 3 }),
382
+ q3: { padding: padding, fill: blueGrey700 },
383
+ q3Labels: __assign(__assign({}, baseLabelStyles), { padding: 3 }),
384
+ }, boxWidth: 20 }, baseProps),
385
+ candlestick: __assign({ style: {
386
+ data: {
387
+ stroke: blueGrey700,
388
+ },
389
+ labels: __assign(__assign({}, baseLabelStyles), { padding: 5 }),
390
+ }, candleColors: {
391
+ positive: '#ffffff',
392
+ negative: blueGrey700,
393
+ } }, baseProps),
394
+ chart: baseProps,
395
+ errorbar: __assign({ borderWidth: 8, style: {
396
+ data: {
397
+ fill: 'transparent',
398
+ opacity: 1,
399
+ stroke: blueGrey700,
400
+ strokeWidth: 2,
401
+ },
402
+ labels: baseLabelStyles,
403
+ } }, baseProps),
404
+ group: __assign({ colorScale: colors }, baseProps),
405
+ histogram: __assign({ style: {
406
+ data: {
407
+ fill: blueGrey700,
408
+ stroke: grey900,
409
+ strokeWidth: 2,
410
+ },
411
+ labels: baseLabelStyles,
412
+ } }, baseProps),
413
+ legend: {
414
+ colorScale: colors,
415
+ gutter: 10,
416
+ orientation: 'vertical',
417
+ titleOrientation: 'top',
418
+ style: {
419
+ data: {
420
+ type: 'circle',
421
+ },
422
+ labels: baseLabelStyles,
423
+ title: __assign(__assign({}, baseLabelStyles), { padding: 5 }),
424
+ },
425
+ },
426
+ line: __assign({ style: {
427
+ data: {
428
+ fill: 'transparent',
429
+ opacity: 1,
430
+ stroke: blueGrey700,
431
+ strokeWidth: 2,
432
+ },
433
+ labels: baseLabelStyles,
434
+ } }, baseProps),
435
+ pie: __assign({ colorScale: colors, style: {
436
+ data: {
437
+ padding: padding,
438
+ stroke: blueGrey50,
439
+ strokeWidth: 1,
440
+ },
441
+ labels: __assign(__assign({}, baseLabelStyles), { padding: 20 }),
442
+ } }, baseProps),
443
+ scatter: __assign({ style: {
444
+ data: {
445
+ fill: blueGrey700,
446
+ opacity: 1,
447
+ stroke: 'transparent',
448
+ strokeWidth: 0,
449
+ },
450
+ labels: baseLabelStyles,
451
+ } }, baseProps),
452
+ stack: __assign({ colorScale: colors }, baseProps),
453
+ tooltip: {
454
+ style: __assign(__assign({}, baseLabelStyles), { padding: 0, pointerEvents: 'none' }),
455
+ flyoutStyle: {
456
+ stroke: grey900,
457
+ strokeWidth: 1,
458
+ fill: '#f0f0f0',
459
+ pointerEvents: 'none',
460
+ },
461
+ flyoutPadding: 5,
462
+ cornerRadius: 5,
463
+ pointerLength: 10,
464
+ },
465
+ voronoi: __assign({ style: {
466
+ data: {
467
+ fill: 'transparent',
468
+ stroke: 'transparent',
469
+ strokeWidth: 0,
470
+ },
471
+ labels: __assign(__assign({}, baseLabelStyles), { padding: 5, pointerEvents: 'none' }),
472
+ flyout: {
473
+ stroke: grey900,
474
+ strokeWidth: 1,
475
+ fill: '#f0f0f0',
476
+ pointerEvents: 'none',
477
+ },
478
+ } }, baseProps),
479
+ };
480
+
481
+ var LineChartContainer = styled.div(templateObject_1$4 || (templateObject_1$4 = __makeTemplateObject(["\n max-height: 600px;\n max-width: 800px;\n svg {\n overflow: visible;\n }\n"], ["\n max-height: 600px;\n max-width: 800px;\n svg {\n overflow: visible;\n }\n"])));
482
+ var VictoryChartContainer = styled.div(templateObject_2$4 || (templateObject_2$4 = __makeTemplateObject([""], [""])));
483
+ var DataLegendsContainer = styled.div(templateObject_3$3 || (templateObject_3$3 = __makeTemplateObject(["\n padding-bottom: 24px;\n"], ["\n padding-bottom: 24px;\n"])));
484
+ var DataLegendsDescription = styled.p(templateObject_4$2 || (templateObject_4$2 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n"], ["\n color: ", ";\n font-size: ", ";\n"])), function (props) { return props.theme.colors.neutral; }, function (props) { return props.theme.typeScale.size02.fontSize; });
485
+ function LineChart(props) {
486
+ var _a = props.componentProps, _b = _a === void 0 ? {} : _a, _c = _b.chart, chart = _c === void 0 ? {} : _c, _d = _b.line, line = _d === void 0 ? {} : _d, _e = _b.scatter, scatter = _e === void 0 ? {} : _e, _f = _b.xAxis, _g = _f === void 0 ? { style: {} } : _f, _h = _g.style, _j = _h === void 0 ? {} : _h, _k = _j.axisLabel, xAxisLabel = _k === void 0 ? undefined : _k, _l = _j.tickLabels, xTickLabels = _l === void 0 ? undefined : _l, xRest = __rest(_j, ["axisLabel", "tickLabels"]), xAxisOther = __rest(_g, ["style"]), _m = _b.yAxis, _o = _m === void 0 ? { style: {} } : _m, _p = _o.style, _q = _p === void 0 ? {} : _p, _r = _q.axisLabel, yAxisLabel = _r === void 0 ? undefined : _r, _s = _q.tickLabels, yTickLabels = _s === void 0 ? undefined : _s, yRest = __rest(_q, ["axisLabel", "tickLabels"]), yAxisOther = __rest(_o, ["style"]), _t = props.data, data = _t === void 0 ? [] : _t, lastFocusedScatterPoint = props.lastFocusedScatterPoint, pointRefArray = props.pointRefArray, registerPoint = props.registerPoint, unregisterPoint = props.unregisterPoint, tabRef = props.tabRef, x = props.x, y = props.y;
487
+ var theme = React__namespace.useContext(reactMagmaDom.ThemeContext);
488
+ var i18n = React__namespace.useContext(reactMagmaDom.I18nContext);
489
+ var _u = React__namespace.useState([]), hiddenData = _u[0], setHiddenData = _u[1];
490
+ var _v = React__namespace.useState(800), width = _v[0], setWidth = _v[1];
491
+ var _w = React__namespace.useState(null), focusedLine = _w[0], setFocusedLine = _w[1];
492
+ var _x = React__namespace.useState(null), showTooltip = _x[0], setShowTooltip = _x[1];
493
+ var _y = React__namespace.useState(true), showXAxisLabel = _y[0], setShowXAxisLabel = _y[1];
494
+ var _z = React__namespace.useState(false), hoveringOnXAxisLine = _z[0], setHoveringOnXAxisLine = _z[1];
495
+ var containerRef = React__namespace.useRef(null);
496
+ var firstLegendButtonRef = React__namespace.useRef(null);
497
+ React__namespace.useEffect(function () {
498
+ updateWidth();
499
+ window.addEventListener('resize', updateWidth);
500
+ window.addEventListener('keydown', handleEsc);
501
+ return function () {
502
+ window.removeEventListener('resize', updateWidth);
503
+ window.removeEventListener('keydown', handleEsc);
504
+ };
505
+ }, []);
506
+ React__namespace.useEffect(function () {
507
+ window.addEventListener('mousemove', handleMouseMove);
508
+ return function () {
509
+ window.removeEventListener('mousemove', handleMouseMove);
510
+ };
511
+ }, [showTooltip]);
512
+ var scatterNames = data.map(function (_, i) { return "scatter-" + i; });
513
+ var xAxisStyles = __assign({ tickLabels: __assign({ color: '#3f3f3f', fontSize: 12 }, xTickLabels), axisLabel: __assign({ color: '#3f3f3f', padding: 44, fontSize: 14, fontWeight: 'bold' }, xAxisLabel) }, xRest);
514
+ var yAxisStyles = __assign({ tickLabels: __assign({ fontSize: 12 }, yTickLabels), axisLabel: __assign({ color: '#3f3f3f', padding: 64, fontSize: 14, fontWeight: 'bold' }, yAxisLabel) }, yRest);
515
+ function updateWidth() {
516
+ containerRef.current && setWidth(containerRef.current.clientWidth);
517
+ }
518
+ function handleEsc(event) {
519
+ if (event.key === 'Escape') {
520
+ setShowTooltip(null);
521
+ setShowXAxisLabel(false);
522
+ }
523
+ }
524
+ function handleMouseMove() {
525
+ !showTooltip && setShowXAxisLabel(true);
526
+ }
527
+ function setLineOpacity(index) {
528
+ return focusedLine === null ? 1 : focusedLine === index ? 1 : 0.1;
529
+ }
530
+ function handleLegendClick(dataIndex) {
531
+ if (hiddenData.includes(dataIndex)) {
532
+ setHiddenData(hiddenData.filter(function (item) { return item !== dataIndex; }));
533
+ }
534
+ else {
535
+ setHiddenData(hiddenData.concat([dataIndex]));
536
+ }
537
+ }
538
+ function focusCurrentLine(dataIndex) {
539
+ setFocusedLine(dataIndex);
540
+ }
541
+ function resetLineFocus() {
542
+ setFocusedLine(null);
543
+ }
544
+ var buildLineIndexes = function (acc, point) {
545
+ if (point.current) {
546
+ var currentLineIndex = parseInt(point.current.getAttribute('data-line-index'), 10);
547
+ !acc.includes(currentLineIndex) &&
548
+ acc.push(parseInt(point.current.getAttribute('data-line-index'), 10));
549
+ }
550
+ return acc;
551
+ };
552
+ var buildLineIndexData = function (point) {
553
+ var currentLineIndex = parseInt(point.current.getAttribute('data-line-index'), 10);
554
+ var currentPointIndex = parseInt(point.current.getAttribute('data-point-index'), 10);
555
+ var lineIndexes = pointRefArray.current.reduce(buildLineIndexes, []);
556
+ var lowestLineIndex = lineIndexes[0];
557
+ var highestLineIndex = lineIndexes[lineIndexes.length - 1];
558
+ return {
559
+ currentLineIndex: currentLineIndex,
560
+ currentPointIndex: currentPointIndex,
561
+ lineIndexes: lineIndexes,
562
+ lowestLineIndex: lowestLineIndex,
563
+ highestLineIndex: highestLineIndex,
564
+ };
565
+ };
566
+ var findPointToFocus = function (lineIndex, pointIndex) {
567
+ return function (point) {
568
+ return point.current &&
569
+ parseInt(point.current.getAttribute('data-line-index'), 10) ===
570
+ lineIndex &&
571
+ parseInt(point.current.getAttribute('data-point-index'), 10) ===
572
+ pointIndex;
573
+ };
574
+ };
575
+ // eslint-disable-next-line complexity
576
+ function handleChartContainerKeyDown(event) {
577
+ var _a, _b;
578
+ var key = event.key, shiftKey = event.shiftKey;
579
+ switch (key) {
580
+ case 'Tab': {
581
+ event.preventDefault();
582
+ lastFocusedScatterPoint.current = pointRefArray.current.find(function (point) { return point.current === document.activeElement; }).current;
583
+ shiftKey
584
+ ? tabRef.current && tabRef.current.focus()
585
+ : firstLegendButtonRef.current &&
586
+ firstLegendButtonRef.current.focus();
587
+ break;
588
+ }
589
+ case 'ArrowRight': {
590
+ var focusedPointIndex = pointRefArray.current.findIndex(function (point) { return point.current === document.activeElement; });
591
+ if (focusedPointIndex !== undefined) {
592
+ focusedPointIndex === pointRefArray.current.length - 1
593
+ ? (_b = (_a = pointRefArray.current[0]) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.focus() : pointRefArray.current[focusedPointIndex + 1]
594
+ .current.focus();
595
+ }
596
+ break;
597
+ }
598
+ case 'ArrowLeft': {
599
+ var focusedPointIndex = pointRefArray.current.findIndex(function (point) { return point.current === document.activeElement; });
600
+ if (focusedPointIndex !== undefined) {
601
+ focusedPointIndex === 0
602
+ ? pointRefArray.current[pointRefArray.current.length - 1]
603
+ .current.focus()
604
+ : pointRefArray.current[focusedPointIndex - 1]
605
+ .current.focus();
606
+ }
607
+ break;
608
+ }
609
+ case 'ArrowUp': {
610
+ event.preventDefault();
611
+ var focusedPoint = pointRefArray.current.find(function (point) { return point.current === document.activeElement; });
612
+ if (focusedPoint && focusedPoint.current) {
613
+ var _c = buildLineIndexData(focusedPoint), currentLineIndex = _c.currentLineIndex, currentPointIndex = _c.currentPointIndex, lineIndexes = _c.lineIndexes, lowestLineIndex = _c.lowestLineIndex, highestLineIndex = _c.highestLineIndex;
614
+ switch (currentLineIndex) {
615
+ case lowestLineIndex: {
616
+ pointRefArray.current.find(findPointToFocus(highestLineIndex, currentPointIndex)).current.focus();
617
+ break;
618
+ }
619
+ default: {
620
+ var nextLowestLineIndex = lineIndexes[lineIndexes.indexOf(currentLineIndex) - 1];
621
+ pointRefArray.current.find(findPointToFocus(nextLowestLineIndex, currentPointIndex)).current.focus();
622
+ }
623
+ }
624
+ }
625
+ break;
626
+ }
627
+ case 'ArrowDown': {
628
+ event.preventDefault();
629
+ var focusedPoint = pointRefArray.current.find(function (point) { return point.current === document.activeElement; });
630
+ if (focusedPoint && focusedPoint.current) {
631
+ var _d = buildLineIndexData(focusedPoint), currentLineIndex = _d.currentLineIndex, currentPointIndex = _d.currentPointIndex, lineIndexes = _d.lineIndexes, lowestLineIndex = _d.lowestLineIndex, highestLineIndex = _d.highestLineIndex;
632
+ switch (currentLineIndex) {
633
+ case highestLineIndex: {
634
+ pointRefArray.current.find(findPointToFocus(lowestLineIndex, currentPointIndex)).current.focus();
635
+ break;
636
+ }
637
+ default: {
638
+ var nextHighestLineIndex = lineIndexes[lineIndexes.indexOf(currentLineIndex) + 1];
639
+ pointRefArray.current.find(findPointToFocus(nextHighestLineIndex, currentPointIndex)).current.focus();
640
+ }
641
+ }
642
+ }
643
+ break;
644
+ }
645
+ }
646
+ }
647
+ function handleFirstLegendButtonKeydown(event) {
648
+ var key = event.key, shiftKey = event.shiftKey;
649
+ switch (key) {
650
+ case 'Tab': {
651
+ if (shiftKey &&
652
+ lastFocusedScatterPoint &&
653
+ lastFocusedScatterPoint.current &&
654
+ pointRefArray.current.find(function (point) { return point.current === lastFocusedScatterPoint.current; })) {
655
+ event.preventDefault();
656
+ lastFocusedScatterPoint.current.focus();
657
+ }
658
+ break;
659
+ }
660
+ }
661
+ }
662
+ return (React__namespace.createElement(LineChartContainer, { ref: containerRef },
663
+ React__namespace.createElement(VictoryChartContainer, { onKeyDown: handleChartContainerKeyDown },
664
+ React__namespace.createElement(victory.VictoryChart, __assign({ domainPadding: 32, height: 400, padding: { top: 0, left: 80, right: 0, bottom: 62 }, theme: magmaTheme, width: width, containerComponent: React__namespace.createElement(victory.VictoryVoronoiContainer, { name: "xAxisGroupLabel", voronoiBlacklist: scatterNames, voronoiDimension: "x", labels: hoveringOnXAxisLine && showXAxisLabel ? function () { return " "; } : undefined, labelComponent: showXAxisLabel ? (React__namespace.createElement(victory.VictoryTooltip, { flyoutComponent: React__namespace.createElement(AxisTooltip, { dataLength: data.length, hiddenData: hiddenData }) })) : undefined, role: "presentation", voronoiPadding: 32 }) }, chart),
665
+ React__namespace.createElement(victory.VictoryAxis, __assign({}, yAxisOther, { dependentAxis: true, style: yAxisStyles })),
666
+ data.map(function (_a, i) {
667
+ var dataset = _a.data;
668
+ return !hiddenData.includes(i) && (React__namespace.createElement(victory.VictoryLine, __assign({ style: {
669
+ data: {
670
+ opacity: setLineOpacity(i),
671
+ stroke: theme.iterableColors[i],
672
+ strokeWidth: '3',
673
+ },
674
+ parent: { border: theme.colors.neutral400 },
675
+ }, key: "line" + i, data: dataset, labelComponent: React__namespace.createElement(React__namespace.Fragment, null), x: x, y: y }, line)));
676
+ }),
677
+ React__namespace.createElement(victory.VictoryAxis, __assign({}, xAxisOther, { style: xAxisStyles, gridComponent: React__namespace.createElement(CustomAxisComponent, { events: {
678
+ onMouseEnter: function () { return setHoveringOnXAxisLine(true); },
679
+ onMouseLeave: function () { return setHoveringOnXAxisLine(false); },
680
+ } }) })),
681
+ data.map(function (_a, i) {
682
+ var dataset = _a.data;
683
+ return !hiddenData.includes(i) && (React__namespace.createElement(victory.VictoryScatter, __assign({ name: "scatter-" + i, events: [
684
+ {
685
+ target: 'data',
686
+ eventHandlers: {
687
+ onBlur: function () {
688
+ setShowXAxisLabel(true);
689
+ setShowTooltip(null);
690
+ return [
691
+ {
692
+ target: 'labels',
693
+ mutation: function () { return ({ active: undefined }); },
694
+ },
695
+ ];
696
+ },
697
+ onClick: function () {
698
+ return [
699
+ {
700
+ target: 'labels',
701
+ mutation: function (props) {
702
+ setShowTooltip(props.datum.lineIndex + "-" + props.datum.index);
703
+ return { active: true };
704
+ },
705
+ },
706
+ ];
707
+ },
708
+ onFocus: function () {
709
+ setShowXAxisLabel(false);
710
+ return [
711
+ {
712
+ target: 'labels',
713
+ mutation: function (props) {
714
+ setShowTooltip(props.datum.lineIndex + "-" + props.datum.index);
715
+ return { active: true };
716
+ },
717
+ },
718
+ ];
719
+ },
720
+ onMouseEnter: function () {
721
+ setShowXAxisLabel(false);
722
+ return [
723
+ {
724
+ target: 'labels',
725
+ mutation: function (props) {
726
+ setShowTooltip(props.datum.lineIndex + "-" + props.datum.index);
727
+ return { active: true };
728
+ },
729
+ },
730
+ ];
731
+ },
732
+ onMouseLeave: function () {
733
+ setShowTooltip(null);
734
+ setShowXAxisLabel(true);
735
+ },
736
+ },
737
+ },
738
+ ], style: {
739
+ data: {
740
+ fill: theme.colors.neutral100,
741
+ opacity: setLineOpacity(i),
742
+ stroke: theme.iterableColors[i],
743
+ strokeWidth: 2,
744
+ },
745
+ }, size: 5, data: dataset.map(function (datum, index) { return (__assign({ index: index, lineIndex: i }, datum)); }), dataComponent: React__namespace.createElement(CustomScatterDataComponent, { lineIndex: i, pointRefArray: pointRefArray, registerPoint: registerPoint, unregisterPoint: unregisterPoint }), labels: function () { return ''; }, labelComponent: React__namespace.createElement(victory.VictoryTooltip, { text: "", flyoutComponent: React__namespace.createElement(GraphTooltip, { index: i, showTooltip: showTooltip }) }), key: "scatter" + i, x: x, y: y }, scatter)));
746
+ }))),
747
+ React__namespace.createElement(DataLegendsContainer, null,
748
+ React__namespace.createElement(DataLegendsDescription, { theme: theme }, i18n.charts.line.dataLegendsLabel),
749
+ data.map(function (_a, i) {
750
+ var name = _a.name;
751
+ var legendButtonAriaLabel = i18n.charts.line.legendButtonAriaLabel.replace(/\{name\}/g, name);
752
+ return (React__namespace.createElement(LegendButton, { "aria-label": legendButtonAriaLabel, color: theme.iterableColors[i], dataIndex: i, isHidden: hiddenData.includes(i), key: name, name: name, onClick: handleLegendClick, onKeyDown: i === 0 ? handleFirstLegendButtonKeydown : undefined, focusCurrentLine: focusCurrentLine, ref: i === 0 ? firstLegendButtonRef : undefined, resetLineFocus: resetLineFocus }));
753
+ }))));
754
+ }
755
+ var templateObject_1$4, templateObject_2$4, templateObject_3$3, templateObject_4$2;
756
+
757
+ var StyledTitle = reactMagmaDom.styled.span(templateObject_1$3 || (templateObject_1$3 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-weight: 600;\n font-family: ", ";\n line-height: ", ";\n margin: 0 0 12px 0;\n"], ["\n color: ", ";\n font-size: ", ";\n font-weight: 600;\n font-family: ", ";\n line-height: ", ";\n margin: 0 0 12px 0;\n"])), function (props) { return props.theme.colors.neutral; }, function (props) { return props.theme.typeScale.size04.fontSize; }, function (props) { return props.theme.bodyFont; }, function (props) { return props.theme.typeScale.size04.lineHeight; });
758
+ var StyledParagraph = reactMagmaDom.styled(reactMagmaDom.Paragraph)(templateObject_2$3 || (templateObject_2$3 = __makeTemplateObject(["\n font-size: ", ";\n margin: 0 0 18px 0;\n"], ["\n font-size: ", ";\n margin: 0 0 18px 0;\n"])), function (props) { return props.theme.typeScale.size02.fontSize; });
759
+ var StyledTabsContainer = reactMagmaDom.styled(reactMagmaDom.TabsContainer)(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n width: 800px;\n ul {\n box-shadow: inset 0 -1px 0 ", ";\n }\n"], ["\n width: 800px;\n ul {\n box-shadow: inset 0 -1px 0 ", ";\n }\n"])), function (props) { return props.theme.colors.neutral300; });
760
+ var StyledTabPanel = reactMagmaDom.styled(reactMagmaDom.TabPanel)(templateObject_4$1 || (templateObject_4$1 = __makeTemplateObject(["\n padding: 22px 0;\n"], ["\n padding: 22px 0;\n"])));
761
+ var KeyboardInstructionsCard = reactMagmaDom.styled(reactMagmaDom.Card)(templateObject_6$1 || (templateObject_6$1 = __makeTemplateObject(["\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);\n display: ", ";\n right: ", ";\n max-height: ", ";\n opacity: ", ";\n outline: 0;\n overflow-y: auto;\n padding: ", "\n ", ";\n position: absolute;\n transition: opacity 0.3s;\n white-space: nowrap;\n z-index: 2;\n\n ", "\n"], ["\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);\n display: ", ";\n right: ", ";\n max-height: ",
762
+ ";\n opacity: ", ";\n outline: 0;\n overflow-y: auto;\n padding: ", "\n ", ";\n position: absolute;\n transition: opacity 0.3s;\n white-space: nowrap;\n z-index: 2;\n\n ",
763
+ "\n"])), function (props) { return (props.isOpen ? 'block' : 'none'); }, function (props) { return props.theme.spaceScale.spacing02; }, function (props) {
764
+ return props.maxHeight ? props.maxHeight : props.theme.dropdown.content.maxHeight;
765
+ }, function (props) { return (props.isOpen ? '1' : '0'); }, function (props) { return props.theme.spaceScale.spacing05; }, function (props) { return props.theme.spaceScale.spacing05; }, function (props) {
766
+ return props.width && react.css(templateObject_5$1 || (templateObject_5$1 = __makeTemplateObject(["\n white-space: normal;\n width: ", ";\n "], ["\n white-space: normal;\n width: ", ";\n "])), props.width);
767
+ });
768
+ function BaseChart(props, ref) {
769
+ var _a, _b, _c, _d, _e, _f;
770
+ var description = props.description, title = props.title; props.testId; var type = props.type, other = __rest(props, ["description", "title", "testId", "type"]);
771
+ var keyboardInstructionsRef = React__namespace.useRef(null);
772
+ var lastFocusedScatterPoint = React__namespace.useRef(null);
773
+ var theme = React__namespace.useContext(reactMagmaDom.ThemeContext);
774
+ var i18n = React__namespace.useContext(reactMagmaDom.I18nContext);
775
+ var _g = reactMagmaDom.useDescendants(), pointRefArray = _g[0], registerPoint = _g[1], unregisterPoint = _g[2];
776
+ var _h = React__namespace.useState(false), isKeyboardInstructionsOpen = _h[0], setIsKeyboardInstructionsOpen = _h[1];
777
+ function handleKeyboardInstructionsButtonBlur() {
778
+ setIsKeyboardInstructionsOpen(false);
779
+ }
780
+ function handleKeyboardInstructionsButtonClick() {
781
+ setIsKeyboardInstructionsOpen(function (prevOpen) { return !prevOpen; });
782
+ }
783
+ function handleKeyboardInstructionsButtonKeydown(event) {
784
+ var key = event.key, shiftKey = event.shiftKey;
785
+ switch (key) {
786
+ case 'Escape': {
787
+ setIsKeyboardInstructionsOpen(false);
788
+ break;
789
+ }
790
+ case 'Tab': {
791
+ if (!shiftKey &&
792
+ lastFocusedScatterPoint &&
793
+ lastFocusedScatterPoint.current &&
794
+ pointRefArray.current.find(function (point) { return point.current === lastFocusedScatterPoint.current; })) {
795
+ event.preventDefault();
796
+ lastFocusedScatterPoint.current.focus();
797
+ }
798
+ break;
799
+ }
800
+ }
801
+ }
802
+ return (React__namespace.createElement("div", { ref: ref },
803
+ React__namespace.createElement(StyledTitle, { theme: theme }, title),
804
+ description && (React__namespace.createElement(StyledParagraph, { theme: theme, visualStyle: reactMagmaDom.TypographyVisualStyle.bodySmall }, description)),
805
+ React__namespace.createElement(StyledTabsContainer, { theme: theme },
806
+ React__namespace.createElement(reactMagmaDom.Tabs, null,
807
+ React__namespace.createElement(reactMagmaDom.Tab, null, i18n.charts.line.chartTabLabel),
808
+ React__namespace.createElement(reactMagmaDom.Tab, null, i18n.charts.line.dataTabLabel),
809
+ React__namespace.createElement("div", { onBlur: handleKeyboardInstructionsButtonBlur, style: {
810
+ display: 'inline-block',
811
+ marginLeft: 'auto',
812
+ } },
813
+ React__namespace.createElement(reactMagmaDom.Tooltip, { content: i18n.charts.line.keyboardInstructionsTooltip, ref: keyboardInstructionsRef },
814
+ React__namespace.createElement(reactMagmaDom.IconButton, { "aria-controls": "keyboardInstructions", "aria-label": i18n.charts.line.keyboardInstructionsTooltip, "aria-expanded": Boolean(isKeyboardInstructionsOpen), icon: React__namespace.createElement(reactMagmaIcons.KeyboardIcon, null), onClick: handleKeyboardInstructionsButtonClick, onKeyDown: handleKeyboardInstructionsButtonKeydown, variant: reactMagmaDom.ButtonVariant.link })),
815
+ React__namespace.createElement(reactMagmaDom.Announce, null,
816
+ React__namespace.createElement(KeyboardInstructionsCard, { id: "keyboardInstructions", isOpen: isKeyboardInstructionsOpen, theme: theme, width: "350px" },
817
+ React__namespace.createElement(reactMagmaDom.Paragraph, { visualStyle: reactMagmaDom.TypographyVisualStyle.headingXSmall, style: { margin: '0 0 16px' } }, i18n.charts.line.keyboardInstructionsHeader),
818
+ i18n.charts.line.keyboardInstructions)))),
819
+ React__namespace.createElement(reactMagmaDom.TabPanelsContainer, null,
820
+ React__namespace.createElement(StyledTabPanel, { theme: theme }, type === 'line' && (React__namespace.createElement(LineChart, __assign({}, other, { lastFocusedScatterPoint: lastFocusedScatterPoint, pointRefArray: pointRefArray, registerPoint: registerPoint, tabRef: keyboardInstructionsRef, unregisterPoint: unregisterPoint })))),
821
+ React__namespace.createElement(StyledTabPanel, { theme: theme },
822
+ React__namespace.createElement(ChartDataTable$1, { data: other.data, xData: {
823
+ keyValue: other.x,
824
+ label: (_b = (_a = other.componentProps) === null || _a === void 0 ? void 0 : _a.xAxis) === null || _b === void 0 ? void 0 : _b.label,
825
+ tickFormat: (_d = (_c = other.componentProps) === null || _c === void 0 ? void 0 : _c.xAxis) === null || _d === void 0 ? void 0 : _d.tickFormat,
826
+ }, yData: {
827
+ keyValue: other.y,
828
+ tickFormat: (_f = (_e = other.componentProps) === null || _e === void 0 ? void 0 : _e.yAxis) === null || _f === void 0 ? void 0 : _f.tickFormat,
829
+ } }))))));
830
+ }
831
+ var Chart = React__namespace.forwardRef(BaseChart);
832
+ var templateObject_1$3, templateObject_2$3, templateObject_3$2, templateObject_4$1, templateObject_5$1, templateObject_6$1;
833
+
87
834
  function _extends() {
88
835
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
89
836
  for (var e = 1; e < arguments.length; e++) {
@@ -164,7 +911,6 @@ function _wrapNativeSuper(t) {
164
911
  }
165
912
 
166
913
  // based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js
167
-
168
914
  /**
169
915
  * Parse errors.md and turn it into a simple hash of code: message
170
916
  * @private
@@ -243,87 +989,77 @@ var ERRORS = {
243
989
  "71": "Passed invalid pixel value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
244
990
  "72": "Passed invalid base value %s to %s(), please pass a value like \"12px\" or 12.\n\n",
245
991
  "73": "Please provide a valid CSS variable.\n\n",
246
- "74": "CSS variable not found.\n\n",
247
- "75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
992
+ "74": "CSS variable not found and no default was provided.\n\n",
993
+ "75": "important requires a valid style object, got a %s instead.\n\n",
994
+ "76": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n\n",
995
+ "77": "remToPx expects a value in \"rem\" but you provided it in \"%s\".\n\n",
996
+ "78": "base must be set in \"px\" or \"%\" but you set it in \"%s\".\n"
248
997
  };
998
+
249
999
  /**
250
1000
  * super basic version of sprintf
251
1001
  * @private
252
1002
  */
253
-
254
1003
  function format() {
255
1004
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
256
1005
  args[_key] = arguments[_key];
257
1006
  }
258
-
259
1007
  var a = args[0];
260
1008
  var b = [];
261
1009
  var c;
262
-
263
1010
  for (c = 1; c < args.length; c += 1) {
264
1011
  b.push(args[c]);
265
1012
  }
266
-
267
1013
  b.forEach(function (d) {
268
1014
  a = a.replace(/%[a-z]/, d);
269
1015
  });
270
1016
  return a;
271
1017
  }
1018
+
272
1019
  /**
273
1020
  * Create an error file out of errors.md for development and a simple web link to the full errors
274
1021
  * in production mode.
275
1022
  * @private
276
1023
  */
277
-
278
-
279
1024
  var PolishedError = /*#__PURE__*/function (_Error) {
280
1025
  _inheritsLoose(PolishedError, _Error);
281
-
282
1026
  function PolishedError(code) {
283
1027
  var _this;
284
-
285
1028
  if (process.env.NODE_ENV === 'production') {
286
1029
  _this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
287
1030
  } else {
288
1031
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
289
1032
  args[_key2 - 1] = arguments[_key2];
290
1033
  }
291
-
292
1034
  _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
293
1035
  }
294
-
295
1036
  return _assertThisInitialized(_this);
296
1037
  }
297
-
298
1038
  return PolishedError;
299
1039
  }( /*#__PURE__*/_wrapNativeSuper(Error));
300
1040
 
301
1041
  function colorToInt(color) {
302
1042
  return Math.round(color * 255);
303
1043
  }
304
-
305
1044
  function convertToInt(red, green, blue) {
306
1045
  return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
307
1046
  }
308
-
309
1047
  function hslToRgb(hue, saturation, lightness, convert) {
310
1048
  if (convert === void 0) {
311
1049
  convert = convertToInt;
312
1050
  }
313
-
314
1051
  if (saturation === 0) {
315
1052
  // achromatic
316
1053
  return convert(lightness, lightness, lightness);
317
- } // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
318
-
1054
+ }
319
1055
 
1056
+ // formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
320
1057
  var huePrime = (hue % 360 + 360) % 360 / 60;
321
1058
  var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
322
1059
  var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
323
1060
  var red = 0;
324
1061
  var green = 0;
325
1062
  var blue = 0;
326
-
327
1063
  if (huePrime >= 0 && huePrime < 1) {
328
1064
  red = chroma;
329
1065
  green = secondComponent;
@@ -343,7 +1079,6 @@ function hslToRgb(hue, saturation, lightness, convert) {
343
1079
  red = chroma;
344
1080
  blue = secondComponent;
345
1081
  }
346
-
347
1082
  var lightnessModification = lightness - chroma / 2;
348
1083
  var finalRed = red + lightnessModification;
349
1084
  var finalGreen = green + lightnessModification;
@@ -501,11 +1236,11 @@ var namedColorMap = {
501
1236
  yellow: 'ff0',
502
1237
  yellowgreen: '9acd32'
503
1238
  };
1239
+
504
1240
  /**
505
1241
  * Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
506
1242
  * @private
507
1243
  */
508
-
509
1244
  function nameToHex(color) {
510
1245
  if (typeof color !== 'string') return color;
511
1246
  var normalizedColorName = color.toLowerCase();
@@ -516,10 +1251,11 @@ var hexRegex = /^#[a-fA-F0-9]{6}$/;
516
1251
  var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
517
1252
  var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
518
1253
  var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
519
- var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
520
- var rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
521
- var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
522
- var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
1254
+ var rgbRegex = /^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i;
1255
+ var rgbaRegex = /^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
1256
+ var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
1257
+ var hslaRegex = /^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;
1258
+
523
1259
  /**
524
1260
  * Returns an RgbColor or RgbaColor object. This utility function is only useful
525
1261
  * if want to extract a color component. With the color util `toColorString` you
@@ -531,14 +1267,11 @@ var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*
531
1267
  * // Assigns `{ red: 92, green: 102, blue: 112, alpha: 0.75 }` to color2
532
1268
  * const color2 = parseToRgb('hsla(210, 10%, 40%, 0.75)');
533
1269
  */
534
-
535
1270
  function parseToRgb(color) {
536
1271
  if (typeof color !== 'string') {
537
1272
  throw new PolishedError(3);
538
1273
  }
539
-
540
1274
  var normalizedColor = nameToHex(color);
541
-
542
1275
  if (normalizedColor.match(hexRegex)) {
543
1276
  return {
544
1277
  red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
@@ -546,7 +1279,6 @@ function parseToRgb(color) {
546
1279
  blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
547
1280
  };
548
1281
  }
549
-
550
1282
  if (normalizedColor.match(hexRgbaRegex)) {
551
1283
  var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
552
1284
  return {
@@ -556,7 +1288,6 @@ function parseToRgb(color) {
556
1288
  alpha: alpha
557
1289
  };
558
1290
  }
559
-
560
1291
  if (normalizedColor.match(reducedHexRegex)) {
561
1292
  return {
562
1293
  red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
@@ -564,10 +1295,8 @@ function parseToRgb(color) {
564
1295
  blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
565
1296
  };
566
1297
  }
567
-
568
1298
  if (normalizedColor.match(reducedRgbaHexRegex)) {
569
1299
  var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
570
-
571
1300
  return {
572
1301
  red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
573
1302
  green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
@@ -575,9 +1304,7 @@ function parseToRgb(color) {
575
1304
  alpha: _alpha
576
1305
  };
577
1306
  }
578
-
579
1307
  var rgbMatched = rgbRegex.exec(normalizedColor);
580
-
581
1308
  if (rgbMatched) {
582
1309
  return {
583
1310
  red: parseInt("" + rgbMatched[1], 10),
@@ -585,66 +1312,124 @@ function parseToRgb(color) {
585
1312
  blue: parseInt("" + rgbMatched[3], 10)
586
1313
  };
587
1314
  }
588
-
589
1315
  var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
590
-
591
1316
  if (rgbaMatched) {
592
1317
  return {
593
1318
  red: parseInt("" + rgbaMatched[1], 10),
594
1319
  green: parseInt("" + rgbaMatched[2], 10),
595
1320
  blue: parseInt("" + rgbaMatched[3], 10),
596
- alpha: parseFloat("" + rgbaMatched[4])
1321
+ alpha: parseFloat("" + rgbaMatched[4]) > 1 ? parseFloat("" + rgbaMatched[4]) / 100 : parseFloat("" + rgbaMatched[4])
597
1322
  };
598
1323
  }
599
-
600
1324
  var hslMatched = hslRegex.exec(normalizedColor);
601
-
602
1325
  if (hslMatched) {
603
1326
  var hue = parseInt("" + hslMatched[1], 10);
604
1327
  var saturation = parseInt("" + hslMatched[2], 10) / 100;
605
1328
  var lightness = parseInt("" + hslMatched[3], 10) / 100;
606
1329
  var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
607
1330
  var hslRgbMatched = rgbRegex.exec(rgbColorString);
608
-
609
1331
  if (!hslRgbMatched) {
610
1332
  throw new PolishedError(4, normalizedColor, rgbColorString);
611
1333
  }
612
-
613
1334
  return {
614
1335
  red: parseInt("" + hslRgbMatched[1], 10),
615
1336
  green: parseInt("" + hslRgbMatched[2], 10),
616
1337
  blue: parseInt("" + hslRgbMatched[3], 10)
617
1338
  };
618
1339
  }
619
-
620
1340
  var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
621
-
622
1341
  if (hslaMatched) {
623
1342
  var _hue = parseInt("" + hslaMatched[1], 10);
624
-
625
1343
  var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
626
-
627
1344
  var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
628
-
629
1345
  var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
630
-
631
1346
  var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
632
-
633
1347
  if (!_hslRgbMatched) {
634
1348
  throw new PolishedError(4, normalizedColor, _rgbColorString);
635
1349
  }
636
-
637
1350
  return {
638
1351
  red: parseInt("" + _hslRgbMatched[1], 10),
639
1352
  green: parseInt("" + _hslRgbMatched[2], 10),
640
1353
  blue: parseInt("" + _hslRgbMatched[3], 10),
641
- alpha: parseFloat("" + hslaMatched[4])
1354
+ alpha: parseFloat("" + hslaMatched[4]) > 1 ? parseFloat("" + hslaMatched[4]) / 100 : parseFloat("" + hslaMatched[4])
642
1355
  };
643
1356
  }
644
-
645
1357
  throw new PolishedError(5);
646
1358
  }
647
1359
 
1360
+ function rgbToHsl(color) {
1361
+ // make sure rgb are contained in a set of [0, 255]
1362
+ var red = color.red / 255;
1363
+ var green = color.green / 255;
1364
+ var blue = color.blue / 255;
1365
+ var max = Math.max(red, green, blue);
1366
+ var min = Math.min(red, green, blue);
1367
+ var lightness = (max + min) / 2;
1368
+ if (max === min) {
1369
+ // achromatic
1370
+ if (color.alpha !== undefined) {
1371
+ return {
1372
+ hue: 0,
1373
+ saturation: 0,
1374
+ lightness: lightness,
1375
+ alpha: color.alpha
1376
+ };
1377
+ } else {
1378
+ return {
1379
+ hue: 0,
1380
+ saturation: 0,
1381
+ lightness: lightness
1382
+ };
1383
+ }
1384
+ }
1385
+ var hue;
1386
+ var delta = max - min;
1387
+ var saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
1388
+ switch (max) {
1389
+ case red:
1390
+ hue = (green - blue) / delta + (green < blue ? 6 : 0);
1391
+ break;
1392
+ case green:
1393
+ hue = (blue - red) / delta + 2;
1394
+ break;
1395
+ default:
1396
+ // blue case
1397
+ hue = (red - green) / delta + 4;
1398
+ break;
1399
+ }
1400
+ hue *= 60;
1401
+ if (color.alpha !== undefined) {
1402
+ return {
1403
+ hue: hue,
1404
+ saturation: saturation,
1405
+ lightness: lightness,
1406
+ alpha: color.alpha
1407
+ };
1408
+ }
1409
+ return {
1410
+ hue: hue,
1411
+ saturation: saturation,
1412
+ lightness: lightness
1413
+ };
1414
+ }
1415
+
1416
+ /**
1417
+ * Returns an HslColor or HslaColor object. This utility function is only useful
1418
+ * if want to extract a color component. With the color util `toColorString` you
1419
+ * can convert a HslColor or HslaColor object back to a string.
1420
+ *
1421
+ * @example
1422
+ * // Assigns `{ hue: 0, saturation: 1, lightness: 0.5 }` to color1
1423
+ * const color1 = parseToHsl('rgb(255, 0, 0)');
1424
+ * // Assigns `{ hue: 128, saturation: 1, lightness: 0.5, alpha: 0.75 }` to color2
1425
+ * const color2 = parseToHsl('hsla(128, 100%, 50%, 0.75)');
1426
+ */
1427
+ function parseToHsl(color) {
1428
+ // Note: At a later stage we can optimize this function as right now a hsl
1429
+ // color would be parsed converted to rgb values and converted back to hsl.
1430
+ return rgbToHsl(parseToRgb(color));
1431
+ }
1432
+
648
1433
  /**
649
1434
  * Reduces hex values if possible e.g. #ff8866 to #f86
650
1435
  * @private
@@ -653,15 +1438,88 @@ var reduceHexValue = function reduceHexValue(value) {
653
1438
  if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
654
1439
  return "#" + value[1] + value[3] + value[5];
655
1440
  }
656
-
657
1441
  return value;
658
1442
  };
1443
+ var reduceHexValue$1 = reduceHexValue;
659
1444
 
660
1445
  function numberToHex(value) {
661
1446
  var hex = value.toString(16);
662
1447
  return hex.length === 1 ? "0" + hex : hex;
663
1448
  }
664
1449
 
1450
+ function colorToHex(color) {
1451
+ return numberToHex(Math.round(color * 255));
1452
+ }
1453
+ function convertToHex(red, green, blue) {
1454
+ return reduceHexValue$1("#" + colorToHex(red) + colorToHex(green) + colorToHex(blue));
1455
+ }
1456
+ function hslToHex(hue, saturation, lightness) {
1457
+ return hslToRgb(hue, saturation, lightness, convertToHex);
1458
+ }
1459
+
1460
+ /**
1461
+ * Returns a string value for the color. The returned result is the smallest possible hex notation.
1462
+ *
1463
+ * @example
1464
+ * // Styles as object usage
1465
+ * const styles = {
1466
+ * background: hsl(359, 0.75, 0.4),
1467
+ * background: hsl({ hue: 360, saturation: 0.75, lightness: 0.4 }),
1468
+ * }
1469
+ *
1470
+ * // styled-components usage
1471
+ * const div = styled.div`
1472
+ * background: ${hsl(359, 0.75, 0.4)};
1473
+ * background: ${hsl({ hue: 360, saturation: 0.75, lightness: 0.4 })};
1474
+ * `
1475
+ *
1476
+ * // CSS in JS Output
1477
+ *
1478
+ * element {
1479
+ * background: "#b3191c";
1480
+ * background: "#b3191c";
1481
+ * }
1482
+ */
1483
+ function hsl(value, saturation, lightness) {
1484
+ if (typeof value === 'object' && saturation === undefined && lightness === undefined) {
1485
+ return hslToHex(value.hue, value.saturation, value.lightness);
1486
+ }
1487
+ throw new PolishedError(1);
1488
+ }
1489
+
1490
+ /**
1491
+ * Returns a string value for the color. The returned result is the smallest possible rgba or hex notation.
1492
+ *
1493
+ * @example
1494
+ * // Styles as object usage
1495
+ * const styles = {
1496
+ * background: hsla(359, 0.75, 0.4, 0.7),
1497
+ * background: hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 }),
1498
+ * background: hsla(359, 0.75, 0.4, 1),
1499
+ * }
1500
+ *
1501
+ * // styled-components usage
1502
+ * const div = styled.div`
1503
+ * background: ${hsla(359, 0.75, 0.4, 0.7)};
1504
+ * background: ${hsla({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0,7 })};
1505
+ * background: ${hsla(359, 0.75, 0.4, 1)};
1506
+ * `
1507
+ *
1508
+ * // CSS in JS Output
1509
+ *
1510
+ * element {
1511
+ * background: "rgba(179,25,28,0.7)";
1512
+ * background: "rgba(179,25,28,0.7)";
1513
+ * background: "#b3191c";
1514
+ * }
1515
+ */
1516
+ function hsla(value, saturation, lightness, alpha) {
1517
+ if (typeof value === 'object' && saturation === undefined && lightness === undefined && alpha === undefined) {
1518
+ return value.alpha >= 1 ? hslToHex(value.hue, value.saturation, value.lightness) : "rgba(" + hslToRgb(value.hue, value.saturation, value.lightness) + "," + value.alpha + ")";
1519
+ }
1520
+ throw new PolishedError(2);
1521
+ }
1522
+
665
1523
  /**
666
1524
  * Returns a string value for the color. The returned result is the smallest possible hex notation.
667
1525
  *
@@ -687,11 +1545,10 @@ function numberToHex(value) {
687
1545
  */
688
1546
  function rgb(value, green, blue) {
689
1547
  if (typeof value === 'number' && typeof green === 'number' && typeof blue === 'number') {
690
- return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
1548
+ return reduceHexValue$1("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
691
1549
  } else if (typeof value === 'object' && green === undefined && blue === undefined) {
692
- return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
1550
+ return reduceHexValue$1("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
693
1551
  }
694
-
695
1552
  throw new PolishedError(6);
696
1553
  }
697
1554
 
@@ -733,10 +1590,62 @@ function rgba(firstValue, secondValue, thirdValue, fourthValue) {
733
1590
  if (typeof firstValue === 'object' && secondValue === undefined && thirdValue === undefined && fourthValue === undefined) {
734
1591
  return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
735
1592
  }
736
-
737
1593
  throw new PolishedError(7);
738
1594
  }
739
1595
 
1596
+ var isRgb = function isRgb(color) {
1597
+ return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
1598
+ };
1599
+ var isRgba = function isRgba(color) {
1600
+ return typeof color.red === 'number' && typeof color.green === 'number' && typeof color.blue === 'number' && typeof color.alpha === 'number';
1601
+ };
1602
+ var isHsl = function isHsl(color) {
1603
+ return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && (typeof color.alpha !== 'number' || typeof color.alpha === 'undefined');
1604
+ };
1605
+ var isHsla = function isHsla(color) {
1606
+ return typeof color.hue === 'number' && typeof color.saturation === 'number' && typeof color.lightness === 'number' && typeof color.alpha === 'number';
1607
+ };
1608
+
1609
+ /**
1610
+ * Converts a RgbColor, RgbaColor, HslColor or HslaColor object to a color string.
1611
+ * This util is useful in case you only know on runtime which color object is
1612
+ * used. Otherwise we recommend to rely on `rgb`, `rgba`, `hsl` or `hsla`.
1613
+ *
1614
+ * @example
1615
+ * // Styles as object usage
1616
+ * const styles = {
1617
+ * background: toColorString({ red: 255, green: 205, blue: 100 }),
1618
+ * background: toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 }),
1619
+ * background: toColorString({ hue: 240, saturation: 1, lightness: 0.5 }),
1620
+ * background: toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 }),
1621
+ * }
1622
+ *
1623
+ * // styled-components usage
1624
+ * const div = styled.div`
1625
+ * background: ${toColorString({ red: 255, green: 205, blue: 100 })};
1626
+ * background: ${toColorString({ red: 255, green: 205, blue: 100, alpha: 0.72 })};
1627
+ * background: ${toColorString({ hue: 240, saturation: 1, lightness: 0.5 })};
1628
+ * background: ${toColorString({ hue: 360, saturation: 0.75, lightness: 0.4, alpha: 0.72 })};
1629
+ * `
1630
+ *
1631
+ * // CSS in JS Output
1632
+ * element {
1633
+ * background: "#ffcd64";
1634
+ * background: "rgba(255,205,100,0.72)";
1635
+ * background: "#00f";
1636
+ * background: "rgba(179,25,25,0.72)";
1637
+ * }
1638
+ */
1639
+
1640
+ function toColorString(color) {
1641
+ if (typeof color !== 'object') throw new PolishedError(8);
1642
+ if (isRgba(color)) return rgba(color);
1643
+ if (isRgb(color)) return rgb(color);
1644
+ if (isHsla(color)) return hsla(color);
1645
+ if (isHsl(color)) return hsl(color);
1646
+ throw new PolishedError(8);
1647
+ }
1648
+
740
1649
  // Type definitions taken from https://github.com/gcanti/flow-static-land/blob/master/src/Fun.js
741
1650
  // eslint-disable-next-line no-unused-vars
742
1651
  // eslint-disable-next-line no-unused-vars
@@ -747,18 +1656,453 @@ function curried(f, length, acc) {
747
1656
  var combined = acc.concat(Array.prototype.slice.call(arguments));
748
1657
  return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
749
1658
  };
750
- } // eslint-disable-next-line no-redeclare
751
-
1659
+ }
752
1660
 
1661
+ // eslint-disable-next-line no-redeclare
753
1662
  function curry(f) {
754
1663
  // eslint-disable-line no-redeclare
755
1664
  return curried(f, f.length, []);
756
1665
  }
757
1666
 
1667
+ /**
1668
+ * Changes the hue of the color. Hue is a number between 0 to 360. The first
1669
+ * argument for adjustHue is the amount of degrees the color is rotated around
1670
+ * the color wheel, always producing a positive hue value.
1671
+ *
1672
+ * @example
1673
+ * // Styles as object usage
1674
+ * const styles = {
1675
+ * background: adjustHue(180, '#448'),
1676
+ * background: adjustHue('180', 'rgba(101,100,205,0.7)'),
1677
+ * }
1678
+ *
1679
+ * // styled-components usage
1680
+ * const div = styled.div`
1681
+ * background: ${adjustHue(180, '#448')};
1682
+ * background: ${adjustHue('180', 'rgba(101,100,205,0.7)')};
1683
+ * `
1684
+ *
1685
+ * // CSS in JS Output
1686
+ * element {
1687
+ * background: "#888844";
1688
+ * background: "rgba(136,136,68,0.7)";
1689
+ * }
1690
+ */
1691
+ function adjustHue(degree, color) {
1692
+ if (color === 'transparent') return color;
1693
+ var hslColor = parseToHsl(color);
1694
+ return toColorString(_extends({}, hslColor, {
1695
+ hue: hslColor.hue + parseFloat(degree)
1696
+ }));
1697
+ }
1698
+
1699
+ // prettier-ignore
1700
+ curry /* ::<number | string, string, string> */(adjustHue);
1701
+
758
1702
  function guard(lowerBoundary, upperBoundary, value) {
759
1703
  return Math.max(lowerBoundary, Math.min(upperBoundary, value));
760
1704
  }
761
1705
 
1706
+ /**
1707
+ * Returns a string value for the darkened color.
1708
+ *
1709
+ * @example
1710
+ * // Styles as object usage
1711
+ * const styles = {
1712
+ * background: darken(0.2, '#FFCD64'),
1713
+ * background: darken('0.2', 'rgba(255,205,100,0.7)'),
1714
+ * }
1715
+ *
1716
+ * // styled-components usage
1717
+ * const div = styled.div`
1718
+ * background: ${darken(0.2, '#FFCD64')};
1719
+ * background: ${darken('0.2', 'rgba(255,205,100,0.7)')};
1720
+ * `
1721
+ *
1722
+ * // CSS in JS Output
1723
+ *
1724
+ * element {
1725
+ * background: "#ffbd31";
1726
+ * background: "rgba(255,189,49,0.7)";
1727
+ * }
1728
+ */
1729
+ function darken(amount, color) {
1730
+ if (color === 'transparent') return color;
1731
+ var hslColor = parseToHsl(color);
1732
+ return toColorString(_extends({}, hslColor, {
1733
+ lightness: guard(0, 1, hslColor.lightness - parseFloat(amount))
1734
+ }));
1735
+ }
1736
+
1737
+ // prettier-ignore
1738
+ curry /* ::<number | string, string, string> */(darken);
1739
+
1740
+ /**
1741
+ * Decreases the intensity of a color. Its range is between 0 to 1. The first
1742
+ * argument of the desaturate function is the amount by how much the color
1743
+ * intensity should be decreased.
1744
+ *
1745
+ * @example
1746
+ * // Styles as object usage
1747
+ * const styles = {
1748
+ * background: desaturate(0.2, '#CCCD64'),
1749
+ * background: desaturate('0.2', 'rgba(204,205,100,0.7)'),
1750
+ * }
1751
+ *
1752
+ * // styled-components usage
1753
+ * const div = styled.div`
1754
+ * background: ${desaturate(0.2, '#CCCD64')};
1755
+ * background: ${desaturate('0.2', 'rgba(204,205,100,0.7)')};
1756
+ * `
1757
+ *
1758
+ * // CSS in JS Output
1759
+ * element {
1760
+ * background: "#b8b979";
1761
+ * background: "rgba(184,185,121,0.7)";
1762
+ * }
1763
+ */
1764
+ function desaturate(amount, color) {
1765
+ if (color === 'transparent') return color;
1766
+ var hslColor = parseToHsl(color);
1767
+ return toColorString(_extends({}, hslColor, {
1768
+ saturation: guard(0, 1, hslColor.saturation - parseFloat(amount))
1769
+ }));
1770
+ }
1771
+
1772
+ // prettier-ignore
1773
+ curry /* ::<number | string, string, string> */(desaturate);
1774
+
1775
+ /**
1776
+ * Returns a string value for the lightened color.
1777
+ *
1778
+ * @example
1779
+ * // Styles as object usage
1780
+ * const styles = {
1781
+ * background: lighten(0.2, '#CCCD64'),
1782
+ * background: lighten('0.2', 'rgba(204,205,100,0.7)'),
1783
+ * }
1784
+ *
1785
+ * // styled-components usage
1786
+ * const div = styled.div`
1787
+ * background: ${lighten(0.2, '#FFCD64')};
1788
+ * background: ${lighten('0.2', 'rgba(204,205,100,0.7)')};
1789
+ * `
1790
+ *
1791
+ * // CSS in JS Output
1792
+ *
1793
+ * element {
1794
+ * background: "#e5e6b1";
1795
+ * background: "rgba(229,230,177,0.7)";
1796
+ * }
1797
+ */
1798
+ function lighten(amount, color) {
1799
+ if (color === 'transparent') return color;
1800
+ var hslColor = parseToHsl(color);
1801
+ return toColorString(_extends({}, hslColor, {
1802
+ lightness: guard(0, 1, hslColor.lightness + parseFloat(amount))
1803
+ }));
1804
+ }
1805
+
1806
+ // prettier-ignore
1807
+ curry /* ::<number | string, string, string> */(lighten);
1808
+
1809
+ /**
1810
+ * Mixes the two provided colors together by calculating the average of each of the RGB components weighted to the first color by the provided weight.
1811
+ *
1812
+ * @example
1813
+ * // Styles as object usage
1814
+ * const styles = {
1815
+ * background: mix(0.5, '#f00', '#00f')
1816
+ * background: mix(0.25, '#f00', '#00f')
1817
+ * background: mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')
1818
+ * }
1819
+ *
1820
+ * // styled-components usage
1821
+ * const div = styled.div`
1822
+ * background: ${mix(0.5, '#f00', '#00f')};
1823
+ * background: ${mix(0.25, '#f00', '#00f')};
1824
+ * background: ${mix('0.5', 'rgba(255, 0, 0, 0.5)', '#00f')};
1825
+ * `
1826
+ *
1827
+ * // CSS in JS Output
1828
+ *
1829
+ * element {
1830
+ * background: "#7f007f";
1831
+ * background: "#3f00bf";
1832
+ * background: "rgba(63, 0, 191, 0.75)";
1833
+ * }
1834
+ */
1835
+ function mix(weight, color, otherColor) {
1836
+ if (color === 'transparent') return otherColor;
1837
+ if (otherColor === 'transparent') return color;
1838
+ if (weight === 0) return otherColor;
1839
+ var parsedColor1 = parseToRgb(color);
1840
+ var color1 = _extends({}, parsedColor1, {
1841
+ alpha: typeof parsedColor1.alpha === 'number' ? parsedColor1.alpha : 1
1842
+ });
1843
+ var parsedColor2 = parseToRgb(otherColor);
1844
+ var color2 = _extends({}, parsedColor2, {
1845
+ alpha: typeof parsedColor2.alpha === 'number' ? parsedColor2.alpha : 1
1846
+ });
1847
+
1848
+ // The formula is copied from the original Sass implementation:
1849
+ // http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
1850
+ var alphaDelta = color1.alpha - color2.alpha;
1851
+ var x = parseFloat(weight) * 2 - 1;
1852
+ var y = x * alphaDelta === -1 ? x : x + alphaDelta;
1853
+ var z = 1 + x * alphaDelta;
1854
+ var weight1 = (y / z + 1) / 2.0;
1855
+ var weight2 = 1 - weight1;
1856
+ var mixedColor = {
1857
+ red: Math.floor(color1.red * weight1 + color2.red * weight2),
1858
+ green: Math.floor(color1.green * weight1 + color2.green * weight2),
1859
+ blue: Math.floor(color1.blue * weight1 + color2.blue * weight2),
1860
+ alpha: color1.alpha * parseFloat(weight) + color2.alpha * (1 - parseFloat(weight))
1861
+ };
1862
+ return rgba(mixedColor);
1863
+ }
1864
+
1865
+ // prettier-ignore
1866
+ var curriedMix = curry /* ::<number | string, string, string, string> */(mix);
1867
+ var mix$1 = curriedMix;
1868
+
1869
+ /**
1870
+ * Increases the opacity of a color. Its range for the amount is between 0 to 1.
1871
+ *
1872
+ *
1873
+ * @example
1874
+ * // Styles as object usage
1875
+ * const styles = {
1876
+ * background: opacify(0.1, 'rgba(255, 255, 255, 0.9)');
1877
+ * background: opacify(0.2, 'hsla(0, 0%, 100%, 0.5)'),
1878
+ * background: opacify('0.5', 'rgba(255, 0, 0, 0.2)'),
1879
+ * }
1880
+ *
1881
+ * // styled-components usage
1882
+ * const div = styled.div`
1883
+ * background: ${opacify(0.1, 'rgba(255, 255, 255, 0.9)')};
1884
+ * background: ${opacify(0.2, 'hsla(0, 0%, 100%, 0.5)')},
1885
+ * background: ${opacify('0.5', 'rgba(255, 0, 0, 0.2)')},
1886
+ * `
1887
+ *
1888
+ * // CSS in JS Output
1889
+ *
1890
+ * element {
1891
+ * background: "#fff";
1892
+ * background: "rgba(255,255,255,0.7)";
1893
+ * background: "rgba(255,0,0,0.7)";
1894
+ * }
1895
+ */
1896
+ function opacify(amount, color) {
1897
+ if (color === 'transparent') return color;
1898
+ var parsedColor = parseToRgb(color);
1899
+ var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
1900
+ var colorWithAlpha = _extends({}, parsedColor, {
1901
+ alpha: guard(0, 1, (alpha * 100 + parseFloat(amount) * 100) / 100)
1902
+ });
1903
+ return rgba(colorWithAlpha);
1904
+ }
1905
+
1906
+ // prettier-ignore
1907
+ curry /* ::<number | string, string, string> */(opacify);
1908
+
1909
+ /**
1910
+ * Increases the intensity of a color. Its range is between 0 to 1. The first
1911
+ * argument of the saturate function is the amount by how much the color
1912
+ * intensity should be increased.
1913
+ *
1914
+ * @example
1915
+ * // Styles as object usage
1916
+ * const styles = {
1917
+ * background: saturate(0.2, '#CCCD64'),
1918
+ * background: saturate('0.2', 'rgba(204,205,100,0.7)'),
1919
+ * }
1920
+ *
1921
+ * // styled-components usage
1922
+ * const div = styled.div`
1923
+ * background: ${saturate(0.2, '#FFCD64')};
1924
+ * background: ${saturate('0.2', 'rgba(204,205,100,0.7)')};
1925
+ * `
1926
+ *
1927
+ * // CSS in JS Output
1928
+ *
1929
+ * element {
1930
+ * background: "#e0e250";
1931
+ * background: "rgba(224,226,80,0.7)";
1932
+ * }
1933
+ */
1934
+ function saturate(amount, color) {
1935
+ if (color === 'transparent') return color;
1936
+ var hslColor = parseToHsl(color);
1937
+ return toColorString(_extends({}, hslColor, {
1938
+ saturation: guard(0, 1, hslColor.saturation + parseFloat(amount))
1939
+ }));
1940
+ }
1941
+
1942
+ // prettier-ignore
1943
+ curry /* ::<number | string, string, string> */(saturate);
1944
+
1945
+ /**
1946
+ * Sets the hue of a color to the provided value. The hue range can be
1947
+ * from 0 and 359.
1948
+ *
1949
+ * @example
1950
+ * // Styles as object usage
1951
+ * const styles = {
1952
+ * background: setHue(42, '#CCCD64'),
1953
+ * background: setHue('244', 'rgba(204,205,100,0.7)'),
1954
+ * }
1955
+ *
1956
+ * // styled-components usage
1957
+ * const div = styled.div`
1958
+ * background: ${setHue(42, '#CCCD64')};
1959
+ * background: ${setHue('244', 'rgba(204,205,100,0.7)')};
1960
+ * `
1961
+ *
1962
+ * // CSS in JS Output
1963
+ * element {
1964
+ * background: "#cdae64";
1965
+ * background: "rgba(107,100,205,0.7)";
1966
+ * }
1967
+ */
1968
+ function setHue(hue, color) {
1969
+ if (color === 'transparent') return color;
1970
+ return toColorString(_extends({}, parseToHsl(color), {
1971
+ hue: parseFloat(hue)
1972
+ }));
1973
+ }
1974
+
1975
+ // prettier-ignore
1976
+ curry /* ::<number | string, string, string> */(setHue);
1977
+
1978
+ /**
1979
+ * Sets the lightness of a color to the provided value. The lightness range can be
1980
+ * from 0 and 1.
1981
+ *
1982
+ * @example
1983
+ * // Styles as object usage
1984
+ * const styles = {
1985
+ * background: setLightness(0.2, '#CCCD64'),
1986
+ * background: setLightness('0.75', 'rgba(204,205,100,0.7)'),
1987
+ * }
1988
+ *
1989
+ * // styled-components usage
1990
+ * const div = styled.div`
1991
+ * background: ${setLightness(0.2, '#CCCD64')};
1992
+ * background: ${setLightness('0.75', 'rgba(204,205,100,0.7)')};
1993
+ * `
1994
+ *
1995
+ * // CSS in JS Output
1996
+ * element {
1997
+ * background: "#4d4d19";
1998
+ * background: "rgba(223,224,159,0.7)";
1999
+ * }
2000
+ */
2001
+ function setLightness(lightness, color) {
2002
+ if (color === 'transparent') return color;
2003
+ return toColorString(_extends({}, parseToHsl(color), {
2004
+ lightness: parseFloat(lightness)
2005
+ }));
2006
+ }
2007
+
2008
+ // prettier-ignore
2009
+ curry /* ::<number | string, string, string> */(setLightness);
2010
+
2011
+ /**
2012
+ * Sets the saturation of a color to the provided value. The saturation range can be
2013
+ * from 0 and 1.
2014
+ *
2015
+ * @example
2016
+ * // Styles as object usage
2017
+ * const styles = {
2018
+ * background: setSaturation(0.2, '#CCCD64'),
2019
+ * background: setSaturation('0.75', 'rgba(204,205,100,0.7)'),
2020
+ * }
2021
+ *
2022
+ * // styled-components usage
2023
+ * const div = styled.div`
2024
+ * background: ${setSaturation(0.2, '#CCCD64')};
2025
+ * background: ${setSaturation('0.75', 'rgba(204,205,100,0.7)')};
2026
+ * `
2027
+ *
2028
+ * // CSS in JS Output
2029
+ * element {
2030
+ * background: "#adad84";
2031
+ * background: "rgba(228,229,76,0.7)";
2032
+ * }
2033
+ */
2034
+ function setSaturation(saturation, color) {
2035
+ if (color === 'transparent') return color;
2036
+ return toColorString(_extends({}, parseToHsl(color), {
2037
+ saturation: parseFloat(saturation)
2038
+ }));
2039
+ }
2040
+
2041
+ // prettier-ignore
2042
+ curry /* ::<number | string, string, string> */(setSaturation);
2043
+
2044
+ /**
2045
+ * Shades a color by mixing it with black. `shade` can produce
2046
+ * hue shifts, where as `darken` manipulates the luminance channel and therefore
2047
+ * doesn't produce hue shifts.
2048
+ *
2049
+ * @example
2050
+ * // Styles as object usage
2051
+ * const styles = {
2052
+ * background: shade(0.25, '#00f')
2053
+ * }
2054
+ *
2055
+ * // styled-components usage
2056
+ * const div = styled.div`
2057
+ * background: ${shade(0.25, '#00f')};
2058
+ * `
2059
+ *
2060
+ * // CSS in JS Output
2061
+ *
2062
+ * element {
2063
+ * background: "#00003f";
2064
+ * }
2065
+ */
2066
+
2067
+ function shade(percentage, color) {
2068
+ if (color === 'transparent') return color;
2069
+ return mix$1(parseFloat(percentage), 'rgb(0, 0, 0)', color);
2070
+ }
2071
+
2072
+ // prettier-ignore
2073
+ curry /* ::<number | string, string, string> */(shade);
2074
+
2075
+ /**
2076
+ * Tints a color by mixing it with white. `tint` can produce
2077
+ * hue shifts, where as `lighten` manipulates the luminance channel and therefore
2078
+ * doesn't produce hue shifts.
2079
+ *
2080
+ * @example
2081
+ * // Styles as object usage
2082
+ * const styles = {
2083
+ * background: tint(0.25, '#00f')
2084
+ * }
2085
+ *
2086
+ * // styled-components usage
2087
+ * const div = styled.div`
2088
+ * background: ${tint(0.25, '#00f')};
2089
+ * `
2090
+ *
2091
+ * // CSS in JS Output
2092
+ *
2093
+ * element {
2094
+ * background: "#bfbfff";
2095
+ * }
2096
+ */
2097
+
2098
+ function tint(percentage, color) {
2099
+ if (color === 'transparent') return color;
2100
+ return mix$1(parseFloat(percentage), 'rgb(255, 255, 255)', color);
2101
+ }
2102
+
2103
+ // prettier-ignore
2104
+ curry /* ::<number | string, string, string> */(tint);
2105
+
762
2106
  /**
763
2107
  * Decreases the opacity of a color. Its range for the amount is between 0 to 1.
764
2108
  *
@@ -766,7 +2110,7 @@ function guard(lowerBoundary, upperBoundary, value) {
766
2110
  * @example
767
2111
  * // Styles as object usage
768
2112
  * const styles = {
769
- * background: transparentize(0.1, '#fff');
2113
+ * background: transparentize(0.1, '#fff'),
770
2114
  * background: transparentize(0.2, 'hsl(0, 0%, 100%)'),
771
2115
  * background: transparentize('0.5', 'rgba(255, 0, 0, 0.8)'),
772
2116
  * }
@@ -774,8 +2118,8 @@ function guard(lowerBoundary, upperBoundary, value) {
774
2118
  * // styled-components usage
775
2119
  * const div = styled.div`
776
2120
  * background: ${transparentize(0.1, '#fff')};
777
- * background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')},
778
- * background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')},
2121
+ * background: ${transparentize(0.2, 'hsl(0, 0%, 100%)')};
2122
+ * background: ${transparentize('0.5', 'rgba(255, 0, 0, 0.8)')};
779
2123
  * `
780
2124
  *
781
2125
  * // CSS in JS Output
@@ -786,23 +2130,19 @@ function guard(lowerBoundary, upperBoundary, value) {
786
2130
  * background: "rgba(255,0,0,0.3)";
787
2131
  * }
788
2132
  */
789
-
790
2133
  function transparentize(amount, color) {
791
2134
  if (color === 'transparent') return color;
792
2135
  var parsedColor = parseToRgb(color);
793
2136
  var alpha = typeof parsedColor.alpha === 'number' ? parsedColor.alpha : 1;
794
-
795
2137
  var colorWithAlpha = _extends({}, parsedColor, {
796
2138
  alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
797
2139
  });
798
-
799
2140
  return rgba(colorWithAlpha);
800
- } // prettier-ignore
801
-
2141
+ }
802
2142
 
803
- var curriedTransparentize = /*#__PURE__*/curry
804
- /* ::<number | string, string, string> */
805
- (transparentize);
2143
+ // prettier-ignore
2144
+ var curriedTransparentize = curry /* ::<number | string, string, string> */(transparentize);
2145
+ var curriedTransparentize$1 = curriedTransparentize;
806
2146
 
807
2147
  var FOCUSABLE_SELECTOR = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
808
2148
  function getFocusableElements(container) {
@@ -994,7 +2334,7 @@ function ChartDataTable(_a) {
994
2334
  var rowKey = resolvedColumns
995
2335
  .map(function (col) { var _a; return String((_a = row[col.key]) !== null && _a !== void 0 ? _a : ''); })
996
2336
  .join('-');
997
- return (React__namespace.createElement(reactMagmaDom.TableRow, { key: "".concat(rowKey, "-").concat(index) }, resolvedColumns.map(function (col) { return (React__namespace.createElement(reactMagmaDom.TableCell, { key: col.key }, row[col.key])); })));
2337
+ return (React__namespace.createElement(reactMagmaDom.TableRow, { key: rowKey + "-" + index }, resolvedColumns.map(function (col) { return (React__namespace.createElement(reactMagmaDom.TableCell, { key: col.key }, row[col.key])); })));
998
2338
  }))));
999
2339
  }
1000
2340
 
@@ -1014,6 +2354,7 @@ var defaults = {
1014
2354
  * Reads chart toolbar i18n strings from the I18nContext if available,
1015
2355
  * falling back to English defaults.
1016
2356
  */
2357
+ // eslint-disable-next-line complexity
1017
2358
  function useChartToolbarI18n() {
1018
2359
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1019
2360
  var i18n = React__namespace.useContext(reactMagmaDom.I18nContext);
@@ -1061,7 +2402,8 @@ function ChartTableButton(_a) {
1061
2402
  }
1062
2403
 
1063
2404
  var ModalFooter = styled.div(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n display: flex;\n justify-content: flex-end;\n padding-top: ", ";\n"], ["\n display: flex;\n justify-content: flex-end;\n padding-top: ", ";\n"])), function (props) { return props.theme.spaceScale.spacing05; });
1064
- var HeaderLabel = styled.span(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n display: block;\n font-size: ", ";\n font-weight: normal;\n color: ", ";\n line-height: ", ";\n"], ["\n display: block;\n font-size: ", ";\n font-weight: normal;\n color: ", ";\n line-height: ", ";\n"])), function (props) { return props.theme.typeScale.size02.fontSize; }, function (props) {
2405
+ var HeaderLabel = styled.span(templateObject_2$2 || (templateObject_2$2 = __makeTemplateObject(["\n display: block;\n font-size: ", ";\n font-weight: normal;\n color: ", ";\n line-height: ", ";\n"], ["\n display: block;\n font-size: ", ";\n font-weight: normal;\n color: ",
2406
+ ";\n line-height: ", ";\n"])), function (props) { return props.theme.typeScale.size02.fontSize; }, function (props) {
1065
2407
  return props.isInverse
1066
2408
  ? props.theme.colors.neutral100
1067
2409
  : props.theme.colors.neutral500;
@@ -1124,7 +2466,9 @@ exports.CarbonChartType = void 0;
1124
2466
  CarbonChartType["combo"] = "combo";
1125
2467
  })(exports.CarbonChartType || (exports.CarbonChartType = {}));
1126
2468
  var ChartContentWrapper = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n position: relative;\n"], ["\n height: 100%;\n position: relative;\n"])));
1127
- var FullscreenRoot = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 100%;\n width: 100%;\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ", ";\n\n ", "\n }\n"], ["\n height: 100%;\n width: 100%;\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ", ";\n\n ", "\n }\n"])), function (props) {
2469
+ var FullscreenRoot = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 100%;\n width: 100%;\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ", ";\n\n ", "\n }\n"], ["\n height: 100%;\n width: 100%;\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ",
2470
+ ";\n\n ",
2471
+ "\n }\n"])), function (props) {
1128
2472
  return props.isInverse
1129
2473
  ? props.theme.colors.primary700
1130
2474
  : props.theme.colors.neutral100;
@@ -1133,7 +2477,48 @@ var FullscreenRoot = styled.div(templateObject_2 || (templateObject_2 = __makeTe
1133
2477
  ? "\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n padding: 2em;\n\n .carbon-chart-wrapper,\n .carbon-chart-content {\n display: flex;\n flex: 1 1 auto;\n flex-direction: column;\n min-height: 0;\n }\n\n .cds--chart-holder {\n flex: 1 1 auto;\n height: auto !important;\n min-height: 0;\n }\n "
1134
2478
  : "\n .cds--chart-holder {\n height: 100vh !important;\n }\n ";
1135
2479
  });
1136
- var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .cds--cc--legend-fieldset {\n border: 0;\n margin: 0;\n min-inline-size: 0;\n padding: 0;\n }\n\n .cds--cc--legend-fieldset > legend {\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n top: auto;\n white-space: nowrap;\n width: 1px;\n }\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ", ";\n\n .cds--chart-holder {\n height: 100vh !important;\n }\n }\n\n .cds--chart-holder.filled,\n .cds--chart-holder.filled .cds--cc--chart-wrapper {\n background-color: ", ";\n }\n\n .cds--data-table thead tr th {\n background: ", " !important;\n }\n .cds--data-table td,\n .cds--data-table tbody th {\n color: ", ";\n }\n .cds--data-table tbody tr,\n .cds--data-table tbody tr td,\n .cds--data-table tbody tr th {\n color: ", ";\n }\n .cds--data-table tr {\n block-size: 2.5rem;\n }\n\n .cds--cc--tooltip .content-box .datapoint-tooltip p {\n font-size: ", ";\n padding: ", ";\n color: ", ";\n max-width: 142px;\n white-space: normal;\n }\n\n .cds--modal-container {\n clip-path: inset(0% 0% 0% 0% round ", ");\n background: ", ";\n .cds--data-table th {\n background: ", ";\n }\n .cds--data-table td {\n border-top: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n background: ", ";\n }\n .cds--data-table tr:hover td {\n background: ", ";\n }\n }\n\n .chart-holder p,\n .chart-holder div,\n .chart-holder text,\n .cds--cc--axes g.axis .axis-title,\n .cds--cc--title p.title,\n .cds--cc--axes g.axis g.tick text {\n font-family: ", " !important;\n color: ", ";\n }\n\n .cds--cc--axes {\n overflow: visible;\n }\n\n div.cds--cc--legend {\n div.legend-item {\n div.checkbox {\n background: ", ";\n border: none;\n width: ", ";\n height: ", ";\n svg {\n left: 2px;\n position: relative;\n }\n }\n p {\n font-size: ", ";\n margin: 0 ", " 0 0;\n }\n }\n }\n div.cds--cc--legend.has-deactivated-items {\n div.legend-item {\n div.checkbox {\n border: 1px solid\n ", ";\n }\n div.checkbox.active {\n border: 1px solid transparent;\n }\n }\n }\n .chart-holder {\n .cds--cc--axes g.axis g.tick text {\n fill: ", ";\n }\n .cds--cc--axes g.axis path.domain {\n stroke: ", ";\n }\n .cds--cc--grid g.x.grid g.tick line,\n .cds--cc--grid g.y.grid g.tick line {\n stroke: ", ";\n }\n .cds--cc--grid rect.chart-grid-backdrop.stroked {\n stroke: ", ";\n }\n .cds--cc--skeleton .shimmer-effect-lines {\n filter: ", ";\n }\n /* .chart-holder.cds--chart-holder.filled,\n .cds--cc--skeleton rect.chart-skeleton-backdrop,\n .cds--cc--grid rect.chart-grid-backdrop {\n } */\n\n .cds--cc--grid rect.chart-grid-backdrop {\n fill: transparent;\n }\n .cds--cc--scatter circle.dot,\n .cds--cc--scatter circle.dot.hovered {\n padding: 10px;\n }\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled {\n stroke-width: 6px;\n transition: 0.1s all linear;\n }\n .cds--cc--scatter circle.dot {\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--scatter circle.dot.hovered {\n stroke-width: 0.5em;\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot.hovered {\n stroke-width: 15px;\n }\n .cds--cc--scatter-stacked circle.dot,\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.hovered {\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--lollipop .cds--cc--scatter circle.dot.hovered {\n transition: 0.1s all linear;\n stroke-width: 1.1em;\n }\n\n .cds--cc--tooltip {\n ", "\n }\n\n .cds--overflow-menu-options__btn:focus {\n outline-color: ", ";\n }\n\n .cds--btn {\n min-height: auto;\n display: flex;\n flex: 0 auto;\n align-items: center;\n text-align: center;\n padding: 20px;\n margin: 0;\n line-height: ", ";\n margin: 0;\n min-width: ", ";\n overflow: hidden;\n position: relative;\n right: ", ";\n text-align: center;\n height: 40px;\n font-family: ", ";\n font-size: ", ";\n border-radius: ", ";\n font-weight: 500;\n }\n\n .cds--btn--primary {\n background: ", ";\n color: ", ";\n }\n\n *:focus {\n outline: 2px solid\n ", " !important;\n outline-offset: 0;\n }\n circle.dot:focus {\n outline: none !important;\n }\n .cds--overflow-menu-options__btn:focus,\n .cds--overflow-menu:focus,\n .cds--overflow-menu__trigger:focus,\n .toolbar-control:focus {\n outline: 2px solid\n ", " !important;\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):focus\n div.checkbox,\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n border: ", ";\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n box-shadow: 0 0 0 2px\n ", " !important;\n }\n\n .cds--btn--primary {\n &:focus {\n outline: 2px solid\n ", ";\n }\n outline-offset: 2px;\n border: none;\n box-shadow: none;\n }\n .cds--modal-header {\n background: ", ";\n margin-bottom: 0;\n border-bottom: 1px solid\n ", ";\n }\n .cds--modal-header__heading {\n font-weight: 600;\n }\n\n .cds--modal-close {\n position: absolute;\n top: 0;\n right: 0;\n &:focus {\n outline: 2px solid\n ", ";\n border-color: none;\n }\n outline-offset: 0;\n border: none;\n }\n }\n\n .cds--modal-footer.cds--modal-footer {\n display: flex;\n align-items: center;\n border-top: 1px solid\n ", ";\n background: ", " !important;\n }\n .layout-child.header {\n height: auto !important;\n p {\n text-overflow: inherit;\n overflow: auto;\n white-space: normal;\n }\n }\n\n &.has-magma-toolbar .cds--cc--title p.title {\n visibility: hidden;\n }\n\n svg:not(:root) {\n overflow: visible;\n }\n\n circle.dot:focus {\n outline: none;\n stroke: ", " !important;\n stroke-width: 6px !important;\n stroke-opacity: 1 !important;\n paint-order: stroke fill;\n }\n\n .cds--cc--chart-wrapper text {\n font-size: ", ";\n }\n\n g.center text,\n .pie-label {\n fill: ", ";\n }\n\n // Zoom responsive tweaks\n\n @media screen and (max-width: 760px) {\n .cds--modal-container {\n overflow-y: auto;\n }\n .cds--chart-holder .cds--modal .cds--modal-container .cds--modal-content {\n overflow: visible;\n }\n .cds--chart-holder\n .cds--modal\n .cds--modal-container\n .cds--modal-content\n table\n th {\n position: relative;\n }\n }\n"], ["\n .cds--cc--legend-fieldset {\n border: 0;\n margin: 0;\n min-inline-size: 0;\n padding: 0;\n }\n\n .cds--cc--legend-fieldset > legend {\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n top: auto;\n white-space: nowrap;\n width: 1px;\n }\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ", ";\n\n .cds--chart-holder {\n height: 100vh !important;\n }\n }\n\n .cds--chart-holder.filled,\n .cds--chart-holder.filled .cds--cc--chart-wrapper {\n background-color: ", ";\n }\n\n .cds--data-table thead tr th {\n background: ", " !important;\n }\n .cds--data-table td,\n .cds--data-table tbody th {\n color: ", ";\n }\n .cds--data-table tbody tr,\n .cds--data-table tbody tr td,\n .cds--data-table tbody tr th {\n color: ", ";\n }\n .cds--data-table tr {\n block-size: 2.5rem;\n }\n\n .cds--cc--tooltip .content-box .datapoint-tooltip p {\n font-size: ", ";\n padding: ", ";\n color: ", ";\n max-width: 142px;\n white-space: normal;\n }\n\n .cds--modal-container {\n clip-path: inset(0% 0% 0% 0% round ", ");\n background: ", ";\n .cds--data-table th {\n background: ", ";\n }\n .cds--data-table td {\n border-top: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n background: ", ";\n }\n .cds--data-table tr:hover td {\n background: ", ";\n }\n }\n\n .chart-holder p,\n .chart-holder div,\n .chart-holder text,\n .cds--cc--axes g.axis .axis-title,\n .cds--cc--title p.title,\n .cds--cc--axes g.axis g.tick text {\n font-family: ", " !important;\n color: ", ";\n }\n\n .cds--cc--axes {\n overflow: visible;\n }\n\n div.cds--cc--legend {\n div.legend-item {\n div.checkbox {\n background: ", ";\n border: none;\n width: ", ";\n height: ", ";\n svg {\n left: 2px;\n position: relative;\n }\n }\n p {\n font-size: ", ";\n margin: 0 ", " 0 0;\n }\n }\n }\n div.cds--cc--legend.has-deactivated-items {\n div.legend-item {\n div.checkbox {\n border: 1px solid\n ", ";\n }\n div.checkbox.active {\n border: 1px solid transparent;\n }\n }\n }\n .chart-holder {\n .cds--cc--axes g.axis g.tick text {\n fill: ", ";\n }\n .cds--cc--axes g.axis path.domain {\n stroke: ", ";\n }\n .cds--cc--grid g.x.grid g.tick line,\n .cds--cc--grid g.y.grid g.tick line {\n stroke: ", ";\n }\n .cds--cc--grid rect.chart-grid-backdrop.stroked {\n stroke: ", ";\n }\n .cds--cc--skeleton .shimmer-effect-lines {\n filter: ", ";\n }\n /* .chart-holder.cds--chart-holder.filled,\n .cds--cc--skeleton rect.chart-skeleton-backdrop,\n .cds--cc--grid rect.chart-grid-backdrop {\n } */\n\n .cds--cc--grid rect.chart-grid-backdrop {\n fill: transparent;\n }\n .cds--cc--scatter circle.dot,\n .cds--cc--scatter circle.dot.hovered {\n padding: 10px;\n }\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled {\n stroke-width: 6px;\n transition: 0.1s all linear;\n }\n .cds--cc--scatter circle.dot {\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--scatter circle.dot.hovered {\n stroke-width: 0.5em;\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot.hovered {\n stroke-width: 15px;\n }\n .cds--cc--scatter-stacked circle.dot,\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.hovered {\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--lollipop .cds--cc--scatter circle.dot.hovered {\n transition: 0.1s all linear;\n stroke-width: 1.1em;\n }\n\n .cds--cc--tooltip {\n ", "\n }\n\n .cds--overflow-menu-options__btn:focus {\n outline-color: ", ";\n }\n\n .cds--btn {\n min-height: auto;\n display: flex;\n flex: 0 auto;\n align-items: center;\n text-align: center;\n padding: 20px;\n margin: 0;\n line-height: ", ";\n margin: 0;\n min-width: ", ";\n overflow: hidden;\n position: relative;\n right: ", ";\n text-align: center;\n height: 40px;\n font-family: ", ";\n font-size: ", ";\n border-radius: ", ";\n font-weight: 500;\n }\n\n .cds--btn--primary {\n background: ", ";\n color: ", ";\n }\n\n *:focus {\n outline: 2px solid\n ", " !important;\n outline-offset: 0;\n }\n circle.dot:focus {\n outline: none !important;\n }\n .cds--overflow-menu-options__btn:focus,\n .cds--overflow-menu:focus,\n .cds--overflow-menu__trigger:focus,\n .toolbar-control:focus {\n outline: 2px solid\n ", " !important;\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):focus\n div.checkbox,\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n border: ", ";\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n box-shadow: 0 0 0 2px\n ", " !important;\n }\n\n .cds--btn--primary {\n &:focus {\n outline: 2px solid\n ", ";\n }\n outline-offset: 2px;\n border: none;\n box-shadow: none;\n }\n .cds--modal-header {\n background: ", ";\n margin-bottom: 0;\n border-bottom: 1px solid\n ", ";\n }\n .cds--modal-header__heading {\n font-weight: 600;\n }\n\n .cds--modal-close {\n position: absolute;\n top: 0;\n right: 0;\n &:focus {\n outline: 2px solid\n ", ";\n border-color: none;\n }\n outline-offset: 0;\n border: none;\n }\n }\n\n .cds--modal-footer.cds--modal-footer {\n display: flex;\n align-items: center;\n border-top: 1px solid\n ", ";\n background: ", " !important;\n }\n .layout-child.header {\n height: auto !important;\n p {\n text-overflow: inherit;\n overflow: auto;\n white-space: normal;\n }\n }\n\n &.has-magma-toolbar .cds--cc--title p.title {\n visibility: hidden;\n }\n\n svg:not(:root) {\n overflow: visible;\n }\n\n circle.dot:focus {\n outline: none;\n stroke: ", " !important;\n stroke-width: 6px !important;\n stroke-opacity: 1 !important;\n paint-order: stroke fill;\n }\n\n .cds--cc--chart-wrapper text {\n font-size: ", ";\n }\n\n g.center text,\n .pie-label {\n fill: ", ";\n }\n\n // Zoom responsive tweaks\n\n @media screen and (max-width: 760px) {\n .cds--modal-container {\n overflow-y: auto;\n }\n .cds--chart-holder .cds--modal .cds--modal-container .cds--modal-content {\n overflow: visible;\n }\n .cds--chart-holder\n .cds--modal\n .cds--modal-container\n .cds--modal-content\n table\n th {\n position: relative;\n }\n }\n"])), function (props) {
2480
+ var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .cds--cc--legend-fieldset {\n border: 0;\n margin: 0;\n min-inline-size: 0;\n padding: 0;\n }\n\n .cds--cc--legend-fieldset > legend {\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n top: auto;\n white-space: nowrap;\n width: 1px;\n }\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ", ";\n\n .cds--chart-holder {\n height: 100vh !important;\n }\n }\n\n .cds--chart-holder.filled,\n .cds--chart-holder.filled .cds--cc--chart-wrapper {\n background-color: ", ";\n }\n\n .cds--data-table thead tr th {\n background: ", " !important;\n }\n .cds--data-table td,\n .cds--data-table tbody th {\n color: ", ";\n }\n .cds--data-table tbody tr,\n .cds--data-table tbody tr td,\n .cds--data-table tbody tr th {\n color: ", ";\n }\n .cds--data-table tr {\n block-size: 2.5rem;\n }\n\n .cds--cc--tooltip .content-box .datapoint-tooltip p {\n font-size: ", ";\n padding: ", ";\n color: ", ";\n max-width: 142px;\n white-space: normal;\n }\n\n .cds--modal-container {\n clip-path: inset(0% 0% 0% 0% round ", ");\n background: ", ";\n .cds--data-table th {\n background: ", ";\n }\n .cds--data-table td {\n border-top: 1px solid\n ", ";\n border-bottom: 1px solid\n ", ";\n background: ", ";\n }\n .cds--data-table tr:hover td {\n background: ", ";\n }\n }\n\n .chart-holder p,\n .chart-holder div,\n .chart-holder text,\n .cds--cc--axes g.axis .axis-title,\n .cds--cc--title p.title,\n .cds--cc--axes g.axis g.tick text {\n font-family: ", " !important;\n color: ", ";\n }\n\n .cds--cc--axes {\n overflow: visible;\n }\n\n div.cds--cc--legend {\n div.legend-item {\n div.checkbox {\n background: ", ";\n border: none;\n width: ", ";\n height: ", ";\n svg {\n left: 2px;\n position: relative;\n }\n }\n p {\n font-size: ", ";\n margin: 0 ", " 0 0;\n }\n }\n }\n div.cds--cc--legend.has-deactivated-items {\n div.legend-item {\n div.checkbox {\n border: 1px solid\n ", ";\n }\n div.checkbox.active {\n border: 1px solid transparent;\n }\n }\n }\n .chart-holder {\n .cds--cc--axes g.axis g.tick text {\n fill: ", ";\n }\n .cds--cc--axes g.axis path.domain {\n stroke: ", ";\n }\n .cds--cc--grid g.x.grid g.tick line,\n .cds--cc--grid g.y.grid g.tick line {\n stroke: ", ";\n }\n .cds--cc--grid rect.chart-grid-backdrop.stroked {\n stroke: ", ";\n }\n .cds--cc--skeleton .shimmer-effect-lines {\n filter: ", ";\n }\n /* .chart-holder.cds--chart-holder.filled,\n .cds--cc--skeleton rect.chart-skeleton-backdrop,\n .cds--cc--grid rect.chart-grid-backdrop {\n } */\n\n .cds--cc--grid rect.chart-grid-backdrop {\n fill: transparent;\n }\n .cds--cc--scatter circle.dot,\n .cds--cc--scatter circle.dot.hovered {\n padding: 10px;\n }\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled {\n stroke-width: 6px;\n transition: 0.1s all linear;\n }\n .cds--cc--scatter circle.dot {\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--scatter circle.dot.hovered {\n stroke-width: 0.5em;\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot.hovered {\n stroke-width: 15px;\n }\n .cds--cc--scatter-stacked circle.dot,\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.hovered {\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ", "\n )\n drop-shadow(\n -1px 0px 0px\n ", "\n )\n drop-shadow(\n 0px 1px 0px\n ", "\n )\n drop-shadow(\n 0px -1px 0px\n ", "\n );\n }\n .cds--cc--lollipop .cds--cc--scatter circle.dot.hovered {\n transition: 0.1s all linear;\n stroke-width: 1.1em;\n }\n\n .cds--cc--tooltip {\n ", "\n }\n\n .cds--overflow-menu-options__btn:focus {\n outline-color: ", ";\n }\n\n .cds--btn {\n min-height: auto;\n display: flex;\n flex: 0 auto;\n align-items: center;\n text-align: center;\n padding: 20px;\n margin: 0;\n line-height: ", ";\n margin: 0;\n min-width: ", ";\n overflow: hidden;\n position: relative;\n right: ", ";\n text-align: center;\n height: 40px;\n font-family: ", ";\n font-size: ", ";\n border-radius: ", ";\n font-weight: 500;\n }\n\n .cds--btn--primary {\n background: ", ";\n color: ", ";\n }\n\n *:focus {\n outline: 2px solid\n ", " !important;\n outline-offset: 0;\n }\n circle.dot:focus {\n outline: none !important;\n }\n .cds--overflow-menu-options__btn:focus,\n .cds--overflow-menu:focus,\n .cds--overflow-menu__trigger:focus,\n .toolbar-control:focus {\n outline: 2px solid\n ", " !important;\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):focus\n div.checkbox,\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n border: ", ";\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n box-shadow: 0 0 0 2px\n ", " !important;\n }\n\n .cds--btn--primary {\n &:focus {\n outline: 2px solid\n ", ";\n }\n outline-offset: 2px;\n border: none;\n box-shadow: none;\n }\n .cds--modal-header {\n background: ", ";\n margin-bottom: 0;\n border-bottom: 1px solid\n ", ";\n }\n .cds--modal-header__heading {\n font-weight: 600;\n }\n\n .cds--modal-close {\n position: absolute;\n top: 0;\n right: 0;\n &:focus {\n outline: 2px solid\n ", ";\n border-color: none;\n }\n outline-offset: 0;\n border: none;\n }\n }\n\n .cds--modal-footer.cds--modal-footer {\n display: flex;\n align-items: center;\n border-top: 1px solid\n ", ";\n background: ", " !important;\n }\n .layout-child.header {\n height: auto !important;\n p {\n text-overflow: inherit;\n overflow: auto;\n white-space: normal;\n }\n }\n\n &.has-magma-toolbar .cds--cc--title p.title {\n visibility: hidden;\n }\n\n svg:not(:root) {\n overflow: visible;\n }\n\n circle.dot:focus {\n outline: none;\n stroke: ", " !important;\n stroke-width: 6px !important;\n stroke-opacity: 1 !important;\n paint-order: stroke fill;\n }\n\n .cds--cc--chart-wrapper text {\n font-size: ", ";\n }\n\n g.center text,\n .pie-label {\n fill: ", ";\n }\n\n // Zoom responsive tweaks\n\n @media screen and (max-width: 760px) {\n .cds--modal-container {\n overflow-y: auto;\n }\n .cds--chart-holder .cds--modal .cds--modal-container .cds--modal-content {\n overflow: visible;\n }\n .cds--chart-holder\n .cds--modal\n .cds--modal-container\n .cds--modal-content\n table\n th {\n position: relative;\n }\n }\n"], ["\n .cds--cc--legend-fieldset {\n border: 0;\n margin: 0;\n min-inline-size: 0;\n padding: 0;\n }\n\n .cds--cc--legend-fieldset > legend {\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n top: auto;\n white-space: nowrap;\n width: 1px;\n }\n\n &:fullscreen,\n &:-webkit-full-screen {\n background: ",
2481
+ ";\n\n .cds--chart-holder {\n height: 100vh !important;\n }\n }\n\n .cds--chart-holder.filled,\n .cds--chart-holder.filled .cds--cc--chart-wrapper {\n background-color: ",
2482
+ ";\n }\n\n .cds--data-table thead tr th {\n background: ",
2483
+ " !important;\n }\n .cds--data-table td,\n .cds--data-table tbody th {\n color: ", ";\n }\n .cds--data-table tbody tr,\n .cds--data-table tbody tr td,\n .cds--data-table tbody tr th {\n color: ", ";\n }\n .cds--data-table tr {\n block-size: 2.5rem;\n }\n\n .cds--cc--tooltip .content-box .datapoint-tooltip p {\n font-size: ", ";\n padding: ", ";\n color: ",
2484
+ ";\n max-width: 142px;\n white-space: normal;\n }\n\n .cds--modal-container {\n clip-path: inset(0% 0% 0% 0% round ", ");\n background: ",
2485
+ ";\n .cds--data-table th {\n background: ",
2486
+ ";\n }\n .cds--data-table td {\n border-top: 1px solid\n ",
2487
+ ";\n border-bottom: 1px solid\n ",
2488
+ ";\n background: ", ";\n }\n .cds--data-table tr:hover td {\n background: ",
2489
+ ";\n }\n }\n\n .chart-holder p,\n .chart-holder div,\n .chart-holder text,\n .cds--cc--axes g.axis .axis-title,\n .cds--cc--title p.title,\n .cds--cc--axes g.axis g.tick text {\n font-family: ", " !important;\n color: ",
2490
+ ";\n }\n\n .cds--cc--axes {\n overflow: visible;\n }\n\n div.cds--cc--legend {\n div.legend-item {\n div.checkbox {\n background: ",
2491
+ ";\n border: none;\n width: ", ";\n height: ", ";\n svg {\n left: 2px;\n position: relative;\n }\n }\n p {\n font-size: ", ";\n margin: 0 ", " 0 0;\n }\n }\n }\n div.cds--cc--legend.has-deactivated-items {\n div.legend-item {\n div.checkbox {\n border: 1px solid\n ",
2492
+ ";\n }\n div.checkbox.active {\n border: 1px solid transparent;\n }\n }\n }\n .chart-holder {\n .cds--cc--axes g.axis g.tick text {\n fill: ", ";\n }\n .cds--cc--axes g.axis path.domain {\n stroke: ",
2493
+ ";\n }\n .cds--cc--grid g.x.grid g.tick line,\n .cds--cc--grid g.y.grid g.tick line {\n stroke: ",
2494
+ ";\n }\n .cds--cc--grid rect.chart-grid-backdrop.stroked {\n stroke: ",
2495
+ ";\n }\n .cds--cc--skeleton .shimmer-effect-lines {\n filter: ", ";\n }\n /* .chart-holder.cds--chart-holder.filled,\n .cds--cc--skeleton rect.chart-skeleton-backdrop,\n .cds--cc--grid rect.chart-grid-backdrop {\n } */\n\n .cds--cc--grid rect.chart-grid-backdrop {\n fill: transparent;\n }\n .cds--cc--scatter circle.dot,\n .cds--cc--scatter circle.dot.hovered {\n padding: 10px;\n }\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled {\n stroke-width: 6px;\n transition: 0.1s all linear;\n }\n .cds--cc--scatter circle.dot {\n filter: drop-shadow(\n 1px 0px 0px\n ",
2496
+ "\n )\n drop-shadow(\n -1px 0px 0px\n ",
2497
+ "\n )\n drop-shadow(\n 0px 1px 0px\n ",
2498
+ "\n )\n drop-shadow(\n 0px -1px 0px\n ",
2499
+ "\n );\n }\n .cds--cc--scatter circle.dot.hovered {\n stroke-width: 0.5em;\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ",
2500
+ "\n )\n drop-shadow(\n -1px 0px 0px\n ",
2501
+ "\n )\n drop-shadow(\n 0px 1px 0px\n ",
2502
+ "\n )\n drop-shadow(\n 0px -1px 0px\n ",
2503
+ "\n );\n }\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot.hovered {\n stroke-width: 15px;\n }\n .cds--cc--scatter-stacked circle.dot,\n .cds--cc--scatter-stacked circle.dot.hovered,\n .cds--cc--scatter-stacked circle.dot.unfilled,\n .cds--cc--scatter circle.dot.unfilled,\n .cds--cc--lollipop circle.dot.filled,\n .cds--cc--lollipop circle.dot,\n .cds--cc--lollipop circle.dot.hovered {\n transition: 0.1s all linear;\n filter: drop-shadow(\n 1px 0px 0px\n ",
2504
+ "\n )\n drop-shadow(\n -1px 0px 0px\n ",
2505
+ "\n )\n drop-shadow(\n 0px 1px 0px\n ",
2506
+ "\n )\n drop-shadow(\n 0px -1px 0px\n ",
2507
+ "\n );\n }\n .cds--cc--lollipop .cds--cc--scatter circle.dot.hovered {\n transition: 0.1s all linear;\n stroke-width: 1.1em;\n }\n\n .cds--cc--tooltip {\n ",
2508
+ "\n }\n\n .cds--overflow-menu-options__btn:focus {\n outline-color: ",
2509
+ ";\n }\n\n .cds--btn {\n min-height: auto;\n display: flex;\n flex: 0 auto;\n align-items: center;\n text-align: center;\n padding: 20px;\n margin: 0;\n line-height: ", ";\n margin: 0;\n min-width: ", ";\n overflow: hidden;\n position: relative;\n right: ", ";\n text-align: center;\n height: 40px;\n font-family: ", ";\n font-size: ", ";\n border-radius: ", ";\n font-weight: 500;\n }\n\n .cds--btn--primary {\n background: ",
2510
+ ";\n color: ", ";\n }\n\n *:focus {\n outline: 2px solid\n ",
2511
+ " !important;\n outline-offset: 0;\n }\n circle.dot:focus {\n outline: none !important;\n }\n .cds--overflow-menu-options__btn:focus,\n .cds--overflow-menu:focus,\n .cds--overflow-menu__trigger:focus,\n .toolbar-control:focus {\n outline: 2px solid\n ",
2512
+ " !important;\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):focus\n div.checkbox,\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n border: ",
2513
+ ";\n }\n div.cds--cc--legend.clickable\n div.legend-item:not(.additional):hover\n div.checkbox {\n box-shadow: 0 0 0 2px\n ",
2514
+ " !important;\n }\n\n .cds--btn--primary {\n &:focus {\n outline: 2px solid\n ",
2515
+ ";\n }\n outline-offset: 2px;\n border: none;\n box-shadow: none;\n }\n .cds--modal-header {\n background: ",
2516
+ ";\n margin-bottom: 0;\n border-bottom: 1px solid\n ",
2517
+ ";\n }\n .cds--modal-header__heading {\n font-weight: 600;\n }\n\n .cds--modal-close {\n position: absolute;\n top: 0;\n right: 0;\n &:focus {\n outline: 2px solid\n ",
2518
+ ";\n border-color: none;\n }\n outline-offset: 0;\n border: none;\n }\n }\n\n .cds--modal-footer.cds--modal-footer {\n display: flex;\n align-items: center;\n border-top: 1px solid\n ",
2519
+ ";\n background: ",
2520
+ " !important;\n }\n .layout-child.header {\n height: auto !important;\n p {\n text-overflow: inherit;\n overflow: auto;\n white-space: normal;\n }\n }\n\n &.has-magma-toolbar .cds--cc--title p.title {\n visibility: hidden;\n }\n\n svg:not(:root) {\n overflow: visible;\n }\n\n circle.dot:focus {\n outline: none;\n stroke: ",
2521
+ " !important;\n stroke-width: 6px !important;\n stroke-opacity: 1 !important;\n paint-order: stroke fill;\n }\n\n .cds--cc--chart-wrapper text {\n font-size: ", ";\n }\n\n g.center text,\n .pie-label {\n fill: ", ";\n }\n\n // Zoom responsive tweaks\n\n @media screen and (max-width: 760px) {\n .cds--modal-container {\n overflow-y: auto;\n }\n .cds--chart-holder .cds--modal .cds--modal-container .cds--modal-content {\n overflow: visible;\n }\n .cds--chart-holder\n .cds--modal\n .cds--modal-container\n .cds--modal-content\n table\n th {\n position: relative;\n }\n }\n"])), function (props) {
1137
2522
  return props.isInverse
1138
2523
  ? props.theme.colors.primary700
1139
2524
  : props.theme.colors.neutral100;
@@ -1153,11 +2538,11 @@ var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __ma
1153
2538
  return props.isInverse ? props.theme.colors.primary600 : '';
1154
2539
  }, function (props) {
1155
2540
  return props.isInverse
1156
- ? curriedTransparentize(0.8, props.theme.colors.neutral100)
2541
+ ? curriedTransparentize$1(0.8, props.theme.colors.neutral100)
1157
2542
  : 'inherit';
1158
2543
  }, function (props) {
1159
2544
  return props.isInverse
1160
- ? curriedTransparentize(0.8, props.theme.colors.neutral100)
2545
+ ? curriedTransparentize$1(0.8, props.theme.colors.neutral100)
1161
2546
  : 'inherit';
1162
2547
  }, function (props) { return (props.isInverse ? '#202565' : ''); }, function (props) {
1163
2548
  return props.isInverse ? props.theme.colors.primary600 : '';
@@ -1177,7 +2562,7 @@ var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __ma
1177
2562
  return props.isInverse ? props.theme.colors.neutral100 : '';
1178
2563
  }, function (props) {
1179
2564
  return props.isInverse
1180
- ? curriedTransparentize(0.5, props.theme.colors.neutral100)
2565
+ ? curriedTransparentize$1(0.5, props.theme.colors.neutral100)
1181
2566
  : '';
1182
2567
  }, function (props) {
1183
2568
  return props.isInverse ? props.theme.colors.neutral100 : '';
@@ -1235,9 +2620,8 @@ var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __ma
1235
2620
  : props.theme.chartColors) || [];
1236
2621
  return chartColors.reduce(function (result, color, index) {
1237
2622
  var indexNum = index + 1;
1238
- var newResult = result +
1239
- ".tooltip-".concat(props.groupsLength, "-1-").concat(indexNum, " { background-color: ").concat(color, "; }");
1240
- return newResult;
2623
+ result += ".tooltip-" + props.groupsLength + "-1-" + indexNum + " { background-color: " + color + "; }";
2624
+ return result;
1241
2625
  }, '');
1242
2626
  }, function (props) {
1243
2627
  return props.isInverse ? props.theme.colors.focusInverse : '';
@@ -1254,7 +2638,7 @@ var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __ma
1254
2638
  ? props.theme.colors.focusInverse
1255
2639
  : props.theme.colors.focus;
1256
2640
  }, function (props) {
1257
- return props.isInverse ? "1px solid ".concat(props.theme.colors.focusInverse) : '';
2641
+ return props.isInverse ? "1px solid " + props.theme.colors.focusInverse : '';
1258
2642
  }, function (props) {
1259
2643
  return props.isInverse
1260
2644
  ? props.theme.colors.focusInverse
@@ -1269,7 +2653,7 @@ var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __ma
1269
2653
  : props.theme.colors.neutral100;
1270
2654
  }, function (props) {
1271
2655
  return props.isInverse
1272
- ? curriedTransparentize(0.8, props.theme.colors.neutral100)
2656
+ ? curriedTransparentize$1(0.8, props.theme.colors.neutral100)
1273
2657
  : props.theme.colors.neutral300;
1274
2658
  }, function (props) {
1275
2659
  return props.isInverse
@@ -1277,7 +2661,7 @@ var CarbonChartWrapper = styled.div(templateObject_3 || (templateObject_3 = __ma
1277
2661
  : props.theme.colors.focus;
1278
2662
  }, function (props) {
1279
2663
  return props.isInverse
1280
- ? curriedTransparentize(0.8, props.theme.colors.neutral100)
2664
+ ? curriedTransparentize$1(0.8, props.theme.colors.neutral100)
1281
2665
  : props.theme.colors.neutral300;
1282
2666
  }, function (props) {
1283
2667
  return props.isInverse
@@ -1298,10 +2682,13 @@ var ChartTheme;
1298
2682
  ChartTheme["G90"] = "g90";
1299
2683
  ChartTheme["G10"] = "g10";
1300
2684
  })(ChartTheme || (ChartTheme = {}));
1301
- var ToolbarWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n justify-content: space-between;\n z-index: 2;\n\n ", "\n\n button {\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 0;\n }\n }\n"], ["\n align-items: center;\n display: flex;\n justify-content: space-between;\n z-index: 2;\n\n ", "\n\n button {\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 0;\n }\n }\n"])), function (props) {
2685
+ var ToolbarWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n justify-content: space-between;\n z-index: 2;\n\n ", "\n\n button {\n color: ", ";\n\n &:focus {\n outline: 2px solid\n ", ";\n outline-offset: 0;\n }\n }\n"], ["\n align-items: center;\n display: flex;\n justify-content: space-between;\n z-index: 2;\n\n ",
2686
+ "\n\n button {\n color: ",
2687
+ ";\n\n &:focus {\n outline: 2px solid\n ",
2688
+ ";\n outline-offset: 0;\n }\n }\n"])), function (props) {
1302
2689
  return props.isFlowLayout
1303
2690
  ? "\n position: relative;\n "
1304
- : "\n left: ".concat(props.isFullscreen ? '2em' : '0', ";\n position: absolute;\n right: ").concat(props.isFullscreen ? '2em' : '0', ";\n top: ").concat(props.isFullscreen ? '2em' : '0', ";\n ");
2691
+ : "\n left: " + (props.isFullscreen ? '2em' : '0') + ";\n position: absolute;\n right: " + (props.isFullscreen ? '2em' : '0') + ";\n top: " + (props.isFullscreen ? '2em' : '0') + ";\n ";
1305
2692
  }, function (props) {
1306
2693
  return props.isInverse
1307
2694
  ? props.theme.colors.neutral100
@@ -1311,7 +2698,8 @@ var ToolbarWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTe
1311
2698
  ? props.theme.colors.focusInverse
1312
2699
  : props.theme.colors.focus;
1313
2700
  });
1314
- var ChartTitle = styled.h2(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", " !important;\n font-size: 16px !important;\n font-weight: 700 !important;\n letter-spacing: normal !important;\n line-height: 1.25 !important;\n margin: 0 !important;\n color: ", " !important;\n"], ["\n font-family: ", " !important;\n font-size: 16px !important;\n font-weight: 700 !important;\n letter-spacing: normal !important;\n line-height: 1.25 !important;\n margin: 0 !important;\n color: ", " !important;\n"])), function (props) { return props.theme.bodyFont; }, function (props) {
2701
+ var ChartTitle = styled.h2(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", " !important;\n font-size: 16px !important;\n font-weight: 700 !important;\n letter-spacing: normal !important;\n line-height: 1.25 !important;\n margin: 0 !important;\n color: ", " !important;\n"], ["\n font-family: ", " !important;\n font-size: 16px !important;\n font-weight: 700 !important;\n letter-spacing: normal !important;\n line-height: 1.25 !important;\n margin: 0 !important;\n color: ",
2702
+ " !important;\n"])), function (props) { return props.theme.bodyFont; }, function (props) {
1315
2703
  return props.isInverse
1316
2704
  ? props.theme.colors.neutral100
1317
2705
  : props.theme.colors.neutral700;
@@ -1323,7 +2711,7 @@ var ToolbarActions = styled.div(templateObject_9 || (templateObject_9 = __makeTe
1323
2711
  function sanitizeCsvValue(value) {
1324
2712
  var trimmed = value.trimStart();
1325
2713
  if (/^[=+\-@\t\r]/.test(trimmed)) {
1326
- return "'".concat(value);
2714
+ return "'" + value;
1327
2715
  }
1328
2716
  return value;
1329
2717
  }
@@ -1338,17 +2726,17 @@ function downloadCsv(dataSet, title) {
1338
2726
  var v = row[k];
1339
2727
  var s = sanitizeCsvValue(String(v !== null && v !== void 0 ? v : ''));
1340
2728
  return s.includes(',') || s.includes('"') || s.includes('\n')
1341
- ? "\"".concat(s.replace(/"/g, '""'), "\"")
2729
+ ? "\"" + s.replace(/"/g, '""') + "\""
1342
2730
  : s;
1343
2731
  })
1344
2732
  .join(',');
1345
2733
  });
1346
- var csv = __spreadArray([header], rows, true).join('\n');
2734
+ var csv = __spreadArrays([header], rows).join('\n');
1347
2735
  var blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
1348
2736
  var url = URL.createObjectURL(blob);
1349
2737
  var a = document.createElement('a');
1350
2738
  a.href = url;
1351
- a.download = "".concat(title || 'chart-data', ".csv");
2739
+ a.download = (title || 'chart-data') + ".csv";
1352
2740
  a.click();
1353
2741
  URL.revokeObjectURL(url);
1354
2742
  }
@@ -1357,8 +2745,7 @@ function exportCarbonChartImage(chart, toolbarWrapper, format) {
1357
2745
  var domUtils = (_a = chart === null || chart === void 0 ? void 0 : chart.services) === null || _a === void 0 ? void 0 : _a.domUtils;
1358
2746
  if (!domUtils)
1359
2747
  return;
1360
- var magmaWrapper = (toolbarWrapper === null || toolbarWrapper === void 0 ? void 0 : toolbarWrapper.classList.contains('has-magma-toolbar'))
1361
- ? toolbarWrapper
2748
+ var magmaWrapper = (toolbarWrapper === null || toolbarWrapper === void 0 ? void 0 : toolbarWrapper.classList.contains('has-magma-toolbar')) ? toolbarWrapper
1362
2749
  : null;
1363
2750
  magmaWrapper === null || magmaWrapper === void 0 ? void 0 : magmaWrapper.classList.remove('has-magma-toolbar');
1364
2751
  var restored = false;
@@ -1439,11 +2826,11 @@ function CarbonChartToolbar(_a) {
1439
2826
  return (React__namespace.createElement(ToolbarWrapper, { isFlowLayout: isFlowLayout, isFullscreen: isFullscreen, isInverse: isInverse, theme: theme },
1440
2827
  React__namespace.createElement(TitleGroup, { theme: theme },
1441
2828
  config.titlePrefix ? (React__namespace.createElement(TitleSlot, null, config.titlePrefix)) : null,
1442
- React__namespace.createElement(ChartTitle, { as: "h".concat((_b = config.titleLevel) !== null && _b !== void 0 ? _b : 2), isInverse: isInverse, theme: theme }, resolvedTitle),
2829
+ React__namespace.createElement(ChartTitle, { as: "h" + ((_b = config.titleLevel) !== null && _b !== void 0 ? _b : 2), isInverse: isInverse, theme: theme }, resolvedTitle),
1443
2830
  config.titleSuffix ? (React__namespace.createElement(TitleSlot, null, config.titleSuffix)) : null),
1444
2831
  React__namespace.createElement(ToolbarActions, { theme: theme },
1445
2832
  showTable && (React__namespace.createElement(ChartTableButton, { ariaLabel: resolvedTitle, icon: React__namespace.createElement(reactMagmaIcons.TableIcon, { size: 20 }), isInverse: isInverse, isTableOpen: isTableOpen, onClick: onOpenTable })),
1446
- showFullscreen && (React__namespace.createElement(ChartFullscreenButton, { ariaLabel: "".concat(isFullscreen ? 'Exit' : 'View', " ").concat(resolvedTitle, " full screen"), icon: React__namespace.createElement(reactMagmaIcons.FullscreenIcon, { size: 20 }), exitIcon: React__namespace.createElement(reactMagmaIcons.FullscreenExitIcon, { size: 20 }), isInverse: isInverse, isFullscreen: isFullscreen, onClick: onToggleFullscreen })),
2833
+ showFullscreen && (React__namespace.createElement(ChartFullscreenButton, { ariaLabel: (isFullscreen ? 'Exit' : 'View') + " " + resolvedTitle + " full screen", icon: React__namespace.createElement(reactMagmaIcons.FullscreenIcon, { size: 20 }), exitIcon: React__namespace.createElement(reactMagmaIcons.FullscreenExitIcon, { size: 20 }), isInverse: isInverse, isFullscreen: isFullscreen, onClick: onToggleFullscreen })),
1447
2834
  React__namespace.createElement(ChartMoreOptionsButton, { icon: React__namespace.createElement(reactMagmaIcons.MoreVertIcon, { size: 20 }), isInverse: isInverse }, moreOptionsContent))));
1448
2835
  }
1449
2836
  var CarbonChart = React__namespace.forwardRef(function (props, ref) {
@@ -1499,7 +2886,7 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1499
2886
  document.removeEventListener('fullscreenchange', onFullscreenChange);
1500
2887
  // Restore height if the component unmounts while in fullscreen.
1501
2888
  var chartHolder = (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.cds--chart-holder');
1502
- if (chartHolder && document.fullscreenElement) {
2889
+ if (chartHolder && document.fullscreenElement && !isFlowLayout) {
1503
2890
  chartHolder.style.height = savedHeightRef.current;
1504
2891
  }
1505
2892
  };
@@ -1528,7 +2915,7 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1528
2915
  }
1529
2916
  }, []);
1530
2917
  var chartTitle = options.title || toolbarI18n.defaultTitle;
1531
- var legendLabel = "".concat(ariaLabel || chartTitle, ". ").concat(toolbarI18n.legendInstructions);
2918
+ var legendLabel = (ariaLabel || chartTitle) + ". " + toolbarI18n.legendInstructions;
1532
2919
  React__namespace.useEffect(function () {
1533
2920
  var container = internalRef.current;
1534
2921
  if (!container)
@@ -1650,8 +3037,8 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1650
3037
  var colorScale = React__namespace.useMemo(function () {
1651
3038
  var scaleColorsObj = {};
1652
3039
  var customColors = options.colors || [];
1653
- var allColors = __spreadArray(__spreadArray([], customColors, true), theme.chartColors, true);
1654
- var allInverseColors = __spreadArray(__spreadArray([], customColors, true), theme.chartColorsInverse, true);
3040
+ var allColors = __spreadArrays(customColors, theme.chartColors);
3041
+ var allInverseColors = __spreadArrays(customColors, theme.chartColorsInverse);
1655
3042
  var allGroups = dataSet.map(function (item) {
1656
3043
  return 'group' in item ? item['group'] : null;
1657
3044
  });
@@ -1681,6 +3068,18 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1681
3068
  ? {}
1682
3069
  : { fileDownload: { fileName: chartTitle } })) : {}));
1683
3070
  var ChartType = ALL_CHARTS[type];
3071
+ React__namespace.useEffect(function () {
3072
+ if (!ariaLabel)
3073
+ return;
3074
+ var rafId = requestAnimationFrame(function () {
3075
+ var _a;
3076
+ var svgEl = (_a = internalRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('.graph-frame');
3077
+ if (!svgEl)
3078
+ return;
3079
+ svgEl.setAttribute('aria-label', ariaLabel);
3080
+ });
3081
+ return function () { return cancelAnimationFrame(rafId); };
3082
+ }, [ariaLabel]);
1684
3083
  React__namespace.useEffect(function () {
1685
3084
  var timer = setTimeout(function () {
1686
3085
  if (internalRef.current) {
@@ -1743,7 +3142,7 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1743
3142
  // render, which still triggers this observer. Only announce when the
1744
3143
  // selection actually changed, otherwise unrelated re-renders (e.g.
1745
3144
  // the legend group announcement) cause phantom announcements.
1746
- var selectionSignature = "".concat(activeLabels.join('|'), "::").concat(allItems.length);
3145
+ var selectionSignature = activeLabels.join('|') + "::" + allItems.length;
1747
3146
  if (selectionSignatureRef.current === selectionSignature)
1748
3147
  return;
1749
3148
  var isFirstRun = selectionSignatureRef.current === undefined;
@@ -1753,7 +3152,7 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1753
3152
  if (activeLabels.length === 1) {
1754
3153
  if (!legendAnnouncedRef.current) {
1755
3154
  legendAnnouncedRef.current = true;
1756
- setLegendAnnouncement("Only ".concat(activeLabels[0], " is selected"));
3155
+ setLegendAnnouncement("Only " + activeLabels[0] + " is selected");
1757
3156
  }
1758
3157
  }
1759
3158
  else if (activeLabels.length === allItems.length) {
@@ -1872,7 +3271,7 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1872
3271
  React__namespace.createElement(reactMagmaDom.Announce, null, legendAnnouncement)),
1873
3272
  React__namespace.createElement(reactMagmaDom.VisuallyHidden, null,
1874
3273
  React__namespace.createElement("div", { "aria-live": "polite", ref: legendGroupAnnounceRef })),
1875
- React__namespace.createElement(CarbonChartWrapper, __assign({ "data-testid": testId, isInverse: isInverse, theme: theme, className: "carbon-chart-wrapper".concat(chartToolbar ? ' has-magma-toolbar' : ''), groupsLength: groupsLength < 6 ? groupsLength : 14, role: "region", "aria-label": ariaLabel || chartTitle, "aria-roledescription": "chart" }, rest),
3274
+ React__namespace.createElement(CarbonChartWrapper, __assign({ "data-testid": testId, isInverse: isInverse, theme: theme, className: "carbon-chart-wrapper" + (chartToolbar ? ' has-magma-toolbar' : ''), groupsLength: groupsLength < 6 ? groupsLength : 14, role: "region", "aria-label": ariaLabel || chartTitle, "aria-roledescription": "chart" }, rest),
1876
3275
  React__namespace.createElement(ChartContentWrapper, { className: "carbon-chart-content" },
1877
3276
  chartToolbar && (
1878
3277
  /*
@@ -1890,6 +3289,7 @@ var CarbonChart = React__namespace.forwardRef(function (props, ref) {
1890
3289
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9;
1891
3290
 
1892
3291
  exports.CarbonChart = CarbonChart;
3292
+ exports.Chart = Chart;
1893
3293
  exports.ChartDataTable = ChartDataTable;
1894
3294
  exports.ChartFullscreenButton = ChartFullscreenButton;
1895
3295
  exports.ChartMoreOptionsButton = ChartMoreOptionsButton;