@semcore/d3-chart 17.0.0-prerelease.9 → 17.0.1

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 (123) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/lib/cjs/Area.js +11 -11
  3. package/lib/cjs/Axis.js +16 -16
  4. package/lib/cjs/Bar.js +16 -16
  5. package/lib/cjs/Bubble.js +20 -15
  6. package/lib/cjs/Bubble.js.map +1 -1
  7. package/lib/cjs/CompactHorizontalBar.js +16 -16
  8. package/lib/cjs/Donut.js +9 -9
  9. package/lib/cjs/Dots.js +8 -8
  10. package/lib/cjs/HorizontalBar.js +16 -16
  11. package/lib/cjs/Hover.js +3 -3
  12. package/lib/cjs/Line.js +9 -9
  13. package/lib/cjs/Plot.js +2 -2
  14. package/lib/cjs/Radar.js +19 -19
  15. package/lib/cjs/RadialTree.js +12 -12
  16. package/lib/cjs/Reference.js +12 -12
  17. package/lib/cjs/ScatterPlot.js +9 -9
  18. package/lib/cjs/Tooltip.js +9 -9
  19. package/lib/cjs/Venn.js +9 -9
  20. package/lib/cjs/a11y/PlotA11yModule.js +2 -2
  21. package/lib/cjs/a11y/PlotA11yView.js +7 -7
  22. package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
  23. package/lib/cjs/component/Chart/AbstractChart.js +9 -21
  24. package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
  25. package/lib/cjs/component/Chart/CigaretteChart.js +197 -57
  26. package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
  27. package/lib/cjs/component/Chart/CigaretteChart.type.js.map +1 -1
  28. package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  29. package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  30. package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  31. package/lib/cjs/style/bubble.shadow.css +4 -0
  32. package/lib/cjs/utils.js +3 -2
  33. package/lib/cjs/utils.js.map +1 -1
  34. package/lib/es6/Area.js +11 -11
  35. package/lib/es6/Axis.js +16 -16
  36. package/lib/es6/Bar.js +16 -16
  37. package/lib/es6/Bubble.js +20 -15
  38. package/lib/es6/Bubble.js.map +1 -1
  39. package/lib/es6/CompactHorizontalBar.js +16 -16
  40. package/lib/es6/Donut.js +9 -9
  41. package/lib/es6/Dots.js +8 -8
  42. package/lib/es6/HorizontalBar.js +16 -16
  43. package/lib/es6/Hover.js +3 -3
  44. package/lib/es6/Line.js +9 -9
  45. package/lib/es6/Plot.js +2 -2
  46. package/lib/es6/Radar.js +19 -19
  47. package/lib/es6/RadialTree.js +12 -12
  48. package/lib/es6/Reference.js +12 -12
  49. package/lib/es6/ScatterPlot.js +9 -9
  50. package/lib/es6/Tooltip.js +9 -9
  51. package/lib/es6/Venn.js +9 -9
  52. package/lib/es6/a11y/PlotA11yModule.js +2 -2
  53. package/lib/es6/a11y/PlotA11yView.js +6 -5
  54. package/lib/es6/a11y/PlotA11yView.js.map +1 -1
  55. package/lib/es6/component/Chart/AbstractChart.js +9 -21
  56. package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
  57. package/lib/es6/component/Chart/CigaretteChart.js +199 -59
  58. package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
  59. package/lib/es6/component/Chart/CigaretteChart.type.js.map +1 -1
  60. package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
  61. package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +17 -17
  62. package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
  63. package/lib/es6/style/bubble.shadow.css +4 -0
  64. package/lib/es6/utils.js +3 -2
  65. package/lib/es6/utils.js.map +1 -1
  66. package/lib/esm/AnimatedClipPath.mjs +1 -1
  67. package/lib/esm/Area.mjs +14 -14
  68. package/lib/esm/Axis.mjs +21 -23
  69. package/lib/esm/Bar.mjs +18 -18
  70. package/lib/esm/Bubble.mjs +24 -20
  71. package/lib/esm/CompactHorizontalBar.mjs +21 -20
  72. package/lib/esm/Donut.mjs +15 -13
  73. package/lib/esm/Dots.mjs +10 -10
  74. package/lib/esm/HorizontalBar.mjs +18 -18
  75. package/lib/esm/Hover.mjs +6 -6
  76. package/lib/esm/Line.mjs +12 -12
  77. package/lib/esm/Pattern.mjs +6 -7
  78. package/lib/esm/Plot.mjs +6 -7
  79. package/lib/esm/Radar.mjs +27 -29
  80. package/lib/esm/RadialTree.mjs +30 -75
  81. package/lib/esm/Reference.mjs +13 -13
  82. package/lib/esm/ResponsiveContainer.mjs +3 -5
  83. package/lib/esm/ScatterPlot.mjs +12 -11
  84. package/lib/esm/StackBar.mjs +2 -2
  85. package/lib/esm/StackedArea.mjs +2 -2
  86. package/lib/esm/Tooltip.mjs +15 -17
  87. package/lib/esm/Venn.mjs +13 -12
  88. package/lib/esm/a11y/DataAccessibilityTable.mjs +2 -4
  89. package/lib/esm/a11y/PlotA11yModule.mjs +5 -4
  90. package/lib/esm/a11y/PlotA11yView.mjs +14 -21
  91. package/lib/esm/a11y/focus.mjs +2 -2
  92. package/lib/esm/a11y/hints.mjs +3 -3
  93. package/lib/esm/a11y/insights.mjs +15 -20
  94. package/lib/esm/a11y/intl.mjs +1 -1
  95. package/lib/esm/a11y/locale.mjs +1 -2
  96. package/lib/esm/a11y/serialize.mjs +17 -17
  97. package/lib/esm/component/Chart/AbstractChart.mjs +25 -38
  98. package/lib/esm/component/Chart/AreaChart.mjs +5 -4
  99. package/lib/esm/component/Chart/BarChart.mjs +4 -3
  100. package/lib/esm/component/Chart/BubbleChart.mjs +8 -8
  101. package/lib/esm/component/Chart/CigaretteChart.mjs +204 -64
  102. package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +2 -1
  103. package/lib/esm/component/Chart/DonutChart.mjs +3 -2
  104. package/lib/esm/component/Chart/HistogramChart.mjs +5 -4
  105. package/lib/esm/component/Chart/LineChart.mjs +5 -4
  106. package/lib/esm/component/Chart/RadarChart.mjs +4 -5
  107. package/lib/esm/component/Chart/ScatterPlotChart.mjs +3 -2
  108. package/lib/esm/component/Chart/VennChart.mjs +3 -3
  109. package/lib/esm/component/ChartLegend/BaseLegend.mjs +9 -14
  110. package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +6 -6
  111. package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +19 -19
  112. package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +9 -10
  113. package/lib/esm/component/ChartLegend/index.mjs +2 -0
  114. package/lib/esm/component/Cigarette/Cigarette.mjs +1 -2
  115. package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +2 -3
  116. package/lib/esm/createElement.mjs +1 -1
  117. package/lib/esm/index.mjs +1 -0
  118. package/lib/esm/style/bubble.shadow.css +4 -0
  119. package/lib/esm/utils.mjs +3 -3
  120. package/lib/types/a11y/PlotA11yView.d.ts +1 -1
  121. package/lib/types/component/Chart/AbstractChart.d.ts +4 -7
  122. package/lib/types/component/Chart/CigaretteChart.type.d.ts +7 -4
  123. package/package.json +17 -17
