@aquera/nile-visualization 2.9.37 → 2.9.39

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.
@@ -1,2 +1,4 @@
1
1
  import { type TemplateResult } from 'lit';
2
2
  export declare function renderChartSkeleton(chartType: string | undefined): TemplateResult;
3
+ /** Static, decorative ghost for the empty state: solid shapes only, no loading semantics. */
4
+ export declare function renderChartGhost(chartType: string | undefined): TemplateResult;
@@ -181,4 +181,13 @@ export function renderChartSkeleton(chartType) {
181
181
  const v = variantFor(chartType);
182
182
  return html `<div part="skeleton skeleton-${v}" class="nile-chart-skeleton nile-chart-skeleton--${v}" aria-busy="true" aria-label="Loading chart">${renderBody(v)}</div>`;
183
183
  }
184
+ // ── Empty-state ghost: separate from the default skeleton above, which it does not alter ──
185
+ // Line-like charts have no solid shape of their own, so the ghost uses columns.
186
+ const GHOST_AS_COLUMNS = new Set(['line', 'trendline', 'anomaly']);
187
+ /** Static, decorative ghost for the empty state: solid shapes only, no loading semantics. */
188
+ export function renderChartGhost(chartType) {
189
+ const base = variantFor(chartType);
190
+ const v = GHOST_AS_COLUMNS.has(base) ? 'columns' : base;
191
+ return html `<div part="skeleton skeleton-${v} skeleton-ghost" class="nile-chart-skeleton nile-chart-skeleton--${v} nile-chart-skeleton--ghost" aria-hidden="true">${renderBody(v)}</div>`;
192
+ }
184
193
  //# sourceMappingURL=nile-chart-skeleton.js.map
