@flux-ui/statistics 3.0.0-next.67 → 3.0.0-next.68

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 (93) hide show
  1. package/README.md +1 -1
  2. package/dist/component/FluxStatisticsAreaChart.vue.d.ts +11 -4
  3. package/dist/component/FluxStatisticsBarChart.vue.d.ts +11 -4
  4. package/dist/component/FluxStatisticsBase.vue.d.ts +1 -0
  5. package/dist/component/FluxStatisticsBoxPlotChart.vue.d.ts +15 -0
  6. package/dist/component/FluxStatisticsBubbleChart.vue.d.ts +14 -0
  7. package/dist/component/FluxStatisticsCandlestickChart.vue.d.ts +15 -0
  8. package/dist/component/FluxStatisticsChart.vue.d.ts +7 -5
  9. package/dist/component/FluxStatisticsChartPane.vue.d.ts +1 -0
  10. package/dist/component/FluxStatisticsComparison.vue.d.ts +16 -0
  11. package/dist/component/FluxStatisticsDonutChart.vue.d.ts +8 -4
  12. package/dist/component/FluxStatisticsEmpty.vue.d.ts +19 -0
  13. package/dist/component/FluxStatisticsHeatmapChart.vue.d.ts +15 -0
  14. package/dist/component/FluxStatisticsLegendItem.vue.d.ts +1 -0
  15. package/dist/component/FluxStatisticsLineChart.vue.d.ts +11 -4
  16. package/dist/component/FluxStatisticsMixedChart.vue.d.ts +17 -0
  17. package/dist/component/FluxStatisticsPieChart.vue.d.ts +8 -4
  18. package/dist/component/FluxStatisticsPolarAreaChart.vue.d.ts +14 -0
  19. package/dist/component/FluxStatisticsRadarChart.vue.d.ts +12 -0
  20. package/dist/component/FluxStatisticsRadialBar.vue.d.ts +11 -0
  21. package/dist/component/FluxStatisticsScatterChart.vue.d.ts +14 -0
  22. package/dist/component/FluxStatisticsSparkline.vue.d.ts +13 -0
  23. package/dist/component/FluxStatisticsTreemapChart.vue.d.ts +11 -0
  24. package/dist/component/index.d.ts +13 -0
  25. package/dist/composable/index.d.ts +10 -0
  26. package/dist/composable/useChartHoverSync.d.ts +9 -0
  27. package/dist/composable/useChartLegend.d.ts +14 -0
  28. package/dist/composable/useChartSeriesSetup.d.ts +23 -0
  29. package/dist/composable/useECharts.d.ts +9 -0
  30. package/dist/composable/usePieSlicesSetup.d.ts +14 -0
  31. package/dist/echarts.d.ts +1 -0
  32. package/dist/index.css +230 -37
  33. package/dist/index.d.ts +5 -2
  34. package/dist/index.js +10919 -9041
  35. package/dist/index.js.map +1 -1
  36. package/dist/util/baseOptions.d.ts +15 -0
  37. package/dist/util/colors.d.ts +4 -0
  38. package/dist/util/convert.d.ts +22 -0
  39. package/dist/util/defaultOptions.d.ts +76 -0
  40. package/dist/util/iconSvg.d.ts +2 -0
  41. package/dist/util/index.d.ts +7 -0
  42. package/dist/util/seriesDefaults.d.ts +15 -0
  43. package/dist/util/sparklineOptions.d.ts +7 -0
  44. package/package.json +14 -15
  45. package/src/component/FluxStatisticsAreaChart.vue +38 -41
  46. package/src/component/FluxStatisticsBarChart.vue +38 -33
  47. package/src/component/FluxStatisticsBase.vue +14 -1
  48. package/src/component/FluxStatisticsBoxPlotChart.vue +69 -0
  49. package/src/component/FluxStatisticsBubbleChart.vue +56 -0
  50. package/src/component/FluxStatisticsCandlestickChart.vue +81 -0
  51. package/src/component/FluxStatisticsChart.vue +19 -169
  52. package/src/component/FluxStatisticsChartPane.vue +23 -11
  53. package/src/component/FluxStatisticsComparison.vue +113 -0
  54. package/src/component/FluxStatisticsDonutChart.vue +39 -18
  55. package/src/component/FluxStatisticsEmpty.vue +44 -0
  56. package/src/component/FluxStatisticsHeatmapChart.vue +80 -0
  57. package/src/component/FluxStatisticsLegend.vue +33 -1
  58. package/src/component/FluxStatisticsLegendItem.vue +3 -1
  59. package/src/component/FluxStatisticsLineChart.vue +38 -41
  60. package/src/component/FluxStatisticsMixedChart.vue +55 -0
  61. package/src/component/FluxStatisticsPieChart.vue +39 -18
  62. package/src/component/FluxStatisticsPolarAreaChart.vue +53 -0
  63. package/src/component/FluxStatisticsRadarChart.vue +108 -0
  64. package/src/component/FluxStatisticsRadialBar.vue +48 -0
  65. package/src/component/FluxStatisticsScatterChart.vue +56 -0
  66. package/src/component/FluxStatisticsSparkline.vue +67 -0
  67. package/src/component/FluxStatisticsTreemapChart.vue +39 -0
  68. package/src/component/index.ts +13 -0
  69. package/src/composable/index.ts +10 -0
  70. package/src/composable/useChartHoverSync.ts +92 -0
  71. package/src/composable/useChartLegend.ts +23 -0
  72. package/src/composable/useChartSeriesSetup.ts +75 -0
  73. package/src/composable/useECharts.ts +55 -0
  74. package/src/composable/usePieSlicesSetup.ts +58 -0
  75. package/src/css/Base.module.scss +28 -1
  76. package/src/css/Chart.module.scss +66 -32
  77. package/src/css/ChartPane.module.scss +24 -9
  78. package/src/css/Comparison.module.scss +52 -0
  79. package/src/css/Empty.module.scss +39 -0
  80. package/src/css/Grid.module.scss +1 -0
  81. package/src/css/Legend.module.scss +11 -1
  82. package/src/css/Metric.module.scss +6 -0
  83. package/src/css/Sparkline.module.scss +13 -0
  84. package/src/echarts.ts +47 -0
  85. package/src/index.ts +7 -3
  86. package/src/util/baseOptions.ts +74 -0
  87. package/src/util/colors.ts +86 -0
  88. package/src/util/convert.ts +360 -0
  89. package/src/util/defaultOptions.ts +398 -0
  90. package/src/util/iconSvg.ts +20 -0
  91. package/src/util/index.ts +7 -0
  92. package/src/util/seriesDefaults.ts +210 -0
  93. package/src/util/sparklineOptions.ts +67 -0
