@ids-group-ltd/ids-design-system 0.13.1 → 0.13.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +361 -0
  2. package/components.md +17 -5
  3. package/docs/agent/INDEX.md +1 -0
  4. package/docs/agent/charts/ds-line-chart.md +2 -1
  5. package/docs/agent/feedback/ds-meter.md +11 -0
  6. package/docs/agent/feedback/ds-progress.md +4 -1
  7. package/docs/agent/forms/ds-button.md +1 -1
  8. package/docs/agent/forms/ds-icon-button.md +1 -1
  9. package/docs/agent/surfaces/ds-card.md +1 -1
  10. package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +77 -8
  11. package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
  12. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +3 -0
  13. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
  14. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +47 -5
  15. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
  16. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +141 -22
  17. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
  18. package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +49 -9
  19. package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
  20. package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs +47 -7
  21. package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs.map +1 -1
  22. package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +74 -8
  23. package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
  24. package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +182 -18
  25. package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
  26. package/fesm2022/ids-group-ltd-ids-design-system-components-meter.mjs +61 -0
  27. package/fesm2022/ids-group-ltd-ids-design-system-components-meter.mjs.map +1 -0
  28. package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs +34 -10
  29. package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs.map +1 -1
  30. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +71 -13
  31. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
  32. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
  33. package/fesm2022/ids-group-ltd-ids-design-system.mjs +1 -0
  34. package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
  35. package/migrations/0.13.2.json +269 -0
  36. package/package.json +9 -1
  37. package/styles/_chart-frame.scss +101 -4
  38. package/styles/_chart-interactive.scss +12 -3
  39. package/styles/_overlay-motion.scss +7 -6
  40. package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +66 -4
  41. package/types/ids-group-ltd-ids-design-system-components-button.d.ts +1 -0
  42. package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +25 -2
  43. package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +16 -2
  44. package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +34 -3
  45. package/types/ids-group-ltd-ids-design-system-components-donut-chart.d.ts +29 -3
  46. package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +46 -3
  47. package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +83 -6
  48. package/types/ids-group-ltd-ids-design-system-components-meter.d.ts +36 -0
  49. package/types/ids-group-ltd-ids-design-system-components-progress.d.ts +21 -3
  50. package/types/ids-group-ltd-ids-design-system-components.d.ts +35 -9
  51. package/types/ids-group-ltd-ids-design-system-core.d.ts +19 -3
  52. package/types/ids-group-ltd-ids-design-system.d.ts +5 -4
