@aquera/nile-visualization 2.9.41 → 2.9.43

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 CHANGED
@@ -36,6 +36,13 @@ To run a local development server that serves the basic demo located in `demo/in
36
36
 
37
37
  In this section, you can find the updates for each release of `nile-visualization`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
38
38
 
39
+ #### Version 2.9.43 (November 18, 2026)
40
+ - Nile Chart: The master-detail chart now takes several series and can stack them. Set `series` (`{ name, data, color? }[]`, replaces `data` when non-empty) and `stacking` (`normal` or `percent`) on `type: 'master-detail'` or `<nile-master-detail-chart>`; both panes stack, the detail pane shows a legend and a shared tooltip for 2+ series, and dragging the master selection now zooms every series instead of only the first. Single-series charts are unchanged (UIF-1425)
41
+
42
+ #### Version 2.9.42 (November 18, 2026)
43
+ - Nile KPI Chart: Compact titles now wrap onto up to 3 lines with or without header controls, and the new `title-overflow` property (`ellipsis` default, or `break`) controls how an oversized word is handled; a tooltip with the full title shows only when it is truncated. Other variants are unchanged. Also fixes the white strip beside the compact sparkline in a scaled wrapper and the sparkline tooltip width and edge clamping (UIF-1424)
44
+ - Nile Charts: Fixed the clipped bottom border of the "No data" empty-state badge (UIF-1424)
45
+
39
46
  #### Version 2.9.41 (November 18, 2026)
40
47
  - Nile Charts: Opt-in pagination for all axis charts (bar, column, line, area, timeline, …) via `chart.pagination` — chevrons page the category axis when it overflows; `valueSpan` also pages the value axis (UIF-1423)
41
48
  - Nile Charts: `chart.zoomType`, `chart.panning` and `chart.panKey` turn on Highcharts zoom and pan; panning moves a paginated chart's page (UIF-1423)
@@ -40,7 +40,7 @@ export type { BoxplotBox, BoxplotSeriesData } from './nile-boxplot-chart/index.j
40
40
  export { NileTimelineChart } from './nile-timeline-chart/index.js';
41
41
  export type { TimelineEvent } from './nile-timeline-chart/index.js';
42
42
  export { NileMasterDetailChart } from './nile-master-detail-chart/index.js';
43
- export type { MasterDetailPoint, MasterDetailSeriesType } from './nile-master-detail-chart/index.js';
43
+ export type { MasterDetailPoint, MasterDetailSeries, MasterDetailSeriesType, MasterDetailStacking } from './nile-master-detail-chart/index.js';
44
44
  export { NileDumbbellChart } from './nile-dumbbell-chart/index.js';
45
45
  export type { DumbbellPoint } from './nile-dumbbell-chart/index.js';
46
46
  export { NileDumbbellLowerChart } from './nile-dumbbell-lower-chart/index.js';
@@ -101,7 +101,7 @@ export type { FlameChartPoint, FlameSunburstPoint, FlameChartLayout, } from './n
101
101
  export { NileSpiderwebChart } from './nile-spiderweb-chart/index.js';
102
102
  export type { SpiderwebChartSeriesData } from './nile-spiderweb-chart/index.js';
103
103
  export { NileKpiChart } from './nile-kpi-chart/index.js';
104
- export type { ChartKpiSeparatedPayload, KpiConfig, NileKpiConfigInputType, TrendDirection, KpiVariant, } from './nile-kpi-chart/index.js';
104
+ export type { ChartKpiSeparatedPayload, KpiConfig, NileKpiConfigInputType, TrendDirection, KpiVariant, KpiTitleOverflow, } from './nile-kpi-chart/index.js';
105
105
  export { NileFilterChart } from './nile-filter-chart/index.js';
106
106
  export type { FilterChartSeparatedPayload, FilterControl, FilterOption, FilterChartConfig, } from './nile-filter-chart/nile-filter-chart.js';
107
107
  export { NileMapChart } from './nile-map-chart/index.js';
@@ -325,8 +325,48 @@ const WAVE2_TRANSLATORS = {
325
325
  return o;
326
326
  },
327
327
  'master-detail': (c) => {
328
- const o = cartesian(c, 'line');
329
- return { ...o, dataZoom: [{ type: 'slider', height: 22, bottom: 4 }, { type: 'inside' }], grid: { ...o.grid, bottom: 58 } };
328
+ const zoom = { dataZoom: [{ type: 'slider', height: 22, bottom: 4 }, { type: 'inside' }] };
329
+ if (!(Array.isArray(c.series) && c.series.length)) {
330
+ const o = cartesian(c, 'line');
331
+ return { ...o, ...zoom, grid: { ...o.grid, bottom: 58 } };
332
+ }
333
+ // Multi-series form: { name, data: { x, y }[], color? }[] on a time/value x-axis,
334
+ // stacked when `stacking` is set. ECharts has no percent stacking, so percent
335
+ // mode normalises each x to the share of its column total first.
336
+ const stacking = c.stacking === 'normal' || c.stacking === 'percent' ? c.stacking : undefined;
337
+ const area = !['line', 'spline', 'column', 'bar'].includes(c.detailType ?? 'area');
338
+ const bar = c.detailType === 'column' || c.detailType === 'bar';
339
+ const totals = new Map();
340
+ if (stacking === 'percent') {
341
+ for (const s of c.series)
342
+ for (const p of s.data ?? [])
343
+ totals.set(p.x, (totals.get(p.x) ?? 0) + (Number(p.y) || 0));
344
+ }
345
+ const value = (p) => {
346
+ if (stacking !== 'percent')
347
+ return p.y;
348
+ const total = totals.get(p.x) ?? 0;
349
+ return total === 0 ? 0 : ((Number(p.y) || 0) / total) * 100;
350
+ };
351
+ const series = c.series.map((s) => ({
352
+ name: s.name,
353
+ type: bar ? 'bar' : 'line',
354
+ smooth: c.detailType === 'spline' || c.detailType === 'areaspline' || undefined,
355
+ showSymbol: false,
356
+ ...(area && !bar ? { areaStyle: {} } : {}),
357
+ ...(stacking ? { stack: 'total' } : {}),
358
+ ...(s.color ? { itemStyle: { color: s.color }, lineStyle: { color: s.color } } : {}),
359
+ data: (s.data ?? []).map((p) => [p.x, value(p)]),
360
+ }));
361
+ const b = base(c, series.length);
362
+ return {
363
+ ...b,
364
+ ...zoom,
365
+ grid: { ...b.grid, bottom: 58 },
366
+ xAxis: { type: (c.xAxisType ?? 'datetime') === 'datetime' ? 'time' : 'value' },
367
+ yAxis: { type: 'value', name: c.yAxisTitle, ...(stacking === 'percent' ? { max: 100 } : {}) },
368
+ series,
369
+ };
330
370
  },
331
371
  'line-column': (c) => {
332
372
  // ONE value axis (dual axis is banned) — series carry their own form
@@ -1,8 +1,13 @@
1
1
  import type { Options } from 'highcharts';
2
- import type { MasterDetailPoint, MasterDetailSeriesType, MasterDetailXAxisType } from '../../nile-master-detail-chart/nile-master-detail-chart.js';
2
+ import type { MasterDetailPoint, MasterDetailSeries, MasterDetailSeriesType, MasterDetailStacking, MasterDetailXAxisType } from '../../nile-master-detail-chart/nile-master-detail-chart.js';
3
3
  export interface ChartMasterDetailConfigType {
4
4
  type: 'master-detail';
5
- data: MasterDetailPoint[];
5
+ /** Single-series shorthand. Optional when `series` is given. */
6
+ data?: MasterDetailPoint[];
7
+ /** Several named series; when non-empty it replaces `data` / `seriesName` / `seriesColor`. */
8
+ series?: MasterDetailSeries[];
9
+ /** Stack the series on both panes. */
10
+ stacking?: MasterDetailStacking;
6
11
  seriesName?: string;
7
12
  seriesColor?: string;
8
13
  detailType?: MasterDetailSeriesType;
@@ -28,7 +28,7 @@ import type { HistogramSamples } from '../nile-histogram-chart/nile-histogram-ch
28
28
  import type { BellcurveSamples } from '../nile-bellcurve-chart/nile-bellcurve-chart.js';
29
29
  import type { BoxplotSeriesData } from '../nile-boxplot-chart/nile-boxplot-chart.js';
30
30
  import type { TimelineEvent } from '../nile-timeline-chart/nile-timeline-chart.js';
31
- import type { MasterDetailPoint } from '../nile-master-detail-chart/nile-master-detail-chart.js';
31
+ import type { MasterDetailPoint, MasterDetailSeries, MasterDetailStacking } from '../nile-master-detail-chart/nile-master-detail-chart.js';
32
32
  import type { DumbbellPoint } from '../nile-dumbbell-chart/nile-dumbbell-chart.js';
33
33
  import type { FanLinePoint, FanUncertaintyBand } from '../nile-fan-chart/nile-fan-chart.js';
34
34
  import type { FunnelDataPoint } from '../nile-funnel-chart/nile-funnel-chart.js';
@@ -410,7 +410,12 @@ export interface NileTimelineChartConfig extends NileChartConfigBase {
410
410
  }
411
411
  export interface NileMasterDetailChartConfig extends NileChartConfigBase {
412
412
  type: 'master-detail';
413
- data: MasterDetailPoint[];
413
+ /** Single-series shorthand. Optional when `series` is given. */
414
+ data?: MasterDetailPoint[];
415
+ /** Several named series; when non-empty it replaces `data` / `seriesName` / `seriesColor`. */
416
+ series?: MasterDetailSeries[];
417
+ /** Stack the series on both panes: `normal` or `percent`. */
418
+ stacking?: MasterDetailStacking;
414
419
  seriesName?: string;
415
420
  seriesColor?: string;
416
421
  detailType?: string;
@@ -150,6 +150,16 @@ export function isChartEmpty(config) {
150
150
  return false;
151
151
  return isFanEmpty(cfg.lineData, cfg.bands);
152
152
  }
153
+ if (type === 'master-detail' && Array.isArray(cfg.series) && cfg.series.length > 0) {
154
+ // Multi-series form: `series` is the dataset ({ name, data: { x, y }[] }[]), so
155
+ // it is empty only when no series has a plottable point.
156
+ const hasPoint = cfg.series.some((s) => Array.isArray(s?.data) && (s.data).some(isPlottablePoint));
157
+ if (hasPoint)
158
+ return false;
159
+ const optSeries = cfg.options?.series;
160
+ if (!(Array.isArray(optSeries) && optSeries.length > 0))
161
+ return true;
162
+ }
153
163
  const isKnown = SERIES_TYPES.has(type) || VALUE_POINT_TYPES.has(type) || LIST_ONLY_TYPES.has(type)
154
164
  || NUMERIC_LIST_TYPES.has(type);
155
165
  if (!isKnown)
@@ -1125,7 +1125,8 @@ export const styles = css `
1125
1125
  font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