@@ -13,15 +13,15 @@ const styles = (
13
13
  /*__reshadow_css_start__*/
14
14
  (sstyled.insert(
15
15
  /*__inner_css_start__*/
16
- ".___SPlotA11yView_9ugu2_gg_{position:relative;display:block;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);color:var(--intergalactic-text-primary, #191b23);border:3px solid var(--intergalactic-border-primary, #c4c7cf);font-size:var(--intergalactic-fs-50, 10px);z-index:var(--intergalactic-z-index-overlay, 500);padding:2px;width:200px;height:200px;max-width:80%;max-height:80%;overflow:auto}.___SPlotA11yView_9ugu2_gg_ a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline;margin-bottom:var(--intergalactic-spacing-2x, 8px);display:block}.___SPlotA11yView_9ugu2_gg_ table,.___SPlotA11yView_9ugu2_gg_ td,.___SPlotA11yView_9ugu2_gg_ th{border:1px solid var(--intergalactic-border-primary, #c4c7cf)}",
16
+ ".___SPlotA11yView_1h3zj_gg_{position:relative;display:block;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);color:var(--intergalactic-text-primary, #191b23);border:3px solid var(--intergalactic-border-primary, #c4c7cf);font-size:var(--intergalactic-fs-50, 10px);z-index:var(--intergalactic-z-index-overlay, 500);padding:2px;width:200px;height:200px;max-width:80%;max-height:80%;overflow:auto}.___SPlotA11yView_1h3zj_gg_ a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline;margin-bottom:var(--intergalactic-spacing-2x, 8px);display:block}.___SPlotA11yView_1h3zj_gg_ table,.___SPlotA11yView_1h3zj_gg_ td,.___SPlotA11yView_1h3zj_gg_ th{border:1px solid var(--intergalactic-border-primary, #c4c7cf)}",
17
17
  /*__inner_css_end__*/
18
- "9ugu2_gg_"
18
+ "1h3zj_gg_"
19
19
  ), /*__reshadow_css_end__*/
20
20
  {
21
- "__SPlotA11yView": "___SPlotA11yView_9ugu2_gg_"
21
+ "__SPlotA11yView": "___SPlotA11yView_1h3zj_gg_"
22
22
  })
23
23
  );
