@aquera/nile-visualization 2.9.33 → 2.9.34

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,9 @@ 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.34 (September 28, 2026)
40
+ - Nile KPI Chart: Added `valueInfo` / `valueInfoPlacement` for an info icon beside the value, updated the default sparkline and gauge colour to `#1868DB`, and fixed the hover dot to match the sparkline colour and hide on scroll. (UIF-1354)
41
+
39
42
  #### Version 2.9.33 (September 15, 2026)
40
43
  - Nile KPI Chart: Fixed the hover tooltip and marker sticking on screen after a scroll (UIF-1354)
41
44
 
@@ -70,6 +70,9 @@ export const styles = css `
70
70
  --nile-kpi-forecast-font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
71
71
  --nile-kpi-description-font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
72
72
  --nile-kpi-description-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
73
+ /* Value info icon (fixed 16px via the glyph's size attribute). */
74
+ --nile-kpi-info-color: var(--nile-colors-neutral-700, var(--ng-colors-fg-tertiary-600));
75
+ --nile-kpi-info-hover-color: var(--nile-colors-dark-900, var(--ng-colors-fg-tertiary-hover));
73
76
  display: flex;
74
77
  flex-direction: column;
75
78
  width: 100%;
@@ -120,7 +123,7 @@ export const styles = css `
120
123
 
121
124
  /* Accent variant — card chrome with a prominent left colour bar. */
122
125
  :host([variant='accent']:not([embed-in-nile-chart])) {
123
- --nile-kpi-accent-color: #005EA6;
126
+ --nile-kpi-accent-color: var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
124
127
  background: var(--nile-kpi-card-bg);
125
128
  border: var(--nile-kpi-card-border-width) solid var(--nile-kpi-card-border-color);
126
129
  border-left: 4px solid var(--nile-kpi-accent-color);
@@ -186,6 +189,55 @@ export const styles = css `
186
189
  flex: 0 0 auto;
187
190
  }
188
191
 
192
+ .kpi-value-group {
193
+ display: inline-flex;
194
+ align-items: stretch;
195
+ flex: 0 0 auto;
196
+ min-width: 0;
197
+ }
198
+
199
+ .kpi-info {
200
+ display: inline-flex;
201
+ flex: 0 0 auto;
202
+ color: var(--nile-kpi-info-color);
203
+ border-radius: 50%;
204
+ cursor: pointer;
205
+ outline: none;
206
+ transition: color var(--nile-transition-duration-default, var(--ng-transition-duration-default)) ease;
207
+ }
208
+
209
+ /* currentColor follows .kpi-info's colour. */
210
+ .kpi-info nile-glyph {
211
+ display: block;
212
+ --nile-svg-fill: currentColor;
213
+ }
214
+
215
+ .kpi-info:hover,
216
+ .kpi-info:focus-visible {
217
+ color: var(--nile-kpi-info-hover-color);
218
+ }
219
+
220
+ .kpi-info:focus-visible {
221
+ box-shadow: 0 0 0 2px var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
222
+ }
223
+
224
+ /* top = superscript (level with the cap height), bottom = subscript (at the baseline). */
225
+ .kpi-info--top {
226
+ align-self: flex-start;
227
+ }
228
+
229
+ .kpi-info--bottom {
230
+ align-self: flex-end;
231
+ }
232
+
233
+ .kpi-info--right {
234
+ margin-left: var(--nile-spacing-xs, var(--ng-spacing-xs));
235
+ }
236
+
237
+ .kpi-info--left {
238
+ margin-right: var(--nile-spacing-xs, var(--ng-spacing-xs));
239
+ }
240
+
189
241
  .kpi-prefix,
190
242
  .kpi-suffix {
191
243
  font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
@@ -486,10 +538,10 @@ export const styles = css `
486
538
  }
487
539
 
488
540
  /* Constrained both ways — only show the value. */
489
-
541
+
490
542
 
