@tekkare/romulus 0.1.8 → 0.1.10

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 (33) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/assets/styles/components.css +1 -1
  3. package/dist/runtime/assets/styles/tokens.css +1 -1
  4. package/dist/runtime/components/ActionBar.vue +1 -1
  5. package/dist/runtime/components/AdvancedSearch.vue +29 -10
  6. package/dist/runtime/components/BarChart.vue +45 -0
  7. package/dist/runtime/components/Breadcrumb.vue +1 -1
  8. package/dist/runtime/components/Button.vue +1 -1
  9. package/dist/runtime/components/Card.vue +1 -1
  10. package/dist/runtime/components/Chart.vue +75 -0
  11. package/dist/runtime/components/ChartCard.vue +5 -1
  12. package/dist/runtime/components/DonutChart.vue +27 -0
  13. package/dist/runtime/components/Drawer.vue +1 -1
  14. package/dist/runtime/components/FilterCheckbox.vue +1 -1
  15. package/dist/runtime/components/FilterComplex.vue +3 -3
  16. package/dist/runtime/components/FilterDropdown.vue +26 -1
  17. package/dist/runtime/components/Input.vue +1 -1
  18. package/dist/runtime/components/LineChart.vue +42 -0
  19. package/dist/runtime/components/NavLink.vue +1 -1
  20. package/dist/runtime/components/Pill.vue +1 -1
  21. package/dist/runtime/components/PillTabs.vue +1 -1
  22. package/dist/runtime/components/SearchBar.vue +103 -19
  23. package/dist/runtime/components/Sidebar.vue +1 -1
  24. package/dist/runtime/components/SparklineChart.vue +33 -0
  25. package/dist/runtime/components/Tabs.vue +5 -5
  26. package/dist/runtime/components/ToolbarFilter.vue +1 -1
  27. package/dist/runtime/composables/useChartTheme.d.ts +7 -0
  28. package/dist/runtime/composables/useChartTheme.js +27 -0
  29. package/dist/runtime/composables/useTheme.d.ts +17 -0
  30. package/dist/runtime/composables/useTheme.js +98 -0
  31. package/dist/runtime/utils/chart.d.ts +475 -0
  32. package/dist/runtime/utils/chart.js +209 -0
  33. package/package.json +3 -2
