@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,17 +1,85 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ChangeDetectionStrategy, ViewEncapsulation, Component,
|
|
2
|
+
import { input, inject, ElementRef, afterRenderEffect, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewContainerRef, effect, DestroyRef, Directive, signal } from '@angular/core';
|
|
3
3
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
|
-
import { closeOnScroll, disposeWithLeave } from '@ids-group-ltd/ids-design-system/components';
|
|
5
|
+
import { closeOnScroll, disposeWithLeave, chartDwell } from '@ids-group-ltd/ids-design-system/components';
|
|
6
6
|
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
8
|
+
import { ICONS } from '@ids-group-ltd/ids-design-system/core';
|
|
9
|
+
|
|
10
|
+
// WCAG 1.4.11: a graphical object needs 3:1 against what it sits on to be seen.
|
|
11
|
+
const NON_TEXT_CONTRAST = 3;
|
|
12
|
+
let probe = null;
|
|
13
|
+
const blendsByPair = new Map();
|
|
14
|
+
// Painting the colour and reading the pixel back resolves any CSS colour syntax to sRGB -
|
|
15
|
+
// `oklch()`, `color-mix()` and named colours included - where parsing the string would not.
|
|
16
|
+
function srgbOf(color) {
|
|
17
|
+
if (!probe) {
|
|
18
|
+
const canvas = document.createElement('canvas');
|
|
19
|
+
canvas.width = 1;
|
|
20
|
+
canvas.height = 1;
|
|
21
|
+
probe = canvas.getContext('2d', { willReadFrequently: true });
|
|
22
|
+
}
|
|
23
|
+
if (!probe) {
|
|
24
|
+
return [0, 0, 0];
|
|
25
|
+
}
|
|
26
|
+
probe.clearRect(0, 0, 1, 1);
|
|
27
|
+
probe.fillStyle = color;
|
|
28
|
+
probe.fillRect(0, 0, 1, 1);
|
|
29
|
+
const [red, green, blue] = probe.getImageData(0, 0, 1, 1).data;
|
|
30
|
+
return [red, green, blue];
|
|
31
|
+
}
|
|
32
|
+
function relativeLuminance([red, green, blue]) {
|
|
33
|
+
const linear = (channel) => {
|
|
34
|
+
const value = channel / 255;
|
|
35
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
36
|
+
};
|
|
37
|
+
return 0.2126 * linear(red) + 0.7152 * linear(green) + 0.0722 * linear(blue);
|
|
38
|
+
}
|
|
39
|
+
/** Whether a swatch of `color` sits on `ground` below the non-text contrast a graphical object
|
|
40
|
+
* needs, and so has to be ringed to be seen. Both are computed CSS colours. */
|
|
41
|
+
function swatchBlendsInto(color, ground) {
|
|
42
|
+
const pair = `${color}|${ground}`;
|
|
43
|
+
const known = blendsByPair.get(pair);
|
|
44
|
+
if (known !== undefined) {
|
|
45
|
+
return known;
|
|
46
|
+
}
|
|
47
|
+
const swatchLuminance = relativeLuminance(srgbOf(color));
|
|
48
|
+
const groundLuminance = relativeLuminance(srgbOf(ground));
|
|
49
|
+
const ratio = (Math.max(swatchLuminance, groundLuminance) + 0.05) /
|
|
50
|
+
(Math.min(swatchLuminance, groundLuminance) + 0.05);
|
|
51
|
+
const blends = ratio < NON_TEXT_CONTRAST;
|
|
52
|
+
blendsByPair.set(pair, blends);
|
|
53
|
+
return blends;
|
|
54
|
+
}
|
|
7
55
|
|
|
8
56
|
class ChartTooltipPanelComponent {
|
|
9
57
|
/** The category and the readings the panel prints. */
|
|
10
58
|
context = input.required(...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
11
59
|
/** The chart's projected `#dsChartTooltip` template. Null renders the built-in rows. */
|
|
12
60
|
template = input(null, ...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
61
|
+
host = inject(ElementRef);
|
|
62
|
+
constructor() {
|
|
63
|
+
// Before the frame paints, so a ring never lands a frame after its row.
|
|
64
|
+
afterRenderEffect({
|
|
65
|
+
earlyRead: () => {
|
|
66
|
+
this.context();
|
|
67
|
+
const host = this.host.nativeElement;
|
|
68
|
+
const ground = getComputedStyle(host).backgroundColor;
|
|
69
|
+
return [...host.querySelectorAll('.swatch')].map((swatch) => [
|
|
70
|
+
swatch,
|
|
71
|
+
swatchBlendsInto(getComputedStyle(swatch).backgroundColor, ground),
|
|
72
|
+
]);
|
|
73
|
+
},
|
|
74
|
+
write: (swatches) => {
|
|
75
|
+
for (const [swatch, blends] of swatches()) {
|
|
76
|
+
swatch.classList.toggle('ringed', blends);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
13
81
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartTooltipPanelComponent, isStandalone: true, selector: "ds-chart-tooltip-panel", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" } }, ngImport: i0, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)
|
|
82
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartTooltipPanelComponent, isStandalone: true, selector: "ds-chart-tooltip-panel", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" } }, ngImport: i0, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);--_chart-tooltip-hatch-color: var(--ds-chart-hatch-color);--_chart-tooltip-hatch-width: var(--ds-chart-hatch-width);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)}.swatch.ringed{box-shadow:inset 0 0 0 1.5px var(--_chart-tooltip-text-color)}.swatch.hatched{background-image:linear-gradient(-45deg,transparent calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% + var(--_chart-tooltip-hatch-width) / 2),transparent calc(50% + var(--_chart-tooltip-hatch-width) / 2))}.value{font-variant-numeric:tabular-nums;font-weight:var(--font-weight-medium)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
15
83
|
}
|
|
16
84
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipPanelComponent, decorators: [{
|
|
17
85
|
type: Component,
|
|
@@ -20,8 +88,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
20
88
|
// carries the same label and value in its `aria-label`, so exposing the panel
|
|
21
89
|
// makes a screen reader read each reading twice.
|
|
22
90
|
'aria-hidden': 'true',
|
|
23
|
-
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)
|
|
24
|
-
}], propDecorators: { context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }] } });
|
|
91
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);--_chart-tooltip-hatch-color: var(--ds-chart-hatch-color);--_chart-tooltip-hatch-width: var(--ds-chart-hatch-width);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)}.swatch.ringed{box-shadow:inset 0 0 0 1.5px var(--_chart-tooltip-text-color)}.swatch.hatched{background-image:linear-gradient(-45deg,transparent calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% + var(--_chart-tooltip-hatch-width) / 2),transparent calc(50% + var(--_chart-tooltip-hatch-width) / 2))}.value{font-variant-numeric:tabular-nums;font-weight:var(--font-weight-medium)}\n"] }]
|
|
92
|
+
}], ctorParameters: () => [], propDecorators: { context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }] } });
|
|
25
93
|
|
|
26
94
|
const POINTER_GAP_PX = 10;
|
|
27
95
|
// A fingertip covers roughly 40 CSS px, so a touch-opened panel has to clear the tap
|
|
@@ -32,28 +100,23 @@ const TOUCH_GAP_PX = 48;
|
|
|
32
100
|
// past what the margin leaves is one push cannot fit.
|
|
33
101
|
const VIEWPORT_MARGIN_PX = 12;
|
|
34
102
|
// Four fallbacks are what make the panel flip out of a small dashboard card rather than be
|
|
35
|
-
// clipped by it. Above first,
|
|
36
|
-
|
|
37
|
-
// panel is portaled to the body, so no z-index can lift the control over it — an app layout that
|
|
38
|
-
// isolates its own stacking context traps the chart's chrome below the overlay whatever number it
|
|
39
|
-
// carries.
|
|
40
|
-
function positionsFor(gap, preferBelow) {
|
|
41
|
-
const above = {
|
|
42
|
-
originX: 'center',
|
|
43
|
-
originY: 'top',
|
|
44
|
-
overlayX: 'center',
|
|
45
|
-
overlayY: 'bottom',
|
|
46
|
-
offsetY: -gap,
|
|
47
|
-
};
|
|
48
|
-
const below = {
|
|
49
|
-
originX: 'center',
|
|
50
|
-
originY: 'bottom',
|
|
51
|
-
overlayX: 'center',
|
|
52
|
-
overlayY: 'top',
|
|
53
|
-
offsetY: gap,
|
|
54
|
-
};
|
|
103
|
+
// clipped by it. Above first, held or not: the panel opens over the mark it is about.
|
|
104
|
+
function positionsFor(gap) {
|
|
55
105
|
return [
|
|
56
|
-
|
|
106
|
+
{
|
|
107
|
+
originX: 'center',
|
|
108
|
+
originY: 'top',
|
|
109
|
+
overlayX: 'center',
|
|
110
|
+
overlayY: 'bottom',
|
|
111
|
+
offsetY: -gap,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
originX: 'center',
|
|
115
|
+
originY: 'bottom',
|
|
116
|
+
overlayX: 'center',
|
|
117
|
+
overlayY: 'top',
|
|
118
|
+
offsetY: gap,
|
|
119
|
+
},
|
|
57
120
|
{
|
|
58
121
|
originX: 'end',
|
|
59
122
|
originY: 'center',
|
|
@@ -88,9 +151,6 @@ class ChartTooltipDirective {
|
|
|
88
151
|
* that text as well as the mark, or the two overlap. Ignored for touch, where the gap is already
|
|
89
152
|
* sized for a fingertip. */
|
|
90
153
|
dsChartTooltipExtraGap = input(0, ...(ngDevMode ? [{ debugName: "dsChartTooltipExtraGap" }] : /* istanbul ignore next */ []));
|
|
91
|
-
/** Opens the panel BELOW the mark first. A chart sets it while a mark is held, so the panel
|
|
92
|
-
* leaves the plot's top edge — and the Unpin control that lives there — alone. */
|
|
93
|
-
dsChartTooltipPreferBelow = input(false, ...(ngDevMode ? [{ debugName: "dsChartTooltipPreferBelow" }] : /* istanbul ignore next */ []));
|
|
94
154
|
/** A held panel takes the pointer again, so its text can be selected. While it merely follows
|
|
95
155
|
* the pointer the pane stays inert, or the mark it covers never sees the pointer at all. */
|
|
96
156
|
dsChartTooltipPinned = input(false, ...(ngDevMode ? [{ debugName: "dsChartTooltipPinned" }] : /* istanbul ignore next */ []));
|
|
@@ -144,7 +204,7 @@ class ChartTooltipDirective {
|
|
|
144
204
|
.withFlexibleDimensions(false)
|
|
145
205
|
.withPush(true)
|
|
146
206
|
.withViewportMargin(VIEWPORT_MARGIN_PX)
|
|
147
|
-
.withPositions(positionsFor(gap
|
|
207
|
+
.withPositions(positionsFor(gap));
|
|
148
208
|
}
|
|
149
209
|
// WCAG 1.4.13 wants the panel dismissable WITHOUT moving the pointer or the focus, which rules
|
|
150
210
|
// out "move off the mark". Nothing re-opens it afterwards: the effect re-runs on a CHANGE to the
|
|
@@ -175,7 +235,7 @@ class ChartTooltipDirective {
|
|
|
175
235
|
this.panelRef = null;
|
|
176
236
|
}
|
|
177
237
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
178
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: ChartTooltipDirective, isStandalone: true, selector: "[dsChartTooltip]", inputs: { dsChartTooltip: { classPropertyName: "dsChartTooltip", publicName: "dsChartTooltip", isSignal: true, isRequired: false, transformFunction: null }, dsChartTooltipOrigin: { classPropertyName: "dsChartTooltipOrigin", publicName: "dsChartTooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, dsChartTooltipTemplate: { classPropertyName: "dsChartTooltipTemplate", publicName: "dsChartTooltipTemplate", isSignal: true, isRequired: false, transformFunction: null }, dsChartTooltipExtraGap: { classPropertyName: "dsChartTooltipExtraGap", publicName: "dsChartTooltipExtraGap", isSignal: true, isRequired: false, transformFunction: null },
|
|
238
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: ChartTooltipDirective, isStandalone: true, selector: "[dsChartTooltip]", inputs: { dsChartTooltip: { classPropertyName: "dsChartTooltip", publicName: "dsChartTooltip", isSignal: true, isRequired: false, transformFunction: null }, dsChartTooltipOrigin: { classPropertyName: "dsChartTooltipOrigin", publicName: "dsChartTooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, dsChartTooltipTemplate: { classPropertyName: "dsChartTooltipTemplate", publicName: "dsChartTooltipTemplate", isSignal: true, isRequired: false, transformFunction: null }, dsChartTooltipExtraGap: { classPropertyName: "dsChartTooltipExtraGap", publicName: "dsChartTooltipExtraGap", isSignal: true, isRequired: false, transformFunction: null }, dsChartTooltipPinned: { classPropertyName: "dsChartTooltipPinned", publicName: "dsChartTooltipPinned", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
179
239
|
}
|
|
180
240
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipDirective, decorators: [{
|
|
181
241
|
type: Directive,
|
|
@@ -183,7 +243,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
183
243
|
selector: '[dsChartTooltip]',
|
|
184
244
|
standalone: true,
|
|
185
245
|
}]
|
|
186
|
-
}], ctorParameters: () => [], propDecorators: { dsChartTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltip", required: false }] }], dsChartTooltipOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltipOrigin", required: false }] }], dsChartTooltipTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltipTemplate", required: false }] }], dsChartTooltipExtraGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltipExtraGap", required: false }] }],
|
|
246
|
+
}], ctorParameters: () => [], propDecorators: { dsChartTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltip", required: false }] }], dsChartTooltipOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltipOrigin", required: false }] }], dsChartTooltipTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltipTemplate", required: false }] }], dsChartTooltipExtraGap: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltipExtraGap", required: false }] }], dsChartTooltipPinned: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsChartTooltipPinned", required: false }] }] } });
|
|
187
247
|
function coarsePointer() {
|
|
188
248
|
return (typeof window !== 'undefined' &&
|
|
189
249
|
window.matchMedia('(pointer: coarse)').matches);
|
|
@@ -194,26 +254,34 @@ function coarsePointer() {
|
|
|
194
254
|
* Pointer and keyboard write the same pair, so a chart wires `pointerenter` and `focus` to
|
|
195
255
|
* `enter` and gets one code path rather than two.
|
|
196
256
|
*
|
|
257
|
+
* A POINTER WAITS. It is answered once it has rested on a mark for `hoverDelayMs`, and at once
|
|
258
|
+
* while the chart has already answered it; focus, a tap and a pin are answered at once.
|
|
259
|
+
*
|
|
197
260
|
* A TAP LATCHES. A touch fires `pointerleave` the moment the finger lifts, so without this the
|
|
198
261
|
* panel would flash and vanish; latched, it stays until the next tap lands outside the mark. Call
|
|
199
262
|
* from an injection context — the release listener is torn down with the component.
|
|
200
263
|
*
|
|
201
264
|
* @internal
|
|
202
265
|
*/
|
|
203
|
-
function chartActiveMark(lingerMs = () => 0) {
|
|
266
|
+
function chartActiveMark(lingerMs = () => 0, hoverDelayMs = () => 0) {
|
|
204
267
|
const index = signal(-1, ...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
205
268
|
const origin = signal(null, ...(ngDevMode ? [{ debugName: "origin" }] : /* istanbul ignore next */ []));
|
|
206
269
|
// One flag for two ways of arriving at the same state: a tap, which has no hover to hold the
|
|
207
270
|
// panel open, and a deliberate click under `pinOnClick`. Both release the same way.
|
|
208
271
|
const pinned = signal(false, ...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
272
|
+
// A tap latches on its pointer event and the browser then clicks the same mark; that click belongs
|
|
273
|
+
// to the tap, and must not read as the second press that lets go.
|
|
274
|
+
let tapLatched = false;
|
|
209
275
|
let pendingClear = null;
|
|
210
276
|
// The element that OWNS the handlers, which is not always the tooltip anchor: a column anchors
|
|
211
277
|
// its panel to the bar while the whole cell answers the pointer. A press is "outside" only when
|
|
212
278
|
// it misses this, or a click on the cell beside the bar would release the pin and immediately
|
|
213
279
|
// re-take it, leaving the pin looking stuck.
|
|
214
280
|
let host = null;
|
|
281
|
+
const dwell = chartDwell(hoverDelayMs);
|
|
215
282
|
const clear = () => {
|
|
216
283
|
pinned.set(false);
|
|
284
|
+
tapLatched = false;
|
|
217
285
|
host = null;
|
|
218
286
|
cancelPendingClear();
|
|
219
287
|
index.set(-1);
|
|
@@ -310,6 +378,7 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
310
378
|
};
|
|
311
379
|
if (typeof document !== 'undefined') {
|
|
312
380
|
inject(DestroyRef).onDestroy(() => {
|
|
381
|
+
dwell.cancel();
|
|
313
382
|
cancelPendingClear();
|
|
314
383
|
document.removeEventListener('pointerdown', release, true);
|
|
315
384
|
document.removeEventListener('keydown', releaseOnEscape, true);
|
|
@@ -327,36 +396,33 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
327
396
|
if (pinned()) {
|
|
328
397
|
return;
|
|
329
398
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
document.addEventListener('pointerover', trackPointer, true);
|
|
334
|
-
}
|
|
335
|
-
if (typeof document !== 'undefined' &&
|
|
336
|
-
event instanceof PointerEvent &&
|
|
337
|
-
event.pointerType === 'touch') {
|
|
338
|
-
hold();
|
|
339
|
-
}
|
|
399
|
+
// Taken now: `currentTarget` is gone by the time a delayed answer runs.
|
|
400
|
+
const target = mark ?? event.currentTarget;
|
|
401
|
+
dwell.schedule(at, () => answer(at, event, anchor, target), event);
|
|
340
402
|
},
|
|
341
403
|
setIndex(at) {
|
|
342
404
|
if (pinned()) {
|
|
343
405
|
return;
|
|
344
406
|
}
|
|
407
|
+
dwell.cancel();
|
|
345
408
|
cancelPendingClear();
|
|
346
409
|
index.set(at);
|
|
347
410
|
},
|
|
348
411
|
leave() {
|
|
412
|
+
dwell.cancel();
|
|
349
413
|
if (pinned()) {
|
|
350
414
|
return;
|
|
351
415
|
}
|
|
352
416
|
scheduleClear();
|
|
353
417
|
},
|
|
354
418
|
release() {
|
|
419
|
+
dwell.cancel();
|
|
355
420
|
if (typeof document !== 'undefined') {
|
|
356
421
|
clear();
|
|
357
422
|
}
|
|
358
423
|
},
|
|
359
424
|
pin(at, event, anchor, mark) {
|
|
425
|
+
dwell.cancel();
|
|
360
426
|
if (typeof document === 'undefined') {
|
|
361
427
|
return;
|
|
362
428
|
}
|
|
@@ -364,9 +430,14 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
364
430
|
// through `release` by the time the click lands, so this only ever sees a fresh mark or the
|
|
365
431
|
// pinned one.
|
|
366
432
|
if (pinned() && index() === at) {
|
|
433
|
+
if (tapLatched) {
|
|
434
|
+
tapLatched = false;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
367
437
|
clear();
|
|
368
438
|
return;
|
|
369
439
|
}
|
|
440
|
+
tapLatched = false;
|
|
370
441
|
// Re-aiming while already pinned keeps `pinned` true throughout, so nothing that renders on
|
|
371
442
|
// it — the Unpin control, the held mark's styling — unmounts between the two marks.
|
|
372
443
|
aim(at, event, anchor, mark);
|
|
@@ -375,11 +446,94 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
375
446
|
}
|
|
376
447
|
},
|
|
377
448
|
};
|
|
449
|
+
function answer(at, event, anchor, target) {
|
|
450
|
+
if (pinned()) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
aim(at, event, anchor, target);
|
|
454
|
+
cancelPendingClear();
|
|
455
|
+
if (typeof document !== 'undefined') {
|
|
456
|
+
document.addEventListener('pointerover', trackPointer, true);
|
|
457
|
+
}
|
|
458
|
+
if (typeof document !== 'undefined' &&
|
|
459
|
+
event instanceof PointerEvent &&
|
|
460
|
+
event.pointerType === 'touch') {
|
|
461
|
+
hold();
|
|
462
|
+
tapLatched = true;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
378
465
|
}
|
|
379
466
|
|
|
467
|
+
/** Radius of the pin disc, in plot pixels. A mark that places a disc inside itself keeps this
|
|
468
|
+
* much room from its edge.
|
|
469
|
+
*
|
|
470
|
+
* @internal */
|
|
471
|
+
const CHART_PIN_RADIUS = 11;
|
|
472
|
+
/** How far a disc sits inside the top edge of what it holds. At one radius it sits flush against
|
|
473
|
+
* the edge and reads as part of the mark rather than as a badge on it.
|
|
474
|
+
*
|
|
475
|
+
* @internal */
|
|
476
|
+
const CHART_PIN_GAP = 4;
|
|
477
|
+
const GLYPH_SIZE = 14;
|
|
478
|
+
/**
|
|
479
|
+
* The disc an SVG chart draws on the mark or category it holds. Drawn rather than composed:
|
|
480
|
+
* `ds-icon`'s host is an HTML element, and an element the SVG specification does not know renders
|
|
481
|
+
* nothing inside a canvas. The opaque disc is what keeps the glyph legible on any series colour.
|
|
482
|
+
* Centred on the host's origin; place it with a `transform`.
|
|
483
|
+
*
|
|
484
|
+
* @internal
|
|
485
|
+
*/
|
|
486
|
+
class ChartPinMarkerComponent {
|
|
487
|
+
radius = CHART_PIN_RADIUS;
|
|
488
|
+
glyphSize = GLYPH_SIZE;
|
|
489
|
+
glyphOffset = -GLYPH_SIZE / 2;
|
|
490
|
+
glyph = inject(DomSanitizer).bypassSecurityTrustHtml(ICONS.pin);
|
|
491
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartPinMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
492
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.22", type: ChartPinMarkerComponent, isStandalone: true, selector: "g[dsChartPinMarker]", host: { attributes: { "aria-hidden": "true" }, classAttribute: "pin-marker" }, ngImport: i0, template: `
|
|
493
|
+
<svg:circle class="pin-disc" [attr.r]="radius" />
|
|
494
|
+
|
|
495
|
+
<svg:svg
|
|
496
|
+
class="pin-glyph"
|
|
497
|
+
viewBox="0 0 24 24"
|
|
498
|
+
fill="none"
|
|
499
|
+
stroke="currentColor"
|
|
500
|
+
stroke-width="1.75"
|
|
501
|
+
stroke-linecap="round"
|
|
502
|
+
stroke-linejoin="round"
|
|
503
|
+
[attr.x]="glyphOffset"
|
|
504
|
+
[attr.y]="glyphOffset"
|
|
505
|
+
[attr.width]="glyphSize"
|
|
506
|
+
[attr.height]="glyphSize"
|
|
507
|
+
[innerHTML]="glyph" />
|
|
508
|
+
`, isInline: true, styles: [":host{pointer-events:none}.pin-disc{fill:var(--surface-default);stroke:var(--border-divider);stroke-width:var(--border-width-default)}.pin-glyph{color:var(--text-primary)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
509
|
+
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartPinMarkerComponent, decorators: [{
|
|
511
|
+
type: Component,
|
|
512
|
+
args: [{ selector: 'g[dsChartPinMarker]', standalone: true, template: `
|
|
513
|
+
<svg:circle class="pin-disc" [attr.r]="radius" />
|
|
514
|
+
|
|
515
|
+
<svg:svg
|
|
516
|
+
class="pin-glyph"
|
|
517
|
+
viewBox="0 0 24 24"
|
|
518
|
+
fill="none"
|
|
519
|
+
stroke="currentColor"
|
|
520
|
+
stroke-width="1.75"
|
|
521
|
+
stroke-linecap="round"
|
|
522
|
+
stroke-linejoin="round"
|
|
523
|
+
[attr.x]="glyphOffset"
|
|
524
|
+
[attr.y]="glyphOffset"
|
|
525
|
+
[attr.width]="glyphSize"
|
|
526
|
+
[attr.height]="glyphSize"
|
|
527
|
+
[innerHTML]="glyph" />
|
|
528
|
+
`, host: {
|
|
529
|
+
class: 'pin-marker',
|
|
530
|
+
'aria-hidden': 'true',
|
|
531
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{pointer-events:none}.pin-disc{fill:var(--surface-default);stroke:var(--border-divider);stroke-width:var(--border-width-default)}.pin-glyph{color:var(--text-primary)}\n"] }]
|
|
532
|
+
}] });
|
|
533
|
+
|
|
380
534
|
/**
|
|
381
535
|
* Generated bundle index. Do not edit.
|
|
382
536
|
*/
|
|
383
537
|
|
|
384
|
-
export { ChartTooltipDirective, chartActiveMark };
|
|
538
|
+
export { CHART_PIN_GAP, CHART_PIN_RADIUS, ChartPinMarkerComponent, ChartTooltipDirective, chartActiveMark };
|
|
385
539
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-chart-tooltip.mjs","sources":["../../../src/lib/components/chart-tooltip/chart-tooltip-panel.component.ts","../../../src/lib/components/chart-tooltip/chart-tooltip-panel.component.html","../../../src/lib/components/chart-tooltip/chart-tooltip.directive.ts","../../../src/lib/components/chart-tooltip/chart-active-mark.ts","../../../src/lib/components/chart-tooltip/ids-group-ltd-ids-design-system-components-chart-tooltip.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n TemplateRef,\n ViewEncapsulation,\n input,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport type { ChartTooltipContext } from './chart-tooltip.types';\n\n@Component({\n selector: 'ds-chart-tooltip-panel',\n standalone: true,\n imports: [NgTemplateOutlet],\n templateUrl: './chart-tooltip-panel.component.html',\n styleUrl: './chart-tooltip-panel.component.scss',\n host: {\n // Hidden from assistive technology on purpose: every interactive mark already\n // carries the same label and value in its `aria-label`, so exposing the panel\n // makes a screen reader read each reading twice.\n 'aria-hidden': 'true',\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChartTooltipPanelComponent {\n /** The category and the readings the panel prints. */\n readonly context = input.required<ChartTooltipContext>();\n /** The chart's projected `#dsChartTooltip` template. Null renders the built-in rows. */\n readonly template = input<TemplateRef<{\n $implicit: ChartTooltipContext;\n }> | null>(null);\n}\n","@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n","import {\n ComponentRef,\n DestroyRef,\n Directive,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n input,\n} from '@angular/core';\nimport {\n ConnectedPosition,\n Overlay,\n OverlayRef,\n type FlexibleConnectedPositionStrategyOrigin,\n} from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n closeOnScroll,\n disposeWithLeave,\n} from '@ids-group-ltd/ids-design-system/components';\nimport { ChartTooltipPanelComponent } from './chart-tooltip-panel.component';\nimport type {\n ChartTooltipContext,\n ChartTooltipOrigin,\n} from './chart-tooltip.types';\n\nconst POINTER_GAP_PX = 10;\n// A fingertip covers roughly 40 CSS px, so a touch-opened panel has to clear the tap\n// point by more than a pointer-opened one does.\nconst TOUCH_GAP_PX = 48;\n\n// Keeps the panel off the screen edge, and matches the `--space-3` the panel reserves in its own\n// `max-height`. The two have to agree: CDK pushes against this margin, and a panel allowed to grow\n// past what the margin leaves is one push cannot fit.\nconst VIEWPORT_MARGIN_PX = 12;\n\n// Four fallbacks are what make the panel flip out of a small dashboard card rather than be\n// clipped by it. Above first, except while a mark is HELD: the Unpin control sits at the plot's\n// top edge, and a panel that opens upward from a mark in the upper half lands on top of it. The\n// panel is portaled to the body, so no z-index can lift the control over it — an app layout that\n// isolates its own stacking context traps the chart's chrome below the overlay whatever number it\n// carries.\nfunction positionsFor(gap: number, preferBelow: boolean): ConnectedPosition[] {\n const above: ConnectedPosition = {\n originX: 'center',\n originY: 'top',\n overlayX: 'center',\n overlayY: 'bottom',\n offsetY: -gap,\n };\n const below: ConnectedPosition = {\n originX: 'center',\n originY: 'bottom',\n overlayX: 'center',\n overlayY: 'top',\n offsetY: gap,\n };\n\n return [\n ...(preferBelow ? [below, above] : [above, below]),\n {\n originX: 'end',\n originY: 'center',\n overlayX: 'start',\n overlayY: 'center',\n offsetX: gap,\n },\n {\n originX: 'start',\n originY: 'center',\n overlayX: 'end',\n overlayY: 'center',\n offsetX: -gap,\n },\n ];\n}\n\n/**\n * The chart tooltip, driven entirely by the context a chart hands it: non-null opens the\n * panel, null closes it. Pointer and keyboard therefore share one path — a chart that\n * sets the context on `focus` gets the panel with no pointer involved.\n *\n * @internal\n */\n@Directive({\n selector: '[dsChartTooltip]',\n standalone: true,\n})\nexport class ChartTooltipDirective {\n private readonly overlay = inject(Overlay);\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n readonly dsChartTooltip = input<ChartTooltipContext | null>(null);\n readonly dsChartTooltipOrigin = input<ChartTooltipOrigin | null>(null);\n readonly dsChartTooltipTemplate = input<TemplateRef<{\n $implicit: ChartTooltipContext;\n }> | null>(null);\n\n /** Extra clearance between the mark and the panel, on top of the pointer default. A chart that\n * prints something ABOVE its mark — a column with its value on top — needs the panel to clear\n * that text as well as the mark, or the two overlap. Ignored for touch, where the gap is already\n * sized for a fingertip. */\n readonly dsChartTooltipExtraGap = input(0);\n /** Opens the panel BELOW the mark first. A chart sets it while a mark is held, so the panel\n * leaves the plot's top edge — and the Unpin control that lives there — alone. */\n readonly dsChartTooltipPreferBelow = input(false);\n\n /** A held panel takes the pointer again, so its text can be selected. While it merely follows\n * the pointer the pane stays inert, or the mark it covers never sees the pointer at all. */\n readonly dsChartTooltipPinned = input(false);\n\n private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<ChartTooltipPanelComponent> | null = null;\n private detachScrollReposition: (() => void) | null = null;\n private detachEscape: (() => void) | null = null;\n\n constructor() {\n effect(() => {\n const context = this.dsChartTooltip();\n const origin = this.dsChartTooltipOrigin();\n if (!context?.entries.length || !origin) {\n this.close();\n\n return;\n }\n this.open(context, origin);\n });\n inject(DestroyRef).onDestroy(() => this.close());\n }\n\n private open(context: ChartTooltipContext, origin: ChartTooltipOrigin): void {\n // Reposition rather than re-create while the pointer moves between marks: a fresh\n // OverlayRef per mark restarts the enter transition on every band it crosses.\n if (!this.overlayRef) {\n this.overlayRef = this.overlay.create({\n positionStrategy: this.strategyFor(origin),\n panelClass: ['ds-overlay-pane', 'ds-chart-tooltip-pane'],\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n });\n this.panelRef = this.overlayRef.attach(\n new ComponentPortal(ChartTooltipPanelComponent, this.viewContainerRef),\n );\n // CDK's reposition strategy watches `window` and registered `cdkScrollable`s only, so it\n // misses an app's own `overflow: auto` container. Moved rather than closed: a PINNED mark\n // stops answering pointer moves, so a close here would be permanent, leaving the pin glyph\n // and the Unpin control standing over a reading that is gone.\n this.detachScrollReposition = closeOnScroll(this.overlayRef, () =>\n this.overlayRef?.updatePosition(),\n );\n this.detachEscape = this.closeOnEscape();\n } else {\n this.overlayRef.updatePositionStrategy(this.strategyFor(origin));\n }\n this.overlayRef.overlayElement.classList.toggle(\n 'is-pinned',\n this.dsChartTooltipPinned(),\n );\n this.panelRef?.setInput('context', context);\n this.panelRef?.setInput('template', this.dsChartTooltipTemplate());\n }\n\n private strategyFor(origin: ChartTooltipOrigin) {\n const gap = coarsePointer()\n ? TOUCH_GAP_PX\n : POINTER_GAP_PX + this.dsChartTooltipExtraGap();\n\n return this.overlay\n .position()\n .flexibleConnectedTo(origin as FlexibleConnectedPositionStrategyOrigin)\n .withFlexibleDimensions(false)\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN_PX)\n .withPositions(positionsFor(gap, this.dsChartTooltipPreferBelow()));\n }\n\n // WCAG 1.4.13 wants the panel dismissable WITHOUT moving the pointer or the focus, which rules\n // out \"move off the mark\". Nothing re-opens it afterwards: the effect re-runs on a CHANGE to the\n // context or the origin, and neither changes while the pointer rests where it already is — so the\n // reader keeps the screen they cleared until they visit another mark.\n private closeOnEscape(): () => void {\n if (typeof document === 'undefined') {\n return () => undefined;\n }\n const onKeydown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n this.close();\n }\n };\n document.addEventListener('keydown', onKeydown, true);\n\n return () => document.removeEventListener('keydown', onKeydown, true);\n }\n\n private close(): void {\n this.detachEscape?.();\n this.detachEscape = null;\n this.detachScrollReposition?.();\n this.detachScrollReposition = null;\n // A dismissal, never a selection: the panel closes when the reader leaves the plot, and the\n // family's answer to that is a fade. Moving between marks repositions this overlay rather than\n // closing it, so nothing here can lag behind the pointer.\n disposeWithLeave(this.overlayRef, 'dismiss');\n this.overlayRef = null;\n this.panelRef = null;\n }\n}\n\nfunction coarsePointer(): boolean {\n return (\n typeof window !== 'undefined' &&\n window.matchMedia('(pointer: coarse)').matches\n );\n}\n","import { DestroyRef, Signal, inject, signal } from '@angular/core';\n\n/** @internal */\nexport interface ChartActiveMark {\n /** Index of the mark under the pointer or holding focus; `-1` when none is. */\n readonly index: Signal<number>;\n /** The mark's own element, which is what the tooltip anchors to. */\n readonly origin: Signal<Element | null>;\n /** Whether the active mark is held rather than followed — a tap, or a click under `pinOnClick`. */\n readonly pinned: Signal<boolean>;\n /** `mark` is the hovered element, for a listener delegated to the marks' parent; it defaults to\n * the event's `currentTarget`. */\n enter(\n index: number,\n event: Event,\n anchor?: string | Element | null,\n mark?: Element,\n ): void;\n /** Moves the active index with no pointer behind it - a keyboard, or a mark handing over which\n * category it took focus on. Leaves the anchor alone: the caller that has no event has no\n * element to aim at either. A pin holds against this too. */\n setIndex(index: number): void;\n leave(): void;\n /** Holds the mark that was activated, for any pointer type. Activating the mark that is already\n * pinned releases it, so one gesture both sets and clears. */\n pin(\n index: number,\n event: Event,\n anchor?: string | Element | null,\n mark?: Element,\n ): void;\n /** Lets go of a held mark, for a control that offers the way out in as many words. */\n release(): void;\n}\n\n/**\n * The pointer-and-focus target the tooltip reads, for a chart whose marks are elements.\n * Pointer and keyboard write the same pair, so a chart wires `pointerenter` and `focus` to\n * `enter` and gets one code path rather than two.\n *\n * A TAP LATCHES. A touch fires `pointerleave` the moment the finger lifts, so without this the\n * panel would flash and vanish; latched, it stays until the next tap lands outside the mark. Call\n * from an injection context — the release listener is torn down with the component.\n *\n * @internal\n */\nexport function chartActiveMark(\n lingerMs: () => number = () => 0,\n): ChartActiveMark {\n const index = signal(-1);\n const origin = signal<Element | null>(null);\n // One flag for two ways of arriving at the same state: a tap, which has no hover to hold the\n // panel open, and a deliberate click under `pinOnClick`. Both release the same way.\n const pinned = signal(false);\n let pendingClear: ReturnType<typeof setTimeout> | null = null;\n // The element that OWNS the handlers, which is not always the tooltip anchor: a column anchors\n // its panel to the bar while the whole cell answers the pointer. A press is \"outside\" only when\n // it misses this, or a click on the cell beside the bar would release the pin and immediately\n // re-take it, leaving the pin looking stuck.\n let host: Element | null = null;\n\n const clear = (): void => {\n pinned.set(false);\n host = null;\n cancelPendingClear();\n index.set(-1);\n origin.set(null);\n document.removeEventListener('pointerdown', release, true);\n document.removeEventListener('keydown', releaseOnEscape, true);\n document.removeEventListener('pointerover', trackPointer, true);\n };\n\n // The tooltip anchors to the MARK, not to the box that catches the pointer: a column's cell is\n // the full plot height, so anchoring to it opens the panel at the top of the chart rather than\n // over the column it is about. A selector is resolved INSIDE the box; a legend item's mark is not\n // inside it, so that caller passes the element.\n const aim = (\n at: number,\n event: Event,\n anchor?: string | Element | null,\n mark: EventTarget | null = event.currentTarget,\n ): void => {\n const target = mark;\n if (target instanceof Element) {\n host = target;\n const mark =\n typeof anchor === 'string' ? target.querySelector(anchor) : anchor;\n // A mark drawn from a zero value is degenerate in one axis - a column loses its height, a\n // bar its width - and an overlay anchored to it lands at that edge rather than near the\n // reading. Both dimensions have to be real. The hover target always is.\n const box = mark?.getBoundingClientRect();\n const aimable = box && box.width > 0 && box.height > 0;\n origin.set(aimable ? (mark ?? target) : target);\n }\n index.set(at);\n };\n\n const hold = (): void => {\n pinned.set(true);\n cancelPendingClear();\n document.addEventListener('pointerdown', release, true);\n document.addEventListener('keydown', releaseOnEscape, true);\n };\n\n // Escape releases the mark as well as the panel. Without this the panel would go and the dimming\n // it caused would stay, leaving the chart in a state with nothing on screen explaining it.\n const releaseOnEscape = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n clear();\n }\n };\n\n const cancelPendingClear = (): void => {\n if (pendingClear !== null) {\n clearTimeout(pendingClear);\n pendingClear = null;\n }\n };\n\n const scheduleClear = (): void => {\n cancelPendingClear();\n pendingClear = setTimeout(\n () => {\n pendingClear = null;\n index.set(-1);\n origin.set(null);\n document.removeEventListener('pointerover', trackPointer, true);\n },\n Math.max(lingerMs(), 0),\n );\n };\n\n // One listener answers both halves of \"is the pointer on the panel\": `pointerover` fires on every\n // element the pointer crosses, so arriving on the panel cancels the clear and leaving it for\n // anything that is not the mark schedules a new one. Without the second half a panel the pointer\n // once touched would never close, because the mark's own `pointerleave` has already fired.\n const trackPointer = (event: PointerEvent): void => {\n if (!(event.target instanceof Element)) {\n return;\n }\n if (pinned() || event.target.closest('.ds-chart-tooltip-pane')) {\n cancelPendingClear();\n\n return;\n }\n // Against the HOST, not the anchor: a legend item and the arc its panel points at are disjoint\n // elements, so testing the anchor would clear the panel the moment the pointer moved inside the\n // legend item that opened it.\n if (!host || !host.contains(event.target)) {\n scheduleClear();\n }\n };\n\n // The chart the aimed mark belongs to. Every chart puts its plot in one `<figure>`, so this is\n // what tells \"pressed another mark of the same chart\" apart from \"pressed away\".\n const chartOf = (element: Element | null): Element | null =>\n element ? element.closest('figure') : null;\n\n const release = (event: PointerEvent): void => {\n if (!(event.target instanceof Element)) {\n clear();\n\n return;\n }\n if (host && host.contains(event.target)) {\n return;\n }\n // Hopping the pin from one mark to the next must not pass through \"nothing is pinned\". This\n // handler runs on `pointerdown`, the re-aim on the `click` after it, so clearing here would\n // unmount the Unpin control and the pinned styling for a frame and mount them again — a\n // flicker on every hop. The press is a re-aim when it lands on another mark of the same chart.\n const pressedMark = event.target.closest('[data-mark-index]');\n if (pressedMark && chartOf(pressedMark) === chartOf(host)) {\n return;\n }\n clear();\n };\n\n if (typeof document !== 'undefined') {\n inject(DestroyRef).onDestroy(() => {\n cancelPendingClear();\n document.removeEventListener('pointerdown', release, true);\n document.removeEventListener('keydown', releaseOnEscape, true);\n document.removeEventListener('pointerover', trackPointer, true);\n });\n }\n\n return {\n index: index.asReadonly(),\n origin: origin.asReadonly(),\n pinned: pinned.asReadonly(),\n enter(at, event, anchor, mark) {\n // A pin HOLDS. Without this the next mark the pointer crossed took the active slot straight\n // back, so pinning appeared to work and then followed the pointer anyway — the one thing a\n // pin exists not to do. It is released by Escape, or by a press outside the pinned mark.\n if (pinned()) {\n return;\n }\n aim(at, event, anchor, mark);\n cancelPendingClear();\n if (typeof document !== 'undefined') {\n document.addEventListener('pointerover', trackPointer, true);\n }\n if (\n typeof document !== 'undefined' &&\n event instanceof PointerEvent &&\n event.pointerType === 'touch'\n ) {\n hold();\n }\n },\n setIndex(at) {\n if (pinned()) {\n return;\n }\n cancelPendingClear();\n index.set(at);\n },\n leave() {\n if (pinned()) {\n return;\n }\n scheduleClear();\n },\n release() {\n if (typeof document !== 'undefined') {\n clear();\n }\n },\n pin(at, event, anchor, mark) {\n if (typeof document === 'undefined') {\n return;\n }\n // The same gesture that set the pin clears it. A press on a DIFFERENT mark has already gone\n // through `release` by the time the click lands, so this only ever sees a fresh mark or the\n // pinned one.\n if (pinned() && index() === at) {\n clear();\n\n return;\n }\n // Re-aiming while already pinned keeps `pinned` true throughout, so nothing that renders on\n // it — the Unpin control, the held mark's styling — unmounts between the two marks.\n aim(at, event, anchor, mark);\n if (!pinned()) {\n hold();\n }\n },\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAyBa,0BAA0B,CAAA;;AAE5B,IAAA,OAAO,GAAG,KAAK,CAAC,QAAQ,6EAAuB;;AAE/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AAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC;AAC5B,YAAA,kBAAkB,EAAE;AACpB,YAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;gBACnC,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,YAAY,EAAE,IAAI,CAAC;YAC9D;YACA,IACE,OAAO,QAAQ,KAAK,WAAW;AAC/B,gBAAA,KAAK,YAAY,YAAY;AAC7B,gBAAA,KAAK,CAAC,WAAW,KAAK,OAAO,EAC7B;AACA,gBAAA,IAAI,EAAE;YACR;QACF,CAAC;AACD,QAAA,QAAQ,CAAC,EAAE,EAAA;YACT,IAAI,MAAM,EAAE,EAAE;gBACZ;YACF;AACA,YAAA,kBAAkB,EAAE;AACpB,YAAA,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACf,CAAC;QACD,KAAK,GAAA;YACH,IAAI,MAAM,EAAE,EAAE;gBACZ;YACF;AACA,YAAA,aAAa,EAAE;QACjB,CAAC;QACD,OAAO,GAAA;AACL,YAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AACnC,gBAAA,KAAK,EAAE;YACT;QACF,CAAC;AACD,QAAA,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAA;AACzB,YAAA,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;gBACnC;YACF;;;;YAIA,IAAI,MAAM,EAAE,IAAI,KAAK,EAAE,KAAK,EAAE,EAAE;AAC9B,gBAAA,KAAK,EAAE;gBAEP;YACF;;;YAGA,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC;AAC5B,YAAA,IAAI,CAAC,MAAM,EAAE,EAAE;AACb,gBAAA,IAAI,EAAE;YACR;QACF,CAAC;KACF;AACH;;ACzPA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-chart-tooltip.mjs","sources":["../../../src/lib/components/chart-tooltip/swatch-contrast.ts","../../../src/lib/components/chart-tooltip/chart-tooltip-panel.component.ts","../../../src/lib/components/chart-tooltip/chart-tooltip-panel.component.html","../../../src/lib/components/chart-tooltip/chart-tooltip.directive.ts","../../../src/lib/components/chart-tooltip/chart-active-mark.ts","../../../src/lib/components/chart-tooltip/chart-pin-marker.component.ts","../../../src/lib/components/chart-tooltip/ids-group-ltd-ids-design-system-components-chart-tooltip.ts"],"sourcesContent":["// WCAG 1.4.11: a graphical object needs 3:1 against what it sits on to be seen.\nconst NON_TEXT_CONTRAST = 3;\n\nlet probe: CanvasRenderingContext2D | null = null;\nconst blendsByPair = new Map<string, boolean>();\n\n// Painting the colour and reading the pixel back resolves any CSS colour syntax to sRGB -\n// `oklch()`, `color-mix()` and named colours included - where parsing the string would not.\nfunction srgbOf(color: string): readonly [number, number, number] {\n if (!probe) {\n const canvas = document.createElement('canvas');\n canvas.width = 1;\n canvas.height = 1;\n probe = canvas.getContext('2d', { willReadFrequently: true });\n }\n if (!probe) {\n return [0, 0, 0];\n }\n probe.clearRect(0, 0, 1, 1);\n probe.fillStyle = color;\n probe.fillRect(0, 0, 1, 1);\n const [red, green, blue] = probe.getImageData(0, 0, 1, 1).data;\n\n return [red, green, blue];\n}\n\nfunction relativeLuminance([red, green, blue]: readonly [\n number,\n number,\n number,\n]): number {\n const linear = (channel: number): number => {\n const value = channel / 255;\n\n return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;\n };\n\n return 0.2126 * linear(red) + 0.7152 * linear(green) + 0.0722 * linear(blue);\n}\n\n/** Whether a swatch of `color` sits on `ground` below the non-text contrast a graphical object\n * needs, and so has to be ringed to be seen. Both are computed CSS colours. */\nexport function swatchBlendsInto(color: string, ground: string): boolean {\n const pair = `${color}|${ground}`;\n const known = blendsByPair.get(pair);\n if (known !== undefined) {\n return known;\n }\n const swatchLuminance = relativeLuminance(srgbOf(color));\n const groundLuminance = relativeLuminance(srgbOf(ground));\n const ratio =\n (Math.max(swatchLuminance, groundLuminance) + 0.05) /\n (Math.min(swatchLuminance, groundLuminance) + 0.05);\n const blends = ratio < NON_TEXT_CONTRAST;\n blendsByPair.set(pair, blends);\n\n return blends;\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n inject,\n input,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport type { ChartTooltipContext } from './chart-tooltip.types';\nimport { swatchBlendsInto } from './swatch-contrast';\n\n@Component({\n selector: 'ds-chart-tooltip-panel',\n standalone: true,\n imports: [NgTemplateOutlet],\n templateUrl: './chart-tooltip-panel.component.html',\n styleUrl: './chart-tooltip-panel.component.scss',\n host: {\n // Hidden from assistive technology on purpose: every interactive mark already\n // carries the same label and value in its `aria-label`, so exposing the panel\n // makes a screen reader read each reading twice.\n 'aria-hidden': 'true',\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChartTooltipPanelComponent {\n /** The category and the readings the panel prints. */\n readonly context = input.required<ChartTooltipContext>();\n /** The chart's projected `#dsChartTooltip` template. Null renders the built-in rows. */\n readonly template = input<TemplateRef<{\n $implicit: ChartTooltipContext;\n }> | null>(null);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n constructor() {\n // Before the frame paints, so a ring never lands a frame after its row.\n afterRenderEffect({\n earlyRead: () => {\n this.context();\n const host = this.host.nativeElement;\n const ground = getComputedStyle(host).backgroundColor;\n\n return [...host.querySelectorAll<HTMLElement>('.swatch')].map(\n (swatch) =>\n [\n swatch,\n swatchBlendsInto(\n getComputedStyle(swatch).backgroundColor,\n ground,\n ),\n ] as const,\n );\n },\n write: (swatches) => {\n for (const [swatch, blends] of swatches()) {\n swatch.classList.toggle('ringed', blends);\n }\n },\n });\n }\n}\n","@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n","import {\n ComponentRef,\n DestroyRef,\n Directive,\n TemplateRef,\n ViewContainerRef,\n effect,\n inject,\n input,\n} from '@angular/core';\nimport {\n ConnectedPosition,\n Overlay,\n OverlayRef,\n type FlexibleConnectedPositionStrategyOrigin,\n} from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport {\n closeOnScroll,\n disposeWithLeave,\n} from '@ids-group-ltd/ids-design-system/components';\nimport { ChartTooltipPanelComponent } from './chart-tooltip-panel.component';\nimport type {\n ChartTooltipContext,\n ChartTooltipOrigin,\n} from './chart-tooltip.types';\n\nconst POINTER_GAP_PX = 10;\n// A fingertip covers roughly 40 CSS px, so a touch-opened panel has to clear the tap\n// point by more than a pointer-opened one does.\nconst TOUCH_GAP_PX = 48;\n\n// Keeps the panel off the screen edge, and matches the `--space-3` the panel reserves in its own\n// `max-height`. The two have to agree: CDK pushes against this margin, and a panel allowed to grow\n// past what the margin leaves is one push cannot fit.\nconst VIEWPORT_MARGIN_PX = 12;\n\n// Four fallbacks are what make the panel flip out of a small dashboard card rather than be\n// clipped by it. Above first, held or not: the panel opens over the mark it is about.\nfunction positionsFor(gap: number): ConnectedPosition[] {\n return [\n {\n originX: 'center',\n originY: 'top',\n overlayX: 'center',\n overlayY: 'bottom',\n offsetY: -gap,\n },\n {\n originX: 'center',\n originY: 'bottom',\n overlayX: 'center',\n overlayY: 'top',\n offsetY: gap,\n },\n {\n originX: 'end',\n originY: 'center',\n overlayX: 'start',\n overlayY: 'center',\n offsetX: gap,\n },\n {\n originX: 'start',\n originY: 'center',\n overlayX: 'end',\n overlayY: 'center',\n offsetX: -gap,\n },\n ];\n}\n\n/**\n * The chart tooltip, driven entirely by the context a chart hands it: non-null opens the\n * panel, null closes it. Pointer and keyboard therefore share one path — a chart that\n * sets the context on `focus` gets the panel with no pointer involved.\n *\n * @internal\n */\n@Directive({\n selector: '[dsChartTooltip]',\n standalone: true,\n})\nexport class ChartTooltipDirective {\n private readonly overlay = inject(Overlay);\n private readonly viewContainerRef = inject(ViewContainerRef);\n\n readonly dsChartTooltip = input<ChartTooltipContext | null>(null);\n readonly dsChartTooltipOrigin = input<ChartTooltipOrigin | null>(null);\n readonly dsChartTooltipTemplate = input<TemplateRef<{\n $implicit: ChartTooltipContext;\n }> | null>(null);\n\n /** Extra clearance between the mark and the panel, on top of the pointer default. A chart that\n * prints something ABOVE its mark — a column with its value on top — needs the panel to clear\n * that text as well as the mark, or the two overlap. Ignored for touch, where the gap is already\n * sized for a fingertip. */\n readonly dsChartTooltipExtraGap = input(0);\n\n /** A held panel takes the pointer again, so its text can be selected. While it merely follows\n * the pointer the pane stays inert, or the mark it covers never sees the pointer at all. */\n readonly dsChartTooltipPinned = input(false);\n\n private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<ChartTooltipPanelComponent> | null = null;\n private detachScrollReposition: (() => void) | null = null;\n private detachEscape: (() => void) | null = null;\n\n constructor() {\n effect(() => {\n const context = this.dsChartTooltip();\n const origin = this.dsChartTooltipOrigin();\n if (!context?.entries.length || !origin) {\n this.close();\n\n return;\n }\n this.open(context, origin);\n });\n inject(DestroyRef).onDestroy(() => this.close());\n }\n\n private open(context: ChartTooltipContext, origin: ChartTooltipOrigin): void {\n // Reposition rather than re-create while the pointer moves between marks: a fresh\n // OverlayRef per mark restarts the enter transition on every band it crosses.\n if (!this.overlayRef) {\n this.overlayRef = this.overlay.create({\n positionStrategy: this.strategyFor(origin),\n panelClass: ['ds-overlay-pane', 'ds-chart-tooltip-pane'],\n scrollStrategy: this.overlay.scrollStrategies.reposition(),\n });\n this.panelRef = this.overlayRef.attach(\n new ComponentPortal(ChartTooltipPanelComponent, this.viewContainerRef),\n );\n // CDK's reposition strategy watches `window` and registered `cdkScrollable`s only, so it\n // misses an app's own `overflow: auto` container. Moved rather than closed: a PINNED mark\n // stops answering pointer moves, so a close here would be permanent, leaving the pin glyph\n // and the Unpin control standing over a reading that is gone.\n this.detachScrollReposition = closeOnScroll(this.overlayRef, () =>\n this.overlayRef?.updatePosition(),\n );\n this.detachEscape = this.closeOnEscape();\n } else {\n this.overlayRef.updatePositionStrategy(this.strategyFor(origin));\n }\n this.overlayRef.overlayElement.classList.toggle(\n 'is-pinned',\n this.dsChartTooltipPinned(),\n );\n this.panelRef?.setInput('context', context);\n this.panelRef?.setInput('template', this.dsChartTooltipTemplate());\n }\n\n private strategyFor(origin: ChartTooltipOrigin) {\n const gap = coarsePointer()\n ? TOUCH_GAP_PX\n : POINTER_GAP_PX + this.dsChartTooltipExtraGap();\n\n return this.overlay\n .position()\n .flexibleConnectedTo(origin as FlexibleConnectedPositionStrategyOrigin)\n .withFlexibleDimensions(false)\n .withPush(true)\n .withViewportMargin(VIEWPORT_MARGIN_PX)\n .withPositions(positionsFor(gap));\n }\n\n // WCAG 1.4.13 wants the panel dismissable WITHOUT moving the pointer or the focus, which rules\n // out \"move off the mark\". Nothing re-opens it afterwards: the effect re-runs on a CHANGE to the\n // context or the origin, and neither changes while the pointer rests where it already is — so the\n // reader keeps the screen they cleared until they visit another mark.\n private closeOnEscape(): () => void {\n if (typeof document === 'undefined') {\n return () => undefined;\n }\n const onKeydown = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n this.close();\n }\n };\n document.addEventListener('keydown', onKeydown, true);\n\n return () => document.removeEventListener('keydown', onKeydown, true);\n }\n\n private close(): void {\n this.detachEscape?.();\n this.detachEscape = null;\n this.detachScrollReposition?.();\n this.detachScrollReposition = null;\n // A dismissal, never a selection: the panel closes when the reader leaves the plot, and the\n // family's answer to that is a fade. Moving between marks repositions this overlay rather than\n // closing it, so nothing here can lag behind the pointer.\n disposeWithLeave(this.overlayRef, 'dismiss');\n this.overlayRef = null;\n this.panelRef = null;\n }\n}\n\nfunction coarsePointer(): boolean {\n return (\n typeof window !== 'undefined' &&\n window.matchMedia('(pointer: coarse)').matches\n );\n}\n","import { DestroyRef, Signal, inject, signal } from '@angular/core';\nimport { chartDwell } from '@ids-group-ltd/ids-design-system/components';\n\n/** @internal */\nexport interface ChartActiveMark {\n /** Index of the mark under the pointer or holding focus; `-1` when none is. */\n readonly index: Signal<number>;\n /** The mark's own element, which is what the tooltip anchors to. */\n readonly origin: Signal<Element | null>;\n /** Whether the active mark is held rather than followed — a tap, or a click under `pinOnClick`. */\n readonly pinned: Signal<boolean>;\n /** `mark` is the hovered element, for a listener delegated to the marks' parent; it defaults to\n * the event's `currentTarget`. */\n enter(\n index: number,\n event: Event,\n anchor?: string | Element | null,\n mark?: Element,\n ): void;\n /** Moves the active index with no pointer behind it - a keyboard, or a mark handing over which\n * category it took focus on. Leaves the anchor alone: the caller that has no event has no\n * element to aim at either. A pin holds against this too. */\n setIndex(index: number): void;\n leave(): void;\n /** Holds the mark that was activated, for any pointer type. Activating the mark that is already\n * pinned releases it, so one gesture both sets and clears. */\n pin(\n index: number,\n event: Event,\n anchor?: string | Element | null,\n mark?: Element,\n ): void;\n /** Lets go of a held mark, for a control that offers the way out in as many words. */\n release(): void;\n}\n\n/**\n * The pointer-and-focus target the tooltip reads, for a chart whose marks are elements.\n * Pointer and keyboard write the same pair, so a chart wires `pointerenter` and `focus` to\n * `enter` and gets one code path rather than two.\n *\n * A POINTER WAITS. It is answered once it has rested on a mark for `hoverDelayMs`, and at once\n * while the chart has already answered it; focus, a tap and a pin are answered at once.\n *\n * A TAP LATCHES. A touch fires `pointerleave` the moment the finger lifts, so without this the\n * panel would flash and vanish; latched, it stays until the next tap lands outside the mark. Call\n * from an injection context — the release listener is torn down with the component.\n *\n * @internal\n */\nexport function chartActiveMark(\n lingerMs: () => number = () => 0,\n hoverDelayMs: () => number = () => 0,\n): ChartActiveMark {\n const index = signal(-1);\n const origin = signal<Element | null>(null);\n // One flag for two ways of arriving at the same state: a tap, which has no hover to hold the\n // panel open, and a deliberate click under `pinOnClick`. Both release the same way.\n const pinned = signal(false);\n // A tap latches on its pointer event and the browser then clicks the same mark; that click belongs\n // to the tap, and must not read as the second press that lets go.\n let tapLatched = false;\n let pendingClear: ReturnType<typeof setTimeout> | null = null;\n // The element that OWNS the handlers, which is not always the tooltip anchor: a column anchors\n // its panel to the bar while the whole cell answers the pointer. A press is \"outside\" only when\n // it misses this, or a click on the cell beside the bar would release the pin and immediately\n // re-take it, leaving the pin looking stuck.\n let host: Element | null = null;\n const dwell = chartDwell(hoverDelayMs);\n\n const clear = (): void => {\n pinned.set(false);\n tapLatched = false;\n host = null;\n cancelPendingClear();\n index.set(-1);\n origin.set(null);\n document.removeEventListener('pointerdown', release, true);\n document.removeEventListener('keydown', releaseOnEscape, true);\n document.removeEventListener('pointerover', trackPointer, true);\n };\n\n // The tooltip anchors to the MARK, not to the box that catches the pointer: a column's cell is\n // the full plot height, so anchoring to it opens the panel at the top of the chart rather than\n // over the column it is about. A selector is resolved INSIDE the box; a legend item's mark is not\n // inside it, so that caller passes the element.\n const aim = (\n at: number,\n event: Event,\n anchor?: string | Element | null,\n mark: EventTarget | null = event.currentTarget,\n ): void => {\n const target = mark;\n if (target instanceof Element) {\n host = target;\n const mark =\n typeof anchor === 'string' ? target.querySelector(anchor) : anchor;\n // A mark drawn from a zero value is degenerate in one axis - a column loses its height, a\n // bar its width - and an overlay anchored to it lands at that edge rather than near the\n // reading. Both dimensions have to be real. The hover target always is.\n const box = mark?.getBoundingClientRect();\n const aimable = box && box.width > 0 && box.height > 0;\n origin.set(aimable ? (mark ?? target) : target);\n }\n index.set(at);\n };\n\n const hold = (): void => {\n pinned.set(true);\n cancelPendingClear();\n document.addEventListener('pointerdown', release, true);\n document.addEventListener('keydown', releaseOnEscape, true);\n };\n\n // Escape releases the mark as well as the panel. Without this the panel would go and the dimming\n // it caused would stay, leaving the chart in a state with nothing on screen explaining it.\n const releaseOnEscape = (event: KeyboardEvent): void => {\n if (event.key === 'Escape') {\n clear();\n }\n };\n\n const cancelPendingClear = (): void => {\n if (pendingClear !== null) {\n clearTimeout(pendingClear);\n pendingClear = null;\n }\n };\n\n const scheduleClear = (): void => {\n cancelPendingClear();\n pendingClear = setTimeout(\n () => {\n pendingClear = null;\n index.set(-1);\n origin.set(null);\n document.removeEventListener('pointerover', trackPointer, true);\n },\n Math.max(lingerMs(), 0),\n );\n };\n\n // One listener answers both halves of \"is the pointer on the panel\": `pointerover` fires on every\n // element the pointer crosses, so arriving on the panel cancels the clear and leaving it for\n // anything that is not the mark schedules a new one. Without the second half a panel the pointer\n // once touched would never close, because the mark's own `pointerleave` has already fired.\n const trackPointer = (event: PointerEvent): void => {\n if (!(event.target instanceof Element)) {\n return;\n }\n if (pinned() || event.target.closest('.ds-chart-tooltip-pane')) {\n cancelPendingClear();\n\n return;\n }\n // Against the HOST, not the anchor: a legend item and the arc its panel points at are disjoint\n // elements, so testing the anchor would clear the panel the moment the pointer moved inside the\n // legend item that opened it.\n if (!host || !host.contains(event.target)) {\n scheduleClear();\n }\n };\n\n // The chart the aimed mark belongs to. Every chart puts its plot in one `<figure>`, so this is\n // what tells \"pressed another mark of the same chart\" apart from \"pressed away\".\n const chartOf = (element: Element | null): Element | null =>\n element ? element.closest('figure') : null;\n\n const release = (event: PointerEvent): void => {\n if (!(event.target instanceof Element)) {\n clear();\n\n return;\n }\n if (host && host.contains(event.target)) {\n return;\n }\n // Hopping the pin from one mark to the next must not pass through \"nothing is pinned\". This\n // handler runs on `pointerdown`, the re-aim on the `click` after it, so clearing here would\n // unmount the Unpin control and the pinned styling for a frame and mount them again — a\n // flicker on every hop. The press is a re-aim when it lands on another mark of the same chart.\n const pressedMark = event.target.closest('[data-mark-index]');\n if (pressedMark && chartOf(pressedMark) === chartOf(host)) {\n return;\n }\n clear();\n };\n\n if (typeof document !== 'undefined') {\n inject(DestroyRef).onDestroy(() => {\n dwell.cancel();\n cancelPendingClear();\n document.removeEventListener('pointerdown', release, true);\n document.removeEventListener('keydown', releaseOnEscape, true);\n document.removeEventListener('pointerover', trackPointer, true);\n });\n }\n\n return {\n index: index.asReadonly(),\n origin: origin.asReadonly(),\n pinned: pinned.asReadonly(),\n enter(at, event, anchor, mark) {\n // A pin HOLDS. Without this the next mark the pointer crossed took the active slot straight\n // back, so pinning appeared to work and then followed the pointer anyway — the one thing a\n // pin exists not to do. It is released by Escape, or by a press outside the pinned mark.\n if (pinned()) {\n return;\n }\n // Taken now: `currentTarget` is gone by the time a delayed answer runs.\n const target = mark ?? event.currentTarget;\n dwell.schedule(at, () => answer(at, event, anchor, target), event);\n },\n setIndex(at) {\n if (pinned()) {\n return;\n }\n dwell.cancel();\n cancelPendingClear();\n index.set(at);\n },\n leave() {\n dwell.cancel();\n if (pinned()) {\n return;\n }\n scheduleClear();\n },\n release() {\n dwell.cancel();\n if (typeof document !== 'undefined') {\n clear();\n }\n },\n pin(at, event, anchor, mark) {\n dwell.cancel();\n if (typeof document === 'undefined') {\n return;\n }\n // The same gesture that set the pin clears it. A press on a DIFFERENT mark has already gone\n // through `release` by the time the click lands, so this only ever sees a fresh mark or the\n // pinned one.\n if (pinned() && index() === at) {\n if (tapLatched) {\n tapLatched = false;\n\n return;\n }\n clear();\n\n return;\n }\n tapLatched = false;\n // Re-aiming while already pinned keeps `pinned` true throughout, so nothing that renders on\n // it — the Unpin control, the held mark's styling — unmounts between the two marks.\n aim(at, event, anchor, mark);\n if (!pinned()) {\n hold();\n }\n },\n };\n\n function answer(\n at: number,\n event: Event,\n anchor: string | Element | null | undefined,\n target: EventTarget | null,\n ): void {\n if (pinned()) {\n return;\n }\n aim(at, event, anchor, target);\n cancelPendingClear();\n if (typeof document !== 'undefined') {\n document.addEventListener('pointerover', trackPointer, true);\n }\n if (\n typeof document !== 'undefined' &&\n event instanceof PointerEvent &&\n event.pointerType === 'touch'\n ) {\n hold();\n tapLatched = true;\n }\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { DomSanitizer, type SafeHtml } from '@angular/platform-browser';\nimport { ICONS } from '@ids-group-ltd/ids-design-system/core';\n\n/** Radius of the pin disc, in plot pixels. A mark that places a disc inside itself keeps this\n * much room from its edge.\n *\n * @internal */\nexport const CHART_PIN_RADIUS = 11;\n\n/** How far a disc sits inside the top edge of what it holds. At one radius it sits flush against\n * the edge and reads as part of the mark rather than as a badge on it.\n *\n * @internal */\nexport const CHART_PIN_GAP = 4;\n\nconst GLYPH_SIZE = 14;\n\n/**\n * The disc an SVG chart draws on the mark or category it holds. Drawn rather than composed:\n * `ds-icon`'s host is an HTML element, and an element the SVG specification does not know renders\n * nothing inside a canvas. The opaque disc is what keeps the glyph legible on any series colour.\n * Centred on the host's origin; place it with a `transform`.\n *\n * @internal\n */\n@Component({\n // An element selector cannot work inside a canvas: an element the SVG specification does not\n // know renders nothing, and neither do its children.\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'g[dsChartPinMarker]',\n standalone: true,\n template: `\n <svg:circle class=\"pin-disc\" [attr.r]=\"radius\" />\n\n <svg:svg\n class=\"pin-glyph\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n [attr.x]=\"glyphOffset\"\n [attr.y]=\"glyphOffset\"\n [attr.width]=\"glyphSize\"\n [attr.height]=\"glyphSize\"\n [innerHTML]=\"glyph\" />\n `,\n styles: `\n :host {\n pointer-events: none;\n }\n\n .pin-disc {\n fill: var(--surface-default);\n stroke: var(--border-divider);\n stroke-width: var(--border-width-default);\n }\n\n .pin-glyph {\n color: var(--text-primary);\n }\n `,\n host: {\n class: 'pin-marker',\n 'aria-hidden': 'true',\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChartPinMarkerComponent {\n protected readonly radius = CHART_PIN_RADIUS;\n protected readonly glyphSize = GLYPH_SIZE;\n protected readonly glyphOffset = -GLYPH_SIZE / 2;\n protected readonly glyph: SafeHtml = inject(\n DomSanitizer,\n ).bypassSecurityTrustHtml(ICONS.pin);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAAA;AACA,MAAM,iBAAiB,GAAG,CAAC;AAE3B,IAAI,KAAK,GAAoC,IAAI;AACjD,MAAM,YAAY,GAAG,IAAI,GAAG,EAAmB;AAE/C;AACA;AACA,SAAS,MAAM,CAAC,KAAa,EAAA;IAC3B,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;AAC/C,QAAA,MAAM,CAAC,KAAK,GAAG,CAAC;AAChB,QAAA,MAAM,CAAC,MAAM,GAAG,CAAC;AACjB,QAAA,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;IAC/D;IACA,IAAI,CAAC,KAAK,EAAE;AACV,QAAA,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAClB;IACA,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC3B,IAAA,KAAK,CAAC,SAAS,GAAG,KAAK;IACvB,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;AAE9D,IAAA,OAAO,CA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