24
- const PlotA11yView = ({
24
+ function PlotA11yView({
25
25
  id,
26
26
  payload: providedData,
27
27
  hints,
@@ -31,7 +31,7 @@ const PlotA11yView = ({
31
31
  config: providedConfig,
32
32
  locale,
33
33
  onCloseHandler
34
- }) => {
34
+ }) {
35
35
  var _ref = arguments[0], _ref2;
36
36
  const SPlotA11yView = Box;
37
37
  const translations = useAsyncI18nMessages(localizedMessages, locale);
@@ -42,22 +42,17 @@ const PlotA11yView = ({
42
42
  const [summary, setSummary] = React.useState(null);
43
43
  const [generatingSummary, setGeneratingSummary] = React.useState(true);
44
44
  React.useEffect(() => {
45
- var _a, _b;
46
- (_a = rootRef.current) == null ? void 0 : _a.focus();
45
+ rootRef.current?.focus();
47
46
  function focusOutHandler(event) {
48
- var _a2;
49
47
  if (event.relatedTarget === null) {
50
48
  return requestIdleCallback(onCloseHandler);
51
49
  }
52
50
  if (!(event.relatedTarget instanceof HTMLElement)) return;
53
- if ((_a2 = rootRef.current) == null ? void 0 : _a2.contains(event.relatedTarget)) return;
51
+ if (rootRef.current?.contains(event.relatedTarget)) return;
54
52
  requestIdleCallback(onCloseHandler);
55
53
  }
56
- (_b = rootRef.current) == null ? void 0 : _b.addEventListener("focusout", focusOutHandler);
57
- return () => {
58
- var _a2;
59
- return (_a2 = rootRef.current) == null ? void 0 : _a2.removeEventListener("focusout", focusOutHandler);
60
- };
54
+ rootRef.current?.addEventListener("focusout", focusOutHandler);
55
+ return () => rootRef.current?.removeEventListener("focusout", focusOutHandler);
61
56
  }, []);
62
57
  React.useEffect(() => {
63
58
  if (config.disable) {
@@ -78,15 +73,13 @@ const PlotA11yView = ({
78
73
  const handleClose = React.useCallback(() => {
79
74
  onCloseHandler();
80
75
  requestIdleCallback(() => {
81
- var _a;
82
- (_a = triggerRef.current) == null ? void 0 : _a.focus();
76
+ triggerRef.current?.focus();
83
77
  });
84
78
  }, []);
85
79
  const handleSkip = React.useCallback((event) => {
86
- var _a;
87
80
  event.preventDefault();
88
81
  if (!plotRef.current) return;
89
- (_a = heavyFindNextFocusableElement(plotRef.current)) == null ? void 0 : _a.focus();
82
+ heavyFindNextFocusableElement(plotRef.current)?.focus();
90
83
  onCloseHandler();
91
84
  }, []);
92
85
  const handleSkipKeyboard = React.useCallback((event) => {
@@ -94,9 +87,8 @@ const PlotA11yView = ({
94
87
  handleSkip(event);
95
88
  }, [handleSkip]);
96
89
  const handleGoToTable = React.useCallback((event) => {
97
- var _a;
98
90
  event.preventDefault();
99
- (_a = dataTableRef.current) == null ? void 0 : _a.focus();
91
+ dataTableRef.current?.focus();
100
92
  }, []);
101
93
  const handleGoToTableKeyboard = React.useCallback((event) => {
102
94
  if (!(event.key === "Enter" || event.key === " ")) return;
@@ -164,7 +156,8 @@ const PlotA11yView = ({
164
156
  "config": config,
165
157
  "intl": intl
166
158
  })));
167
- };
159
+ }
160
+ ;
168
161
  export {
169
162
  PlotA11yView
170
163
  };
@@ -3,7 +3,7 @@ const findNextFocusableElementInChildren = (element) => {
3
3
  if (element && isFocusable(element)) {
4
4
  return element;
5
5
  }
6
- const children = element == null ? void 0 : element.children;
6
+ const children = element?.children;
7
7
  if (children) {
8
8
  for (let i = 0; i < children.length; i++) {
9
9
  const childChild = children.item(i);
@@ -27,7 +27,7 @@ const heavyFindNextFocusableElement = (base) => {
27
27
  const parents = makeParentsChain(base);
28
28
  for (let i = 0; i < parents.length; i++) {
29
29
  const parent = parents[i];
30
- let siblings = Array.from((parent == null ? void 0 : parent.children) ?? []);
30
+ let siblings = Array.from(parent?.children ?? []);
31
31
  if (siblings.indexOf(parents[i - 1] || base) !== -1) {
32
32
  siblings = siblings.slice(siblings.indexOf(parents[i - 1] || base) + 1);
33
33
  }
@@ -99,15 +99,15 @@ const makeDataSummarizationConfig = (config) => ({
99
99
  weak: 1 / 10,
100
100
  medium: 1 / 5,
101
101
  strong: Number.POSITIVE_INFINITY,
102
- ...(config == null ? void 0 : config.trendTangens) ?? {}
102
+ ...config?.trendTangens ?? {}
103
103
  },
104
104
  movingAverage: {
105
105
  longSize: void 0,
106
106
  shortSize: void 0,
107
107
  notableDiff: void 0,
108
- ...(config == null ? void 0 : config.movingAverage) ?? {}
108
+ ...config?.movingAverage ?? {}
109
109
  },
110
- additionalFields: [...(config == null ? void 0 : config.additionalFields) ?? []]
110
+ additionalFields: [...config?.additionalFields ?? []]
111
111
  });
112
112
  export {
113
113
  makeDataHintsContainer,
@@ -24,7 +24,6 @@ const movingAverage = (data, frame) => {
24
24
  return result;
25
25
  };
26
26
  const extractDataInsights = (data, hints, config) => {
27
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
28
27
  let insights = [];
29
28
  let dataType = config.dataType ?? hints.dataType;
30
29
  const dataRange = [];
@@ -66,8 +65,8 @@ const extractDataInsights = (data, hints, config) => {
66
65
  entitiesCount = Object.keys(valuesKeys).length;
67
66
  const fromKey = firstRow[labelsKey];
68
67
  const toKey = lastRow[labelsKey];
69
- const from = ((_b = (_a = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _b.call(_a, fromKey)) ?? hints.titles.horizontalAxes[fromKey] ?? fromKey;
70
- const to = ((_d = (_c = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _d.call(_c, toKey)) ?? hints.titles.horizontalAxes[toKey] ?? toKey;
68
+ const from = hints.titles.getHorizontalAxesTitle?.(fromKey) ?? hints.titles.horizontalAxes[fromKey] ?? fromKey;
69
+ const to = hints.titles.getHorizontalAxesTitle?.(toKey) ?? hints.titles.horizontalAxes[toKey] ?? toKey;
71
70
  if (entitiesCount > 0) {
72
71
  dataRange.push({
73
72
  from,
@@ -115,10 +114,9 @@ const extractDataInsights = (data, hints, config) => {
115
114
  label,
116
115
  type
117
116
  }) => {
118
- var _a2, _b2;
119
117
  for (let i = 0; i < trendStrengths.length; i++) {
120
- const normalizedHeight = Math.abs(value.from - value.to) / (((_a2 = hints.pointsDensity) == null ? void 0 : _a2.verticalAxes) ?? 1);
121
- const normalizedWidth = width / (((_b2 = hints.pointsDensity) == null ? void 0 : _b2.horizontalAxes) ?? 1);
118
+ const normalizedHeight = Math.abs(value.from - value.to) / (hints.pointsDensity?.verticalAxes ?? 1);
119
+ const normalizedWidth = width / (hints.pointsDensity?.horizontalAxes ?? 1);
122
120
  const tang = normalizedHeight / normalizedWidth;
123
121
  const trendStrength = trendStrengths[i];
124
122
  if (tang <= config.trendTangens[trendStrength] || i === trendStrengths.length - 1) {
@@ -169,8 +167,8 @@ const extractDataInsights = (data, hints, config) => {
169
167
  i = Math.min(i, data.length - 1);
170
168
  const fromKey2 = data[lastSwitch][labelsKey];
171
169
  const toKey2 = data[i][labelsKey];
172
- const from2 = ((_f = (_e = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _f.call(_e, fromKey2)) ?? hints.titles.horizontalAxes[fromKey2] ?? fromKey2;
173
- const to2 = ((_h = (_g = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _h.call(_g, toKey2)) ?? hints.titles.horizontalAxes[toKey2] ?? toKey2;
170
+ const from2 = hints.titles.getHorizontalAxesTitle?.(fromKey2) ?? hints.titles.horizontalAxes[fromKey2] ?? fromKey2;
171
+ const to2 = hints.titles.getHorizontalAxesTitle?.(toKey2) ?? hints.titles.horizontalAxes[toKey2] ?? toKey2;
174
172
  localTrends.push(recordTrend({
175
173
  type: "trend",
176
174
  value: {
@@ -284,7 +282,7 @@ const extractDataInsights = (data, hints, config) => {
284
282
  for (const yNeighbour of [y - 1, y, y + 1]) {
285
283
  if (xNeighbour === void 0 || yNeighbour === void 0) continue;
286
284
  if (xNeighbour === x && yNeighbour === y) continue;
287
- if (!((_i = grid[xNeighbour]) == null ? void 0 : _i[yNeighbour])) continue;
285
+ if (!grid[xNeighbour]?.[yNeighbour]) continue;
288
286
  pointHandled = true;
289
287
  grid[x][y].clusterId = grid[xNeighbour][yNeighbour].clusterId;
290
288
  break;
@@ -386,7 +384,8 @@ const extractDataInsights = (data, hints, config) => {
386
384
  x: 1,
387
385
  y: 1
388
386
  }], {
389
- width: 1
387
+ width: 1,
388
+ height: 1
390
389
  });
391
390
  for (const clustersInsight of clustersInsights) {
392
391
  const {
@@ -430,7 +429,7 @@ const extractDataInsights = (data, hints, config) => {
430
429
  const key = allRowsIds[i];
431
430
  const groupKeyValue = getPropByPath(row, groupKeys[0]);
432
431
  groupedValues[key] = groupedValues[key] ?? {
433
- groupName: ((_k = (_j = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _k.call(_j, groupKeyValue)) ?? groupKeyValue,
432
+ groupName: hints.titles.getHorizontalAxesTitle?.(groupKeyValue) ?? groupKeyValue,
434
433
  rows: []
435
434
  };
436
435
  groupedValues[key].rows.push(row);
@@ -442,12 +441,11 @@ const extractDataInsights = (data, hints, config) => {
442
441
  }
443
442
  fields = fields.filter((key) => !grouppingKeys[key]);
444
443
  const groups = Object.entries(groupedValues).map(([groupKey, group]) => {
445
- var _a2, _b2;
446
444
  const values = [];
447
445
  for (const row of group.rows) {
448
446
  for (const field of fields) {
449
447
  values.push({
450
- label: hints.titles.valuesAxes[field] ?? ((_b2 = (_a2 = hints.titles).getVerticalAxesTitle) == null ? void 0 : _b2.call(_a2, field)) ?? field,
448
+ label: hints.titles.valuesAxes[field] ?? hints.titles.getVerticalAxesTitle?.(field) ?? field,
451
449
  value: getPropByPath(row, field)
452
450
  });
453
451
  }
@@ -483,13 +481,10 @@ const extractDataInsights = (data, hints, config) => {
483
481
  if (fields.length === 0) {
484
482
  fields.push(...Object.keys(keysMap));
485
483
  }
486
- const values = fields.map((field) => {
487
- var _a2, _b2;
488
- return {
489
- label: hints.titles.valuesAxes[field] ?? ((_b2 = (_a2 = hints.titles).getValueAxesTitle) == null ? void 0 : _b2.call(_a2, field)) ?? field,
490
- value: getPropByPath(data, field)
491
- };
492
- });
484
+ const values = fields.map((field) => ({
485
+ label: hints.titles.valuesAxes[field] ?? hints.titles.getValueAxesTitle?.(field) ?? field,
486
+ value: getPropByPath(data, field)
487
+ }));
493
488
  entitiesCount = values.length;
494
489
  values.sort((a, b) => {
495
490
  if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
@@ -1,4 +1,4 @@
1
- import { createIntl, createIntlCache } from "@formatjs/intl";
1
+ import { createIntlCache, createIntl } from "@formatjs/intl";
2
2
  import { normalizeLocale } from "./locale.mjs";
3
3
  const messagesCache = createIntlCache();
4
4
  const intlCache = {};
@@ -1,10 +1,9 @@
1
1
  const normalizeLocale = (providedLocale, translations = {}) => {
2
- var _a;
3
2
  const translationNames = {};
4
3
  for (const locale2 in translations) {
5
4
  translationNames[locale2.toLowerCase()] = locale2;
6
5
  }
7
- providedLocale = providedLocale ?? isAvailableLocale((_a = globalThis == null ? void 0 : globalThis.navigator) == null ? void 0 : _a.language, translations) ?? "en";
6
+ providedLocale = providedLocale ?? isAvailableLocale(globalThis?.navigator?.language, translations) ?? "en";
8
7
  let locale = providedLocale.toLowerCase();
9
8
  if (locale.includes("-") && !translations[locale]) {
10
9
  const [localeBase] = locale.split("-");
@@ -134,12 +134,12 @@ const serialize = ({
134
134
  if (insights.length === 0) return null;
135
135
  const intl = getIntl(locale, translations, availableLocales);
136
136
  const dataRangeSummary = intl.formatList(dataRange.map((range) => {
137
- const from = (valuesFormatter == null ? void 0 : valuesFormatter(range.from, range.label)) ?? defaultValueFormatter(intl, range.from, {
137
+ const from = valuesFormatter?.(range.from, range.label) ?? defaultValueFormatter(intl, range.from, {
138
138
  siblingsTimeMark: range.to,
139
139
  datesWithTime,
140
140
  maxListSymbols
141
141
  });
142
- const to = (valuesFormatter == null ? void 0 : valuesFormatter(range.to, range.label)) ?? defaultValueFormatter(intl, range.to, {
142
+ const to = valuesFormatter?.(range.to, range.label) ?? defaultValueFormatter(intl, range.to, {
143
143
  siblingsTimeMark: range.from,
144
144
  datesWithTime,
145
145
  maxListSymbols
@@ -149,7 +149,7 @@ const serialize = ({
149
149
  }, {
150
150
  from,
151
151
  to,
152
- label: (titlesFormatter == null ? void 0 : titlesFormatter(range.label)) ?? range.label
152
+ label: titlesFormatter?.(range.label) ?? range.label
153
153
  });
154
154
  }));
155
155
  if (dataType === "time-series") {
@@ -173,12 +173,12 @@ const serialize = ({
173
173
  const mainSummary = intl.formatMessage({
174
174
  id: "time-series-general-trend"
175
175
  }, {
176
- dataKey: (titlesFormatter == null ? void 0 : titlesFormatter(summaryDataKey)) ?? summaryDataKey,
176
+ dataKey: titlesFormatter?.(summaryDataKey) ?? summaryDataKey,
177
177
  trend: intl.formatMessage({
178
178
  id: `trend-${primaryTrend.change.strength}`
179
179
  }),
180
- from: (valuesFormatter == null ? void 0 : valuesFormatter(primaryTrend.change.from, dataKey)) ?? intl.formatNumber(primaryTrend.change.from),
181
- to: (valuesFormatter == null ? void 0 : valuesFormatter(primaryTrend.change.to, dataKey)) ?? intl.formatNumber(primaryTrend.change.to)
180
+ from: valuesFormatter?.(primaryTrend.change.from, dataKey) ?? intl.formatNumber(primaryTrend.change.from),
181
+ to: valuesFormatter?.(primaryTrend.change.to, dataKey) ?? intl.formatNumber(primaryTrend.change.to)
182
182
  });
183
183
  const secondarySummaries = secondaryTrends.map((trend) => intl.formatMessage({
184
184
  id: "time-series-local-trend"
@@ -186,12 +186,12 @@ const serialize = ({
186
186
  trend: intl.formatMessage({
187
187
  id: `trend-${trend.change.strength}`
188
188
  }),
189
- from: (valuesFormatter == null ? void 0 : valuesFormatter(trend.from, trend.dataKey)) ?? defaultValueFormatter(intl, trend.from, {
189
+ from: valuesFormatter?.(trend.from, trend.dataKey) ?? defaultValueFormatter(intl, trend.from, {
190
190
  siblingsTimeMark: trend.to,
191
191
  datesWithTime,
192
192
  maxListSymbols
193
193
  }),
194
- to: (valuesFormatter == null ? void 0 : valuesFormatter(trend.to, trend.dataKey)) ?? defaultValueFormatter(intl, trend.to, {
194
+ to: valuesFormatter?.(trend.to, trend.dataKey) ?? defaultValueFormatter(intl, trend.to, {
195
195
  siblingsTimeMark: trend.from,
196
196
  datesWithTime,
197
197
  maxListSymbols
@@ -212,7 +212,7 @@ const serialize = ({
212
212
  }, {
213
213
  entities,
214
214
  entitiesList: intl.formatList(entitiesList),
215
- label: (titlesFormatter == null ? void 0 : titlesFormatter(dataTitle)) ?? dataTitle
215
+ label: titlesFormatter?.(dataTitle) ?? dataTitle
216
216
  });
217
217
  if (dataRangeSummary.length > 0) {
218
218
  return `${summary}
@@ -237,7 +237,7 @@ ${dataRangeSummary}`;
237
237
  minSize
238
238
  });
239
239
  const entitiesList = biggestClusters.map((clusterInsight) => {
240
- const labels = formatLimitedSizeList(clusterInsight.labels.map((label) => (titlesFormatter == null ? void 0 : titlesFormatter(label)) ?? label), intl, maxListSymbols);
240
+ const labels = formatLimitedSizeList(clusterInsight.labels.map((label) => titlesFormatter?.(label) ?? label), intl, maxListSymbols);
241
241
  const anonymous = clusterInsight.labels.length === 0 || labels === String(clusterInsight.size);
242
242
  return intl.formatMessage({
243
243
  id: anonymous ? "entity-type-clusters-label-anonymous" : "entity-type-clusters-label"
@@ -247,10 +247,10 @@ ${dataRangeSummary}`;
247
247
  }),
248
248
  labels,
249
249
  size: clusterInsight.size,
250
- x: (valuesFormatter == null ? void 0 : valuesFormatter(clusterInsight.center.x, clusterInsight.labels)) ?? intl.formatNumber(clusterInsight.center.x),
251
- xLabel: (titlesFormatter == null ? void 0 : titlesFormatter(clusterInsight.center.xLabel)) ?? clusterInsight.center.xLabel,
252
- y: (valuesFormatter == null ? void 0 : valuesFormatter(clusterInsight.center.y, clusterInsight.labels)) ?? intl.formatNumber(clusterInsight.center.y),
253
- yLabel: (titlesFormatter == null ? void 0 : titlesFormatter(clusterInsight.center.yLabel)) ?? clusterInsight.center.yLabel
250
+ x: valuesFormatter?.(clusterInsight.center.x, clusterInsight.labels) ?? intl.formatNumber(clusterInsight.center.x),
251
+ xLabel: titlesFormatter?.(clusterInsight.center.xLabel) ?? clusterInsight.center.xLabel,
252
+ y: valuesFormatter?.(clusterInsight.center.y, clusterInsight.labels) ?? intl.formatNumber(clusterInsight.center.y),
253
+ yLabel: titlesFormatter?.(clusterInsight.center.yLabel) ?? clusterInsight.center.yLabel
254
254
  });
255
255
  });
256
256
  if (insights.length > clustersLimit) {
@@ -265,7 +265,7 @@ ${dataRangeSummary}`;
265
265
  }, {
266
266
  entities,
267
267
  entitiesList: intl.formatList(entitiesList),
268
- label: (titlesFormatter == null ? void 0 : titlesFormatter(dataTitle)) ?? dataTitle
268
+ label: titlesFormatter?.(dataTitle) ?? dataTitle
269
269
  });
270
270
  if (dataRangeSummary.length > 0) {
271
271
  return `${summary}
@@ -290,7 +290,7 @@ ${dataRangeSummary}`;
290
290
  }, {
291
291
  entities,
292
292
  entitiesList,
293
- label: (titlesFormatter == null ? void 0 : titlesFormatter(dataTitle)) ?? dataTitle
293
+ label: titlesFormatter?.(dataTitle) ?? dataTitle
294
294
  });
295
295
  } else if (dataType === "grouped-values" || dataType === "indexed-groups") {
296
296
  const groupInsights = insights;
@@ -338,7 +338,7 @@ ${dataRangeSummary}`;
338
338
  }, {
339
339
  entities,
340
340
  entitiesList: intl.formatList(entitiesList),
341
- label: (titlesFormatter == null ? void 0 : titlesFormatter(dataTitle)) ?? dataTitle
341
+ label: titlesFormatter?.(dataTitle) ?? dataTitle
342
342
  });
343
343
  return summary;
344
344
  }
@@ -1,29 +1,31 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { Component, sstyled, assignProps } from "@semcore/core";
3
- import { Flex, Box } from "@semcore/base-components";
2
+ import { sstyled, Component, assignProps } from "@semcore/core";
3
+ import { Box, Flex } from "@semcore/base-components";
4
4
  import { extractAriaProps } from "@semcore/core/lib/utils/ariaProps";
5
5
  import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
6
6
  import { Text } from "@semcore/typography";
7
7
  import React, { Fragment } from "react";
8
- import Plot from "../../Plot.mjs";
9
- import { LegendFlex } from "../ChartLegend/LegendFlex/LegendFlex.mjs";
8
+ import "../../index.mjs";
9
+ import { makeDataHintsContainer } from "../../a11y/hints.mjs";
10
+ import { interpolateValue } from "../../utils.mjs";
11
+ import "../ChartLegend/index.mjs";
10
12
  import { LegendTable } from "../ChartLegend/LegendTable/LegendTable.mjs";
13
+ import { LegendFlex } from "../ChartLegend/LegendFlex/LegendFlex.mjs";
11
14
  import { YAxis, XAxis } from "../../Axis.mjs";
12
- import { interpolateValue } from "../../utils.mjs";
13
- import { makeDataHintsContainer } from "../../a11y/hints.mjs";
15
+ import Plot from "../../Plot.mjs";
14
16
  /*!__reshadow-styles__:"../../style/abstract-chart.shadow.css"*/
15
17
  const style = (
16
18
  /*__reshadow_css_start__*/
17
19
  (sstyled.insert(
18
20
  /*__inner_css_start__*/
19
- ".___STooltipChildrenWrapper_135h8_gg_{display:grid;grid-column-gap:var(--intergalactic-spacing-2x, 8px);-moz-column-gap:var(--intergalactic-spacing-2x, 8px);column-gap:var(--intergalactic-spacing-2x, 8px)}.___STooltipChildrenWrapper_135h8_gg_._columnsCount_2_135h8_gg_{grid-template-columns:auto minmax(28px,max-content)}.___STooltipChildrenWrapper_135h8_gg_._columnsCount_3_135h8_gg_{grid-template-columns:auto minmax(28px,max-content) minmax(28px,max-content)}",
21
+ ".___STooltipChildrenWrapper_16iik_gg_{display:grid;grid-column-gap:var(--intergalactic-spacing-2x, 8px);-moz-column-gap:var(--intergalactic-spacing-2x, 8px);column-gap:var(--intergalactic-spacing-2x, 8px)}.___STooltipChildrenWrapper_16iik_gg_._columnsCount_2_16iik_gg_{grid-template-columns:auto minmax(28px,max-content)}.___STooltipChildrenWrapper_16iik_gg_._columnsCount_3_16iik_gg_{grid-template-columns:auto minmax(28px,max-content) minmax(28px,max-content)}",
20
22
  /*__inner_css_end__*/
21
- "135h8_gg_"
23
+ "16iik_gg_"
22
24
  ), /*__reshadow_css_end__*/
23
25
  {
24
- "__STooltipChildrenWrapper": "___STooltipChildrenWrapper_135h8_gg_",
25
- "_columnsCount_2": "_columnsCount_2_135h8_gg_",
26
- "_columnsCount_3": "_columnsCount_3_135h8_gg_"
26
+ "__STooltipChildrenWrapper": "___STooltipChildrenWrapper_16iik_gg_",
27
+ "_columnsCount_2": "_columnsCount_2_16iik_gg_",
28
+ "_columnsCount_3": "_columnsCount_3_16iik_gg_"
27
29
  })
28
30
  );
29
31
  const NOT_A_VALUE = "n/a";
@@ -32,11 +34,6 @@ class AbstractChart extends Component {
32
34
  super(props);
33
35
  _defineProperty(this, "plotPadding", 6);
34
36
  _defineProperty(this, "dataHints", makeDataHintsContainer());
35
- _defineProperty(this, "state", {
36
- dataDefinitions: this.getDefaultDataDefinitions(),
37
- highlightedLine: -1,
38
- withTrend: false
39
- });
40
37
  this.setHighlightedLine = this.setHighlightedLine.bind(this);
41
38
  this.handleChangeVisible = this.handleChangeVisible.bind(this);
42
39
  this.handleMouseEnter = this.handleMouseEnter.bind(this);
@@ -44,6 +41,11 @@ class AbstractChart extends Component {
44
41
  this.resolveColor = this.resolveColor.bind(this);
45
42
  this.tooltipValueFormatter = this.tooltipValueFormatter.bind(this);
46
43
  this.handleWithTrendChange = this.handleWithTrendChange.bind(this);
44
+ this.state = {
45
+ dataDefinitions: this.getDefaultDataDefinitions(),
46
+ highlightedLine: -1,
47
+ withTrend: false
48
+ };
47
49
  }
48
50
  componentDidUpdate(prevProps) {
49
51
  if (prevProps.data !== this.props.data || prevProps.legendProps !== this.props.legendProps) {
@@ -58,17 +60,16 @@ class AbstractChart extends Component {
58
60
  legendProps
59
61
  } = this.props;
60
62
  return this.dataKeys.map((key, index) => {
61
- var _a;
62
- const legendData = (_a = legendProps == null ? void 0 : legendProps.legendMap) == null ? void 0 : _a[key];
63
+ const legendData = legendProps?.legendMap?.[key];
63
64
  const dataDefinition = {
64
65
  id: key,
65
- label: (legendData == null ? void 0 : legendData.label) ?? key,
66
- icon: (legendData == null ? void 0 : legendData.icon) ?? void 0,
67
- checked: (legendData == null ? void 0 : legendData.defaultChecked) ?? true,
66
+ label: legendData?.label ?? key,
67
+ icon: legendData?.icon ?? void 0,
68
+ checked: legendData?.defaultChecked ?? true,
68
69
  color: this.resolveColor(key, index),
69
70
  columns: []
70
71
  };
71
- if ((legendData == null ? void 0 : legendData.additionalInfo) || (legendData == null ? void 0 : legendData.count)) {
72
+ if (legendData?.additionalInfo || legendData?.count) {
72
73
  dataDefinition.additionalInfo = legendData.additionalInfo ? {
73
74
  label: legendData.additionalInfo
74
75
  } : legendData.count ? {
@@ -233,18 +234,6 @@ class AbstractChart extends Component {
233
234
  }
234
235
  return total;
235
236
  }
236
- percentValue(data, key) {
237
- const total = this.totalValue(data);
238
- const value = data[key];
239
- if (typeof value === "number" && total !== 0) {
240
- const percent = Math.round(100 * value / total);
241
- return `${percent}%`;
242
- }
243
- if (value === null) {
244
- return `0%`;
245
- }
246
- return NOT_A_VALUE;
247
- }
248
237
  getValueScale(values) {
249
238
  const max = Math.max(...values);
250
239
  const min = Math.min(...values);
@@ -283,8 +272,7 @@ class AbstractChart extends Component {
283
272
  this.setHighlightedLine(-1);
284
273
  }
285
274
  resolveColor(id, index) {
286
- var _a;
287
- return ((_a = this.props.colorMap) == null ? void 0 : _a[id]) ?? `chart-palette-order-${index + 1}`;
275
+ return this.props.colorMap?.[id] ?? `chart-palette-order-${index + 1}`;
288
276
  }
289
277
  tooltipValueFormatter(value) {
290
278
  const {
@@ -402,7 +390,6 @@ class AbstractChart extends Component {
402
390
  }) : /* @__PURE__ */ React.createElement(XAxis.Grid, null))));
403
391
  }
404
392
  getTooltipChildren(options) {
405
- var _a;
406
393
  var _ref = this.asProps, _ref3;
407
394
  const STooltipChildrenWrapper = Box;
408
395
  const {
@@ -416,7 +403,7 @@ class AbstractChart extends Component {
416
403
  const {
417
404
  dataDefinitions
418
405
  } = this.state;
419
- const title = (_a = dataItem[groupKey]) == null ? void 0 : _a.toString();
406
+ const title = dataItem[groupKey]?.toString();
420
407
  return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(Flex, _ref3.cn("Flex", {
421
408
  "direction": "column"
422
409
  }), title && /* @__PURE__ */ React.createElement(Tooltip.Title, null, title), /* @__PURE__ */ React.createElement(STooltipChildrenWrapper, _ref3.cn("STooltipChildrenWrapper", {
@@ -3,12 +3,13 @@ import { createComponent } from "@semcore/core";
3
3
  import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
4
4
  import { scaleTime, scaleLinear } from "d3-scale";
5
5
  import React from "react";
6
- import Area from "../../Area.mjs";
7
- import StackedArea from "../../StackedArea.mjs";
8
- import { HoverLine } from "../../Hover.mjs";
9
- import { minMax } from "../../utils.mjs";
6
+ import "../../index.mjs";
10
7
  import { AbstractChart } from "./AbstractChart.mjs";
11
8
  import { localizedMessages } from "../../translations/__intergalactic-dynamic-locales.mjs";
9
+ import { minMax } from "../../utils.mjs";
10
+ import StackedArea from "../../StackedArea.mjs";
11
+ import Area from "../../Area.mjs";
12
+ import { HoverLine } from "../../Hover.mjs";
12
13
  class AreaChartComponent extends AbstractChart {
13
14
  get xScale() {
14
15
  const {
@@ -5,13 +5,14 @@ import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
5
5
  import { scaleTime, scaleBand, scaleLinear } from "d3-scale";
6
6
  import React from "react";
7
7
  import { AbstractChart } from "./AbstractChart.mjs";
8
- import { YAxis, XAxis } from "../../Axis.mjs";
8
+ import "../../index.mjs";
9
+ import { localizedMessages } from "../../translations/__intergalactic-dynamic-locales.mjs";
9
10
  import Line from "../../Line.mjs";
10
11
  import GroupBar from "../../GroupBar.mjs";
11
12
  import StackBar from "../../StackBar.mjs";
12
13
  import { HoverRect } from "../../Hover.mjs";
14
+ import { YAxis, XAxis } from "../../Axis.mjs";
13
15
  import { minMax } from "../../utils.mjs";
14
- import { localizedMessages } from "../../translations/__intergalactic-dynamic-locales.mjs";
15
16
  class BarChartComponent extends AbstractChart {
16
17
  constructor(...args) {
17
18
  super(...args);
@@ -61,7 +62,7 @@ class BarChartComponent extends AbstractChart {
61
62
  const {
62
63
  withTrend
63
64
  } = this.state;
64
- const trendItem = trend == null ? void 0 : trend[key];
65
+ const trendItem = trend?.[key];
65
66
  if (withTrend && trendItem) {
66
67
  return /* @__PURE__ */ React.createElement(Line, {
67
68
  data: trendItem,
@@ -4,10 +4,11 @@ import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
4
4
  import { Text } from "@semcore/typography";
5
5
  import { scaleLinear } from "d3-scale";
6
6
  import React from "react";
7
- import Bubble from "../../Bubble.mjs";
8
- import { calculateBubbleDomain } from "../../utils.mjs";
7
+ import "../../index.mjs";
9
8
  import { AbstractChart } from "./AbstractChart.mjs";
10
9
  import { localizedMessages } from "../../translations/__intergalactic-dynamic-locales.mjs";
10
+ import { calculateBubbleDomain } from "../../utils.mjs";
11
+ import Bubble from "../../Bubble.mjs";
11
12
  class BubbleChartComponent extends AbstractChart {
12
13
  get dataKeys() {
13
14
  const {
@@ -21,21 +22,20 @@ class BubbleChartComponent extends AbstractChart {
21
22
  data
22
23
  } = this.props;
23
24
  return data.map((item, index) => {
24
- var _a;
25
25
  const key = index.toString();
26
- const legendData = (_a = legendProps == null ? void 0 : legendProps.legendMap) == null ? void 0 : _a[key];
26
+ const legendData = legendProps?.legendMap?.[key];
27
27
  if (item.color === void 0) {
28
28
  item.color = this.resolveColor(key, index);
29
29
  }
30
30
  const dataDefinition = {
31
31
  id: key,
32
- label: (legendData == null ? void 0 : legendData.label) ?? item.label ?? key,
33
- icon: (legendData == null ? void 0 : legendData.icon) ?? void 0,
34
- checked: (legendData == null ? void 0 : legendData.defaultChecked) ?? true,
32
+ label: legendData?.label ?? item.label ?? key,
33
+ icon: legendData?.icon ?? void 0,
34
+ checked: legendData?.defaultChecked ?? true,
35
35
  color: item.color,
36
36
  columns: []
37
37
  };
38
- if ((legendData == null ? void 0 : legendData.additionalInfo) || (legendData == null ? void 0 : legendData.count)) {
38
+ if (legendData?.additionalInfo || legendData?.count) {
39
39
  dataDefinition.additionalInfo = legendData.additionalInfo ? {
40
40
  label: legendData.additionalInfo
41
41
  } : legendData.count ? {