1126
1126
  font-size: var(--nile-type-scale-4, var(--ng-font-size-text-md));
1127
1127
  font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
1128
- line-height: 1.4;
1128
+ /* room for the inline badge's padding and border, which overflow: hidden would clip */
1129
+ line-height: 1.75;
1129
1130
  color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
1130
1131
  }
1131
1132
 
@@ -1568,7 +1568,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
1568
1568
  ></nile-timeline-chart>`;
1569
1569
  case 'master-detail':
1570
1570
  return html `<nile-master-detail-chart
1571
- .data=${config.data}
1571
+ .data=${config.data ?? []}
1572
+ .series=${config.series ?? []}
1573
+ .stacking=${config.stacking ?? ''}
1572
1574
  .height=${this.hasAttribute('fit') ? null : (config.height ?? '100%')}
1573
1575
  .seriesName=${config.seriesName ?? ''}
1574
1576
  .seriesColor=${config.seriesColor ?? ''}
@@ -1,2 +1,2 @@
1
1
  export { NileKpiChart } from './nile-kpi-chart.js';
2
- export type { ChartKpiSeparatedPayload, KpiConfig, NileKpiConfigInputType, TrendDirection, KpiVariant, } from './nile-kpi-chart.js';
2
+ export type { ChartKpiSeparatedPayload, KpiConfig, NileKpiConfigInputType, TrendDirection, KpiVariant, KpiTitleOverflow, } from './nile-kpi-chart.js';
@@ -2,5 +2,5 @@
2
2
  * Global tooltip styles — injected once into document.head so the tooltip
