@ids-group-ltd/ids-design-system 0.12.3 → 0.13.1
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 +895 -6
- package/components.md +94 -2
- package/docs/agent/INDEX.md +12 -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-config.md +12 -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-alert.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +25 -18
- 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-banner.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +177 -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-bottom-sheet.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs.map +1 -1
- 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 +212 -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 +10 -4
- 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 +196 -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 +18 -10
- 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 +311 -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-drawer.mjs +2 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- 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 +388 -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 +672 -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-list.mjs +2 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +5 -5
- 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 +10 -4
- 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-page-header.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.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 +18 -10
- 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 +10 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.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 +448 -12
- 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/migrations/0.13.1.json +236 -0
- package/package.json +57 -1
- package/styles/_chart-data-table.scss +95 -0
- package/styles/_chart-frame.scss +68 -0
- package/styles/_chart-interactive.scss +51 -0
- package/styles/_chart-motion.scss +88 -0
- package/styles/_dropdown-overlay.scss +9 -3
- package/styles/_focus.scss +11 -2
- package/styles/_overlay-motion.scss +10 -1
- package/styles/_tokens-charts.scss +154 -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 +17 -10
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +119 -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 +84 -0
- package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +6 -1
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +125 -0
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +10 -2
- package/types/ids-group-ltd-ids-design-system-components-donut-chart.d.ts +127 -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 +128 -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 +268 -0
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +6 -1
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +11 -3
- 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-time-picker.d.ts +6 -1
- 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 +171 -5
- package/types/ids-group-ltd-ids-design-system-core.d.ts +36 -2
- package/types/ids-group-ltd-ids-design-system.d.ts +9 -2
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, computed, signal, untracked, afterRenderEffect, TemplateRef, Directive, Injector,
|
|
2
|
+
import { inject, computed, signal, PLATFORM_ID, DestroyRef, untracked, afterRenderEffect, TemplateRef, Directive, Injector, afterNextRender, isDevMode, input, booleanAttribute, effect, ElementRef, DOCUMENT } from '@angular/core';
|
|
3
3
|
import { DS_CONFIG } from '@ids-group-ltd/ids-design-system/core';
|
|
4
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
4
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
6
|
import { NgForm, FormGroupDirective, NgControl } from '@angular/forms';
|
|
7
|
+
import { Router, ActivatedRoute, UrlTree } from '@angular/router';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Resolve one brand string against the app-level default. `ds-sidenav` and
|
|
@@ -19,6 +21,335 @@ function resolveBrandValue(value, key) {
|
|
|
19
21
|
return computed(() => value() ?? config.brand?.[key] ?? '');
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
// GENERATED by tools/generate-chart-palette.mjs. Do not edit. Values are var()
|
|
25
|
+
// references, not resolved colours, so a consumer overriding the token still wins
|
|
26
|
+
// at runtime.
|
|
27
|
+
/** @internal Exported for the chart entry points that import it across the boundary;
|
|
28
|
+
* not part of the package surface. */
|
|
29
|
+
const chartColors = {
|
|
30
|
+
series1: 'var(--ds-chart-series-1-color)',
|
|
31
|
+
series2: 'var(--ds-chart-series-2-color)',
|
|
32
|
+
series3: 'var(--ds-chart-series-3-color)',
|
|
33
|
+
series4: 'var(--ds-chart-series-4-color)',
|
|
34
|
+
series5: 'var(--ds-chart-series-5-color)',
|
|
35
|
+
series6: 'var(--ds-chart-series-6-color)',
|
|
36
|
+
series7: 'var(--ds-chart-series-7-color)',
|
|
37
|
+
series8: 'var(--ds-chart-series-8-color)',
|
|
38
|
+
seriesDefault: 'var(--ds-chart-series-default-color)',
|
|
39
|
+
seriesAccent: 'var(--ds-chart-series-accent-color)',
|
|
40
|
+
ramp1: 'var(--ds-chart-ramp-1-color)',
|
|
41
|
+
ramp2: 'var(--ds-chart-ramp-2-color)',
|
|
42
|
+
ramp3: 'var(--ds-chart-ramp-3-color)',
|
|
43
|
+
ramp4: 'var(--ds-chart-ramp-4-color)',
|
|
44
|
+
ramp5: 'var(--ds-chart-ramp-5-color)',
|
|
45
|
+
ramp6: 'var(--ds-chart-ramp-6-color)',
|
|
46
|
+
ramp7: 'var(--ds-chart-ramp-7-color)',
|
|
47
|
+
ramp8: 'var(--ds-chart-ramp-8-color)',
|
|
48
|
+
};
|
|
49
|
+
/** @internal See chartColors. */
|
|
50
|
+
const CHART_SERIES_COLORS = [
|
|
51
|
+
chartColors.series1,
|
|
52
|
+
chartColors.series2,
|
|
53
|
+
chartColors.series3,
|
|
54
|
+
chartColors.series4,
|
|
55
|
+
chartColors.series5,
|
|
56
|
+
chartColors.series6,
|
|
57
|
+
chartColors.series7,
|
|
58
|
+
chartColors.series8,
|
|
59
|
+
];
|
|
60
|
+
/** @internal See chartColors. */
|
|
61
|
+
const CHART_RAMP_COLORS = [
|
|
62
|
+
chartColors.ramp1,
|
|
63
|
+
chartColors.ramp2,
|
|
64
|
+
chartColors.ramp3,
|
|
65
|
+
chartColors.ramp4,
|
|
66
|
+
chartColors.ramp5,
|
|
67
|
+
chartColors.ramp6,
|
|
68
|
+
chartColors.ramp7,
|
|
69
|
+
chartColors.ramp8,
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
const numberFormatters = new Map();
|
|
73
|
+
function numberFormatter(locale) {
|
|
74
|
+
const key = locale ?? 'default';
|
|
75
|
+
let formatter = numberFormatters.get(key);
|
|
76
|
+
if (!formatter) {
|
|
77
|
+
formatter = new Intl.NumberFormat(locale);
|
|
78
|
+
numberFormatters.set(key, formatter);
|
|
79
|
+
}
|
|
80
|
+
return formatter;
|
|
81
|
+
}
|
|
82
|
+
/** @internal */
|
|
83
|
+
function formatValue(value, locale) {
|
|
84
|
+
if (!Number.isFinite(value)) {
|
|
85
|
+
return '—';
|
|
86
|
+
}
|
|
87
|
+
return numberFormatter(locale).format(value);
|
|
88
|
+
}
|
|
89
|
+
/** @internal */
|
|
90
|
+
function formatPercent(value, total) {
|
|
91
|
+
if (!total || !Number.isFinite(value) || !Number.isFinite(total)) {
|
|
92
|
+
return '—';
|
|
93
|
+
}
|
|
94
|
+
const percent = (value / total) * 100;
|
|
95
|
+
// A real share must never print as an exact zero: at one decimal, 214 of 987,654,321 rounds to
|
|
96
|
+
// "0.0%" beside a bar too short to see, and the row reads as nothing when it is not nothing.
|
|
97
|
+
if (percent !== 0 && Math.abs(percent) < 0.05) {
|
|
98
|
+
return percent > 0 ? '<0.1%' : '>-0.1%';
|
|
99
|
+
}
|
|
100
|
+
return `${percent.toFixed(1)}%`;
|
|
101
|
+
}
|
|
102
|
+
/** Whole percentages that sum to exactly 100. Rounding each share on its own
|
|
103
|
+
* gives 33/33/33 for three equal parts, and a legend that visibly loses 1%.
|
|
104
|
+
*
|
|
105
|
+
* @internal Exported for the chart entry points; not part of the package surface. */
|
|
106
|
+
function largestRemainder(values) {
|
|
107
|
+
const total = values.reduce((sum, value) => sum + value, 0);
|
|
108
|
+
if (!total) {
|
|
109
|
+
return values.map(() => 0);
|
|
110
|
+
}
|
|
111
|
+
const exact = values.map((value) => (value / total) * 100);
|
|
112
|
+
const floors = exact.map(Math.floor);
|
|
113
|
+
let remaining = 100 - floors.reduce((sum, value) => sum + value, 0);
|
|
114
|
+
const order = exact
|
|
115
|
+
.map((value, index) => ({ index, fraction: value - Math.floor(value) }))
|
|
116
|
+
.sort((a, b) => b.fraction - a.fraction);
|
|
117
|
+
const result = [...floors];
|
|
118
|
+
for (const { index } of order) {
|
|
119
|
+
if (remaining <= 0) {
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
result[index]++;
|
|
123
|
+
remaining--;
|
|
124
|
+
}
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
/** @internal */
|
|
128
|
+
function formatTick(value, step) {
|
|
129
|
+
if (!Number.isFinite(value)) {
|
|
130
|
+
return '';
|
|
131
|
+
}
|
|
132
|
+
if (Math.abs(value) < 1000) {
|
|
133
|
+
return String(value);
|
|
134
|
+
}
|
|
135
|
+
// The unit follows the STEP, not the value, so every label on one axis carries the same suffix:
|
|
136
|
+
// a step of 200M labels 1e9 as 1000M, never 1B beside 800M.
|
|
137
|
+
const units = [
|
|
138
|
+
{ suffix: 'B', scale: 1e9 },
|
|
139
|
+
{ suffix: 'M', scale: 1e6 },
|
|
140
|
+
{ suffix: 'K', scale: 1e3 },
|
|
141
|
+
];
|
|
142
|
+
const unit = units.find((candidate) => Math.abs(step) >= candidate.scale) ?? units[2];
|
|
143
|
+
const scaled = value / unit.scale;
|
|
144
|
+
// A step that divides its unit evenly needs no decimal; one that does not needs exactly one on
|
|
145
|
+
// EVERY label, so an axis reads 1.0K · 1.5K · 2.0K rather than mixing 1K with 1.5K. Rounding the
|
|
146
|
+
// whole branch matters too: a caller passing a raw datum instead of a tick would otherwise print
|
|
147
|
+
// every digit of the division, as 987.654321M.
|
|
148
|
+
return step % unit.scale === 0
|
|
149
|
+
? `${Math.round(scaled)}${unit.suffix}`
|
|
150
|
+
: `${scaled.toFixed(1)}${unit.suffix}`;
|
|
151
|
+
}
|
|
152
|
+
/** One mark's share of the total its siblings add up to.
|
|
153
|
+
*
|
|
154
|
+
* A single-series category chart prints every mark's own value beside it, so a tooltip repeating
|
|
155
|
+
* that number tells the reader nothing they are not already looking at. The share is arithmetic
|
|
156
|
+
* the reader should not have to do. Empty for a lone mark, and empty for a reading that is not
|
|
157
|
+
* part of a total anyone can see: negatives and non-finite values are excluded from the total
|
|
158
|
+
* rather than subtracted from it.
|
|
159
|
+
*
|
|
160
|
+
* @internal */
|
|
161
|
+
function describeShare(values, index) {
|
|
162
|
+
const value = values[index];
|
|
163
|
+
if (values.length < 2 || !Number.isFinite(value) || value <= 0) {
|
|
164
|
+
return '';
|
|
165
|
+
}
|
|
166
|
+
const total = values
|
|
167
|
+
.filter((entry) => Number.isFinite(entry) && entry > 0)
|
|
168
|
+
.reduce((sum, entry) => sum + entry, 0);
|
|
169
|
+
return total > 0 ? `${formatPercent(value, total)} of total` : '';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** Container width as a signal. It is 0 under SSR, while the container is
|
|
173
|
+
* `display: none`, and before the first observation.
|
|
174
|
+
*
|
|
175
|
+
* @internal */
|
|
176
|
+
function elementWidth(host) {
|
|
177
|
+
const width = signal(0, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
178
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID))) {
|
|
179
|
+
return width.asReadonly();
|
|
180
|
+
}
|
|
181
|
+
const observer = new ResizeObserver((entries) => {
|
|
182
|
+
width.set(Math.round(entries[0]?.contentRect.width ?? 0));
|
|
183
|
+
});
|
|
184
|
+
observer.observe(host.nativeElement);
|
|
185
|
+
inject(DestroyRef).onDestroy(() => observer.disconnect());
|
|
186
|
+
return width.asReadonly();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const E10 = Math.sqrt(50);
|
|
190
|
+
const E5 = Math.sqrt(10);
|
|
191
|
+
const E2 = Math.sqrt(2);
|
|
192
|
+
/** d3's tick-increment rule. A naive `max / count` produces steps like 482, which
|
|
193
|
+
* no reader parses; this snaps to 1, 2, 5 or 10 times a power of ten. */
|
|
194
|
+
function tickIncrement(domainMax, targetCount) {
|
|
195
|
+
const step = domainMax / Math.max(1, targetCount);
|
|
196
|
+
const power = Math.floor(Math.log10(step));
|
|
197
|
+
const error = step / Math.pow(10, power);
|
|
198
|
+
const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1;
|
|
199
|
+
return factor * Math.pow(10, power);
|
|
200
|
+
}
|
|
201
|
+
/** @internal */
|
|
202
|
+
function tickValues(domainMax, targetCount) {
|
|
203
|
+
if (!Number.isFinite(domainMax) || domainMax <= 0) {
|
|
204
|
+
return [0];
|
|
205
|
+
}
|
|
206
|
+
const step = tickIncrement(domainMax, targetCount);
|
|
207
|
+
const out = [];
|
|
208
|
+
for (let i = 0; i <= Math.ceil(domainMax / step); i++) {
|
|
209
|
+
out.push(i * step);
|
|
210
|
+
}
|
|
211
|
+
return out;
|
|
212
|
+
}
|
|
213
|
+
/** @internal */
|
|
214
|
+
function niceMax(domainMax, targetCount) {
|
|
215
|
+
if (!Number.isFinite(domainMax) || domainMax <= 0) {
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
const step = tickIncrement(domainMax, targetCount);
|
|
219
|
+
return Math.ceil(domainMax / step) * step;
|
|
220
|
+
}
|
|
221
|
+
/** Distance between two ticks, which `formatTick` needs to pick a precision. A
|
|
222
|
+
* degenerate series yields a single tick and therefore no step.
|
|
223
|
+
*
|
|
224
|
+
* @internal */
|
|
225
|
+
function tickStep(ticks) {
|
|
226
|
+
return ticks.length > 1 ? ticks[1] - ticks[0] : 0;
|
|
227
|
+
}
|
|
228
|
+
/** @internal */
|
|
229
|
+
function linearScale(domainMax, rangeSize) {
|
|
230
|
+
if (!Number.isFinite(domainMax) || domainMax <= 0) {
|
|
231
|
+
return () => 0;
|
|
232
|
+
}
|
|
233
|
+
return (value) => (value / domainMax) * rangeSize;
|
|
234
|
+
}
|
|
235
|
+
/** @internal */
|
|
236
|
+
function bandScale(count, rangeSize, paddingRatio) {
|
|
237
|
+
if (count <= 0) {
|
|
238
|
+
return {
|
|
239
|
+
bandWidth: 0,
|
|
240
|
+
step: 0,
|
|
241
|
+
count: 0,
|
|
242
|
+
position: () => 0,
|
|
243
|
+
indexAt: () => -1,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
const step = rangeSize / count;
|
|
247
|
+
const bandWidth = step * (1 - paddingRatio);
|
|
248
|
+
return {
|
|
249
|
+
bandWidth,
|
|
250
|
+
step,
|
|
251
|
+
count,
|
|
252
|
+
position: (index) => step * index + (step - bandWidth) / 2,
|
|
253
|
+
indexAt: (offset) => Math.min(count - 1, Math.max(0, Math.floor(offset / step))),
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Past this the entrance stops reading as one gesture and starts reading as a queue: at 40ms a
|
|
258
|
+
// 100-mark series would otherwise take four seconds to finish arriving.
|
|
259
|
+
const STAGGER_CAP_MS = 300;
|
|
260
|
+
/** Entrance delay for the mark at `index`, in milliseconds. `stepMs` of `0` is the default and
|
|
261
|
+
* means no stagger at all.
|
|
262
|
+
*
|
|
263
|
+
* @internal */
|
|
264
|
+
function staggerDelay(index, stepMs) {
|
|
265
|
+
if (!(stepMs > 0) || !Number.isFinite(index) || index <= 0) {
|
|
266
|
+
return 0;
|
|
267
|
+
}
|
|
268
|
+
return Math.min(index * stepMs, STAGGER_CAP_MS);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** Where a roving tabindex lands after `key`, or `null` when the key does not traverse.
|
|
272
|
+
*
|
|
273
|
+
* The ends wrap, as they do in `ds-radio-group`: a chart's marks are a closed set, and Home and
|
|
274
|
+
* End are the direct way to either extreme.
|
|
275
|
+
*
|
|
276
|
+
* @internal */
|
|
277
|
+
function nextRovingIndex(key, current, count) {
|
|
278
|
+
if (!Number.isFinite(count) || count <= 0) {
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
switch (key) {
|
|
282
|
+
case 'ArrowRight':
|
|
283
|
+
case 'ArrowDown':
|
|
284
|
+
return (current + 1) % count;
|
|
285
|
+
case 'ArrowLeft':
|
|
286
|
+
case 'ArrowUp':
|
|
287
|
+
return (current - 1 + count) % count;
|
|
288
|
+
case 'Home':
|
|
289
|
+
return 0;
|
|
290
|
+
case 'End':
|
|
291
|
+
return count - 1;
|
|
292
|
+
default:
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/** Moves DOM focus to the mark `index` within `scope`, which is what makes the roving tabindex a
|
|
297
|
+
* traversal rather than a state change nobody can see. `within` narrows the search for a chart
|
|
298
|
+
* whose marks repeat the same index once per series.
|
|
299
|
+
*
|
|
300
|
+
* @internal */
|
|
301
|
+
function focusMark(scope, index, within = '') {
|
|
302
|
+
const target = scope?.querySelector(`${within}[data-mark-index="${index}"]`);
|
|
303
|
+
if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
304
|
+
target.focus();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
function trendOf(values) {
|
|
309
|
+
const first = values[0];
|
|
310
|
+
const last = values[values.length - 1];
|
|
311
|
+
const rose = values.every((value, index) => index === 0 || value > values[index - 1]);
|
|
312
|
+
const fell = values.every((value, index) => index === 0 || value < values[index - 1]);
|
|
313
|
+
if (rose) {
|
|
314
|
+
return 'Rising throughout';
|
|
315
|
+
}
|
|
316
|
+
if (fell) {
|
|
317
|
+
return 'Falling throughout';
|
|
318
|
+
}
|
|
319
|
+
if (last > first) {
|
|
320
|
+
return 'Rising overall';
|
|
321
|
+
}
|
|
322
|
+
if (last < first) {
|
|
323
|
+
return 'Falling overall';
|
|
324
|
+
}
|
|
325
|
+
return 'Ending where it started';
|
|
326
|
+
}
|
|
327
|
+
/** The sentence a screen reader gets as the chart's accessible name. Generated rather than
|
|
328
|
+
* required, because a required one is a field that gets left at the component's default and then
|
|
329
|
+
* lies.
|
|
330
|
+
*
|
|
331
|
+
* The ORDER is the contract: what the chart is and its scale, then the trend, then the extremes,
|
|
332
|
+
* then where the numbers are. Blind readers rank a recital of the encoding lowest of the four
|
|
333
|
+
* levels of chart description, and the encoding is the one thing a screen-reader user cannot use.
|
|
334
|
+
*
|
|
335
|
+
* @internal */
|
|
336
|
+
function describeSeries(label, points, format = formatValue, tableFollows = true) {
|
|
337
|
+
const pointer = tableFollows ? ' Full values in the table below.' : '';
|
|
338
|
+
if (points.length === 0) {
|
|
339
|
+
return `${label}. No data.`;
|
|
340
|
+
}
|
|
341
|
+
if (points.length === 1) {
|
|
342
|
+
return `${label}, one point: ${format(points[0].value)} at ${points[0].label}.${pointer}`;
|
|
343
|
+
}
|
|
344
|
+
const lowest = points.reduce((min, point) => point.value < min.value ? point : min);
|
|
345
|
+
const highest = points.reduce((max, point) => point.value > max.value ? point : max);
|
|
346
|
+
return (`${label}, ${points.length} points, ` +
|
|
347
|
+
`${format(lowest.value)} to ${format(highest.value)}. ` +
|
|
348
|
+
`${trendOf(points.map((point) => point.value))}. ` +
|
|
349
|
+
`Highest in ${highest.label} at ${format(highest.value)}, ` +
|
|
350
|
+
`lowest in ${lowest.label} at ${format(lowest.value)}.${pointer}`);
|
|
351
|
+
}
|
|
352
|
+
|
|
22
353
|
/**
|
|
23
354
|
* @fileoverview How many chips fit one line of a trigger, measured rather than
|
|
24
355
|
* guessed.
|
|
@@ -312,9 +643,14 @@ function resolveFieldMessage(sources) {
|
|
|
312
643
|
}, ...(ngDevMode ? [{ debugName: "advisoryText" }] : /* istanbul ignore next */ []));
|
|
313
644
|
// Advisory errors are deliberately absent: a warning does not make a control
|
|
314
645
|
// invalid, so it never sets aria-invalid and never blocks a submit guard.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
646
|
+
// Disabled wins over every source of invalidity. Measured in Chrome's accessibility tree:
|
|
647
|
+
// `aria-invalid` on a NATIVELY disabled input still reports invalid=true and the node is not
|
|
648
|
+
// ignored, so disabling does not make the attribute inert — the reader still hears "invalid" on
|
|
649
|
+
// a control they cannot act on.
|
|
650
|
+
const invalid = computed(() => !(sources.disabled?.() ?? false) &&
|
|
651
|
+
(sources.invalid() ||
|
|
652
|
+
sources.error().length > 0 ||
|
|
653
|
+
(blocking().length > 0 && interacted())), ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
318
654
|
// Message inputs trim via `trimmedText`, so a non-empty string here is real
|
|
319
655
|
// text — a new one declared without that transform breaks this quietly.
|
|
320
656
|
const message = computed(() => {
|
|
@@ -726,6 +1062,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
726
1062
|
}]
|
|
727
1063
|
}] });
|
|
728
1064
|
|
|
1065
|
+
// The query string is a subset match and the fragment is ignored in both: a sort order, a page
|
|
1066
|
+
// number or an open accordion does not make it a different page.
|
|
1067
|
+
const EXACT_PATH = {
|
|
1068
|
+
paths: 'exact',
|
|
1069
|
+
queryParams: 'subset',
|
|
1070
|
+
fragment: 'ignored',
|
|
1071
|
+
matrixParams: 'ignored',
|
|
1072
|
+
};
|
|
1073
|
+
const PREFIX_PATH = {
|
|
1074
|
+
...EXACT_PATH,
|
|
1075
|
+
paths: 'subset',
|
|
1076
|
+
};
|
|
729
1077
|
/**
|
|
730
1078
|
* No destination is a `<button>`, never an `<a href="#">`: a `#` href navigates, rewriting the URL
|
|
731
1079
|
* and discarding the scroll position. Only the decision is shared — each control keeps its own
|
|
@@ -741,6 +1089,65 @@ function dsDestination(routerLink, href) {
|
|
|
741
1089
|
return href() ? 'href' : 'button';
|
|
742
1090
|
});
|
|
743
1091
|
}
|
|
1092
|
+
/**
|
|
1093
|
+
* What a navigating control should announce, distinguishing the two things `routerLinkActive`
|
|
1094
|
+
* cannot tell apart.
|
|
1095
|
+
*
|
|
1096
|
+
* `routerLinkActive` matches by PREFIX, so deriving `aria-current="page"` from it makes a
|
|
1097
|
+
* "back to the section" link claim to be the page the reader is already on. ARIA separates the
|
|
1098
|
+
* two: `page` is the page you are on, `true` is the current section or an ancestor of it. So an
|
|
1099
|
+
* exact match announces `page`, a prefix match announces `true`, and anything else stays silent —
|
|
1100
|
+
* which is correct for a button and for a sidenav item without a branch between them.
|
|
1101
|
+
*
|
|
1102
|
+
* Feed the result to `RouterLinkActive.ariaCurrentWhenActive`, never to `[attr.aria-current]`: the
|
|
1103
|
+
* directive removes that attribute from its host in a microtask whenever its own input is unset,
|
|
1104
|
+
* so a template binding is written and then silently wiped. Consequence worth knowing — a narrowed
|
|
1105
|
+
* `routerLinkActiveOptions` narrows the announcement with it, because the directive writes nothing
|
|
1106
|
+
* while it considers the link inactive.
|
|
1107
|
+
*
|
|
1108
|
+
* Must be called from an injection context. Outside a router it returns the override or `null`,
|
|
1109
|
+
* so a control can render with no router present.
|
|
1110
|
+
*
|
|
1111
|
+
* @internal
|
|
1112
|
+
*/
|
|
1113
|
+
function dsAriaCurrent(routerLink, modifiers, override) {
|
|
1114
|
+
const router = inject(Router, { optional: true });
|
|
1115
|
+
// `RouterLink` resolves its commands against the route it sits on, so a relative destination
|
|
1116
|
+
// (`routerLink="."`, `['..', 'sibling']`) means something different from the root. Resolving it
|
|
1117
|
+
// here without the same base would make `.` land on `/` — a prefix of every page, so the item
|
|
1118
|
+
// that IS the current page would announce `true` instead of `page`.
|
|
1119
|
+
const route = inject(ActivatedRoute, { optional: true });
|
|
1120
|
+
return computed(() => {
|
|
1121
|
+
// `null` is the consumer's way of saying "announce nothing"; the directive spells that
|
|
1122
|
+
// `undefined`, so the two meet here rather than at every call site.
|
|
1123
|
+
const explicit = override();
|
|
1124
|
+
if (explicit !== undefined) {
|
|
1125
|
+
return explicit ?? undefined;
|
|
1126
|
+
}
|
|
1127
|
+
const link = routerLink();
|
|
1128
|
+
if (!router || link === null) {
|
|
1129
|
+
return undefined;
|
|
1130
|
+
}
|
|
1131
|
+
const tree = link instanceof UrlTree
|
|
1132
|
+
? link
|
|
1133
|
+
: router.createUrlTree(Array.isArray(link) ? [...link] : [link], {
|
|
1134
|
+
relativeTo: route ?? undefined,
|
|
1135
|
+
...modifiers(),
|
|
1136
|
+
});
|
|
1137
|
+
// `lastSuccessfulNavigation` is only the reactive trigger. The comparison goes through
|
|
1138
|
+
// `Router.isActive`, which reads the LIVE url: the standalone `isActive()` helper compares
|
|
1139
|
+
// against that navigation's `finalUrl` instead, and an app that rewrites its path without
|
|
1140
|
+
// navigating — a docs page tracking the section under the reader, a wizard naming its step —
|
|
1141
|
+
// then keeps announcing the page it landed on. Deprecated in 21.1, and nothing public replaces
|
|
1142
|
+
// the live-url comparison.
|
|
1143
|
+
router.lastSuccessfulNavigation();
|
|
1144
|
+
return router.isActive(tree, EXACT_PATH)
|
|
1145
|
+
? 'page'
|
|
1146
|
+
: router.isActive(tree, PREFIX_PATH)
|
|
1147
|
+
? true
|
|
1148
|
+
: undefined;
|
|
1149
|
+
});
|
|
1150
|
+
}
|
|
744
1151
|
|
|
745
1152
|
/**
|
|
746
1153
|
* Replaces a picker panel's "no matches" row — an icon, a sentence in the app's
|
|
@@ -884,25 +1291,41 @@ const OVERLAY_MOTION_TOKENS = [
|
|
|
884
1291
|
'--ds-overlay-enter-offset',
|
|
885
1292
|
'--ds-overlay-enter-scale',
|
|
886
1293
|
];
|
|
887
|
-
/** Styles `dropdownOverlay()`
|
|
888
|
-
* gets it whether or not it names panel tokens of its own. */
|
|
1294
|
+
/** Styles the `ds-dropdown-panel` class every `dropdownOverlay()` pane carries, so
|
|
1295
|
+
* every connected picker gets it whether or not it names panel tokens of its own. */
|
|
889
1296
|
const DROPDOWN_PANEL_TOKENS = [
|
|
890
1297
|
'--ds-dropdown-panel-radius',
|
|
891
1298
|
'--ds-dropdown-panel-maxh',
|
|
1299
|
+
'--ds-dropdown-panel-border-color',
|
|
1300
|
+
'--ds-dropdown-panel-shadow',
|
|
892
1301
|
'--ds-option-padding',
|
|
893
1302
|
'--ds-option-gap',
|
|
894
1303
|
'--ds-option-radius',
|
|
895
1304
|
'--ds-option-row-gap',
|
|
896
1305
|
'--ds-option-bg-color-active',
|
|
1306
|
+
'--ds-option-weight',
|
|
1307
|
+
'--ds-option-font-size',
|
|
1308
|
+
'--ds-option-line-height',
|
|
1309
|
+
'--ds-option-font-family',
|
|
897
1310
|
];
|
|
898
1311
|
const DROPDOWN_GAP = 4;
|
|
1312
|
+
/**
|
|
1313
|
+
* One panel-class input as an array. Spreading the raw input would scatter a
|
|
1314
|
+
* string into its characters, which is a silent per-letter class list.
|
|
1315
|
+
* @internal
|
|
1316
|
+
*/
|
|
1317
|
+
function panelClassesOf(panelClass) {
|
|
1318
|
+
return typeof panelClass === 'string'
|
|
1319
|
+
? panelClass.split(' ').filter((className) => className.length > 0)
|
|
1320
|
+
: panelClass;
|
|
1321
|
+
}
|
|
899
1322
|
/**
|
|
900
1323
|
* The geometry every DS dropdown shares. Width is deliberately NOT set here —
|
|
901
1324
|
* each caller has its own policy (the exact trigger width, or the trigger as a
|
|
902
1325
|
* floor).
|
|
903
1326
|
* @internal
|
|
904
1327
|
*/
|
|
905
|
-
function dropdownOverlay(overlay, trigger,
|
|
1328
|
+
function dropdownOverlay(overlay, trigger, extraPanelClass = []) {
|
|
906
1329
|
const positionStrategy = overlay
|
|
907
1330
|
.position()
|
|
908
1331
|
.flexibleConnectedTo(trigger)
|
|
@@ -929,7 +1352,13 @@ function dropdownOverlay(overlay, trigger, panelClass = ['ds-dropdown-panel', 'd
|
|
|
929
1352
|
hasBackdrop: false,
|
|
930
1353
|
// The global panel skin lives in styles/_dropdown-overlay.scss: a portaled
|
|
931
1354
|
// node sits outside the host's DOM tree, so `:host ::ng-deep` cannot reach it.
|
|
932
|
-
|
|
1355
|
+
// The shared pair is never optional — a caller adds to it, so its own class
|
|
1356
|
+
// and a consumer's survive together and a rule can name one picker.
|
|
1357
|
+
panelClass: [
|
|
1358
|
+
'ds-dropdown-panel',
|
|
1359
|
+
'ds-overlay-pane',
|
|
1360
|
+
...panelClassesOf(extraPanelClass),
|
|
1361
|
+
],
|
|
933
1362
|
scrollStrategy: overlay.scrollStrategies.reposition(),
|
|
934
1363
|
},
|
|
935
1364
|
};
|
|
@@ -999,11 +1428,18 @@ function forwardOverlayTokens(overlayRef, host, tokens) {
|
|
|
999
1428
|
// Roles resolve at :root, so every host has a value for them and copying it
|
|
1000
1429
|
// unconditionally would PIN it inline on the pane — an open panel would then
|
|
1001
1430
|
// ignore a theme switch until it was reopened. Forward only where the host
|
|
1002
|
-
//
|
|
1003
|
-
|
|
1431
|
+
// declares the role ITSELF, which is the case the pane cannot see.
|
|
1432
|
+
//
|
|
1433
|
+
// Compared against the PARENT, not against :root. Custom properties inherit, so a
|
|
1434
|
+
// shell that sets a role for its own chrome makes every component under it differ
|
|
1435
|
+
// from the root — each would pin the shell's value inline, where it outranks the
|
|
1436
|
+
// `.ds-overlay-pane` rule that is a consumer's only route to a portaled panel. An
|
|
1437
|
+
// ancestor's value reaches one panel through that component's own `--ds-*` hook,
|
|
1438
|
+
// which the loop above forwards with no such test.
|
|
1439
|
+
const inheritedStyle = getComputedStyle(host.parentElement ?? host.ownerDocument.documentElement);
|
|
1004
1440
|
for (const token of ROLE_TOKENS) {
|
|
1005
1441
|
const value = hostStyle.getPropertyValue(token).trim();
|
|
1006
|
-
if (value && value !==
|
|
1442
|
+
if (value && value !== inheritedStyle.getPropertyValue(token).trim()) {
|
|
1007
1443
|
paneStyle.setProperty(token, value);
|
|
1008
1444
|
}
|
|
1009
1445
|
}
|
|
@@ -1376,5 +1812,5 @@ function createTypeAhead() {
|
|
|
1376
1812
|
* Generated bundle index. Do not edit.
|
|
1377
1813
|
*/
|
|
1378
1814
|
|
|
1379
|
-
export { DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, disposeWithLeave, dropdownOverlay, dsDestination, focusIsInside, forwardOverlayTokens, nextControlId, overlayPlacementOf, prepareOverlayEnter, resolveBrandValue, resolveFieldMessage, scrollActiveOptionIntoView, trimmedText, valueControlBridge };
|
|
1815
|
+
export { CHART_RAMP_COLORS, CHART_SERIES_COLORS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, bandScale, chartColors, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, describeSeries, describeShare, disposeWithLeave, dropdownOverlay, dsAriaCurrent, dsDestination, elementWidth, focusIsInside, focusMark, formatPercent, formatTick, formatValue, forwardOverlayTokens, largestRemainder, linearScale, nextControlId, nextRovingIndex, niceMax, overlayPlacementOf, panelClassesOf, prepareOverlayEnter, resolveBrandValue, resolveFieldMessage, scrollActiveOptionIntoView, staggerDelay, tickStep, tickValues, trimmedText, valueControlBridge };
|
|
1380
1816
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components.mjs.map
|