@@ -1,5 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, model, booleanAttribute, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
2
+ import { input, model, booleanAttribute, computed, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
3
+ import { nextControlId } from '@ids-group-ltd/ids-design-system/components';
3
4
 
4
5
  /**
5
6
  * The key beside a chart, and — when `toggleable` — the control that hides a series.
@@ -14,8 +15,17 @@ class ChartLegendComponent {
14
15
  /** Ids of the hidden items. Two-way, so a page can drive it from a URL parameter and so
15
16
  * cross-chart filtering later is this same mechanism. */
16
17
  hidden = model([], ...(ngDevMode ? [{ debugName: "hidden" }] : /* istanbul ignore next */ []));
17
- /** Offers the toggle. Off leaves the legend a plain key. */
18
+ /** Offers the control. Off leaves the legend a plain key. */
18
19
  toggleable = input(false, { ...(ngDevMode ? { debugName: "toggleable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
20
+ /** What a control does. `'isolate'` shows one series and hides the rest, which is the question a
21
+ * reader of a crowded chart actually asks — "show me only this" takes one action instead of one
22
+ * per series. `'toggle'` hides one and leaves the rest, for taking a dominant series out so the
23
+ * others can be read at a usable scale.
24
+ *
25
+ * The two are different controls, not two styles of one: isolate is a single choice among many,
26
+ * so it renders as a radio group with an "All" option, and toggle renders as checkboxes. That is
27
+ * what gives each the keyboard and screen-reader behaviour it should have. */
28
+ mode = input('isolate', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
19
29
  /** The item under the pointer or holding focus, which is what the chart dims from. */
20
30
  highlighted = model(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
21
31
  isHidden(id) {
@@ -27,13 +37,45 @@ class ChartLegendComponent {
27
37
  ? hidden.filter((entry) => entry !== id)
28
38
  : [...hidden, id]);
29
39
  }
40
+ /** Radio groups are scoped by NAME across the whole document, so a shared name would make every
41
+ * legend on a page one group: choosing a series in one chart would clear the choice in all the
42
+ * others, and only the last one rendered would show a selection at all. */
43
+ groupName = nextControlId('ds-chart-legend');
44
+ /** Which radio is on: an item's id, or the two ends of the range. Always one of them, so the
45
+ * group is never a set of empty circles with nothing chosen — a radio group with no selection
46
+ * reads as broken, and the reader cannot tell "everything" from "not decided yet".
47
+ *
48
+ * A partial set left over from `'toggle'` — some hidden, more than one visible — is not a state
49
+ * isolate can express, so it settles on `'all'` and the next choice makes it true. */
50
+ isolated = computed(() => {
51
+ const items = this.items();
52
+ const visible = items.filter((item) => !this.isHidden(item.id));
53
+ if (visible.length === 0 && items.length > 0) {
54
+ return 'none';
55
+ }
56
+ if (visible.length === 1) {
57
+ return visible[0].id;
58
+ }
59
+ return 'all';
60
+ }, ...(ngDevMode ? [{ debugName: "isolated" }] : /* istanbul ignore next */ []));
61
+ isolate(id) {
62
+ this.hidden.set(this.items()
63
+ .filter((item) => item.id !== id)
64
+ .map((item) => item.id));
65
+ }
66
+ showAll() {
67
+ this.hidden.set([]);
68
+ }
69
+ hideAll() {
70
+ this.hidden.set(this.items().map((item) => item.id));
71
+ }
30
72
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartLegendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
31
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartLegendComponent, isStandalone: true, selector: "ds-chart-legend", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, toggleable: { classPropertyName: "toggleable", publicName: "toggleable", isSignal: true, isRequired: false, transformFunction: null }, highlighted: { classPropertyName: "highlighted", publicName: "highlighted", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { hidden: "hiddenChange", highlighted: "highlightedChange" }, ngImport: i0, template: "<ul class=\"legend\">\n @for (item of items(); track item.id) {\n <li\n class=\"legend-item\"\n [class.is-hidden]=\"isHidden(item.id)\"\n (pointerenter)=\"highlighted.set(item.id)\"\n (pointerleave)=\"highlighted.set(null)\">\n @if (toggleable()) {\n <label class=\"legend-toggle\">\n <input\n type=\"checkbox\"\n class=\"legend-check\"\n animate.enter=\"mark-enter\"\n [checked]=\"!isHidden(item.id)\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"toggle(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else {\n <span\n class=\"legend-swatch\"\n animate.enter=\"mark-enter\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\">\n </span>\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n }\n </li>\n }\n</ul>\n", styles: ["@charset \"UTF-8\";@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.legend-swatch.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-swatch.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.legend-check.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-check.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}:host{display:block}.legend{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-4);margin:var(--space-3) 0 0;padding:0;list-style:none}.legend-item{display:inline-flex;gap:var(--space-2);align-items:center;color:var(--text-secondary);font-size:var(--font-size-xs)}.legend-toggle{display:inline-flex;gap:var(--space-2);align-items:center;cursor:pointer}.legend-check{appearance:none;width:var(--_checkbox-glyph, var(--check-size));height:var(--_checkbox-glyph, var(--check-size));border:var(--check-bw) solid var(--_checkbox-border, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg, var(--ds-checkbox-bg-color, var(--surface-default)));cursor:pointer;display:inline-grid;place-items:center;vertical-align:middle;flex-shrink:0;margin:0;border-radius:var(--_checkbox-radius, var(--ds-checkbox-radius, var(--ds-radius-inner)));transition:background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard)}.legend-check:hover:not(:disabled){border-color:var(--_checkbox-hover-border, var(--ds-checkbox-hover-border-color, var(--accent)))}.legend-check:active:not(:disabled,[disabled],.is-disabled){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.legend-check:disabled{background:var(--surface-disabled);border-color:var(--border-disabled);cursor:not-allowed}.legend-check{color:var(--icon-on-primary)}.legend-check:after{content:\"\";--_check-mark-enter-duration: var(--ds-check-mark-enter-duration, var(--ds-motion-check-enter-duration));--_check-mark-enter-easing: var(--ds-check-mark-enter-easing, var(--ds-motion-check-enter-easing));--_check-mark-exit-duration: var(--ds-check-mark-exit-duration, var(--ds-motion-check-exit-duration));--_check-mark-exit-easing: var(--ds-check-mark-exit-easing, var(--ds-motion-check-exit-easing));width:var(--check-tick-size);height:var(--check-tick-size);transform:scale(.6);opacity:0;transform-origin:center;transition:transform var(--_check-mark-exit-duration) var(--_check-mark-exit-easing),opacity var(--_check-mark-exit-duration) var(--_check-mark-exit-easing);background-color:currentcolor}@media(forced-colors:active){.legend-check:after{background-color:CanvasText}}.legend-check:after{-webkit-mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat;mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat}.legend-check:checked{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:checked:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing)}.legend-check:indeterminate{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:indeterminate:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing);width:var(--check-indet-w);height:var(--check-indet-h);border-radius:var(--ds-radius-inner);-webkit-mask:none;mask:none}.legend-swatch{flex:none;inline-size:var(--space-2-5);block-size:var(--space-2-5);border-radius:var(--radius-pill)}.legend-label{transition:color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item.is-hidden .legend-label{color:var(--text-disabled)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
73
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartLegendComponent, isStandalone: true, selector: "ds-chart-legend", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, toggleable: { classPropertyName: "toggleable", publicName: "toggleable", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, highlighted: { classPropertyName: "highlighted", publicName: "highlighted", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { hidden: "hiddenChange", highlighted: "highlightedChange" }, ngImport: i0, template: "<ul class=\"legend\">\n @if (toggleable() && mode() === 'isolate') {\n <li class=\"legend-item\">\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === 'all'\"\n (change)=\"showAll()\"\n (focus)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n All\n </span>\n </label>\n </li>\n }\n\n @for (item of items(); track item.id) {\n <li\n class=\"legend-item\"\n [class.is-hidden]=\"isHidden(item.id)\"\n (pointerenter)=\"highlighted.set(item.id)\"\n (pointerleave)=\"highlighted.set(null)\">\n @if (toggleable() && mode() === 'isolate') {\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n animate.enter=\"mark-enter\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === item.id\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"isolate(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else if (toggleable()) {\n <label class=\"legend-toggle\">\n <input\n type=\"checkbox\"\n class=\"legend-check\"\n animate.enter=\"mark-enter\"\n [checked]=\"!isHidden(item.id)\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"toggle(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else {\n <span\n class=\"legend-swatch\"\n animate.enter=\"mark-enter\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\">\n </span>\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n }\n </li>\n }\n\n @if (toggleable() && mode() === 'isolate') {\n <li class=\"legend-item\">\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === 'none'\"\n (change)=\"hideAll()\"\n (focus)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n None\n </span>\n </label>\n </li>\n }\n</ul>\n", styles: ["@charset \"UTF-8\";@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.legend-swatch.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-swatch.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.legend-check.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-check.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.legend-radio.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-radio.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}:host{display:block}.legend{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-4);margin:var(--space-3) 0 0;padding:0;list-style:none}.legend-item{display:inline-flex;gap:var(--space-2);align-items:center;color:var(--text-secondary);font-size:var(--font-size-xs)}.legend-toggle{display:inline-flex;gap:var(--space-2);align-items:center;cursor:pointer}.legend-check{appearance:none;width:var(--_checkbox-glyph, var(--check-size));height:var(--_checkbox-glyph, var(--check-size));border:var(--check-bw) solid var(--_checkbox-border, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg, var(--ds-checkbox-bg-color, var(--surface-default)));cursor:pointer;display:inline-grid;place-items:center;vertical-align:middle;flex-shrink:0;margin:0;border-radius:var(--_checkbox-radius, var(--ds-checkbox-radius, var(--ds-radius-inner)));transition:background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard)}.legend-check:hover:not(:disabled){border-color:var(--_checkbox-hover-border, var(--ds-checkbox-hover-border-color, var(--accent)))}.legend-check:active:not(:disabled,[disabled],.is-disabled){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.legend-check:disabled{background:var(--surface-disabled);border-color:var(--border-disabled);cursor:not-allowed}.legend-check{color:var(--icon-on-primary)}.legend-check:after{content:\"\";--_check-mark-enter-duration: var(--ds-check-mark-enter-duration, var(--ds-motion-check-enter-duration));--_check-mark-enter-easing: var(--ds-check-mark-enter-easing, var(--ds-motion-check-enter-easing));--_check-mark-exit-duration: var(--ds-check-mark-exit-duration, var(--ds-motion-check-exit-duration));--_check-mark-exit-easing: var(--ds-check-mark-exit-easing, var(--ds-motion-check-exit-easing));width:var(--check-tick-size);height:var(--check-tick-size);transform:scale(.6);opacity:0;transform-origin:center;transition:transform var(--_check-mark-exit-duration) var(--_check-mark-exit-easing),opacity var(--_check-mark-exit-duration) var(--_check-mark-exit-easing);background-color:currentcolor}@media(forced-colors:active){.legend-check:after{background-color:CanvasText}}.legend-check:after{-webkit-mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat;mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat}.legend-check:checked{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:checked:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing)}.legend-check:indeterminate{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:indeterminate:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing);width:var(--check-indet-w);height:var(--check-indet-h);border-radius:var(--ds-radius-inner);-webkit-mask:none;mask:none}.legend-radio{appearance:none;width:var(--_checkbox-glyph, var(--check-size));height:var(--_checkbox-glyph, var(--check-size));border:var(--check-bw) solid var(--_checkbox-border, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg, var(--ds-checkbox-bg-color, var(--surface-default)));cursor:pointer;display:inline-grid;place-items:center;vertical-align:middle;flex-shrink:0;margin:0;border-radius:var(--_checkbox-radius, var(--ds-checkbox-radius, var(--ds-radius-inner)));transition:background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard)}.legend-radio:hover:not(:disabled){border-color:var(--_checkbox-hover-border, var(--ds-checkbox-hover-border-color, var(--accent)))}.legend-radio:active:not(:disabled,[disabled],.is-disabled){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.legend-radio:disabled{background:var(--surface-disabled);border-color:var(--border-disabled);cursor:not-allowed}.legend-radio{color:var(--icon-on-primary)}.legend-radio:after{content:\"\";--_check-mark-enter-duration: var(--ds-check-mark-enter-duration, var(--ds-motion-check-enter-duration));--_check-mark-enter-easing: var(--ds-check-mark-enter-easing, var(--ds-motion-check-enter-easing));--_check-mark-exit-duration: var(--ds-check-mark-exit-duration, var(--ds-motion-check-exit-duration));--_check-mark-exit-easing: var(--ds-check-mark-exit-easing, var(--ds-motion-check-exit-easing));width:var(--check-tick-size);height:var(--check-tick-size);transform:scale(.6);opacity:0;transform-origin:center;transition:transform var(--_check-mark-exit-duration) var(--_check-mark-exit-easing),opacity var(--_check-mark-exit-duration) var(--_check-mark-exit-easing);background-color:currentcolor}@media(forced-colors:active){.legend-radio:after{background-color:CanvasText}}.legend-radio:after{-webkit-mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat;mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat}.legend-radio:checked{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-radio:checked:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing)}.legend-radio:indeterminate{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-radio:indeterminate:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing);width:var(--check-indet-w);height:var(--check-indet-h);border-radius:var(--ds-radius-inner);-webkit-mask:none;mask:none}.legend-radio{border-radius:var(--radius-pill)}.legend-swatch{flex:none;inline-size:var(--space-2-5);block-size:var(--space-2-5);border-radius:var(--radius-pill)}.legend-label{transition:color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item.is-hidden .legend-label{color:var(--text-disabled)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
32
74
  }
33
75
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartLegendComponent, decorators: [{
34
76
  type: Component,
35
- args: [{ selector: 'ds-chart-legend', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ul class=\"legend\">\n @for (item of items(); track item.id) {\n <li\n class=\"legend-item\"\n [class.is-hidden]=\"isHidden(item.id)\"\n (pointerenter)=\"highlighted.set(item.id)\"\n (pointerleave)=\"highlighted.set(null)\">\n @if (toggleable()) {\n <label class=\"legend-toggle\">\n <input\n type=\"checkbox\"\n class=\"legend-check\"\n animate.enter=\"mark-enter\"\n [checked]=\"!isHidden(item.id)\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"toggle(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else {\n <span\n class=\"legend-swatch\"\n animate.enter=\"mark-enter\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\">\n </span>\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n }\n </li>\n }\n</ul>\n", styles: ["@charset \"UTF-8\";@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.legend-swatch.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-swatch.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.legend-check.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-check.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}:host{display:block}.legend{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-4);margin:var(--space-3) 0 0;padding:0;list-style:none}.legend-item{display:inline-flex;gap:var(--space-2);align-items:center;color:var(--text-secondary);font-size:var(--font-size-xs)}.legend-toggle{display:inline-flex;gap:var(--space-2);align-items:center;cursor:pointer}.legend-check{appearance:none;width:var(--_checkbox-glyph, var(--check-size));height:var(--_checkbox-glyph, var(--check-size));border:var(--check-bw) solid var(--_checkbox-border, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg, var(--ds-checkbox-bg-color, var(--surface-default)));cursor:pointer;display:inline-grid;place-items:center;vertical-align:middle;flex-shrink:0;margin:0;border-radius:var(--_checkbox-radius, var(--ds-checkbox-radius, var(--ds-radius-inner)));transition:background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard)}.legend-check:hover:not(:disabled){border-color:var(--_checkbox-hover-border, var(--ds-checkbox-hover-border-color, var(--accent)))}.legend-check:active:not(:disabled,[disabled],.is-disabled){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.legend-check:disabled{background:var(--surface-disabled);border-color:var(--border-disabled);cursor:not-allowed}.legend-check{color:var(--icon-on-primary)}.legend-check:after{content:\"\";--_check-mark-enter-duration: var(--ds-check-mark-enter-duration, var(--ds-motion-check-enter-duration));--_check-mark-enter-easing: var(--ds-check-mark-enter-easing, var(--ds-motion-check-enter-easing));--_check-mark-exit-duration: var(--ds-check-mark-exit-duration, var(--ds-motion-check-exit-duration));--_check-mark-exit-easing: var(--ds-check-mark-exit-easing, var(--ds-motion-check-exit-easing));width:var(--check-tick-size);height:var(--check-tick-size);transform:scale(.6);opacity:0;transform-origin:center;transition:transform var(--_check-mark-exit-duration) var(--_check-mark-exit-easing),opacity var(--_check-mark-exit-duration) var(--_check-mark-exit-easing);background-color:currentcolor}@media(forced-colors:active){.legend-check:after{background-color:CanvasText}}.legend-check:after{-webkit-mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat;mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat}.legend-check:checked{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:checked:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing)}.legend-check:indeterminate{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:indeterminate:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing);width:var(--check-indet-w);height:var(--check-indet-h);border-radius:var(--ds-radius-inner);-webkit-mask:none;mask:none}.legend-swatch{flex:none;inline-size:var(--space-2-5);block-size:var(--space-2-5);border-radius:var(--radius-pill)}.legend-label{transition:color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item.is-hidden .legend-label{color:var(--text-disabled)}\n"] }]
36
- }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }, { type: i0.Output, args: ["hiddenChange"] }], toggleable: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleable", required: false }] }], highlighted: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlighted", required: false }] }, { type: i0.Output, args: ["highlightedChange"] }] } });
77
+ args: [{ selector: 'ds-chart-legend', standalone: true, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ul class=\"legend\">\n @if (toggleable() && mode() === 'isolate') {\n <li class=\"legend-item\">\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === 'all'\"\n (change)=\"showAll()\"\n (focus)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n All\n </span>\n </label>\n </li>\n }\n\n @for (item of items(); track item.id) {\n <li\n class=\"legend-item\"\n [class.is-hidden]=\"isHidden(item.id)\"\n (pointerenter)=\"highlighted.set(item.id)\"\n (pointerleave)=\"highlighted.set(null)\">\n @if (toggleable() && mode() === 'isolate') {\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n animate.enter=\"mark-enter\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === item.id\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"isolate(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else if (toggleable()) {\n <label class=\"legend-toggle\">\n <input\n type=\"checkbox\"\n class=\"legend-check\"\n animate.enter=\"mark-enter\"\n [checked]=\"!isHidden(item.id)\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"toggle(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else {\n <span\n class=\"legend-swatch\"\n animate.enter=\"mark-enter\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\">\n </span>\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n }\n </li>\n }\n\n @if (toggleable() && mode() === 'isolate') {\n <li class=\"legend-item\">\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === 'none'\"\n (change)=\"hideAll()\"\n (focus)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n None\n </span>\n </label>\n </li>\n }\n</ul>\n", styles: ["@charset \"UTF-8\";@keyframes ds-chart-mark-grow-y{0%{opacity:0;transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{opacity:0;transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-exit{to{opacity:0}}.legend-swatch.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-swatch.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.legend-check.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-check.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}.legend-radio.mark-enter{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-enter-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + var(--_chart-mark-stagger, 0ms)) both}.legend-radio.mark-leave{animation:ds-chart-mark-exit var(--ds-motion-chart-mark-exit-duration) var(--ds-motion-chart-mark-exit-easing) both}:host{display:block}.legend{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-4);margin:var(--space-3) 0 0;padding:0;list-style:none}.legend-item{display:inline-flex;gap:var(--space-2);align-items:center;color:var(--text-secondary);font-size:var(--font-size-xs)}.legend-toggle{display:inline-flex;gap:var(--space-2);align-items:center;cursor:pointer}.legend-check{appearance:none;width:var(--_checkbox-glyph, var(--check-size));height:var(--_checkbox-glyph, var(--check-size));border:var(--check-bw) solid var(--_checkbox-border, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg, var(--ds-checkbox-bg-color, var(--surface-default)));cursor:pointer;display:inline-grid;place-items:center;vertical-align:middle;flex-shrink:0;margin:0;border-radius:var(--_checkbox-radius, var(--ds-checkbox-radius, var(--ds-radius-inner)));transition:background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard)}.legend-check:hover:not(:disabled){border-color:var(--_checkbox-hover-border, var(--ds-checkbox-hover-border-color, var(--accent)))}.legend-check:active:not(:disabled,[disabled],.is-disabled){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.legend-check:disabled{background:var(--surface-disabled);border-color:var(--border-disabled);cursor:not-allowed}.legend-check{color:var(--icon-on-primary)}.legend-check:after{content:\"\";--_check-mark-enter-duration: var(--ds-check-mark-enter-duration, var(--ds-motion-check-enter-duration));--_check-mark-enter-easing: var(--ds-check-mark-enter-easing, var(--ds-motion-check-enter-easing));--_check-mark-exit-duration: var(--ds-check-mark-exit-duration, var(--ds-motion-check-exit-duration));--_check-mark-exit-easing: var(--ds-check-mark-exit-easing, var(--ds-motion-check-exit-easing));width:var(--check-tick-size);height:var(--check-tick-size);transform:scale(.6);opacity:0;transform-origin:center;transition:transform var(--_check-mark-exit-duration) var(--_check-mark-exit-easing),opacity var(--_check-mark-exit-duration) var(--_check-mark-exit-easing);background-color:currentcolor}@media(forced-colors:active){.legend-check:after{background-color:CanvasText}}.legend-check:after{-webkit-mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat;mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat}.legend-check:checked{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:checked:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing)}.legend-check:indeterminate{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-check:indeterminate:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing);width:var(--check-indet-w);height:var(--check-indet-h);border-radius:var(--ds-radius-inner);-webkit-mask:none;mask:none}.legend-radio{appearance:none;width:var(--_checkbox-glyph, var(--check-size));height:var(--_checkbox-glyph, var(--check-size));border:var(--check-bw) solid var(--_checkbox-border, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg, var(--ds-checkbox-bg-color, var(--surface-default)));cursor:pointer;display:inline-grid;place-items:center;vertical-align:middle;flex-shrink:0;margin:0;border-radius:var(--_checkbox-radius, var(--ds-checkbox-radius, var(--ds-radius-inner)));transition:background-color var(--duration-fast) var(--ease-standard),border-color var(--duration-fast) var(--ease-standard)}.legend-radio:hover:not(:disabled){border-color:var(--_checkbox-hover-border, var(--ds-checkbox-hover-border-color, var(--accent)))}.legend-radio:active:not(:disabled,[disabled],.is-disabled){filter:brightness(var(--ds-press-brightness, .9));transform:scale(var(--ds-press-scale, .97))}.legend-radio:disabled{background:var(--surface-disabled);border-color:var(--border-disabled);cursor:not-allowed}.legend-radio{color:var(--icon-on-primary)}.legend-radio:after{content:\"\";--_check-mark-enter-duration: var(--ds-check-mark-enter-duration, var(--ds-motion-check-enter-duration));--_check-mark-enter-easing: var(--ds-check-mark-enter-easing, var(--ds-motion-check-enter-easing));--_check-mark-exit-duration: var(--ds-check-mark-exit-duration, var(--ds-motion-check-exit-duration));--_check-mark-exit-easing: var(--ds-check-mark-exit-easing, var(--ds-motion-check-exit-easing));width:var(--check-tick-size);height:var(--check-tick-size);transform:scale(.6);opacity:0;transform-origin:center;transition:transform var(--_check-mark-exit-duration) var(--_check-mark-exit-easing),opacity var(--_check-mark-exit-duration) var(--_check-mark-exit-easing);background-color:currentcolor}@media(forced-colors:active){.legend-radio:after{background-color:CanvasText}}.legend-radio:after{-webkit-mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat;mask:url(\"data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2 6.5l2.5 2.5L10 3.5' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>\") center/contain no-repeat}.legend-radio:checked{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-radio:checked:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing)}.legend-radio:indeterminate{background:var(--_checkbox-selected-bg, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border, var(--ds-checkbox-selected-border-color, var(--accent)))}.legend-radio:indeterminate:after{transform:scale(1);opacity:1;transition:transform var(--_check-mark-enter-duration) var(--_check-mark-enter-easing),opacity var(--_check-mark-enter-duration) var(--_check-mark-enter-easing);width:var(--check-indet-w);height:var(--check-indet-h);border-radius:var(--ds-radius-inner);-webkit-mask:none;mask:none}.legend-radio{border-radius:var(--radius-pill)}.legend-swatch{flex:none;inline-size:var(--space-2-5);block-size:var(--space-2-5);border-radius:var(--radius-pill)}.legend-label{transition:color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item.is-hidden .legend-label{color:var(--text-disabled)}\n"] }]
78
+ }], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }, { type: i0.Output, args: ["hiddenChange"] }], toggleable: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleable", required: false }] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], highlighted: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlighted", required: false }] }, { type: i0.Output, args: ["highlightedChange"] }] } });
37
79
 
38
80
  /**
39
81
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"ids-group-ltd-ids-design-system-components-chart-legend.mjs","sources":["../../../src/lib/components/chart-legend/chart-legend.component.ts","../../../src/lib/components/chart-legend/chart-legend.component.html","../../../src/lib/components/chart-legend/ids-group-ltd-ids-design-system-components-chart-legend.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n booleanAttribute,\n input,\n model,\n} from '@angular/core';\nimport type { ChartLegendItem } from './chart-legend.types';\n\n/**\n * The key beside a chart, and — when `toggleable` — the control that hides a series.\n *\n * Ordinary DOM, never inside the `<svg>`: an item is a real `<input type=\"checkbox\">`, which is\n * what makes the toggle keyboard-operable and correctly announced without inventing a role.\n *\n * @internal\n */\n@Component({\n selector: 'ds-chart-legend',\n standalone: true,\n templateUrl: './chart-legend.component.html',\n styleUrl: './chart-legend.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChartLegendComponent {\n readonly items = input.required<readonly ChartLegendItem[]>();\n\n /** Ids of the hidden items. Two-way, so a page can drive it from a URL parameter and so\n * cross-chart filtering later is this same mechanism. */\n readonly hidden = model<readonly string[]>([]);\n\n /** Offers the toggle. Off leaves the legend a plain key. */\n readonly toggleable = input(false, { transform: booleanAttribute });\n\n /** The item under the pointer or holding focus, which is what the chart dims from. */\n readonly highlighted = model<string | null>(null);\n\n protected isHidden(id: string): boolean {\n return this.hidden().includes(id);\n }\n\n protected toggle(id: string): void {\n const hidden = this.hidden();\n\n this.hidden.set(\n hidden.includes(id)\n ? hidden.filter((entry) => entry !== id)\n : [...hidden, id],\n );\n }\n}\n","<ul class=\"legend\">\n @for (item of items(); track item.id) {\n <li\n class=\"legend-item\"\n [class.is-hidden]=\"isHidden(item.id)\"\n (pointerenter)=\"highlighted.set(item.id)\"\n (pointerleave)=\"highlighted.set(null)\">\n @if (toggleable()) {\n <label class=\"legend-toggle\">\n <input\n type=\"checkbox\"\n class=\"legend-check\"\n animate.enter=\"mark-enter\"\n [checked]=\"!isHidden(item.id)\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"toggle(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else {\n <span\n class=\"legend-swatch\"\n animate.enter=\"mark-enter\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\">\n </span>\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n }\n </li>\n }\n</ul>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAUA;;;;;;;AAOG;MASU,oBAAoB,CAAA;AACtB,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,2EAA8B;AAE7D;AAC0D;AACjD,IAAA,MAAM,GAAG,KAAK,CAAoB,EAAE,6EAAC;;IAGrC,UAAU,GAAG,KAAK,CAAC,KAAK,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;AAG1D,IAAA,WAAW,GAAG,KAAK,CAAgB,IAAI,kFAAC;AAEvC,IAAA,QAAQ,CAAC,EAAU,EAAA;QAC3B,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC;AAEU,IAAA,MAAM,CAAC,EAAU,EAAA;AACzB,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;QAE5B,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,MAAM,CAAC,QAAQ,CAAC,EAAE;AAChB,cAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,EAAE;cACrC,CAAC,GAAG,MAAM,EAAE,EAAE,CAAC,CACpB;IACH;wGAzBW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAApB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,oBAAoB,iqBC1BjC,srCAuCA,EAAA,MAAA,EAAA,CAAA,g8JAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDba,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBARhC,SAAS;+BACE,iBAAiB,EAAA,UAAA,EACf,IAAI,EAAA,aAAA,EAGD,iBAAiB,CAAC,QAAQ,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,srCAAA,EAAA,MAAA,EAAA,CAAA,g8JAAA,CAAA,EAAA;;;AExBjD;;AAEG;;;;"}
1
+ {"version":3,"file":"ids-group-ltd-ids-design-system-components-chart-legend.mjs","sources":["../../../src/lib/components/chart-legend/chart-legend.component.ts","../../../src/lib/components/chart-legend/chart-legend.component.html","../../../src/lib/components/chart-legend/ids-group-ltd-ids-design-system-components-chart-legend.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n ViewEncapsulation,\n booleanAttribute,\n input,\n model,\n} from '@angular/core';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\nimport type { ChartLegendItem } from './chart-legend.types';\n\n/**\n * The key beside a chart, and — when `toggleable` — the control that hides a series.\n *\n * Ordinary DOM, never inside the `<svg>`: an item is a real `<input type=\"checkbox\">`, which is\n * what makes the toggle keyboard-operable and correctly announced without inventing a role.\n *\n * @internal\n */\n@Component({\n selector: 'ds-chart-legend',\n standalone: true,\n templateUrl: './chart-legend.component.html',\n styleUrl: './chart-legend.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ChartLegendComponent {\n readonly items = input.required<readonly ChartLegendItem[]>();\n\n /** Ids of the hidden items. Two-way, so a page can drive it from a URL parameter and so\n * cross-chart filtering later is this same mechanism. */\n readonly hidden = model<readonly string[]>([]);\n\n /** Offers the control. Off leaves the legend a plain key. */\n readonly toggleable = input(false, { transform: booleanAttribute });\n\n /** What a control does. `'isolate'` shows one series and hides the rest, which is the question a\n * reader of a crowded chart actually asks — \"show me only this\" takes one action instead of one\n * per series. `'toggle'` hides one and leaves the rest, for taking a dominant series out so the\n * others can be read at a usable scale.\n *\n * The two are different controls, not two styles of one: isolate is a single choice among many,\n * so it renders as a radio group with an \"All\" option, and toggle renders as checkboxes. That is\n * what gives each the keyboard and screen-reader behaviour it should have. */\n readonly mode = input<'toggle' | 'isolate'>('isolate');\n\n /** The item under the pointer or holding focus, which is what the chart dims from. */\n readonly highlighted = model<string | null>(null);\n\n protected isHidden(id: string): boolean {\n return this.hidden().includes(id);\n }\n\n protected toggle(id: string): void {\n const hidden = this.hidden();\n\n this.hidden.set(\n hidden.includes(id)\n ? hidden.filter((entry) => entry !== id)\n : [...hidden, id],\n );\n }\n\n /** Radio groups are scoped by NAME across the whole document, so a shared name would make every\n * legend on a page one group: choosing a series in one chart would clear the choice in all the\n * others, and only the last one rendered would show a selection at all. */\n protected readonly groupName = nextControlId('ds-chart-legend');\n\n /** Which radio is on: an item's id, or the two ends of the range. Always one of them, so the\n * group is never a set of empty circles with nothing chosen — a radio group with no selection\n * reads as broken, and the reader cannot tell \"everything\" from \"not decided yet\".\n *\n * A partial set left over from `'toggle'` — some hidden, more than one visible — is not a state\n * isolate can express, so it settles on `'all'` and the next choice makes it true. */\n protected readonly isolated = computed(() => {\n const items = this.items();\n const visible = items.filter((item) => !this.isHidden(item.id));\n if (visible.length === 0 && items.length > 0) {\n return 'none';\n }\n if (visible.length === 1) {\n return visible[0].id;\n }\n\n return 'all';\n });\n\n protected isolate(id: string): void {\n this.hidden.set(\n this.items()\n .filter((item) => item.id !== id)\n .map((item) => item.id),\n );\n }\n\n protected showAll(): void {\n this.hidden.set([]);\n }\n\n protected hideAll(): void {\n this.hidden.set(this.items().map((item) => item.id));\n }\n}\n","<ul class=\"legend\">\n @if (toggleable() && mode() === 'isolate') {\n <li class=\"legend-item\">\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === 'all'\"\n (change)=\"showAll()\"\n (focus)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n All\n </span>\n </label>\n </li>\n }\n\n @for (item of items(); track item.id) {\n <li\n class=\"legend-item\"\n [class.is-hidden]=\"isHidden(item.id)\"\n (pointerenter)=\"highlighted.set(item.id)\"\n (pointerleave)=\"highlighted.set(null)\">\n @if (toggleable() && mode() === 'isolate') {\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n animate.enter=\"mark-enter\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === item.id\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"isolate(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else if (toggleable()) {\n <label class=\"legend-toggle\">\n <input\n type=\"checkbox\"\n class=\"legend-check\"\n animate.enter=\"mark-enter\"\n [checked]=\"!isHidden(item.id)\"\n [style.--ds-checkbox-selected-bg-color]=\"item.color\"\n [style.--ds-checkbox-selected-border-color]=\"item.color\"\n (change)=\"toggle(item.id)\"\n (focus)=\"highlighted.set(item.id)\"\n (blur)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n </label>\n } @else {\n <span\n class=\"legend-swatch\"\n animate.enter=\"mark-enter\"\n aria-hidden=\"true\"\n [style.background]=\"item.color\">\n </span>\n\n <span class=\"legend-label\">\n {{ item.label }}\n </span>\n }\n </li>\n }\n\n @if (toggleable() && mode() === 'isolate') {\n <li class=\"legend-item\">\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\n [attr.name]=\"groupName\"\n [checked]=\"isolated() === 'none'\"\n (change)=\"hideAll()\"\n (focus)=\"highlighted.set(null)\" />\n\n <span class=\"legend-label\">\n None\n </span>\n </label>\n </li>\n }\n</ul>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAYA;;;;;;;AAOG;MASU,oBAAoB,CAAA;AACtB,IAAA,KAAK,GAAG,KAAK,CAAC,QAAQ,2EAA8B;AAE7D;AAC0D;AACjD,IAAA,MAAM,GAAG,KAAK,CAAoB,EAAE,6EAAC;;IAGrC,UAAU,GAAG,KAAK,CAAC,KAAK,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AAEnE;;;;;;;AAO+E;AACtE,IAAA,IAAI,GAAG,KAAK,CAAuB,SAAS,2EAAC;;AAG7C,IAAA,WAAW,GAAG,KAAK,CAAgB,IAAI,kFAAC;AAEvC,IAAA,QAAQ,CAAC,EAAU,EAAA;QAC3B,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC;AAEU,IAAA,MAAM,CAAC,EAAU,EAAA;AACzB,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE;QAE5B,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,MAAM,CAAC,QAAQ,CAAC,EAAE;AAChB,cAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,EAAE;cACrC,CAAC,GAAG,MAAM,EAAE,EAAE,CAAC,CACpB;IACH;AAEA;;AAE4E;AACzD,IAAA,SAAS,GAAG,aAAa,CAAC,iBAAiB,CAAC;AAE/D;;;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BjC,+xFA6FA,EAAA,MAAA,EAAA,CAAA,msRAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FDjEa,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBARhC,SAAS;+BACE,iBAAiB,EAAA,UAAA,EACf,IAAI,EAAA,aAAA,EAGD,iBAAiB,CAAC,QAAQ,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,+xFAAA,EAAA,MAAA,EAAA,CAAA,msRAAA,CAAA,EAAA;;;AE1BjD;;AAEG;;;;"}
@@ -74,9 +74,15 @@ class ChartTooltipDirective {
74
74
  dsChartTooltip = input(null, ...(ngDevMode ? [{ debugName: "dsChartTooltip" }] : /* istanbul ignore next */ []));
75
75
  dsChartTooltipOrigin = input(null, ...(ngDevMode ? [{ debugName: "dsChartTooltipOrigin" }] : /* istanbul ignore next */ []));
76
76
  dsChartTooltipTemplate = input(null, ...(ngDevMode ? [{ debugName: "dsChartTooltipTemplate" }] : /* istanbul ignore next */ []));
77
+ /** Extra clearance between the mark and the panel, on top of the pointer default. A chart that
78
+ * prints something ABOVE its mark — a column with its value on top — needs the panel to clear
79
+ * that text as well as the mark, or the two overlap. Ignored for touch, where the gap is already
80
+ * sized for a fingertip. */
81
+ dsChartTooltipExtraGap = input(0, ...(ngDevMode ? [{ debugName: "dsChartTooltipExtraGap" }] : /* istanbul ignore next */ []));
77
82
  overlayRef = null;
78
83
  panelRef = null;
79
84
  detachScrollClose = null;
85
+ detachEscape = null;
80
86
  constructor() {
81
87
  effect(() => {
82
88
  const context = this.dsChartTooltip();
@@ -105,6 +111,7 @@ class ChartTooltipDirective {
105
111
  // Nothing re-opens it: the effect re-runs on a CHANGE to the context or the origin, and a
106
112
  // scroll changes neither. The next pointer move does both.
107
113
  this.detachScrollClose = closeOnScroll(this.overlayRef, () => this.close());
114
+ this.detachEscape = this.closeOnEscape();
108
115
  }
109
116
  else {
110
117
  this.overlayRef.updatePositionStrategy(this.strategyFor(origin));
@@ -113,7 +120,9 @@ class ChartTooltipDirective {
113
120
  this.panelRef?.setInput('template', this.dsChartTooltipTemplate());
114
121
  }
115
122
  strategyFor(origin) {
116
- const gap = coarsePointer() ? TOUCH_GAP_PX : POINTER_GAP_PX;
123
+ const gap = coarsePointer()
124
+ ? TOUCH_GAP_PX
125
+ : POINTER_GAP_PX + this.dsChartTooltipExtraGap();
117
126
  return this.overlay
118
127
  .position()
119
128
  .flexibleConnectedTo(origin)
@@ -121,7 +130,25 @@ class ChartTooltipDirective {
121
130
  .withPush(true)
122
131
  .withPositions(positionsFor(gap));
123
132
  }
133
+ // WCAG 1.4.13 wants the panel dismissable WITHOUT moving the pointer or the focus, which rules
134
+ // out "move off the mark". Nothing re-opens it afterwards: the effect re-runs on a CHANGE to the
135
+ // context or the origin, and neither changes while the pointer rests where it already is — so the
136
+ // reader keeps the screen they cleared until they visit another mark.
137
+ closeOnEscape() {
138
+ if (typeof document === 'undefined') {
139
+ return () => undefined;
140
+ }
141
+ const onKeydown = (event) => {
142
+ if (event.key === 'Escape') {
143
+ this.close();
144
+ }
145
+ };
146
+ document.addEventListener('keydown', onKeydown, true);
147
+ return () => document.removeEventListener('keydown', onKeydown, true);
148
+ }
124
149
  close() {
150
+ this.detachEscape?.();
151
+ this.detachEscape = null;
125
152
  this.detachScrollClose?.();
126
153
  this.detachScrollClose = null;
127
154
  this.overlayRef?.dispose();
@@ -129,7 +156,7 @@ class ChartTooltipDirective {
129
156
  this.panelRef = null;
130
157
  }
131
158
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
132
- 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 } }, ngImport: i0 });
159
+ 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 } }, ngImport: i0 });
133
160
  }
134
161
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipDirective, decorators: [{
135
162
  type: Directive,
@@ -137,7 +164,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
137
164
  selector: '[dsChartTooltip]',
138
165
  standalone: true,
139
166
  }]
140
- }], 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 }] }] } });
167
+ }], 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 }] }] } });
141
168
  function coarsePointer() {
142
169
  return (typeof window !== 'undefined' &&
143
170
  window.matchMedia('(pointer: coarse)').matches);
@@ -154,52 +181,144 @@ function coarsePointer() {
154
181
  *
155
182
  * @internal
156
183
  */
157
- function chartActiveMark() {
184
+ function chartActiveMark(lingerMs = () => 0) {
158
185
  const index = signal(-1, ...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
159
186
  const origin = signal(null, ...(ngDevMode ? [{ debugName: "origin" }] : /* istanbul ignore next */ []));
160
- let latched = false;
187
+ // One flag for two ways of arriving at the same state: a tap, which has no hover to hold the
188
+ // panel open, and a deliberate click under `pinOnClick`. Both release the same way.
189
+ const pinned = signal(false, ...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
190
+ let pendingClear = null;
191
+ // The element that OWNS the handlers, which is not always the tooltip anchor: a column anchors
192
+ // its panel to the bar while the whole cell answers the pointer. A press is "outside" only when
193
+ // it misses this, or a click on the cell beside the bar would release the pin and immediately
194
+ // re-take it, leaving the pin looking stuck.
195
+ let host = null;
161
196
  const clear = () => {
162
- latched = false;
197
+ pinned.set(false);
198
+ host = null;
199
+ cancelPendingClear();
163
200
  index.set(-1);
164
201
  origin.set(null);
165
202
  document.removeEventListener('pointerdown', release, true);
203
+ document.removeEventListener('keydown', releaseOnEscape, true);
204
+ document.removeEventListener('pointerover', trackPointer, true);
166
205
  };
167
- const release = (event) => {
206
+ // The tooltip anchors to the MARK, not to the box that catches the pointer: a column's cell is
207
+ // the full plot height, so anchoring to it opens the panel at the top of the chart rather than
208
+ // over the column it is about.
209
+ const aim = (at, event, anchorWithin) => {
210
+ const target = event.currentTarget;
211
+ if (target instanceof Element) {
212
+ host = target;
213
+ const anchor = anchorWithin ? target.querySelector(anchorWithin) : null;
214
+ origin.set(anchor ?? target);
215
+ }
216
+ index.set(at);
217
+ };
218
+ const hold = () => {
219
+ pinned.set(true);
220
+ cancelPendingClear();
221
+ document.addEventListener('pointerdown', release, true);
222
+ document.addEventListener('keydown', releaseOnEscape, true);
223
+ };
224
+ // Escape releases the mark as well as the panel. Without this the panel would go and the dimming
225
+ // it caused would stay, leaving the chart in a state with nothing on screen explaining it.
226
+ const releaseOnEscape = (event) => {
227
+ if (event.key === 'Escape') {
228
+ clear();
229
+ }
230
+ };
231
+ const cancelPendingClear = () => {
232
+ if (pendingClear !== null) {
233
+ clearTimeout(pendingClear);
234
+ pendingClear = null;
235
+ }
236
+ };
237
+ const scheduleClear = () => {
238
+ cancelPendingClear();
239
+ pendingClear = setTimeout(() => {
240
+ pendingClear = null;
241
+ index.set(-1);
242
+ origin.set(null);
243
+ document.removeEventListener('pointerover', trackPointer, true);
244
+ }, Math.max(lingerMs(), 0));
245
+ };
246
+ // One listener answers both halves of "is the pointer on the panel": `pointerover` fires on every
247
+ // element the pointer crosses, so arriving on the panel cancels the clear and leaving it for
248
+ // anything that is not the mark schedules a new one. Without the second half a panel the pointer
249
+ // once touched would never close, because the mark's own `pointerleave` has already fired.
250
+ const trackPointer = (event) => {
251
+ if (!(event.target instanceof Element)) {
252
+ return;
253
+ }
254
+ if (pinned() || event.target.closest('.ds-chart-tooltip-pane')) {
255
+ cancelPendingClear();
256
+ return;
257
+ }
168
258
  const mark = origin();
169
- if (mark && event.target instanceof Node && mark.contains(event.target)) {
259
+ if (!(mark instanceof Element) || !mark.contains(event.target)) {
260
+ scheduleClear();
261
+ }
262
+ };
263
+ const release = (event) => {
264
+ if (host && event.target instanceof Node && host.contains(event.target)) {
170
265
  return;
171
266
  }
172
267
  clear();
173
268
  };
174
269
  if (typeof document !== 'undefined') {
175
- inject(DestroyRef).onDestroy(() => document.removeEventListener('pointerdown', release, true));
270
+ inject(DestroyRef).onDestroy(() => {
271
+ cancelPendingClear();
272
+ document.removeEventListener('pointerdown', release, true);
273
+ document.removeEventListener('pointerover', trackPointer, true);
274
+ });
176
275
  }
177
276
  return {
178
277
  index: index.asReadonly(),
179
278
  origin: origin.asReadonly(),
279
+ pinned: pinned.asReadonly(),
180
280
  enter(at, event, anchorWithin) {
181
- const host = event.currentTarget;
182
- if (host instanceof Element) {
183
- // The tooltip anchors to the MARK, not to the box that catches the pointer: a column's
184
- // cell is the full plot height, so anchoring to it opens the panel at the top of the
185
- // chart rather than over the column it is about.
186
- const anchor = anchorWithin ? host.querySelector(anchorWithin) : null;
187
- origin.set(anchor ?? host);
281
+ // A pin HOLDS. Without this the next mark the pointer crossed took the active slot straight
282
+ // back, so pinning appeared to work and then followed the pointer anyway — the one thing a
283
+ // pin exists not to do. It is released by Escape, or by a press outside the pinned mark.
284
+ if (pinned()) {
285
+ return;
286
+ }
287
+ aim(at, event, anchorWithin);
288
+ cancelPendingClear();
289
+ if (typeof document !== 'undefined') {
290
+ document.addEventListener('pointerover', trackPointer, true);
188
291
  }
189
- index.set(at);
190
292
  if (typeof document !== 'undefined' &&
191
293
  event instanceof PointerEvent &&
192
294
  event.pointerType === 'touch') {
193
- latched = true;
194
- document.addEventListener('pointerdown', release, true);
295
+ hold();
195
296
  }
196
297
  },
197
298
  leave() {
198
- if (latched) {
299
+ if (pinned()) {
199
300
  return;
200
301
  }
201
- index.set(-1);
202
- origin.set(null);
302
+ scheduleClear();
303
+ },
304
+ release() {
305
+ if (typeof document !== 'undefined') {
306
+ clear();
307
+ }
308
+ },
309
+ pin(at, event, anchorWithin) {
310
+ if (typeof document === 'undefined') {
311
+ return;
312
+ }
313
+ // The same gesture that set the pin clears it. A press on a DIFFERENT mark has already gone
314
+ // through `release` by the time the click lands, so this only ever sees a fresh mark or the
315
+ // pinned one.
316
+ if (pinned() && index() === at) {
317
+ clear();
318
+ return;
319
+ }
320
+ aim(at, event, anchorWithin);
321
+ hold();
203
322
  },
204
323
  };
205
324
  }
@@ -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 entry.label) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [style.background]=\"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 { closeOnScroll } 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 = 12;\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// Above first, then below, then either side: four fallbacks are what make the panel flip\n// out of a small dashboard card rather than be clipped by it.\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 private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<ChartTooltipPanelComponent> | null = null;\n private detachScrollClose: (() => 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 — and a panel that stays put while the\n // chart scrolls away points at nothing.\n // Nothing re-opens it: the effect re-runs on a CHANGE to the context or the origin, and a\n // scroll changes neither. The next pointer move does both.\n this.detachScrollClose = closeOnScroll(this.overlayRef, () =>\n this.close(),\n );\n } else {\n this.overlayRef.updatePositionStrategy(this.strategyFor(origin));\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() ? TOUCH_GAP_PX : POINTER_GAP_PX;\n\n return this.overlay\n .position()\n .flexibleConnectedTo(origin as FlexibleConnectedPositionStrategyOrigin)\n .withFlexibleDimensions(false)\n .withPush(true)\n .withPositions(positionsFor(gap));\n }\n\n private close(): void {\n this.detachScrollClose?.();\n this.detachScrollClose = null;\n this.overlayRef?.dispose();\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 enter(index: number, event: Event, anchorWithin?: string): void;\n leave(): 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(): ChartActiveMark {\n const index = signal(-1);\n const origin = signal<Element | null>(null);\n let latched = false;\n\n const clear = (): void => {\n latched = false;\n index.set(-1);\n origin.set(null);\n document.removeEventListener('pointerdown', release, true);\n };\n\n const release = (event: PointerEvent): void => {\n const mark = origin();\n if (mark && event.target instanceof Node && mark.contains(event.target)) {\n return;\n }\n clear();\n };\n\n if (typeof document !== 'undefined') {\n inject(DestroyRef).onDestroy(() =>\n document.removeEventListener('pointerdown', release, true),\n );\n }\n\n return {\n index: index.asReadonly(),\n origin: origin.asReadonly(),\n enter(at, event, anchorWithin) {\n const host = event.currentTarget;\n if (host instanceof Element) {\n // The tooltip anchors to the MARK, not to the box that catches the pointer: a column's\n // cell is the full plot height, so anchoring to it opens the panel at the top of the\n // chart rather than over the column it is about.\n const anchor = anchorWithin ? host.querySelector(anchorWithin) : null;\n origin.set(anchor ?? host);\n }\n index.set(at);\n if (\n typeof document !== 'undefined' &&\n event instanceof PointerEvent &&\n event.pointerType === 'touch'\n ) {\n latched = true;\n document.addEventListener('pointerdown', release, true);\n }\n },\n leave() {\n if (latched) {\n return;\n }\n index.set(-1);\n origin.set(null);\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/C,IAAA,QAAQ,GAAG,KAAK,CAEd,IAAI,+EAAC;wGANL,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECzBvC,kzBAoCA,EAAA,MAAA,EAAA,CAAA,itCAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDvBY,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAYf,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G,CAAC,IAAI,CAAC;QAClB,CAAC;KACF;AACH;;AC/EA;;AAEG;;;;"}
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 entry.label) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [style.background]=\"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 { closeOnScroll } 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 = 12;\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// Above first, then below, then either side: four fallbacks are what make the panel flip\n// out of a small dashboard card rather than be clipped by it.\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 private overlayRef: OverlayRef | null = null;\n private panelRef: ComponentRef<ChartTooltipPanelComponent> | null = null;\n private detachScrollClose: (() => 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 — and a panel that stays put while the\n // chart scrolls away points at nothing.\n // Nothing re-opens it: the effect re-runs on a CHANGE to the context or the origin, and a\n // scroll changes neither. The next pointer move does both.\n this.detachScrollClose = closeOnScroll(this.overlayRef, () =>\n this.close(),\n );\n this.detachEscape = this.closeOnEscape();\n } else {\n this.overlayRef.updatePositionStrategy(this.strategyFor(origin));\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 .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.detachScrollClose?.();\n this.detachScrollClose = null;\n this.overlayRef?.dispose();\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 enter(index: number, event: Event, anchorWithin?: string): 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(index: number, event: Event, anchorWithin?: string): 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.\n const aim = (at: number, event: Event, anchorWithin?: string): void => {\n const target = event.currentTarget;\n if (target instanceof Element) {\n host = target;\n const anchor = anchorWithin ? target.querySelector(anchorWithin) : null;\n origin.set(anchor ?? 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 const mark = origin();\n if (!(mark instanceof Element) || !mark.contains(event.target)) {\n scheduleClear();\n }\n };\n\n const release = (event: PointerEvent): void => {\n if (host && event.target instanceof Node && host.contains(event.target)) {\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('pointerover', trackPointer, true);\n });\n }\n\n return {\n index: index.asReadonly(),\n origin: origin.asReadonly(),\n pinned: pinned.asReadonly(),\n enter(at, event, anchorWithin) {\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, anchorWithin);\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 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, anchorWithin) {\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 aim(at, event, anchorWithin);\n hold();\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/C,IAAA,QAAQ,GAAG,KAAK,CAEd,IAAI,+EAAC;wGANL,0BAA0B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAA1B,0BAA0B,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,wBAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,IAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECzBvC,kzBAoCA,EAAA,MAAA,EAAA,CAAA,itCAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDvBY,gBAAgB,EAAA,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CA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