3
3
  * element on document.body is styled independently of the shadow DOM.
4
4
  */
5
- export declare const tooltipCss = "\n .nile-kpi-tooltip {\n position: fixed;\n display: none;\n transform: translate(-50%, calc(-100% - 10px));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));\n font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));\n line-height: 1.4;\n padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-md, var(--ng-spacing-md));\n border-radius: var(--nile-radius-radius-xl, var(--ng-radius-sm));\n border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space: normal;\n max-width: 260px;\n word-break: break-word;\n z-index: 2;\n box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));\n }\n\n .nile-kpi-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n border: var(--nile-border-size-5, 5px) solid transparent;\n border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n .nile-kpi-marker {\n position: fixed;\n display: none;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n pointer-events: none;\n z-index: 1;\n }\n";
5
+ export declare const tooltipCss = "\n .nile-kpi-tooltip {\n position: fixed;\n display: none;\n transform: translate(-50%, calc(-100% - 10px));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));\n font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));\n line-height: 1.4;\n padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-md, var(--ng-spacing-md));\n border-radius: var(--nile-radius-radius-xl, var(--ng-radius-sm));\n border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space: normal;\n /* sizes to its text so it can't shrink to a one-character column near the window edge */\n width: max-content;\n /* border-box: max-width caps the total width, padding and border included */\n box-sizing: border-box;\n max-width: min(260px, calc(100vw - 16px));\n word-break: break-word;\n z-index: 2;\n box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));\n }\n\n /* _showTip() sets --nile-kpi-tip-arrow-x so the arrow keeps pointing at the data point */\n .nile-kpi-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: var(--nile-kpi-tip-arrow-x, 50%);\n transform: translateX(-50%);\n border: var(--nile-border-size-5, 5px) solid transparent;\n border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n\n /* No room above the point: sit below it, arrow on top. */\n .nile-kpi-tooltip[data-placement='bottom'] {\n transform: translate(-50%, 10px);\n }\n .nile-kpi-tooltip[data-placement='bottom']::after {\n top: auto;\n bottom: 100%;\n border-top-color: transparent;\n border-bottom-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n .nile-kpi-marker {\n position: fixed;\n display: none;\n width: 10px;\n height: 10px;\n border-radius: 50%;\n transform: translate(-50%, -50%);\n pointer-events: none;\n z-index: 1;\n }\n";
6
6
  export declare const styles: import("lit").CSSResult;