@@ -0,0 +1 @@
1
+ import './nile-chart';
@@ -0,0 +1,137 @@
1
+ /**
2
+ * The default loading skeleton (renderChartSkeleton) and the empty-state ghost
3
+ * (renderChartGhost) are separate rendering paths. These tests pin the default path
4
+ * and prove the ghost's substitutions, styles and semantics never reach it.
5
+ */
6
+ import { expect, fixture, html } from '@open-wc/testing';
7
+ import { render } from 'lit';
8
+ import './nile-chart';
9
+ import { renderChartSkeleton, renderChartGhost } from './nile-chart-skeleton';
10
+ const mount = (tpl) => {
11
+ const host = document.createElement('div');
12
+ render(tpl, host);
13
+ return host.firstElementChild;
14
+ };
15
+ // One representative chart type per skeleton family, plus an unmapped type (falls back to bars).
16
+ const FAMILY_BY_TYPE = {
17
+ column: 'columns', line: 'line', area: 'line', trendline: 'trendline', anomaly: 'anomaly',
18
+ pie: 'pie', scatter: 'scatter', heatmap: 'heatmap', radar: 'radar', timeline: 'timeline',
19
+ kpi: 'kpi', grid: 'grid', filter: 'filter', somethingUnmapped: 'bars',
20
+ };
21
+ const settle = async (el) => {
22
+ await el.updateComplete;
23
+ await el.updateComplete;
24
+ await new Promise(requestAnimationFrame);
25
+ };
26
+ describe('default skeleton vs empty-state ghost', () => {
27
+ describe('default skeleton (renderChartSkeleton) is unchanged', () => {
28
+ it('takes only the chart type; there is no ghost option on the default path', () => {
29
+ expect(renderChartSkeleton.length).to.equal(1);
30
+ });
31
+ for (const [type, family] of Object.entries(FAMILY_BY_TYPE)) {
32
+ it(`${type} renders the "${family}" skeleton with loading semantics and nothing ghost-related`, () => {
33
+ const sk = mount(renderChartSkeleton(type));
34
+ expect(sk.className).to.equal(`nile-chart-skeleton nile-chart-skeleton--${family}`);
35
+ expect(sk.getAttribute('part')).to.equal(`skeleton skeleton-${family}`);
36
+ expect(sk.getAttribute('aria-busy')).to.equal('true');
37
+ expect(sk.getAttribute('aria-label')).to.equal('Loading chart');
38
+ expect(sk.hasAttribute('aria-hidden')).to.be.false;
39
+ expect(sk.querySelector('.nile-chart-skeleton--ghost')).to.be.null;
40
+ });
41
+ }
42
+ it('line, trendline and anomaly keep their own line shapes (no column substitution)', () => {
43
+ for (const type of ['line', 'area', 'trendline', 'anomaly']) {
44
+ const sk = mount(renderChartSkeleton(type));
45
+ expect(sk.querySelector('.nile-chart-skeleton-line'), type).to.exist;
46
+ expect(sk.querySelector('.nile-chart-skeleton-columns'), type).to.be.null;
47
+ expect(sk.className, type).to.not.contain('--columns');
48
+ }
49
+ });
50
+ it('keeps its axis row, where the ghost has none', () => {
51
+ expect(mount(renderChartSkeleton('column')).querySelector('.nile-chart-skeleton-xaxis-row')).to.exist;
52
+ });
53
+ });
54
+ describe('ghost (renderChartGhost) is a separate, decorative path', () => {
55
+ it('is hidden from assistive tech and carries no loading semantics', () => {
56
+ const g = mount(renderChartGhost('column'));
57
+ expect(g.getAttribute('aria-hidden')).to.equal('true');
58
+ expect(g.hasAttribute('aria-busy')).to.be.false;
59
+ expect(g.hasAttribute('aria-label')).to.be.false;
60
+ expect(g.classList.contains('nile-chart-skeleton--ghost')).to.be.true;
61
+ expect(g.getAttribute('part')).to.contain('skeleton-ghost');
62
+ });
63
+ it('substitutes solid columns for line, trendline and anomaly (and area) only in ghost mode', () => {
64
+ for (const type of ['line', 'area', 'trendline', 'anomaly']) {
65
+ const g = mount(renderChartGhost(type));
66
+ expect(g.className, type).to.contain('--columns');
67
+ expect(g.querySelector('.nile-chart-skeleton-columns'), type).to.exist;
68
+ }
69
+ });
70
+ it('keeps every other family as it is', () => {
71
+ for (const type of ['column', 'pie', 'scatter', 'heatmap', 'radar', 'timeline', 'kpi', 'grid', 'filter', 'somethingUnmapped']) {
72
+ const g = mount(renderChartGhost(type));
73
+ expect(g.className, type).to.contain(`--${FAMILY_BY_TYPE[type]}`);
74
+ }
75
+ });
76
+ });
77
+ describe('ghost renders leave no trace on later default renders', () => {
78
+ const htmlOf = (tpl) => {
79
+ const host = document.createElement('div');
80
+ render(tpl, host);
81
+ return host.innerHTML;
82
+ };
83
+ const TYPES = [...Object.keys(FAMILY_BY_TYPE), undefined];
84
+ it('a default render after ghost renders is identical to one taken before them', () => {
85
+ const before = TYPES.map((t) => htmlOf(renderChartSkeleton(t)));
86
+ for (const t of TYPES) {
87
+ htmlOf(renderChartGhost(t));
88
+ htmlOf(renderChartGhost(t));
89
+ }
90
+ const after = TYPES.map((t) => htmlOf(renderChartSkeleton(t)));
91
+ expect(after).to.deep.equal(before);
92
+ });
93
+ it('interleaving ghost and default renders for the same type keeps each output stable', () => {
94
+ for (const t of ['line', 'trendline', 'anomaly', 'column']) {
95
+ const skeleton = htmlOf(renderChartSkeleton(t));
96
+ const ghost = htmlOf(renderChartGhost(t));
97
+ expect(htmlOf(renderChartSkeleton(t)), `${t} skeleton`).to.equal(skeleton);
98
+ expect(htmlOf(renderChartGhost(t)), `${t} ghost`).to.equal(ghost);
99
+ expect(skeleton, t).to.not.equal(ghost);
100
+ }
101
+ });
102
+ });
103
+ describe('in <nile-chart>', () => {
104
+ it('loading shows the default skeleton: no ghost wrapper, class, or ghost styles', async () => {
105
+ const el = await fixture(html `<nile-chart loading></nile-chart>`);
106
+ el.config = { chart: { type: 'column', data: [], categories: ['a'] }, aq: {} };
107
+ await settle(el);
108
+ const root = el.shadowRoot;
109
+ const sk = root.querySelector('.nile-chart-skeleton');
110
+ expect(sk).to.exist;
111
+ expect(sk.getAttribute('aria-busy')).to.equal('true');
112
+ expect(root.querySelector('.nile-chart-skeleton--ghost')).to.be.null;
113
+ expect(root.querySelector('.nile-chart-empty__ghost')).to.be.null;
114
+ // Ghost CSS must not apply: the axis row is shown and the fill still animates.
115
+ const xrow = sk.querySelector('.nile-chart-skeleton-xaxis-row');
116
+ expect(getComputedStyle(xrow).display).to.not.equal('none');
117
+ const fill = sk.querySelector('.nile-chart-skeleton-fill');
118
+ expect(getComputedStyle(fill).animationName).to.not.equal('none');
119
+ });
120
+ it('a ghost colour variable on the host does not recolour the default skeleton', async () => {
121
+ const el = await fixture(html `<nile-chart loading style="--nile-chart-ghost-color: rgb(255, 0, 0)"></nile-chart>`);
122
+ el.config = { chart: { type: 'column', data: [], categories: ['a'] }, aq: {} };
123
+ await settle(el);
124
+ const fill = el.shadowRoot.querySelector('.nile-chart-skeleton-fill');
125
+ expect(getComputedStyle(fill).backgroundColor).to.not.equal('rgb(255, 0, 0)');
126
+ });
127
+ it('the empty state shows the ghost, and not the default skeleton', async () => {
128
+ const el = await fixture(html `<nile-chart></nile-chart>`);
129
+ el.config = { chart: { type: 'line', data: [], categories: ['a'] }, aq: {} };
130
+ await settle(el);
131
+ const root = el.shadowRoot;
132
+ expect(root.querySelector('.nile-chart-empty__ghost .nile-chart-skeleton--ghost')).to.exist;
133
+ expect(root.querySelector('.nile-chart-skeleton[aria-busy="true"]')).to.be.null;
134
+ });
135
+ });
136
+ });
137
+ //# sourceMappingURL=nile-chart-skeleton.test.js.map
@@ -196,6 +196,12 @@ export const styles = css `
196
196
  flex: 0 1 auto;
197
197
  }
198
198
 
199
+ .nile-chart-header-info-tip {
200
+ display: inline-flex;
201
+ align-items: center;
202
+ flex: 0 0 auto;
203
+ }
204
+
199
205
  .nile-chart-header-info {
200
206
  display: inline-flex;
201
207
  align-items: center;
@@ -1014,6 +1020,129 @@ export const styles = css `
1014
1020
  justify-content: center;
