@m4l/widgets 0.0.2 → 0.0.3-beta-add-widget-serieschart.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 (109) hide show
  1. package/charts/PieChart/PieChart.d.ts +10 -0
  2. package/charts/PieChart/PieChart.d.ts.map +1 -0
  3. package/charts/{Pie/Pie.js → PieChart/PieChart.js} +10 -10
  4. package/charts/PieChart/PieChart.styles.d.ts +3 -0
  5. package/charts/PieChart/PieChart.styles.d.ts.map +1 -0
  6. package/charts/{Pie/Pie.styles.js → PieChart/PieChart.styles.js} +4 -4
  7. package/charts/PieChart/__tests__/helpers/data.d.ts +14 -0
  8. package/charts/PieChart/__tests__/helpers/data.d.ts.map +1 -0
  9. package/charts/PieChart/__tests__/helpers/index.d.ts +7 -0
  10. package/charts/PieChart/__tests__/helpers/index.d.ts.map +1 -0
  11. package/charts/PieChart/__tests__/helpers/theme.d.ts +34 -0
  12. package/charts/PieChart/__tests__/helpers/theme.d.ts.map +1 -0
  13. package/charts/PieChart/__tests__/helpers/values.d.ts +14 -0
  14. package/charts/PieChart/__tests__/helpers/values.d.ts.map +1 -0
  15. package/charts/PieChart/constants.d.ts +2 -0
  16. package/charts/PieChart/constants.d.ts.map +1 -0
  17. package/charts/{Pie → PieChart}/constants.js +1 -1
  18. package/charts/PieChart/helpers/options.d.ts.map +1 -0
  19. package/charts/PieChart/helpers/remap.d.ts +6 -0
  20. package/charts/PieChart/helpers/remap.d.ts.map +1 -0
  21. package/charts/PieChart/helpers/remap.js +16 -0
  22. package/charts/PieChart/hooks/useChartResize.d.ts.map +1 -0
  23. package/charts/{Pie → PieChart}/hooks/usePieChartData.d.ts +2 -2
  24. package/charts/PieChart/hooks/usePieChartData.d.ts.map +1 -0
  25. package/charts/PieChart/index.d.ts +3 -0
  26. package/charts/PieChart/index.d.ts.map +1 -0
  27. package/charts/{Pie/slots/PieEnum.d.ts → PieChart/slots/PieChartEnum.d.ts} +5 -5
  28. package/charts/PieChart/slots/PieChartEnum.d.ts.map +1 -0
  29. package/charts/PieChart/slots/PieChartEnum.js +4 -0
  30. package/charts/{Pie/slots/PieSlots.d.ts → PieChart/slots/PieChartSlots.d.ts} +11 -11
  31. package/charts/PieChart/slots/PieChartSlots.d.ts.map +1 -0
  32. package/charts/{Pie/slots/PieSlots.js → PieChart/slots/PieChartSlots.js} +19 -19
  33. package/charts/PieChart/subcomponents/CustomLegend/CustomLegend.d.ts.map +1 -0
  34. package/charts/{Pie → PieChart}/subcomponents/CustomLegend/CustomLegend.js +1 -1
  35. package/charts/PieChart/subcomponents/CustomLegend/types.d.ts.map +1 -0
  36. package/charts/{Pie → PieChart}/types.d.ts +12 -12
  37. package/charts/PieChart/types.d.ts.map +1 -0
  38. package/charts/SeriesChart/SeriesChart.d.ts +10 -0
  39. package/charts/SeriesChart/SeriesChart.d.ts.map +1 -0
  40. package/charts/SeriesChart/SeriesChart.js +24 -0
  41. package/charts/SeriesChart/SeriesChart.styles.d.ts +3 -0
  42. package/charts/SeriesChart/SeriesChart.styles.d.ts.map +1 -0
  43. package/charts/SeriesChart/SeriesChart.styles.js +32 -0
  44. package/charts/SeriesChart/__tests__/helpers/index.d.ts +15 -0
  45. package/charts/SeriesChart/__tests__/helpers/index.d.ts.map +1 -0
  46. package/charts/SeriesChart/__tests__/helpers/theme.d.ts +31 -0
  47. package/charts/SeriesChart/__tests__/helpers/theme.d.ts.map +1 -0
  48. package/charts/SeriesChart/__tests__/helpers/tooltip.d.ts +10 -0
  49. package/charts/SeriesChart/__tests__/helpers/tooltip.d.ts.map +1 -0
  50. package/charts/SeriesChart/__tests__/helpers/types.d.ts +12 -0
  51. package/charts/SeriesChart/__tests__/helpers/types.d.ts.map +1 -0
  52. package/charts/SeriesChart/__tests__/helpers/values.d.ts +45 -0
  53. package/charts/SeriesChart/__tests__/helpers/values.d.ts.map +1 -0
  54. package/charts/SeriesChart/constants.d.ts +2 -0
  55. package/charts/SeriesChart/constants.d.ts.map +1 -0
  56. package/charts/SeriesChart/constants.js +4 -0
  57. package/charts/SeriesChart/helpers/options.d.ts +7 -0
  58. package/charts/SeriesChart/helpers/options.d.ts.map +1 -0
  59. package/charts/SeriesChart/helpers/options.js +229 -0
  60. package/charts/SeriesChart/helpers/tooltipFormatter.d.ts +6 -0
  61. package/charts/SeriesChart/helpers/tooltipFormatter.d.ts.map +1 -0
  62. package/charts/SeriesChart/helpers/tooltipFormatter.js +85 -0
  63. package/charts/SeriesChart/hooks/useChartResize.d.ts +8 -0
  64. package/charts/SeriesChart/hooks/useChartResize.d.ts.map +1 -0
  65. package/charts/SeriesChart/hooks/useChartResize.js +17 -0
  66. package/charts/SeriesChart/index.d.ts +3 -0
  67. package/charts/SeriesChart/index.d.ts.map +1 -0
  68. package/charts/SeriesChart/slots/SeriesChartEnum.d.ts +18 -0
  69. package/charts/SeriesChart/slots/SeriesChartEnum.d.ts.map +1 -0
  70. package/charts/SeriesChart/slots/SeriesChartEnum.js +4 -0
  71. package/charts/SeriesChart/slots/SeriesChartSlots.d.ts +28 -0
  72. package/charts/SeriesChart/slots/SeriesChartSlots.d.ts.map +1 -0
  73. package/charts/SeriesChart/slots/SeriesChartSlots.js +54 -0
  74. package/charts/SeriesChart/types.d.ts +57 -0
  75. package/charts/SeriesChart/types.d.ts.map +1 -0
  76. package/charts/index.d.ts +2 -1
  77. package/charts/index.d.ts.map +1 -1
  78. package/index.js +4 -2
  79. package/package.json +3 -2
  80. package/tools/color.d.ts +11 -0
  81. package/tools/color.d.ts.map +1 -0
  82. package/tools/color.js +17 -0
  83. package/charts/Pie/Pie.d.ts +0 -10
  84. package/charts/Pie/Pie.d.ts.map +0 -1
  85. package/charts/Pie/Pie.styles.d.ts +0 -3
  86. package/charts/Pie/Pie.styles.d.ts.map +0 -1
  87. package/charts/Pie/constants.d.ts +0 -2
  88. package/charts/Pie/constants.d.ts.map +0 -1
  89. package/charts/Pie/helpers/options.d.ts.map +0 -1
  90. package/charts/Pie/helpers/remap.d.ts +0 -6
  91. package/charts/Pie/helpers/remap.d.ts.map +0 -1
  92. package/charts/Pie/helpers/remap.js +0 -19
  93. package/charts/Pie/hooks/useChartResize.d.ts.map +0 -1
  94. package/charts/Pie/hooks/usePieChartData.d.ts.map +0 -1
  95. package/charts/Pie/index.d.ts +0 -3
  96. package/charts/Pie/index.d.ts.map +0 -1
  97. package/charts/Pie/slots/PieEnum.d.ts.map +0 -1
  98. package/charts/Pie/slots/PieEnum.js +0 -4
  99. package/charts/Pie/slots/PieSlots.d.ts.map +0 -1
  100. package/charts/Pie/subcomponents/CustomLegend/CustomLegend.d.ts.map +0 -1
  101. package/charts/Pie/subcomponents/CustomLegend/types.d.ts.map +0 -1
  102. package/charts/Pie/types.d.ts.map +0 -1
  103. /package/charts/{Pie → PieChart}/helpers/options.d.ts +0 -0
  104. /package/charts/{Pie → PieChart}/helpers/options.js +0 -0
  105. /package/charts/{Pie → PieChart}/hooks/useChartResize.d.ts +0 -0
  106. /package/charts/{Pie → PieChart}/hooks/useChartResize.js +0 -0
  107. /package/charts/{Pie → PieChart}/hooks/usePieChartData.js +0 -0
  108. /package/charts/{Pie → PieChart}/subcomponents/CustomLegend/CustomLegend.d.ts +0 -0
  109. /package/charts/{Pie → PieChart}/subcomponents/CustomLegend/types.d.ts +0 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Create a theme for ECharts options tests.