@@ -19,21 +19,37 @@ export const tooltipCss = `
19
19
  border: var(--nile-border-width-1, var(--ng-stroke-width-1)) solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
20
20
  pointer-events: none;
21
21
  white-space: normal;
22
- max-width: 260px;
22
+ /* sizes to its text so it can't shrink to a one-character column near the window edge */
23
+ width: max-content;
24
+ /* border-box: max-width caps the total width, padding and border included */
25
+ box-sizing: border-box;
26
+ max-width: min(260px, calc(100vw - 16px));
23
27
  word-break: break-word;
24
28
  z-index: 2;
25
29
  box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));
26
30
  }
27
31
 
32
+ /* _showTip() sets --nile-kpi-tip-arrow-x so the arrow keeps pointing at the data point */
28
33
  .nile-kpi-tooltip::after {
29
34
  content: '';
30
35
  position: absolute;
31
36
  top: 100%;
32
- left: 50%;
37
+ left: var(--nile-kpi-tip-arrow-x, 50%);
33
38
  transform: translateX(-50%);
34
39
  border: var(--nile-border-size-5, 5px) solid transparent;
35
40
  border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
36
41
  }
42
+
43
+ /* No room above the point: sit below it, arrow on top. */
44
+ .nile-kpi-tooltip[data-placement='bottom'] {
45
+ transform: translate(-50%, 10px);
46
+ }
47
+ .nile-kpi-tooltip[data-placement='bottom']::after {
48
+ top: auto;
49
+ bottom: 100%;
50
+ border-top-color: transparent;
51
+ border-bottom-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
52
+ }
37
53
  .nile-kpi-marker {
38
54
  position: fixed;
39
55
  display: none;
@@ -172,6 +188,29 @@ export const styles = css `
172
188
  flex-shrink: 0;