1015
1021
  }
1016
1022
 
1023
+ /* ── Empty state (replaces the plotting area when there is nothing to plot) ── */
1024
+
1025
+ .nile-chart-empty {
1026
+ position: relative;
1027
+ display: flex;
1028
+ flex-direction: column;
1029
+ align-items: center;
1030
+ /* "safe" top-aligns when content is taller than the cell; plain value is the fallback. */
1031
+ justify-content: center;
1032
+ justify-content: safe center;
1033
+ gap: var(--nile-spacing-md, var(--ng-spacing-md));
1034
+ width: 100%;
1035
+ height: 100%;
1036
+ min-height: var(--nile-chart-min-height, var(--nile-height-200px, var(--ng-height-200px)));
1037
+ padding: var(--nile-spacing-3xl, var(--ng-spacing-3xl));
1038
+ box-sizing: border-box;
1039
+ text-align: center;
1040
+ }
1041
+
1042
+ :host([fit]) .nile-chart-empty {
1043
+ min-height: 0;
1044
+ }
1045
+
1046
+ :host([fit]) .nile-chart-empty__description {
1047
+ -webkit-line-clamp: 3;
1048
+ line-clamp: 3;
1049
+ }
1050
+
1051
+ /* Ghost behind the message: static, non-interactive. Slot "empty-ghost" replaces it. */
1052
+ .nile-chart-empty__ghost {
1053
+ display: block;
1054
+ position: absolute;
1055
+ inset: 0;
1056
+ pointer-events: none;
1057
+ overflow: hidden;
1058
+ opacity: var(--ng-opacity-20);
1059
+ }
1060
+ .nile-chart-skeleton--ghost {
1061
+ --nile-colors-neutral-400: var(--nile-chart-ghost-color, var(--ng-colors-border-primary));
1062
+ --nile-colors-neutral-300: var(--ng-colors-border-secondary);
1063
+ }
1064
+ /* Shapes only: no axis rules, axis labels or legend. */
1065
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-xaxis-row,
1066
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-ylabel-sk,
1067
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-legend { display: none; }
1068
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-body,
1069
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-columns,
1070
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-scatter { padding-left: 0; }
1071
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-body::before,
1072
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-columns::before,
1073
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-columns::after,
1074
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-scatter::before,
1075
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-scatter::after { display: none; }
1076
+ /* Static. */
1077
+ .nile-chart-skeleton--ghost *,
1078
+ .nile-chart-skeleton--ghost *::before,
1079
+ .nile-chart-skeleton--ghost *::after,
1080
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-kpi-spark path { animation: none; }
1081
+ .nile-chart-skeleton--ghost nile-skeleton-loader::part(skeleton) { animation: none; opacity: 1; }
1082
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-fill,
1083
+ .nile-chart-skeleton--ghost .nile-chart-skeleton-radar-data { opacity: 1; }
1084
+ .nile-chart-empty__ghost ::slotted(*) {
1085
+ width: 100%;
1086
+ height: 100%;
1087
+ object-fit: contain;
1088
+ }
1089
+
1090
+ /* <nile-lite-tooltip> wrappers around the title / description. */
1091
+ .nile-chart-empty__tip {
1092
+ position: relative;
1093
+ z-index: 1;
1094
+ display: flex;
1095
+ flex-direction: column;
1096
+ flex-shrink: 0;
1097
+ max-width: 100%;
1098
+ }
1099
+
1100
+ .nile-chart-empty__tip[hidden] {
1101
+ display: none;
1102
+ }
1103
+
1104
+ /* Gray badge around the title; a slotted empty-title changes the text, not the badge. Style it with ::part(empty-badge). */
1105
+ .nile-chart-empty__badge {
1106
+ display: inline;
1107
+ box-decoration-break: clone;
1108
+ -webkit-box-decoration-break: clone;
1109
+ padding: var(--ng-spacing-xxs) var(--ng-spacing-md-alt);
1110
+ border: var(--ng-border-width-1) solid var(--ng-componentcolors-utility-gray-300);
1111
+ border-radius: var(--ng-radius-full);
1112
+ background: var(--ng-componentcolors-utility-gray-50);
1113
+ color: var(--ng-componentcolors-utility-gray-700);
1114
+ font-size: var(--ng-font-size-text-sm);
1115
+ font-weight: var(--ng-font-weight-medium);
1116
+ }
1117
+ /* A long title clamps to two lines with an ellipsis; the tooltip shows it in full. */
1118
+ .nile-chart-empty__title {
1119
+ display: -webkit-box;
1120
+ -webkit-box-orient: vertical;
1121
+ -webkit-line-clamp: 2;
1122
+ line-clamp: 2;
1123
+ overflow: hidden;
1124
+ overflow-wrap: anywhere;
1125
+ font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
1126
+ font-size: var(--nile-type-scale-4, var(--ng-font-size-text-md));
1127
+ font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
1128
+ line-height: 1.4;
1129
+ color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
1130
+ }
1131
+
1132
+ /* nile-chart-empty.ts sets an inline line-clamp when it must cut the text; otherwise no clamp (3 lines in fit mode). */
1133
+ .nile-chart-empty__description {
1134
+ display: -webkit-box;
1135
+ -webkit-box-orient: vertical;
1136
+ -webkit-line-clamp: none;
1137
+ line-clamp: none;
1138
+ overflow: hidden;
1139
+ overflow-wrap: anywhere;
1140
+ font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
1141
+ font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
1142
+ line-height: 1.5;
1143
+ color: var(--nile-colors-neutral-500, var(--ng-colors-text-tertiary-600));
1144
+ }
1145
+
1017
1146
  @media (prefers-reduced-motion: reduce) {
1018
1147
  .nile-chart-skeleton-line-area,
1019
1148
  .nile-chart-skeleton-line-stroke,
@@ -86,7 +86,6 @@ import '../nile-ai-panel/index.js';
86
86
  export declare class NileChart extends NileElement {
87
87
  static styles: CSSResultGroup;
88
88
  private _headerTipEl;
89
- private _headerInfoTipActive;
90
89
  private _headerResizeObs;
91
90
  /** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
92
91
  config: NileChartConfig | NileChartConfigInputType | null;
@@ -187,7 +186,14 @@ export declare class NileChart extends NileElement {
187
186
  /** Resolve { chart, aq } input to flat NileChartConfig. */
188
187
  private resolveConfig;
189
188
  private resolvedConfig;
189
+ private gridLineStrengthFromConfig;
190
+ /** Sets the gridline strength variable from the config (number → %, or a `%` string). Only a value set here is ever removed, so a CSS variable set in markup is left alone. */
191
+ private applyGridLineStrength;
190
192
  protected updated(changedProperties: PropertyValues): void;
193
+ private _emptyEl;
194
+ private _emptyObs;
195
+ /** Keeps the empty state's truncation tooltips in step with its size and slotted text. */
196
+ private _syncEmptyState;
191
197
  private closeMenu;
192
198
  private toggleChat;
193
199
  /** Push an AI response into the chat panel. Call this from your AI handler. */
@@ -250,8 +256,6 @@ export declare class NileChart extends NileElement {
250
256
  private _showHeaderTip;
251
257
  private _hideHeaderTip;
252
258
  private _onViewportMove;
253
- private _onHeaderInfoEnter;
254
- private _onHeaderInfoKeydown;
255
259
  /** Info icon beside the header title. Tooltip, focus and ARIA live on the wrapper, not the glyph. */
256
260
  private renderHeaderInfo;
257
261
  private _onHeaderTextEnter;
@@ -265,6 +269,7 @@ export declare class NileChart extends NileElement {
265
269
  private _initEcharts;
266
270
  private renderChartContent;
267
271
  private renderSkeleton;
272
+ private renderEmptyState;
268
273
  render(): TemplateResult;
269
274
  }
270
275
  declare global {
@@ -8,6 +8,7 @@ import { styles, tooltipCss, injectGlobalChartMenuOverrides } from './nile-chart
8
8
  import { HIGHCHARTS_PASSTHROUGH_KEYS } from '../internal/types/index.js';
9
9
  import { nileChartConfig } from './nile-chart-config-builder.js';
10
10
  import { renderChartSkeleton } from './nile-chart-skeleton.js';
11
+ import { isChartEmpty, renderChartEmptyState, syncChartEmptyTruncation } from './nile-chart-empty.js';
11
12
  import { convertConfig } from '../internal/utils/chart-adapters.js';
12
13
  import { deepMerge } from '../internal/utils/deep-merge.js';
13
14
  import { initNileChartExporting, getHighcharts } from '../internal/utils/highcharts-provider.js';
@@ -166,7 +167,6 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
166
167
  constructor() {
167
168
  super(...arguments);
168
169
  this._headerTipEl = null;
169
- this._headerInfoTipActive = false;
170
170
  this._headerResizeObs = null;
171
171
  /** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
172
172
  this.config = null;
@@ -285,20 +285,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
285
285
  }
286
286
  };
287
287
  this.resolvedConfig = null;
288
+ this.gridLineStrengthFromConfig = false;
289
+ this._emptyEl = null;
290
+ this._emptyObs = null;
288
291
  // The tooltip is fixed to the viewport and placed once, so any scroll (including a touch-drag while the
289
292
  // finger is still down, when no leave/blur fires) would strand it away from its anchor. Hide it instead.
290
293
  this._onViewportMove = () => this._hideHeaderTip();
291
- // Reveal the full text when a title/subtitle is truncated. Accepts any Event
292
- // so it works for BOTH pointer (mouseenter) and keyboard (focus) users.
293
- this._onHeaderInfoEnter = (e) => {
294
- const rect = e.currentTarget.getBoundingClientRect();
295
- this._showHeaderTip(String(this.headerInfo('chartInfo') ?? ''), rect.left + rect.width / 2, rect.top, rect.height);
296
- this._headerInfoTipActive = true;
297
- };
298
- this._onHeaderInfoKeydown = (e) => {
299
- if (e.key === 'Escape')
300
- this._hideHeaderTip();
301
- };
302
294
  this._onHeaderTextEnter = (e) => {
303
295
  const el = e.currentTarget;
304
296
  if (el.scrollWidth <= el.clientWidth)
@@ -406,6 +398,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
406
398
  this._headerTipEl = null;
407
399
  this._headerResizeObs?.disconnect();
408
400
  this._headerResizeObs = null;
401
+ this._emptyObs?.disconnect();
402
+ this._emptyObs = null;
403
+ this._emptyEl = null;
409
404
  this._teardownExtremesEvents();
410
405
  this._disposeEcharts();
411
406
  this._readyResolvers = [];
@@ -426,10 +421,19 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
426
421
  }
427
422
  return this.mergeChartTypeFromAttr({ ...input });
428
423
  }
424
+ /** Sets the gridline strength variable from the config (number → %, or a `%` string). Only a value set here is ever removed, so a CSS variable set in markup is left alone. */
425
+ applyGridLineStrength(value) {
426
+ const pct = typeof value === 'number' ? `${value}%` : typeof value === 'string' ? value.trim() : '';
427
+ if (/^\d+(\.\d+)?%$/.test(pct) && parseFloat(pct) <= 100) {
428
+ this.style.setProperty('--nile-chart-grid-line-strength', pct);
429
+ this.gridLineStrengthFromConfig = true;
430
+ }
431
+ else if (this.gridLineStrengthFromConfig) {
432
+ this.style.removeProperty('--nile-chart-grid-line-strength');
433
+ this.gridLineStrengthFromConfig = false;
434
+ }
435
+ }
429
436
  updated(changedProperties) {
430
- // The icon can disappear (config swap, drill-down) with the pointer still on it, so no leave/blur ever fires.
431
- if (this._headerInfoTipActive && !this.shadowRoot?.querySelector('.nile-chart-header-info'))
432
- this._hideHeaderTip();
433
437
  if (changedProperties.has('engine')) {
434
438
  this._echartsFallback = false; // re-evaluate on every engine flip
435
439
  if (this.engine !== 'echarts')
@@ -454,6 +458,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
454
458
  this.noBorder = resolved.noBorder === true;
455
459
  if (resolved.appearance && this.appearance !== resolved.appearance)
456
460
  this.appearance = resolved.appearance;
461
+ this.applyGridLineStrength(resolved.gridLineStrength);
457
462
  }
458
463
  if (this.activeType) {
459
464
  this.setAttribute('data-active-type', this.activeType);
@@ -468,6 +473,27 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
468
473
  this.toggleAttribute('data-has-date-picker', hasDatePicker);
469
474
  // Keep truncated-title focusability in sync after any re-render.
470
475
  this._syncHeaderTruncationA11y();
476
+ this._syncEmptyState();
477
+ }
478
+ /** Keeps the empty state's truncation tooltips in step with its size and slotted text. */
479
+ _syncEmptyState() {
480
+ const el = this.shadowRoot?.querySelector('.nile-chart-empty') ?? null;
481
+ if (el !== this._emptyEl) {
482
+ this._emptyObs?.disconnect();
483
+ this._emptyEl = el;
484
+ if (el) {
485
+ if (!this._emptyObs) {
486
+ this._emptyObs = new ResizeObserver(() => {
487
+ if (this._emptyEl)
488
+ syncChartEmptyTruncation(this._emptyEl);
489
+ });
490
+ }
491
+ this._emptyObs.observe(el);
492
+ el.addEventListener('slotchange', () => syncChartEmptyTruncation(el));
493
+ }
494
+ }
495
+ if (el)
496
+ syncChartEmptyTruncation(el);
471
497
  }
472
498
  closeMenu() {
473
499
  const dropdown = this.shadowRoot?.querySelector('.nile-chart-menu-anchor');
@@ -810,7 +836,6 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
810
836
  this._headerTipEl.style.top = `${y + anchorHeight}px`;
811
837
  }
812
838
  _hideHeaderTip() {
813
- this._headerInfoTipActive = false;
814
839
  if (this._headerTipEl)
815
840
  this._headerTipEl.style.display = 'none';
816
841
  window.removeEventListener('scroll', this._onViewportMove, true);
@@ -822,23 +847,18 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
822
847
  if (!info)
823
848
  return nothing;
824
849
  const size = this.headerInfo('chartInfoIconSize');
825
- return html `<span
850
+ return html `<nile-lite-tooltip class="nile-chart-header-info-tip" content=${info} placement="top"><span
826
851
  class="nile-chart-header-info"
827
852
  part="header-info"
828
853
  role="img"
829
854
  tabindex="0"
830
855
  aria-label=${info}
831
- @mouseenter=${this._onHeaderInfoEnter}
832
- @mouseleave=${() => this._hideHeaderTip()}
833
- @focus=${this._onHeaderInfoEnter}
834
- @blur=${() => this._hideHeaderTip()}
835
- @keydown=${this._onHeaderInfoKeydown}
836
856
  ><nile-glyph
837
857
  name=${this.headerInfo('chartInfoIcon') || 'ng-info-circle'}
838
858
  method=${this.headerInfo('chartInfoIconMethod') || 'stroke'}
839
859
  size=${ifDefined(size === '' || size == null ? undefined : size)}
840
860
  color=${this.headerInfo('chartInfoIconColor') || 'currentColor'}
841
- ></nile-glyph></span>`;
861
+ ></nile-glyph></span></nile-lite-tooltip>`;
842
862
  }
843
863
  _syncHeaderTruncationA11y() {
844
864
  const root = this.shadowRoot;
@@ -854,8 +874,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
854
874
  }
855
875
  else {
856
876
  el.removeAttribute('tabindex');
857
- if (!this._headerInfoTipActive)
858
- this._hideHeaderTip();
877
+ this._hideHeaderTip();
859
878
  }
860
879
  }
861
880
  }
@@ -2332,19 +2351,32 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
2332
2351
  renderSkeleton() {
2333
2352
  return renderChartSkeleton(this.activeConfig?.type);
2334
2353
  }
2354
+ renderEmptyState() {
2355
+ const cfg = this.activeConfig;
2356
+ return renderChartEmptyState({
2357
+ type: cfg?.type,
2358
+ ghost: cfg?.emptyGhost !== false,
2359
+ height: this.hasAttribute('fit') ? undefined : cfg?.height,
2360
+ minHeight: cfg?.chartMinHeight,
2361
+ });
2362
+ }
2335
2363
  render() {
2336
2364
  const isLoading = this.loading || (this.activeConfig?.loading ?? false);
2365
+ // Loading always wins over empty.
2366
+ const isEmpty = !isLoading && isChartEmpty(this.activeConfig);
2337
2367
  const isGrid = this.activeConfig?.type === 'grid';
2338
2368
  return html `
2339
- <div class="nile-chart-card ${isGrid ? 'nile-chart-card--grid' : ''} ${isLoading ? 'nile-chart-card--loading' : ''} ${this.activeConfig?.type === 'kpi' ? 'nile-chart-card--kpi' : ''}" part="chart-card">
2369
+ <div class="nile-chart-card ${isGrid ? 'nile-chart-card--grid' : ''} ${isLoading ? 'nile-chart-card--loading' : ''} ${isEmpty ? 'nile-chart-card--empty' : ''} ${this.activeConfig?.type === 'kpi' ? 'nile-chart-card--kpi' : ''}" part="chart-card">
2340
2370
  ${this.renderHeader()}
2341
2371
  <div class="nile-chart-wrapper" part="chart-body">
2342
2372
  <div class="nile-chart-inner ${this.activeConfig?.type === 'kpi' ? 'nile-chart-inner--kpi' : ''} ${this.activeConfig?.type === 'filter' ? 'nile-chart-inner--filter' : ''}" part="chart-inner">
2343
2373
  ${isLoading
2344
2374
  ? this.renderSkeleton()
2345
- : this.activeConfig
2346
- ? this.renderChartContent()
2347
- : html `<slot></slot>`}
2375
+ : isEmpty
2376
+ ? this.renderEmptyState()
2377
+ : this.activeConfig
2378
+ ? this.renderChartContent()
2379
+ : html `<slot></slot>`}
2348
2380
  ${isGrid ? nothing : this.renderAiPanel()}
2349
2381
  </div>
2350
2382
  </div>
@@ -196,6 +196,15 @@ export const styles = css `
196
196
  min-width: 0;
197
197
  }
198
198
 
199
+ .kpi-tip {
200
+ display: contents;
201
+ }
202
+
203
+ .kpi-info-tip {
204
+ display: inline-flex;
205
+ flex: 0 0 auto;
206
+ }
207
+
199
208
  .kpi-info {
200
209
  display: inline-flex;
201
210
  align-items: center;
@@ -303,7 +303,6 @@ export declare class NileKpiChart extends NileElement {
303
303
  */
304
304
  embedInNileChart: boolean;
305
305
  private _createTipEl;
306
- /** `force` bypasses `tooltipEnabled` — for the value info icon, whose only job is the tooltip. */
307
306
  private _showTip;
308
307
  private _showMarker;
309
308
  private _hideTip;
@@ -339,11 +338,9 @@ export declare class NileKpiChart extends NileElement {
339
338
  private destroySparkline;
340
339
  private destroyGauge;
341
340
  private destroyCharts;
342
- private _onValueEnter;
343
- private _onDescEnter;
344
- private _onLabelEnter;
345
- private _onTrendEnter;
346
- private _onInfoEnter;
341
+ private _valueTooltipText;
342
+ private _trendTooltipText;
343
+ private _syncTruncationTips;
347
344
  private _onGaugeEnter;
348
345
  private _onTrendKeydown;
349
346
  private _onTipLeave;