@redsift/charts 10.3.0-alpha.4 → 10.3.0-alpha.6
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.
- package/CONTRIBUTING.md +0 -4
- package/index.d.ts +33 -4
- package/index.js +411 -267
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -362,12 +362,13 @@ var k=/^--/;function I(t,e){return e==null||typeof e=="boolean"||e===""?"":typeo
|
|
|
362
362
|
*/
|
|
363
363
|
const StyledDataPoint = styled(it.g)``;
|
|
364
364
|
|
|
365
|
-
const _excluded$q = ["children", "className", "data", "id", "index", "isSelected", "labelDecorator", "onClick", "role", "tooltipDecorator", "tooltipVariant", "theme"];
|
|
365
|
+
const _excluded$q = ["children", "className", "data", "href", "id", "index", "isSelected", "labelDecorator", "onClick", "role", "tooltipDecorator", "tooltipVariant", "theme"];
|
|
366
366
|
const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
|
|
367
367
|
const {
|
|
368
368
|
children,
|
|
369
369
|
className,
|
|
370
370
|
data,
|
|
371
|
+
href,
|
|
371
372
|
id: propsId,
|
|
372
373
|
index,
|
|
373
374
|
isSelected: propsIsSelected,
|
|
@@ -406,20 +407,20 @@ const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
406
407
|
}
|
|
407
408
|
};
|
|
408
409
|
const DataPointComponent = /*#__PURE__*/React__default.createElement(StyledDataPoint, _extends({
|
|
409
|
-
tabIndex: onClick ? 0 : undefined
|
|
410
|
+
tabIndex: onClick ? 0 : undefined,
|
|
411
|
+
"aria-label": showTooltip && !isEmpty ? text : undefined,
|
|
412
|
+
"aria-labelledby": !showTooltip && !isEmpty ? `${id}-title` : undefined,
|
|
413
|
+
"aria-selected": isSelected ? true : isDeselected ? false : undefined,
|
|
414
|
+
onClick: onClick ? () => onClick(data) : undefined,
|
|
415
|
+
onKeyDown: onClick ? e => onKeyDown(e) : undefined,
|
|
416
|
+
role: role ? role : onClick ? 'button' : href ? undefined : 'img'
|
|
410
417
|
}, forwardedProps, {
|
|
411
418
|
className: classNames(className, `_${index}`, {
|
|
412
419
|
selected: isSelected,
|
|
413
420
|
deselected: isDeselected
|
|
414
421
|
}),
|
|
415
422
|
ref: ref,
|
|
416
|
-
"aria-label": showTooltip && !isEmpty ? `${text}: ${data.data.value}` : undefined,
|
|
417
|
-
"aria-labelledby": !showTooltip && !isEmpty ? `${id}-title` : undefined,
|
|
418
|
-
"aria-selected": isSelected ? true : isDeselected ? false : undefined,
|
|
419
423
|
id: id,
|
|
420
|
-
onClick: onClick ? () => onClick(data) : undefined,
|
|
421
|
-
onKeyDown: onClick ? e => onKeyDown(e) : undefined,
|
|
422
|
-
role: role ? role : onClick ? 'button' : undefined,
|
|
423
424
|
$clickable: Boolean(onClick)
|
|
424
425
|
}), children, !showTooltip && !isEmpty ? /*#__PURE__*/React__default.createElement("title", {
|
|
425
426
|
id: `${id}-title`
|
|
@@ -428,7 +429,9 @@ const DataPoint = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
428
429
|
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
429
430
|
placement: "right",
|
|
430
431
|
theme: theme
|
|
431
|
-
}, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null,
|
|
432
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip.Trigger, null, href !== undefined ? /*#__PURE__*/React__default.createElement("a", {
|
|
433
|
+
href: href
|
|
434
|
+
}, DataPointComponent) : DataPointComponent), /*#__PURE__*/React__default.createElement(Tooltip.Content, null, isTooltipCustom ? tooltipDecorator(data, {
|
|
432
435
|
index,
|
|
433
436
|
isSelected: propsIsSelected,
|
|
434
437
|
color: props.color
|
|
@@ -499,24 +502,9 @@ const config = (() => ({
|
|
|
499
502
|
const _excluded$p = ["className", "createArc", "hasStroke", "previousData"];
|
|
500
503
|
const COMPONENT_NAME$c = 'Arc';
|
|
501
504
|
const CLASSNAME$c = 'redsift-arc';
|
|
502
|
-
const DEFAULT_PROPS$c = {
|
|
503
|
-
color: monochrome,
|
|
504
|
-
index: 0,
|
|
505
|
-
previousData: {
|
|
506
|
-
data: {
|
|
507
|
-
key: '',
|
|
508
|
-
value: 0
|
|
509
|
-
},
|
|
510
|
-
startAngle: 0,
|
|
511
|
-
endAngle: 0,
|
|
512
|
-
padAngle: 0,
|
|
513
|
-
value: 0,
|
|
514
|
-
index: 0
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
505
|
const Arc = /*#__PURE__*/forwardRef((props, ref) => {
|
|
518
506
|
const {
|
|
519
|
-
color,
|
|
507
|
+
color = monochrome,
|
|
520
508
|
data,
|
|
521
509
|
isSelected: propsIsSelected,
|
|
522
510
|
onClick,
|
|
@@ -526,7 +514,17 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
526
514
|
className,
|
|
527
515
|
createArc,
|
|
528
516
|
hasStroke,
|
|
529
|
-
previousData
|
|
517
|
+
previousData = {
|
|
518
|
+
data: {
|
|
519
|
+
key: '',
|
|
520
|
+
value: 0
|
|
521
|
+
},
|
|
522
|
+
startAngle: 0,
|
|
523
|
+
endAngle: 0,
|
|
524
|
+
padAngle: 0,
|
|
525
|
+
value: 0,
|
|
526
|
+
index: 0
|
|
527
|
+
}
|
|
530
528
|
} = props,
|
|
531
529
|
forwardedProps = _objectWithoutProperties(props, _excluded$p);
|
|
532
530
|
const theme = useTheme();
|
|
@@ -555,7 +553,6 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
555
553
|
}));
|
|
556
554
|
});
|
|
557
555
|
Arc.className = CLASSNAME$c;
|
|
558
|
-
Arc.defaultProps = DEFAULT_PROPS$c;
|
|
559
556
|
Arc.displayName = COMPONENT_NAME$c;
|
|
560
557
|
|
|
561
558
|
/**
|
|
@@ -566,7 +563,6 @@ const StyledArcs = styled.g``;
|
|
|
566
563
|
const _excluded$o = ["arcs", "className", "color", "hasLabels", "hasStroke", "id", "labelDecorator", "onClick", "role", "sliceProps", "tooltipVariant"];
|
|
567
564
|
const COMPONENT_NAME$b = 'Arcs';
|
|
568
565
|
const CLASSNAME$b = 'redsift-arcs';
|
|
569
|
-
const DEFAULT_PROPS$b = {};
|
|
570
566
|
const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
571
567
|
const {
|
|
572
568
|
arcs,
|
|
@@ -637,7 +633,6 @@ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
637
633
|
})) : null);
|
|
638
634
|
});
|
|
639
635
|
Arcs.className = CLASSNAME$b;
|
|
640
|
-
Arcs.defaultProps = DEFAULT_PROPS$b;
|
|
641
636
|
Arcs.displayName = COMPONENT_NAME$b;
|
|
642
637
|
|
|
643
638
|
/**
|
|
@@ -811,36 +806,25 @@ const computeTicks = _ref => {
|
|
|
811
806
|
const _excluded$n = ["className", "length", "legend", "legendOffset", "legendPosition", "position", "scale", "tickPadding", "tickRotation", "tickSize", "tickValues", "tickFormat", "tickRemodelling", "variant", "x", "y"];
|
|
812
807
|
const COMPONENT_NAME$a = 'Axis';
|
|
813
808
|
const CLASSNAME$a = 'redsift-axis';
|
|
814
|
-
const DEFAULT_PROPS$a = {
|
|
815
|
-
position: AxisPosition.bottom,
|
|
816
|
-
legendOffset: -32,
|
|
817
|
-
legendPosition: 'end',
|
|
818
|
-
tickPadding: 5,
|
|
819
|
-
tickRotation: 0,
|
|
820
|
-
tickSize: 5,
|
|
821
|
-
variant: AxisVariant.default,
|
|
822
|
-
x: 0,
|
|
823
|
-
y: 0
|
|
824
|
-
};
|
|
825
809
|
const getAxisType = position => [AxisPosition.top, AxisPosition.bottom].includes(position) ? 'x' : 'y';
|
|
826
810
|
const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
827
811
|
const {
|
|
828
812
|
className,
|
|
829
813
|
length,
|
|
830
814
|
legend,
|
|
831
|
-
legendOffset,
|
|
832
|
-
legendPosition,
|
|
833
|
-
position,
|
|
815
|
+
legendOffset = -32,
|
|
816
|
+
legendPosition = 'end',
|
|
817
|
+
position = AxisPosition.bottom,
|
|
834
818
|
scale,
|
|
835
|
-
tickPadding,
|
|
836
|
-
tickRotation,
|
|
837
|
-
tickSize,
|
|
819
|
+
tickPadding = 5,
|
|
820
|
+
tickRotation = 0,
|
|
821
|
+
tickSize = 5,
|
|
838
822
|
tickValues,
|
|
839
823
|
tickFormat,
|
|
840
824
|
tickRemodelling,
|
|
841
|
-
variant,
|
|
842
|
-
x,
|
|
843
|
-
y
|
|
825
|
+
variant = AxisVariant.default,
|
|
826
|
+
x = 0,
|
|
827
|
+
y = 0
|
|
844
828
|
} = props,
|
|
845
829
|
forwardedProps = _objectWithoutProperties(props, _excluded$n);
|
|
846
830
|
const theme = useTheme();
|
|
@@ -938,6 +922,7 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
938
922
|
}
|
|
939
923
|
}));
|
|
940
924
|
return /*#__PURE__*/React__default.createElement(StyledAxis, _extends({
|
|
925
|
+
"aria-hidden": "true",
|
|
941
926
|
className: classNames(Axis.className, className),
|
|
942
927
|
$theme: theme
|
|
943
928
|
}, forwardedProps, {
|
|
@@ -971,7 +956,6 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
971
956
|
}) : null, legendNode);
|
|
972
957
|
});
|
|
973
958
|
Axis.className = CLASSNAME$a;
|
|
974
|
-
Axis.defaultProps = DEFAULT_PROPS$a;
|
|
975
959
|
Axis.displayName = COMPONENT_NAME$a;
|
|
976
960
|
|
|
977
961
|
/**
|
|
@@ -1053,27 +1037,12 @@ const StyledBar = styled(DataPoint)`
|
|
|
1053
1037
|
const _excluded$m = ["className", "gap", "height", "maxHeight", "orientation", "previousData", "scale", "scalePosition", "width"];
|
|
1054
1038
|
const COMPONENT_NAME$9 = 'Bar';
|
|
1055
1039
|
const CLASSNAME$9 = 'redsift-bar';
|
|
1056
|
-
const DEFAULT_PROPS$9 = {
|
|
1057
|
-
color: monochrome,
|
|
1058
|
-
index: 0,
|
|
1059
|
-
gap: 5,
|
|
1060
|
-
height: 40,
|
|
1061
|
-
maxHeight: 100,
|
|
1062
|
-
orientation: BarOrientation.horizontal,
|
|
1063
|
-
previousData: {
|
|
1064
|
-
data: {
|
|
1065
|
-
key: '',
|
|
1066
|
-
value: 0
|
|
1067
|
-
}
|
|
1068
|
-
},
|
|
1069
|
-
width: 40
|
|
1070
|
-
};
|
|
1071
1040
|
const getValue = data => data.cumulativeValue !== undefined ? data.cumulativeValue : data.value;
|
|
1072
1041
|
const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1073
1042
|
const {
|
|
1074
|
-
color,
|
|
1043
|
+
color = monochrome,
|
|
1075
1044
|
data,
|
|
1076
|
-
index,
|
|
1045
|
+
index = 0,
|
|
1077
1046
|
isSelected: propsIsSelected,
|
|
1078
1047
|
labelDecorator,
|
|
1079
1048
|
onClick,
|
|
@@ -1081,14 +1050,19 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1081
1050
|
} = props;
|
|
1082
1051
|
const {
|
|
1083
1052
|
className,
|
|
1084
|
-
gap,
|
|
1085
|
-
height,
|
|
1086
|
-
maxHeight,
|
|
1087
|
-
orientation,
|
|
1088
|
-
previousData
|
|
1053
|
+
gap = 5,
|
|
1054
|
+
height = 40,
|
|
1055
|
+
maxHeight = 100,
|
|
1056
|
+
orientation = BarOrientation.horizontal,
|
|
1057
|
+
previousData = {
|
|
1058
|
+
data: {
|
|
1059
|
+
key: '',
|
|
1060
|
+
value: 0
|
|
1061
|
+
}
|
|
1062
|
+
},
|
|
1089
1063
|
scale,
|
|
1090
1064
|
scalePosition,
|
|
1091
|
-
width
|
|
1065
|
+
width = 40
|
|
1092
1066
|
} = props,
|
|
1093
1067
|
forwardedProps = _objectWithoutProperties(props, _excluded$m);
|
|
1094
1068
|
const theme = useTheme();
|
|
@@ -1112,7 +1086,9 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1112
1086
|
t: 0
|
|
1113
1087
|
}
|
|
1114
1088
|
}));
|
|
1115
|
-
return /*#__PURE__*/React__default.createElement(StyledBar, _extends({
|
|
1089
|
+
return /*#__PURE__*/React__default.createElement(StyledBar, _extends({
|
|
1090
|
+
"aria-hidden": "false"
|
|
1091
|
+
}, forwardedProps, {
|
|
1116
1092
|
ref: ref,
|
|
1117
1093
|
className: classNames(Bar.className, className),
|
|
1118
1094
|
transform: isHorizontal ? `translate(0, ${scalePosition(data.data.key) + gap / 2})` : `translate(${scalePosition(data.data.key) + (isOrdinal ? width + gap / 2 : width / 2)}, ${maxHeight}), rotate(180)`,
|
|
@@ -1134,7 +1110,6 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1134
1110
|
}, text) : null);
|
|
1135
1111
|
});
|
|
1136
1112
|
Bar.className = CLASSNAME$9;
|
|
1137
|
-
Bar.defaultProps = DEFAULT_PROPS$9;
|
|
1138
1113
|
Bar.displayName = COMPONENT_NAME$9;
|
|
1139
1114
|
|
|
1140
1115
|
/**
|
|
@@ -1154,11 +1129,19 @@ const BarChartLegendVariant = {
|
|
|
1154
1129
|
|
|
1155
1130
|
var reset$1 = "Reset";
|
|
1156
1131
|
var enUS = {
|
|
1132
|
+
"static-chart": "Static chart.",
|
|
1133
|
+
"interactive-chart": "Interactive chart.",
|
|
1134
|
+
"view-as-data-table": "View as data table",
|
|
1135
|
+
"table-summary": "Table representation of chart.",
|
|
1157
1136
|
reset: reset$1
|
|
1158
1137
|
};
|
|
1159
1138
|
|
|
1160
1139
|
var reset = "Réinitialiser";
|
|
1161
1140
|
var frFR = {
|
|
1141
|
+
"static-chart": "Graphique statique.",
|
|
1142
|
+
"interactive-chart": "Graphique intéractif.",
|
|
1143
|
+
"view-as-data-table": "Voir au format table de données",
|
|
1144
|
+
"table-summary": "Représentation du graphique sous forme de table de données.",
|
|
1162
1145
|
reset: reset
|
|
1163
1146
|
};
|
|
1164
1147
|
|
|
@@ -1189,6 +1172,7 @@ const StyledChartContainer = styled.div`
|
|
|
1189
1172
|
|
|
1190
1173
|
svg {
|
|
1191
1174
|
display: block;
|
|
1175
|
+
user-select: none;
|
|
1192
1176
|
}
|
|
1193
1177
|
|
|
1194
1178
|
text {
|
|
@@ -1201,6 +1185,32 @@ const StyledChartContainer = styled.div`
|
|
|
1201
1185
|
`;
|
|
1202
1186
|
}}
|
|
1203
1187
|
}
|
|
1188
|
+
|
|
1189
|
+
table {
|
|
1190
|
+
border-collapse: collapse;
|
|
1191
|
+
border: 1px solid #ebebeb;
|
|
1192
|
+
margin: 10px auto;
|
|
1193
|
+
text-align: center;
|
|
1194
|
+
width: 100%;
|
|
1195
|
+
max-width: 500px;
|
|
1196
|
+
|
|
1197
|
+
td, th, caption {
|
|
1198
|
+
padding: 0.5em;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
caption {
|
|
1202
|
+
padding: 1em 0;
|
|
1203
|
+
font-size: 1.2em;
|
|
1204
|
+
color: #555;
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
thead tr, tr:nth-child(even) {
|
|
1208
|
+
background: #f8f8f8;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
th {
|
|
1212
|
+
font-weight: 600;
|
|
1213
|
+
}
|
|
1204
1214
|
`;
|
|
1205
1215
|
const StyledChartContainerTitle = styled(Flexbox)``;
|
|
1206
1216
|
const StyledChartContainerCaption = styled.p`
|
|
@@ -1211,10 +1221,9 @@ const StyledChartContainerCaption = styled.p`
|
|
|
1211
1221
|
margin: 8px;
|
|
1212
1222
|
`;
|
|
1213
1223
|
|
|
1214
|
-
const _excluded$l = ["aria-label", "aria-labelledby", "description", "chartProps", "chartRef", "children", "className", "id", "title", "onReset", "theme"];
|
|
1224
|
+
const _excluded$l = ["aria-label", "aria-labelledby", "description", "chartProps", "chartRef", "children", "className", "id", "title", "onReset", "theme", "mode", "definition", "interactionExplanation", "descriptionForAssistiveTechnology", "dataTableRepresentation", "xAxisDefinition", "yAxisDefinition"];
|
|
1215
1225
|
const COMPONENT_NAME$8 = 'ChartContainer';
|
|
1216
1226
|
const CLASSNAME$8 = 'redsift-chart-container';
|
|
1217
|
-
const DEFAULT_PROPS$8 = {};
|
|
1218
1227
|
const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1219
1228
|
const {
|
|
1220
1229
|
'aria-label': propsAriaLabel,
|
|
@@ -1227,12 +1236,20 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1227
1236
|
id: propsId,
|
|
1228
1237
|
title,
|
|
1229
1238
|
onReset,
|
|
1230
|
-
theme: propsTheme
|
|
1239
|
+
theme: propsTheme,
|
|
1240
|
+
mode = 'static',
|
|
1241
|
+
definition,
|
|
1242
|
+
interactionExplanation,
|
|
1243
|
+
descriptionForAssistiveTechnology,
|
|
1244
|
+
dataTableRepresentation,
|
|
1245
|
+
xAxisDefinition,
|
|
1246
|
+
yAxisDefinition
|
|
1231
1247
|
} = props,
|
|
1232
1248
|
forwardedProps = _objectWithoutProperties(props, _excluded$l);
|
|
1233
1249
|
const [_id] = useId();
|
|
1234
1250
|
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
1235
1251
|
const theme = useTheme(propsTheme);
|
|
1252
|
+
const [viewAsDataTable, setViewAsDataTable] = useState(false);
|
|
1236
1253
|
warnIfNoAccessibleLabelFound(props, [title]);
|
|
1237
1254
|
const format = useMessageFormatter(intlMessages);
|
|
1238
1255
|
const ariaLabel = propsAriaLabel ? propsAriaLabel : propsAriaLabelledby || title ? undefined : undefined;
|
|
@@ -1241,13 +1258,52 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1241
1258
|
value: {
|
|
1242
1259
|
theme
|
|
1243
1260
|
}
|
|
1244
|
-
}, /*#__PURE__*/React__default.createElement(StyledChartContainer, _extends({
|
|
1245
|
-
$theme: theme
|
|
1246
|
-
|
|
1261
|
+
}, /*#__PURE__*/React__default.createElement("figure", null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(StyledChartContainer, _extends({
|
|
1262
|
+
$theme: theme,
|
|
1263
|
+
role: "region",
|
|
1264
|
+
"aria-hidden": "false"
|
|
1265
|
+
}, ariaLabel ? {
|
|
1266
|
+
'aria-label': `${ariaLabel}. ${format(`${mode}-chart`)}`
|
|
1267
|
+
} : {}, ariaLabelledby ? {
|
|
1268
|
+
'aria-labelledby': `${ariaLabelledby} id${id}__interactive-or-not`
|
|
1269
|
+
} : {}, forwardedProps, {
|
|
1247
1270
|
ref: ref,
|
|
1248
1271
|
className: classNames(ChartContainer.className, className),
|
|
1249
1272
|
id: id
|
|
1250
|
-
}),
|
|
1273
|
+
}), /*#__PURE__*/React__default.createElement("div", {
|
|
1274
|
+
id: `id${id}__screen-reader-region-before`,
|
|
1275
|
+
"aria-hidden": "false",
|
|
1276
|
+
style: {
|
|
1277
|
+
position: 'relative'
|
|
1278
|
+
}
|
|
1279
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1280
|
+
"aria-hidden": "false",
|
|
1281
|
+
style: {
|
|
1282
|
+
position: 'absolute',
|
|
1283
|
+
width: '1px',
|
|
1284
|
+
height: '1px',
|
|
1285
|
+
overflow: 'hidden',
|
|
1286
|
+
whiteSpace: 'nowrap',
|
|
1287
|
+
clip: 'rect(1px, 1px, 1px, 1px)',
|
|
1288
|
+
marginTop: '-3px',
|
|
1289
|
+
opacity: '0.01'
|
|
1290
|
+
}
|
|
1291
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
1292
|
+
id: `id${id}__interactive-or-not`,
|
|
1293
|
+
"aria-hidden": "true",
|
|
1294
|
+
style: {
|
|
1295
|
+
display: 'none'
|
|
1296
|
+
}
|
|
1297
|
+
}, format(`${mode}-chart`)), ariaLabel ? /*#__PURE__*/React__default.createElement("p", null, `${ariaLabel}. ${format(`${mode}-chart`)}`) : /*#__PURE__*/React__default.createElement("p", {
|
|
1298
|
+
"aria-labelledby": `${ariaLabelledby} id${id}__interactive-or-not`
|
|
1299
|
+
}), /*#__PURE__*/React__default.createElement("div", null, definition), /*#__PURE__*/React__default.createElement("div", null, interactionExplanation), /*#__PURE__*/React__default.createElement("div", null, descriptionForAssistiveTechnology !== null && descriptionForAssistiveTechnology !== void 0 ? descriptionForAssistiveTechnology : description), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("button", {
|
|
1300
|
+
tabIndex: -1,
|
|
1301
|
+
"aria-expanded": viewAsDataTable,
|
|
1302
|
+
onClick: () => setViewAsDataTable(!viewAsDataTable)
|
|
1303
|
+
}, format('view-as-data-table'), ', ', ariaLabel ? /*#__PURE__*/React__default.createElement("span", null, ariaLabel) : /*#__PURE__*/React__default.createElement("span", {
|
|
1304
|
+
"aria-labelledby": ariaLabelledby
|
|
1305
|
+
}))), /*#__PURE__*/React__default.createElement("div", null, xAxisDefinition), /*#__PURE__*/React__default.createElement("div", null, yAxisDefinition))), title || onReset ? /*#__PURE__*/React__default.createElement(StyledChartContainerTitle, {
|
|
1306
|
+
"aria-hidden": "true",
|
|
1251
1307
|
$theme: theme,
|
|
1252
1308
|
alignItems: "center",
|
|
1253
1309
|
justifyContent: "space-between",
|
|
@@ -1262,18 +1318,24 @@ const ChartContainer = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1262
1318
|
onClick: onReset
|
|
1263
1319
|
}, format('reset')) : null) : null, /*#__PURE__*/React__default.createElement(Flexbox, {
|
|
1264
1320
|
flexDirection: "column"
|
|
1265
|
-
}, children ? /*#__PURE__*/React__default.createElement("div", _extends({
|
|
1321
|
+
}, children ? /*#__PURE__*/React__default.createElement("div", _extends({
|
|
1322
|
+
"aria-hidden": "false",
|
|
1323
|
+
dir: "ltr"
|
|
1324
|
+
}, chartProps, {
|
|
1266
1325
|
ref: chartRef,
|
|
1267
|
-
className: `${ChartContainer.className}__content
|
|
1268
|
-
"aria-label": ariaLabel,
|
|
1269
|
-
"aria-labelledby": ariaLabelledby
|
|
1326
|
+
className: `${ChartContainer.className}__content`
|
|
1270
1327
|
}), children) : null, description ? /*#__PURE__*/React__default.createElement(StyledChartContainerCaption, {
|
|
1328
|
+
"aria-hidden": "true",
|
|
1271
1329
|
$theme: theme,
|
|
1272
1330
|
className: `${ChartContainer.className}__description`
|
|
1273
|
-
}, description) : null
|
|
1331
|
+
}, description) : null, viewAsDataTable && dataTableRepresentation ? /*#__PURE__*/React__default.createElement("table", {
|
|
1332
|
+
tabIndex: -1,
|
|
1333
|
+
summary: format('table-summary')
|
|
1334
|
+
}, ariaLabel ? /*#__PURE__*/React__default.createElement("caption", null, ariaLabel) : /*#__PURE__*/React__default.createElement("caption", {
|
|
1335
|
+
"aria-labelledby": ariaLabelledby
|
|
1336
|
+
}), dataTableRepresentation.header, dataTableRepresentation.body) : null)))));
|
|
1274
1337
|
});
|
|
1275
1338
|
ChartContainer.className = CLASSNAME$8;
|
|
1276
|
-
ChartContainer.defaultProps = DEFAULT_PROPS$8;
|
|
1277
1339
|
ChartContainer.displayName = COMPONENT_NAME$8;
|
|
1278
1340
|
|
|
1279
1341
|
/**
|
|
@@ -1447,7 +1509,7 @@ const LoadingBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1447
1509
|
}), "Loading...");
|
|
1448
1510
|
});
|
|
1449
1511
|
|
|
1450
|
-
const _excluded$i = ["areXLabelsRotated", "barProps", "caping", "className", "data", "id", "isBarSelected", "labelDecorator", "margins", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues"];
|
|
1512
|
+
const _excluded$i = ["areXLabelsRotated", "barProps", "caping", "className", "data", "id", "isBarSelected", "getBarAnchorProps", "labelDecorator", "margins", "onBarClick", "orientation", "others", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues"];
|
|
1451
1513
|
const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1452
1514
|
const {
|
|
1453
1515
|
areXLabelsRotated,
|
|
@@ -1457,6 +1519,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1457
1519
|
data: propsData,
|
|
1458
1520
|
id,
|
|
1459
1521
|
isBarSelected,
|
|
1522
|
+
getBarAnchorProps,
|
|
1460
1523
|
labelDecorator,
|
|
1461
1524
|
margins: propsMargins,
|
|
1462
1525
|
onBarClick,
|
|
@@ -1525,7 +1588,23 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1525
1588
|
return value;
|
|
1526
1589
|
}))]).range(isHorizontal ? [0, chartWidth] : [chartHeight, 0]), [size]);
|
|
1527
1590
|
const scaleCategory = useMemo(() => scaleBand().domain(data.filter(datum => datum.value).map(datum => datum.key)).range([0, isHorizontal ? chartHeight : chartWidth]), [size]);
|
|
1528
|
-
|
|
1591
|
+
const bars = data.filter(datum => datum.value);
|
|
1592
|
+
return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
|
|
1593
|
+
mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
|
|
1594
|
+
definition: `Bar Chart with ${bars.length} bars.`,
|
|
1595
|
+
dataTableRepresentation: {
|
|
1596
|
+
header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
|
|
1597
|
+
scope: "col"
|
|
1598
|
+
}, "Key"), /*#__PURE__*/React__default.createElement("th", {
|
|
1599
|
+
scope: "col"
|
|
1600
|
+
}, "Value"))),
|
|
1601
|
+
body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => /*#__PURE__*/React__default.createElement("tr", {
|
|
1602
|
+
key: datum.key
|
|
1603
|
+
}, /*#__PURE__*/React__default.createElement("th", {
|
|
1604
|
+
scope: "row"
|
|
1605
|
+
}, datum.key), /*#__PURE__*/React__default.createElement("td", null, datum.value))))
|
|
1606
|
+
}
|
|
1607
|
+
}, forwardedProps, {
|
|
1529
1608
|
id: id,
|
|
1530
1609
|
className: className,
|
|
1531
1610
|
ref: ref
|
|
@@ -1584,7 +1663,7 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1584
1663
|
variant: yAxisVariant
|
|
1585
1664
|
}) : null), /*#__PURE__*/React__default.createElement("g", {
|
|
1586
1665
|
transform: `translate(${margins.left},${margins.top})`
|
|
1587
|
-
},
|
|
1666
|
+
}, bars.map((datum, index) => {
|
|
1588
1667
|
const percent = datum.value / total;
|
|
1589
1668
|
const to = {
|
|
1590
1669
|
data: _objectSpread2(_objectSpread2({}, datum), {}, {
|
|
@@ -1594,25 +1673,27 @@ const RenderedOrdinalBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1594
1673
|
const from = cache.current ? {
|
|
1595
1674
|
data: cache.current[index]
|
|
1596
1675
|
} : undefined;
|
|
1597
|
-
return /*#__PURE__*/React__default.createElement(Bar, _extends({
|
|
1676
|
+
return /*#__PURE__*/React__default.createElement(Bar, _extends({
|
|
1598
1677
|
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.key),
|
|
1599
1678
|
data: to,
|
|
1600
1679
|
gap: gap,
|
|
1601
|
-
height: isHorizontal ? barHeight : undefined,
|
|
1602
1680
|
id: `id${id}__bar-${index}`,
|
|
1603
1681
|
index: index,
|
|
1604
1682
|
isSelected: Boolean(isBarSelected(to)),
|
|
1605
1683
|
key: `bar _${index}`,
|
|
1606
1684
|
labelDecorator: labelDecorator,
|
|
1607
|
-
maxHeight: isHorizontal ? undefined : chartHeight
|
|
1685
|
+
maxHeight: isHorizontal ? undefined : chartHeight
|
|
1686
|
+
}, getBarAnchorProps ? getBarAnchorProps(to) : {}, {
|
|
1608
1687
|
onClick: onBarClick,
|
|
1609
1688
|
orientation: orientation,
|
|
1610
1689
|
previousData: from,
|
|
1611
|
-
role: barRole,
|
|
1612
1690
|
scale: scale,
|
|
1613
1691
|
scalePosition: scaleCategory,
|
|
1614
|
-
tooltipVariant: tooltipVariant
|
|
1615
|
-
|
|
1692
|
+
tooltipVariant: tooltipVariant
|
|
1693
|
+
}, barProps, {
|
|
1694
|
+
width: isHorizontal ? undefined : barProps !== null && barProps !== void 0 && barProps.width && typeof barProps.width === 'number' ? barProps.width : barWidth,
|
|
1695
|
+
height: isHorizontal ? barProps !== null && barProps !== void 0 && barProps.height && typeof barProps.height === 'number' ? barProps.height : barHeight : undefined,
|
|
1696
|
+
role: barRole
|
|
1616
1697
|
}));
|
|
1617
1698
|
}))));
|
|
1618
1699
|
});
|
|
@@ -1687,13 +1768,9 @@ const StyledLegendItem = styled.li`
|
|
|
1687
1768
|
const _excluded$h = ["className", "color", "data", "id", "variant"];
|
|
1688
1769
|
const COMPONENT_NAME$7 = 'LegendItem';
|
|
1689
1770
|
const CLASSNAME$7 = 'redsift-legend-item';
|
|
1690
|
-
const DEFAULT_PROPS$7 = {
|
|
1691
|
-
color: monochrome,
|
|
1692
|
-
index: 0
|
|
1693
|
-
};
|
|
1694
1771
|
const LegendItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1695
1772
|
const {
|
|
1696
|
-
index,
|
|
1773
|
+
index = 0,
|
|
1697
1774
|
isSelected: propsIsSelected,
|
|
1698
1775
|
labelDecorator,
|
|
1699
1776
|
legendDecorator,
|
|
@@ -1702,7 +1779,7 @@ const LegendItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1702
1779
|
} = props;
|
|
1703
1780
|
const {
|
|
1704
1781
|
className,
|
|
1705
|
-
color,
|
|
1782
|
+
color = monochrome,
|
|
1706
1783
|
data,
|
|
1707
1784
|
id: propsId,
|
|
1708
1785
|
variant
|
|
@@ -1771,27 +1848,22 @@ const LegendItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1771
1848
|
}, text) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, text)));
|
|
1772
1849
|
});
|
|
1773
1850
|
LegendItem.className = CLASSNAME$7;
|
|
1774
|
-
LegendItem.defaultProps = DEFAULT_PROPS$7;
|
|
1775
1851
|
LegendItem.displayName = COMPONENT_NAME$7;
|
|
1776
1852
|
|
|
1777
1853
|
const _excluded$g = ["className", "data", "isLegendItemSelected", "labelDecorator", "legendDecorator", "legendItemRole", "onLegendItemClick", "variant", "width"],
|
|
1778
1854
|
_excluded2 = ["color"];
|
|
1779
1855
|
const COMPONENT_NAME$6 = 'Legend';
|
|
1780
1856
|
const CLASSNAME$6 = 'redsift-chart-legend';
|
|
1781
|
-
const DEFAULT_PROPS$6 = {
|
|
1782
|
-
isLegendItemSelected: () => true,
|
|
1783
|
-
variant: LegendVariant.label
|
|
1784
|
-
};
|
|
1785
1857
|
const Legend = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1786
1858
|
const {
|
|
1787
1859
|
className,
|
|
1788
1860
|
data,
|
|
1789
|
-
isLegendItemSelected,
|
|
1861
|
+
isLegendItemSelected = () => true,
|
|
1790
1862
|
labelDecorator,
|
|
1791
1863
|
legendDecorator,
|
|
1792
1864
|
legendItemRole,
|
|
1793
1865
|
onLegendItemClick,
|
|
1794
|
-
variant,
|
|
1866
|
+
variant = LegendVariant.label,
|
|
1795
1867
|
width
|
|
1796
1868
|
} = props,
|
|
1797
1869
|
forwardedProps = _objectWithoutProperties(props, _excluded$g);
|
|
@@ -1827,10 +1899,9 @@ const Legend = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1827
1899
|
}));
|
|
1828
1900
|
});
|
|
1829
1901
|
Legend.className = CLASSNAME$6;
|
|
1830
|
-
Legend.defaultProps = DEFAULT_PROPS$6;
|
|
1831
1902
|
Legend.displayName = COMPONENT_NAME$6;
|
|
1832
1903
|
|
|
1833
|
-
const _excluded$f = ["barProps", "className", "data", "id", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBarClick", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "xScaleType", "dateParser"];
|
|
1904
|
+
const _excluded$f = ["barProps", "className", "data", "id", "getBarAnchorProps", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onBarClick", "size", "sortingMethod", "barRole", "colorTheme", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "xScaleType", "dateParser"];
|
|
1834
1905
|
const getKey = datum => Array.isArray(datum.key) ? datum.key[0] : datum.key;
|
|
1835
1906
|
const filterData = (hasCategory, data, filterFn) => {
|
|
1836
1907
|
if (hasCategory) {
|
|
@@ -1851,6 +1922,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1851
1922
|
className,
|
|
1852
1923
|
data: propsData,
|
|
1853
1924
|
id,
|
|
1925
|
+
getBarAnchorProps,
|
|
1854
1926
|
isBarSelected,
|
|
1855
1927
|
labelDecorator,
|
|
1856
1928
|
legendDecorator,
|
|
@@ -1909,9 +1981,9 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1909
1981
|
}, propsMargins);
|
|
1910
1982
|
const chartHeight = height - margins.top - margins.bottom;
|
|
1911
1983
|
const chartWidth = width - margins.left - margins.right;
|
|
1912
|
-
const
|
|
1984
|
+
const numberOfBars = filterData(hasCategory, data, datum => datum.value).length;
|
|
1913
1985
|
const gap = 5;
|
|
1914
|
-
let barWidth = chartWidth / (
|
|
1986
|
+
let barWidth = chartWidth / (numberOfBars * 2) - gap;
|
|
1915
1987
|
const scaleX = (() => {
|
|
1916
1988
|
if (xScaleType === 'number') {
|
|
1917
1989
|
var _ref, _ref2;
|
|
@@ -1928,7 +2000,7 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1928
2000
|
domain[0] = (_ref3 = xAxisMinValue) !== null && _ref3 !== void 0 ? _ref3 : domain[0];
|
|
1929
2001
|
domain[1] = (_ref4 = xAxisMaxValue) !== null && _ref4 !== void 0 ? _ref4 : domain[1];
|
|
1930
2002
|
const startDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[0]), -1) : new Date(domain[0]);
|
|
1931
|
-
const endDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[1]),
|
|
2003
|
+
const endDate = xAxisTickValues && typeof xAxisTickValues === 'function' && typeof xAxisTickValues.offset === 'function' ? xAxisTickValues.offset(new Date(domain[1]), 1) : new Date(domain[1]);
|
|
1932
2004
|
return scaleTime().domain([startDate, endDate]).range([0, chartWidth]).nice();
|
|
1933
2005
|
} else {
|
|
1934
2006
|
var _ref5, _ref6;
|
|
@@ -1996,7 +2068,63 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
1996
2068
|
const minimalGap = Math.min(...bars.map((bar, i) => i > 0 ? Math.abs(bar.key - bars[i - 1].key) : undefined).filter(k => k)) * 0.9;
|
|
1997
2069
|
barWidth = Math.min(barWidth, chartWidth / ((scaleX.domain()[1] - scaleX.domain()[0]) / minimalGap), chartWidth / (xAxisTickValues && typeof xAxisTickValues !== 'string' ? typeof xAxisTickValues === 'number' ? xAxisTickValues : Array.isArray(xAxisTickValues) ? xAxisTickValues.length : xAxisTickValues.range(scaleX.domain()[0], scaleX.domain()[1]).length : 1));
|
|
1998
2070
|
}
|
|
1999
|
-
|
|
2071
|
+
const categories = [];
|
|
2072
|
+
const pivotedTable = bars.reduce((acc, item) => {
|
|
2073
|
+
const {
|
|
2074
|
+
key,
|
|
2075
|
+
category,
|
|
2076
|
+
value
|
|
2077
|
+
} = item;
|
|
2078
|
+
if (!categories.includes(category)) {
|
|
2079
|
+
categories.push(category);
|
|
2080
|
+
}
|
|
2081
|
+
const formattedKey = xAxisTickFormat ? xAxisTickFormat(key) : key.toString();
|
|
2082
|
+
let entry = acc.find(e => e.key === formattedKey);
|
|
2083
|
+
if (!entry) {
|
|
2084
|
+
entry = {
|
|
2085
|
+
key: formattedKey
|
|
2086
|
+
};
|
|
2087
|
+
acc.push(entry);
|
|
2088
|
+
}
|
|
2089
|
+
entry[category] = value;
|
|
2090
|
+
return acc;
|
|
2091
|
+
}, []);
|
|
2092
|
+
return /*#__PURE__*/React__default.createElement(StyledBarChart, _extends({
|
|
2093
|
+
mode: typeof onBarClick === 'function' || typeof getBarAnchorProps === 'function' ? 'interactive' : 'static',
|
|
2094
|
+
definition: `Bar Chart with ${bars.length} bars.`,
|
|
2095
|
+
xAxisDefinition: `The chart has 1 X axis displaying ${xScaleType === 'number' ? 'Numbers' : 'Dates'} from ${xScaleType === 'number' ? scaleX.domain()[0] : xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[0]) : scaleX.domain()[0].toString()} to ${xScaleType === 'number' ? scaleX.domain()[1] : xAxisTickFormat ? xAxisTickFormat(scaleX.domain()[1]) : scaleX.domain()[1].toString()}.`,
|
|
2096
|
+
yAxisDefinition: `The chart has 1 Y axis displaying numbers from ${scaleY.domain()[0]} to ${scaleY.domain()[1]}.`,
|
|
2097
|
+
dataTableRepresentation: hasCategory ? {
|
|
2098
|
+
header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
|
|
2099
|
+
scope: "col"
|
|
2100
|
+
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
|
|
2101
|
+
key: category,
|
|
2102
|
+
scope: "col"
|
|
2103
|
+
}, category)))),
|
|
2104
|
+
body: /*#__PURE__*/React__default.createElement("tbody", null, pivotedTable.map(row => /*#__PURE__*/React__default.createElement("tr", {
|
|
2105
|
+
key: row.key
|
|
2106
|
+
}, /*#__PURE__*/React__default.createElement("th", {
|
|
2107
|
+
scope: "row"
|
|
2108
|
+
}, row.key), categories.map(category => /*#__PURE__*/React__default.createElement("th", {
|
|
2109
|
+
key: `${row.key}-${category}-${row[category]}`,
|
|
2110
|
+
scope: "col"
|
|
2111
|
+
}, row[category])))))
|
|
2112
|
+
} : {
|
|
2113
|
+
header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
|
|
2114
|
+
scope: "col"
|
|
2115
|
+
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/React__default.createElement("th", {
|
|
2116
|
+
scope: "col"
|
|
2117
|
+
}, "Value"))),
|
|
2118
|
+
body: /*#__PURE__*/React__default.createElement("tbody", null, bars.map(datum => {
|
|
2119
|
+
const key = xAxisTickFormat ? xAxisTickFormat(datum.key) : datum.key.toString();
|
|
2120
|
+
return /*#__PURE__*/React__default.createElement("tr", {
|
|
2121
|
+
key: key
|
|
2122
|
+
}, /*#__PURE__*/React__default.createElement("th", {
|
|
2123
|
+
scope: "row"
|
|
2124
|
+
}, key), /*#__PURE__*/React__default.createElement("td", null, datum.value));
|
|
2125
|
+
}))
|
|
2126
|
+
}
|
|
2127
|
+
}, forwardedProps, {
|
|
2000
2128
|
id: id,
|
|
2001
2129
|
className: className,
|
|
2002
2130
|
ref: ref
|
|
@@ -2007,37 +2135,52 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2007
2135
|
}, /*#__PURE__*/React__default.createElement("svg", {
|
|
2008
2136
|
ref: svgRef,
|
|
2009
2137
|
width: width,
|
|
2010
|
-
height: height
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
},
|
|
2014
|
-
const
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2138
|
+
height: height,
|
|
2139
|
+
"aria-label": "Interactive Bar Chart",
|
|
2140
|
+
"aria-hidden": "false"
|
|
2141
|
+
}, categories.map((category, index) => {
|
|
2142
|
+
const filteredBars = bars.filter(bar => bar.category === category);
|
|
2143
|
+
return /*#__PURE__*/React__default.createElement("g", _extends({
|
|
2144
|
+
key: category,
|
|
2145
|
+
transform: `translate(${margins.left},${margins.top})`,
|
|
2146
|
+
"aria-hidden": "false",
|
|
2147
|
+
role: "region"
|
|
2148
|
+
}, hasCategory ? {
|
|
2149
|
+
'aria-label': `${category}, category ${index + 1} of ${categories.length} with ${filteredBars.length} bars`
|
|
2150
|
+
} : {}), filteredBars.map((bar, index) => {
|
|
2151
|
+
const to = {
|
|
2152
|
+
data: bar
|
|
2153
|
+
};
|
|
2154
|
+
const from = cache.current ? {
|
|
2155
|
+
data: cache.current[index]
|
|
2156
|
+
} : undefined;
|
|
2157
|
+
return /*#__PURE__*/React__default.createElement(Bar, _extends({
|
|
2158
|
+
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.category),
|
|
2159
|
+
data: to,
|
|
2160
|
+
gap: gap,
|
|
2161
|
+
id: `id${id}__bar-${index}`,
|
|
2162
|
+
index: index,
|
|
2163
|
+
isSelected: Boolean(isBarSelected(to)),
|
|
2164
|
+
key: `bar _${index}`,
|
|
2165
|
+
labelDecorator: labelDecorator,
|
|
2166
|
+
maxHeight: scaleY(bar.cumulativeValue - bar.value)
|
|
2167
|
+
}, getBarAnchorProps ? getBarAnchorProps(to) : {}, {
|
|
2168
|
+
onClick: onBarClick,
|
|
2169
|
+
orientation: BarOrientation.vertical,
|
|
2170
|
+
previousData: from,
|
|
2171
|
+
scale: scaleY,
|
|
2172
|
+
scalePosition: scaleX,
|
|
2173
|
+
tooltipVariant: tooltipVariant
|
|
2174
|
+
}, barProps, {
|
|
2175
|
+
width: barProps !== null && barProps !== void 0 && barProps.width && typeof barProps.width === 'number' ? barProps.width : barWidth,
|
|
2176
|
+
height: undefined,
|
|
2177
|
+
role: barRole
|
|
2178
|
+
}));
|
|
2039
2179
|
}));
|
|
2040
|
-
}),
|
|
2180
|
+
}), /*#__PURE__*/React__default.createElement("g", {
|
|
2181
|
+
transform: `translate(${margins.left},${margins.top})`,
|
|
2182
|
+
"aria-hidden": "true"
|
|
2183
|
+
}, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React__default.createElement(Axis, {
|
|
2041
2184
|
position: "bottom",
|
|
2042
2185
|
length: chartWidth,
|
|
2043
2186
|
scale: scaleX,
|
|
@@ -2098,46 +2241,37 @@ const RenderedLinearBarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2098
2241
|
}, legendProps)) : null);
|
|
2099
2242
|
});
|
|
2100
2243
|
|
|
2101
|
-
const _excluded$e = ["caping", "chartRef", "className", "data", "dataType", "emptyComponent", "id", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBarClick", "orientation", "others", "size", "
|
|
2244
|
+
const _excluded$e = ["barRole", "caping", "chartRef", "className", "colorTheme", "data", "dataType", "emptyComponent", "id", "isBarSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBarClick", "orientation", "others", "size", "sortingMethod", "theme", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "yAxisPlacement"];
|
|
2102
2245
|
const COMPONENT_NAME$5 = 'BarChart';
|
|
2103
2246
|
const CLASSNAME$5 = 'redsift-barchart';
|
|
2104
|
-
const DEFAULT_PROPS$5 = {
|
|
2105
|
-
isBarSelected: () => true,
|
|
2106
|
-
orientation: BarOrientation.horizontal,
|
|
2107
|
-
others: true,
|
|
2108
|
-
size: ChartSize.medium,
|
|
2109
|
-
sortingMethod: 'desc-value',
|
|
2110
|
-
colorTheme: ColorTheme.default,
|
|
2111
|
-
tooltipVariant: TooltipVariant.value,
|
|
2112
|
-
localeText: {
|
|
2113
|
-
emptyChartText: 'No Data'
|
|
2114
|
-
},
|
|
2115
|
-
xAxisPlacement: 'bottom',
|
|
2116
|
-
yAxisPlacement: 'left'
|
|
2117
|
-
};
|
|
2118
2247
|
const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2119
2248
|
const {
|
|
2249
|
+
barRole,
|
|
2120
2250
|
caping,
|
|
2121
2251
|
chartRef,
|
|
2122
2252
|
className,
|
|
2253
|
+
colorTheme = ColorTheme.default,
|
|
2123
2254
|
data: propsData,
|
|
2124
2255
|
dataType: propsDataType,
|
|
2125
2256
|
emptyComponent,
|
|
2126
2257
|
id: propsId,
|
|
2127
|
-
isBarSelected,
|
|
2258
|
+
isBarSelected = () => true,
|
|
2128
2259
|
labelDecorator,
|
|
2129
2260
|
legendDecorator,
|
|
2130
2261
|
legendVariant: propsLegendVariant,
|
|
2131
|
-
localeText
|
|
2262
|
+
localeText = {
|
|
2263
|
+
emptyChartText: 'No Data'
|
|
2264
|
+
},
|
|
2132
2265
|
onBarClick,
|
|
2133
|
-
orientation,
|
|
2134
|
-
others,
|
|
2135
|
-
size,
|
|
2136
|
-
|
|
2266
|
+
orientation = BarOrientation.horizontal,
|
|
2267
|
+
others = true,
|
|
2268
|
+
size = ChartSize.medium,
|
|
2269
|
+
sortingMethod = 'desc-value',
|
|
2137
2270
|
theme,
|
|
2138
2271
|
tooltipDecorator,
|
|
2139
|
-
|
|
2140
|
-
|
|
2272
|
+
tooltipVariant = TooltipVariant.value,
|
|
2273
|
+
xAxisPlacement = 'bottom',
|
|
2274
|
+
yAxisPlacement = 'left'
|
|
2141
2275
|
} = props,
|
|
2142
2276
|
forwardedProps = _objectWithoutProperties(props, _excluded$e);
|
|
2143
2277
|
const [_id] = useId();
|
|
@@ -2176,10 +2310,13 @@ const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2176
2310
|
orientation: orientation,
|
|
2177
2311
|
others: others,
|
|
2178
2312
|
size: size,
|
|
2313
|
+
sortingMethod: sortingMethod,
|
|
2179
2314
|
theme: theme,
|
|
2180
2315
|
tooltipDecorator: tooltipDecorator,
|
|
2181
2316
|
colorTheme: colorTheme,
|
|
2182
|
-
tooltipVariant: tooltipVariant
|
|
2317
|
+
tooltipVariant: tooltipVariant,
|
|
2318
|
+
xAxisPlacement: xAxisPlacement,
|
|
2319
|
+
yAxisPlacement: yAxisPlacement
|
|
2183
2320
|
}, forwardedProps, {
|
|
2184
2321
|
ref: ref
|
|
2185
2322
|
}));
|
|
@@ -2196,10 +2333,13 @@ const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2196
2333
|
legendVariant: legendVariant,
|
|
2197
2334
|
onBarClick: onBarClick,
|
|
2198
2335
|
size: size,
|
|
2336
|
+
sortingMethod: sortingMethod,
|
|
2199
2337
|
theme: theme,
|
|
2200
2338
|
tooltipDecorator: tooltipDecorator,
|
|
2201
2339
|
colorTheme: colorTheme,
|
|
2202
|
-
tooltipVariant: tooltipVariant
|
|
2340
|
+
tooltipVariant: tooltipVariant,
|
|
2341
|
+
xAxisPlacement: xAxisPlacement,
|
|
2342
|
+
yAxisPlacement: yAxisPlacement
|
|
2203
2343
|
}, forwardedProps, {
|
|
2204
2344
|
ref: ref
|
|
2205
2345
|
}));
|
|
@@ -2207,7 +2347,6 @@ const BarChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2207
2347
|
return null;
|
|
2208
2348
|
});
|
|
2209
2349
|
BarChart.className = CLASSNAME$5;
|
|
2210
|
-
BarChart.defaultProps = DEFAULT_PROPS$5;
|
|
2211
2350
|
BarChart.displayName = COMPONENT_NAME$5;
|
|
2212
2351
|
|
|
2213
2352
|
/**
|
|
@@ -2261,20 +2400,12 @@ const StyledDot = styled(DataPoint)`
|
|
|
2261
2400
|
}}}
|
|
2262
2401
|
`;
|
|
2263
2402
|
|
|
2264
|
-
const _excluded$d = ["className", "scaleX", "scaleY", "variant"];
|
|
2403
|
+
const _excluded$d = ["className", "labelDecorator", "scaleX", "scaleY", "variant"];
|
|
2265
2404
|
const COMPONENT_NAME$4 = 'Dot';
|
|
2266
2405
|
const CLASSNAME$4 = 'redsift-dot';
|
|
2267
|
-
const DEFAULT_PROPS$4 = {
|
|
2268
|
-
color: monochrome,
|
|
2269
|
-
index: 0,
|
|
2270
|
-
labelDecorator: datum => {
|
|
2271
|
-
return datum.data.key[2] !== undefined && datum.data.key[2] !== null ? datum.data.key[2] : `${datum.data.key[0]},${datum.data.key[1]}`;
|
|
2272
|
-
},
|
|
2273
|
-
variant: DotVariant.plain
|
|
2274
|
-
};
|
|
2275
2406
|
const Dot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2276
2407
|
const {
|
|
2277
|
-
color,
|
|
2408
|
+
color = monochrome,
|
|
2278
2409
|
data,
|
|
2279
2410
|
isSelected: propsIsSelected,
|
|
2280
2411
|
onClick,
|
|
@@ -2282,15 +2413,20 @@ const Dot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2282
2413
|
} = props;
|
|
2283
2414
|
const {
|
|
2284
2415
|
className,
|
|
2416
|
+
labelDecorator = datum => {
|
|
2417
|
+
return datum.data.key[2] !== undefined && datum.data.key[2] !== null ? datum.data.key[2] : `${datum.data.key[0]},${datum.data.key[1]}`;
|
|
2418
|
+
},
|
|
2285
2419
|
scaleX,
|
|
2286
2420
|
scaleY,
|
|
2287
|
-
variant
|
|
2421
|
+
variant = DotVariant.plain
|
|
2288
2422
|
} = props,
|
|
2289
2423
|
forwardedProps = _objectWithoutProperties(props, _excluded$d);
|
|
2290
2424
|
const theme = useTheme();
|
|
2291
2425
|
const isSelectable = role === 'option';
|
|
2292
2426
|
const isDeselected = isSelectable && propsIsSelected === false;
|
|
2293
|
-
return /*#__PURE__*/React__default.createElement(StyledDot, _extends({
|
|
2427
|
+
return /*#__PURE__*/React__default.createElement(StyledDot, _extends({
|
|
2428
|
+
labelDecorator: labelDecorator
|
|
2429
|
+
}, forwardedProps, {
|
|
2294
2430
|
ref: ref,
|
|
2295
2431
|
className: classNames(Dot.className, className),
|
|
2296
2432
|
$clickable: Boolean(onClick),
|
|
@@ -2306,7 +2442,6 @@ const Dot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2306
2442
|
}));
|
|
2307
2443
|
});
|
|
2308
2444
|
Dot.className = CLASSNAME$4;
|
|
2309
|
-
Dot.defaultProps = DEFAULT_PROPS$4;
|
|
2310
2445
|
Dot.displayName = COMPONENT_NAME$4;
|
|
2311
2446
|
|
|
2312
2447
|
/**
|
|
@@ -2317,13 +2452,9 @@ const StyledLine = styled('g')``;
|
|
|
2317
2452
|
const _excluded$c = ["className", "createLine", "previousData"];
|
|
2318
2453
|
const COMPONENT_NAME$3 = 'Line';
|
|
2319
2454
|
const CLASSNAME$3 = 'redsift-line';
|
|
2320
|
-
const DEFAULT_PROPS$3 = {
|
|
2321
|
-
color: monochrome,
|
|
2322
|
-
previousData: []
|
|
2323
|
-
};
|
|
2324
2455
|
const Line = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2325
2456
|
const {
|
|
2326
|
-
color,
|
|
2457
|
+
color = monochrome,
|
|
2327
2458
|
data,
|
|
2328
2459
|
isSelected: propsIsSelected,
|
|
2329
2460
|
role
|
|
@@ -2331,7 +2462,7 @@ const Line = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2331
2462
|
const {
|
|
2332
2463
|
className,
|
|
2333
2464
|
createLine,
|
|
2334
|
-
previousData
|
|
2465
|
+
previousData = []
|
|
2335
2466
|
} = props,
|
|
2336
2467
|
forwardedProps = _objectWithoutProperties(props, _excluded$c);
|
|
2337
2468
|
const interpolator = interpolate(previousData, data);
|
|
@@ -2358,7 +2489,6 @@ const Line = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2358
2489
|
}));
|
|
2359
2490
|
});
|
|
2360
2491
|
Line.className = CLASSNAME$3;
|
|
2361
|
-
Line.defaultProps = DEFAULT_PROPS$3;
|
|
2362
2492
|
Line.displayName = COMPONENT_NAME$3;
|
|
2363
2493
|
|
|
2364
2494
|
/**
|
|
@@ -2796,25 +2926,13 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2796
2926
|
}, legendProps)) : null);
|
|
2797
2927
|
});
|
|
2798
2928
|
|
|
2799
|
-
const _excluded$8 = ["className", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onDotClick", "size", "
|
|
2929
|
+
const _excluded$8 = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onDotClick", "size", "sortingMethod", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
|
|
2800
2930
|
const COMPONENT_NAME$2 = 'LineChart';
|
|
2801
2931
|
const CLASSNAME$2 = 'redsift-line-chart';
|
|
2802
|
-
const DEFAULT_PROPS$2 = {
|
|
2803
|
-
localeText: {
|
|
2804
|
-
emptyChartText: 'No Data'
|
|
2805
|
-
},
|
|
2806
|
-
size: ChartSize.medium,
|
|
2807
|
-
sortingMethod: 'desc-value',
|
|
2808
|
-
colorTheme: ColorTheme.dark,
|
|
2809
|
-
tooltipVariant: TooltipVariant.none,
|
|
2810
|
-
xAxisVariant: AxisVariant.default,
|
|
2811
|
-
xAxisPlacement: 'bottom',
|
|
2812
|
-
yAxisVariant: AxisVariant.default,
|
|
2813
|
-
yAxisPlacement: 'left'
|
|
2814
|
-
};
|
|
2815
2932
|
const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
2816
2933
|
const {
|
|
2817
2934
|
className,
|
|
2935
|
+
colorTheme = ColorTheme.dark,
|
|
2818
2936
|
data: propsData,
|
|
2819
2937
|
dotRole,
|
|
2820
2938
|
emptyComponent,
|
|
@@ -2823,12 +2941,18 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2823
2941
|
labelDecorator,
|
|
2824
2942
|
legendDecorator,
|
|
2825
2943
|
legendVariant: propsLegendVariant,
|
|
2826
|
-
localeText
|
|
2944
|
+
localeText = {
|
|
2945
|
+
emptyChartText: 'No Data'
|
|
2946
|
+
},
|
|
2827
2947
|
onDotClick,
|
|
2828
|
-
size,
|
|
2829
|
-
|
|
2948
|
+
size = ChartSize.medium,
|
|
2949
|
+
sortingMethod = 'desc-value',
|
|
2830
2950
|
tooltipDecorator,
|
|
2831
|
-
tooltipVariant
|
|
2951
|
+
tooltipVariant = TooltipVariant.none,
|
|
2952
|
+
xAxisPlacement = 'bottom',
|
|
2953
|
+
xAxisVariant = AxisVariant.default,
|
|
2954
|
+
yAxisPlacement = 'left',
|
|
2955
|
+
yAxisVariant = AxisVariant.default
|
|
2832
2956
|
} = props,
|
|
2833
2957
|
forwardedProps = _objectWithoutProperties(props, _excluded$8);
|
|
2834
2958
|
const [_id] = useId();
|
|
@@ -2846,13 +2970,19 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2846
2970
|
data: propsData,
|
|
2847
2971
|
emptyComponent: emptyComponent,
|
|
2848
2972
|
localeText: localeText,
|
|
2849
|
-
size: size
|
|
2973
|
+
size: size,
|
|
2974
|
+
sortingMethod: sortingMethod,
|
|
2975
|
+
xAxisPlacement: xAxisPlacement,
|
|
2976
|
+
xAxisVariant: xAxisVariant,
|
|
2977
|
+
yAxisPlacement: yAxisPlacement,
|
|
2978
|
+
yAxisVariant: yAxisVariant
|
|
2850
2979
|
}, forwardedProps, {
|
|
2851
2980
|
ref: ref
|
|
2852
2981
|
}));
|
|
2853
2982
|
}
|
|
2854
2983
|
return /*#__PURE__*/React__default.createElement(RenderedLineChart, _extends({
|
|
2855
2984
|
className: classNames(LineChart.className, className),
|
|
2985
|
+
colorTheme: colorTheme,
|
|
2856
2986
|
data: propsData,
|
|
2857
2987
|
dotRole: dotRole,
|
|
2858
2988
|
id: id,
|
|
@@ -2863,15 +2993,18 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
2863
2993
|
localeText: localeText,
|
|
2864
2994
|
onDotClick: onDotClick,
|
|
2865
2995
|
size: size,
|
|
2866
|
-
|
|
2996
|
+
sortingMethod: sortingMethod,
|
|
2867
2997
|
tooltipDecorator: tooltipDecorator,
|
|
2868
|
-
tooltipVariant: tooltipVariant
|
|
2998
|
+
tooltipVariant: tooltipVariant,
|
|
2999
|
+
xAxisPlacement: xAxisPlacement,
|
|
3000
|
+
xAxisVariant: xAxisVariant,
|
|
3001
|
+
yAxisPlacement: yAxisPlacement,
|
|
3002
|
+
yAxisVariant: yAxisVariant
|
|
2869
3003
|
}, forwardedProps, {
|
|
2870
3004
|
ref: ref
|
|
2871
3005
|
}));
|
|
2872
3006
|
});
|
|
2873
3007
|
LineChart.className = CLASSNAME$2;
|
|
2874
|
-
LineChart.defaultProps = DEFAULT_PROPS$2;
|
|
2875
3008
|
LineChart.displayName = COMPONENT_NAME$2;
|
|
2876
3009
|
|
|
2877
3010
|
/**
|
|
@@ -3168,12 +3301,13 @@ const EmptyPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3168
3301
|
}))));
|
|
3169
3302
|
});
|
|
3170
3303
|
|
|
3171
|
-
const _excluded$5 = ["caping", "className", "data", "id", "isHalf", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "middleText", "onSliceClick", "others", "size", "sliceProps", "sliceRole", "sortingMethod", "subtext", "text", "colorTheme", "tooltipVariant", "variant"];
|
|
3304
|
+
const _excluded$5 = ["caping", "className", "data", "getSliceAnchorProps", "id", "isHalf", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "middleText", "onSliceClick", "others", "size", "sliceProps", "sliceRole", "sortingMethod", "subtext", "text", "colorTheme", "tooltipVariant", "variant"];
|
|
3172
3305
|
const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
3173
3306
|
const {
|
|
3174
3307
|
caping,
|
|
3175
3308
|
className,
|
|
3176
3309
|
data: propsData,
|
|
3310
|
+
getSliceAnchorProps,
|
|
3177
3311
|
id,
|
|
3178
3312
|
isHalf,
|
|
3179
3313
|
isSliceSelected,
|
|
@@ -3254,7 +3388,23 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3254
3388
|
})
|
|
3255
3389
|
});
|
|
3256
3390
|
}), total) : propsMiddleText;
|
|
3257
|
-
|
|
3391
|
+
const filteredPieData = pieData.filter(datum => datum.data.value);
|
|
3392
|
+
return /*#__PURE__*/React__default.createElement(StyledPieChart, _extends({
|
|
3393
|
+
mode: typeof onSliceClick === 'function' || typeof getSliceAnchorProps === 'function' ? 'interactive' : 'static',
|
|
3394
|
+
definition: `Pie Chart with ${filteredPieData.length} slices.`,
|
|
3395
|
+
dataTableRepresentation: {
|
|
3396
|
+
header: /*#__PURE__*/React__default.createElement("thead", null, /*#__PURE__*/React__default.createElement("tr", null, /*#__PURE__*/React__default.createElement("th", {
|
|
3397
|
+
scope: "col"
|
|
3398
|
+
}, "Key"), /*#__PURE__*/React__default.createElement("th", {
|
|
3399
|
+
scope: "col"
|
|
3400
|
+
}, "Value"))),
|
|
3401
|
+
body: /*#__PURE__*/React__default.createElement("tbody", null, filteredPieData.map(datum => /*#__PURE__*/React__default.createElement("tr", {
|
|
3402
|
+
key: datum.data.key
|
|
3403
|
+
}, /*#__PURE__*/React__default.createElement("th", {
|
|
3404
|
+
scope: "row"
|
|
3405
|
+
}, datum.data.key), /*#__PURE__*/React__default.createElement("td", null, datum.data.value))))
|
|
3406
|
+
}
|
|
3407
|
+
}, forwardedProps, {
|
|
3258
3408
|
className: className,
|
|
3259
3409
|
id: id,
|
|
3260
3410
|
ref: ref
|
|
@@ -3269,7 +3419,7 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3269
3419
|
width: width,
|
|
3270
3420
|
height: isHalf ? height + externalRadiusPadding : height
|
|
3271
3421
|
}, /*#__PURE__*/React__default.createElement(Arcs, {
|
|
3272
|
-
arcs:
|
|
3422
|
+
arcs: filteredPieData.map((datum, index) => {
|
|
3273
3423
|
const percent = datum.data.value / total;
|
|
3274
3424
|
const from = previousPieData ? previousPieData[index] : {
|
|
3275
3425
|
data: {
|
|
@@ -3287,7 +3437,7 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3287
3437
|
percent
|
|
3288
3438
|
})
|
|
3289
3439
|
});
|
|
3290
|
-
return {
|
|
3440
|
+
return _objectSpread2({
|
|
3291
3441
|
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(to.data.key),
|
|
3292
3442
|
createArc,
|
|
3293
3443
|
previousData: from,
|
|
@@ -3296,7 +3446,7 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3296
3446
|
isSelected: isSliceSelected(to),
|
|
3297
3447
|
key: `id${id}__bar-${index}`,
|
|
3298
3448
|
data: to
|
|
3299
|
-
};
|
|
3449
|
+
}, getSliceAnchorProps ? getSliceAnchorProps(to) : {});
|
|
3300
3450
|
}),
|
|
3301
3451
|
hasLabels: legendVariant === PieChartLegendVariant.internal,
|
|
3302
3452
|
hasStroke: isSpaced,
|
|
@@ -3317,46 +3467,36 @@ const RenderedPieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3317
3467
|
}, legendProps)) : null);
|
|
3318
3468
|
});
|
|
3319
3469
|
|
|
3320
|
-
const _excluded$4 = ["caping", "chartRef", "className", "data", "emptyComponent", "id", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "middleText", "onSliceClick", "others", "size", "sliceRole", "
|
|
3470
|
+
const _excluded$4 = ["caping", "chartRef", "className", "colorTheme", "data", "emptyComponent", "id", "isSliceSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "middleText", "onSliceClick", "others", "size", "sliceRole", "sortingMethod", "subtext", "text", "tooltipDecorator", "tooltipVariant", "variant"];
|
|
3321
3471
|
const COMPONENT_NAME$1 = 'PieChart';
|
|
3322
3472
|
const CLASSNAME$1 = 'redsift-piechart';
|
|
3323
|
-
const DEFAULT_PROPS$1 = {
|
|
3324
|
-
isSliceSelected: () => true,
|
|
3325
|
-
// legendVariant: PieChartLegendVariant.none,
|
|
3326
|
-
others: true,
|
|
3327
|
-
size: ChartSize.medium,
|
|
3328
|
-
sortingMethod: 'desc-value',
|
|
3329
|
-
colorTheme: ColorTheme.default,
|
|
3330
|
-
variant: PieChartVariant.spaced,
|
|
3331
|
-
tooltipVariant: TooltipVariant.value,
|
|
3332
|
-
localeText: {
|
|
3333
|
-
emptyChartText: 'No Data'
|
|
3334
|
-
}
|
|
3335
|
-
};
|
|
3336
3473
|
const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
3337
3474
|
const {
|
|
3338
3475
|
caping,
|
|
3339
3476
|
chartRef,
|
|
3340
3477
|
className,
|
|
3478
|
+
colorTheme = ColorTheme.default,
|
|
3341
3479
|
data: propsData,
|
|
3342
3480
|
emptyComponent,
|
|
3343
3481
|
id: propsId,
|
|
3344
|
-
isSliceSelected,
|
|
3482
|
+
isSliceSelected = () => true,
|
|
3345
3483
|
labelDecorator,
|
|
3346
3484
|
legendDecorator,
|
|
3347
3485
|
legendVariant: propsLegendVariant,
|
|
3348
|
-
localeText
|
|
3486
|
+
localeText = {
|
|
3487
|
+
emptyChartText: 'No Data'
|
|
3488
|
+
},
|
|
3349
3489
|
middleText,
|
|
3350
3490
|
onSliceClick,
|
|
3351
|
-
others,
|
|
3352
|
-
size,
|
|
3491
|
+
others = true,
|
|
3492
|
+
size = ChartSize.medium,
|
|
3353
3493
|
sliceRole,
|
|
3494
|
+
sortingMethod = 'desc-value',
|
|
3354
3495
|
subtext,
|
|
3355
3496
|
text,
|
|
3356
|
-
colorTheme,
|
|
3357
3497
|
tooltipDecorator,
|
|
3358
|
-
tooltipVariant,
|
|
3359
|
-
variant
|
|
3498
|
+
tooltipVariant = TooltipVariant.value,
|
|
3499
|
+
variant = PieChartVariant.spaced
|
|
3360
3500
|
} = props,
|
|
3361
3501
|
forwardedProps = _objectWithoutProperties(props, _excluded$4);
|
|
3362
3502
|
const [_id] = useId();
|
|
@@ -3376,6 +3516,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3376
3516
|
id: id,
|
|
3377
3517
|
localeText: localeText,
|
|
3378
3518
|
size: size,
|
|
3519
|
+
sortingMethod: sortingMethod,
|
|
3379
3520
|
variant: variant
|
|
3380
3521
|
}, forwardedProps, {
|
|
3381
3522
|
ref: ref
|
|
@@ -3396,6 +3537,7 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3396
3537
|
others: others,
|
|
3397
3538
|
size: size,
|
|
3398
3539
|
sliceRole: sliceRole,
|
|
3540
|
+
sortingMethod: sortingMethod,
|
|
3399
3541
|
subtext: subtext,
|
|
3400
3542
|
text: text,
|
|
3401
3543
|
colorTheme: colorTheme,
|
|
@@ -3407,7 +3549,6 @@ const PieChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3407
3549
|
}));
|
|
3408
3550
|
});
|
|
3409
3551
|
PieChart.className = CLASSNAME$1;
|
|
3410
|
-
PieChart.defaultProps = DEFAULT_PROPS$1;
|
|
3411
3552
|
PieChart.displayName = COMPONENT_NAME$1;
|
|
3412
3553
|
|
|
3413
3554
|
/**
|
|
@@ -3878,45 +4019,37 @@ const RenderedScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3878
4019
|
}, legendProps)) : null);
|
|
3879
4020
|
});
|
|
3880
4021
|
|
|
3881
|
-
const _excluded = ["className", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBrush", "onBrushEnd", "onDotClick", "size", "
|
|
4022
|
+
const _excluded = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "hideControlKeyPanel", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onBrush", "onBrushEnd", "onDotClick", "size", "sortingMethod", "tooltipDecorator", "tooltipVariant", "variant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
|
|
3882
4023
|
const COMPONENT_NAME = 'ScatterPlot';
|
|
3883
4024
|
const CLASSNAME = 'redsift-scatterplot';
|
|
3884
|
-
const DEFAULT_PROPS = {
|
|
3885
|
-
hideControlKeyPanel: false,
|
|
3886
|
-
// legendVariant: ScatterPlotLegendVariant.externalLabel,
|
|
3887
|
-
localeText: {
|
|
3888
|
-
emptyChartText: 'No Data'
|
|
3889
|
-
},
|
|
3890
|
-
size: ChartSize.medium,
|
|
3891
|
-
sortingMethod: 'desc-value',
|
|
3892
|
-
colorTheme: ColorTheme.default,
|
|
3893
|
-
tooltipVariant: TooltipVariant.none,
|
|
3894
|
-
variant: ScatterPlotVariant.default,
|
|
3895
|
-
xAxisVariant: AxisVariant.default,
|
|
3896
|
-
xAxisPlacement: 'bottom',
|
|
3897
|
-
yAxisVariant: AxisVariant.default,
|
|
3898
|
-
yAxisPlacement: 'left'
|
|
3899
|
-
};
|
|
3900
4025
|
const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
3901
4026
|
const {
|
|
3902
4027
|
className,
|
|
4028
|
+
colorTheme = ColorTheme.default,
|
|
3903
4029
|
data: propsData,
|
|
3904
4030
|
dotRole,
|
|
3905
4031
|
emptyComponent,
|
|
4032
|
+
hideControlKeyPanel = false,
|
|
3906
4033
|
id: propsId,
|
|
3907
4034
|
isDotSelected,
|
|
3908
4035
|
labelDecorator,
|
|
3909
4036
|
legendDecorator,
|
|
3910
4037
|
legendVariant: propsLegendVariant,
|
|
3911
|
-
localeText
|
|
4038
|
+
localeText = {
|
|
4039
|
+
emptyChartText: 'No Data'
|
|
4040
|
+
},
|
|
3912
4041
|
onBrush,
|
|
3913
4042
|
onBrushEnd,
|
|
3914
4043
|
onDotClick,
|
|
3915
|
-
size,
|
|
3916
|
-
|
|
4044
|
+
size = ChartSize.medium,
|
|
4045
|
+
sortingMethod = 'desc-value',
|
|
3917
4046
|
tooltipDecorator,
|
|
3918
|
-
tooltipVariant,
|
|
3919
|
-
variant
|
|
4047
|
+
tooltipVariant = TooltipVariant.none,
|
|
4048
|
+
variant = ScatterPlotVariant.default,
|
|
4049
|
+
xAxisPlacement = 'bottom',
|
|
4050
|
+
xAxisVariant = AxisVariant.default,
|
|
4051
|
+
yAxisPlacement = 'left',
|
|
4052
|
+
yAxisVariant = AxisVariant.default
|
|
3920
4053
|
} = props,
|
|
3921
4054
|
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
3922
4055
|
const [_id] = useId();
|
|
@@ -3933,16 +4066,24 @@ const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3933
4066
|
return /*#__PURE__*/React__default.createElement(EmptyScatterPlot, _extends({
|
|
3934
4067
|
data: propsData,
|
|
3935
4068
|
emptyComponent: emptyComponent,
|
|
4069
|
+
hideControlKeyPanel: hideControlKeyPanel,
|
|
3936
4070
|
localeText: localeText,
|
|
3937
|
-
size: size
|
|
4071
|
+
size: size,
|
|
4072
|
+
sortingMethod: sortingMethod,
|
|
4073
|
+
xAxisPlacement: xAxisPlacement,
|
|
4074
|
+
xAxisVariant: xAxisVariant,
|
|
4075
|
+
yAxisPlacement: yAxisPlacement,
|
|
4076
|
+
yAxisVariant: yAxisVariant
|
|
3938
4077
|
}, forwardedProps, {
|
|
3939
4078
|
ref: ref
|
|
3940
4079
|
}));
|
|
3941
4080
|
}
|
|
3942
4081
|
return /*#__PURE__*/React__default.createElement(RenderedScatterPlot, _extends({
|
|
3943
4082
|
className: classNames(ScatterPlot.className, className),
|
|
4083
|
+
colorTheme: colorTheme,
|
|
3944
4084
|
data: propsData,
|
|
3945
4085
|
dotRole: dotRole,
|
|
4086
|
+
hideControlKeyPanel: hideControlKeyPanel,
|
|
3946
4087
|
id: id,
|
|
3947
4088
|
isDotSelected: isDotSelected,
|
|
3948
4089
|
labelDecorator: labelDecorator,
|
|
@@ -3953,16 +4094,19 @@ const ScatterPlot = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
3953
4094
|
onBrushEnd: onBrushEnd,
|
|
3954
4095
|
onDotClick: onDotClick,
|
|
3955
4096
|
size: size,
|
|
3956
|
-
|
|
4097
|
+
sortingMethod: sortingMethod,
|
|
3957
4098
|
tooltipDecorator: tooltipDecorator,
|
|
3958
4099
|
tooltipVariant: tooltipVariant,
|
|
3959
|
-
variant: variant
|
|
4100
|
+
variant: variant,
|
|
4101
|
+
xAxisPlacement: xAxisPlacement,
|
|
4102
|
+
xAxisVariant: xAxisVariant,
|
|
4103
|
+
yAxisPlacement: yAxisPlacement,
|
|
4104
|
+
yAxisVariant: yAxisVariant
|
|
3960
4105
|
}, forwardedProps, {
|
|
3961
4106
|
ref: ref
|
|
3962
4107
|
}));
|
|
3963
4108
|
});
|
|
3964
4109
|
ScatterPlot.className = CLASSNAME;
|
|
3965
|
-
ScatterPlot.defaultProps = DEFAULT_PROPS;
|
|
3966
4110
|
ScatterPlot.displayName = COMPONENT_NAME;
|
|
3967
4111
|
|
|
3968
4112
|
export { Arc, Arcs, Axis, AxisPosition, AxisVariant, Bar, BarChart, BarChartLegendVariant, BarOrientation, ChartContainer, ChartSize, ColorTheme, DataPoint, Dot, DotVariant, LabelVariant, Legend, LegendVariant, Line, LineChart, LineChartLegendVariant, PieChart, PieChartLegendVariant, PieChartVariant, ScatterPlot, ScatterPlotLegendVariant, ScatterPlotVariant, StyledArc, StyledArcs, StyledAxis, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerTitle, StyledDataPoint, StyledDot, StyledLegend, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledScatterPlot, StyledScatterPlotEmptyText, TooltipVariant, empty, getColorScale, getSortingMethod, isValidDate, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|