173
189
  }
174
190
 
191
+ /* The 3-line clamp is on the inner span, not the <p>, so the <p>'s display stays under the card's visibility rules */
192
+ :host([variant='compact']) .kpi-label {
193
+ white-space: normal;
194
+ text-overflow: clip;
195
+ }
196
+
197
+ :host([variant='compact']) .kpi-label-text {
198
+ display: -webkit-box;
199
+ -webkit-box-orient: vertical;
200
+ /* _fitDescription lowers --kpi-title-lines when the title would push the value out of the card */
201
+ -webkit-line-clamp: var(--kpi-title-lines, 3);
202
+ line-clamp: var(--kpi-title-lines, 3);
203
+ overflow: hidden;
204
+ text-overflow: ellipsis;
205
+ overflow-wrap: normal;
206
+ word-break: normal;
207
+ }
208
+
209
+ :host([variant='compact'][title-overflow='break']) .kpi-label,
210
+ :host([variant='compact'][title-overflow='break']) .kpi-label-text {
211
+ overflow-wrap: anywhere;
212
+ }
213
+
175
214
  .kpi-value-row {
176
215
  display: flex;
177
216
  align-items: center;
@@ -394,6 +433,11 @@ export const styles = css `
394
433
  flex-shrink: 0;
395
434
  }
396
435
 
436
+ /* set when the title leaves the compact sparkline less than its minimum height */
437
+ :host([variant='compact'][data-hide-spark]) .kpi-sparkline {
438
+ display: none;
439
+ }
440
+
397
441
  /* Set by the component when the card is too short to show the description whole. */
398
442
  :host([data-hide-desc][data-hide-desc]) .kpi-description,
399
443
  :host([data-hide-desc][data-hide-desc]) .kpi-forecast {
@@ -647,10 +691,15 @@ export const styles = css `
647
691
  display: inline-flex;
648
692
  }
