@aquera/nile-visualization 2.9.37 → 2.9.38

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,10 @@ 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.38 (November 16, 2026)
40
+ - Nile Chart: The header info icon now uses `nile-lite-tooltip` (UIF-1416)
41
+ - Nile KPI Chart: The value info icon and the trend, value, label and description tooltips now use `nile-lite-tooltip`, shown only when the text is truncated (UIF-1416)
42
+
39
43
  #### Version 2.9.37 (October 12, 2026)
40
44
  - Nile KPI Chart: The value info icon is now configurable with `valueInfoIcon`, `valueInfoIconMethod`, `valueInfoIconSize` and `valueInfoIconColor` (`nile-glyph` icons only). Defaults are unchanged (UIF-1379)
41
45
  - Nile Chart: Added a header info icon for all chart types. Set `chartInfo` (with a `chartTitle`), and optionally `chartInfoIcon`, `chartInfoIconMethod`, `chartInfoIconSize` and `chartInfoIconColor` (UIF-1379)
@@ -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;
@@ -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;
@@ -250,8 +249,6 @@ export declare class NileChart extends NileElement {
250
249
  private _showHeaderTip;
251
250
  private _hideHeaderTip;
252
251
  private _onViewportMove;
253
- private _onHeaderInfoEnter;
254
- private _onHeaderInfoKeydown;
255
252
  /** Info icon beside the header title. Tooltip, focus and ARIA live on the wrapper, not the glyph. */
256
253
  private renderHeaderInfo;
257
254
  private _onHeaderTextEnter;
@@ -166,7 +166,6 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
166
166
  constructor() {
167
167
  super(...arguments);
168
168
  this._headerTipEl = null;
169
- this._headerInfoTipActive = false;
170
169
  this._headerResizeObs = null;
171
170
  /** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
172
171
  this.config = null;
@@ -288,17 +287,6 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
288
287
  // The tooltip is fixed to the viewport and placed once, so any scroll (including a touch-drag while the
289
288
  // finger is still down, when no leave/blur fires) would strand it away from its anchor. Hide it instead.
290
289
  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
290
  this._onHeaderTextEnter = (e) => {
303
291
  const el = e.currentTarget;
304
292
  if (el.scrollWidth <= el.clientWidth)
@@ -427,9 +415,6 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
427
415
  return this.mergeChartTypeFromAttr({ ...input });
428
416
  }
429
417
  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
418
  if (changedProperties.has('engine')) {
434
419
  this._echartsFallback = false; // re-evaluate on every engine flip
435
420
  if (this.engine !== 'echarts')
@@ -810,7 +795,6 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
810
795
  this._headerTipEl.style.top = `${y + anchorHeight}px`;
811
796
  }
812
797
  _hideHeaderTip() {
813
- this._headerInfoTipActive = false;
814
798
  if (this._headerTipEl)
815
799
  this._headerTipEl.style.display = 'none';
816
800
  window.removeEventListener('scroll', this._onViewportMove, true);
@@ -822,23 +806,18 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
822
806
  if (!info)
823
807
  return nothing;
824
808
  const size = this.headerInfo('chartInfoIconSize');
825
- return html `<span
809
+ return html `<nile-lite-tooltip class="nile-chart-header-info-tip" content=${info} placement="top"><span
826
810
  class="nile-chart-header-info"
827
811
  part="header-info"
828
812
  role="img"
829
813
  tabindex="0"
830
814
  aria-label=${info}
831
- @mouseenter=${this._onHeaderInfoEnter}
832
- @mouseleave=${() => this._hideHeaderTip()}
833
- @focus=${this._onHeaderInfoEnter}
834
- @blur=${() => this._hideHeaderTip()}
835
- @keydown=${this._onHeaderInfoKeydown}
836
815
  ><nile-glyph
837
816
  name=${this.headerInfo('chartInfoIcon') || 'ng-info-circle'}
838
817
  method=${this.headerInfo('chartInfoIconMethod') || 'stroke'}
839
818
  size=${ifDefined(size === '' || size == null ? undefined : size)}
840
819
  color=${this.headerInfo('chartInfoIconColor') || 'currentColor'}
841
- ></nile-glyph></span>`;
820
+ ></nile-glyph></span></nile-lite-tooltip>`;
842
821
  }
843
822
  _syncHeaderTruncationA11y() {
844
823
  const root = this.shadowRoot;
@@ -854,8 +833,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
854
833
  }
855
834
  else {
856
835
  el.removeAttribute('tabindex');
857
- if (!this._headerInfoTipActive)
858
- this._hideHeaderTip();
836
+ this._hideHeaderTip();
859
837
  }
860
838
  }
861
839
  }
@@ -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;
@@ -230,48 +230,6 @@ let NileKpiChart = class NileKpiChart extends NileElement {
230
230
  this._onSparklineMouseLeave = () => {
231
231
  this._hideTip();
232
232
  };
233
- // ── Value / Gauge hover handlers ─────────────────────────────────────────
234
- this._onValueEnter = (e) => {
235
- const rect = e.currentTarget.getBoundingClientRect();
236
- const rawNum = this.parseNumericValue(this.value);
237
- const full = rawNum != null ? this.formatValue(rawNum).full : String(this.value ?? '');
238
- const prefix = this.prefix ?? '';
239
- const suffix = this.suffix ?? '';
240
- this._showTip(`${prefix}${full}${suffix}`.trim(), rect.left + rect.width / 2, rect.top);
241
- };
242
- this._onDescEnter = (e) => {
243
- const el = e.currentTarget;
244
- if (el.scrollWidth <= el.clientWidth)
245
- return;
246
- const rect = el.getBoundingClientRect();
247
- this._showTip(this.description ?? '', rect.left + rect.width / 2, rect.top);
248
- };
249
- this._onLabelEnter = (e) => {
250
- const el = e.currentTarget;
251
- if (el.scrollWidth <= el.clientWidth)
252
- return;
253
- const rect = el.getBoundingClientRect();
254
- this._showTip(this.label ?? '', rect.left + rect.width / 2, rect.top);
255
- };
256
- this._onTrendEnter = (e) => {
257
- const el = e.currentTarget;
258
- // Only show a tooltip when the trend is actually clipped/ellipsized.
259
- const hasEllipsis = getComputedStyle(el).textOverflow === 'ellipsis';
260
- if (!hasEllipsis)
261
- return;
262
- if (el.scrollWidth <= el.clientWidth + 2)
263
- return;
264
- const rect = el.getBoundingClientRect();
265
- const dir = this.trendDirection;
266
- const arrow = dir === 'up' ? '▲' : dir === 'down' ? '▼' : '–';
267
- const pct = this.trendValue !== null ? `${Math.abs(this.trendValue).toFixed(1)}%` : '';
268
- const text = `${arrow} ${pct}${this.trendLabel ? ' ' + this.trendLabel : ''}`.trim();
269
- this._showTip(text, rect.left + rect.width / 2, rect.top);
270
- };
271
- this._onInfoEnter = (e) => {
272
- const rect = e.currentTarget.getBoundingClientRect();
273
- this._showTip(this.valueInfo, rect.left + rect.width / 2, rect.top, true);
274
- };
275
233
  this._onGaugeEnter = (e) => {
276
234
  const rect = e.currentTarget.getBoundingClientRect();
277
235
  this._showTip(this.getTooltipContent(), rect.left + rect.width / 2, rect.top + rect.height / 2);
@@ -297,9 +255,8 @@ let NileKpiChart = class NileKpiChart extends NileElement {
297
255
  document.body.appendChild(marker);
298
256
  this._markerEl = marker;
299
257
  }
300
- /** `force` bypasses `tooltipEnabled` — for the value info icon, whose only job is the tooltip. */
301
- _showTip(text, x, y, force = false) {
302
- if (!this._tipEl || (!this.tooltipEnabled && !force))
258
+ _showTip(text, x, y) {
259
+ if (!this._tipEl || !this.tooltipEnabled)
303
260
  return;
304
261
  this._tipEl.textContent = text;
305
262
  this._tipEl.style.left = `${x}px`;
@@ -728,11 +685,13 @@ let NileKpiChart = class NileKpiChart extends NileElement {
728
685
  this.initGauge();
729
686
  this.setupResizeObserver();
730
687
  requestAnimationFrame(() => this._reconcileFit());
688
+ void document.fonts?.ready.then(() => this._syncTruncationTips());
731
689
  }
732
690
  updated(changedProperties) {
733
691
  const hasValue = this.value !== '' && this.value !== null && this.value !== undefined;
734
692
  this.toggleAttribute('has-value', hasValue);
735
693
  this.toggleAttribute('has-sparkline', this.sparkline.length > 0);
694
+ this._syncTruncationTips();
736
695
  if (changedProperties.has('config') && this.config) {
737
696
  this.applyConfig(this.config);
738
697
  return;
@@ -859,6 +818,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
859
818
  this._reconcileFit();
860
819
  this.syncSparklineChartSize();
861
820
  this.syncGaugeChartSize();
821
+ this._syncTruncationTips();
862
822
  });
863
823
  this.resizeObserver.observe(this);
864
824
  if (this.sparklineContainer)
@@ -1106,28 +1066,54 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1106
1066
  this.destroySparkline();
1107
1067
  this.destroyGauge();
1108
1068
  }
1069
+ _valueTooltipText() {
1070
+ const rawNum = this.parseNumericValue(this.value);
1071
+ const full = rawNum != null ? this.formatValue(rawNum).full : String(this.value ?? '');
1072
+ return `${this.prefix ?? ''}${full}${this.suffix ?? ''}`.trim();
1073
+ }
1074
+ _trendTooltipText() {
1075
+ const dir = this.trendDirection;
1076
+ const arrow = dir === 'up' ? '▲' : dir === 'down' ? '▼' : '–';
1077
+ const pct = this.trendValue !== null ? `${Math.abs(this.trendValue).toFixed(1)}%` : '';
1078
+ return `${arrow} ${pct}${this.trendLabel ? ' ' + this.trendLabel : ''}`.trim();
1079
+ }
1080
+ _syncTruncationTips() {
1081
+ const root = this.shadowRoot;
1082
+ if (!root)
1083
+ return;
1084
+ root.querySelectorAll('nile-lite-tooltip[data-kpi-tip]').forEach(tip => {
1085
+ const el = tip.firstElementChild;
1086
+ if (!el)
1087
+ return;
1088
+ const truncated = tip.dataset['kpiTip'] === 'trend'
1089
+ ? getComputedStyle(el).textOverflow === 'ellipsis' && el.scrollWidth > el.clientWidth + 2
1090
+ : el.scrollWidth > el.clientWidth;
1091
+ const disabled = !this.tooltipEnabled || !truncated;
1092
+ if (tip.disabled !== disabled)
1093
+ tip.disabled = disabled;
1094
+ });
1095
+ }
1109
1096
  // ── Render ───────────────────────────────────────────────────────────────
1110
1097
  renderValueInfo() {
1111
1098
  if (!this.valueInfo)
1112
1099
  return nothing;
1113
1100
  const [vertical, side] = (typeof this.valueInfoPlacement === 'string' ? this.valueInfoPlacement : 'top-right').split('-');
1114
- return html `<span
1115
- class="kpi-info kpi-info--${vertical === 'bottom' || vertical === 'center' ? vertical : 'top'} kpi-info--${side === 'left' ? 'left' : 'right'}"
1101
+ return html `<nile-lite-tooltip
1102
+ class="kpi-info-tip kpi-info--${vertical === 'bottom' || vertical === 'center' ? vertical : 'top'} kpi-info--${side === 'left' ? 'left' : 'right'}"
1103
+ content=${this.valueInfo}
1104
+ placement="top"
1105
+ ><span
1106
+ class="kpi-info"
1116
1107
  part="value-info"
1117
1108
  role="img"
1118
1109
  tabindex="0"
1119
1110
  aria-label=${this.valueInfo}
1120
- @mouseenter=${this._onInfoEnter}
1121
- @mouseleave=${this._onTipLeave}
1122
- @focus=${this._onInfoEnter}
1123
- @blur=${this._onTipLeave}
1124
- @keydown=${this._onTrendKeydown}
1125
1111
  ><nile-glyph
1126
1112
  name=${this.valueInfoIcon || 'ng-info-circle'}
1127
1113
  method=${this.valueInfoIconMethod || 'stroke'}
1128
1114
  size=${ifDefined(this.valueInfoIconSize === '' || this.valueInfoIconSize == null ? undefined : this.valueInfoIconSize)}
1129
1115
  color=${this.valueInfoIconColor || 'currentColor'}
1130
- ></nile-glyph></span>`;
1116
+ ></nile-glyph></span></nile-lite-tooltip>`;
1131
1117
  }
1132
1118
  renderTrend() {
1133
1119
  if (this.trendValue === null)
@@ -1135,17 +1121,11 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1135
1121
  const dir = this.trendDirection;
1136
1122
  const formatted = Math.abs(this.trendValue).toFixed(1) + '%';
1137
1123
  const trendAriaLabel = `Trend ${dir === 'up' ? 'up' : dir === 'down' ? 'down' : 'neutral'} ${formatted}${this.trendLabel ? ' ' + this.trendLabel : ''}`.trim();
1138
- return html `
1139
- <span
1124
+ return html `<nile-lite-tooltip class="kpi-tip" data-kpi-tip="trend" content=${this._trendTooltipText()} placement="top" disabled><span
1140
1125
  class="kpi-trend kpi-trend--${dir}"
1141
1126
  tabindex="0"
1142
1127
  role="button"
1143
1128
  aria-label=${trendAriaLabel}
1144
- @mouseenter=${this._onTrendEnter}
1145
- @mouseleave=${this._onTipLeave}
1146
- @focus=${this._onTrendEnter}
1147
- @blur=${this._onTipLeave}
1148
- @keydown=${this._onTrendKeydown}
1149
1129
  >
1150
1130
  <span class="kpi-trend-arrow">
1151
1131
  ${dir === 'up'
@@ -1155,8 +1135,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1155
1135
  : html `<svg viewBox="0 0 12 12"><path d="M2 6.5h8" stroke="currentColor" stroke-width="1.5" fill="none"/></svg>`}
1156
1136
  </span>
1157
1137
  <span class="kpi-trend-value">${formatted}</span>${this.trendLabel ? html ` <span class="kpi-trend-label">${this.trendLabel}</span>` : nothing}
1158
- </span>
1159
- `;
1138
+ </span></nile-lite-tooltip>`;
1160
1139
  }
1161
1140
  /**
1162
1141
  * The projected-value line. Rendered only when `forecastValue` is set, so a
@@ -1193,17 +1172,18 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1193
1172
  const displayValue = fmt ? fmt.display : String(this.value ?? '');
1194
1173
  const showTooltip = !!fmt && fmt.display !== fmt.full;
1195
1174
  const infoLeft = typeof this.valueInfoPlacement === 'string' && this.valueInfoPlacement.endsWith('-left');
1175
+ const valueEl = html `<h2
1176
+ class="kpi-value"
1177
+ tabindex=${showTooltip ? '0' : nothing}
1178
+ >
1179
+ ${this.prefix ? html `<span class="kpi-prefix">${this.prefix}</span>` : nothing}${displayValue}${this.suffix ? html `<span class="kpi-suffix">${this.suffix}</span>` : nothing}
1180
+ </h2>`;
1196
1181
  return html `
1197
1182
  <div class="kpi ${isGauge ? 'kpi--gauge' : ''}">
1198
- ${this.label ? html `<p
1183
+ ${this.label ? html `<nile-lite-tooltip class="kpi-tip" data-kpi-tip="label" content=${this.label} placement="top" disabled><p
1199
1184
  class="kpi-label"
1200
1185
  tabindex="0"
1201
- @mouseenter=${this._onLabelEnter}
1202
- @mouseleave=${this._onTipLeave}
1203
- @focus=${this._onLabelEnter}
1204
- @blur=${this._onTipLeave}
1205
- @keydown=${this._onTrendKeydown}
1206
- >${this.label}</p>` : nothing}
1186
+ >${this.label}</p></nile-lite-tooltip>` : nothing}
1207
1187
 
1208
1188
  ${isGauge ? html `
1209
1189
  <div class="kpi-gauge-slot">
@@ -1225,17 +1205,9 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1225
1205
  ${!isGauge ? html `
1226
1206
  <span class="kpi-value-group">
1227
1207
  ${infoLeft ? this.renderValueInfo() : nothing}
1228
- <h2
1229
- class="kpi-value"
1230
- tabindex=${showTooltip ? '0' : nothing}
1231
- @mouseenter=${showTooltip ? this._onValueEnter : nothing}
1232
- @mouseleave=${showTooltip ? this._onTipLeave : nothing}
1233
- @focus=${showTooltip ? this._onValueEnter : nothing}
1234
- @blur=${showTooltip ? this._onTipLeave : nothing}
1235
- @keydown=${showTooltip ? this._onTrendKeydown : nothing}
1236
- >
1237
- ${this.prefix ? html `<span class="kpi-prefix">${this.prefix}</span>` : nothing}${displayValue}${this.suffix ? html `<span class="kpi-suffix">${this.suffix}</span>` : nothing}
1238
- </h2>
1208
+ ${showTooltip
1209
+ ? html `<nile-lite-tooltip class="kpi-tip" content=${this._valueTooltipText()} placement="top" ?disabled=${!this.tooltipEnabled}>${valueEl}</nile-lite-tooltip>`
1210
+ : valueEl}
1239
1211
  ${infoLeft ? nothing : this.renderValueInfo()}
1240
1212
  </span>
1241
1213
  ` : nothing}
@@ -1246,15 +1218,10 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1246
1218
 
1247
1219
  ${this.renderForecast()}
1248
1220
 
1249
- ${this.description ? html `<p
1221
+ ${this.description ? html `<nile-lite-tooltip class="kpi-tip" data-kpi-tip="description" content=${this.description} placement="top" disabled><p
1250
1222
  class="kpi-description"
1251
1223
  tabindex="0"
1252
- @mouseenter=${this._onDescEnter}
1253
- @mouseleave=${this._onTipLeave}
1254
- @focus=${this._onDescEnter}
1255
- @blur=${this._onTipLeave}
1256
- @keydown=${this._onTrendKeydown}
1257
- >${this.description}</p>` : nothing}
1224
+ >${this.description}</p></nile-lite-tooltip>` : nothing}
1258
1225
 
1259
1226
  ${this.sparkline.length && !isGauge ? html `<div class="kpi-sparkline"></div>` : nothing}
1260
1227
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/nile-visualization",
3
- "version": "2.9.37",
3
+ "version": "2.9.38",
4
4
  "description": "A visualization Library for the Nile Design System",
5
5
  "license": "MIT",
6
6
  "author": "Aquera Inc",
@@ -73,6 +73,7 @@
73
73
  "@aquera/nile-elements": ">=0.1.0"
74
74
  },
75
75
  "devDependencies": {
76
+ "@aquera/nile-glyph": "^1.0.9",
76
77
  "@rollup/plugin-babel": "^6.0.3",
77
78
  "@rollup/plugin-commonjs": "^25.0.3",
78
79
  "@rollup/plugin-node-resolve": "^15.0.1",