@@ -0,0 +1,475 @@
1
+ /**
2
+ * Theme et constructeurs d'option ECharts.
3
+ *
4
+ * Porte depuis le design system : palettes et resolveur de `reference.html`
5
+ * (`window.OIP_PALETTES` / `CHART_THEME`), constructeurs d'option de
6
+ * `references/charts.md`. ECharts v5 est la librairie standard de tous les
7
+ * dashboards Tekkare ; ne pas en introduire une seconde.
8
+ *
9
+ * Les couleurs sont ici en litteral et non en `var(--...)` : ECharts peint
10
+ * dans un canvas SVG qu'il genere lui-meme, il ne resout pas les variables
11
+ * CSS. C'est la seule raison acceptee d'ecrire un hex hors tokens.
12
+ */
13
+ export interface RmPalette {
14
+ /** Palette categorielle, 6 couleurs maximum sans ordre. Au-dela, passer en sequentiel ou regrouper en "Autres". */
15
+ cat: string[];
16
+ primary: string;
17
+ accent: string;
18
+ neutral: string;
19
+ /** Palette sequentielle, du plus clair au plus fonce : heatmaps, choroplethes. */
20
+ seq: string[];
21
+ }
22
+ /**
23
+ * Les quatre palettes du design system. `cvdSafe` est la palette Okabe-Ito,
24
+ * validee pour les trois principaux types de dyschromatopsie ; le violet OIP
25
+ * y devient le bleu #0072B2 qui joue le role de couleur primaire.
26
+ */
27
+ export declare const RM_PALETTES: Record<string, RmPalette>;
28
+ /** Palettes par verticale produit, cf. references/charts.md. */
29
+ export declare const RM_PRODUCT_PALETTES: Record<string, string[]>;
30
+ /** Palette divergente : negatif vers neutre vers positif. */
31
+ export declare const RM_DIVERGING: string[];
32
+ export interface RmChartTheme {
33
+ night: boolean;
34
+ textColor: string;
35
+ mutedColor: string;
36
+ dimmedColor: string;
37
+ splitLine: string;
38
+ axisLine: string;
39
+ tooltipBg: string;
40
+ tooltipText: string;
41
+ tooltipBorder: string;
42
+ backgroundColor: string;
43
+ }
44
+ export declare const rmChartTheme: (night: boolean) => RmChartTheme;
45
+ /**
46
+ * Resout la palette active. En mode nuit, la variante *Dark prend le relais
47
+ * quand elle existe : les teintes du mode jour ne contrastent pas assez sur
48
+ * #0E0E14 et une serie devient illisible, ce qui est un bug d'accessibilite
49
+ * et pas un choix esthetique.
50
+ */
51
+ export declare function rmPalette(name?: string, night?: boolean): RmPalette;
52
+ /** Hauteurs normalisees du design system. */
53
+ export declare const RM_CHART_HEIGHTS: {
54
+ readonly sparkline: 48;
55
+ readonly kpi: 80;
56
+ readonly compact: 200;
57
+ readonly standard: 260;
58
+ readonly large: 320;
59
+ readonly full: 360;
60
+ };
61
+ /**
62
+ * Socle commun a tous les graphes. `decal` active le double encodage par
63
+ * motifs : sur un graphe multi-series, la couleur seule ne suffit pas, c'est
64
+ * une regle du design system et non une option.
65
+ */
66
+ export declare function rmBaseOption(theme: RmChartTheme, decal?: boolean): {
67
+ backgroundColor: string;
68
+ animation: boolean;
69
+ aria: {
70
+ enabled: boolean;
71
+ decal: {
72
+ show: boolean;
73
+ };
74
+ };
75
+ textStyle: {
76
+ fontFamily: string;
77
+ };
78
+ grid: {
79
+ left: number;
80
+ right: number;
81
+ top: number;
82
+ bottom: number;
83
+ containLabel: boolean;
84
+ };
85
+ tooltip: {
86
+ trigger: string;
87
+ backgroundColor: string;
88
+ textStyle: {
89
+ color: string;
90
+ fontFamily: string;
91
+ fontSize: number;
92
+ };
93
+ borderColor: string;
94
+ borderWidth: number;
95
+ };
96
+ };
97
+ export interface RmSeriesInput {
98
+ name?: string;
99
+ data: (number | null)[];
100
+ color?: string;
101
+ /** Cle d'empilement : deux series avec la meme cle s'empilent. */
102
+ stack?: string;
103
+ }
104
+ /** Bar chart vertical, une ou plusieurs series, empilable. */
105
+ export declare function rmBarVerticalOption(categories: (string | number)[], series: RmSeriesInput[], theme: RmChartTheme, palette: string[], decal?: boolean): {
106
+ legend: {
107
+ top: number;
108
+ textStyle: {
109
+ color: string;
110
+ fontSize: number;
111
+ fontFamily: string;
112
+ };
113
+ } | undefined;
114
+ xAxis: {
115
+ splitLine: {
116
+ show: boolean;
117
+ };
118
+ axisLabel: {
119
+ fontSize: number;
120
+ color: string;
121
+ fontFamily: string;
122
+ };
123
+ axisLine: {
124
+ lineStyle: {
125
+ color: string;
126
+ };
127
+ };
128
+ type: string;
129
+ data: (string | number)[];
130
+ };
131
+ yAxis: {
132
+ axisLabel: {
133
+ fontSize: number;
134
+ color: string;
135
+ fontFamily: string;
136
+ };
137
+ axisLine: {
138
+ lineStyle: {
139
+ color: string;
140
+ };
141
+ };
142
+ splitLine: {
143
+ lineStyle: {
144
+ color: string;
145
+ };
146
+ };
147
+ type: string;
148
+ };
149
+ series: {
150
+ type: string;
151
+ name: string | undefined;
152
+ stack: string | undefined;
153
+ data: (number | null)[];
154
+ itemStyle: {
155
+ color: string;
156
+ borderRadius: number[];
157
+ };
158
+ }[];
159
+ backgroundColor: string;
160
+ animation: boolean;
161
+ aria: {
162
+ enabled: boolean;
163
+ decal: {
164
+ show: boolean;
165
+ };
166
+ };
167
+ textStyle: {
168
+ fontFamily: string;
169
+ };
170
+ grid: {
171
+ left: number;
172
+ right: number;
173
+ top: number;
174
+ bottom: number;
175
+ containLabel: boolean;
176
+ };
177
+ tooltip: {
178
+ trigger: string;
179
+ backgroundColor: string;
180
+ textStyle: {
181
+ color: string;
182
+ fontFamily: string;
183
+ fontSize: number;
184
+ };
185
+ borderColor: string;
186
+ borderWidth: number;
187
+ };
188
+ };
189
+ /** Bar chart horizontal, avec valeur affichee en bout de barre. */
190
+ export declare function rmBarHorizontalOption(labels: string[], values: (number | null)[], theme: RmChartTheme, palette: string[], decal?: boolean, formatter?: (value: number) => string): {
191
+ grid: {
192
+ left: number;
193
+ right: number;
194
+ top: number;
195
+ bottom: number;
196
+ containLabel: boolean;
197
+ };
198
+ xAxis: {
199
+ axisLabel: {
200
+ fontSize: number;
201
+ color: string;
202
+ fontFamily: string;
203
+ };
204
+ axisLine: {
205
+ lineStyle: {
206
+ color: string;
207
+ };
208
+ };
209
+ splitLine: {
210
+ lineStyle: {
211
+ color: string;
212
+ };
213
+ };
214
+ type: string;
215
+ };
216
+ yAxis: {
217
+ splitLine: {
218
+ show: boolean;
219
+ };
220
+ axisLabel: {
221
+ fontSize: number;
222
+ color: string;
223
+ fontFamily: string;
224
+ };
225
+ axisLine: {
226
+ lineStyle: {
227
+ color: string;
228
+ };
229
+ };
230
+ type: string;
231
+ data: string[];
232
+ };
233
+ series: {
234
+ type: string;
235
+ data: (number | null)[];
236
+ itemStyle: {
237
+ color: (params: {
238
+ dataIndex: number;
239
+ }) => string;
240
+ borderRadius: number[];
241
+ };
242
+ label: {
243
+ show: boolean;
244
+ position: string;
245
+ fontSize: number;
246
+ color: string;
247
+ fontFamily: string;
248
+ formatter: ((p: {
249
+ value: number;
250
+ }) => string) | undefined;
251
+ };
252
+ }[];
253
+ backgroundColor: string;
254
+ animation: boolean;
255
+ aria: {
256
+ enabled: boolean;
257
+ decal: {
258
+ show: boolean;
259
+ };
260
+ };
261
+ textStyle: {
262
+ fontFamily: string;
263
+ };
264
+ tooltip: {
265
+ trigger: string;
266
+ backgroundColor: string;
267
+ textStyle: {
268
+ color: string;
269
+ fontFamily: string;
270
+ fontSize: number;
271
+ };
272
+ borderColor: string;
273
+ borderWidth: number;
274
+ };
275
+ };
276
+ /** Line ou area chart. `step` produit la marche d'escalier des series de prix. */
277
+ export declare function rmLineOption(categories: (string | number)[], series: RmSeriesInput[], theme: RmChartTheme, palette: string[], options?: {
278
+ area?: boolean;
279
+ step?: boolean;
280
+ smooth?: boolean;
281
+ decal?: boolean;
282
+ }): {
283
+ legend: {
284
+ top: number;
285
+ textStyle: {
286
+ color: string;
287
+ fontSize: number;
288
+ fontFamily: string;
289
+ };
290
+ } | undefined;
291
+ xAxis: {
292
+ splitLine: {
293
+ show: boolean;
294
+ };
295
+ boundaryGap: boolean;
296
+ axisLabel: {
297
+ fontSize: number;
298
+ color: string;
299
+ fontFamily: string;
300
+ };
301
+ axisLine: {
302
+ lineStyle: {
303
+ color: string;
304
+ };
305
+ };
306
+ type: string;
307
+ data: (string | number)[];
308
+ };
309
+ yAxis: {
310
+ axisLabel: {
311
+ fontSize: number;
312
+ color: string;
313
+ fontFamily: string;
314
+ };
315
+ axisLine: {
316
+ lineStyle: {
317
+ color: string;
318
+ };
319
+ };
320
+ splitLine: {
321
+ lineStyle: {
322
+ color: string;
323
+ };
324
+ };
325
+ type: string;
326
+ };
327
+ series: {
328
+ type: string;
329
+ name: string | undefined;
330
+ data: (number | null)[];
331
+ smooth: boolean;
332
+ step: string | undefined;
333
+ symbol: string;
334
+ symbolSize: number;
335
+ lineStyle: {
336
+ color: string;
337
+ width: number;
338
+ };
339
+ itemStyle: {
340
+ color: string;
341
+ };
342
+ areaStyle: {
343
+ color: {
344
+ type: string;
345
+ x: number;
346
+ y: number;
347
+ x2: number;
348
+ y2: number;
349
+ colorStops: {
350
+ offset: number;
351
+ color: string;
352
+ }[];
353
+ };
354
+ } | undefined;
355
+ }[];
356
+ backgroundColor: string;
357
+ animation: boolean;
358
+ aria: {
359
+ enabled: boolean;
360
+ decal: {
361
+ show: boolean;
362
+ };
363
+ };
364
+ textStyle: {
365
+ fontFamily: string;
366
+ };
367
+ grid: {
368
+ left: number;
369
+ right: number;
370
+ top: number;
371
+ bottom: number;
372
+ containLabel: boolean;
373
+ };
374
+ tooltip: {
375
+ trigger: string;
376
+ backgroundColor: string;
377
+ textStyle: {
378
+ color: string;
379
+ fontFamily: string;
380
+ fontSize: number;
381
+ };
382
+ borderColor: string;
383
+ borderWidth: number;
384
+ };
385
+ };
386
+ /** Donut. Au-dela de 6 parts, regrouper le reste en "Autres". */
387
+ export declare function rmDonutOption(data: {
388
+ name: string;
389
+ value: number;
390
+ }[], theme: RmChartTheme, palette: string[], decal?: boolean): {
391
+ grid: undefined;
392
+ tooltip: {
393
+ trigger: string;
394
+ backgroundColor: string;
395
+ textStyle: {
396
+ color: string;
397
+ fontFamily: string;
398
+ fontSize: number;
399
+ };
400
+ borderColor: string;
401
+ borderWidth: number;
402
+ };
403
+ legend: {
404
+ bottom: number;
405
+ textStyle: {
406
+ color: string;
407
+ fontSize: number;
408
+ fontFamily: string;
409
+ };
410
+ };
411
+ series: {
412
+ type: string;
413
+ radius: string[];
414
+ center: string[];
415
+ data: {
416
+ value: number;
417
+ name: string;
418
+ itemStyle: {
419
+ color: string;
420
+ };
421
+ }[];
422
+ label: {
423
+ fontSize: number;
424
+ color: string;
425
+ fontFamily: string;
426
+ };
427
+ }[];
428
+ backgroundColor: string;
429
+ animation: boolean;
430
+ aria: {
431
+ enabled: boolean;
432
+ decal: {
433
+ show: boolean;
434
+ };
435
+ };
436
+ textStyle: {
437
+ fontFamily: string;
438
+ };
439
+ };
440
+ /** Sparkline : pas d'axes, pas de tooltip, destinee a une cellule ou une tuile KPI. */
441
+ export declare function rmSparklineOption(values: (number | null)[], color: string): {
442
+ backgroundColor: string;
443
+ animation: boolean;
444
+ grid: {
445
+ left: number;
446
+ right: number;
447
+ top: number;
448
+ bottom: number;
449
+ };
450
+ xAxis: {
451
+ type: string;
452
+ show: boolean;
453
+ data: number[];
454
+ };
455
+ yAxis: {
456
+ type: string;
457
+ show: boolean;
458
+ };
459
+ tooltip: {
460
+ show: boolean;
461
+ };
462
+ series: {
463
+ type: string;
464
+ data: (number | null)[];
465
+ smooth: boolean;
466
+ symbol: string;
467
+ lineStyle: {
468
+ color: string;
469
+ width: number;
470
+ };
471
+ areaStyle: {
472
+ color: string;
473
+ };
474
+ }[];
475
+ };
@@ -0,0 +1,209 @@
1
+ export const RM_PALETTES = {
2
+ default: {
3
+ cat: ["#2100AD", "#00D4A8", "#F59E0B", "#4164EE", "#EC4899", "#6B3FFF"],
4
+ primary: "#2100AD",
5
+ accent: "#6B3FFF",
6
+ neutral: "#D6CCFF",
7
+ seq: ["#EEF1FE", "#D6CCFF", "#B485FF", "#8B5CF6", "#6B3FFF", "#2100AD"]
8
+ },
9
+ defaultDark: {
10
+ cat: ["#9B7CFF", "#3DD9B9", "#FBBF24", "#7AA0FF", "#F472B6", "#B485FF"],
11
+ primary: "#9B7CFF",
12
+ accent: "#B485FF",
13
+ neutral: "#4A3F70",
14
+ seq: ["#1A1A24", "#2D2A42", "#4A3F70", "#7C5FE6", "#9B7CFF", "#D6CCFF"]
15
+ },
16
+ cvdSafe: {
17
+ cat: ["#0072B2", "#E69F00", "#009E73", "#CC79A7", "#56B4E9", "#F0E442"],
18
+ primary: "#0072B2",
19
+ accent: "#E69F00",
20
+ neutral: "#A3C9E2",
21
+ seq: ["#F0F7FB", "#D5E5F0", "#A3C9E2", "#56B4E9", "#0072B2", "#003E5C"]
22
+ },
23
+ cvdSafeDark: {
24
+ cat: ["#4DA8E5", "#FFB84D", "#3DD9A8", "#E5A0C8", "#7DD3F5", "#F5E76A"],
25
+ primary: "#4DA8E5",
26
+ accent: "#FFB84D",
27
+ neutral: "#3A4A5C",
28
+ seq: ["#1A1A24", "#2A3A4A", "#3A5A78", "#4DA8E5", "#7DD3F5", "#B3E5FC"]
29
+ }
30
+ };
31
+ export const RM_PRODUCT_PALETTES = {
32
+ generic: ["#2100AD", "#4164EE", "#7B9EF5", "#B8C8F8", "#DBDEF0"],
33
+ healthcare: ["#4164EE", "#1A2A8F", "#00D4A8", "#7B9EF5", "#B8C8F8"],
34
+ pharma: ["#F7520E", "#FF8C00", "#FFD600", "#FCA982", "#DBDEF0"],
35
+ discovery: ["#07816F", "#2ECC71", "#56CCF2", "#0DA38D", "#DBDEF0"]
36
+ };
37
+ export const RM_DIVERGING = ["#E53535", "#FCA5A5", "#F9F9FA", "#86EFAC", "#16A34A"];
38
+ const THEME_DAY = {
39
+ night: false,
40
+ textColor: "#1E293B",
41
+ mutedColor: "#525670",
42
+ dimmedColor: "#878CA6",
43
+ splitLine: "#F0F1F7",
44
+ axisLine: "#DBDEF0",
45
+ tooltipBg: "#1E293B",
46
+ tooltipText: "#FFFFFF",
47
+ tooltipBorder: "#344159",
48
+ backgroundColor: "transparent"
49
+ };
50
+ const THEME_NIGHT = {
51
+ night: true,
52
+ textColor: "#E5E7F0",
53
+ mutedColor: "#B8BCD0",
54
+ dimmedColor: "#7B8099",
55
+ splitLine: "#2F2F40",
56
+ axisLine: "#3A3A4E",
57
+ tooltipBg: "#232330",
58
+ tooltipText: "#E5E7F0",
59
+ tooltipBorder: "#3A3A4E",
60
+ backgroundColor: "transparent"
61
+ };
62
+ export const rmChartTheme = (night) => night ? THEME_NIGHT : THEME_DAY;
63
+ export function rmPalette(name = "default", night = false) {
64
+ const dark = `${name}Dark`;
65
+ if (night && RM_PALETTES[dark]) return RM_PALETTES[dark];
66
+ return RM_PALETTES[name] ?? RM_PALETTES.default;
67
+ }
68
+ export const RM_CHART_HEIGHTS = {
69
+ sparkline: 48,
70
+ kpi: 80,
71
+ compact: 200,
72
+ standard: 260,
73
+ large: 320,
74
+ full: 360
75
+ };
76
+ const FONT = "Figtree, system-ui, sans-serif";
77
+ export function rmBaseOption(theme, decal = false) {
78
+ return {
79
+ backgroundColor: theme.backgroundColor,
80
+ animation: true,
81
+ aria: { enabled: true, decal: { show: decal } },
82
+ textStyle: { fontFamily: FONT },
83
+ grid: { left: 48, right: 16, top: 24, bottom: 36, containLabel: true },
84
+ tooltip: {
85
+ trigger: "axis",
86
+ backgroundColor: theme.tooltipBg,
87
+ textStyle: { color: theme.tooltipText, fontFamily: FONT, fontSize: 12 },
88
+ borderColor: theme.tooltipBorder,
89
+ borderWidth: 1
90
+ }
91
+ };
92
+ }
93
+ const axisCommon = (theme) => ({
94
+ axisLabel: { fontSize: 11, color: theme.mutedColor, fontFamily: FONT },
95
+ axisLine: { lineStyle: { color: theme.axisLine } },
96
+ splitLine: { lineStyle: { color: theme.splitLine } }
97
+ });
98
+ export function rmBarVerticalOption(categories, series, theme, palette, decal = false) {
99
+ return {
100
+ ...rmBaseOption(theme, decal),
101
+ legend: series.length > 1 ? { top: 0, textStyle: { color: theme.mutedColor, fontSize: 11, fontFamily: FONT } } : void 0,
102
+ xAxis: { type: "category", data: categories, ...axisCommon(theme), splitLine: { show: false } },
103
+ yAxis: { type: "value", ...axisCommon(theme) },
104
+ series: series.map((s, i) => ({
105
+ type: "bar",
106
+ name: s.name,
107
+ stack: s.stack,
108
+ data: s.data,
109
+ itemStyle: { color: s.color ?? palette[i % palette.length], borderRadius: [3, 3, 0, 0] }
110
+ }))
111
+ };
112
+ }
113
+ export function rmBarHorizontalOption(labels, values, theme, palette, decal = false, formatter) {
114
+ return {
115
+ ...rmBaseOption(theme, decal),
116
+ grid: { left: 140, right: 60, top: 16, bottom: 24, containLabel: true },
117
+ xAxis: { type: "value", ...axisCommon(theme) },
118
+ yAxis: { type: "category", data: labels, ...axisCommon(theme), splitLine: { show: false } },
119
+ series: [{
120
+ type: "bar",
121
+ data: values,
122
+ itemStyle: {
123
+ color: (params) => palette[params.dataIndex % palette.length],
124
+ borderRadius: [0, 3, 3, 0]
125
+ },
126
+ label: {
127
+ show: true,
128
+ position: "right",
129
+ fontSize: 11,
130
+ color: theme.mutedColor,
131
+ fontFamily: FONT,
132
+ formatter: formatter ? (p) => formatter(p.value) : void 0
133
+ }
134
+ }]
135
+ };
136
+ }
137
+ export function rmLineOption(categories, series, theme, palette, options = {}) {
138
+ const { area = false, step = false, smooth = true, decal = false } = options;
139
+ return {
140
+ ...rmBaseOption(theme, decal),
141
+ legend: series.length > 1 ? { top: 0, textStyle: { color: theme.mutedColor, fontSize: 11, fontFamily: FONT } } : void 0,
142
+ xAxis: { type: "category", data: categories, ...axisCommon(theme), splitLine: { show: false }, boundaryGap: false },
143
+ yAxis: { type: "value", ...axisCommon(theme) },
144
+ series: series.map((s, i) => {
145
+ const color = s.color ?? palette[i % palette.length];
146
+ return {
147
+ type: "line",
148
+ name: s.name,
149
+ data: s.data,
150
+ smooth: step ? false : smooth,
151
+ step: step ? "end" : void 0,
152
+ symbol: "circle",
153
+ symbolSize: 5,
154
+ lineStyle: { color, width: 2.5 },
155
+ itemStyle: { color },
156
+ areaStyle: area ? {
157
+ color: {
158
+ type: "linear",
159
+ x: 0,
160
+ y: 0,
161
+ x2: 0,
162
+ y2: 1,
163
+ colorStops: [
164
+ { offset: 0, color: `${color}30` },
165
+ { offset: 1, color: `${color}00` }
166
+ ]
167
+ }
168
+ } : void 0
169
+ };
170
+ })
171
+ };
172
+ }
173
+ export function rmDonutOption(data, theme, palette, decal = false) {
174
+ return {
175
+ ...rmBaseOption(theme, decal),
176
+ grid: void 0,
177
+ tooltip: { ...rmBaseOption(theme, decal).tooltip, trigger: "item" },
178
+ legend: { bottom: 0, textStyle: { color: theme.mutedColor, fontSize: 11, fontFamily: FONT } },
179
+ series: [{
180
+ type: "pie",
181
+ radius: ["45%", "70%"],
182
+ center: ["50%", "46%"],
183
+ data: data.map((d, i) => ({
184
+ value: d.value,
185
+ name: d.name,
186
+ itemStyle: { color: palette[i % palette.length] }
187
+ })),
188
+ label: { fontSize: 11, color: theme.mutedColor, fontFamily: FONT }
189
+ }]
190
+ };
191
+ }
192
+ export function rmSparklineOption(values, color) {
193
+ return {
194
+ backgroundColor: "transparent",
195
+ animation: true,
196
+ grid: { left: 0, right: 0, top: 2, bottom: 2 },
197
+ xAxis: { type: "category", show: false, data: values.map((_, i) => i) },
198
+ yAxis: { type: "value", show: false },
199
+ tooltip: { show: false },
200
+ series: [{
201
+ type: "line",
202
+ data: values,
203
+ smooth: true,
204
+ symbol: "none",
205
+ lineStyle: { color, width: 1.5 },
206
+ areaStyle: { color: `${color}20` }
207
+ }]
208
+ };
209
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,7 +27,8 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@nuxt/kit": "^3.16.0",
30
- "@phosphor-icons/vue": "^2.2.1"
30
+ "@phosphor-icons/vue": "^2.2.1",
31
+ "echarts": "^5.6.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@nuxt/module-builder": "^0.8.4",