@aquera/nile-visualization 2.9.9 → 2.9.11
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/dist/src/nile-chart/nile-chart-skeleton.d.ts +2 -0
- package/dist/src/nile-chart/nile-chart-skeleton.js +184 -0
- package/dist/src/nile-chart/nile-chart.css.js +416 -40
- package/dist/src/nile-chart/nile-chart.d.ts +1 -0
- package/dist/src/nile-chart/nile-chart.js +11 -17
- package/dist/src/nile-filter-chart/nile-filter-chart.css.js +13 -18
- package/dist/src/nile-filter-chart/utils/prompt.js +1 -1
- package/dist/src/nile-filter-chart/utils/types.d.ts +1 -2
- package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +197 -24
- package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +10 -1
- package/dist/src/nile-kpi-chart/nile-kpi-chart.js +205 -26
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@ export const styles = css `
|
|
|
47
47
|
--nile-kpi-label-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
48
48
|
--nile-kpi-label-font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
49
49
|
--nile-kpi-label-font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
50
|
-
--nile-kpi-value-font-size: clamp(
|
|
50
|
+
--nile-kpi-value-font-size: clamp(22px, 9cqi, 36px);
|
|
51
51
|
--nile-kpi-value-color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
|
|
52
52
|
--nile-kpi-prefix-suffix-font-size: var(--nile-type-scale-6, var(--ng-font-size-text-xl));
|
|
53
53
|
--nile-kpi-prefix-suffix-color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
|
|
@@ -63,7 +63,14 @@ export const styles = css `
|
|
|
63
63
|
position: relative;
|
|
64
64
|
box-sizing: border-box;
|
|
65
65
|
overflow: hidden;
|
|
66
|
-
container
|
|
66
|
+
/* size containment so @container queries can use both width and height */
|
|
67
|
+
container-type: size;
|
|
68
|
+
min-height: 120px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Gauge variant needs more vertical room so the ring renders at a usable size. */
|
|
72
|
+
:host([variant='gauge']) {
|
|
73
|
+
min-height: 200px;
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
:host([hidden]) {
|
|
@@ -75,6 +82,7 @@ export const styles = css `
|
|
|
75
82
|
element is already flex:1, so it stretches with the host. */
|
|
76
83
|
:host([fit]) {
|
|
77
84
|
height: 100%;
|
|
85
|
+
min-height: 0;
|
|
78
86
|
}
|
|
79
87
|
|
|
80
88
|
/* Card / gauge chrome on the host when used alone (inside nile-chart, embed-in-nile-chart skips this). */
|
|
@@ -142,6 +150,7 @@ export const styles = css `
|
|
|
142
150
|
align-items: center;
|
|
143
151
|
gap: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
144
152
|
flex-wrap: nowrap;
|
|
153
|
+
flex: 0 0 auto;
|
|
145
154
|
min-width: 0;
|
|
146
155
|
overflow: hidden;
|
|
147
156
|
}
|
|
@@ -155,10 +164,7 @@ export const styles = css `
|
|
|
155
164
|
line-height: 1.2;
|
|
156
165
|
cursor: default;
|
|
157
166
|
white-space: nowrap;
|
|
158
|
-
|
|
159
|
-
flex: 0 1 auto;
|
|
160
|
-
overflow: hidden;
|
|
161
|
-
text-overflow: ellipsis;
|
|
167
|
+
flex: 0 0 auto;
|
|
162
168
|
}
|
|
163
169
|
|
|
164
170
|
.kpi-prefix,
|
|
@@ -178,6 +184,21 @@ export const styles = css `
|
|
|
178
184
|
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
179
185
|
font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
|
|
180
186
|
font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
|
|
187
|
+
flex: 1 1 0;
|
|
188
|
+
min-width: 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.kpi-trend-arrow,
|
|
192
|
+
.kpi-trend-value {
|
|
193
|
+
flex: 0 0 auto;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.kpi-trend-label {
|
|
197
|
+
flex: 0 1 auto;
|
|
198
|
+
min-width: 0;
|
|
199
|
+
overflow: hidden;
|
|
200
|
+
text-overflow: ellipsis;
|
|
201
|
+
white-space: nowrap;
|
|
181
202
|
line-height: 1;
|
|
182
203
|
flex-shrink: 1;
|
|
183
204
|
min-width: 0;
|
|
@@ -229,20 +250,17 @@ export const styles = css `
|
|
|
229
250
|
|
|
230
251
|
.kpi-sparkline {
|
|
231
252
|
width: 100%;
|
|
232
|
-
flex:
|
|
233
|
-
min-height:
|
|
253
|
+
flex: 1 1 24px;
|
|
254
|
+
min-height: 24px;
|
|
234
255
|
margin-top: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
235
256
|
}
|
|
236
257
|
|
|
237
258
|
/* ── Container queries: scale down for narrow cards ── */
|
|
238
259
|
|
|
239
|
-
/* Medium-small: ~280px and below —
|
|
260
|
+
/* Medium-small: ~280px and below — shrink prefix/suffix only */
|
|
240
261
|
@container (max-width: 280px) {
|
|
241
262
|
:host {
|
|
242
|
-
--nile-kpi-padding-v: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
243
|
-
--nile-kpi-padding-h: var(--nile-spacing-xl, var(--ng-spacing-xl));
|
|
244
263
|
--nile-kpi-prefix-suffix-font-size: var(--nile-type-scale-4, var(--ng-font-size-text-md));
|
|
245
|
-
--nile-kpi-label-font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
|
|
246
264
|
}
|
|
247
265
|
|
|
248
266
|
.kpi-value-row {
|
|
@@ -257,8 +275,6 @@ export const styles = css `
|
|
|
257
275
|
/* Small: ~220px and below — tighten further; description/sparkline stay visible. */
|
|
258
276
|
@container (max-width: 220px) {
|
|
259
277
|
:host {
|
|
260
|
-
--nile-kpi-padding-v: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
261
|
-
--nile-kpi-padding-h: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
262
278
|
--nile-kpi-prefix-suffix-font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
|
|
263
279
|
--nile-kpi-description-font-size: var(--nile-type-scale-1, var(--ng-font-size-text-xs));
|
|
264
280
|
}
|
|
@@ -269,15 +285,161 @@ export const styles = css `
|
|
|
269
285
|
}
|
|
270
286
|
}
|
|
271
287
|
|
|
272
|
-
/*
|
|
288
|
+
/* Sparkline is the lowest-priority piece — hide it before the trend so
|
|
289
|
+
the visible order stays value → trend → sparkline. */
|
|
273
290
|
@container (max-width: 180px) {
|
|
291
|
+
.kpi-sparkline {
|
|
292
|
+
display: none;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* At minimum height (h ≤ 75px and not short-wide) —
|
|
297
|
+
hide everything except the value and trend. */
|
|
298
|
+
@container (max-height: 50px) and (max-width: 319.98px) {
|
|
299
|
+
.kpi-label,
|
|
300
|
+
.kpi-description,
|
|
301
|
+
.kpi-sparkline {
|
|
302
|
+
display: none;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
:host([variant='gauge']) .kpi {
|
|
306
|
+
padding: 0;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* Gauge card is short — collapse padding so the gauge still renders. */
|
|
311
|
+
@container (max-height: 109.98px) {
|
|
312
|
+
:host([variant='gauge']) .kpi {
|
|
313
|
+
padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-md, var(--ng-spacing-md));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* Narrow card — keep trend inline next to value. Behavior is the same at
|
|
318
|
+
any height so the trend doesn't appear/disappear when the card grows
|
|
319
|
+
taller, only when it grows wider/narrower. The arrow + numeric value
|
|
320
|
+
stay intact; only the label ellipses when space is tight. */
|
|
321
|
+
@container (max-width: 320px) {
|
|
274
322
|
.kpi-value-row {
|
|
275
|
-
flex-
|
|
276
|
-
|
|
323
|
+
flex-direction: row;
|
|
324
|
+
align-items: center;
|
|
325
|
+
gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
|
|
326
|
+
overflow: hidden;
|
|
277
327
|
}
|
|
278
328
|
|
|
329
|
+
/* Treat arrow + value + label as a single text run that ellipses
|
|
330
|
+
together: switch the trend from flex to a single inline-block with
|
|
331
|
+
white-space:nowrap so text-overflow:ellipsis applies across the
|
|
332
|
+
whole "▲ 14.2% vs last month" string instead of only the label. */
|
|
279
333
|
.kpi-trend {
|
|
280
|
-
|
|
334
|
+
display: inline-block;
|
|
335
|
+
flex: 1 1 0;
|
|
336
|
+
min-width: 0;
|
|
337
|
+
max-width: 100%;
|
|
338
|
+
padding-left: 0;
|
|
339
|
+
overflow: hidden;
|
|
340
|
+
text-overflow: ellipsis;
|
|
341
|
+
white-space: nowrap;
|
|
342
|
+
line-height: 1;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.kpi-trend-arrow {
|
|
346
|
+
display: inline-block;
|
|
347
|
+
vertical-align: middle;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.kpi-trend-value,
|
|
351
|
+
.kpi-trend-label {
|
|
352
|
+
display: inline;
|
|
353
|
+
flex: initial;
|
|
354
|
+
overflow: visible;
|
|
355
|
+
text-overflow: clip;
|
|
356
|
+
min-width: 0;
|
|
357
|
+
white-space: nowrap;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/* Card too short for a clean sparkline — hide it (unless short-wide layout below restores it). */
|
|
362
|
+
@container (max-height: 70px) {
|
|
363
|
+
.kpi-sparkline {
|
|
364
|
+
display: none;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* Tall — there is enough vertical room, bring the sparkline back even at narrow widths. */
|
|
369
|
+
@container (min-height: 80px) {
|
|
370
|
+
.kpi-sparkline {
|
|
371
|
+
display: block;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/* Short but wide (h ≤ 110, w ≥ 320) — lay out value, trend and sparkline horizontally.
|
|
376
|
+
Skip the card-variant gauge here so the gauge ring keeps its vertical room. */
|
|
377
|
+
@container (max-height: 110px) and (min-width: 320px) {
|
|
378
|
+
:host(:not([variant='gauge'])) .kpi {
|
|
379
|
+
flex-direction: row;
|
|
380
|
+
align-items: flex-start;
|
|
381
|
+
justify-content: flex-start;
|
|
382
|
+
gap: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.kpi-label,
|
|
386
|
+
.kpi-description {
|
|
387
|
+
display: none;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.kpi-value-row {
|
|
391
|
+
flex: 0 0 auto;
|
|
392
|
+
flex-direction: row;
|
|
393
|
+
align-items: center;
|
|
394
|
+
overflow: visible;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.kpi-trend {
|
|
398
|
+
display: inline-flex;
|
|
399
|
+
flex: 0 1 auto;
|
|
400
|
+
min-width: 0;
|
|
401
|
+
max-width: 100%;
|
|
402
|
+
overflow: hidden;
|
|
403
|
+
padding-left: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.kpi-trend-label {
|
|
407
|
+
overflow: hidden;
|
|
408
|
+
text-overflow: ellipsis;
|
|
409
|
+
white-space: nowrap;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.kpi-sparkline {
|
|
413
|
+
display: block;
|
|
414
|
+
flex: 1 1 0;
|
|
415
|
+
min-width: 0;
|
|
416
|
+
margin-top: 0;
|
|
417
|
+
align-self: stretch;
|
|
418
|
+
height: auto;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
@container (max-width: 100px) {
|
|
423
|
+
.kpi-sparkline {
|
|
424
|
+
display: none;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/* Constrained both ways — only show the value. */
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
@container (max-width: 180px) and (max-height: 70px) {
|
|
432
|
+
|
|
433
|
+
.kpi-description,
|
|
434
|
+
.kpi-sparkline {
|
|
435
|
+
display: none;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* Short but wide — drop description, keep trend (and sparkline) alongside value. */
|
|
440
|
+
@container (min-width: 180.01px) and (max-height: 85px) {
|
|
441
|
+
.kpi-description {
|
|
442
|
+
display: none;
|
|
281
443
|
}
|
|
282
444
|
}
|
|
283
445
|
|
|
@@ -288,13 +450,24 @@ export const styles = css `
|
|
|
288
450
|
text-align: center;
|
|
289
451
|
}
|
|
290
452
|
|
|
291
|
-
.kpi-gauge-
|
|
453
|
+
.kpi-gauge-slot {
|
|
454
|
+
flex: 1 1 0;
|
|
292
455
|
width: 100%;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
456
|
+
min-width: 0;
|
|
457
|
+
min-height: 40px;
|
|
458
|
+
align-self: stretch;
|
|
459
|
+
display: flex;
|
|
460
|
+
align-items: center;
|
|
461
|
+
justify-content: center;
|
|
462
|
+
overflow: hidden;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.kpi-gauge-container {
|
|
466
|
+
position: relative;
|
|
467
|
+
overflow: hidden;
|
|
468
|
+
box-sizing: border-box;
|
|
469
|
+
display: block;
|
|
470
|
+
flex: 0 0 auto;
|
|
298
471
|
}
|
|
299
472
|
|
|
300
473
|
.kpi--gauge .kpi-value-row {
|
|
@@ -4,7 +4,7 @@ import NileElement from '../internal/nile-element.js';
|
|
|
4
4
|
import type { AqConfigType } from '../internal/types/aq-config.type.js';
|
|
5
5
|
export type TrendDirection = 'up' | 'down' | 'neutral';
|
|
6
6
|
export type KpiVariant = 'default' | 'card' | 'gauge' | 'accent';
|
|
7
|
-
export type SparklineType = 'area' | 'line';
|
|
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
10
|
/** `chart` slice for `<nile-kpi-chart>.config` (discriminated by `type: 'kpi'`). */
|
|
@@ -136,6 +136,7 @@ export declare class NileKpiChart extends NileElement {
|
|
|
136
136
|
private _tipEl;
|
|
137
137
|
private sparklineContainer;
|
|
138
138
|
private gaugeContainer;
|
|
139
|
+
private gaugeSlot;
|
|
139
140
|
/** Full configuration: `{ chart, aq }` (same convention as other Nile charts). */
|
|
140
141
|
config: NileKpiConfigInputType | null;
|
|
141
142
|
/** Display variant: default (flat), card (bordered container), gauge (Highcharts solid gauge). */
|
|
@@ -264,6 +265,12 @@ export declare class NileKpiChart extends NileElement {
|
|
|
264
265
|
disconnectedCallback(): void;
|
|
265
266
|
protected firstUpdated(): void;
|
|
266
267
|
protected updated(changedProperties: PropertyValues): void;
|
|
268
|
+
private _lastSparkSize;
|
|
269
|
+
private _lastGaugeSize;
|
|
270
|
+
private _gaugeRafScheduled;
|
|
271
|
+
private _scheduleGaugeSync;
|
|
272
|
+
private _syncGaugeNow;
|
|
273
|
+
private syncGaugeChartSize;
|
|
267
274
|
private syncSparklineChartSize;
|
|
268
275
|
private setupResizeObserver;
|
|
269
276
|
private _onSparklineMouseMove;
|
|
@@ -278,7 +285,9 @@ export declare class NileKpiChart extends NileElement {
|
|
|
278
285
|
private _onValueEnter;
|
|
279
286
|
private _onDescEnter;
|
|
280
287
|
private _onLabelEnter;
|
|
288
|
+
private _onTrendEnter;
|
|
281
289
|
private _onGaugeEnter;
|
|
290
|
+
private _onTrendKeydown;
|
|
282
291
|
private _onTipLeave;
|
|
283
292
|
private renderTrend;
|
|
284
293
|
render(): TemplateResult;
|