@aquera/nile-visualization 2.9.38 → 2.9.40
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.
- package/README.md +8 -0
- package/dist/src/internal/types/aq-config.type.d.ts +2 -0
- package/dist/src/internal/utils/highcharts-compat.d.ts +27 -0
- package/dist/src/internal/utils/highcharts-compat.js +80 -0
- package/dist/src/internal/utils/highcharts-compat.test.d.ts +1 -0
- package/dist/src/internal/utils/highcharts-compat.test.js +116 -0
- package/dist/src/internal/utils/highcharts-provider.js +31 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +3 -0
- package/dist/src/nile-chart/nile-chart-empty.d.ts +22 -0
- package/dist/src/nile-chart/nile-chart-empty.js +264 -0
- package/dist/src/nile-chart/nile-chart-empty.test.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart-empty.test.js +897 -0
- package/dist/src/nile-chart/nile-chart-skeleton.d.ts +2 -0
- package/dist/src/nile-chart/nile-chart-skeleton.js +9 -0
- package/dist/src/nile-chart/nile-chart-skeleton.test.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart-skeleton.test.js +137 -0
- package/dist/src/nile-chart/nile-chart.css.js +123 -0
- package/dist/src/nile-chart/nile-chart.d.ts +8 -0
- package/dist/src/nile-chart/nile-chart.js +61 -5
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +419 -26
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +37 -3
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +175 -17
- package/package.json +3 -3
|
@@ -53,13 +53,13 @@ export const styles = css `
|
|
|
53
53
|
--nile-kpi-card-border-radius: var(--nile-radius-radius-3xl, var(--ng-radius-xl));
|
|
54
54
|
--nile-kpi-card-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));
|
|
55
55
|
--nile-kpi-card-shadow-hover: var(--nile-kpi-card-shadow, var(--nile-box-shadow-7, var(--ng-shadow-md)));
|
|
56
|
-
--nile-kpi-padding-v: var(--nile-spacing-
|
|
57
|
-
--nile-kpi-padding-h: var(--nile-spacing-
|
|
56
|
+
--nile-kpi-padding-v: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
57
|
+
--nile-kpi-padding-h: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
58
58
|
--nile-kpi-content-gap: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
59
59
|
--nile-kpi-label-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
60
60
|
--nile-kpi-label-font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
61
61
|
--nile-kpi-label-font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
62
|
-
--nile-kpi-value-font-size: clamp(
|
|
62
|
+
--nile-kpi-value-font-size: clamp(28px, 16cqi, 52px);
|
|
63
63
|
--nile-kpi-value-color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
64
64
|
--nile-kpi-prefix-suffix-font-size: var(--nile-type-scale-6, var(--ng-font-size-text-xl));
|
|
65
65
|
--nile-kpi-prefix-suffix-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
@@ -136,6 +136,11 @@ export const styles = css `
|
|
|
136
136
|
box-shadow: var(--nile-kpi-card-shadow-hover);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/* Fit cards are also capped by their height so a short card keeps room for the sparkline. */
|
|
140
|
+
:host([fit]) {
|
|
141
|
+
--nile-kpi-value-font-size: clamp(24px, min(27cqi, 23cqh), 60px);
|
|
142
|
+
}
|
|
143
|
+
|
|
139
144
|
.kpi {
|
|
140
145
|
flex: 1 1 auto;
|
|
141
146
|
display: flex;
|
|
@@ -375,10 +380,30 @@ export const styles = css `
|
|
|
375
380
|
box-sizing: border-box;
|
|
376
381
|
}
|
|
377
382
|
|
|
383
|
+
/* The value is the hero: on tall cards the sparkline stays a modest strip at the bottom instead of
|
|
384
|
+
taking all the spare height (only fit cards are height-aware; others size to their content). */
|
|
385
|
+
:host([fit]) .kpi-sparkline,
|
|
386
|
+
:host([fit]) .kpi--compact .kpi-sparkline {
|
|
387
|
+
max-height: max(48px, 42cqh);
|
|
388
|
+
margin-top: auto;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/* The description never shrinks (and gets half-cut): if it doesn't fit, the fit check hides it whole. */
|
|
392
|
+
.kpi-description,
|
|
393
|
+
.kpi-forecast {
|
|
394
|
+
flex-shrink: 0;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Set by the component when the card is too short to show the description whole. */
|
|
398
|
+
:host([data-hide-desc][data-hide-desc]) .kpi-description,
|
|
399
|
+
:host([data-hide-desc][data-hide-desc]) .kpi-forecast {
|
|
400
|
+
display: none;
|
|
401
|
+
}
|
|
402
|
+
|
|
378
403
|
.kpi-sparkline {
|
|
379
404
|
width: 100%;
|
|
380
405
|
flex: 1 1 24px;
|
|
381
|
-
min-height:
|
|
406
|
+
min-height: 16px;
|
|
382
407
|
}
|
|
383
408
|
|
|
384
409
|
/* ── Container queries: scale down for narrow cards ── */
|
|
@@ -408,13 +433,7 @@ export const styles = css `
|
|
|
408
433
|
|
|
409
434
|
.kpi-sparkline {
|
|
410
435
|
flex-basis: 32px;
|
|
411
|
-
min-height:
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
@container (max-width: 130px) {
|
|
416
|
-
.kpi-sparkline {
|
|
417
|
-
display: none;
|
|
436
|
+
min-height: 16px;
|
|
418
437
|
}
|
|
419
438
|
}
|
|
420
439
|
|
|
@@ -543,17 +562,6 @@ export const styles = css `
|
|
|
543
562
|
}
|
|
544
563
|
}
|
|
545
564
|
|
|
546
|
-
@container (max-width: 100px) {
|
|
547
|
-
.kpi-sparkline {
|
|
548
|
-
display: none;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
@container (max-width: 379.98px) and (max-height: 90px) {
|
|
553
|
-
:host([has-value][has-sparkline]:not([variant='gauge'])) .kpi-sparkline {
|
|
554
|
-
display: none;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
565
|
|
|
558
566
|
/* Constrained both ways — only show the value. */
|
|
559
567
|
|
|
@@ -574,29 +582,414 @@ export const styles = css `
|
|
|
574
582
|
}
|
|
575
583
|
|
|
576
584
|
@container (max-height: 150px) {
|
|
577
|
-
:host([has-sparkline]:not([variant='gauge'])) .kpi-description {
|
|
585
|
+
:host([has-sparkline]:not([variant='gauge']):not([variant='compact'])) .kpi-description {
|
|
578
586
|
display: none;
|
|
579
587
|
}
|
|
580
588
|
}
|
|
581
589
|
|
|
582
590
|
@container (max-width: 319.98px) and (max-height: 165px) {
|
|
583
|
-
:host([has-sparkline]:not([variant='gauge'])) .kpi-description {
|
|
591
|
+
:host([has-sparkline]:not([variant='gauge']):not([variant='compact'])) .kpi-description {
|
|
584
592
|
display: none;
|
|
585
593
|
}
|
|
586
594
|
}
|
|
587
595
|
|
|
588
596
|
@container (max-width: 319.98px) and (max-height: 110px) {
|
|
589
|
-
:host([has-value]) .kpi-label {
|
|
597
|
+
:host([has-value]:not([variant='compact'])) .kpi-label {
|
|
590
598
|
display: none;
|
|
591
599
|
}
|
|
592
600
|
}
|
|
593
601
|
|
|
594
602
|
@container (max-height: 110px) {
|
|
595
|
-
:host([has-value][has-sparkline]:not([variant='gauge'])) .kpi-label {
|
|
603
|
+
:host([has-value][has-sparkline]:not([variant='gauge']):not([variant='compact'])) .kpi-label {
|
|
596
604
|
display: none;
|
|
597
605
|
}
|
|
598
606
|
}
|
|
599
607
|
|
|
608
|
+
/* ── Header row (all variants): [header-lead] title [trend] [header-actions] ── */
|
|
609
|
+
|
|
610
|
+
.kpi-header {
|
|
611
|
+
display: flex;
|
|
612
|
+
align-items: flex-start;
|
|
613
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
614
|
+
min-width: 0;
|
|
615
|
+
width: 100%;
|
|
616
|
+
flex: 0 0 auto;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
.kpi-header .kpi-tip {
|
|
620
|
+
display: block;
|
|
621
|
+
min-width: 0;
|
|
622
|
+
flex: 1 1 0;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.kpi-header .kpi-label {
|
|
626
|
+
width: auto;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/* The title never collapses to a sliver, however many controls share the row. */
|
|
630
|
+
.kpi-header .kpi-tip:not([data-kpi-tip='trend']) {
|
|
631
|
+
min-width: 3.5em;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
.kpi-header-lead,
|
|
635
|
+
.kpi-header-actions {
|
|
636
|
+
display: none;
|
|
637
|
+
align-items: center;
|
|
638
|
+
flex: 0 0 auto;
|
|
639
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
640
|
+
/* Pin the controls to the top, centred on the title's first line. */
|
|
641
|
+
align-self: flex-start;
|
|
642
|
+
min-height: calc(var(--nile-kpi-label-font-size) * 1.4);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
:host([has-header-lead]) .kpi-header-lead,
|
|
646
|
+
:host([has-header-actions]) .kpi-header-actions {
|
|
647
|
+
display: inline-flex;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
/* With lead/actions present the title wraps instead of truncating, so it
|
|
651
|
+
never runs underneath the controls. */
|
|
652
|
+
:host([has-header-lead]) .kpi-label,
|
|
653
|
+
:host([has-header-actions]) .kpi-label {
|
|
654
|
+
white-space: normal;
|
|
655
|
+
overflow: visible;
|
|
656
|
+
text-overflow: clip;
|
|
657
|
+
/* Never split a word: one that is too wide for the line is cut with an ellipsis instead. */
|
|
658
|
+
overflow-wrap: normal;
|
|
659
|
+
word-break: normal;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
:host([has-header-lead]) .kpi-label-text,
|
|
663
|
+
:host([has-header-actions]) .kpi-label-text {
|
|
664
|
+
/* clip (not hidden) so the text stays part of the line-clamp's flow */
|
|
665
|
+
overflow: clip;
|
|
666
|
+
text-overflow: ellipsis;
|
|
667
|
+
overflow-wrap: normal;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/* The title scales with the card's width and (for fit cards) height, so words
|
|
671
|
+
fit on a line instead of breaking mid-word and short cards keep room for the
|
|
672
|
+
value and sparkline. Never larger than the variant's own size. */
|
|
673
|
+
.kpi-header {
|
|
674
|
+
--kpi-label-fs: clamp(11px, min(7.5cqi, 9cqh), var(--nile-kpi-label-font-size));
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.kpi-header .kpi-label {
|
|
678
|
+
font-size: var(--kpi-label-fs);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
@container (max-width: 190px) {
|
|
682
|
+
.kpi-header {
|
|
683
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
.kpi-header-lead,
|
|
687
|
+
.kpi-header-actions {
|
|
688
|
+
gap: 2px;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/* A wrapping title is capped by card height so a long one can't push the value and
|
|
693
|
+
sparkline out of the card; the rest is cut with an ellipsis (full text is in the tooltip). */
|
|
694
|
+
:host([has-header-lead]) .kpi-label,
|
|
695
|
+
:host([has-header-actions]) .kpi-label {
|
|
696
|
+
display: -webkit-box;
|
|
697
|
+
-webkit-box-orient: vertical;
|
|
698
|
+
-webkit-line-clamp: 4;
|
|
699
|
+
overflow: hidden;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
@container (max-height: 230px) {
|
|
703
|
+
:host([has-header-lead]) .kpi-label,
|
|
704
|
+
:host([has-header-actions]) .kpi-label {
|
|
705
|
+
-webkit-line-clamp: 3;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/* Very short cards: two lines. Anything taller keeps three, and the sparkline gives way instead. */
|
|
710
|
+
@container (max-height: 125px) {
|
|
711
|
+
:host([has-header-lead]) .kpi-label,
|
|
712
|
+
:host([has-header-actions]) .kpi-label {
|
|
713
|
+
-webkit-line-clamp: 2;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
/* With header controls the trend + mover + actions float at the top-right and the title
|
|
718
|
+
wraps AROUND them: first lines are shortened by a spacer, later lines use the full width. */
|
|
719
|
+
.kpi-header-controls {
|
|
720
|
+
display: contents;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
:host([has-header-lead]) .kpi-header,
|
|
724
|
+
:host([has-header-actions]) .kpi-header {
|
|
725
|
+
display: block;
|
|
726
|
+
position: relative;
|
|
727
|
+
min-height: var(--kpi-controls-h, 0px);
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
:host([has-header-lead]) .kpi-header-controls,
|
|
731
|
+
:host([has-header-actions]) .kpi-header-controls {
|
|
732
|
+
display: flex;
|
|
733
|
+
position: absolute;
|
|
734
|
+
top: 0;
|
|
735
|
+
right: 0;
|
|
736
|
+
align-items: flex-start;
|
|
737
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
:host([has-header-lead]) .kpi-header .kpi-tip:not([data-kpi-tip='trend']),
|
|
741
|
+
:host([has-header-actions]) .kpi-header .kpi-tip:not([data-kpi-tip='trend']) {
|
|
742
|
+
display: block;
|
|
743
|
+
min-width: 0;
|
|
744
|
+
width: 100%;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
:host([has-header-lead]) .kpi-header .kpi-label-text::before,
|
|
748
|
+
:host([has-header-actions]) .kpi-header .kpi-label-text::before {
|
|
749
|
+
content: '';
|
|
750
|
+
float: right;
|
|
751
|
+
width: calc(var(--kpi-controls-w, 0px) + var(--nile-spacing-xs, var(--ng-spacing-xs)));
|
|
752
|
+
height: var(--kpi-controls-h, 0px);
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
:host([has-header-lead]) .kpi-header .kpi-label-text,
|
|
756
|
+
:host([has-header-actions]) .kpi-header .kpi-label-text {
|
|
757
|
+
display: block;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
:host([has-header-lead]) .kpi-header .kpi-tip[data-kpi-tip='trend'],
|
|
761
|
+
:host([has-header-actions]) .kpi-header .kpi-tip[data-kpi-tip='trend'] {
|
|
762
|
+
min-height: calc(var(--nile-kpi-label-font-size) * 1.4);
|
|
763
|
+
display: inline-flex;
|
|
764
|
+
align-items: center;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/* Compact: the trend sits between the title and the actions. */
|
|
768
|
+
.kpi--compact .kpi-header {
|
|
769
|
+
align-items: baseline;
|
|
770
|
+
justify-content: space-between;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
.kpi-header .kpi-tip[data-kpi-tip='trend'] {
|
|
774
|
+
flex: 0 1 auto;
|
|
775
|
+
min-width: 0;
|
|
776
|
+
overflow: hidden;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/* Narrow compact card with header controls: no room for title + trend + controls on one
|
|
780
|
+
line, so the trend moves to its own row under the header. The controls themselves never
|
|
781
|
+
wrap — they stay in the absolutely-positioned group at the top-right. */
|
|
782
|
+
.kpi-trend-row {
|
|
783
|
+
display: none;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
@container (max-width: 210px) {
|
|
787
|
+
:host([variant='compact'][has-header-lead]) .kpi-header-controls .kpi-tip[data-kpi-tip='trend'],
|
|
788
|
+
:host([variant='compact'][has-header-actions]) .kpi-header-controls .kpi-tip[data-kpi-tip='trend'] {
|
|
789
|
+
display: none;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
:host([variant='compact'][has-header-lead]) .kpi-trend-row,
|
|
793
|
+
:host([variant='compact'][has-header-actions]) .kpi-trend-row {
|
|
794
|
+
display: block;
|
|
795
|
+
min-width: 0;
|
|
796
|
+
margin-top: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/* ── Compact variant ──
|
|
801
|
+
Tinted card: label (left) + trend (right) on one header row, a large
|
|
802
|
+
value under it, a muted description, and the sparkline along the bottom.
|
|
803
|
+
Same config as the other variants — only padding, type and placement differ. */
|
|
804
|
+
|
|
805
|
+
:host([variant='compact']) {
|
|
806
|
+
/* 12px on all four sides. */
|
|
807
|
+
--nile-kpi-padding-v: 12px;
|
|
808
|
+
--nile-kpi-padding-h: 12px;
|
|
809
|
+
--nile-kpi-card-border-radius: var(--nile-radius-radius-3xl, var(--ng-radius-xl));
|
|
810
|
+
--nile-kpi-label-font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
811
|
+
/* Title and value are regular weight; the value stays the dark colour, the title and description the muted grey. */
|
|
812
|
+
--nile-kpi-label-font-weight: var(--nile-font-weight-regular, 400);
|
|
813
|
+
--nile-kpi-label-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
814
|
+
--nile-kpi-value-font-size: clamp(32px, 18cqi, 56px);
|
|
815
|
+
--nile-kpi-description-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
816
|
+
--nile-kpi-description-font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
|
|
817
|
+
min-height: 160px;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/* Fit-to-container (e.g. a resizable box) must be able to shrink below the default.
|
|
821
|
+
The value font is also capped by the card height so a wide-but-short card
|
|
822
|
+
doesn't grow a value that crowds out the description and sparkline. */
|
|
823
|
+
:host([variant='compact'][fit]) {
|
|
824
|
+
min-height: 0;
|
|
825
|
+
--nile-kpi-value-font-size: clamp(24px, min(18cqi, 24cqh), 56px);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
:host([variant='compact']:not([embed-in-nile-chart])) {
|
|
829
|
+
background: var(--nile-kpi-card-bg);
|
|
830
|
+
border: var(--nile-kpi-card-border-width) solid var(--nile-kpi-card-border-color);
|
|
831
|
+
border-radius: var(--nile-kpi-card-border-radius);
|
|
832
|
+
box-shadow: var(--nile-kpi-card-shadow);
|
|
833
|
+
transition: box-shadow var(--nile-transition-duration-default, var(--ng-transition-duration-default)) ease;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
:host([variant='compact']:not([embed-in-nile-chart]):hover) {
|
|
837
|
+
box-shadow: var(--nile-kpi-card-shadow-hover);
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/* With a sparkline the border moves outside the box (as a ring), so the full-bleed fill
|
|
841
|
+
reaches the card edge instead of stopping at an inner 1px border. */
|
|
842
|
+
:host([variant='compact'][has-sparkline]:not([embed-in-nile-chart])) {
|
|
843
|
+
border-width: 0;
|
|
844
|
+
box-shadow: 0 0 0 var(--nile-kpi-card-border-width) var(--nile-kpi-card-border-color), var(--nile-kpi-card-shadow);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
:host([variant='compact'][has-sparkline]:not([embed-in-nile-chart]):hover) {
|
|
848
|
+
box-shadow: 0 0 0 var(--nile-kpi-card-border-width) var(--nile-kpi-card-border-color), var(--nile-kpi-card-shadow-hover);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
.kpi--compact {
|
|
852
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
.kpi--compact .kpi-label {
|
|
856
|
+
width: auto;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/* Trend becomes a plain top-right figure (no arrow, no vs-label). */
|
|
860
|
+
.kpi--compact .kpi-trend {
|
|
861
|
+
/* On a very narrow card the trend shrinks and ends in an ellipsis rather than spilling out. */
|
|
862
|
+
display: block;
|
|
863
|
+
flex: 0 1 auto;
|
|
864
|
+
min-width: 0;
|
|
865
|
+
max-width: 100%;
|
|
866
|
+
overflow: hidden;
|
|
867
|
+
text-overflow: ellipsis;
|
|
868
|
+
white-space: nowrap;
|
|
869
|
+
padding: 0;
|
|
870
|
+
font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
871
|
+
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
.kpi--compact .kpi-trend-arrow,
|
|
875
|
+
.kpi--compact .kpi-trend-label {
|
|
876
|
+
display: none;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
.kpi--compact .kpi-trend-value::before {
|
|
880
|
+
content: '+';
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
.kpi--compact .kpi-trend--down .kpi-trend-value::before {
|
|
884
|
+
content: '-';
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
.kpi--compact .kpi-trend--neutral .kpi-trend-value::before {
|
|
888
|
+
content: '';
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
.kpi--compact .kpi-value {
|
|
892
|
+
font-weight: var(--nile-font-weight-regular, 400);
|
|
893
|
+
line-height: 1.1;
|
|
894
|
+
letter-spacing: -0.02em;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
.kpi--compact .kpi-description {
|
|
898
|
+
font-size: var(--nile-kpi-description-font-size);
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
.kpi--compact .kpi-sparkline {
|
|
902
|
+
flex: 1 1 20px;
|
|
903
|
+
min-height: 20px;
|
|
904
|
+
margin-top: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
905
|
+
/* Full-bleed: cancel the card's side padding so the sparkline runs edge to edge. */
|
|
906
|
+
width: auto;
|
|
907
|
+
margin-left: calc(-1 * var(--nile-kpi-padding-h));
|
|
908
|
+
margin-right: calc(-1 * var(--nile-kpi-padding-h));
|
|
909
|
+
margin-bottom: calc(-1 * var(--nile-kpi-padding-v));
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
/* Compact keeps its own column layout at every size (the generic short-wide
|
|
913
|
+
row layout above would split it up) ... */
|
|
914
|
+
:host([variant='compact']) .kpi--compact {
|
|
915
|
+
flex-direction: column;
|
|
916
|
+
align-items: stretch;
|
|
917
|
+
justify-content: flex-start;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/* ... and its parts are all-or-nothing: shown whole, or hidden — never
|
|
921
|
+
squashed or clipped. The generic short-card rules above that would otherwise
|
|
922
|
+
half-hide them are scoped to non-compact variants. Height tiers only apply when
|
|
923
|
+
the card is sized by its container (fit / size-container). */
|
|
924
|
+
:host([variant='compact']) .kpi-label,
|
|
925
|
+
:host([variant='compact']) .kpi-description,
|
|
926
|
+
:host([variant='compact']) .kpi-forecast,
|
|
927
|
+
:host([variant='compact']) .kpi-sparkline {
|
|
928
|
+
display: block;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
:host([variant='compact']) .kpi-forecast {
|
|
932
|
+
display: inline-flex;
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
/* Compact titles that wrap beside header controls keep their line cap (the block
|
|
936
|
+
rule above would otherwise cancel -webkit-box). */
|
|
937
|
+
:host([variant='compact'][has-header-lead]) .kpi-label,
|
|
938
|
+
:host([variant='compact'][has-header-actions]) .kpi-label {
|
|
939
|
+
display: -webkit-box;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/* 1. The sparkline stays at every size; it only goes when the card is too short for anything else. */
|
|
943
|
+
@container (max-height: 72px) {
|
|
944
|
+
:host([variant='compact']) .kpi-sparkline {
|
|
945
|
+
display: none;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
/* 2. Then the description and forecast. */
|
|
950
|
+
@container (max-height: 128px) {
|
|
951
|
+
:host([variant='compact']) .kpi-description,
|
|
952
|
+
:host([variant='compact']) .kpi-forecast {
|
|
953
|
+
display: none;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/* The wrapped trend row (narrow card with header controls) costs ~20px, so
|
|
958
|
+
tiers 1 and 2 kick in that much earlier. */
|
|
959
|
+
@container (max-width: 210px) and (max-height: 150px) {
|
|
960
|
+
:host([variant='compact'][has-header-lead]) .kpi-description,
|
|
961
|
+
:host([variant='compact'][has-header-lead]) .kpi-forecast,
|
|
962
|
+
:host([variant='compact'][has-header-actions]) .kpi-description,
|
|
963
|
+
:host([variant='compact'][has-header-actions]) .kpi-forecast {
|
|
964
|
+
display: none;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/* 3. Tighten the padding so header + value still fit. */
|
|
969
|
+
@container (max-height: 108px) {
|
|
970
|
+
:host([variant='compact']) {
|
|
971
|
+
--nile-kpi-padding-v: 12px;
|
|
972
|
+
--nile-kpi-padding-h: 12px;
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/* 4. Smallest: value only. */
|
|
977
|
+
@container (max-height: 90px) {
|
|
978
|
+
/* Title and trend go; any header-lead / header-actions controls stay. */
|
|
979
|
+
:host([variant='compact']) .kpi-header .kpi-tip {
|
|
980
|
+
display: none;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
:host([variant='compact']) {
|
|
984
|
+
--nile-kpi-padding-v: 12px;
|
|
985
|
+
--nile-kpi-value-font-size: clamp(22px, 10cqi, 32px);
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
:host([variant='compact']) .kpi--compact {
|
|
989
|
+
justify-content: center;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
|
|
600
993
|
/* ── Gauge variant ── */
|
|
601
994
|
|
|
602
995
|
.kpi--gauge {
|
|
@@ -3,7 +3,7 @@ import type Highcharts from 'highcharts';
|
|
|
3
3
|
import NileElement from '../internal/base/nile-element.js';
|
|
4
4
|
import type { AqConfigType } from '../internal/types/aq-config.type.js';
|
|
5
5
|
export type TrendDirection = 'up' | 'down' | 'neutral';
|
|
6
|
-
export type KpiVariant = 'default' | 'card' | 'gauge' | 'accent';
|
|
6
|
+
export type KpiVariant = 'default' | 'card' | 'gauge' | 'accent' | 'compact';
|
|
7
7
|
export type SparklineType = 'area' | 'line' | 'column' | 'bar' | 'spline' | 'areaspline' | 'pie' | 'scatter';
|
|
8
8
|
export type KpiValueFormat = 'auto' | 'K' | 'M' | 'B' | 'T' | 'none';
|
|
9
9
|
export type KpiNumberSystem = 'indian' | 'international';
|
|
@@ -160,7 +160,7 @@ export declare class NileKpiChart extends NileElement {
|
|
|
160
160
|
private gaugeSlot;
|
|
161
161
|
/** Full configuration: `{ chart, aq }` (same convention as other Nile charts). */
|
|
162
162
|
config: NileKpiConfigInputType | null;
|
|
163
|
-
/** Display variant: default (flat), card (bordered container), gauge (Highcharts solid gauge). */
|
|
163
|
+
/** Display variant: default (flat), card (bordered container), gauge (Highcharts solid gauge), accent (left colour bar), compact (tinted card: label + trend on top, large value, description, sparkline at the bottom). */
|
|
164
164
|
variant: KpiVariant;
|
|
165
165
|
/** Label displayed above the value. */
|
|
166
166
|
label: string;
|
|
@@ -206,7 +206,8 @@ export declare class NileKpiChart extends NileElement {
|
|
|
206
206
|
/** Sparkline chart height in pixels. */
|
|
207
207
|
sparklineHeight: number;
|
|
208
208
|
/** Sparkline stroke width. */
|
|
209
|
-
|
|
209
|
+
/** Sparkline stroke width in px. Unset: 2 (1.25 for the compact variant). */
|
|
210
|
+
sparklineLineWidth: number | null;
|
|
210
211
|
/** Sparkline series type: 'area' (filled) or 'line'. */
|
|
211
212
|
sparklineType: SparklineType;
|
|
212
213
|
/** Fill area opacity 0–1. Only applies when sparklineType is 'area'. */
|
|
@@ -340,17 +341,50 @@ export declare class NileKpiChart extends NileElement {
|
|
|
340
341
|
private destroyCharts;
|
|
341
342
|
private _valueTooltipText;
|
|
342
343
|
private _trendTooltipText;
|
|
344
|
+
private _fitSize;
|
|
345
|
+
/**
|
|
346
|
+
* All-or-nothing description: if the content doesn't fit the card's height with the
|
|
347
|
+
* description (and forecast) showing, hide them so the sparkline keeps its room and
|
|
348
|
+
* nothing is half-cut. Re-evaluated only when the card's size changes, so hiding them
|
|
349
|
+
* (which frees space) can't make it flip back and forth.
|
|
350
|
+
*/
|
|
351
|
+
private _fitDescription;
|
|
352
|
+
/**
|
|
353
|
+
* True when `el` is cut off sideways (ellipsis) or, for the title, by the line-clamp. Chrome drops
|
|
354
|
+
* lines hidden by -webkit-line-clamp without reporting them as overflow, so the clamp is lifted for
|
|
355
|
+
* one synchronous measurement and the full height compared with the clamped height.
|
|
356
|
+
*/
|
|
357
|
+
private _isLabelTruncated;
|
|
343
358
|
private _syncTruncationTips;
|
|
344
359
|
private _onGaugeEnter;
|
|
345
360
|
private _onTrendKeydown;
|
|
346
361
|
private _onTipLeave;
|
|
347
362
|
private renderValueInfo;
|
|
363
|
+
/** Normalise any CSS colour to #rrggbb (the area gradient appends hex alpha to it). */
|
|
364
|
+
private _toHex;
|
|
365
|
+
/** Explicit `sparklineColor` wins; the compact variant otherwise follows the trend colour. */
|
|
366
|
+
private _sparklineColor;
|
|
348
367
|
private renderTrend;
|
|
349
368
|
/**
|
|
350
369
|
* The projected-value line. Rendered only when `forecastValue` is set, so a
|
|
351
370
|
* tile with no projection keeps exactly the layout it had.
|
|
352
371
|
*/
|
|
353
372
|
private renderForecast;
|
|
373
|
+
/** Mirrors the header slots' content onto the host (`has-header-lead` / `has-header-actions`). */
|
|
374
|
+
private _onHeaderSlotChange;
|
|
375
|
+
/**
|
|
376
|
+
* The trend and header controls float at the top-right of the header; the title wraps around
|
|
377
|
+
* them (its first lines are shortened by a spacer of this size) and uses the full width below.
|
|
378
|
+
*/
|
|
379
|
+
private _controlsObserved;
|
|
380
|
+
private _syncHeaderControls;
|
|
381
|
+
/**
|
|
382
|
+
* Header row: [label] [extra, e.g. the compact trend] [header-lead slot] [header-actions slot] —
|
|
383
|
+
both controls sit at the trailing (right) edge.
|
|
384
|
+
* When either slot has content the label wraps onto further lines instead of truncating
|
|
385
|
+
* (see the `has-header-*` rules in the stylesheet).
|
|
386
|
+
*/
|
|
387
|
+
private renderHeaderRow;
|
|
354
388
|
render(): TemplateResult;
|
|
355
389
|
}
|
|
356
390
|
declare global {
|