package/dist/index.css CHANGED
@@ -22,35 +22,8 @@
22
22
  inset: 0;
23
23
  height: unset;
24
24
  width: unset;
25
- }
26
- .statistics-chart svg {
27
- overflow: hidden;
28
- }
29
- .statistics-chart {
30
25
  --stroke: rgb(from var(--surface-stroke) r g b / .5);
31
26
  }
32
- .statistics-chart .apexcharts-canvas .apexcharts-grid-borders {
33
- display: none;
34
- }
35
- .statistics-chart .apexcharts-canvas .apexcharts-yaxis-texts-g {
36
- display: none;
37
- }
38
- .statistics-chart .apexcharts-canvas .apexcharts-tooltip {
39
- background: rgb(from var(--surface) r g b/0.975);
40
- background-clip: padding-box;
41
- backdrop-filter: blur(3px) saturate(180%);
42
- border: 1px solid var(--surface-stroke-out-hover);
43
- border-radius: var(--radius-double);
44
- box-shadow: var(--shadow-lg);
45
- color: var(--foreground);
46
- contain: paint;
47
- }
48
-
49
- .statistics-chart-element {
50
- position: absolute;
51
- display: block;
52
- inset: 0;
53
- }
54
27
 
55
28
  .statistics-chart-tooltip-title {
56
29
  padding: 18px 18px 0;
@@ -75,15 +48,78 @@
75
48
  border-radius: 6px;
76
49
  }
77
50
 
