@aquera/nile-visualization 2.9.36 → 2.9.37
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 +4 -0
- package/dist/src/internal/types/aq-config.type.d.ts +10 -0
- package/dist/src/nile-chart/nile-chart-config.d.ts +23 -1
- package/dist/src/nile-chart/nile-chart.css.d.ts +1 -1
- package/dist/src/nile-chart/nile-chart.css.js +58 -2
- package/dist/src/nile-chart/nile-chart.d.ts +7 -0
- package/dist/src/nile-chart/nile-chart.js +79 -4
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +10 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +18 -2
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +40 -6
- package/package.json +1 -1
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.37 (October 12, 2026)
|
|
40
|
+
- 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
|
+
- 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)
|
|
42
|
+
|
|
39
43
|
#### Version 2.9.36 (September 30, 2026)
|
|
40
44
|
- Nile KPI Chart: Fixed the sparkline getting partly cut off after a data refresh or resize. The chart is now resized to match its box instead of resetting to `sparklineHeight`, and sparkline resize animation is turned off (UIF-1370)
|
|
41
45
|
|
|
@@ -5,6 +5,16 @@ import type { NileChartMenuConfig, NileChartMenuItem } from '../../nile-chart/ni
|
|
|
5
5
|
export interface AqConfigType {
|
|
6
6
|
chartTitle?: string;
|
|
7
7
|
chartSubtitle?: string;
|
|
8
|
+
/** Info text shown on hover/focus of an icon beside the header title. Empty → no icon (needs a title). */
|
|
9
|
+
chartInfo?: string;
|
|
10
|
+
/** `nile-glyph` name for the header info icon (default: 'ng-info-circle'). */
|
|
11
|
+
chartInfoIcon?: string;
|
|
12
|
+
/** `nile-glyph` `method` for the header info icon (default: 'stroke'). */
|
|
13
|
+
chartInfoIconMethod?: string;
|
|
14
|
+
/** `nile-glyph` `size` for the header info icon (default: unset, so `nile-glyph`'s own 16). The hover/focus target keeps a 16px token minimum. */
|
|
15
|
+
chartInfoIconSize?: string | number;
|
|
16
|
+
/** `nile-glyph` `color` for the header info icon, passed through unchanged. An explicit colour overrides the hover colour. */
|
|
17
|
+
chartInfoIconColor?: string;
|
|
8
18
|
/** Font size for the header title (number → px, or any CSS length string). */
|
|
9
19
|
titleFontSize?: string | number;
|
|
10
20
|
/** Font size for the header subtitle (number → px, or any CSS length string). */
|
|
@@ -16,7 +16,7 @@ import type { RadarChartSeriesData } from '../nile-radar-chart/nile-radar-chart.
|
|
|
16
16
|
import type { GaugeBand } from '../nile-gauge-chart/nile-gauge-chart.js';
|
|
17
17
|
import type { WaterfallDataPoint } from '../nile-waterfall-chart/nile-waterfall-chart.js';
|
|
18
18
|
import type { ForecastConfigFields, ForecastSeriesInput } from '../internal/utils/chart-forecast.js';
|
|
19
|
-
import type { KpiVariant, KpiValueFormat, KpiNumberSystem, SparklineType, TrendDirection } from '../nile-kpi-chart/nile-kpi-chart.js';
|
|
19
|
+
import type { KpiVariant, KpiValueFormat, KpiNumberSystem, SparklineType, TrendDirection, KpiInfoPlacement } from '../nile-kpi-chart/nile-kpi-chart.js';
|
|
20
20
|
import type { MapChartDataPoint } from '../nile-map-chart/nile-map-chart.js';
|
|
21
21
|
import type { StatusLightConfig } from '../nile-chart-message/nile-chart-message.js';
|
|
22
22
|
import type { ChartListVariant, ChartListItem, ChartListMarker } from '../nile-chart-list/nile-chart-list.js';
|
|
@@ -93,6 +93,16 @@ export interface NileAiConfig {
|
|
|
93
93
|
export interface NileChartConfigBase extends HighchartsPassthroughConfig {
|
|
94
94
|
chartTitle?: string;
|
|
95
95
|
chartSubtitle?: string;
|
|
96
|
+
/** Info text shown on hover/focus of an icon beside the header title. Empty → no icon (needs a title). */
|
|
97
|
+
chartInfo?: string;
|
|
98
|
+
/** `nile-glyph` name for the header info icon (default: 'ng-info-circle'). */
|
|
99
|
+
chartInfoIcon?: string;
|
|
100
|
+
/** `nile-glyph` `method` for the header info icon (default: 'stroke'). */
|
|
101
|
+
chartInfoIconMethod?: string;
|
|
102
|
+
/** `nile-glyph` `size` for the header info icon (default: unset, so `nile-glyph`'s own 16). The hover/focus target keeps a 16px token minimum. */
|
|
103
|
+
chartInfoIconSize?: string | number;
|
|
104
|
+
/** `nile-glyph` `color` for the header info icon, passed through unchanged. An explicit colour overrides the hover colour. */
|
|
105
|
+
chartInfoIconColor?: string;
|
|
96
106
|
titleFontSize?: string | number;
|
|
97
107
|
subtitleFontSize?: string | number;
|
|
98
108
|
noHeader?: boolean;
|
|
@@ -538,6 +548,18 @@ export interface NileKpiChartConfig extends NileChartConfigBase {
|
|
|
538
548
|
gaugeLabelYOffset?: number;
|
|
539
549
|
valueFontSize?: string | number;
|
|
540
550
|
valueColor?: string;
|
|
551
|
+
/** Info text for an icon beside the value. Empty → no icon. */
|
|
552
|
+
valueInfo?: string;
|
|
553
|
+
/** Info icon position relative to the value (default: 'top-right'). */
|
|
554
|
+
valueInfoPlacement?: KpiInfoPlacement;
|
|
555
|
+
/** `nile-glyph` name for the info icon (default: 'ng-info-circle'). */
|
|
556
|
+
valueInfoIcon?: string;
|
|
557
|
+
/** `nile-glyph` `method` for the info icon (default: 'stroke'). */
|
|
558
|
+
valueInfoIconMethod?: string;
|
|
559
|
+
/** `nile-glyph` `size` for the info icon (default: unset, so `nile-glyph`'s own 16). Changes the glyph only; the hover/focus target keeps the 16px token minimum. */
|
|
560
|
+
valueInfoIconSize?: string | number;
|
|
561
|
+
/** `nile-glyph` `color` for the info icon, passed through as-is. An explicit colour overrides the hover colour. Default: follows `--nile-kpi-info-color`. */
|
|
562
|
+
valueInfoIconColor?: string;
|
|
541
563
|
labelColor?: string;
|
|
542
564
|
labelFontSize?: string | number;
|
|
543
565
|
labelFontWeight?: string | number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const tooltipCss = "\n .nile-chart-header-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: 4px 10px;\n border-radius: 6px;\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space:
|
|
1
|
+
export declare const tooltipCss = "\n .nile-chart-header-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: 4px 10px;\n border-radius: 6px;\n border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n pointer-events: none;\n white-space: normal;\n width: max-content;\n max-width: min(320px, calc(100vw - 16px));\n overflow-wrap: anywhere;\n z-index: 2147483647;\n box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));\n }\n .nile-chart-header-tooltip.below {\n transform: translate(-50%, 10px);\n }\n .nile-chart-header-tooltip.below::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-chart-header-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: var(--tip-arrow-x, 50%);\n transform: translateX(-50%);\n border: 5px solid transparent;\n border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n";
|
|
2
2
|
export declare function injectGlobalChartMenuOverrides(): void;
|
|
3
3
|
export declare const styles: import("lit").CSSResult;
|
|
@@ -14,15 +14,27 @@ export const tooltipCss = `
|
|
|
14
14
|
border-radius: 6px;
|
|
15
15
|
border: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
16
16
|
pointer-events: none;
|
|
17
|
-
white-space:
|
|
17
|
+
white-space: normal;
|
|
18
|
+
width: max-content;
|
|
19
|
+
max-width: min(320px, calc(100vw - 16px));
|
|
20
|
+
overflow-wrap: anywhere;
|
|
18
21
|
z-index: 2147483647;
|
|
19
22
|
box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));
|
|
20
23
|
}
|
|
24
|
+
.nile-chart-header-tooltip.below {
|
|
25
|
+
transform: translate(-50%, 10px);
|
|
26
|
+
}
|
|
27
|
+
.nile-chart-header-tooltip.below::after {
|
|
28
|
+
top: auto;
|
|
29
|
+
bottom: 100%;
|
|
30
|
+
border-top-color: transparent;
|
|
31
|
+
border-bottom-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
32
|
+
}
|
|
21
33
|
.nile-chart-header-tooltip::after {
|
|
22
34
|
content: '';
|
|
23
35
|
position: absolute;
|
|
24
36
|
top: 100%;
|
|
25
|
-
left: 50
|
|
37
|
+
left: var(--tip-arrow-x, 50%);
|
|
26
38
|
transform: translateX(-50%);
|
|
27
39
|
border: 5px solid transparent;
|
|
28
40
|
border-top-color: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
@@ -170,6 +182,50 @@ export const styles = css `
|
|
|
170
182
|
flex: 1 1 auto;
|
|
171
183
|
}
|
|
172
184
|
|
|
185
|
+
/* Only rendered when chartInfo is set; otherwise the title <p> sits directly in the titles column. */
|
|
186
|
+
.nile-chart-header-title-row {
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
190
|
+
min-width: 0;
|
|
191
|
+
width: 100%;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.nile-chart-header-title-row .nile-chart-header-title {
|
|
195
|
+
width: auto;
|
|
196
|
+
flex: 0 1 auto;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.nile-chart-header-info {
|
|
200
|
+
display: inline-flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: center;
|
|
203
|
+
flex: 0 0 auto;
|
|
204
|
+
/* Hover/focus target never shrinks below the default glyph size, whatever chartInfoIconSize is. */
|
|
205
|
+
min-width: var(--nile-height-16px, var(--ng-height-16px));
|
|
206
|
+
min-height: var(--nile-height-16px, var(--ng-height-16px));
|
|
207
|
+
color: var(--nile-chart-header-info-color, var(--nile-colors-neutral-700, var(--ng-colors-fg-tertiary-600)));
|
|
208
|
+
border-radius: 50%;
|
|
209
|
+
cursor: pointer;
|
|
210
|
+
outline: none;
|
|
211
|
+
transition: color var(--nile-transition-duration-default, var(--ng-transition-duration-default)) ease;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* currentColor follows .nile-chart-header-info's colour. */
|
|
215
|
+
.nile-chart-header-info nile-glyph {
|
|
216
|
+
display: block;
|
|
217
|
+
--nile-svg-fill: currentColor;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.nile-chart-header-info:hover,
|
|
221
|
+
.nile-chart-header-info:focus-visible {
|
|
222
|
+
color: var(--nile-chart-header-info-hover-color, var(--nile-colors-dark-900, var(--ng-colors-fg-tertiary-hover)));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.nile-chart-header-info:focus-visible {
|
|
226
|
+
box-shadow: 0 0 0 2px var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
|
|
227
|
+
}
|
|
228
|
+
|
|
173
229
|
.nile-chart-header-title {
|
|
174
230
|
margin: 0;
|
|
175
231
|
font-family: var(--nile-font-family-serif-colfax-medium, var(--ng-font-family-display));
|
|
@@ -86,6 +86,7 @@ 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;
|
|
89
90
|
private _headerResizeObs;
|
|
90
91
|
/** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
|
|
91
92
|
config: NileChartConfig | NileChartConfigInputType | null;
|
|
@@ -227,6 +228,7 @@ export declare class NileChart extends NileElement {
|
|
|
227
228
|
/** Normalize a numeric (→px) or string dimension to a CSS length. */
|
|
228
229
|
private static toCssSize;
|
|
229
230
|
private get titleFontSize();
|
|
231
|
+
private headerInfo;
|
|
230
232
|
private get subtitleFontSize();
|
|
231
233
|
private onHeaderSlotChange;
|
|
232
234
|
private onHeaderActionsSlotChange;
|
|
@@ -247,6 +249,11 @@ export declare class NileChart extends NileElement {
|
|
|
247
249
|
private renderAiTrigger;
|
|
248
250
|
private _showHeaderTip;
|
|
249
251
|
private _hideHeaderTip;
|
|
252
|
+
private _onViewportMove;
|
|
253
|
+
private _onHeaderInfoEnter;
|
|
254
|
+
private _onHeaderInfoKeydown;
|
|
255
|
+
/** Info icon beside the header title. Tooltip, focus and ARIA live on the wrapper, not the glyph. */
|
|
256
|
+
private renderHeaderInfo;
|
|
250
257
|
private _onHeaderTextEnter;
|
|
251
258
|
private _syncHeaderTruncationA11y;
|
|
252
259
|
private renderHeader;
|
|
@@ -2,6 +2,7 @@ var NileChart_1;
|
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
4
4
|
import { html, nothing } from 'lit';
|
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
6
|
import NileElement from '../internal/base/nile-element.js';
|
|
6
7
|
import { styles, tooltipCss, injectGlobalChartMenuOverrides } from './nile-chart.css.js';
|
|
7
8
|
import { HIGHCHARTS_PASSTHROUGH_KEYS } from '../internal/types/index.js';
|
|
@@ -165,6 +166,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
165
166
|
constructor() {
|
|
166
167
|
super(...arguments);
|
|
167
168
|
this._headerTipEl = null;
|
|
169
|
+
this._headerInfoTipActive = false;
|
|
168
170
|
this._headerResizeObs = null;
|
|
169
171
|
/** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
|
|
170
172
|
this.config = null;
|
|
@@ -283,14 +285,26 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
283
285
|
}
|
|
284
286
|
};
|
|
285
287
|
this.resolvedConfig = null;
|
|
288
|
+
// The tooltip is fixed to the viewport and placed once, so any scroll (including a touch-drag while the
|
|
289
|
+
// finger is still down, when no leave/blur fires) would strand it away from its anchor. Hide it instead.
|
|
290
|
+
this._onViewportMove = () => this._hideHeaderTip();
|
|
286
291
|
// Reveal the full text when a title/subtitle is truncated. Accepts any Event
|
|
287
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
|
+
};
|
|
288
302
|
this._onHeaderTextEnter = (e) => {
|
|
289
303
|
const el = e.currentTarget;
|
|
290
304
|
if (el.scrollWidth <= el.clientWidth)
|
|
291
305
|
return;
|
|
292
306
|
const rect = el.getBoundingClientRect();
|
|
293
|
-
this._showHeaderTip(el.textContent ?? '', rect.left + rect.width / 2, rect.top);
|
|
307
|
+
this._showHeaderTip(el.textContent ?? '', rect.left + rect.width / 2, rect.top, rect.height);
|
|
294
308
|
};
|
|
295
309
|
// ── ECharts engine path (NILE-005) ──────────────────────────────
|
|
296
310
|
this._echart = null;
|
|
@@ -387,6 +401,7 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
387
401
|
document.removeEventListener('click', this.handleOutsideClick);
|
|
388
402
|
this.removeEventListener('nile-chart-ready', this.handleChartReady);
|
|
389
403
|
this.removeEventListener('dblclick', this._onDoubleTap);
|
|
404
|
+
this._hideHeaderTip();
|
|
390
405
|
this._headerTipEl?.remove();
|
|
391
406
|
this._headerTipEl = null;
|
|
392
407
|
this._headerResizeObs?.disconnect();
|
|
@@ -412,6 +427,9 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
412
427
|
return this.mergeChartTypeFromAttr({ ...input });
|
|
413
428
|
}
|
|
414
429
|
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();
|
|
415
433
|
if (changedProperties.has('engine')) {
|
|
416
434
|
this._echartsFallback = false; // re-evaluate on every engine flip
|
|
417
435
|
if (this.engine !== 'echarts')
|
|
@@ -551,6 +569,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
551
569
|
get titleFontSize() {
|
|
552
570
|
return NileChart_1.toCssSize(this.activeConfig?.titleFontSize ?? this.resolvedConfig?.titleFontSize);
|
|
553
571
|
}
|
|
572
|
+
headerInfo(key) {
|
|
573
|
+
// The info keys travel as a unit: once the active config sets chartInfo (even '' to clear it) all
|
|
574
|
+
// five keys come from it, so its text is never paired with another config's icon, size or colour.
|
|
575
|
+
const source = this.activeConfig?.chartInfo !== undefined ? this.activeConfig : this.resolvedConfig;
|
|
576
|
+
return source?.[key];
|
|
577
|
+
}
|
|
554
578
|
get subtitleFontSize() {
|
|
555
579
|
return NileChart_1.toCssSize(this.activeConfig?.subtitleFontSize ?? this.resolvedConfig?.subtitleFontSize);
|
|
556
580
|
}
|
|
@@ -764,17 +788,57 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
764
788
|
<slot name="nile-ai-trigger-after"></slot>
|
|
765
789
|
`;
|
|
766
790
|
}
|
|
767
|
-
_showHeaderTip(text, x, y) {
|
|
791
|
+
_showHeaderTip(text, x, y, anchorHeight = 0) {
|
|
768
792
|
if (!this._headerTipEl)
|
|
769
793
|
return;
|
|
770
794
|
this._headerTipEl.textContent = text;
|
|
771
795
|
this._headerTipEl.style.left = `${x}px`;
|
|
772
796
|
this._headerTipEl.style.top = `${y}px`;
|
|
773
797
|
this._headerTipEl.style.display = 'block';
|
|
798
|
+
window.addEventListener('scroll', this._onViewportMove, { capture: true, passive: true });
|
|
799
|
+
window.addEventListener('resize', this._onViewportMove, { passive: true });
|
|
800
|
+
// Keep the tooltip inside the viewport; the arrow keeps pointing at the anchor.
|
|
801
|
+
const margin = 8;
|
|
802
|
+
const half = this._headerTipEl.offsetWidth / 2;
|
|
803
|
+
const cx = Math.min(Math.max(x, half + margin), Math.max(half + margin, window.innerWidth - half - margin));
|
|
804
|
+
this._headerTipEl.style.left = `${cx}px`;
|
|
805
|
+
this._headerTipEl.style.setProperty('--tip-arrow-x', `${half + x - cx}px`);
|
|
806
|
+
// Not enough room above the anchor: drop below it instead.
|
|
807
|
+
const above = y - this._headerTipEl.offsetHeight - 10 >= margin;
|
|
808
|
+
this._headerTipEl.classList.toggle('below', !above);
|
|
809
|
+
if (!above)
|
|
810
|
+
this._headerTipEl.style.top = `${y + anchorHeight}px`;
|
|
774
811
|
}
|
|
775
812
|
_hideHeaderTip() {
|
|
813
|
+
this._headerInfoTipActive = false;
|
|
776
814
|
if (this._headerTipEl)
|
|
777
815
|
this._headerTipEl.style.display = 'none';
|
|
816
|
+
window.removeEventListener('scroll', this._onViewportMove, true);
|
|
817
|
+
window.removeEventListener('resize', this._onViewportMove);
|
|
818
|
+
}
|
|
819
|
+
/** Info icon beside the header title. Tooltip, focus and ARIA live on the wrapper, not the glyph. */
|
|
820
|
+
renderHeaderInfo() {
|
|
821
|
+
const info = String(this.headerInfo('chartInfo') ?? '');
|
|
822
|
+
if (!info)
|
|
823
|
+
return nothing;
|
|
824
|
+
const size = this.headerInfo('chartInfoIconSize');
|
|
825
|
+
return html `<span
|
|
826
|
+
class="nile-chart-header-info"
|
|
827
|
+
part="header-info"
|
|
828
|
+
role="img"
|
|
829
|
+
tabindex="0"
|
|
830
|
+
aria-label=${info}
|
|
831
|
+
@mouseenter=${this._onHeaderInfoEnter}
|
|
832
|
+
@mouseleave=${() => this._hideHeaderTip()}
|
|
833
|
+
@focus=${this._onHeaderInfoEnter}
|
|
834
|
+
@blur=${() => this._hideHeaderTip()}
|
|
835
|
+
@keydown=${this._onHeaderInfoKeydown}
|
|
836
|
+
><nile-glyph
|
|
837
|
+
name=${this.headerInfo('chartInfoIcon') || 'ng-info-circle'}
|
|
838
|
+
method=${this.headerInfo('chartInfoIconMethod') || 'stroke'}
|
|
839
|
+
size=${ifDefined(size === '' || size == null ? undefined : size)}
|
|
840
|
+
color=${this.headerInfo('chartInfoIconColor') || 'currentColor'}
|
|
841
|
+
></nile-glyph></span>`;
|
|
778
842
|
}
|
|
779
843
|
_syncHeaderTruncationA11y() {
|
|
780
844
|
const root = this.shadowRoot;
|
|
@@ -790,7 +854,8 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
790
854
|
}
|
|
791
855
|
else {
|
|
792
856
|
el.removeAttribute('tabindex');
|
|
793
|
-
this.
|
|
857
|
+
if (!this._headerInfoTipActive)
|
|
858
|
+
this._hideHeaderTip();
|
|
794
859
|
}
|
|
795
860
|
}
|
|
796
861
|
}
|
|
@@ -809,7 +874,11 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
809
874
|
<slot name="header" @slotchange=${this.onHeaderSlotChange}></slot>
|
|
810
875
|
${showDefaultTitles
|
|
811
876
|
? html `
|
|
812
|
-
${title
|
|
877
|
+
${title
|
|
878
|
+
? this.headerInfo('chartInfo')
|
|
879
|
+
? html `<div class="nile-chart-header-title-row" part="header-title-row">${html `<p class="nile-chart-header-title" part="header-title" style=${titleFontSize ? `font-size:${titleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${title}</p>`}${this.renderHeaderInfo()}</div>`
|
|
880
|
+
: html `<p class="nile-chart-header-title" part="header-title" style=${titleFontSize ? `font-size:${titleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${title}</p>`
|
|
881
|
+
: nothing}
|
|
813
882
|
${subtitle ? html `<p class="nile-chart-header-subtitle" part="header-subtitle" style=${subtitleFontSize ? `font-size:${subtitleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${subtitle}</p>` : nothing}
|
|
814
883
|
`
|
|
815
884
|
: nothing}
|
|
@@ -2130,6 +2199,12 @@ let NileChart = NileChart_1 = class NileChart extends NileElement {
|
|
|
2130
2199
|
gaugeLabelYOffset: k.gaugeLabelYOffset,
|
|
2131
2200
|
valueFontSize: k.valueFontSize,
|
|
2132
2201
|
valueColor: k.valueColor,
|
|
2202
|
+
valueInfo: k.valueInfo,
|
|
2203
|
+
valueInfoPlacement: k.valueInfoPlacement,
|
|
2204
|
+
valueInfoIcon: k.valueInfoIcon,
|
|
2205
|
+
valueInfoIconMethod: k.valueInfoIconMethod,
|
|
2206
|
+
valueInfoIconSize: k.valueInfoIconSize,
|
|
2207
|
+
valueInfoIconColor: k.valueInfoIconColor,
|
|
2133
2208
|
labelColor: k.labelColor,
|
|
2134
2209
|
labelFontSize: k.labelFontSize,
|
|
2135
2210
|
labelFontWeight: k.labelFontWeight,
|
|
@@ -70,7 +70,7 @@ 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 (
|
|
73
|
+
/* Value info icon (default size is nile-glyph's own 16). */
|
|
74
74
|
--nile-kpi-info-color: var(--nile-colors-neutral-700, var(--ng-colors-fg-tertiary-600));
|
|
75
75
|
--nile-kpi-info-hover-color: var(--nile-colors-dark-900, var(--ng-colors-fg-tertiary-hover));
|
|
76
76
|
display: flex;
|
|
@@ -198,7 +198,12 @@ export const styles = css `
|
|
|
198
198
|
|
|
199
199
|
.kpi-info {
|
|
200
200
|
display: inline-flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: center;
|
|
201
203
|
flex: 0 0 auto;
|
|
204
|
+
/* Hover/focus target never shrinks below the default glyph size, whatever valueInfoIconSize is. */
|
|
205
|
+
min-width: var(--nile-height-16px, var(--ng-height-16px));
|
|
206
|
+
min-height: var(--nile-height-16px, var(--ng-height-16px));
|
|
202
207
|
color: var(--nile-kpi-info-color);
|
|
203
208
|
border-radius: 50%;
|
|
204
209
|
cursor: pointer;
|
|
@@ -226,6 +231,10 @@ export const styles = css `
|
|
|
226
231
|
align-self: flex-start;
|
|
227
232
|
}
|
|
228
233
|
|
|
234
|
+
.kpi-info--center {
|
|
235
|
+
align-self: center;
|
|
236
|
+
}
|
|
237
|
+
|
|
229
238
|
.kpi-info--bottom {
|
|
230
239
|
align-self: flex-end;
|
|
231
240
|
}
|
|
@@ -7,7 +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
|
+
export type KpiInfoPlacement = 'top-right' | 'center-right' | 'bottom-right' | 'top-left' | 'center-left' | 'bottom-left';
|
|
11
11
|
/** `chart` slice for `<nile-kpi-chart>.config` (discriminated by `type: 'kpi'`). */
|
|
12
12
|
export interface ChartKpiSeparatedPayload {
|
|
13
13
|
type: 'kpi';
|
|
@@ -70,6 +70,14 @@ export interface ChartKpiSeparatedPayload {
|
|
|
70
70
|
valueInfo?: string;
|
|
71
71
|
/** Info icon position relative to the value (default: 'top-right'). */
|
|
72
72
|
valueInfoPlacement?: KpiInfoPlacement;
|
|
73
|
+
/** `nile-glyph` name for the info icon (default: 'ng-info-circle'). */
|
|
74
|
+
valueInfoIcon?: string;
|
|
75
|
+
/** `nile-glyph` `method` for the info icon (default: 'stroke'). */
|
|
76
|
+
valueInfoIconMethod?: string;
|
|
77
|
+
/** `nile-glyph` `size` for the info icon (default: the 16px height token)*/
|
|
78
|
+
valueInfoIconSize?: string | number;
|
|
79
|
+
/** nile-glyph` `color` for the info icon, passed through unchanged */
|
|
80
|
+
valueInfoIconColor?: string;
|
|
73
81
|
/** Custom text shown in the loading state (default: 'Loading...'). */
|
|
74
82
|
loadingText?: string;
|
|
75
83
|
/** Whether the hover tooltip is shown on value / sparkline / gauge (default: true). */
|
|
@@ -241,8 +249,16 @@ export declare class NileKpiChart extends NileElement {
|
|
|
241
249
|
valueColor: string;
|
|
242
250
|
/** Info text shown on hover/focus of an icon beside the value. Empty → no icon. */
|
|
243
251
|
valueInfo: string;
|
|
244
|
-
/** Info icon position: top-/bottom- (superscript/subscript), -left (before prefix) / -right (after suffix). */
|
|
252
|
+
/** Info icon position: top-/center-/bottom- (superscript/vertically centred/subscript), -left (before prefix) / -right (after suffix). */
|
|
245
253
|
valueInfoPlacement: KpiInfoPlacement;
|
|
254
|
+
/** `nile-glyph` name used for the info icon. Empty → 'ng-info-circle'. */
|
|
255
|
+
valueInfoIcon: string;
|
|
256
|
+
/** `nile-glyph` `method` for the info icon. */
|
|
257
|
+
valueInfoIconMethod: string;
|
|
258
|
+
/** `nile-glyph` `size` for the info icon. Changes the glyph only, not the hover/focus target (min: the 16px height token). Empty → not passed, so `nile-glyph` uses its own default (16). */
|
|
259
|
+
valueInfoIconSize: string | number;
|
|
260
|
+
/** `nile-glyph` `color` for the info icon */
|
|
261
|
+
valueInfoIconColor: string;
|
|
246
262
|
/** Custom text shown in the loading state. */
|
|
247
263
|
loadingText: string;
|
|
248
264
|
/** Whether the hover tooltip is shown on value / sparkline / gauge. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
3
|
import { html, nothing } from 'lit';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
5
|
import NileElement from '../internal/base/nile-element.js';
|
|
5
6
|
import { getHighcharts } from '../internal/utils/highcharts-provider.js';
|
|
6
7
|
import { styles, tooltipCss } from './nile-kpi-chart.css.js';
|
|
@@ -120,8 +121,16 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
120
121
|
this.valueColor = '';
|
|
121
122
|
/** Info text shown on hover/focus of an icon beside the value. Empty → no icon. */
|
|
122
123
|
this.valueInfo = '';
|
|
123
|
-
/** Info icon position: top-/bottom- (superscript/subscript), -left (before prefix) / -right (after suffix). */
|
|
124
|
+
/** Info icon position: top-/center-/bottom- (superscript/vertically centred/subscript), -left (before prefix) / -right (after suffix). */
|
|
124
125
|
this.valueInfoPlacement = 'top-right';
|
|
126
|
+
/** `nile-glyph` name used for the info icon. Empty → 'ng-info-circle'. */
|
|
127
|
+
this.valueInfoIcon = 'ng-info-circle';
|
|
128
|
+
/** `nile-glyph` `method` for the info icon. */
|
|
129
|
+
this.valueInfoIconMethod = 'stroke';
|
|
130
|
+
/** `nile-glyph` `size` for the info icon. Changes the glyph only, not the hover/focus target (min: the 16px height token). Empty → not passed, so `nile-glyph` uses its own default (16). */
|
|
131
|
+
this.valueInfoIconSize = '';
|
|
132
|
+
/** `nile-glyph` `color` for the info icon */
|
|
133
|
+
this.valueInfoIconColor = '';
|
|
125
134
|
/** Custom text shown in the loading state. */
|
|
126
135
|
this.loadingText = 'Loading...';
|
|
127
136
|
/** Whether the hover tooltip is shown on value / sparkline / gauge. */
|
|
@@ -591,8 +600,16 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
591
600
|
this.valueColor = c.valueColor;
|
|
592
601
|
if (c.valueInfo !== undefined)
|
|
593
602
|
this.valueInfo = c.valueInfo;
|
|
594
|
-
if (c.valueInfoPlacement
|
|
603
|
+
if (c.valueInfoPlacement != null)
|
|
595
604
|
this.valueInfoPlacement = c.valueInfoPlacement;
|
|
605
|
+
if (c.valueInfoIcon != null)
|
|
606
|
+
this.valueInfoIcon = c.valueInfoIcon;
|
|
607
|
+
if (c.valueInfoIconMethod != null)
|
|
608
|
+
this.valueInfoIconMethod = c.valueInfoIconMethod;
|
|
609
|
+
if (c.valueInfoIconSize != null)
|
|
610
|
+
this.valueInfoIconSize = c.valueInfoIconSize;
|
|
611
|
+
if (c.valueInfoIconColor != null)
|
|
612
|
+
this.valueInfoIconColor = c.valueInfoIconColor;
|
|
596
613
|
if (c.loadingText !== undefined)
|
|
597
614
|
this.loadingText = c.loadingText;
|
|
598
615
|
if (c.tooltipEnabled !== undefined)
|
|
@@ -1093,9 +1110,9 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
1093
1110
|
renderValueInfo() {
|
|
1094
1111
|
if (!this.valueInfo)
|
|
1095
1112
|
return nothing;
|
|
1096
|
-
const [vertical, side] = this.valueInfoPlacement.split('-');
|
|
1113
|
+
const [vertical, side] = (typeof this.valueInfoPlacement === 'string' ? this.valueInfoPlacement : 'top-right').split('-');
|
|
1097
1114
|
return html `<span
|
|
1098
|
-
class="kpi-info kpi-info--${vertical === 'bottom'
|
|
1115
|
+
class="kpi-info kpi-info--${vertical === 'bottom' || vertical === 'center' ? vertical : 'top'} kpi-info--${side === 'left' ? 'left' : 'right'}"
|
|
1099
1116
|
part="value-info"
|
|
1100
1117
|
role="img"
|
|
1101
1118
|
tabindex="0"
|
|
@@ -1105,7 +1122,12 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
1105
1122
|
@focus=${this._onInfoEnter}
|
|
1106
1123
|
@blur=${this._onTipLeave}
|
|
1107
1124
|
@keydown=${this._onTrendKeydown}
|
|
1108
|
-
><nile-glyph
|
|
1125
|
+
><nile-glyph
|
|
1126
|
+
name=${this.valueInfoIcon || 'ng-info-circle'}
|
|
1127
|
+
method=${this.valueInfoIconMethod || 'stroke'}
|
|
1128
|
+
size=${ifDefined(this.valueInfoIconSize === '' || this.valueInfoIconSize == null ? undefined : this.valueInfoIconSize)}
|
|
1129
|
+
color=${this.valueInfoIconColor || 'currentColor'}
|
|
1130
|
+
></nile-glyph></span>`;
|
|
1109
1131
|
}
|
|
1110
1132
|
renderTrend() {
|
|
1111
1133
|
if (this.trendValue === null)
|
|
@@ -1170,7 +1192,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
|
|
|
1170
1192
|
const fmt = rawNum != null ? this.formatValue(rawNum) : null;
|
|
1171
1193
|
const displayValue = fmt ? fmt.display : String(this.value ?? '');
|
|
1172
1194
|
const showTooltip = !!fmt && fmt.display !== fmt.full;
|
|
1173
|
-
const infoLeft = this.valueInfoPlacement.endsWith('-left');
|
|
1195
|
+
const infoLeft = typeof this.valueInfoPlacement === 'string' && this.valueInfoPlacement.endsWith('-left');
|
|
1174
1196
|
return html `
|
|
1175
1197
|
<div class="kpi ${isGauge ? 'kpi--gauge' : ''}">
|
|
1176
1198
|
${this.label ? html `<p
|
|
@@ -1369,6 +1391,18 @@ __decorate([
|
|
|
1369
1391
|
__decorate([
|
|
1370
1392
|
property({ type: String, attribute: 'value-info-placement' })
|
|
1371
1393
|
], NileKpiChart.prototype, "valueInfoPlacement", void 0);
|
|
1394
|
+
__decorate([
|
|
1395
|
+
property({ type: String, attribute: true })
|
|
1396
|
+
], NileKpiChart.prototype, "valueInfoIcon", void 0);
|
|
1397
|
+
__decorate([
|
|
1398
|
+
property({ type: String, attribute: true })
|
|
1399
|
+
], NileKpiChart.prototype, "valueInfoIconMethod", void 0);
|
|
1400
|
+
__decorate([
|
|
1401
|
+
property({ attribute: true })
|
|
1402
|
+
], NileKpiChart.prototype, "valueInfoIconSize", void 0);
|
|
1403
|
+
__decorate([
|
|
1404
|
+
property({ type: String, attribute: true })
|
|
1405
|
+
], NileKpiChart.prototype, "valueInfoIconColor", void 0);
|
|
1372
1406
|
__decorate([
|
|
1373
1407
|
property({ type: String, attribute: 'loading-text' })
|
|
1374
1408
|
], NileKpiChart.prototype, "loadingText", void 0);
|