649
693
 
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 {
694
+ /* the title stays visible beside header controls even where the short-card rules hide it */
695
+ :host([variant='compact'][has-header-lead]) .kpi-label,
696
+ :host([variant='compact'][has-header-actions]) .kpi-label {
697
+ display: block;
698
+ }
699
+
700
+ /* with lead/actions present the title wraps instead of truncating, so it never runs under the controls */
701
+ :host([has-header-lead]:not([variant='compact'])) .kpi-label,
702
+ :host([has-header-actions]:not([variant='compact'])) .kpi-label {
654
703
  white-space: normal;
655
704
  overflow: visible;
656
705
  text-overflow: clip;
@@ -659,8 +708,8 @@ export const styles = css `
659
708
  word-break: normal;
660
709
  }
661
710
 
662
- :host([has-header-lead]) .kpi-label-text,
663
- :host([has-header-actions]) .kpi-label-text {
711
+ :host([has-header-lead]:not([variant='compact'])) .kpi-label-text,
712
+ :host([has-header-actions]:not([variant='compact'])) .kpi-label-text {
664
713
  /* clip (not hidden) so the text stays part of the line-clamp's flow */
665
714
  overflow: clip;
666
715
  text-overflow: ellipsis;
@@ -691,8 +740,8 @@ export const styles = css `
691
740
 
692
741
  /* A wrapping title is capped by card height so a long one can't push the value and
693
742
  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 {
743
+ :host([has-header-lead]:not([variant='compact'])) .kpi-label,
744
+ :host([has-header-actions]:not([variant='compact'])) .kpi-label {
696
745
  display: -webkit-box;
697
746
  -webkit-box-orient: vertical;
698
747
  -webkit-line-clamp: 4;
@@ -700,35 +749,47 @@ export const styles = css `
700
749
  }
701
750
 
702
751
  @container (max-height: 230px) {
703
- :host([has-header-lead]) .kpi-label,
704
- :host([has-header-actions]) .kpi-label {
752
+ :host([has-header-lead]:not([variant='compact'])) .kpi-label,
753
+ :host([has-header-actions]:not([variant='compact'])) .kpi-label {
705
754
  -webkit-line-clamp: 3;
706
755
  }
707
756
  }
708
757
 
709
758
  /* Very short cards: two lines. Anything taller keeps three, and the sparkline gives way instead. */
710
759
  @container (max-height: 125px) {
711
- :host([has-header-lead]) .kpi-label,
712
- :host([has-header-actions]) .kpi-label {
760
+ :host([has-header-lead]:not([variant='compact'])) .kpi-label,
761
+ :host([has-header-actions]:not([variant='compact'])) .kpi-label {
713
762
  -webkit-line-clamp: 2;
714
763
  }
715
764
  }
716
765
 
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
766
  .kpi-header-controls {
720
767
  display: contents;
721
768
  }
722
769
 
723
- :host([has-header-lead]) .kpi-header,
724
- :host([has-header-actions]) .kpi-header {
770
+ /* title and controls sit side by side, so the title's first line starts level with the controls */
771
+ :host([variant='compact'][has-header-lead]) .kpi-header,
772
+ :host([variant='compact'][has-header-actions]) .kpi-header {
773
+ display: flex;
774
+ align-items: flex-start;
775
+ gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
776
+ }
777
+
778
+ :host([variant='compact'][has-header-lead]) .kpi-header .kpi-tip:not([data-kpi-tip='trend']),
779
+ :host([variant='compact'][has-header-actions]) .kpi-header .kpi-tip:not([data-kpi-tip='trend']) {
780
+ display: block;
781
+ }
782
+
783
+ /* the trend, mover and actions float top-right and the title wraps around them via a spacer on its first lines */
784
+ :host([has-header-lead]:not([variant='compact'])) .kpi-header,
785
+ :host([has-header-actions]:not([variant='compact'])) .kpi-header {
725
786
  display: block;
726
787
  position: relative;
727
788
  min-height: var(--kpi-controls-h, 0px);
728
789
  }
729
790
 
730
- :host([has-header-lead]) .kpi-header-controls,
731
- :host([has-header-actions]) .kpi-header-controls {
791
+ :host([has-header-lead]:not([variant='compact'])) .kpi-header-controls,
792
+ :host([has-header-actions]:not([variant='compact'])) .kpi-header-controls {
732
793
  display: flex;
733
794
  position: absolute;
734
795
  top: 0;
@@ -737,23 +798,23 @@ export const styles = css `
737
798
  gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
738
799
  }
739
800
 
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']) {
801
+ :host([has-header-lead]:not([variant='compact'])) .kpi-header .kpi-tip:not([data-kpi-tip='trend']),
802
+ :host([has-header-actions]:not([variant='compact'])) .kpi-header .kpi-tip:not([data-kpi-tip='trend']) {
742
803
  display: block;
743
804
  min-width: 0;
744
805
  width: 100%;
745
806
  }
746
807
 
747
- :host([has-header-lead]) .kpi-header .kpi-label-text::before,
748
- :host([has-header-actions]) .kpi-header .kpi-label-text::before {
808
+ :host([has-header-lead]:not([variant='compact'])) .kpi-header .kpi-label-text::before,
809
+ :host([has-header-actions]:not([variant='compact'])) .kpi-header .kpi-label-text::before {
749
810
  content: '';
750
811
  float: right;
751
812
  width: calc(var(--kpi-controls-w, 0px) + var(--nile-spacing-xs, var(--ng-spacing-xs)));
752
813
  height: var(--kpi-controls-h, 0px);
753
814
  }
754
815
 
755
- :host([has-header-lead]) .kpi-header .kpi-label-text,
756
- :host([has-header-actions]) .kpi-header .kpi-label-text {
816
+ :host([has-header-lead]:not([variant='compact'])) .kpi-header .kpi-label-text,
817
+ :host([has-header-actions]:not([variant='compact'])) .kpi-header .kpi-label-text {
757
818
  display: block;
758
819
  }
759
820
 
@@ -932,13 +993,6 @@ export const styles = css `
932
993
  display: inline-flex;
933
994
  }
934
995
 
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
996
  /* 1. The sparkline stays at every size; it only goes when the card is too short for anything else. */
943
997
  @container (max-height: 72px) {
944
998
  :host([variant='compact']) .kpi-sparkline {
@@ -8,6 +8,8 @@ export type SparklineType = 'area' | 'line' | 'column' | 'bar' | 'spline' | 'are
8
8
  export type KpiValueFormat = 'auto' | 'K' | 'M' | 'B' | 'T' | 'none';
9
9
  export type KpiNumberSystem = 'indian' | 'international';
10
10
  export type KpiInfoPlacement = 'top-right' | 'center-right' | 'bottom-right' | 'top-left' | 'center-left' | 'bottom-left';
11
+ /** How compact titles handle an oversized word: `'ellipsis'` cuts it with `…`, `'break'` splits it. */
12
+ export type KpiTitleOverflow = 'ellipsis' | 'break';
11
13
  /** `chart` slice for `<nile-kpi-chart>.config` (discriminated by `type: 'kpi'`). */
12
14
  export interface ChartKpiSeparatedPayload {
13
15
  type: 'kpi';
@@ -82,6 +84,8 @@ export interface ChartKpiSeparatedPayload {
82
84
  loadingText?: string;
83
85
  /** Whether the hover tooltip is shown on value / sparkline / gauge (default: true). */
84
86
  tooltipEnabled?: boolean;
87
+ /** How the compact title handles text that doesn't fit; see `KpiTitleOverflow`. */
88
+ titleOverflow?: KpiTitleOverflow;
85
89
  /** Accent bar colour for the 'accent' variant (default: brand blue). */
86
90
  accentColor?: string;
87
91
  cardBackground?: string;
@@ -149,6 +153,8 @@ export declare class NileKpiChart extends NileElement {
149
153
  private sparklineChart;
150
154
  private gaugeChart;
151
155
  private resizeObserver;
156
+ /** Pending late re-check of the sparkline size (see initSparkline). */
157
+ private _sparkSettleTimer;
152
158
  /** Latched once the fit safety-net has fallen back to inline-size (see _reconcileFit). */
153
159
  private _fitInlineFallback;
154
160
  /** Tooltip element on document.body — outside shadow DOM, never clipped. */
@@ -264,6 +270,8 @@ export declare class NileKpiChart extends NileElement {
264
270
  loadingText: string;
265
271
  /** Whether the hover tooltip is shown on value / sparkline / gauge. */
266
272
  tooltipEnabled: boolean;
273
+ /** How the compact title handles text that doesn't fit; see `KpiTitleOverflow`. */
274
+ titleOverflow: KpiTitleOverflow;
267
275
  cardBackground: string;
268
276
  cardBorderColor: string;
269
277
  cardBorderWidth: string | number;
@@ -350,9 +358,7 @@ export declare class NileKpiChart extends NileElement {
350
358
  */
351
359
  private _fitDescription;
352
360
  /**
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.
361
+ * True when `el` shows less than its full text. Chrome hides -webkit-line-clamp lines without reporting overflow, so the clamp is lifted for one measurement.
356
362
  */
357
363
  private _isLabelTruncated;
358
364
  private _syncTruncationTips;
@@ -373,8 +379,7 @@ export declare class NileKpiChart extends NileElement {
373
379
  /** Mirrors the header slots' content onto the host (`has-header-lead` / `has-header-actions`). */
374
380
  private _onHeaderSlotChange;
375
381
  /**
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.
382
+ * Sizes the spacer the title wraps around beside floating header controls; compact lays them out side by side and skips it.
378
383
  */
379
384
  private _controlsObserved;
380
385
  private _syncHeaderControls;