51
+ .statistics-chart-tooltip-series-icon {
52
+ display: flex;
53
+ height: 14px;
54
+ width: 14px;
55
+ color: var(--danger-600);
56
+ align-items: center;
57
+ justify-content: center;
58
+ }
59
+ .statistics-chart-tooltip-series-icon > svg {
60
+ height: 100%;
61
+ width: 100%;
62
+ }
63
+
78
64
  .statistics-chart-tooltip-series-name {
65
+ color: var(--foreground-secondary);
79
66
  font-size: 14px;
80
67
  font-weight: 700;
68
+ transition: color 0.15s ease-out;
81
69
  }
82
70
 
83
71
  .statistics-chart-tooltip-series-value {
72
+ color: var(--foreground-secondary);
84
73
  font-size: 14px;
85
74
  font-weight: 500;
86
75
  text-align: right;
76
+ transition: color 0.15s ease-out;
77
+ }
78
+
79
+ .statistics-chart-tooltip-series-name.is-active,
80
+ .statistics-chart-tooltip-series-value.is-active {
81
+ color: var(--foreground-prominent);
82
+ }
83
+
84
+ .statistics-chart-tooltip-section {
85
+ padding: 12px 18px;
86
+ transition: opacity 0.15s ease-out;
87
+ }
88
+ .statistics-chart-tooltip-section + .statistics-chart-tooltip-section {
89
+ border-top: 1px solid var(--surface-stroke);
90
+ }
91
+
92
+ .statistics-chart-tooltip-section.is-dimmed {
93
+ opacity: 0.55;
94
+ }
95
+
96
+ .statistics-chart-tooltip-section-title {
97
+ color: var(--foreground-prominent);
98
+ font-size: 14px;
99
+ font-weight: 700;
100
+ line-height: 1;
101
+ margin-bottom: 9px;
102
+ }
103
+
104
+ .statistics-chart-tooltip-section-body {
105
+ display: grid;
106
+ align-items: center;
107
+ gap: 6px 15px;
108
+ grid-template-columns: repeat(3, auto);
109
+ }
110
+
111
+ .flux-statistics-tooltip {
112
+ background: rgb(from var(--surface) r g b/0.975) !important;
113
+ background-clip: padding-box;
114
+ backdrop-filter: blur(3px) saturate(180%);
115
+ border: 1px solid var(--surface-stroke-out-hover) !important;
116
+ border-radius: var(--radius-double) !important;
117
+ box-shadow: var(--shadow-lg) !important;
118
+ color: var(--foreground);
119
+ contain: paint;
120
+ }
121
+ .flux-statistics-tooltip:empty {
122
+ display: none;
87
123
  }.statistics-base {
88
124
  display: flex;
89
125
  height: 100%;
@@ -103,6 +139,7 @@
103
139
  .statistics-base-header {
104
140
  display: flex;
105
141
  padding: 18px 18px 0;
142
+ gap: 9px;
106
143
  align-items: flex-start;
107
144
  }
108
145
 
@@ -114,10 +151,30 @@
114
151
  word-break: break-word;
115
152
  }
116
153
 
154
+ .statistics-base-header-icon,
155
+ .statistics-base-header-info {
156
+ font-size: 20px;
157
+ line-height: 24px;
158
+ }
159
+
160
+ .statistics-base-header-info {
161
+ margin-left: auto;
162
+ color: var(--foreground-secondary);
163
+ cursor: help;
164
+ scale: 0.75;
165
+ transition: color 0.2s var(--swift-out);
166
+ }
167
+ .statistics-base-header-info:hover {
168
+ color: var(--foreground-prominent);
169
+ }
170
+
171
+ .statistics-base-header-info + .statistics-base-header-icon {
172
+ margin-left: 6px;
173
+ }
174
+
117
175
  .statistics-base-header-icon {
118
176
  margin-left: auto;
119
177
  color: var(--primary-600);
120
- font-size: 20px;
121
178
  }
122
179
 
123
180
  .statistics-base-small .statistics-base-header-title {
@@ -126,6 +183,11 @@
126
183
  line-height: 18px;
127
184
  }
128
185
 
