@ids-group-ltd/ids-design-system 0.14.0 → 0.14.2
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 +573 -4
- package/components.md +103 -62
- package/design-system.md +2 -0
- package/docs/agent/INDEX.md +5 -4
- package/docs/agent/charts/column-series-component.md +1 -1
- package/docs/agent/charts/ds-bar-chart.md +4 -3
- package/docs/agent/charts/ds-chart.md +1 -1
- package/docs/agent/charts/ds-column-chart.md +3 -3
- package/docs/agent/charts/ds-config.md +3 -1
- package/docs/agent/charts/ds-funnel-chart.md +3 -3
- package/docs/agent/charts/ds-heatmap-chart.md +1 -1
- package/docs/agent/charts/ds-line-chart.md +3 -3
- package/docs/agent/charts/ds-pie-chart.md +5 -4
- package/docs/agent/charts/ds-scatter-chart.md +1 -1
- package/docs/agent/charts/ds-waterfall-chart.md +1 -1
- package/docs/agent/charts/line-series-component.md +1 -1
- package/docs/agent/feedback/ds-alert.md +1 -0
- package/docs/agent/feedback/ds-badge.md +1 -1
- package/docs/agent/feedback/ds-banner.md +1 -0
- package/docs/agent/feedback/ds-description-list.md +3 -0
- package/docs/agent/feedback/ds-skeleton.md +2 -2
- package/docs/agent/feedback/ds-tag.md +1 -1
- package/docs/agent/forms/ds-autocomplete.md +2 -2
- package/docs/agent/forms/ds-button.md +1 -1
- package/docs/agent/forms/ds-color-picker.md +1 -1
- package/docs/agent/forms/ds-date-picker.md +2 -2
- package/docs/agent/forms/ds-filter-bar.md +1 -1
- package/docs/agent/forms/ds-icon-button.md +1 -1
- package/docs/agent/forms/ds-input.md +1 -1
- package/docs/agent/forms/ds-multi-select.md +2 -2
- package/docs/agent/forms/ds-otp-input.md +1 -1
- package/docs/agent/forms/ds-search.md +2 -2
- package/docs/agent/forms/ds-split-button.md +1 -1
- package/docs/agent/forms/ds-textarea.md +2 -2
- package/docs/agent/foundations/tokens.md +1 -1
- package/docs/agent/navigation/ds-app-layout.md +2 -2
- package/docs/agent/navigation/ds-auth-layout.md +4 -4
- package/docs/agent/navigation/ds-page-header.md +1 -1
- package/docs/agent/navigation/ds-pagination.md +1 -1
- package/docs/agent/navigation/ds-tabs.md +1 -0
- package/docs/agent/overlays/ds-tooltip.md +3 -3
- package/docs/agent/platform/ds-config.md +2 -3
- package/docs/agent/platform/ds-intl.md +33 -0
- package/docs/agent/surfaces/ds-accordion.md +2 -2
- package/docs/agent/tables/ds-table.md +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +9 -5
- 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 +21 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +9 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +8 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +15 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +5 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +12 -8
- 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 +21 -10
- 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 +53 -30
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs +7 -6
- 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 +4 -3
- 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 +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +20 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +198 -44
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs +248 -142
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +9 -5
- 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 +28 -25
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +16 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +7 -4
- 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 +12 -6
- 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-filter-bar.mjs +13 -7
- 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 +64 -43
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +56 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +5 -4
- 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 +32 -29
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +26 -13
- 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 +17 -10
- 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 +5 -4
- 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 +13 -7
- 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 +15 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs +12 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +62 -25
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +49 -12
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +6 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +20 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +6 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +6 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +16 -13
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +9 -6
- 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 +48 -22
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +68 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +9 -5
- 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 +63 -10
- 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 +12 -10
- 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 +8 -6
- 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 +78 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs +36 -21
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +355 -81
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +362 -3
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.10.0.json +1 -1
- package/migrations/0.10.1.json +1 -1
- package/migrations/0.14.0.json +28 -4
- package/migrations/0.14.1.json +856 -0
- package/migrations/0.14.2.json +427 -0
- package/package.json +1 -1
- package/schematics/check-overrides/index.cjs +56 -0
- package/schematics/check-overrides/scan.cjs +74 -0
- package/schematics/check-overrides/schema.json +19 -0
- package/schematics/check-overrides/surface.json +2333 -0
- package/schematics/collection.json +5 -0
- package/styles/_chart-frame.scss +34 -12
- package/styles/_chart-interactive.scss +43 -9
- package/styles/_chart-motion.scss +139 -16
- package/styles/_field-box.scss +12 -0
- package/styles/_overlay-motion.scss +12 -4
- package/styles/_tokens-charts.scss +1 -1
- package/styles/_tokens.scss +19 -4
- package/types/ids-group-ltd-ids-design-system-components-accordion.d.ts +11 -2
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +4 -0
- package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +5 -2
- package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +5 -5
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +7 -4
- package/types/ids-group-ltd-ids-design-system-components-avatar-group.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-avatar.d.ts +5 -3
- package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +4 -0
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +41 -19
- package/types/ids-group-ltd-ids-design-system-components-breadcrumbs.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-chart-data-table.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +8 -1
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +34 -6
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +189 -121
- package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +17 -17
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +9 -3
- package/types/ids-group-ltd-ids-design-system-components-description-list.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-filter-bar.d.ts +9 -4
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +34 -20
- package/types/ids-group-ltd-ids-design-system-components-heatmap-chart.d.ts +36 -7
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +21 -18
- package/types/ids-group-ltd-ids-design-system-components-modal.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +11 -6
- package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-password-rules.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +41 -17
- package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +28 -7
- package/types/ids-group-ltd-ids-design-system-components-search.d.ts +7 -3
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +3 -2
- package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-skeleton.d.ts +5 -1
- package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-spinner.d.ts +6 -4
- package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +5 -2
- package/types/ids-group-ltd-ids-design-system-components-stepper.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-table-export.d.ts +1 -0
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +15 -6
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +15 -2
- package/types/ids-group-ltd-ids-design-system-components-tag.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +24 -4
- package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +10 -1
- package/types/ids-group-ltd-ids-design-system-components-w3w.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-waterfall-chart.d.ts +18 -7
- package/types/ids-group-ltd-ids-design-system-components.d.ts +75 -25
- package/types/ids-group-ltd-ids-design-system-core.d.ts +421 -11
- package/types/ids-group-ltd-ids-design-system.d.ts +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, computed, signal, PLATFORM_ID, DestroyRef, untracked, afterRenderEffect, TemplateRef, Directive, Injector,
|
|
3
|
-
import { DS_CONFIG, resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';
|
|
2
|
+
import { inject, computed, signal, PLATFORM_ID, DestroyRef, InjectionToken, ElementRef, afterNextRender, NgZone, untracked, afterRenderEffect, TemplateRef, Directive, Injector, isDevMode, input, booleanAttribute, effect, DOCUMENT } from '@angular/core';
|
|
3
|
+
import { DS_CONFIG, DS_INTL, injectDsLocale, resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';
|
|
4
4
|
import { isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { NgForm, FormGroupDirective, NgControl } from '@angular/forms';
|
|
@@ -105,39 +105,64 @@ function formatValue(value, locale) {
|
|
|
105
105
|
}
|
|
106
106
|
return numberFormatter(locale).format(value);
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const chartFormats = new Map();
|
|
109
|
+
/** The built-in `valueFormat` in one locale: compact on a tick (`1.2M`), spelled out everywhere
|
|
110
|
+
* else (`1,248,392`). A caller-supplied formatter receives the same `location` and decides for
|
|
110
111
|
* itself; this is only the default.
|
|
111
112
|
*
|
|
112
113
|
* @internal */
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
function chartValueFormat(locale) {
|
|
115
|
+
let format = chartFormats.get(locale);
|
|
116
|
+
if (!format) {
|
|
117
|
+
const compact = new Intl.NumberFormat(locale, {
|
|
118
|
+
notation: 'compact',
|
|
119
|
+
maximumFractionDigits: 1,
|
|
120
|
+
});
|
|
121
|
+
const full = new Intl.NumberFormat(locale);
|
|
122
|
+
format = (value, location) => !Number.isFinite(value)
|
|
123
|
+
? '—'
|
|
124
|
+
: location === 'tick'
|
|
125
|
+
? compact.format(value)
|
|
126
|
+
: full.format(value);
|
|
127
|
+
chartFormats.set(locale, format);
|
|
128
|
+
}
|
|
129
|
+
return format;
|
|
130
|
+
}
|
|
131
|
+
const percentFormatters = new Map();
|
|
132
|
+
function percentFormatter(locale, digits) {
|
|
133
|
+
const key = `${locale}|${digits}`;
|
|
134
|
+
let formatter = percentFormatters.get(key);
|
|
135
|
+
if (!formatter) {
|
|
136
|
+
formatter = new Intl.NumberFormat(locale, {
|
|
137
|
+
style: 'percent',
|
|
138
|
+
minimumFractionDigits: digits,
|
|
139
|
+
maximumFractionDigits: digits,
|
|
140
|
+
});
|
|
141
|
+
percentFormatters.set(key, formatter);
|
|
116
142
|
}
|
|
117
|
-
return
|
|
118
|
-
? compactFormatter().format(value)
|
|
119
|
-
: numberFormatter(undefined).format(value);
|
|
120
|
-
}
|
|
121
|
-
let cachedCompactFormatter = null;
|
|
122
|
-
function compactFormatter() {
|
|
123
|
-
cachedCompactFormatter ??= new Intl.NumberFormat(undefined, {
|
|
124
|
-
notation: 'compact',
|
|
125
|
-
maximumFractionDigits: 1,
|
|
126
|
-
});
|
|
127
|
-
return cachedCompactFormatter;
|
|
143
|
+
return formatter;
|
|
128
144
|
}
|
|
129
145
|
/** @internal */
|
|
130
|
-
function formatPercent(value, total) {
|
|
146
|
+
function formatPercent(value, total, locale) {
|
|
131
147
|
if (!total || !Number.isFinite(value) || !Number.isFinite(total)) {
|
|
132
148
|
return '—';
|
|
133
149
|
}
|
|
134
|
-
const
|
|
150
|
+
const fraction = value / total;
|
|
151
|
+
const formatter = percentFormatter(locale, 1);
|
|
135
152
|
// A real share must never print as an exact zero: at one decimal, 214 of 987,654,321 rounds to
|
|
136
153
|
// "0.0%" beside a bar too short to see, and the row reads as nothing when it is not nothing.
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
154
|
+
if (fraction !== 0 && Math.abs(fraction) < 0.0005) {
|
|
155
|
+
return fraction > 0
|
|
156
|
+
? `<${formatter.format(0.001)}`
|
|
157
|
+
: `>${formatter.format(-0.001)}`;
|
|
139
158
|
}
|
|
140
|
-
return
|
|
159
|
+
return formatter.format(fraction);
|
|
160
|
+
}
|
|
161
|
+
/** A whole-number percentage (the pie's largest-remainder shares), in `locale`.
|
|
162
|
+
*
|
|
163
|
+
* @internal */
|
|
164
|
+
function formatWholePercent(percent, locale) {
|
|
165
|
+
return percentFormatter(locale, 0).format(percent / 100);
|
|
141
166
|
}
|
|
142
167
|
/** Whole percentages that sum to exactly 100. Rounding each share on its own
|
|
143
168
|
* gives 33/33/33 for three equal parts, and a legend that visibly loses 1%.
|
|
@@ -196,7 +221,7 @@ function formatTick(value, step) {
|
|
|
196
221
|
* rather than subtracted from it, so a negative mark has no share rather than a misleading one.
|
|
197
222
|
*
|
|
198
223
|
* @internal */
|
|
199
|
-
function shareOfTotal(values, index) {
|
|
224
|
+
function shareOfTotal(values, index, locale) {
|
|
200
225
|
const value = values[index];
|
|
201
226
|
if (values.length < 2 || !Number.isFinite(value) || value <= 0) {
|
|
202
227
|
return '';
|
|
@@ -204,15 +229,15 @@ function shareOfTotal(values, index) {
|
|
|
204
229
|
const total = values
|
|
205
230
|
.filter((entry) => Number.isFinite(entry) && entry > 0)
|
|
206
231
|
.reduce((sum, entry) => sum + entry, 0);
|
|
207
|
-
return total > 0 ? formatPercent(value, total) : '';
|
|
232
|
+
return total > 0 ? formatPercent(value, total, locale) : '';
|
|
208
233
|
}
|
|
209
234
|
/** The same share, phrased for a tooltip line, where no column header stands above it to say what
|
|
210
235
|
* the percentage is OF.
|
|
211
236
|
*
|
|
212
237
|
* @internal */
|
|
213
|
-
function describeShare(values, index) {
|
|
214
|
-
const share = shareOfTotal(values, index);
|
|
215
|
-
return share ?
|
|
238
|
+
function describeShare(values, index, locale, phrase) {
|
|
239
|
+
const share = shareOfTotal(values, index, locale);
|
|
240
|
+
return share ? phrase(share) : '';
|
|
216
241
|
}
|
|
217
242
|
|
|
218
243
|
/** Container width as a signal. It is 0 under SSR, while the container is
|
|
@@ -234,16 +259,166 @@ function elementWidth(host) {
|
|
|
234
259
|
return width.asReadonly();
|
|
235
260
|
}
|
|
236
261
|
const widths = new WeakMap();
|
|
237
|
-
let observer = null;
|
|
262
|
+
let observer$1 = null;
|
|
238
263
|
// One observer for every chart on the page, so a resize is one callback with every entry in it
|
|
239
264
|
// rather than one callback per chart.
|
|
240
265
|
function sharedObserver() {
|
|
241
|
-
observer ??= new ResizeObserver((entries) => {
|
|
266
|
+
observer$1 ??= new ResizeObserver((entries) => {
|
|
242
267
|
for (const entry of entries) {
|
|
243
268
|
widths.get(entry.target)?.set(Math.round(entry.contentRect.width));
|
|
244
269
|
}
|
|
245
270
|
});
|
|
246
|
-
return observer;
|
|
271
|
+
return observer$1;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** Provided by a chart that has already waited for the viewport, so the `ds-chart` it draws
|
|
275
|
+
* through builds at once instead of waiting a second time.
|
|
276
|
+
*
|
|
277
|
+
* @internal */
|
|
278
|
+
const CHART_RENDER_GATE_PASSED = new InjectionToken('CHART_RENDER_GATE_PASSED');
|
|
279
|
+
const builders = new WeakMap();
|
|
280
|
+
const near = new Map();
|
|
281
|
+
const ahead = new Map();
|
|
282
|
+
const observers = new Map();
|
|
283
|
+
let draining = false;
|
|
284
|
+
let idleScheduled = false;
|
|
285
|
+
let budgetMs = 8;
|
|
286
|
+
function drain() {
|
|
287
|
+
const start = performance.now();
|
|
288
|
+
for (const [host, build] of near) {
|
|
289
|
+
if (performance.now() - start > budgetMs) {
|
|
290
|
+
setTimeout(drain);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
near.delete(host);
|
|
294
|
+
build();
|
|
295
|
+
}
|
|
296
|
+
draining = false;
|
|
297
|
+
}
|
|
298
|
+
// An idle period with less than this left would run a chart's build into the next frame.
|
|
299
|
+
const IDLE_ROOM_MS = 12;
|
|
300
|
+
function buildWhileIdle(deadline) {
|
|
301
|
+
idleScheduled = false;
|
|
302
|
+
for (const [host, build] of ahead) {
|
|
303
|
+
if (deadline.timeRemaining() < IDLE_ROOM_MS) {
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
ahead.delete(host);
|
|
307
|
+
build();
|
|
308
|
+
}
|
|
309
|
+
scheduleIdle();
|
|
310
|
+
}
|
|
311
|
+
function scheduleIdle() {
|
|
312
|
+
if (idleScheduled ||
|
|
313
|
+
!ahead.size ||
|
|
314
|
+
typeof requestIdleCallback === 'undefined') {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
idleScheduled = true;
|
|
318
|
+
requestIdleCallback(buildWhileIdle);
|
|
319
|
+
}
|
|
320
|
+
function observer(root, margin, queue, schedule) {
|
|
321
|
+
let byMargin = observers.get(root);
|
|
322
|
+
if (!byMargin) {
|
|
323
|
+
byMargin = new Map();
|
|
324
|
+
observers.set(root, byMargin);
|
|
325
|
+
}
|
|
326
|
+
const key = `${queue === near ? 'near' : 'ahead'} ${margin}`;
|
|
327
|
+
let found = byMargin.get(key);
|
|
328
|
+
if (!found) {
|
|
329
|
+
found = new IntersectionObserver((entries) => {
|
|
330
|
+
for (const entry of entries) {
|
|
331
|
+
const build = builders.get(entry.target);
|
|
332
|
+
// A chart the reader has already scrolled past leaves the queue instead of being built
|
|
333
|
+
// behind them.
|
|
334
|
+
if (build && entry.isIntersecting) {
|
|
335
|
+
queue.set(entry.target, build);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
queue.delete(entry.target);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
schedule();
|
|
342
|
+
}, { root, rootMargin: margin });
|
|
343
|
+
byMargin.set(key, found);
|
|
344
|
+
}
|
|
345
|
+
return found;
|
|
346
|
+
}
|
|
347
|
+
function scheduleDrain() {
|
|
348
|
+
if (near.size && !draining) {
|
|
349
|
+
draining = true;
|
|
350
|
+
setTimeout(drain);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// A margin on the root only widens the root: an element inside a scrolling container is clipped by
|
|
354
|
+
// that container first, so the container has to BE the root for the margin to reach past its edge.
|
|
355
|
+
// The overflow test alone is not enough - a box that only scrolls sideways computes `overflow-y:
|
|
356
|
+
// auto` too - so the container also has to be taller inside than out.
|
|
357
|
+
function scrollRoot(host) {
|
|
358
|
+
for (let node = host.parentElement; node; node = node.parentElement) {
|
|
359
|
+
const overflow = getComputedStyle(node).overflowY;
|
|
360
|
+
if ((overflow === 'auto' ||
|
|
361
|
+
overflow === 'scroll' ||
|
|
362
|
+
overflow === 'overlay') &&
|
|
363
|
+
node.scrollHeight > node.clientHeight) {
|
|
364
|
+
return node;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
/** Whether a chart may build its plot yet, under `DS_CONFIG.chart.rendering`. `true` from the
|
|
370
|
+
* start unless `deferUntilVisible` is on; with it on, `true` once the chart nears the viewport or
|
|
371
|
+
* is built ahead while the page is idle, and it stays `true`. Call from an injection context.
|
|
372
|
+
*
|
|
373
|
+
* @internal */
|
|
374
|
+
function chartRenderGate() {
|
|
375
|
+
const rendering = inject(DS_CONFIG).chart?.rendering;
|
|
376
|
+
// `skipSelf`: a preset provides the token to its own view, and must not read it back itself.
|
|
377
|
+
const passed = inject(CHART_RENDER_GATE_PASSED, {
|
|
378
|
+
optional: true,
|
|
379
|
+
skipSelf: true,
|
|
380
|
+
});
|
|
381
|
+
if (!rendering?.deferUntilVisible ||
|
|
382
|
+
passed ||
|
|
383
|
+
!isPlatformBrowser(inject(PLATFORM_ID)) ||
|
|
384
|
+
typeof IntersectionObserver === 'undefined') {
|
|
385
|
+
return signal(true).asReadonly();
|
|
386
|
+
}
|
|
387
|
+
const ready = signal(false, ...(ngDevMode ? [{ debugName: "ready" }] : /* istanbul ignore next */ []));
|
|
388
|
+
const host = inject(ElementRef).nativeElement;
|
|
389
|
+
budgetMs = rendering.frameBudgetMs ?? budgetMs;
|
|
390
|
+
const skipWhileOffscreen = rendering.skipWhileOffscreen ?? true;
|
|
391
|
+
let release = () => undefined;
|
|
392
|
+
afterNextRender(() => {
|
|
393
|
+
const root = scrollRoot(host);
|
|
394
|
+
const watchers = [
|
|
395
|
+
observer(root, rendering.visibleMargin ?? '10% 0px', near, scheduleDrain),
|
|
396
|
+
];
|
|
397
|
+
if (rendering.buildAheadWhileIdle ?? true) {
|
|
398
|
+
watchers.push(observer(root, rendering.buildAheadMargin ?? '100% 0px', ahead, scheduleIdle));
|
|
399
|
+
}
|
|
400
|
+
release = () => {
|
|
401
|
+
for (const watcher of watchers) {
|
|
402
|
+
watcher.unobserve(host);
|
|
403
|
+
}
|
|
404
|
+
near.delete(host);
|
|
405
|
+
ahead.delete(host);
|
|
406
|
+
};
|
|
407
|
+
builders.set(host, () => {
|
|
408
|
+
release();
|
|
409
|
+
if (skipWhileOffscreen) {
|
|
410
|
+
// `auto` remembers the height the chart last rendered at, so skipping it moves nothing.
|
|
411
|
+
host.style.contentVisibility = 'auto';
|
|
412
|
+
host.style.containIntrinsicBlockSize = 'auto 300px';
|
|
413
|
+
}
|
|
414
|
+
ready.set(true);
|
|
415
|
+
});
|
|
416
|
+
for (const watcher of watchers) {
|
|
417
|
+
watcher.observe(host);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
inject(DestroyRef).onDestroy(() => release());
|
|
421
|
+
return ready.asReadonly();
|
|
247
422
|
}
|
|
248
423
|
|
|
249
424
|
/** A label turned 45 degrees takes this fraction of its width across the axis. 45 is where the
|
|
@@ -679,18 +854,19 @@ function roundStepAtLeast(minimumStep) {
|
|
|
679
854
|
return 10 * base;
|
|
680
855
|
}
|
|
681
856
|
|
|
682
|
-
// Past
|
|
683
|
-
//
|
|
684
|
-
const
|
|
685
|
-
/** Entrance delay for the mark at `index`, in milliseconds
|
|
686
|
-
*
|
|
857
|
+
// The whole spread of a series' arrival. Past it the entrance stops reading as one gesture and
|
|
858
|
+
// starts reading as a queue.
|
|
859
|
+
const STAGGER_BUDGET_MS = 260;
|
|
860
|
+
/** Entrance delay for the mark at `index` of `count`, in milliseconds: `stepMs` apart, narrowed so
|
|
861
|
+
* the last mark starts within the budget. Spread evenly rather than capped, so a long series still
|
|
862
|
+
* arrives in order instead of landing all at once past the cap. `stepMs` of `0` means no stagger.
|
|
687
863
|
*
|
|
688
864
|
* @internal */
|
|
689
|
-
function staggerDelay(index, stepMs) {
|
|
690
|
-
if (!(stepMs > 0) || !Number.isFinite(index) || index <= 0) {
|
|
865
|
+
function staggerDelay(index, count, stepMs) {
|
|
866
|
+
if (!(stepMs > 0) || !Number.isFinite(index) || index <= 0 || count <= 1) {
|
|
691
867
|
return 0;
|
|
692
868
|
}
|
|
693
|
-
return Math.min(
|
|
869
|
+
return index * Math.min(stepMs, STAGGER_BUDGET_MS / (count - 1));
|
|
694
870
|
}
|
|
695
871
|
/** Starts a mark's exit, bound as `(animate.leave)="leaveMark($event)"`: `_chart-motion.scss`
|
|
696
872
|
* animates `.mark-leave`, and Angular removes the mark on its `animationend`. The function form,
|
|
@@ -702,6 +878,73 @@ function leaveMark(event) {
|
|
|
702
878
|
event.target.classList.add('mark-leave');
|
|
703
879
|
}
|
|
704
880
|
|
|
881
|
+
// A chart stays warm from its first answer until the pointer leaves it, so a reader moving along
|
|
882
|
+
// the marks is answered at once rather than waiting at every mark. One set for the whole page:
|
|
883
|
+
// a legend and the plot beside it are one chart.
|
|
884
|
+
const warmCharts = new WeakSet();
|
|
885
|
+
function chartOf(event) {
|
|
886
|
+
const node = event.currentTarget ?? event.target;
|
|
887
|
+
return node instanceof Element ? node.closest('figure') : null;
|
|
888
|
+
}
|
|
889
|
+
function warmUp(chart) {
|
|
890
|
+
if (warmCharts.has(chart)) {
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
warmCharts.add(chart);
|
|
894
|
+
const coolOnLeave = (event) => {
|
|
895
|
+
if (!(event.target instanceof Node) || !chart.contains(event.target)) {
|
|
896
|
+
warmCharts.delete(chart);
|
|
897
|
+
document.removeEventListener('pointerover', coolOnLeave, true);
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
document.addEventListener('pointerover', coolOnLeave, true);
|
|
901
|
+
}
|
|
902
|
+
/** Call from anywhere; the wait is cancelled by the caller's own `leave`. `delayMs` is read at each
|
|
903
|
+
* `schedule`, so a config that changes is picked up on the next rest.
|
|
904
|
+
*
|
|
905
|
+
* @internal */
|
|
906
|
+
function chartDwell(delayMs) {
|
|
907
|
+
let waiting = null;
|
|
908
|
+
const cancel = () => {
|
|
909
|
+
if (waiting) {
|
|
910
|
+
clearTimeout(waiting.timer);
|
|
911
|
+
waiting = null;
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
return {
|
|
915
|
+
schedule(target, answer, event) {
|
|
916
|
+
const pointer = typeof PointerEvent !== 'undefined' &&
|
|
917
|
+
event instanceof PointerEvent &&
|
|
918
|
+
event.pointerType !== 'touch';
|
|
919
|
+
const chart = chartOf(event);
|
|
920
|
+
const delay = Math.max(delayMs(), 0);
|
|
921
|
+
if (!pointer || delay === 0 || (chart && warmCharts.has(chart))) {
|
|
922
|
+
cancel();
|
|
923
|
+
answer();
|
|
924
|
+
if (pointer && chart) {
|
|
925
|
+
warmUp(chart);
|
|
926
|
+
}
|
|
927
|
+
return;
|
|
928
|
+
}
|
|
929
|
+
if (waiting && waiting.target === target) {
|
|
930
|
+
waiting.answer = answer;
|
|
931
|
+
return;
|
|
932
|
+
}
|
|
933
|
+
cancel();
|
|
934
|
+
const timer = setTimeout(() => {
|
|
935
|
+
const ready = waiting;
|
|
936
|
+
waiting = null;
|
|
937
|
+
ready?.answer();
|
|
938
|
+
if (chart) {
|
|
939
|
+
warmUp(chart);
|
|
940
|
+
}
|
|
941
|
+
}, delay);
|
|
942
|
+
waiting = { target, answer, timer };
|
|
943
|
+
},
|
|
944
|
+
cancel,
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
|
|
705
948
|
/** Where a roving tabindex lands after `key`, or `null` when the key does not traverse.
|
|
706
949
|
*
|
|
707
950
|
* The ends wrap, as they do in `ds-radio-group`: a chart's marks are a closed set, and Home and
|
|
@@ -766,8 +1009,7 @@ function rovingMarks(count) {
|
|
|
766
1009
|
* event did not start on a mark.
|
|
767
1010
|
*
|
|
768
1011
|
* @internal */
|
|
769
|
-
function markOf(event) {
|
|
770
|
-
const scope = event.currentTarget;
|
|
1012
|
+
function markOf(event, scope = event.currentTarget) {
|
|
771
1013
|
const target = event.target;
|
|
772
1014
|
if (!(scope instanceof Element) || !(target instanceof Element)) {
|
|
773
1015
|
return null;
|
|
@@ -778,43 +1020,74 @@ function markOf(event) {
|
|
|
778
1020
|
}
|
|
779
1021
|
return { element, index: Number(element.getAttribute('data-mark-index')) };
|
|
780
1022
|
}
|
|
1023
|
+
/** Focus arriving on and leaving a mark inside `scope`, heard from the document rather than from
|
|
1024
|
+
* the marks' group: Chromium makes an SVG element focusable once it has a `focus`, `blur`,
|
|
1025
|
+
* `focusin` or `focusout` listener, so a group that listened would take focus on a click and
|
|
1026
|
+
* ring every mark it holds. Call from an injection context.
|
|
1027
|
+
*
|
|
1028
|
+
* @internal */
|
|
1029
|
+
function listenForMarkFocus(scope, onFocus, onBlur) {
|
|
1030
|
+
const zone = inject(NgZone);
|
|
1031
|
+
const destroyRef = inject(DestroyRef);
|
|
1032
|
+
afterNextRender(() => {
|
|
1033
|
+
const host = scope.nativeElement;
|
|
1034
|
+
const document = host.ownerDocument;
|
|
1035
|
+
const forward = (handler) => (event) => {
|
|
1036
|
+
const hit = handler && markOf(event, host);
|
|
1037
|
+
if (hit) {
|
|
1038
|
+
handler(event, hit);
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
const focusIn = forward(onFocus);
|
|
1042
|
+
const focusOut = forward(onBlur);
|
|
1043
|
+
// Outside the zone: every focus change on the page reaches every series, and the handlers
|
|
1044
|
+
// write signals, which schedule the render they need.
|
|
1045
|
+
zone.runOutsideAngular(() => {
|
|
1046
|
+
document.addEventListener('focusin', focusIn);
|
|
1047
|
+
document.addEventListener('focusout', focusOut);
|
|
1048
|
+
});
|
|
1049
|
+
destroyRef.onDestroy(() => {
|
|
1050
|
+
document.removeEventListener('focusin', focusIn);
|
|
1051
|
+
document.removeEventListener('focusout', focusOut);
|
|
1052
|
+
});
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
781
1055
|
|
|
782
|
-
function trendOf(values) {
|
|
1056
|
+
function trendOf(values, words) {
|
|
783
1057
|
const first = values[0];
|
|
784
1058
|
const last = values[values.length - 1];
|
|
785
1059
|
const rose = values.every((value, index) => index === 0 || value > values[index - 1]);
|
|
786
1060
|
const fell = values.every((value, index) => index === 0 || value < values[index - 1]);
|
|
787
1061
|
if (rose) {
|
|
788
|
-
return
|
|
1062
|
+
return words.trendRisingThroughout;
|
|
789
1063
|
}
|
|
790
1064
|
if (fell) {
|
|
791
|
-
return
|
|
1065
|
+
return words.trendFallingThroughout;
|
|
792
1066
|
}
|
|
793
1067
|
if (last > first) {
|
|
794
|
-
return
|
|
1068
|
+
return words.trendRisingOverall;
|
|
795
1069
|
}
|
|
796
1070
|
if (last < first) {
|
|
797
|
-
return
|
|
1071
|
+
return words.trendFallingOverall;
|
|
798
1072
|
}
|
|
799
|
-
return
|
|
1073
|
+
return words.trendFlat;
|
|
800
1074
|
}
|
|
801
1075
|
/** Where the readings sit against each reference line, appended to the description. A line the
|
|
802
1076
|
* reader cannot see is a line that does not exist for them, and its whole point is the
|
|
803
1077
|
* comparison, not its position. */
|
|
804
|
-
function describeThresholds(thresholds, points, format) {
|
|
1078
|
+
function describeThresholds(thresholds, points, format, words) {
|
|
805
1079
|
const total = points.length;
|
|
806
|
-
const noun = total === 1 ? 'point' : 'points';
|
|
807
1080
|
return thresholds
|
|
808
1081
|
.map((threshold) => {
|
|
809
|
-
const name = threshold.label ??
|
|
1082
|
+
const name = threshold.label ?? words.threshold;
|
|
810
1083
|
if (threshold.to == null) {
|
|
811
1084
|
const above = points.filter((point) => point.value > threshold.value).length;
|
|
812
|
-
return ` ${name
|
|
1085
|
+
return ` ${words.thresholdAbove(name, format(threshold.value), above, total)}`;
|
|
813
1086
|
}
|
|
814
1087
|
const low = Math.min(threshold.value, threshold.to);
|
|
815
1088
|
const high = Math.max(threshold.value, threshold.to);
|
|
816
1089
|
const inside = points.filter((point) => point.value >= low && point.value <= high).length;
|
|
817
|
-
return ` ${name
|
|
1090
|
+
return ` ${words.thresholdInside(name, format(low), format(high), inside, total)}`;
|
|
818
1091
|
})
|
|
819
1092
|
.join('');
|
|
820
1093
|
}
|
|
@@ -827,22 +1100,20 @@ function describeThresholds(thresholds, points, format) {
|
|
|
827
1100
|
* levels of chart description, and the encoding is the one thing a screen-reader user cannot use.
|
|
828
1101
|
*
|
|
829
1102
|
* @internal */
|
|
830
|
-
function describeSeries(label, points, format = formatValue, tableFollows = true, thresholds = []) {
|
|
1103
|
+
function describeSeries(words, label, points, format = formatValue, tableFollows = true, thresholds = []) {
|
|
831
1104
|
if (points.length === 0) {
|
|
832
|
-
return
|
|
1105
|
+
return words.noData(label);
|
|
833
1106
|
}
|
|
834
|
-
const pointer = describeThresholds(thresholds, points, format) +
|
|
835
|
-
(tableFollows ?
|
|
1107
|
+
const pointer = describeThresholds(thresholds, points, format, words) +
|
|
1108
|
+
(tableFollows ? ` ${words.tableFollows}` : '');
|
|
836
1109
|
if (points.length === 1) {
|
|
837
|
-
return `${label
|
|
1110
|
+
return `${words.onePoint(label, format(points[0].value), points[0].label)}${pointer}`;
|
|
838
1111
|
}
|
|
839
1112
|
const lowest = points.reduce((min, point) => point.value < min.value ? point : min);
|
|
840
1113
|
const highest = points.reduce((max, point) => point.value > max.value ? point : max);
|
|
841
|
-
return (`${label
|
|
842
|
-
`${
|
|
843
|
-
`${
|
|
844
|
-
`Highest in ${highest.label} at ${format(highest.value)}, ` +
|
|
845
|
-
`lowest in ${lowest.label} at ${format(lowest.value)}.${pointer}`);
|
|
1114
|
+
return (`${words.range(label, points.length, format(lowest.value), format(highest.value))} ` +
|
|
1115
|
+
`${trendOf(points.map((point) => point.value), words)}. ` +
|
|
1116
|
+
`${words.extremes(highest.label, format(highest.value), lowest.label, format(lowest.value))}${pointer}`);
|
|
846
1117
|
}
|
|
847
1118
|
|
|
848
1119
|
/**
|
|
@@ -1891,9 +2162,9 @@ function dropdownOverlay(overlay, trigger, extraPanelClass = []) {
|
|
|
1891
2162
|
},
|
|
1892
2163
|
};
|
|
1893
2164
|
}
|
|
1894
|
-
//
|
|
1895
|
-
//
|
|
1896
|
-
//
|
|
2165
|
+
// The teardown guarantee for the leave: a pane that is display:none, a consumer stylesheet
|
|
2166
|
+
// that removed the animation, and a 0s reduced-motion duration (whose animationend is not
|
|
2167
|
+
// reliably delivered) all end here. Comfortably past --ds-motion-exit-duration.
|
|
1897
2168
|
const LEAVE_TIMEOUT_MS = 400;
|
|
1898
2169
|
/**
|
|
1899
2170
|
* Close a DS overlay panel — instantly on a `'select'`, with a short fade on a
|
|
@@ -2140,14 +2411,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
2140
2411
|
* child and, worse, a region created together with its text is the case screen
|
|
2141
2412
|
* readers reliably do not announce — there is no content CHANGE to fire on. The
|
|
2142
2413
|
* node here is created once, empty, and only its text changes.
|
|
2143
|
-
*
|
|
2144
|
-
* The text is English, which is the same debt every other library-invented string
|
|
2145
|
-
* in this package carries (see the localization item in `docs/todo.md`). It is a
|
|
2146
|
-
* count, so it is the cheapest of them to swap once a provider lands.
|
|
2147
2414
|
* @internal
|
|
2148
2415
|
*/
|
|
2149
2416
|
function announceOptionCount(count, active) {
|
|
2150
2417
|
const documentRef = inject(DOCUMENT);
|
|
2418
|
+
const intl = inject(DS_INTL);
|
|
2151
2419
|
const region = documentRef.createElement('div');
|
|
2152
2420
|
region.setAttribute('aria-live', 'polite');
|
|
2153
2421
|
region.setAttribute('aria-atomic', 'true');
|
|
@@ -2162,13 +2430,7 @@ function announceOptionCount(count, active) {
|
|
|
2162
2430
|
region.textContent = '';
|
|
2163
2431
|
return;
|
|
2164
2432
|
}
|
|
2165
|
-
|
|
2166
|
-
region.textContent =
|
|
2167
|
-
total === 0
|
|
2168
|
-
? 'No results'
|
|
2169
|
-
: total === 1
|
|
2170
|
-
? '1 result'
|
|
2171
|
-
: `${total} results`;
|
|
2433
|
+
region.textContent = intl().picker.resultCount(count());
|
|
2172
2434
|
});
|
|
2173
2435
|
}
|
|
2174
2436
|
|
|
@@ -2338,17 +2600,29 @@ function createTypeAhead() {
|
|
|
2338
2600
|
|
|
2339
2601
|
const NO_DATA_TABLE = signal(null, ...(ngDevMode ? [{ debugName: "NO_DATA_TABLE" }] : /* istanbul ignore next */ []));
|
|
2340
2602
|
const NO_LINGER = signal(null, ...(ngDevMode ? [{ debugName: "NO_LINGER" }] : /* istanbul ignore next */ []));
|
|
2341
|
-
|
|
2603
|
+
const NO_PIN = signal(null, ...(ngDevMode ? [{ debugName: "NO_PIN" }] : /* istanbul ignore next */ []));
|
|
2604
|
+
const NO_DELAY = signal(null, ...(ngDevMode ? [{ debugName: "NO_DELAY" }] : /* istanbul ignore next */ []));
|
|
2605
|
+
/** How long a resting pointer waits before a chart answers it, when nothing sets it.
|
|
2606
|
+
*
|
|
2607
|
+
* @internal */
|
|
2608
|
+
const CHART_HOVER_DELAY_MS = 500;
|
|
2609
|
+
/** Each resolved input → `DS_CONFIG.chart` → the built-in; copy resolves input → `DS_INTL.chart`.
|
|
2610
|
+
* Call from an injection context.
|
|
2342
2611
|
*
|
|
2343
2612
|
* @internal */
|
|
2344
2613
|
function resolveChartDefaults(inputs) {
|
|
2614
|
+
const locale = injectDsLocale();
|
|
2615
|
+
const intl = inject(DS_INTL);
|
|
2345
2616
|
return {
|
|
2617
|
+
locale,
|
|
2346
2618
|
frame: resolveWithConfig(inputs.frame, (config) => config.chart?.frame, 'auto'),
|
|
2347
2619
|
dataTable: resolveWithConfig(inputs.dataTable ?? NO_DATA_TABLE, (config) => config.chart?.dataTable, 'none'),
|
|
2348
|
-
emptyText:
|
|
2349
|
-
errorText:
|
|
2350
|
-
valueFormat: resolveWithConfig(inputs.valueFormat, (config) => config.chart?.valueFormat,
|
|
2620
|
+
emptyText: computed(() => inputs.emptyText() ?? intl().chart.empty),
|
|
2621
|
+
errorText: computed(() => inputs.errorText() ?? intl().chart.error),
|
|
2622
|
+
valueFormat: resolveWithConfig(inputs.valueFormat, (config) => config.chart?.valueFormat, chartValueFormat(locale)),
|
|
2351
2623
|
tooltipLingerMs: resolveWithConfig(inputs.tooltipLingerMs ?? NO_LINGER, (config) => config.chart?.tooltipLingerMs, 0),
|
|
2624
|
+
pinOnClick: resolveWithConfig(inputs.pinOnClick ?? NO_PIN, (config) => config.chart?.pinOnClick, true),
|
|
2625
|
+
hoverDelayMs: resolveWithConfig(inputs.hoverDelayMs ?? NO_DELAY, (config) => config.chart?.hoverDelayMs, CHART_HOVER_DELAY_MS),
|
|
2352
2626
|
};
|
|
2353
2627
|
}
|
|
2354
2628
|
|
|
@@ -2356,5 +2630,5 @@ function resolveChartDefaults(inputs) {
|
|
|
2356
2630
|
* Generated bundle index. Do not edit.
|
|
2357
2631
|
*/
|
|
2358
2632
|
|
|
2359
|
-
export { CHART_HEAT_COLORS, 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, areaPath, bandPath, bandScale, chartColors, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, decimationTarget,
|
|
2633
|
+
export { CHART_HEAT_COLORS, CHART_HOVER_DELAY_MS, CHART_RAMP_COLORS, CHART_RENDER_GATE_PASSED, CHART_SERIES_COLORS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, areaPath, bandPath, bandScale, chartColors, chartDwell, chartRenderGate, chartValueFormat, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, decimationTarget, describeSeries, describeShare, disposeWithLeave, domainMinOf, dropdownOverlay, dsAriaCurrent, dsDestination, elementWidth, focusIsInside, focusMark, formatPercent, formatTick, formatValue, formatWholePercent, forwardOverlayTokens, labelInterval, largestRemainder, leaveMark, linePath, lineSegments, linearScale, listenForMarkFocus, lttbDecimate, markAt, markOf, minMaxDecimate, needsDecimating, nextControlId, nextRovingIndex, niceDomain, overlayPlacementOf, panelClassesOf, pointScale, polylinePoints, prepareOverlayEnter, resolveBrandValue, resolveChartDefaults, resolveFieldMessage, rotationWouldFit, roundStepAtLeast, rovingMarks, scrollActiveOptionIntoView, shareOfTotal, staggerDelay, tickStep, tickValues, trimmedText, valueControlBridge };
|
|
2360
2634
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components.mjs.map
|