@ids-group-ltd/ids-design-system 0.12.3 → 0.13.0
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/CHANGELOG.md +603 -6
- package/components.md +85 -2
- package/docs/agent/INDEX.md +11 -1
- package/docs/agent/charts/chart-colour-which-palette-a-chart-takes.md +9 -0
- package/docs/agent/charts/chart-frame-the-box-a-chart-draws-around-itself.md +12 -0
- package/docs/agent/charts/ds-bar-chart.md +15 -0
- package/docs/agent/charts/ds-column-chart.md +14 -0
- package/docs/agent/charts/ds-donut-chart.md +17 -0
- package/docs/agent/charts/ds-funnel-chart.md +16 -0
- package/docs/agent/charts/ds-line-chart.md +15 -0
- package/docs/agent/forms/ds-button.md +4 -2
- package/docs/agent/forms/ds-number-stepper.md +1 -0
- package/docs/agent/navigation/ds-sidenav-item.md +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +16 -14
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +161 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +58 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +43 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +197 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +173 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs +299 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +69 -17
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +366 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +10 -14
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +631 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +2 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +18 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +4 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +30 -71
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +31 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +393 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +17 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +3 -0
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +10 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.13.0.json +530 -0
- package/package.json +57 -1
- package/styles/_chart-data-table.scss +95 -0
- package/styles/_chart-frame.scss +53 -0
- package/styles/_chart-interactive.scss +40 -0
- package/styles/_chart-motion.scss +45 -0
- package/styles/_focus.scss +1 -1
- package/styles/_tokens-charts.scss +149 -39
- package/styles/_tokens.scss +17 -4
- package/themes/dark/_theme.scss +37 -29
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +11 -9
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +104 -0
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +37 -4
- package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +34 -0
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +78 -0
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +105 -0
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +4 -1
- package/types/ids-group-ltd-ids-design-system-components-donut-chart.d.ts +113 -0
- package/types/ids-group-ltd-ids-design-system-components-field-group.d.ts +52 -11
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +109 -0
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +5 -7
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +241 -0
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +5 -2
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +16 -4
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +13 -28
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +11 -1
- package/types/ids-group-ltd-ids-design-system-components.d.ts +154 -4
- package/types/ids-group-ltd-ids-design-system-core.d.ts +12 -1
- package/types/ids-group-ltd-ids-design-system.d.ts +9 -2
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, output, numberAttribute, contentChild, signal, computed, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
+
import { formatValue, staggerDelay, nextRovingIndex, focusMark, chartColors, CHART_RAMP_COLORS, formatPercent, describeSeries } from '@ids-group-ltd/ids-design-system/components';
|
|
4
|
+
import { SkeletonComponent } from '@ids-group-ltd/ids-design-system/components/skeleton';
|
|
5
|
+
import { chartActiveMark, ChartTooltipDirective } from '@ids-group-ltd/ids-design-system/components/chart-tooltip';
|
|
6
|
+
|
|
7
|
+
/** Bottom width of the fixed silhouette, as a fraction of the full width. The
|
|
8
|
+
* tail carries a label, so it never narrows past this. */
|
|
9
|
+
const FUNNEL_TAIL_WIDTH = 0.38;
|
|
10
|
+
/** Ramp step for one stage, spread across the whole ramp rather than taking its
|
|
11
|
+
* first `rampedCount` entries — a three-stage funnel that used steps 1-3 would
|
|
12
|
+
* never reach the deep end the ramp exists to provide. */
|
|
13
|
+
function rampPosition(index, rampedCount, rampLength) {
|
|
14
|
+
if (rampLength <= 0 || rampedCount <= 1) {
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
const position = Math.round((index / (rampedCount - 1)) * (rampLength - 1));
|
|
18
|
+
return Math.min(Math.max(position, 0), rampLength - 1);
|
|
19
|
+
}
|
|
20
|
+
/** The viewBox is normalised: depth runs 0..100 whatever the stage count, and
|
|
21
|
+
* the rendered block size carries the real height. */
|
|
22
|
+
const FUNNEL_VIEW_BOX_WIDTH = 100;
|
|
23
|
+
const FUNNEL_VIEW_BOX_HEIGHT = 100;
|
|
24
|
+
/** One inter-stage gap, as a share of a single stage's own depth. A share and
|
|
25
|
+
* not a count of units, because the viewBox depth is normalised: a fixed
|
|
26
|
+
* number of units would grow on screen with every stage added. */
|
|
27
|
+
const FUNNEL_STAGE_GAP_SHARE = 0.14;
|
|
28
|
+
/** Every value as a finite, non-negative number. A negative would mirror a
|
|
29
|
+
* stage about its own centre line, and a non-finite one reaches an SVG
|
|
30
|
+
* attribute as `NaN`, where the renderer drops the whole shape without an
|
|
31
|
+
* error. */
|
|
32
|
+
function sanitizeValues(values) {
|
|
33
|
+
return values.map((value) => Number.isFinite(value) ? Math.max(value, 0) : 0);
|
|
34
|
+
}
|
|
35
|
+
function clampFraction(value) {
|
|
36
|
+
if (!Number.isFinite(value)) {
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
return Math.min(Math.max(value, 0), 1);
|
|
40
|
+
}
|
|
41
|
+
function widthAtDepth(depth, tailWidth) {
|
|
42
|
+
return 1 - (1 - tailWidth) * clampFraction(depth);
|
|
43
|
+
}
|
|
44
|
+
function largestValue(values) {
|
|
45
|
+
return values.reduce((largest, value) => (value > largest ? value : largest), 0);
|
|
46
|
+
}
|
|
47
|
+
/** The depth at which `areaShare` of the silhouette's area lies above. The area
|
|
48
|
+
* down to depth `t` is `t - (1 - tail) * t² / 2` against a whole of
|
|
49
|
+
* `(1 + tail) / 2`, so the depth is a root of that quadratic rather than a
|
|
50
|
+
* ratio — this is the step that makes area, not width, carry the value. The
|
|
51
|
+
* discriminant bottoms out at `tail²`, so the root is always real. */
|
|
52
|
+
function depthForAreaShare(areaShare, tailWidth) {
|
|
53
|
+
const share = clampFraction(areaShare);
|
|
54
|
+
const tail = clampFraction(tailWidth);
|
|
55
|
+
const narrowing = 1 - tail;
|
|
56
|
+
// A silhouette that does not narrow is a rectangle, where area is linear in
|
|
57
|
+
// depth and the quadratic degenerates to 0/0.
|
|
58
|
+
if (narrowing <= 0) {
|
|
59
|
+
return share;
|
|
60
|
+
}
|
|
61
|
+
const discriminant = Math.max(1 - narrowing * share * (1 + tail), 0);
|
|
62
|
+
return clampFraction((1 - Math.sqrt(discriminant)) / narrowing);
|
|
63
|
+
}
|
|
64
|
+
function evenDepths(count) {
|
|
65
|
+
return Array.from({ length: count + 1 }, (_, index) => index / count);
|
|
66
|
+
}
|
|
67
|
+
function boundaryDepths(values, shape, tailWidth) {
|
|
68
|
+
const count = values.length;
|
|
69
|
+
if (shape !== 'area') {
|
|
70
|
+
return evenDepths(count);
|
|
71
|
+
}
|
|
72
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
73
|
+
if (!Number.isFinite(total) || total <= 0) {
|
|
74
|
+
return evenDepths(count);
|
|
75
|
+
}
|
|
76
|
+
const depths = [];
|
|
77
|
+
let consumed = 0;
|
|
78
|
+
for (let index = 0; index <= count; index += 1) {
|
|
79
|
+
depths.push(depthForAreaShare(consumed / total, tailWidth));
|
|
80
|
+
if (index < count) {
|
|
81
|
+
consumed += values[index];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return depths;
|
|
85
|
+
}
|
|
86
|
+
function boundaryWidths(values, shape, depths, tailWidth) {
|
|
87
|
+
if (shape !== 'width') {
|
|
88
|
+
return depths.map((depth) => widthAtDepth(depth, tailWidth));
|
|
89
|
+
}
|
|
90
|
+
const count = values.length;
|
|
91
|
+
const largest = largestValue(values);
|
|
92
|
+
if (!Number.isFinite(largest) || largest <= 0) {
|
|
93
|
+
return depths.map(() => 0);
|
|
94
|
+
}
|
|
95
|
+
// The last boundary repeats the last value, which flattens the closing edge:
|
|
96
|
+
// there is no following stage to taper towards.
|
|
97
|
+
return Array.from({ length: count + 1 }, (_, index) => clampFraction(values[Math.min(index, count - 1)] / largest));
|
|
98
|
+
}
|
|
99
|
+
/** One trapezoid per stage, in fractions of the full width and of the total
|
|
100
|
+
* depth.
|
|
101
|
+
*
|
|
102
|
+
* `'taper'` and `'area'` share one fixed silhouette — full width at the top,
|
|
103
|
+
* `FUNNEL_TAIL_WIDTH` at the bottom — and differ only in where the stage
|
|
104
|
+
* boundaries land on it: evenly spaced for `'taper'`, so width encodes
|
|
105
|
+
* nothing, and at the depths that make each band's area proportional to its
|
|
106
|
+
* value for `'area'`. `'width'` abandons the silhouette and reads every
|
|
107
|
+
* boundary straight off the values. */
|
|
108
|
+
function funnelGeometry(values, shape, tailWidth = FUNNEL_TAIL_WIDTH) {
|
|
109
|
+
const safeValues = sanitizeValues(values);
|
|
110
|
+
if (safeValues.length === 0) {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
const tail = Number.isFinite(tailWidth)
|
|
114
|
+
? clampFraction(tailWidth)
|
|
115
|
+
: FUNNEL_TAIL_WIDTH;
|
|
116
|
+
const depths = boundaryDepths(safeValues, shape, tail);
|
|
117
|
+
const widths = boundaryWidths(safeValues, shape, depths, tail);
|
|
118
|
+
return safeValues.map((_, index) => ({
|
|
119
|
+
top: depths[index],
|
|
120
|
+
bottom: depths[index + 1],
|
|
121
|
+
topWidth: widths[index],
|
|
122
|
+
bottomWidth: widths[index + 1],
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
/** The fall from `previousValue` to `value`, as a fraction of `previousValue`.
|
|
126
|
+
* Null where there is nothing to fall from — a zero or non-finite predecessor
|
|
127
|
+
* makes the ratio 0/0. Negative where the stage grew, which is real data. */
|
|
128
|
+
function stageDrop(previousValue, value) {
|
|
129
|
+
if (!Number.isFinite(previousValue) || !Number.isFinite(value)) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
if (previousValue <= 0) {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
return (previousValue - value) / previousValue;
|
|
136
|
+
}
|
|
137
|
+
/** The drop into each stage. The first entry is null and not zero: a printed
|
|
138
|
+
* `0%` there would claim nobody fell away, rather than that there was no
|
|
139
|
+
* earlier stage to fall from. */
|
|
140
|
+
function stageDrops(values) {
|
|
141
|
+
return values.map((value, index) => index === 0 ? null : stageDrop(values[index - 1], value));
|
|
142
|
+
}
|
|
143
|
+
/** Depth of one inter-stage gap, in viewBox units. */
|
|
144
|
+
function stageGapUnits(stageCount, viewBoxHeight) {
|
|
145
|
+
if (!Number.isFinite(stageCount) ||
|
|
146
|
+
!Number.isFinite(viewBoxHeight) ||
|
|
147
|
+
stageCount <= 0) {
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
return (FUNNEL_STAGE_GAP_SHARE * viewBoxHeight) / stageCount;
|
|
151
|
+
}
|
|
152
|
+
function roundCoordinate(value) {
|
|
153
|
+
return Math.round(value * 1000) / 1000;
|
|
154
|
+
}
|
|
155
|
+
/** The stage's four corners as an SVG `points` value, or an empty string when
|
|
156
|
+
* any input is non-finite. An attribute holding `NaN` is discarded by the
|
|
157
|
+
* renderer without an error, so the shape would go missing in silence. */
|
|
158
|
+
function stagePolygonPoints(geometry, viewBoxWidth, viewBoxHeight, gapUnits) {
|
|
159
|
+
const inputs = [
|
|
160
|
+
geometry.topWidth,
|
|
161
|
+
geometry.bottomWidth,
|
|
162
|
+
geometry.top,
|
|
163
|
+
geometry.bottom,
|
|
164
|
+
viewBoxWidth,
|
|
165
|
+
viewBoxHeight,
|
|
166
|
+
gapUnits,
|
|
167
|
+
];
|
|
168
|
+
if (inputs.some((input) => !Number.isFinite(input))) {
|
|
169
|
+
return '';
|
|
170
|
+
}
|
|
171
|
+
const halfGap = Math.max(gapUnits, 0) / 2;
|
|
172
|
+
const bandTop = clampFraction(geometry.top) * viewBoxHeight;
|
|
173
|
+
const bandBottom = clampFraction(geometry.bottom) * viewBoxHeight;
|
|
174
|
+
let top = bandTop + halfGap;
|
|
175
|
+
let bottom = bandBottom - halfGap;
|
|
176
|
+
if (bottom < top) {
|
|
177
|
+
// A band shallower than the gap it has to leave. Collapse it to a line
|
|
178
|
+
// instead of letting the edges cross and draw a bow tie.
|
|
179
|
+
const middle = (top + bottom) / 2;
|
|
180
|
+
top = middle;
|
|
181
|
+
bottom = middle;
|
|
182
|
+
}
|
|
183
|
+
const horizontalCentre = viewBoxWidth / 2;
|
|
184
|
+
const topWidth = clampFraction(geometry.topWidth);
|
|
185
|
+
const bottomWidth = clampFraction(geometry.bottomWidth);
|
|
186
|
+
// The widths belong to the band's own boundaries, and the gap moves the drawn edges INSIDE them.
|
|
187
|
+
// Drawing the boundary widths at the inset depths makes every band overhang the silhouette at its
|
|
188
|
+
// top and fall short of it at its bottom, so the stack reads as a fir tree rather than a funnel.
|
|
189
|
+
// The silhouette is linear in depth for every shape, so the inset widths interpolate exactly.
|
|
190
|
+
const bandDepth = bandBottom - bandTop;
|
|
191
|
+
// Capped at half: past that the band has collapsed to a line, and an uncapped fraction would
|
|
192
|
+
// swap the two edges and draw the bow tie the collapse exists to prevent.
|
|
193
|
+
const inset = bandDepth > 0 ? Math.min(Math.max(halfGap / bandDepth, 0), 0.5) : 0;
|
|
194
|
+
const widthAt = (fraction) => topWidth + (bottomWidth - topWidth) * fraction;
|
|
195
|
+
const halfTopWidth = (widthAt(inset) * viewBoxWidth) / 2;
|
|
196
|
+
const halfBottomWidth = (widthAt(1 - inset) * viewBoxWidth) / 2;
|
|
197
|
+
return [
|
|
198
|
+
`${roundCoordinate(horizontalCentre - halfTopWidth)},${roundCoordinate(top)}`,
|
|
199
|
+
`${roundCoordinate(horizontalCentre + halfTopWidth)},${roundCoordinate(top)}`,
|
|
200
|
+
`${roundCoordinate(horizontalCentre + halfBottomWidth)},${roundCoordinate(bottom)}`,
|
|
201
|
+
`${roundCoordinate(horizontalCentre - halfBottomWidth)},${roundCoordinate(bottom)}`,
|
|
202
|
+
].join(' ');
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const defaultValueFormat = (value) => formatValue(value);
|
|
206
|
+
const SKELETON_STAGE_WIDTHS = ['88%', '62%', '80%', '54%', '72%'];
|
|
207
|
+
class FunnelChartComponent {
|
|
208
|
+
/** Drawn in the order given. The order of a funnel's stages is its meaning,
|
|
209
|
+
* so they are never sorted. */
|
|
210
|
+
data = input.required(...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
211
|
+
/** What the silhouette encodes. `'area'`, the default, makes each stage's AREA proportional to
|
|
212
|
+
* its value, which is the honest encoding that still leaves a tail wide enough to label.
|
|
213
|
+
* `'width'` reads the widths straight off the values, which collapses the tail of a steep
|
|
214
|
+
* funnel below a labellable width. `'taper'` encodes NOTHING: the shape is fixed whatever the
|
|
215
|
+
* data, and the numbers are read from the table beside it. */
|
|
216
|
+
shape = input('area', ...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []));
|
|
217
|
+
/** The value, percent and drop table printed under the funnel. It supersedes
|
|
218
|
+
* `dataTable`: while this is on, the disclosure every chart carries would
|
|
219
|
+
* repeat a strict subset of these same numbers, so it is not rendered. */
|
|
220
|
+
showTable = input(true, { ...(ngDevMode ? { debugName: "showTable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
221
|
+
/** Printed above the plot as the chart's visible title, and reused as the annex table's
|
|
222
|
+
* caption. */
|
|
223
|
+
caption = input(null, ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
224
|
+
/** Accessible name. Generated from the data when omitted. */
|
|
225
|
+
summary = input(null, ...(ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []));
|
|
226
|
+
/** The label-and-value disclosure every chart carries. Ignored while
|
|
227
|
+
* `showTable` is on, which already prints every label and value. */
|
|
228
|
+
dataTable = input('toggle', ...(ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []));
|
|
229
|
+
/** Draws skeleton marks in place of the data, at the same count, so the chart does not resize
|
|
230
|
+
* when the data lands. */
|
|
231
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
232
|
+
/** Shown in place of the plot when `data` is empty. */
|
|
233
|
+
emptyText = input('No data', ...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
234
|
+
/** Shows `errorText` in place of the plot. Separate from `loading` and from an empty `data`,
|
|
235
|
+
* because "the request failed" and "there is nothing to show" read the same to a reader and
|
|
236
|
+
* mean opposite things. */
|
|
237
|
+
error = input(false, { ...(ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
238
|
+
/** The message the error state prints. */
|
|
239
|
+
errorText = input('Could not load the data', ...(ngDevMode ? [{ debugName: "errorText" }] : /* istanbul ignore next */ []));
|
|
240
|
+
/** Formats every value the chart prints, the annex table and the generated description
|
|
241
|
+
* included. Defaults to the browser's locale grouping with a K/M/B suffix past four digits. */
|
|
242
|
+
valueFormat = input(defaultValueFormat, ...(ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []));
|
|
243
|
+
/** Turns on the click affordance — the pointer cursor and any hover tint.
|
|
244
|
+
* The click output fires whether or not this is set, so a consumer that
|
|
245
|
+
* binds the output and forgets the flag still receives every click. */
|
|
246
|
+
interactive = input(false, { ...(ngDevMode ? { debugName: "interactive" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
247
|
+
/** The stage that was clicked, or activated with Enter or Space. Fires whether or not
|
|
248
|
+
* `interactive` is set. */
|
|
249
|
+
stageClicked = output();
|
|
250
|
+
/** Milliseconds between one mark's entrance and the next. `0`, the default, is no stagger at
|
|
251
|
+
* all; `40` is the documented non-zero step. The total is capped, so a long series does not
|
|
252
|
+
* crawl in. */
|
|
253
|
+
staggerMs = input(0, { ...(ngDevMode ? { debugName: "staggerMs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
254
|
+
markStagger(index) {
|
|
255
|
+
return `${staggerDelay(index, this.staggerMs())}ms`;
|
|
256
|
+
}
|
|
257
|
+
/** Whether a hovered or focused stage opens a tooltip. `'axis'` is not offered — a
|
|
258
|
+
* funnel's stages are its categories, so an axis tooltip would repeat the item one. */
|
|
259
|
+
tooltip = input('item', ...(ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []));
|
|
260
|
+
tooltipTemplate = contentChild('dsChartTooltip', ...(ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []));
|
|
261
|
+
activeMark = chartActiveMark();
|
|
262
|
+
/** One tab stop per chart, not one per mark: WCAG 2.1.1's Understanding is explicit that not
|
|
263
|
+
* every mouse-operable control has to be separately focusable, and that is what keeps a
|
|
264
|
+
* twenty-five mark chart from being twenty-five stops in the page's tab order. */
|
|
265
|
+
rovingIndex = signal(0, ...(ngDevMode ? [{ debugName: "rovingIndex" }] : /* istanbul ignore next */ []));
|
|
266
|
+
tabStopIndex = computed(() => Math.min(this.rovingIndex(), Math.max(0, this.stages().length - 1)), ...(ngDevMode ? [{ debugName: "tabStopIndex" }] : /* istanbul ignore next */ []));
|
|
267
|
+
onMarkFocus(index, event) {
|
|
268
|
+
this.rovingIndex.set(index);
|
|
269
|
+
this.activeMark.enter(index, event);
|
|
270
|
+
}
|
|
271
|
+
onMarkNavigation(event, index) {
|
|
272
|
+
const next = nextRovingIndex(event.key, index, this.stages().length);
|
|
273
|
+
if (next === null) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
this.rovingIndex.set(next);
|
|
278
|
+
focusMark(event.currentTarget.closest('svg'), next);
|
|
279
|
+
}
|
|
280
|
+
tooltipContext = computed(() => {
|
|
281
|
+
const entry = this.stages()[this.activeMark.index()];
|
|
282
|
+
if (this.tooltip() === 'none' || !entry) {
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
category: '',
|
|
287
|
+
entries: [
|
|
288
|
+
{
|
|
289
|
+
label: entry.stage.label,
|
|
290
|
+
value: entry.stage.value,
|
|
291
|
+
formatted: `${entry.formattedValue} · ${entry.formattedPercent}`,
|
|
292
|
+
color: entry.color,
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
};
|
|
296
|
+
}, ...(ngDevMode ? [{ debugName: "tooltipContext" }] : /* istanbul ignore next */ []));
|
|
297
|
+
viewBox = `0 0 ${FUNNEL_VIEW_BOX_WIDTH} ${FUNNEL_VIEW_BOX_HEIGHT}`;
|
|
298
|
+
stages = computed(() => {
|
|
299
|
+
const data = this.data();
|
|
300
|
+
const values = data.map((stage) => stage.value);
|
|
301
|
+
const geometry = funnelGeometry(values, this.shape());
|
|
302
|
+
const drops = stageDrops(values);
|
|
303
|
+
const gapUnits = stageGapUnits(data.length, FUNNEL_VIEW_BOX_HEIGHT);
|
|
304
|
+
const format = this.valueFormat();
|
|
305
|
+
// Every stage is a share of the funnel's mouth, not of the column total:
|
|
306
|
+
// the stages are nested subsets, so they do not add up to 100%.
|
|
307
|
+
const firstValue = values.length ? values[0] : 0;
|
|
308
|
+
// The stages are one quantity draining, not eight categories, so they take a
|
|
309
|
+
// single-hue ramp. The last one is the outcome the funnel is read for, so it
|
|
310
|
+
// leaves the ramp and takes the accent.
|
|
311
|
+
const lastIndex = data.length - 1;
|
|
312
|
+
return data.map((stage, index) => {
|
|
313
|
+
const drop = drops[index];
|
|
314
|
+
return {
|
|
315
|
+
stage,
|
|
316
|
+
points: stagePolygonPoints(geometry[index], FUNNEL_VIEW_BOX_WIDTH, FUNNEL_VIEW_BOX_HEIGHT, gapUnits),
|
|
317
|
+
formattedValue: format(stage.value),
|
|
318
|
+
formattedPercent: formatPercent(stage.value, firstValue),
|
|
319
|
+
formattedDrop: drop === null ? '—' : formatPercent(drop, 1),
|
|
320
|
+
color: index === lastIndex
|
|
321
|
+
? chartColors.seriesAccent
|
|
322
|
+
: CHART_RAMP_COLORS[rampPosition(index, lastIndex, CHART_RAMP_COLORS.length)],
|
|
323
|
+
};
|
|
324
|
+
});
|
|
325
|
+
}, ...(ngDevMode ? [{ debugName: "stages" }] : /* istanbul ignore next */ []));
|
|
326
|
+
accessibleName = computed(() => this.summary() ??
|
|
327
|
+
describeSeries(this.caption() ?? 'Chart', this.data().map((stage) => ({
|
|
328
|
+
label: stage.label,
|
|
329
|
+
value: stage.value,
|
|
330
|
+
})), this.valueFormat(), this.showTable() || this.dataTable() !== 'none'), ...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
331
|
+
entryLabel(entry) {
|
|
332
|
+
return `${entry.stage.label}, ${entry.formattedValue}`;
|
|
333
|
+
}
|
|
334
|
+
onStageKey(stage, event) {
|
|
335
|
+
// A key pressed on a control inside the stage belongs to that control.
|
|
336
|
+
if (!this.interactive() || event.target !== event.currentTarget) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
event.preventDefault();
|
|
340
|
+
this.stageClicked.emit(stage);
|
|
341
|
+
}
|
|
342
|
+
isEmpty = computed(() => this.data().length === 0, ...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
343
|
+
showDataTable = computed(() => this.dataTable() !== 'none' && !this.showTable(), ...(ngDevMode ? [{ debugName: "showDataTable" }] : /* istanbul ignore next */ []));
|
|
344
|
+
chartHeight = computed(() => `calc(var(--_funnel-chart-stage-height) * ${Math.max(this.data().length, 1)})`, ...(ngDevMode ? [{ debugName: "chartHeight" }] : /* istanbul ignore next */ []));
|
|
345
|
+
/** Placeholder stage widths while loading. The count follows the real stage
|
|
346
|
+
* count so the chart does not resize when the data lands, falling back to
|
|
347
|
+
* three when `data` is still empty. The widths vary — and deliberately do
|
|
348
|
+
* not narrow in order — because a column of equal full-width bars is
|
|
349
|
+
* indistinguishable from a funnel whose stages have all gone grey, and a
|
|
350
|
+
* narrowing one just reads as the funnel itself. Same reasoning as the
|
|
351
|
+
* table's skeleton rows. */
|
|
352
|
+
skeletonStages = computed(() => Array.from({ length: Math.max(this.data().length, 3) }, (unusedEntry, index) => SKELETON_STAGE_WIDTHS[index % SKELETON_STAGE_WIDTHS.length]), ...(ngDevMode ? [{ debugName: "skeletonStages" }] : /* istanbul ignore next */ []));
|
|
353
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: FunnelChartComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
354
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: FunnelChartComponent, isStandalone: true, selector: "ds-funnel-chart", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, showTable: { classPropertyName: "showTable", publicName: "showTable", isSignal: true, isRequired: false, transformFunction: null }, caption: { classPropertyName: "caption", publicName: "caption", isSignal: true, isRequired: false, transformFunction: null }, summary: { classPropertyName: "summary", publicName: "summary", isSignal: true, isRequired: false, transformFunction: null }, dataTable: { classPropertyName: "dataTable", publicName: "dataTable", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, error: { classPropertyName: "error", publicName: "error", isSignal: true, isRequired: false, transformFunction: null }, errorText: { classPropertyName: "errorText", publicName: "errorText", isSignal: true, isRequired: false, transformFunction: null }, valueFormat: { classPropertyName: "valueFormat", publicName: "valueFormat", isSignal: true, isRequired: false, transformFunction: null }, interactive: { classPropertyName: "interactive", publicName: "interactive", isSignal: true, isRequired: false, transformFunction: null }, staggerMs: { classPropertyName: "staggerMs", publicName: "staggerMs", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { stageClicked: "stageClicked" }, queries: [{ propertyName: "tooltipTemplate", first: true, predicate: ["dsChartTooltip"], descendants: true, isSignal: true }], ngImport: i0, template: "<figure class=\"funnel-chart\">\n @if (caption()) {\n <figcaption>\n {{ caption() }}\n </figcaption>\n }\n\n @if (error()) {\n <p\n class=\"empty is-error\"\n role=\"status\">\n {{ errorText() }}\n </p>\n } @else if (loading()) {\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n @for (placeholderWidth of skeletonStages(); track $index) {\n <ds-skeleton\n height=\"calc(var(--_funnel-chart-stage-height) - var(--_funnel-chart-stage-gap))\"\n [width]=\"placeholderWidth\" />\n }\n </div>\n } @else if (isEmpty()) {\n <p class=\"empty\">\n {{ emptyText() }}\n </p>\n } @else {\n <div\n class=\"shape\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"activeMark.origin()\"\n [dsChartTooltipTemplate]=\"tooltipTemplate() ?? null\">\n <svg\n preserveAspectRatio=\"none\"\n [attr.aria-hidden]=\"interactive() ? null : true\"\n [attr.viewBox]=\"viewBox\"\n [style.block-size]=\"chartHeight()\">\n @for (entry of stages(); track entry.stage.id; let index = $index) {\n <polygon\n class=\"stage\"\n animate.enter=\"mark-enter\"\n animate.leave=\"mark-leave\"\n [style.--_chart-mark-stagger]=\"markStagger(index)\"\n [class.interactive]=\"interactive()\"\n [attr.points]=\"entry.points\"\n [attr.fill]=\"entry.color\"\n [attr.role]=\"interactive() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() ? (index === tabStopIndex() ? 0 : -1) : null\n \"\n [attr.data-mark-index]=\"index\"\n [attr.aria-label]=\"interactive() ? entryLabel(entry) : null\"\n (pointerenter)=\"activeMark.enter(index, $event)\"\n (pointerleave)=\"activeMark.leave()\"\n (focus)=\"onMarkFocus(index, $event)\"\n (blur)=\"activeMark.leave()\"\n (keydown)=\"onMarkNavigation($event, index)\"\n (click)=\"stageClicked.emit(entry.stage)\"\n (keydown.enter)=\"onStageKey(entry.stage, $event)\"\n (keydown.space)=\"onStageKey(entry.stage, $event)\">\n </polygon>\n }\n </svg>\n </div>\n\n @if (showTable()) {\n <table class=\"stage-table\">\n <caption class=\"visually-hidden\">\n Each stage as a percentage of the first, and the drop from the stage\n above it.\n </caption>\n\n <thead>\n <tr>\n <th scope=\"col\">\n Stage\n </th>\n\n <th scope=\"col\">\n Value\n </th>\n\n <th scope=\"col\">\n Percent\n </th>\n\n <th scope=\"col\">\n Drop\n </th>\n </tr>\n </thead>\n\n <tbody>\n @for (entry of stages(); track entry.stage.id) {\n <tr>\n <th scope=\"row\">\n <span\n class=\"swatch\"\n aria-hidden=\"true\"\n [style.background]=\"entry.color\">\n </span>\n\n {{ entry.stage.label }}\n </th>\n\n <td>\n {{ entry.formattedValue }}\n </td>\n\n <td>\n {{ entry.formattedPercent }}\n </td>\n\n <td>\n {{ entry.formattedDrop }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n }\n\n @if (showDataTable()) {\n <details\n class=\"data-table\"\n [open]=\"dataTable() === 'visible'\">\n <summary>\n Data table\n </summary>\n\n <table>\n <caption>\n {{\n caption() ?? 'Chart data'\n }}\n </caption>\n\n <thead>\n <tr>\n <th scope=\"col\">\n Label\n </th>\n\n <th scope=\"col\">\n Value\n </th>\n </tr>\n </thead>\n\n <tbody>\n @for (entry of stages(); track entry.stage.id) {\n <tr>\n <td>\n {{ entry.stage.label }}\n </td>\n\n <td>\n {{ entry.formattedValue }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n </details>\n }\n }\n</figure>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}@keyframes ds-chart-mark-enter{0%{opacity:0;transform:scale(.94)}}@keyframes ds-chart-mark-exit{to{opacity:0;transform:scale(.94)}}.stage{transform-box:fill-box;transform-origin:center}.stage.mark-enter{animation:ds-chart-mark-enter var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.stage.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}:host{display:block;padding:var(--ds-chart-frame-padding);background:var(--ds-chart-frame-bg-color);border:var(--ds-chart-frame-border-width) solid var(--ds-chart-frame-border-color);border-radius:var(--ds-chart-frame-radius)}.data-table{--_chart-data-table-marker: var(--space-1);margin-block-start:var(--space-4);color:var(--text-secondary);font-size:var(--font-size-s)}.data-table>summary{display:inline-flex;align-items:center;gap:var(--space-1);padding-block:var(--space-1);color:var(--text-tertiary);font-size:var(--font-size-xs);cursor:pointer;list-style:none}.data-table>summary::-webkit-details-marker{display:none}.data-table>summary:before{content:\"\";inline-size:0;block-size:0;border-block-start:var(--_chart-data-table-marker) solid transparent;border-block-end:var(--_chart-data-table-marker) solid transparent;border-inline-start:calc(var(--_chart-data-table-marker) * 1.25) solid currentcolor;transition:transform var(--duration-fast) var(--ease-standard)}@media(prefers-reduced-motion:reduce){.data-table>summary:before{transition:none}}.data-table[open]>summary:before{transform:rotate(90deg)}.data-table>summary{border-radius:var(--radius-sm)}.data-table caption{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.data-table table{inline-size:100%;margin-block-start:var(--space-2);border-collapse:collapse;font-variant-numeric:tabular-nums}.data-table th,.data-table td{padding-block:var(--space-2);border-block-end:var(--border-width-default) solid var(--ds-chart-grid-line-color);text-align:end}.data-table thead th{color:var(--text-tertiary);font-size:var(--font-size-xs);font-weight:600}.data-table th:first-child,.data-table td:first-child{text-align:start}.data-table td+td{padding-inline-start:var(--space-3)}.funnel-chart{--_funnel-chart-stage-height: var(--ds-funnel-chart-stage-height, 44px);--_funnel-chart-stage-gap: var(--ds-funnel-chart-stage-gap, var(--ds-chart-bar-gap));--_funnel-chart-row-gap: var(--ds-funnel-chart-row-gap, var(--space-4));--_funnel-chart-focus-color: var(--ds-funnel-chart-focus-color, var(--focus-ring-color));--_funnel-chart-focus-width: var(--ds-funnel-chart-focus-width, var(--focus-ring-width));position:relative;overflow-x:auto;margin:0}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}figcaption{margin-block-end:var(--space-3);color:var(--text-primary);font-weight:600}.empty{margin:0;color:var(--text-secondary)}.shape{display:block}svg{display:block;inline-size:100%}@media not (forced-colors:active){.stage.interactive:focus-visible{outline:none}}.stage.interactive:focus-visible{stroke:var(--ds-chart-focus-ring-color);stroke-width:var(--focus-ring-width);paint-order:stroke;filter:drop-shadow(0 0 1px var(--ds-chart-focus-halo-color)) drop-shadow(0 0 1px var(--ds-chart-focus-halo-color))}.skeleton{display:grid;row-gap:var(--_funnel-chart-stage-gap)}.stage-table{inline-size:100%;margin-block-start:var(--_funnel-chart-row-gap);border-collapse:collapse;font-variant-numeric:tabular-nums}.stage-table th,.stage-table td{padding-block:var(--space-2);border-block-end:var(--border-width-default) solid var(--ds-chart-grid-line-color);text-align:end}.stage-table thead th{color:var(--text-tertiary);font-size:var(--font-size-xs);font-weight:600}.stage-table thead th:first-child{text-align:start}.stage-table td{padding-inline-start:var(--space-3)}.stage-table th[scope=row]{color:var(--text-secondary);font-weight:400;text-align:start}.swatch{display:inline-block;inline-size:var(--space-2);block-size:var(--space-2);margin-inline-end:var(--space-2);border-radius:var(--radius-sm)}.empty.is-error{color:var(--error)}.shape .stage{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.shape .stage.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.shape:has(.stage.interactive:hover) .stage.interactive:not(:hover),.shape:has(.stage.interactive:focus-visible) .stage.interactive:not(:focus-visible){opacity:var(--ds-chart-dim-opacity)}.shape .stage.interactive{cursor:pointer}@media(forced-colors:active){.axis-line,.grid-line{stroke:CanvasText}.axis-label,.category-label{fill:CanvasText}:focus-visible{stroke:Highlight;filter:none}}\n"], dependencies: [{ kind: "component", type: SkeletonComponent, selector: "ds-skeleton", inputs: ["width", "height", "circle", "inline"] }, { kind: "directive", type: ChartTooltipDirective, selector: "[dsChartTooltip]", inputs: ["dsChartTooltip", "dsChartTooltipOrigin", "dsChartTooltipTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
355
|
+
}
|
|
356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: FunnelChartComponent, decorators: [{
|
|
357
|
+
type: Component,
|
|
358
|
+
args: [{ selector: 'ds-funnel-chart', standalone: true, imports: [SkeletonComponent, ChartTooltipDirective], encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<figure class=\"funnel-chart\">\n @if (caption()) {\n <figcaption>\n {{ caption() }}\n </figcaption>\n }\n\n @if (error()) {\n <p\n class=\"empty is-error\"\n role=\"status\">\n {{ errorText() }}\n </p>\n } @else if (loading()) {\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n @for (placeholderWidth of skeletonStages(); track $index) {\n <ds-skeleton\n height=\"calc(var(--_funnel-chart-stage-height) - var(--_funnel-chart-stage-gap))\"\n [width]=\"placeholderWidth\" />\n }\n </div>\n } @else if (isEmpty()) {\n <p class=\"empty\">\n {{ emptyText() }}\n </p>\n } @else {\n <div\n class=\"shape\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"activeMark.origin()\"\n [dsChartTooltipTemplate]=\"tooltipTemplate() ?? null\">\n <svg\n preserveAspectRatio=\"none\"\n [attr.aria-hidden]=\"interactive() ? null : true\"\n [attr.viewBox]=\"viewBox\"\n [style.block-size]=\"chartHeight()\">\n @for (entry of stages(); track entry.stage.id; let index = $index) {\n <polygon\n class=\"stage\"\n animate.enter=\"mark-enter\"\n animate.leave=\"mark-leave\"\n [style.--_chart-mark-stagger]=\"markStagger(index)\"\n [class.interactive]=\"interactive()\"\n [attr.points]=\"entry.points\"\n [attr.fill]=\"entry.color\"\n [attr.role]=\"interactive() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() ? (index === tabStopIndex() ? 0 : -1) : null\n \"\n [attr.data-mark-index]=\"index\"\n [attr.aria-label]=\"interactive() ? entryLabel(entry) : null\"\n (pointerenter)=\"activeMark.enter(index, $event)\"\n (pointerleave)=\"activeMark.leave()\"\n (focus)=\"onMarkFocus(index, $event)\"\n (blur)=\"activeMark.leave()\"\n (keydown)=\"onMarkNavigation($event, index)\"\n (click)=\"stageClicked.emit(entry.stage)\"\n (keydown.enter)=\"onStageKey(entry.stage, $event)\"\n (keydown.space)=\"onStageKey(entry.stage, $event)\">\n </polygon>\n }\n </svg>\n </div>\n\n @if (showTable()) {\n <table class=\"stage-table\">\n <caption class=\"visually-hidden\">\n Each stage as a percentage of the first, and the drop from the stage\n above it.\n </caption>\n\n <thead>\n <tr>\n <th scope=\"col\">\n Stage\n </th>\n\n <th scope=\"col\">\n Value\n </th>\n\n <th scope=\"col\">\n Percent\n </th>\n\n <th scope=\"col\">\n Drop\n </th>\n </tr>\n </thead>\n\n <tbody>\n @for (entry of stages(); track entry.stage.id) {\n <tr>\n <th scope=\"row\">\n <span\n class=\"swatch\"\n aria-hidden=\"true\"\n [style.background]=\"entry.color\">\n </span>\n\n {{ entry.stage.label }}\n </th>\n\n <td>\n {{ entry.formattedValue }}\n </td>\n\n <td>\n {{ entry.formattedPercent }}\n </td>\n\n <td>\n {{ entry.formattedDrop }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n }\n\n @if (showDataTable()) {\n <details\n class=\"data-table\"\n [open]=\"dataTable() === 'visible'\">\n <summary>\n Data table\n </summary>\n\n <table>\n <caption>\n {{\n caption() ?? 'Chart data'\n }}\n </caption>\n\n <thead>\n <tr>\n <th scope=\"col\">\n Label\n </th>\n\n <th scope=\"col\">\n Value\n </th>\n </tr>\n </thead>\n\n <tbody>\n @for (entry of stages(); track entry.stage.id) {\n <tr>\n <td>\n {{ entry.stage.label }}\n </td>\n\n <td>\n {{ entry.formattedValue }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n </details>\n }\n }\n</figure>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}@keyframes ds-focus-ring-in{0%{outline-color:transparent}}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=edge]{--focus-ring-offset: 0px;--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--focus-ring-offset: calc(-1 * var(--focus-ring-width));--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error)}@media(forced-colors:active){:where(:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}@keyframes ds-chart-mark-enter{0%{opacity:0;transform:scale(.94)}}@keyframes ds-chart-mark-exit{to{opacity:0;transform:scale(.94)}}.stage{transform-box:fill-box;transform-origin:center}.stage.mark-enter{animation:ds-chart-mark-enter var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.stage.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}:host{display:block;padding:var(--ds-chart-frame-padding);background:var(--ds-chart-frame-bg-color);border:var(--ds-chart-frame-border-width) solid var(--ds-chart-frame-border-color);border-radius:var(--ds-chart-frame-radius)}.data-table{--_chart-data-table-marker: var(--space-1);margin-block-start:var(--space-4);color:var(--text-secondary);font-size:var(--font-size-s)}.data-table>summary{display:inline-flex;align-items:center;gap:var(--space-1);padding-block:var(--space-1);color:var(--text-tertiary);font-size:var(--font-size-xs);cursor:pointer;list-style:none}.data-table>summary::-webkit-details-marker{display:none}.data-table>summary:before{content:\"\";inline-size:0;block-size:0;border-block-start:var(--_chart-data-table-marker) solid transparent;border-block-end:var(--_chart-data-table-marker) solid transparent;border-inline-start:calc(var(--_chart-data-table-marker) * 1.25) solid currentcolor;transition:transform var(--duration-fast) var(--ease-standard)}@media(prefers-reduced-motion:reduce){.data-table>summary:before{transition:none}}.data-table[open]>summary:before{transform:rotate(90deg)}.data-table>summary{border-radius:var(--radius-sm)}.data-table caption{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.data-table table{inline-size:100%;margin-block-start:var(--space-2);border-collapse:collapse;font-variant-numeric:tabular-nums}.data-table th,.data-table td{padding-block:var(--space-2);border-block-end:var(--border-width-default) solid var(--ds-chart-grid-line-color);text-align:end}.data-table thead th{color:var(--text-tertiary);font-size:var(--font-size-xs);font-weight:600}.data-table th:first-child,.data-table td:first-child{text-align:start}.data-table td+td{padding-inline-start:var(--space-3)}.funnel-chart{--_funnel-chart-stage-height: var(--ds-funnel-chart-stage-height, 44px);--_funnel-chart-stage-gap: var(--ds-funnel-chart-stage-gap, var(--ds-chart-bar-gap));--_funnel-chart-row-gap: var(--ds-funnel-chart-row-gap, var(--space-4));--_funnel-chart-focus-color: var(--ds-funnel-chart-focus-color, var(--focus-ring-color));--_funnel-chart-focus-width: var(--ds-funnel-chart-focus-width, var(--focus-ring-width));position:relative;overflow-x:auto;margin:0}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}figcaption{margin-block-end:var(--space-3);color:var(--text-primary);font-weight:600}.empty{margin:0;color:var(--text-secondary)}.shape{display:block}svg{display:block;inline-size:100%}@media not (forced-colors:active){.stage.interactive:focus-visible{outline:none}}.stage.interactive:focus-visible{stroke:var(--ds-chart-focus-ring-color);stroke-width:var(--focus-ring-width);paint-order:stroke;filter:drop-shadow(0 0 1px var(--ds-chart-focus-halo-color)) drop-shadow(0 0 1px var(--ds-chart-focus-halo-color))}.skeleton{display:grid;row-gap:var(--_funnel-chart-stage-gap)}.stage-table{inline-size:100%;margin-block-start:var(--_funnel-chart-row-gap);border-collapse:collapse;font-variant-numeric:tabular-nums}.stage-table th,.stage-table td{padding-block:var(--space-2);border-block-end:var(--border-width-default) solid var(--ds-chart-grid-line-color);text-align:end}.stage-table thead th{color:var(--text-tertiary);font-size:var(--font-size-xs);font-weight:600}.stage-table thead th:first-child{text-align:start}.stage-table td{padding-inline-start:var(--space-3)}.stage-table th[scope=row]{color:var(--text-secondary);font-weight:400;text-align:start}.swatch{display:inline-block;inline-size:var(--space-2);block-size:var(--space-2);margin-inline-end:var(--space-2);border-radius:var(--radius-sm)}.empty.is-error{color:var(--error)}.shape .stage{transition:opacity var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.shape .stage.is-dimmed{opacity:var(--ds-chart-dim-opacity)}.shape:has(.stage.interactive:hover) .stage.interactive:not(:hover),.shape:has(.stage.interactive:focus-visible) .stage.interactive:not(:focus-visible){opacity:var(--ds-chart-dim-opacity)}.shape .stage.interactive{cursor:pointer}@media(forced-colors:active){.axis-line,.grid-line{stroke:CanvasText}.axis-label,.category-label{fill:CanvasText}:focus-visible{stroke:Highlight;filter:none}}\n"] }]
|
|
359
|
+
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], showTable: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTable", required: false }] }], caption: [{ type: i0.Input, args: [{ isSignal: true, alias: "caption", required: false }] }], summary: [{ type: i0.Input, args: [{ isSignal: true, alias: "summary", required: false }] }], dataTable: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataTable", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], error: [{ type: i0.Input, args: [{ isSignal: true, alias: "error", required: false }] }], errorText: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorText", required: false }] }], valueFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueFormat", required: false }] }], interactive: [{ type: i0.Input, args: [{ isSignal: true, alias: "interactive", required: false }] }], stageClicked: [{ type: i0.Output, args: ["stageClicked"] }], staggerMs: [{ type: i0.Input, args: [{ isSignal: true, alias: "staggerMs", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], tooltipTemplate: [{ type: i0.ContentChild, args: ['dsChartTooltip', { isSignal: true }] }] } });
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Generated bundle index. Do not edit.
|
|
363
|
+
*/
|
|
364
|
+
|
|
365
|
+
export { FunnelChartComponent };
|
|
366
|
+
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-funnel-chart.mjs","sources":["../../../src/lib/components/funnel-chart/funnel-chart.math.ts","../../../src/lib/components/funnel-chart/funnel-chart.component.ts","../../../src/lib/components/funnel-chart/funnel-chart.component.html","../../../src/lib/components/funnel-chart/ids-group-ltd-ids-design-system-components-funnel-chart.ts"],"sourcesContent":["import type { FunnelChartShape } from './funnel-chart.types';\n\n/** Bottom width of the fixed silhouette, as a fraction of the full width. The\n * tail carries a label, so it never narrows past this. */\nexport const FUNNEL_TAIL_WIDTH = 0.38;\n\n/** Ramp step for one stage, spread across the whole ramp rather than taking its\n * first `rampedCount` entries — a three-stage funnel that used steps 1-3 would\n * never reach the deep end the ramp exists to provide. */\nexport function rampPosition(\n index: number,\n rampedCount: number,\n rampLength: number,\n): number {\n if (rampLength <= 0 || rampedCount <= 1) {\n return 0;\n }\n const position = Math.round((index / (rampedCount - 1)) * (rampLength - 1));\n\n return Math.min(Math.max(position, 0), rampLength - 1);\n}\n\n/** The viewBox is normalised: depth runs 0..100 whatever the stage count, and\n * the rendered block size carries the real height. */\nexport const FUNNEL_VIEW_BOX_WIDTH = 100;\n\nexport const FUNNEL_VIEW_BOX_HEIGHT = 100;\n\n/** One inter-stage gap, as a share of a single stage's own depth. A share and\n * not a count of units, because the viewBox depth is normalised: a fixed\n * number of units would grow on screen with every stage added. */\nconst FUNNEL_STAGE_GAP_SHARE = 0.14;\n\nexport interface FunnelStageGeometry {\n /** Fraction of the full width at the stage's top edge, 0..1. */\n readonly topWidth: number;\n readonly bottomWidth: number;\n /** Fraction of the total depth at the stage's top edge, 0..1. */\n readonly top: number;\n readonly bottom: number;\n}\n\n/** Every value as a finite, non-negative number. A negative would mirror a\n * stage about its own centre line, and a non-finite one reaches an SVG\n * attribute as `NaN`, where the renderer drops the whole shape without an\n * error. */\nexport function sanitizeValues(values: readonly number[]): number[] {\n return values.map((value) =>\n Number.isFinite(value) ? Math.max(value, 0) : 0,\n );\n}\n\nfunction clampFraction(value: number): number {\n if (!Number.isFinite(value)) {\n return 0;\n }\n\n return Math.min(Math.max(value, 0), 1);\n}\n\nfunction widthAtDepth(depth: number, tailWidth: number): number {\n return 1 - (1 - tailWidth) * clampFraction(depth);\n}\n\nfunction largestValue(values: readonly number[]): number {\n return values.reduce(\n (largest, value) => (value > largest ? value : largest),\n 0,\n );\n}\n\n/** The depth at which `areaShare` of the silhouette's area lies above. The area\n * down to depth `t` is `t - (1 - tail) * t² / 2` against a whole of\n * `(1 + tail) / 2`, so the depth is a root of that quadratic rather than a\n * ratio — this is the step that makes area, not width, carry the value. The\n * discriminant bottoms out at `tail²`, so the root is always real. */\nexport function depthForAreaShare(\n areaShare: number,\n tailWidth: number,\n): number {\n const share = clampFraction(areaShare);\n const tail = clampFraction(tailWidth);\n const narrowing = 1 - tail;\n // A silhouette that does not narrow is a rectangle, where area is linear in\n // depth and the quadratic degenerates to 0/0.\n if (narrowing <= 0) {\n return share;\n }\n const discriminant = Math.max(1 - narrowing * share * (1 + tail), 0);\n\n return clampFraction((1 - Math.sqrt(discriminant)) / narrowing);\n}\n\nfunction evenDepths(count: number): number[] {\n return Array.from({ length: count + 1 }, (_, index) => index / count);\n}\n\nfunction boundaryDepths(\n values: readonly number[],\n shape: FunnelChartShape,\n tailWidth: number,\n): number[] {\n const count = values.length;\n if (shape !== 'area') {\n return evenDepths(count);\n }\n const total = values.reduce((sum, value) => sum + value, 0);\n if (!Number.isFinite(total) || total <= 0) {\n return evenDepths(count);\n }\n const depths: number[] = [];\n let consumed = 0;\n for (let index = 0; index <= count; index += 1) {\n depths.push(depthForAreaShare(consumed / total, tailWidth));\n if (index < count) {\n consumed += values[index];\n }\n }\n\n return depths;\n}\n\nfunction boundaryWidths(\n values: readonly number[],\n shape: FunnelChartShape,\n depths: readonly number[],\n tailWidth: number,\n): number[] {\n if (shape !== 'width') {\n return depths.map((depth) => widthAtDepth(depth, tailWidth));\n }\n const count = values.length;\n const largest = largestValue(values);\n if (!Number.isFinite(largest) || largest <= 0) {\n return depths.map(() => 0);\n }\n\n // The last boundary repeats the last value, which flattens the closing edge:\n // there is no following stage to taper towards.\n return Array.from({ length: count + 1 }, (_, index) =>\n clampFraction(values[Math.min(index, count - 1)] / largest),\n );\n}\n\n/** One trapezoid per stage, in fractions of the full width and of the total\n * depth.\n *\n * `'taper'` and `'area'` share one fixed silhouette — full width at the top,\n * `FUNNEL_TAIL_WIDTH` at the bottom — and differ only in where the stage\n * boundaries land on it: evenly spaced for `'taper'`, so width encodes\n * nothing, and at the depths that make each band's area proportional to its\n * value for `'area'`. `'width'` abandons the silhouette and reads every\n * boundary straight off the values. */\nexport function funnelGeometry(\n values: readonly number[],\n shape: FunnelChartShape,\n tailWidth: number = FUNNEL_TAIL_WIDTH,\n): FunnelStageGeometry[] {\n const safeValues = sanitizeValues(values);\n if (safeValues.length === 0) {\n return [];\n }\n const tail = Number.isFinite(tailWidth)\n ? clampFraction(tailWidth)\n : FUNNEL_TAIL_WIDTH;\n const depths = boundaryDepths(safeValues, shape, tail);\n const widths = boundaryWidths(safeValues, shape, depths, tail);\n\n return safeValues.map((_, index) => ({\n top: depths[index],\n bottom: depths[index + 1],\n topWidth: widths[index],\n bottomWidth: widths[index + 1],\n }));\n}\n\n/** The fall from `previousValue` to `value`, as a fraction of `previousValue`.\n * Null where there is nothing to fall from — a zero or non-finite predecessor\n * makes the ratio 0/0. Negative where the stage grew, which is real data. */\nexport function stageDrop(previousValue: number, value: number): number | null {\n if (!Number.isFinite(previousValue) || !Number.isFinite(value)) {\n return null;\n }\n if (previousValue <= 0) {\n return null;\n }\n\n return (previousValue - value) / previousValue;\n}\n\n/** The drop into each stage. The first entry is null and not zero: a printed\n * `0%` there would claim nobody fell away, rather than that there was no\n * earlier stage to fall from. */\nexport function stageDrops(values: readonly number[]): (number | null)[] {\n return values.map((value, index) =>\n index === 0 ? null : stageDrop(values[index - 1], value),\n );\n}\n\n/** Depth of one inter-stage gap, in viewBox units. */\nexport function stageGapUnits(\n stageCount: number,\n viewBoxHeight: number,\n): number {\n if (\n !Number.isFinite(stageCount) ||\n !Number.isFinite(viewBoxHeight) ||\n stageCount <= 0\n ) {\n return 0;\n }\n\n return (FUNNEL_STAGE_GAP_SHARE * viewBoxHeight) / stageCount;\n}\n\nfunction roundCoordinate(value: number): number {\n return Math.round(value * 1000) / 1000;\n}\n\n/** The stage's four corners as an SVG `points` value, or an empty string when\n * any input is non-finite. An attribute holding `NaN` is discarded by the\n * renderer without an error, so the shape would go missing in silence. */\nexport function stagePolygonPoints(\n geometry: FunnelStageGeometry,\n viewBoxWidth: number,\n viewBoxHeight: number,\n gapUnits: number,\n): string {\n const inputs = [\n geometry.topWidth,\n geometry.bottomWidth,\n geometry.top,\n geometry.bottom,\n viewBoxWidth,\n viewBoxHeight,\n gapUnits,\n ];\n if (inputs.some((input) => !Number.isFinite(input))) {\n return '';\n }\n const halfGap = Math.max(gapUnits, 0) / 2;\n const bandTop = clampFraction(geometry.top) * viewBoxHeight;\n const bandBottom = clampFraction(geometry.bottom) * viewBoxHeight;\n let top = bandTop + halfGap;\n let bottom = bandBottom - halfGap;\n if (bottom < top) {\n // A band shallower than the gap it has to leave. Collapse it to a line\n // instead of letting the edges cross and draw a bow tie.\n const middle = (top + bottom) / 2;\n top = middle;\n bottom = middle;\n }\n const horizontalCentre = viewBoxWidth / 2;\n const topWidth = clampFraction(geometry.topWidth);\n const bottomWidth = clampFraction(geometry.bottomWidth);\n // The widths belong to the band's own boundaries, and the gap moves the drawn edges INSIDE them.\n // Drawing the boundary widths at the inset depths makes every band overhang the silhouette at its\n // top and fall short of it at its bottom, so the stack reads as a fir tree rather than a funnel.\n // The silhouette is linear in depth for every shape, so the inset widths interpolate exactly.\n const bandDepth = bandBottom - bandTop;\n // Capped at half: past that the band has collapsed to a line, and an uncapped fraction would\n // swap the two edges and draw the bow tie the collapse exists to prevent.\n const inset =\n bandDepth > 0 ? Math.min(Math.max(halfGap / bandDepth, 0), 0.5) : 0;\n const widthAt = (fraction: number) =>\n topWidth + (bottomWidth - topWidth) * fraction;\n const halfTopWidth = (widthAt(inset) * viewBoxWidth) / 2;\n const halfBottomWidth = (widthAt(1 - inset) * viewBoxWidth) / 2;\n\n return [\n `${roundCoordinate(horizontalCentre - halfTopWidth)},${roundCoordinate(top)}`,\n `${roundCoordinate(horizontalCentre + halfTopWidth)},${roundCoordinate(top)}`,\n `${roundCoordinate(horizontalCentre + halfBottomWidth)},${roundCoordinate(bottom)}`,\n `${roundCoordinate(horizontalCentre - halfBottomWidth)},${roundCoordinate(bottom)}`,\n ].join(' ');\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n TemplateRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n contentChild,\n input,\n numberAttribute,\n output,\n signal,\n} from '@angular/core';\nimport {\n CHART_RAMP_COLORS,\n chartColors,\n describeSeries,\n formatPercent,\n focusMark,\n formatValue,\n nextRovingIndex,\n staggerDelay,\n} from '@ids-group-ltd/ids-design-system/components';\nimport { SkeletonComponent } from '@ids-group-ltd/ids-design-system/components/skeleton';\nimport {\n ChartTooltipDirective,\n chartActiveMark,\n} from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport type {\n ChartItemTooltipTrigger,\n ChartTooltipContext,\n} from '@ids-group-ltd/ids-design-system/components/chart-tooltip';\nimport {\n FUNNEL_VIEW_BOX_HEIGHT,\n FUNNEL_VIEW_BOX_WIDTH,\n funnelGeometry,\n rampPosition,\n stageDrops,\n stageGapUnits,\n stagePolygonPoints,\n} from './funnel-chart.math';\nimport type { FunnelChartShape, FunnelChartStage } from './funnel-chart.types';\n\nconst defaultValueFormat = (value: number) => formatValue(value);\n\nconst SKELETON_STAGE_WIDTHS = ['88%', '62%', '80%', '54%', '72%'] as const;\n\n@Component({\n selector: 'ds-funnel-chart',\n standalone: true,\n imports: [SkeletonComponent, ChartTooltipDirective],\n templateUrl: './funnel-chart.component.html',\n styleUrl: './funnel-chart.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FunnelChartComponent {\n /** Drawn in the order given. The order of a funnel's stages is its meaning,\n * so they are never sorted. */\n readonly data = input.required<readonly FunnelChartStage[]>();\n\n /** What the silhouette encodes. `'area'`, the default, makes each stage's AREA proportional to\n * its value, which is the honest encoding that still leaves a tail wide enough to label.\n * `'width'` reads the widths straight off the values, which collapses the tail of a steep\n * funnel below a labellable width. `'taper'` encodes NOTHING: the shape is fixed whatever the\n * data, and the numbers are read from the table beside it. */\n readonly shape = input<FunnelChartShape>('area');\n\n /** The value, percent and drop table printed under the funnel. It supersedes\n * `dataTable`: while this is on, the disclosure every chart carries would\n * repeat a strict subset of these same numbers, so it is not rendered. */\n readonly showTable = input(true, { transform: booleanAttribute });\n\n /** Printed above the plot as the chart's visible title, and reused as the annex table's\n * caption. */\n readonly caption = input<string | null>(null);\n\n /** Accessible name. Generated from the data when omitted. */\n readonly summary = input<string | null>(null);\n\n /** The label-and-value disclosure every chart carries. Ignored while\n * `showTable` is on, which already prints every label and value. */\n readonly dataTable = input<'toggle' | 'visible' | 'none'>('toggle');\n /** Draws skeleton marks in place of the data, at the same count, so the chart does not resize\n * when the data lands. */\n readonly loading = input(false, { transform: booleanAttribute });\n /** Shown in place of the plot when `data` is empty. */\n readonly emptyText = input<string>('No data');\n\n /** Shows `errorText` in place of the plot. Separate from `loading` and from an empty `data`,\n * because \"the request failed\" and \"there is nothing to show\" read the same to a reader and\n * mean opposite things. */\n readonly error = input(false, { transform: booleanAttribute });\n\n /** The message the error state prints. */\n readonly errorText = input<string>('Could not load the data');\n /** Formats every value the chart prints, the annex table and the generated description\n * included. Defaults to the browser's locale grouping with a K/M/B suffix past four digits. */\n readonly valueFormat = input<(value: number) => string>(defaultValueFormat);\n\n /** Turns on the click affordance — the pointer cursor and any hover tint.\n * The click output fires whether or not this is set, so a consumer that\n * binds the output and forgets the flag still receives every click. */\n readonly interactive = input(false, { transform: booleanAttribute });\n\n /** The stage that was clicked, or activated with Enter or Space. Fires whether or not\n * `interactive` is set. */\n readonly stageClicked = output<FunnelChartStage>();\n\n /** Milliseconds between one mark's entrance and the next. `0`, the default, is no stagger at\n * all; `40` is the documented non-zero step. The total is capped, so a long series does not\n * crawl in. */\n readonly staggerMs = input(0, { transform: numberAttribute });\n\n protected markStagger(index: number): string {\n return `${staggerDelay(index, this.staggerMs())}ms`;\n }\n\n /** Whether a hovered or focused stage opens a tooltip. `'axis'` is not offered — a\n * funnel's stages are its categories, so an axis tooltip would repeat the item one. */\n readonly tooltip = input<ChartItemTooltipTrigger>('item');\n\n protected readonly tooltipTemplate =\n contentChild<TemplateRef<{ $implicit: ChartTooltipContext }>>(\n 'dsChartTooltip',\n );\n\n protected readonly activeMark = chartActiveMark();\n /** One tab stop per chart, not one per mark: WCAG 2.1.1's Understanding is explicit that not\n * every mouse-operable control has to be separately focusable, and that is what keeps a\n * twenty-five mark chart from being twenty-five stops in the page's tab order. */\n protected readonly rovingIndex = signal(0);\n\n protected readonly tabStopIndex = computed(() =>\n Math.min(this.rovingIndex(), Math.max(0, this.stages().length - 1)),\n );\n\n protected onMarkFocus(index: number, event: FocusEvent): void {\n this.rovingIndex.set(index);\n this.activeMark.enter(index, event);\n }\n\n protected onMarkNavigation(event: KeyboardEvent, index: number): void {\n const next = nextRovingIndex(event.key, index, this.stages().length);\n if (next === null) {\n return;\n }\n event.preventDefault();\n this.rovingIndex.set(next);\n focusMark((event.currentTarget as Element).closest('svg'), next);\n }\n\n protected readonly tooltipContext = computed<ChartTooltipContext | null>(\n () => {\n const entry = this.stages()[this.activeMark.index()];\n if (this.tooltip() === 'none' || !entry) {\n return null;\n }\n\n return {\n category: '',\n entries: [\n {\n label: entry.stage.label,\n value: entry.stage.value,\n formatted: `${entry.formattedValue} · ${entry.formattedPercent}`,\n color: entry.color,\n },\n ],\n };\n },\n );\n\n protected readonly viewBox = `0 0 ${FUNNEL_VIEW_BOX_WIDTH} ${FUNNEL_VIEW_BOX_HEIGHT}`;\n\n protected readonly stages = computed(() => {\n const data = this.data();\n const values = data.map((stage) => stage.value);\n const geometry = funnelGeometry(values, this.shape());\n const drops = stageDrops(values);\n const gapUnits = stageGapUnits(data.length, FUNNEL_VIEW_BOX_HEIGHT);\n const format = this.valueFormat();\n // Every stage is a share of the funnel's mouth, not of the column total:\n // the stages are nested subsets, so they do not add up to 100%.\n const firstValue = values.length ? values[0] : 0;\n // The stages are one quantity draining, not eight categories, so they take a\n // single-hue ramp. The last one is the outcome the funnel is read for, so it\n // leaves the ramp and takes the accent.\n const lastIndex = data.length - 1;\n\n return data.map((stage, index) => {\n const drop = drops[index];\n\n return {\n stage,\n points: stagePolygonPoints(\n geometry[index],\n FUNNEL_VIEW_BOX_WIDTH,\n FUNNEL_VIEW_BOX_HEIGHT,\n gapUnits,\n ),\n formattedValue: format(stage.value),\n formattedPercent: formatPercent(stage.value, firstValue),\n formattedDrop: drop === null ? '—' : formatPercent(drop, 1),\n color:\n index === lastIndex\n ? chartColors.seriesAccent\n : CHART_RAMP_COLORS[\n rampPosition(index, lastIndex, CHART_RAMP_COLORS.length)\n ],\n };\n });\n });\n\n protected readonly accessibleName = computed(\n () =>\n this.summary() ??\n describeSeries(\n this.caption() ?? 'Chart',\n this.data().map((stage) => ({\n label: stage.label,\n value: stage.value,\n })),\n this.valueFormat(),\n this.showTable() || this.dataTable() !== 'none',\n ),\n );\n\n protected entryLabel(entry: {\n stage: FunnelChartStage;\n formattedValue: string;\n }): string {\n return `${entry.stage.label}, ${entry.formattedValue}`;\n }\n\n protected onStageKey(stage: FunnelChartStage, event: Event): void {\n // A key pressed on a control inside the stage belongs to that control.\n if (!this.interactive() || event.target !== event.currentTarget) {\n return;\n }\n event.preventDefault();\n this.stageClicked.emit(stage);\n }\n\n protected readonly isEmpty = computed(() => this.data().length === 0);\n\n protected readonly showDataTable = computed(\n () => this.dataTable() !== 'none' && !this.showTable(),\n );\n\n protected readonly chartHeight = computed(\n () =>\n `calc(var(--_funnel-chart-stage-height) * ${Math.max(this.data().length, 1)})`,\n );\n\n /** Placeholder stage widths while loading. The count follows the real stage\n * count so the chart does not resize when the data lands, falling back to\n * three when `data` is still empty. The widths vary — and deliberately do\n * not narrow in order — because a column of equal full-width bars is\n * indistinguishable from a funnel whose stages have all gone grey, and a\n * narrowing one just reads as the funnel itself. Same reasoning as the\n * table's skeleton rows. */\n protected readonly skeletonStages = computed(() =>\n Array.from(\n { length: Math.max(this.data().length, 3) },\n (unusedEntry, index) =>\n SKELETON_STAGE_WIDTHS[index % SKELETON_STAGE_WIDTHS.length],\n ),\n );\n}\n","<figure class=\"funnel-chart\">\n @if (caption()) {\n <figcaption>\n {{ caption() }}\n </figcaption>\n }\n\n @if (error()) {\n <p\n class=\"empty is-error\"\n role=\"status\">\n {{ errorText() }}\n </p>\n } @else if (loading()) {\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n @for (placeholderWidth of skeletonStages(); track $index) {\n <ds-skeleton\n height=\"calc(var(--_funnel-chart-stage-height) - var(--_funnel-chart-stage-gap))\"\n [width]=\"placeholderWidth\" />\n }\n </div>\n } @else if (isEmpty()) {\n <p class=\"empty\">\n {{ emptyText() }}\n </p>\n } @else {\n <div\n class=\"shape\"\n [attr.role]=\"interactive() ? 'group' : 'img'\"\n [attr.aria-label]=\"accessibleName()\"\n [dsChartTooltip]=\"tooltipContext()\"\n [dsChartTooltipOrigin]=\"activeMark.origin()\"\n [dsChartTooltipTemplate]=\"tooltipTemplate() ?? null\">\n <svg\n preserveAspectRatio=\"none\"\n [attr.aria-hidden]=\"interactive() ? null : true\"\n [attr.viewBox]=\"viewBox\"\n [style.block-size]=\"chartHeight()\">\n @for (entry of stages(); track entry.stage.id; let index = $index) {\n <polygon\n class=\"stage\"\n animate.enter=\"mark-enter\"\n animate.leave=\"mark-leave\"\n [style.--_chart-mark-stagger]=\"markStagger(index)\"\n [class.interactive]=\"interactive()\"\n [attr.points]=\"entry.points\"\n [attr.fill]=\"entry.color\"\n [attr.role]=\"interactive() ? 'button' : null\"\n [attr.tabindex]=\"\n interactive() ? (index === tabStopIndex() ? 0 : -1) : null\n \"\n [attr.data-mark-index]=\"index\"\n [attr.aria-label]=\"interactive() ? entryLabel(entry) : null\"\n (pointerenter)=\"activeMark.enter(index, $event)\"\n (pointerleave)=\"activeMark.leave()\"\n (focus)=\"onMarkFocus(index, $event)\"\n (blur)=\"activeMark.leave()\"\n (keydown)=\"onMarkNavigation($event, index)\"\n (click)=\"stageClicked.emit(entry.stage)\"\n (keydown.enter)=\"onStageKey(entry.stage, $event)\"\n (keydown.space)=\"onStageKey(entry.stage, $event)\">\n </polygon>\n }\n </svg>\n </div>\n\n @if (showTable()) {\n <table class=\"stage-table\">\n <caption class=\"visually-hidden\">\n Each stage as a percentage of the first, and the drop from the stage\n above it.\n </caption>\n\n <thead>\n <tr>\n <th scope=\"col\">\n Stage\n </th>\n\n <th scope=\"col\">\n Value\n </th>\n\n <th scope=\"col\">\n Percent\n </th>\n\n <th scope=\"col\">\n Drop\n </th>\n </tr>\n </thead>\n\n <tbody>\n @for (entry of stages(); track entry.stage.id) {\n <tr>\n <th scope=\"row\">\n <span\n class=\"swatch\"\n aria-hidden=\"true\"\n [style.background]=\"entry.color\">\n </span>\n\n {{ entry.stage.label }}\n </th>\n\n <td>\n {{ entry.formattedValue }}\n </td>\n\n <td>\n {{ entry.formattedPercent }}\n </td>\n\n <td>\n {{ entry.formattedDrop }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n }\n\n @if (showDataTable()) {\n <details\n class=\"data-table\"\n [open]=\"dataTable() === 'visible'\">\n <summary>\n Data table\n </summary>\n\n <table>\n <caption>\n {{\n caption() ?? 'Chart data'\n }}\n </caption>\n\n <thead>\n <tr>\n <th scope=\"col\">\n Label\n </th>\n\n <th scope=\"col\">\n Value\n </th>\n </tr>\n </thead>\n\n <tbody>\n @for (entry of stages(); track entry.stage.id) {\n <tr>\n <td>\n {{ entry.stage.label }}\n </td>\n\n <td>\n {{ entry.formattedValue }}\n </td>\n </tr>\n }\n </tbody>\n </table>\n </details>\n }\n }\n</figure>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAEA;AAC2D;AACpD,MAAM,iBAAiB,GAAG,IAAI;AAErC;;AAE2D;SAC3C,YAAY,CAC1B,KAAa,EACb,WAAmB,EACnB,UAAkB,EAAA;IAElB,IAAI,UAAU,IAAI,CAAC,IAAI,WAAW,IAAI,CAAC,EAAE;AACvC,QAAA,OAAO,CAAC;IACV;IACA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,WAAW,GAAG,CAAC,CAAC,KAAK,UAAU,GAAG,CAAC,CAAC,CAAC;AAE3E,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC;AACxD;AAEA;AACuD;AAChD,MAAM,qBAAqB,GAAG,GAAG;AAEjC,MAAM,sBAAsB,GAAG,GAAG;AAEzC;;AAEmE;AACnE,MAAM,sBAAsB,GAAG,IAAI;AAWnC;;;AAGa;AACP,SAAU,cAAc,CAAC,MAAyB,EAAA;AACtD,IAAA,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,KACtB,MAAM,CAAC,QAAQ,CAAC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AA,MAAA,EAAA,CAAA,2oLAAA,CAAA,EAAA;s8CAsE3C,gBAAgB,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AE5HtB;;AAEG;;;;"}
|
|
@@ -7,7 +7,7 @@ import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
|
|
|
7
7
|
import { SpinnerComponent } from '@ids-group-ltd/ids-design-system/components/spinner';
|
|
8
8
|
import { DsControlValueAccessor, trimmedText, nextControlId, resolveFieldMessage, FieldClickFocusDirective } from '@ids-group-ltd/ids-design-system/components';
|
|
9
9
|
import { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';
|
|
10
|
-
import { inFieldGroup } from '@ids-group-ltd/ids-design-system/components/field-group';
|
|
10
|
+
import { inFieldGroup, describedByIds, groupMessageId, groupInvalid } from '@ids-group-ltd/ids-design-system/components/field-group';
|
|
11
11
|
|
|
12
12
|
class InputComponent extends DsControlValueAccessor {
|
|
13
13
|
control = viewChild('control', ...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
@@ -31,12 +31,10 @@ class InputComponent extends DsControlValueAccessor {
|
|
|
31
31
|
/** Prevents editing while still allowing focus and selection. */
|
|
32
32
|
readOnly = input(false, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
33
33
|
/**
|
|
34
|
-
* The contract spelling of `readOnly
|
|
35
|
-
*
|
|
34
|
+
* The contract spelling of `readOnly`: signal forms binds by NAME, so a
|
|
35
|
+
* `readonly()` rule reaches nothing without it.
|
|
36
36
|
*/
|
|
37
37
|
readonlyBinding = input(false, { ...(ngDevMode ? { debugName: "readonlyBinding" } : /* istanbul ignore next */ {}),
|
|
38
|
-
// The alias IS the point: signal forms binds by name, and the contract
|
|
39
|
-
// spells it `readonly` where the DS spells it `readOnly`.
|
|
40
38
|
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
41
39
|
alias: 'readonly',
|
|
42
40
|
transform: booleanAttribute });
|
|
@@ -75,7 +73,7 @@ class InputComponent extends DsControlValueAccessor {
|
|
|
75
73
|
* live "{current}/{max}" counter below the field. */
|
|
76
74
|
maxLength = input(null, { ...(ngDevMode ? { debugName: "maxLength" } : /* istanbul ignore next */ {}), transform: optionalBound });
|
|
77
75
|
// Signal forms binds these by name; without them a `pattern()` or `minLength()`
|
|
78
|
-
// rule
|
|
76
|
+
// rule validates in the form model while the native element advertises nothing.
|
|
79
77
|
/** Native `minlength` attribute. */
|
|
80
78
|
minLength = input(null, { ...(ngDevMode ? { debugName: "minLength" } : /* istanbul ignore next */ {}), transform: optionalBound });
|
|
81
79
|
/** Native `pattern` attribute — signal forms sends the schema's RegExp list. */
|
|
@@ -92,10 +90,8 @@ class InputComponent extends DsControlValueAccessor {
|
|
|
92
90
|
blurred = output();
|
|
93
91
|
/**
|
|
94
92
|
* Show an inline clear (×) button when the input has a non-empty value.
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* DS tokens. Defaults to true when type='search', false otherwise — pass
|
|
98
|
-
* an explicit boolean to override.
|
|
93
|
+
* Defaults to true when `type="search"`, false otherwise — pass an explicit
|
|
94
|
+
* boolean to override.
|
|
99
95
|
*/
|
|
100
96
|
clearable = input(null, ...(ngDevMode ? [{ debugName: "clearable" }] : /* istanbul ignore next */ []));
|
|
101
97
|
/** Shows a show/hide button when `type="password"`. */
|
|
@@ -122,10 +118,10 @@ class InputComponent extends DsControlValueAccessor {
|
|
|
122
118
|
uid = nextControlId('ds-input');
|
|
123
119
|
hintId = computed(() => this.message().text ? `${this.uid}-hint` : null, ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
124
120
|
describedBy = computed(() => {
|
|
125
|
-
|
|
126
|
-
return ids.length ? ids.join(' ') : null;
|
|
121
|
+
return describedByIds(this.hintId(), this.groupMessage(), this.ariaDescribedBy());
|
|
127
122
|
}, ...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
128
123
|
fieldMessage = resolveFieldMessage({
|
|
124
|
+
disabled: () => this.isDisabled(),
|
|
129
125
|
hint: this.hint,
|
|
130
126
|
warning: this.warning,
|
|
131
127
|
error: this.error,
|
|
@@ -137,10 +133,10 @@ class InputComponent extends DsControlValueAccessor {
|
|
|
137
133
|
});
|
|
138
134
|
message = this.fieldMessage.message;
|
|
139
135
|
controlState = this.fieldMessage.controlState;
|
|
140
|
-
|
|
136
|
+
groupMessage = groupMessageId();
|
|
137
|
+
invalidResolved = groupInvalid(this.fieldMessage.invalid);
|
|
141
138
|
/** Only name via aria-label when there's no visible `<label for>`. */
|
|
142
139
|
resolvedAriaLabel = computed(() => this.label() ? null : this.ariaLabel() || this.placeholder() || null, ...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
|
|
143
|
-
/** Effective disabled — own `disabled` input OR the reactive-forms state. */
|
|
144
140
|
isDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
145
141
|
currentLength = computed(() => this.value().length, ...(ngDevMode ? [{ debugName: "currentLength" }] : /* istanbul ignore next */ []));
|
|
146
142
|
counterId = computed(() => this.maxLength() !== null ? `${this.uid}-counter` : null, ...(ngDevMode ? [{ debugName: "counterId" }] : /* istanbul ignore next */ []));
|