186
+ .statistics-base-small .statistics-base-header-info {
187
+ font-size: 14px;
188
+ line-height: 18px;
189
+ }
190
+
129
191
  .statistics-base-small .statistics-base-header-icon {
130
192
  font-size: 18px;
131
193
  }.statistics-change {
@@ -165,35 +227,100 @@
165
227
  font-weight: 500;
166
228
  }.statistics-chart-pane {
167
229
  --aspect-ratio: unset;
230
+ container: chart-pane/inline-size;
168
231
  max-width: 100%;
169
- aspect-ratio: var(--aspect-ratio);
170
232
  }
171
233
 
172
234
  .statistics-chart-pane-body {
173
235
  display: grid;
236
+ align-content: start;
174
237
  flex-grow: 1;
175
238
  grid-template-columns: 1fr;
176
239
  grid-template-rows: 1fr;
177
240
  }
241
+ .statistics-chart-pane-body .statistics-chart-pane-container {
242
+ height: calc(100cqw / var(--aspect-ratio, 1));
243
+ }
178
244
  .statistics-chart-pane-body:has(.statistics-legend) {
179
- grid-template-columns: 1fr 1fr;
245
+ grid-template-columns: 0.4fr 0.6fr;
180
246
  }
181
-
182
- .statistics-chart-pane-container {
183
- position: relative;
184
- display: block;
247
+ @container chart-pane (max-width: 390px) {
248
+ .statistics-chart-pane-body:has(.statistics-legend) {
249
+ grid-template-columns: 1fr;
250
+ grid-template-rows: auto auto;
251
+ }
252
+ }
253
+ .statistics-chart-pane-body:has(.statistics-legend) .statistics-chart-pane-container {
254
+ height: calc(40cqw / var(--aspect-ratio, 1));
185
255
  }
186
- .statistics-chart-pane-container:first-child svg {
256
+ .statistics-chart-pane-body:first-child canvas {
187
257
  border-top-left-radius: var(--radius);
188
258
  border-top-right-radius: var(--radius);
189
259
  }
190
- .statistics-chart-pane-container:last-child svg {
260
+ .statistics-chart-pane-body:last-child canvas {
191
261
  border-bottom-left-radius: var(--radius);
192
262
  border-bottom-right-radius: var(--radius);
193
263
  }
194
264
 
265
+ .statistics-chart-pane-container {
266
+ position: relative;
267
+ display: block;
268
+ align-self: center;
269
+ }
270
+
195
271
  .pane-header + .statistics-chart-pane-container {
196
272
  margin-top: 18px;
273
+ }.statistics-comparison {
274
+ display: grid;
275
+ margin-top: 18px;
276
+ gap: 12px;
277
+ grid-template-columns: 1fr auto 1fr;
278
+ align-items: center;
279
+ }
280
+
281
+ .statistics-comparison-divider {
282
+ width: 1px;
283
+ height: 36px;
284
+ background: var(--stroke);
285
+ }
286
+
287
+ .statistics-comparison-item {
288
+ display: flex;
289
+ flex-flow: column;
290
+ gap: 3px;
291
+ }
292
+
293
+ .statistics-comparison-item-label {
294
+ color: var(--foreground-secondary);
295
+ font-size: 13px;
296
+ font-weight: 500;
297
+ }
298
+
299
+ .statistics-comparison-item-value {
300
+ color: var(--foreground-prominent);
301
+ font-size: 21px;
302
+ font-weight: 800;
303
+ line-height: 28px;
304
+ }
305
+
306
+ .statistics-comparison-item-value-muted {
307
+ color: var(--foreground-secondary);
308
+ font-size: 18px;
309
+ font-weight: 600;
310
+ line-height: 28px;
311
+ }
312
+
313
+ .statistics-comparison-bottom {
314
+ display: flex;
315
+ margin-top: 9px;
316
+ align-items: center;
317
+ gap: 9px;
318
+ line-height: 18px;
319
+ }
320
+
321
+ .statistics-comparison-footer {
322
+ color: var(--foreground-secondary);
323
+ font-size: 14px;
197
324
  }.statistics-base-content .statistics-stackable + .statistics-stackable {
198
325
  margin-top: 18px;
199
326
  }.details-table {
@@ -235,6 +362,44 @@
235
362
  .details-table-title {
236
363
  font-size: 15px;
237
364
  font-weight: 600;
365
+ }.statistics-empty {
366
+ position: absolute;
367
+ display: flex;
368
+ inset: 0;
369
+ padding: 24px 18px;
370
+ flex-flow: column;
371
+ align-items: center;
372
+ justify-content: center;
373
+ text-align: center;
374
+ gap: 9px;
375
+ }
376
+
377
+ .statistics-empty-icon {
378
+ color: var(--foreground-secondary);
379
+ font-size: 32px;
380
+ opacity: 0.5;
381
+ }
382
+
383
+ .statistics-empty-title {
384
+ color: var(--foreground-prominent);
385
+ font-size: 16px;
386
+ font-weight: 700;
387
+ line-height: 24px;
388
+ }
389
+
390
+ .statistics-empty-description {
391
+ max-width: 320px;
392
+ color: var(--foreground-secondary);
393
+ font-size: 14px;
394
+ font-weight: 400;
395
+ line-height: 20px;
396
+ }
397
+
398
+ .statistics-empty-actions {
399
+ display: flex;
400
+ margin-top: 9px;
401
+ align-items: center;
402
+ gap: 9px;
238
403
  }.statistics-grid {
239
404
  --columns: 1;
240
405
  --gap: 18px;
@@ -244,6 +409,7 @@
244
409
 
245
410
  .statistics-grid-content {
246
411
  display: grid;
412
+ align-items: start;
247
413
  gap: var(--gap);
248
414
  grid-template-columns: repeat(var(--columns), 1fr);
249
415
  }
@@ -292,23 +458,33 @@
292
458
  line-height: 36px;
293
459
  }.statistics-legend {
294
460
  display: flex;
461
+ max-height: 360px;
295
462
  min-width: 0;
296
463
  padding: 15px 18px 15px;
297
464
  align-self: center;
298
465
  flex-flow: column;
299
466
  flex-grow: 1;
467
+ overflow: auto;
468
+ user-select: none;
300
469
  }
301
470
 
302
471
  .statistics-legend-item {
303
472
  --color: var(--primary-600);
304
473
  display: flex;
305
- padding: 6px 0;
474
+ padding: 6px 9px;
475
+ margin: 0 -9px;
306
476
  align-items: flex-start;
307
477
  flex-flow: row nowrap;
308
478
  gap: 9px;
309
479
  font-size: 14px;
310
480
  line-height: 20px;
311
481
  white-space: nowrap;
482
+ border-radius: var(--radius-small);
483
+ transition: background var(--swift-out);
484
+ }
485
+
486
+ .statistics-legend-item.is-hovered {
487
+ background: var(--surface-active);
312
488
  }
313
489
 
314
490
  .statistics-legend-item-color {
@@ -465,6 +641,11 @@
465
641
  .statistics-metric-content small:not(:first-child) {
466
642
  margin-top: 15px;
467
643
  }
644
+ .statistics-metric-content [data-sparkline] {
645
+ margin-inline: -18px;
646
+ width: calc(100% + 36px);
647
+ max-width: none;
648
+ }
468
649
 
469
650
  .statistics-metric-footer {
470
651
  color: var(--foreground-secondary);
@@ -492,4 +673,16 @@
492
673
 
493
674
  .statistics-metric-value + .statistics-metric-content {
494
675
  margin-top: 15px;
676
+ }.statistics-sparkline {
677
+ position: relative;
678
+ display: block;
679
+ width: 100%;
680
+ height: 40px;
681
+ min-width: 60px;
682
+ }
683
+
684
+ .statistics-sparkline-chart {
685
+ position: absolute;
686
+ display: block;
687
+ inset: 0;
495
688
  }/*$vite$:1*/
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { FluxStatisticsChartColor } from '@flux-ui/types';
1
2
  export * from './component';
2
- export declare const CHART_COLORS: string[];
3
- export declare const CHART_COLORFUL_COLORS: string[];
3
+ export * from './composable';
4
+ export type { ChartTooltipValueFormatter, SharedTooltipItem, Translator } from './util';
5
+ export declare const CHART_COLORS: readonly FluxStatisticsChartColor[];
6
+ export declare const CHART_COLORFUL_COLORS: readonly FluxStatisticsChartColor[];