491
543
  @container (max-width: 180px) and (max-height: 70px) {
492
-
544
+
493
545
  .kpi-description,
494
546
  .kpi-sparkline {
495
547
  display: none;
@@ -7,6 +7,7 @@ export type KpiVariant = 'default' | 'card' | 'gauge' | 'accent';
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';
10
+ export type KpiInfoPlacement = 'top-right' | 'bottom-right' | 'top-left' | 'bottom-left';
10
11
  /** `chart` slice for `<nile-kpi-chart>.config` (discriminated by `type: 'kpi'`). */
11
12
  export interface ChartKpiSeparatedPayload {
12
13
  type: 'kpi';
@@ -65,6 +66,10 @@ export interface ChartKpiSeparatedPayload {
65
66
  valueFontSize?: string | number;
66
67
  /** Override the KPI value text color. */
67
68
  valueColor?: string;
69
+ /** Text for an info icon beside the value. Omitted/empty → no icon. */
70
+ valueInfo?: string;
71
+ /** Info icon position relative to the value (default: 'top-right'). */
72
+ valueInfoPlacement?: KpiInfoPlacement;
68
73
  /** Custom text shown in the loading state (default: 'Loading...'). */
69
74
  loadingText?: string;
70
75
  /** Whether the hover tooltip is shown on value / sparkline / gauge (default: true). */
@@ -234,6 +239,10 @@ export declare class NileKpiChart extends NileElement {
234
239
  valueFontSize: string | number;
235
240
  /** Override the KPI value text color. */
236
241
  valueColor: string;
242
+ /** Info text shown on hover/focus of an icon beside the value. Empty → no icon. */
243
+ valueInfo: string;
244
+ /** Info icon position: top-/bottom- (superscript/subscript), -left (before prefix) / -right (after suffix). */
245
+ valueInfoPlacement: KpiInfoPlacement;
237
246
  /** Custom text shown in the loading state. */
238
247
  loadingText: string;
239
248
  /** Whether the hover tooltip is shown on value / sparkline / gauge. */
@@ -278,6 +287,7 @@ export declare class NileKpiChart extends NileElement {
278
287
  */
279
288
  embedInNileChart: boolean;
280
289
  private _createTipEl;
290
+ /** `force` bypasses `tooltipEnabled` — for the value info icon, whose only job is the tooltip. */
281
291
  private _showTip;
282
292
  private _showMarker;
283
293
  private _hideTip;
@@ -318,9 +328,11 @@ export declare class NileKpiChart extends NileElement {
318
328
  private _onDescEnter;
319
329
  private _onLabelEnter;
320
330
  private _onTrendEnter;
331
+ private _onInfoEnter;
321
332
  private _onGaugeEnter;
322
333
  private _onTrendKeydown;
323
334
  private _onTipLeave;
335
+ private renderValueInfo;
324
336
  private renderTrend;
325
337
  /**
326
338
  * The projected-value line. Rendered only when `forecastValue` is set, so a
@@ -118,6 +118,10 @@ let NileKpiChart = class NileKpiChart extends NileElement {
118
118
  this.valueFontSize = '';
119
119
  /** Override the KPI value text color. */
120
120
  this.valueColor = '';
121
+ /** Info text shown on hover/focus of an icon beside the value. Empty → no icon. */
122
+ this.valueInfo = '';
123
+ /** Info icon position: top-/bottom- (superscript/subscript), -left (before prefix) / -right (after suffix). */
124
+ this.valueInfoPlacement = 'top-right';
121
125
  /** Custom text shown in the loading state. */
122
126
  this.loadingText = 'Loading...';
123
127
  /** Whether the hover tooltip is shown on value / sparkline / gauge. */
@@ -185,6 +189,10 @@ let NileKpiChart = class NileKpiChart extends NileElement {
185
189
  if (!series?.points?.length)
186
190
  return;
187
191
  const rect = this.sparklineContainer.getBoundingClientRect();
192
+ if (e.clientX < rect.left || e.clientX > rect.right || e.clientY < rect.top || e.clientY > rect.bottom) {
193
+ this._hideTip();
194
+ return;
195
+ }
188
196
  const inverted = !!chart.inverted;
189
197
  const xAxis = series.xAxis;
190
198
  const yAxis = series.yAxis;
@@ -208,7 +216,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
208
216
  this._showTip(text, tipX, tipY);
209
217
  const isBarLike = this.sparklineType === 'bar' || this.sparklineType === 'column';
210
218
  if (!isBarLike) {
211
- this._showMarker(tipX, tipY, this.sparklineColor || '#005EA6');
219
+ this._showMarker(tipX, tipY, this.sparklineColor || '#1868DB');
212
220
  }
213
221
  };
214
222
  this._onSparklineMouseLeave = () => {
@@ -252,6 +260,10 @@ let NileKpiChart = class NileKpiChart extends NileElement {
252
260
  const text = `${arrow} ${pct}${this.trendLabel ? ' ' + this.trendLabel : ''}`.trim();
253
261
  this._showTip(text, rect.left + rect.width / 2, rect.top);
254
262
  };
263
+ this._onInfoEnter = (e) => {
264
+ const rect = e.currentTarget.getBoundingClientRect();
265
+ this._showTip(this.valueInfo, rect.left + rect.width / 2, rect.top, true);
266
+ };
255
267
  this._onGaugeEnter = (e) => {
256
268
  const rect = e.currentTarget.getBoundingClientRect();
257
269
  this._showTip(this.getTooltipContent(), rect.left + rect.width / 2, rect.top + rect.height / 2);
@@ -277,8 +289,9 @@ let NileKpiChart = class NileKpiChart extends NileElement {
277
289
  document.body.appendChild(marker);
278
290
  this._markerEl = marker;
279
291
  }
280
- _showTip(text, x, y) {
281
- if (!this._tipEl || !this.tooltipEnabled)
292
+ /** `force` bypasses `tooltipEnabled` — for the value info icon, whose only job is the tooltip. */
293
+ _showTip(text, x, y, force = false) {
294
+ if (!this._tipEl || (!this.tooltipEnabled && !force))
282
295
  return;
283
296
  this._tipEl.textContent = text;
284
297
  this._tipEl.style.left = `${x}px`;
@@ -577,6 +590,10 @@ let NileKpiChart = class NileKpiChart extends NileElement {
577
590
  this.valueFontSize = c.valueFontSize;
578
591
  if (c.valueColor !== undefined)
579
592
  this.valueColor = c.valueColor;
593
+ if (c.valueInfo !== undefined)
594
+ this.valueInfo = c.valueInfo;
595
+ if (c.valueInfoPlacement !== undefined)
596
+ this.valueInfoPlacement = c.valueInfoPlacement;
580
597
  if (c.loadingText !== undefined)
581
598
  this.loadingText = c.loadingText;
582
599
  if (c.tooltipEnabled !== undefined)
@@ -662,6 +679,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
662
679
  ensureTooltipStyles();
663
680
  this._createTipEl();
664
681
  document.addEventListener('scroll', this._onViewportChange, { capture: true, passive: true });
682
+ document.addEventListener('wheel', this._onViewportChange, { capture: true, passive: true });
665
683
  window.addEventListener('resize', this._onViewportChange, { passive: true });
666
684
  if (!this._hc) {
667
685
  getHighcharts().then(hc => { this._hc = hc; this.requestUpdate(); });
@@ -672,6 +690,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
672
690
  disconnectedCallback() {
673
691
  super.disconnectedCallback();
674
692
  document.removeEventListener('scroll', this._onViewportChange, { capture: true });
693
+ document.removeEventListener('wheel', this._onViewportChange, { capture: true });
675
694
  window.removeEventListener('resize', this._onViewportChange);
676
695
  this._hideTip();
677
696
  this._tipEl?.remove();
@@ -822,7 +841,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
822
841
  }
823
842
  // ── Chart options ────────────────────────────────────────────────────────
824
843
  buildSparklineOptions() {
825
- const brandColor = this.sparklineColor || '#005EA6';
844
+ const brandColor = this.sparklineColor || '#1868DB';
826
845
  const lineWidth = this.sparklineLineWidth;
827
846
  const seriesType = this.sparklineType;
828
847
  const topAlpha = Math.round(Math.min(1, Math.max(0, this.sparklineFillOpacity)) * 255).toString(16).padStart(2, '0');
@@ -919,7 +938,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
919
938
  return { ...defaults, ...this.options };
920
939
  }
921
940
  buildGaugeOptions() {
922
- const color = this.gaugeColor || '#005EA6';
941
+ const color = this.gaugeColor || '#1868DB';
923
942
  const trackColor = this.gaugeTrackColor || '#E5E7EB';
924
943
  const innerRadius = this.gaugeInnerRadius || '80%';
925
944
  const outerRadius = this.gaugeOuterRadius || '100%';
@@ -1057,6 +1076,23 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1057
1076
  this.destroyGauge();
1058
1077
  }
1059
1078
  // ── Render ───────────────────────────────────────────────────────────────
1079
+ renderValueInfo() {
1080
+ if (!this.valueInfo)
1081
+ return nothing;
1082
+ const [vertical, side] = this.valueInfoPlacement.split('-');
1083
+ return html `<span
1084
+ class="kpi-info kpi-info--${vertical === 'bottom' ? 'bottom' : 'top'} kpi-info--${side === 'left' ? 'left' : 'right'}"
1085
+ part="value-info"
1086
+ role="img"
1087
+ tabindex="0"
1088
+ aria-label=${this.valueInfo}
1089
+ @mouseenter=${this._onInfoEnter}
1090
+ @mouseleave=${this._onTipLeave}
1091
+ @focus=${this._onInfoEnter}
1092
+ @blur=${this._onTipLeave}
1093
+ @keydown=${this._onTrendKeydown}
1094
+ ><nile-glyph name="ng-info-circle" method="stroke" size="16"></nile-glyph></span>`;
1095
+ }
1060
1096
  renderTrend() {
1061
1097
  if (this.trendValue === null)
1062
1098
  return undefined;
@@ -1120,6 +1156,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1120
1156
  const fmt = rawNum != null ? this.formatValue(rawNum) : null;
1121
1157
  const displayValue = fmt ? fmt.display : String(this.value ?? '');
1122
1158
  const showTooltip = !!fmt && fmt.display !== fmt.full;
1159
+ const infoLeft = this.valueInfoPlacement.endsWith('-left');
1123
1160
  return html `
1124
1161
  <div class="kpi ${isGauge ? 'kpi--gauge' : ''}">
1125
1162
  ${this.label ? html `<p
@@ -1150,6 +1187,8 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1150
1187
 
1151
1188
  <div class="kpi-value-row">
1152
1189
  ${!isGauge ? html `
1190
+ <span class="kpi-value-group">
1191
+ ${infoLeft ? this.renderValueInfo() : nothing}
1153
1192
  <h2
1154
1193
  class="kpi-value"
1155
1194
  tabindex=${showTooltip ? '0' : nothing}
@@ -1161,6 +1200,8 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1161
1200
  >
1162
1201
  ${this.prefix ? html `<span class="kpi-prefix">${this.prefix}</span>` : nothing}${displayValue}${this.suffix ? html `<span class="kpi-suffix">${this.suffix}</span>` : nothing}
1163
1202
  </h2>
1203
+ ${infoLeft ? nothing : this.renderValueInfo()}
1204
+ </span>
1164
1205
  ` : nothing}
1165
1206
  ${!isGauge ? this.renderTrend() : nothing}
1166
1207
  </div>
@@ -1308,6 +1349,12 @@ __decorate([
1308
1349
  __decorate([
1309
1350
  property({ type: String, attribute: 'value-color' })
1310
1351
  ], NileKpiChart.prototype, "valueColor", void 0);
1352
+ __decorate([
1353
+ property({ type: String, attribute: 'value-info' })
1354
+ ], NileKpiChart.prototype, "valueInfo", void 0);
1355
+ __decorate([
1356
+ property({ type: String, attribute: 'value-info-placement' })
1357
+ ], NileKpiChart.prototype, "valueInfoPlacement", void 0);
1311
1358
  __decorate([
1312
1359
  property({ type: String, attribute: 'loading-text' })
1313
1360
  ], NileKpiChart.prototype, "loadingText", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aquera/nile-visualization",
3
- "version": "2.9.33",
3
+ "version": "2.9.34",
4
4
  "description": "A visualization Library for the Nile Design System",
5
5
  "license": "MIT",
6
6
  "author": "Aquera Inc",