@equinor/echo-components 0.6.6 → 0.7.2

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.
@@ -0,0 +1,77 @@
1
+ import { InteractionMode } from 'chart.js';
2
+ import { ChartData, ChartOptions, ChartType } from 'chart.js/auto';
3
+ export type LineChartDataSet = {
4
+ label: string;
5
+ data: number[];
6
+ borderColor: string;
7
+ pointBackgroundColor: string;
8
+ backgroundColor: string;
9
+ borderWidth: number;
10
+ pointStyle: string;
11
+ fill: boolean;
12
+ };
13
+ export type LineChartData = {
14
+ labels: string[];
15
+ datasets: LineChartDataSet[];
16
+ };
17
+ export type LineChartConfig = {
18
+ type: ChartType;
19
+ data: ChartData;
20
+ options: ChartOptions & {
21
+ responsive: boolean;
22
+ stacked: boolean;
23
+ interaction: {
24
+ mode: InteractionMode;
25
+ intersect: boolean;
26
+ };
27
+ elements: {
28
+ line: {
29
+ borderWidth: number;
30
+ };
31
+ };
32
+ plugins: {
33
+ legend: {
34
+ labels: {
35
+ boxWidth: number;
36
+ boxHeight: number;
37
+ };
38
+ };
39
+ title: {
40
+ display: boolean;
41
+ text: string;
42
+ };
43
+ tooltip: {
44
+ callbacks?: {
45
+ title?: () => string;
46
+ };
47
+ };
48
+ };
49
+ scales: {
50
+ x: {
51
+ title: {
52
+ display: boolean;
53
+ text: string;
54
+ };
55
+ ticks: {
56
+ minRotation: number;
57
+ maxRotation: number;
58
+ };
59
+ };
60
+ y: {
61
+ border: {
62
+ display: boolean;
63
+ };
64
+ title: {
65
+ display: boolean;
66
+ text: string;
67
+ };
68
+ };
69
+ };
70
+ animation: boolean;
71
+ };
72
+ };
73
+ export type ChartCallbacks = {
74
+ tooltipCallback?: {
75
+ title?: (tooltipItems: [Chart.ChartTooltipItem]) => string | undefined;
76
+ };
77
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-components",
3
- "version": "0.6.6",
3
+ "version": "0.7.2",
4
4
  "description": "Package for creating echo related components.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -39,6 +39,7 @@
39
39
  "dependencies": {
40
40
  "@babel/runtime": "^7.21.0",
41
41
  "@floating-ui/react": "^0.19.2",
42
+ "chart.js": "^4.2.1",
42
43
  "jest-environment-jsdom": "^29.4.3",
43
44
  "lodash.throttle": "^4.1.1",
44
45
  "react-datepicker": "^4.10.0",
@@ -71,6 +72,7 @@
71
72
  "@svgr/webpack": "^6.5.1",
72
73
  "@testing-library/dom": "^8.20.0",
73
74
  "@testing-library/react": "^14.0.0",
75
+ "@types/chart.js": "^2.9.37",
74
76
  "@types/jest": "^29.4.0",
75
77
  "@types/lodash.throttle": "^4.1.7",
76
78
  "@types/react": "^18.0.28",