3
+ */
4
+ export declare function createTheme(overrides?: Record<string, unknown>): {
5
+ vars: {
6
+ palette: {
7
+ text: {
8
+ primary: string;
9
+ disabled: string;
10
+ contrastText: string;
11
+ };
12
+ background: {
13
+ base: string;
14
+ default: string;
15
+ neutral: string;
16
+ };
17
+ border: {
18
+ disabled: string;
19
+ };
20
+ };
21
+ };
22
+ };
23
+ /**
24
+ * Theme ready to pass to generateOptions (avoids repeating "as any" in specs).
25
+ */
26
+ export declare function getThemeForOptions(overrides?: Record<string, unknown>): any;
27
+ /**
28
+ * Empty theme for testing theme fallbacks in generateOptions.
29
+ */
30
+ export declare const emptyTheme: any;
31
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/widgets/src/charts/SeriesChart/__tests__/helpers/theme.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;;;;;;;;;;;;;;;;;;EAWlE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACvC,GAAG,CACrC;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAS,GAAG,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { TooltipParam } from './types';
2
+ /**
3
+ * Create a tooltip param for formatter tests.
4
+ */
5
+ export declare function createTooltipParam(overrides?: Partial<TooltipParam>): TooltipParam;
6
+ /**
7
+ * Create a tooltip params for formatter tests.
8
+ */
9
+ export declare function createTooltipParams(partials: Partial<TooltipParam>[]): TooltipParam[];
10
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/widgets/src/charts/SeriesChart/__tests__/helpers/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAc5C;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,YAAY,CAEtF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,YAAY,CAAC,EAAE,GAAG,YAAY,EAAE,CAErF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ECharts tooltip param shape for formatter tests.
3
+ */
4
+ export interface TooltipParam {
5
+ name: string;
6
+ dataIndex: number;
7
+ seriesIndex: number;
8
+ color: string;
9
+ borderColor: string;
10
+ seriesType: 'bar' | 'line';
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/widgets/src/charts/SeriesChart/__tests__/helpers/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,45 @@
1
+ import { SeriesChartValueItem } from '../../types';
2
+ /** Single series item shape for test overrides. */
3
+ export type SeriesItemShape = SeriesChartValueItem['series'][number];
4
+ /** One row of values used across options specs (single point). */
5
+ export declare const oneRowValues: SeriesChartValueItem['values'];
6
+ /** One row with a unit in the label (e.g. for yAxis name extraction). */
7
+ export declare const oneRowValuesWithUnit: (unit: string) => SeriesChartValueItem["values"];
8
+ /** Default bar series item. Override with spread for tests. */
9
+ export declare const barSeriesItem: SeriesItemShape;
10
+ /** Default line series item. Override with spread for tests. */
11
+ export declare const lineSeriesItem: SeriesItemShape;
12
+ /** Default scatter series item (for "other than line or bar" tests). */
13
+ export declare const scatterSeriesItem: SeriesItemShape;
14
+ /** Single yAxis used when testing yAxisIndex fallback. */
15
+ export declare const singleYAxis: {
16
+ id: string;
17
+ title: string;
18
+ }[];
19
+ /**
20
+ * Default values for SeriesChart (two rows, one series).
21
+ */
22
+ export declare const defaultSeriesChartValues: SeriesChartValueItem;
23
+ /**
24
+ * Minimal values (single row) for component render tests.
25
+ */
26
+ export declare const minimalSeriesChartValues: SeriesChartValueItem;
27
+ /**
28
+ * Two xAxis, two yAxis, two series (for options multi-axis test).
29
+ */
30
+ export declare const multiAxisSeriesChartValues: SeriesChartValueItem;
31
+ /**
32
+ * Two rows with numeric labels (for tooltipFormatter "row per param" test).
33
+ */
34
+ export declare const twoRowsTooltipValues: SeriesChartValueItem;
35
+ /**
36
+ * Three xAxis, three yAxis (only two series so third yAxis has no related series).
37
+ * Covers grid.top when xAxis.length > 2, grid.right when yAxis.length > 1,
38
+ * xAxis/yAxis offset when index > 1, and relatedSeries undefined for orphan yAxis.
39
+ */
40
+ export declare const threeAxisSeriesChartValues: SeriesChartValueItem;
41
+ /**
42
+ * Build chart values with partial overrides.
43
+ */
44
+ export declare function createSeriesChartValues(overrides?: Partial<SeriesChartValueItem>): SeriesChartValueItem;
45
+ //# sourceMappingURL=values.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/widgets/src/charts/SeriesChart/__tests__/helpers/values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,mDAAmD;AACnD,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,kEAAkE;AAClE,eAAO,MAAM,YAAY,EAAE,oBAAoB,CAAC,QAAQ,CAEvD,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,oBAAoB,CAAC,QAAQ,CAEhF,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,aAAa,EAAE,eAM3B,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,cAAc,EAAE,eAM5B,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,EAAE,eAM/B,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,WAAW;;;GAA6B,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,oBAUtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,oBAOtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,oBAgBxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,oBAMlC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,oBAkBxC,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,GAAE,OAAO,CAAC,oBAAoB,CAAM,GAC5C,oBAAoB,CAEtB"}
@@ -0,0 +1,2 @@
1
+ export declare const SERIES_KEY_COMPONENT = "M4LSeriesChart";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/SeriesChart/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ const E = "M4LSeriesChart";
2
+ export {
3
+ E as SERIES_KEY_COMPONENT
4
+ };
@@ -0,0 +1,7 @@
1
+ import { Theme } from '@mui/material/styles';
2
+ import { SeriesChartProps } from '../types';
3
+ /**
4
+ * Builds ECharts option config for the series chart from data and theme.
5
+ */
6
+ export declare function generateOptions(values: SeriesChartProps['values'], theme: Theme, scrollable: boolean): any;
7
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/SeriesChart/helpers/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,GAAG,GAAG,CA4O1G"}
@@ -0,0 +1,229 @@
1
+ import { getColorHexFromVar as i, getColorHexFromToken as n } from "../../../tools/color.js";
2
+ import * as f from "echarts";
3
+ import { remapTooltipFormatter as y } from "./tooltipFormatter.js";
4
+ function m(o, r, d) {
5
+ const e = {
6
+ textPrimaryColor: i(r.vars?.palette?.text?.primary),
7
+ textDisabledColor: i(r.vars?.palette?.text?.disabled),
8
+ themeBackgroundColor: i(r.vars?.palette?.background?.default),
9
+ contrastTextColor: i(r.vars?.palette?.text?.contrastText),
10
+ backgroundNeutralColor: i(r.vars?.palette?.background?.neutral),
11
+ contrastDefaultColor: i(r.vars?.palette?.background?.contrastDefault)
12
+ }, c = g(o.values[0]);
13
+ return {
14
+ baseOption: {
15
+ /**
16
+ * Tooltip configuration.
17
+ */
18
+ tooltip: {
19
+ trigger: "axis",
20
+ backgroundColor: "transparent",
21
+ borderColor: "transparent",
22
+ shadowColor: "transparent",
23
+ borderWidth: 0,
24
+ textStyle: {
25
+ color: e.contrastTextColor,
26
+ fontFamily: "Inter",
27
+ fontSize: 13,
28
+ fontWeight: 700
29
+ },
30
+ formatter: (t) => y(t, o, e),
31
+ axisPointer: {
32
+ type: "cross",
33
+ lineStyle: {
34
+ color: e.textDisabledColor,
35
+ type: "solid"
36
+ },
37
+ crossStyle: {
38
+ color: e.textDisabledColor,
39
+ type: "solid"
40
+ },
41
+ label: {
42
+ backgroundColor: e.backgroundNeutralColor,
43
+ color: e.textPrimaryColor,
44
+ fontFamily: "Inter",
45
+ fontSize: 13,
46
+ fontWeight: 400,
47
+ borderRadius: 6
48
+ }
49
+ }
50
+ },
51
+ /**
52
+ * Data zoom configuration.
53
+ */
54
+ dataZoom: d ? [
55
+ {
56
+ type: "slider",
57
+ show: !0,
58
+ realtime: !0,
59
+ start: 0,
60
+ end: Math.max(1, Math.round(300 / o.values.length)),
61
+ height: 15,
62
+ bottom: 5
63
+ },
64
+ {
65
+ type: "inside",
66
+ realtime: !0,
67
+ start: 30,
68
+ end: 70,
69
+ xAxisIndex: [0, 1]
70
+ }
71
+ ] : [{ show: !1 }],
72
+ /**
73
+ * Legend configuration.
74
+ */
75
+ legend: {
76
+ show: !0,
77
+ type: "scroll",
78
+ top: "0%",
79
+ left: "center",
80
+ orient: "horizontal",
81
+ itemGap: 30,
82
+ itemWidth: 11,
83
+ itemHeight: 11,
84
+ textStyle: {
85
+ fontSize: 12,
86
+ color: e.textPrimaryColor
87
+ },
88
+ data: o.series.map((t) => t.title)
89
+ },
90
+ /**
91
+ * X-axis configuration.
92
+ */
93
+ xAxis: o.xAxis.map((t, a) => ({
94
+ type: "category",
95
+ data: o.values.map((l) => l[t.field]),
96
+ offset: a > 1 ? (a - 1) * 20 : 0,
97
+ axisLine: { show: !1 },
98
+ axisTick: { show: !1 },
99
+ axisLabel: {
100
+ interval: 0,
101
+ lineHeight: 15,
102
+ fontFamily: "Inter",
103
+ fontSize: 11,
104
+ fontWeight: 500,
105
+ hideOverlap: !0,
106
+ color: e.textPrimaryColor
107
+ }
108
+ })),
109
+ /**
110
+ * Y-axis configuration.
111
+ */
112
+ yAxis: o.yAxis.map((t, a) => {
113
+ const l = o.series.find((s) => s.yAxisId === t.id), p = c[l?.field || ""] || "", x = n(l?.pallet_color || "", "contained", "backgroundColorTone");
114
+ return {
115
+ type: "value",
116
+ name: t.title + " (" + p + ")",
117
+ position: a === 0 ? "left" : "right",
118
+ offset: a > 1 ? (a - 1) * 70 : 0,
119
+ alignTicks: !0,
120
+ splitLine: {
121
+ show: !0,
122
+ lineStyle: {
123
+ type: "dashed",
124
+ color: e.textDisabledColor,
125
+ opacity: 0.3,
126
+ width: 1,
127
+ dashOffset: 0
128
+ }
129
+ },
130
+ nameTextStyle: {
131
+ color: e.textDisabledColor,
132
+ fontFamily: "Inter",
133
+ fontSize: "12px",
134
+ fontWeight: 500
135
+ },
136
+ nameRotate: 90,
137
+ nameLocation: "middle",
138
+ axisLabel: {
139
+ color: e.textPrimaryColor,
140
+ fontFamily: "Jura",
141
+ fontSize: "13px",
142
+ fontWeight: 700,
143
+ overflow: "break",
144
+ ellipsis: "...",
145
+ width: 30,
146
+ formatter: (s) => `${s}`
147
+ },
148
+ axisLine: {
149
+ show: !0,
150
+ lineStyle: { color: x, width: 0.5, opacity: 1 }
151
+ }
152
+ };
153
+ }),
154
+ /**
155
+ * Grid configuration.
156
+ */
157
+ grid: {
158
+ left: "8%",
159
+ bottom: "10%",
160
+ right: o.yAxis.length > 1 ? (o.yAxis.length - 1) * 70 : "8%",
161
+ top: o.xAxis.length > 2 ? (o.xAxis.length - 1) * 35 : "15%",
162
+ containLabel: !1
163
+ },
164
+ /**
165
+ * Series configuration.
166
+ */
167
+ series: o.series.map((t) => {
168
+ const a = o.yAxis.findIndex((l) => l.id === t.yAxisId);
169
+ return {
170
+ name: t.title,
171
+ type: t.type,
172
+ yAxisIndex: a !== -1 ? a : 0,
173
+ areaStyle: {
174
+ color: new f.graphic.LinearGradient(0, 0, 0, 1, [
175
+ {
176
+ offset: 0,
177
+ color: n(t?.pallet_color || "", "contained", "backgroundColor")
178
+ },
179
+ {
180
+ offset: 0.8,
181
+ color: "transparent"
182
+ }
183
+ ])
184
+ },
185
+ data: o.values.map((l) => l[t.field].r),
186
+ ...t.type === "line" && {
187
+ symbol: "circle",
188
+ symbolSize: 10,
189
+ itemStyle: {
190
+ borderWidth: 2,
191
+ borderColor: n(t.pallet_color, "contained", "backgroundColorTone"),
192
+ color: e.themeBackgroundColor
193
+ },
194
+ lineStyle: {
195
+ width: 2,
196
+ color: n(t.pallet_color, "contained", "backgroundColorTone")
197
+ },
198
+ emphasis: {
199
+ itemStyle: {
200
+ color: n(t.pallet_color, "contained", "backgroundColorTone")
201
+ }
202
+ }
203
+ },
204
+ ...t.type === "bar" && {
205
+ barGap: "20%",
206
+ barCategoryGap: "35%",
207
+ barMaxWidth: 40,
208
+ itemStyle: {
209
+ borderRadius: [6, 6, 0, 0]
210
+ },
211
+ color: n(t.pallet_color, "contained", "backgroundColorTone")
212
+ }
213
+ };
214
+ })
215
+ /**
216
+ * Next configuration.
217
+ */
218
+ }
219
+ };
220
+ }
221
+ function g(o) {
222
+ return Object.keys(o).reduce((r, d) => {
223
+ const e = o[d];
224
+ return e && typeof e == "object" && "v" in e && (r[d] = e.v.replace(/[0-9.\s]+/g, "")), r;
225
+ }, {});
226
+ }
227
+ export {
228
+ m as generateOptions
229
+ };
@@ -0,0 +1,6 @@
1
+ import { SeriesChartProps } from '../types';
2
+ /**
3
+ * Formats ECharts tooltip params to HTML for SeriesChart.
4
+ */
5
+ export declare function remapTooltipFormatter(params: any[], values: SeriesChartProps['values'], themeColors: any): string;
6
+ //# sourceMappingURL=tooltipFormatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltipFormatter.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/SeriesChart/helpers/tooltipFormatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,GAAG,UA+FxG"}
@@ -0,0 +1,85 @@
1
+ function d(a, s, t) {
2
+ let r = `
3
+ <div style="
4
+ display: flex;
5
+ padding: var(--theme-vars-size-baseSpacings-sp3, 12px);
6
+ flex-direction: column;
7
+ justify-content: center;
8
+ align-items: center;
9
+ border-radius: var(--size-borderRadius-r3, 12px);
10
+ background: color-mix(in srgb, ${t.contrastDefaultColor} 90%, transparent);
11
+ box-shadow: 0 4px 8px -5px var(--customShadowsColors-sh3, rgba(95, 108, 125, 0.16)), 0 8px 30px -1px var(--customShadowsColors-sh2, rgba(109, 124, 146, 0.12));
12
+ gap: var(--theme-vars-size-baseSpacings-sp2, 8px);
13
+ ">
14
+ <h3 style="
15
+ color: ${t.contrastTextColor};
16
+ font-family: var(--typographyInter-font-family, Inter);
17
+ font-size: var(--typoghaphy-size-Inter-paragraph, 13px);
18
+ font-style: normal;
19
+ font-weight: 700;
20
+ line-height: normal;
21
+ letter-spacing: var(--typographyInter-letter-spacing-dens, 0.8px);
22
+ align-self: stretch;
23
+ ">
24
+ ${a[0].name}
25
+ </h3>
26
+ <div style="
27
+ display: flex;
28
+ flex-direction: column;
29
+ justify-content: center;
30
+ align-items: flex-start;
31
+ gap: var(--theme-vars-size-baseSpacings-Sp0, 0);
32
+ align-self: stretch;
33
+ ">
34
+ `;
35
+ return a.forEach((e) => {
36
+ const o = s.values[e.dataIndex][s.series[e.seriesIndex].field].v, i = e.color, n = e.borderColor, l = `
37
+ <div style="
38
+ width: 11px;
39
+ height: 0;
40
+ stroke-width: 3px;
41
+ stroke: ${n};
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ ">
46
+ <svg width="14" height="3" viewBox="0 0 14 3" fill="none" xmlns="http://www.w3.org/2000/svg">
47
+ <path d="M1.5 1.5H12.5" stroke="${n}" stroke-width="3" stroke-linecap="round"/>
48
+ </svg>
49
+ </div>`, p = `
50
+ <span style="
51
+ width: 11px;
52
+ height: 11px;
53
+ border-radius: 5px;
54
+ background: ${i};
55
+ ">
56
+ </span>`, c = e.seriesType === "line" ? l : p;
57
+ r += `
58
+ <div style="
59
+ display: flex;
60
+ height: var(--theme-vars-size-device-size-action, 24px);
61
+ padding: 4px 8px;
62
+ align-items: center;
63
+ gap: 8px;
64
+ border-radius: 6px;
65
+ ">
66
+ ${c}
67
+ <span style="
68
+ color: ${t.contrastTextColor};
69
+ font-family: var(--typographyInter-font-family, Inter);
70
+ font-size: var(--typoghaphy-size-Inter-body, 11px);
71
+ font-style: normal;
72
+ font-weight: 500;
73
+ line-height: normal;
74
+ letter-spacing: var(--typographyInter-letter-spacing-normal, 0.5px);
75
+ "><b>${o}</b></span>
76
+ </div>
77
+ `;
78
+ }), r += `
79
+ </div>
80
+ </div>
81
+ `, r;
82
+ }
83
+ export {
84
+ d as remapTooltipFormatter
85
+ };
@@ -0,0 +1,8 @@
1
+ import { default as ReactECharts } from 'echarts-for-react';
2
+ /**
3
+ * Custom hook to resize the chart when the container size changes.
4
+ * @param chartRef - Reference to the chart element
5
+ * @returns Reference to the chart parent element
6
+ */
7
+ export declare function useChartResize(chartRef: React.RefObject<ReactECharts | null>): (node: HTMLDivElement | null) => void;
8
+ //# sourceMappingURL=useChartResize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChartResize.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/SeriesChart/hooks/useChartResize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAGlD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,yCAoB5E"}
@@ -0,0 +1,17 @@
1
+ import { useEffect as s } from "react";
2
+ import { useStateRef as a, useSizeContainer as o } from "@m4l/components";
3
+ function l(e) {
4
+ const [t, n] = a(null), r = o(t, {
5
+ throttleTime: 200,
6
+ excludePadding: !1,
7
+ leading: !0,
8
+ trailing: !0
9
+ });
10
+ return s(() => {
11
+ const i = e.current?.getEchartsInstance();
12
+ window.requestAnimationFrame(() => i?.resize());
13
+ }, [r, e]), n;
14
+ }
15
+ export {
16
+ l as useChartResize
17
+ };
@@ -0,0 +1,3 @@
1
+ export { SeriesChart } from './SeriesChart';
2
+ export type { SeriesChartProps, SeriesChartValueItem, } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/widgets/src/charts/SeriesChart/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Slot names for the series chart component.
3
+ * Must match the keys in SeriesChart.styles.ts.
4
+ */
5
+ export declare enum SeriesChartSlots {
6
+ seriesRoot = "seriesRoot",
7
+ seriesParent = "seriesParent",
8
+ chartContainer = "chartContainer",
9
+ legendContainer = "legendContainer",
10
+ legendItem = "legendItem",
11
+ legendItemColor = "legendItemColor",
12
+ legendItemTextContainer = "legendItemTextContainer",
13
+ legendItemTextSubContainer = "legendItemTextSubContainer",
14
+ legendItemName = "legendItemName",
15
+ legendItemValueBadge = "legendItemValueBadge",
16
+ legendItemCategory = "legendItemCategory"
17
+ }
18
+ //# sourceMappingURL=SeriesChartEnum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeriesChartEnum.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/SeriesChart/slots/SeriesChartEnum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,oBAAY,gBAAgB;IAC1B,UAAU,eAAe;IACzB,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,UAAU,eAAe;IACzB,eAAe,oBAAoB;IACnC,uBAAuB,4BAA4B;IACnD,0BAA0B,+BAA+B;IACzD,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,kBAAkB,uBAAuB;CAC1C"}
@@ -0,0 +1,4 @@
1
+ var n = /* @__PURE__ */ ((e) => (e.seriesRoot = "seriesRoot", e.seriesParent = "seriesParent", e.chartContainer = "chartContainer", e.legendContainer = "legendContainer", e.legendItem = "legendItem", e.legendItemColor = "legendItemColor", e.legendItemTextContainer = "legendItemTextContainer", e.legendItemTextSubContainer = "legendItemTextSubContainer", e.legendItemName = "legendItemName", e.legendItemValueBadge = "legendItemValueBadge", e.legendItemCategory = "legendItemCategory", e))(n || {});
2
+ export {
3
+ n as SeriesChartSlots
4
+ };
@@ -0,0 +1,28 @@
1
+ export declare const SeriesChartRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
2
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
3
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
4
+ export declare const SeriesChartParentStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
5
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
6
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
7
+ export declare const ChartContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
8
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
9
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
10
+ export declare const LegendContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
11
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
12
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
13
+ export declare const LegendItemStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
14
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
15
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
16
+ export declare const LegendItemColorStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
17
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
18
+ }, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
19
+ export declare const LegendItemTextContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
20
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
21
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
22
+ export declare const LegendItemTextSubContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
23
+ ownerState?: (Partial<import('../types').SeriesChartOwnerState> & Record<string, unknown>) | undefined;
24
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
25
+ export declare const LegendItemNameStyled: any;
26
+ export declare const LegendItemValueBadgeStyled: any;
27
+ export declare const LegendItemCategoryStyled: any;
28
+ //# sourceMappingURL=SeriesChartSlots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeriesChartSlots.d.ts","sourceRoot":"","sources":["../../../../../../../packages/widgets/src/charts/SeriesChart/slots/SeriesChartSlots.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB;;6NAGF,CAAC;AAEjC,eAAO,MAAM,uBAAuB;;6NAGF,CAAC;AAEnC,eAAO,MAAM,oBAAoB;;6NAGG,CAAC;AAErC,eAAO,MAAM,qBAAqB;;6NAGG,CAAC;AAEtC,eAAO,MAAM,gBAAgB;;6NAGG,CAAC;AAEjC,eAAO,MAAM,qBAAqB;;yGAIG,CAAC;AAEtC,eAAO,MAAM,6BAA6B;;6NAGG,CAAC;AAE9C,eAAO,MAAM,gCAAgC;;6NAGG,CAAC;AAEjD,eAAO,MAAM,oBAAoB,EAAE,GAGC,CAAC;AAErC,eAAO,MAAM,0BAA0B,EAAE,GAGC,CAAC;AAE3C,eAAO,MAAM,wBAAwB,EAAE,GAGC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { styled as e } from "@mui/material/styles";
2
+ import { Typography as r } from "@mui/material";
3
+ import { seriesChartStyles as t } from "../SeriesChart.styles.js";
4
+ import { SeriesChartSlots as o } from "./SeriesChartEnum.js";
5
+ import { SERIES_KEY_COMPONENT as n } from "../constants.js";
6
+ const g = e("div", {
7
+ name: n,
8
+ slot: o.seriesRoot
9
+ })(t.seriesRoot);
10
+ e("div", {
11
+ name: n,
12
+ slot: o.seriesParent
13
+ })(t.seriesParent);
14
+ const C = e("div", {
15
+ name: n,
16
+ slot: o.chartContainer
17
+ })(t.chartContainer);
18
+ e("div", {
19
+ name: n,
20
+ slot: o.legendContainer
21
+ })(t.legendContainer);
22
+ e("div", {
23
+ name: n,
24
+ slot: o.legendItem
25
+ })(t.legendItem);
26
+ e("div", {
27
+ name: n,
28
+ slot: o.legendItemColor,
29
+ shouldForwardProp: (a) => a !== "ownerState"
30
+ })(t.legendItemColor);
31
+ e("div", {
32
+ name: n,
33
+ slot: o.legendItemTextContainer
34
+ })(t.legendItemTextContainer);
35
+ e("div", {
36
+ name: n,
37
+ slot: o.legendItemTextSubContainer
38
+ })(t.legendItemTextSubContainer);
39
+ e(r, {
40
+ name: n,
41
+ slot: o.legendItemName
42
+ })(t.legendItemName);
43
+ e(r, {
44
+ name: n,
45
+ slot: o.legendItemValueBadge
46
+ })(t.legendItemValueBadge);
47
+ e(r, {
48
+ name: n,
49
+ slot: o.legendItemCategory
50
+ })(t.legendItemCategory);
51
+ export {
52
+ C as ChartContainerStyled,
53
+ g as SeriesChartRootStyled
54
+ };