@ids-group-ltd/ids-design-system 0.14.1 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +243 -0
- package/components.md +29 -26
- package/docs/agent/INDEX.md +3 -3
- package/docs/agent/charts/column-series-component.md +1 -1
- package/docs/agent/charts/ds-bar-chart.md +3 -3
- package/docs/agent/charts/ds-chart.md +1 -1
- package/docs/agent/charts/ds-column-chart.md +3 -3
- package/docs/agent/charts/ds-config.md +1 -1
- package/docs/agent/charts/ds-funnel-chart.md +3 -3
- package/docs/agent/charts/ds-heatmap-chart.md +1 -1
- package/docs/agent/charts/ds-line-chart.md +2 -2
- package/docs/agent/charts/ds-pie-chart.md +2 -2
- package/docs/agent/charts/ds-scatter-chart.md +1 -1
- package/docs/agent/charts/ds-waterfall-chart.md +1 -1
- package/docs/agent/charts/line-series-component.md +1 -1
- package/docs/agent/feedback/ds-description-list.md +3 -0
- package/docs/agent/forms/ds-textarea.md +1 -1
- package/docs/agent/navigation/ds-pagination.md +1 -1
- package/docs/agent/navigation/ds-tabs.md +1 -0
- package/docs/agent/overlays/ds-tooltip.md +3 -3
- package/docs/agent/tables/ds-table.md +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +22 -16
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +19 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +180 -19
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs +175 -93
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +10 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +32 -18
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +47 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +11 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +11 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +15 -13
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +35 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +32 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +66 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +61 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +78 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs +25 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +85 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +4 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.14.2.json +427 -0
- package/package.json +1 -1
- package/schematics/check-overrides/surface.json +31 -2
- package/styles/_chart-frame.scss +34 -12
- package/styles/_chart-interactive.scss +10 -9
- package/styles/_chart-motion.scss +139 -16
- package/styles/_overlay-motion.scss +6 -0
- package/styles/_tokens.scss +19 -4
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +24 -10
- package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +6 -1
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +33 -2
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +151 -103
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +8 -9
- package/types/ids-group-ltd-ids-design-system-components-description-list.d.ts +1 -1
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +23 -11
- package/types/ids-group-ltd-ids-design-system-components-heatmap-chart.d.ts +29 -2
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +8 -8
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +17 -7
- package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +20 -2
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +13 -2
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +22 -4
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +10 -1
- package/types/ids-group-ltd-ids-design-system-components-waterfall-chart.d.ts +11 -2
- package/types/ids-group-ltd-ids-design-system-components.d.ts +33 -6
- package/types/ids-group-ltd-ids-design-system-core.d.ts +14 -1
- package/types/ids-group-ltd-ids-design-system.d.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, input, model, booleanAttribute, computed, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
-
import { nextControlId } from '@ids-group-ltd/ids-design-system/components';
|
|
4
|
-
import { DS_INTL } from '@ids-group-ltd/ids-design-system/core';
|
|
2
|
+
import { inject, input, model, booleanAttribute, signal, DestroyRef, computed, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
+
import { chartDwell, CHART_HOVER_DELAY_MS, nextControlId } from '@ids-group-ltd/ids-design-system/components';
|
|
4
|
+
import { DS_INTL, resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The key beside a chart, and — when `toggleable` — the control that hides a series.
|
|
@@ -28,8 +28,20 @@ class ChartLegendComponent {
|
|
|
28
28
|
* so it renders as a radio group with an "All" option, and toggle renders as checkboxes. That is
|
|
29
29
|
* what gives each the keyboard and screen-reader behaviour it should have. */
|
|
30
30
|
mode = input('isolate', ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
31
|
-
/** The item under the pointer or holding focus, which is what the chart dims from.
|
|
31
|
+
/** The item under the pointer or holding focus, which is what the chart dims from. A pointer
|
|
32
|
+
* names it once it has rested for `DS_CONFIG.chart.hoverDelayMs`; focus names it at once. */
|
|
32
33
|
highlighted = model(null, ...(ngDevMode ? [{ debugName: "highlighted" }] : /* istanbul ignore next */ []));
|
|
34
|
+
dwell = chartDwell(resolveWithConfig(signal(null), (config) => config.chart?.hoverDelayMs, CHART_HOVER_DELAY_MS));
|
|
35
|
+
constructor() {
|
|
36
|
+
inject(DestroyRef).onDestroy(() => this.dwell.cancel());
|
|
37
|
+
}
|
|
38
|
+
onItemEnter(id, event) {
|
|
39
|
+
this.dwell.schedule(id, () => this.highlighted.set(id), event);
|
|
40
|
+
}
|
|
41
|
+
onItemLeave() {
|
|
42
|
+
this.dwell.cancel();
|
|
43
|
+
this.highlighted.set(null);
|
|
44
|
+
}
|
|
33
45
|
isHidden(id) {
|
|
34
46
|
return this.hidden().includes(id);
|
|
35
47
|
}
|
|
@@ -72,12 +84,12 @@ class ChartLegendComponent {
|
|
|
72
84
|
this.hidden.set(this.items().map((item) => item.id));
|
|
73
85
|
}
|
|
74
86
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartLegendComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
75
|
-
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 {{ intl().chart.legendAll }}\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 [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 [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 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 {{ intl().chart.legendNone }}\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{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)) backwards}.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{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)) backwards}.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{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)) backwards}.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{--_chart-legend-swatch-size: var(--ds-chart-legend-swatch-size, var(--space-2-5));--_chart-legend-hover-bg-color: var(--ds-chart-legend-hover-bg-color, var(--surface-secondary));--_chart-legend-hover-text-color: var(--ds-chart-legend-hover-text-color, var(--text-primary));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-item{margin:calc(-1 * var(--space-0-5)) calc(-1 * var(--space-1-5));padding:var(--space-0-5) var(--space-1-5);border-radius:var(--radius-sm);transition:background-color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item:hover,.legend-item:focus-visible,.legend-item:has(:focus-visible){background-color:var(--_chart-legend-hover-bg-color);color:var(--_chart-legend-hover-text-color)}.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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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(--_chart-legend-swatch-size);block-size:var(--_chart-legend-swatch-size);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 });
|
|
87
|
+
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 {{ intl().chart.legendAll }}\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)=\"onItemEnter(item.id, $event)\"\n (pointerleave)=\"onItemLeave()\">\n @if (toggleable() && mode() === 'isolate') {\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\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 [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 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 {{ intl().chart.legendNone }}\n </span>\n </label>\n </li>\n }\n</ul>\n", styles: ["@charset \"UTF-8\";@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-rise{0%{opacity:0;transform:translateY(var(--_chart-rise-distance, 4px))}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-ring-sweep{0%{opacity:0;transform:rotate(-30deg) scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}.legend-swatch{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.legend-swatch{animation-delay:0ms}}.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{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.legend-check{animation-delay:0ms}}.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{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.legend-radio{animation-delay:0ms}}.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{--_chart-legend-swatch-size: var(--ds-chart-legend-swatch-size, var(--space-2-5));--_chart-legend-hover-bg-color: var(--ds-chart-legend-hover-bg-color, var(--surface-secondary));--_chart-legend-hover-text-color: var(--ds-chart-legend-hover-text-color, var(--text-primary));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-item{margin:calc(-1 * var(--space-0-5)) calc(-1 * var(--space-1-5));padding:var(--space-0-5) var(--space-1-5);border-radius:var(--radius-sm);transition:background-color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item:hover,.legend-item:focus-visible,.legend-item:has(:focus-visible){background-color:var(--_chart-legend-hover-bg-color);color:var(--_chart-legend-hover-text-color)}.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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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(--_chart-legend-swatch-size);block-size:var(--_chart-legend-swatch-size);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 });
|
|
76
88
|
}
|
|
77
89
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartLegendComponent, decorators: [{
|
|
78
90
|
type: Component,
|
|
79
|
-
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 {{ intl().chart.legendAll }}\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 [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 [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 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 {{ intl().chart.legendNone }}\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{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)) backwards}.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{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)) backwards}.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{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)) backwards}.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{--_chart-legend-swatch-size: var(--ds-chart-legend-swatch-size, var(--space-2-5));--_chart-legend-hover-bg-color: var(--ds-chart-legend-hover-bg-color, var(--surface-secondary));--_chart-legend-hover-text-color: var(--ds-chart-legend-hover-text-color, var(--text-primary));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-item{margin:calc(-1 * var(--space-0-5)) calc(-1 * var(--space-1-5));padding:var(--space-0-5) var(--space-1-5);border-radius:var(--radius-sm);transition:background-color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item:hover,.legend-item:focus-visible,.legend-item:has(:focus-visible){background-color:var(--_chart-legend-hover-bg-color);color:var(--_chart-legend-hover-text-color)}.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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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(--_chart-legend-swatch-size);block-size:var(--_chart-legend-swatch-size);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"] }]
|
|
80
|
-
}], 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"] }] } });
|
|
91
|
+
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 {{ intl().chart.legendAll }}\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)=\"onItemEnter(item.id, $event)\"\n (pointerleave)=\"onItemLeave()\">\n @if (toggleable() && mode() === 'isolate') {\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\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 [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 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 {{ intl().chart.legendNone }}\n </span>\n </label>\n </li>\n }\n</ul>\n", styles: ["@charset \"UTF-8\";@keyframes ds-chart-mark-grow-y{0%{transform:scaleY(0)}}@keyframes ds-chart-mark-grow-x{0%{transform:scaleX(0)}}@keyframes ds-chart-mark-fade-in{0%{opacity:0}}@keyframes ds-chart-mark-rise{0%{opacity:0;transform:translateY(var(--_chart-rise-distance, 4px))}}@keyframes ds-chart-mark-settle{0%{opacity:0;transform:scale(.96)}}@keyframes ds-chart-ring-sweep{0%{opacity:0;transform:rotate(-30deg) scale(.96)}}@keyframes ds-chart-line-draw{0%{stroke-dashoffset:1}}@keyframes ds-chart-mark-exit{to{opacity:0}}.legend-swatch{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.legend-swatch{animation-delay:0ms}}.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{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.legend-check{animation-delay:0ms}}.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{animation:ds-chart-mark-fade-in var(--ds-motion-chart-mark-detail-duration) var(--ds-motion-chart-mark-enter-easing) calc(var(--ds-motion-chart-mark-exit-duration) + 0ms + var(--_chart-mark-stagger, 0ms)) backwards}@media(prefers-reduced-motion:reduce){.legend-radio{animation-delay:0ms}}.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{--_chart-legend-swatch-size: var(--ds-chart-legend-swatch-size, var(--space-2-5));--_chart-legend-hover-bg-color: var(--ds-chart-legend-hover-bg-color, var(--surface-secondary));--_chart-legend-hover-text-color: var(--ds-chart-legend-hover-text-color, var(--text-primary));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-item{margin:calc(-1 * var(--space-0-5)) calc(-1 * var(--space-1-5));padding:var(--space-0-5) var(--space-1-5);border-radius:var(--radius-sm);transition:background-color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing),color var(--ds-motion-chart-state-duration) var(--ds-motion-chart-state-easing)}.legend-item:hover,.legend-item:focus-visible,.legend-item:has(:focus-visible){background-color:var(--_chart-legend-hover-bg-color);color:var(--_chart-legend-hover-text-color)}.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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-border-color, var(--border-strong)));background:var(--_checkbox-bg-color, 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-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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-color, var(--ds-checkbox-selected-bg-color, var(--accent)));border-color:var(--_checkbox-selected-border-color, 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(--_chart-legend-swatch-size);block-size:var(--_chart-legend-swatch-size);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"] }]
|
|
92
|
+
}], ctorParameters: () => [], 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"] }] } });
|
|
81
93
|
|
|
82
94
|
/**
|
|
83
95
|
* 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 computed,\n ViewEncapsulation,\n booleanAttribute,\n inject,\n input,\n model,\n} from '@angular/core';\nimport { nextControlId } from '@ids-group-ltd/ids-design-system/components';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/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 protected readonly intl = inject(DS_INTL);\n\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 {{ intl().chart.legendAll }}\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 [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 [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 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 {{ intl().chart.legendNone }}\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":"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"}
|
|
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 DestroyRef,\n computed,\n ViewEncapsulation,\n booleanAttribute,\n inject,\n input,\n model,\n signal,\n} from '@angular/core';\nimport {\n CHART_HOVER_DELAY_MS,\n chartDwell,\n nextControlId,\n} from '@ids-group-ltd/ids-design-system/components';\nimport {\n DS_INTL,\n resolveWithConfig,\n} from '@ids-group-ltd/ids-design-system/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 protected readonly intl = inject(DS_INTL);\n\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. A pointer\n * names it once it has rested for `DS_CONFIG.chart.hoverDelayMs`; focus names it at once. */\n readonly highlighted = model<string | null>(null);\n\n private readonly dwell = chartDwell(\n resolveWithConfig(\n signal<number | null>(null),\n (config) => config.chart?.hoverDelayMs,\n CHART_HOVER_DELAY_MS,\n ),\n );\n\n constructor() {\n inject(DestroyRef).onDestroy(() => this.dwell.cancel());\n }\n\n protected onItemEnter(id: string, event: PointerEvent): void {\n this.dwell.schedule(id, () => this.highlighted.set(id), event);\n }\n\n protected onItemLeave(): void {\n this.dwell.cancel();\n this.highlighted.set(null);\n }\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 {{ intl().chart.legendAll }}\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)=\"onItemEnter(item.id, $event)\"\n (pointerleave)=\"onItemLeave()\">\n @if (toggleable() && mode() === 'isolate') {\n <label class=\"legend-toggle\">\n <input\n type=\"radio\"\n class=\"legend-radio\"\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 [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 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 {{ intl().chart.legendNone }}\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":"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"}
|
|
@@ -1,17 +1,85 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { input, ChangeDetectionStrategy, ViewEncapsulation, Component,
|
|
2
|
+
import { input, inject, ElementRef, afterRenderEffect, ChangeDetectionStrategy, ViewEncapsulation, Component, ViewContainerRef, effect, DestroyRef, Directive, signal } from '@angular/core';
|
|
3
3
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
5
|
-
import { closeOnScroll, disposeWithLeave } from '@ids-group-ltd/ids-design-system/components';
|
|
5
|
+
import { closeOnScroll, disposeWithLeave, chartDwell } from '@ids-group-ltd/ids-design-system/components';
|
|
6
6
|
import { NgTemplateOutlet } from '@angular/common';
|
|
7
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
8
|
+
import { ICONS } from '@ids-group-ltd/ids-design-system/core';
|
|
9
|
+
|
|
10
|
+
// WCAG 1.4.11: a graphical object needs 3:1 against what it sits on to be seen.
|
|
11
|
+
const NON_TEXT_CONTRAST = 3;
|
|
12
|
+
let probe = null;
|
|
13
|
+
const blendsByPair = new Map();
|
|
14
|
+
// Painting the colour and reading the pixel back resolves any CSS colour syntax to sRGB -
|
|
15
|
+
// `oklch()`, `color-mix()` and named colours included - where parsing the string would not.
|
|
16
|
+
function srgbOf(color) {
|
|
17
|
+
if (!probe) {
|
|
18
|
+
const canvas = document.createElement('canvas');
|
|
19
|
+
canvas.width = 1;
|
|
20
|
+
canvas.height = 1;
|
|
21
|
+
probe = canvas.getContext('2d', { willReadFrequently: true });
|
|
22
|
+
}
|
|
23
|
+
if (!probe) {
|
|
24
|
+
return [0, 0, 0];
|
|
25
|
+
}
|
|
26
|
+
probe.clearRect(0, 0, 1, 1);
|
|
27
|
+
probe.fillStyle = color;
|
|
28
|
+
probe.fillRect(0, 0, 1, 1);
|
|
29
|
+
const [red, green, blue] = probe.getImageData(0, 0, 1, 1).data;
|
|
30
|
+
return [red, green, blue];
|
|
31
|
+
}
|
|
32
|
+
function relativeLuminance([red, green, blue]) {
|
|
33
|
+
const linear = (channel) => {
|
|
34
|
+
const value = channel / 255;
|
|
35
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
36
|
+
};
|
|
37
|
+
return 0.2126 * linear(red) + 0.7152 * linear(green) + 0.0722 * linear(blue);
|
|
38
|
+
}
|
|
39
|
+
/** Whether a swatch of `color` sits on `ground` below the non-text contrast a graphical object
|
|
40
|
+
* needs, and so has to be ringed to be seen. Both are computed CSS colours. */
|
|
41
|
+
function swatchBlendsInto(color, ground) {
|
|
42
|
+
const pair = `${color}|${ground}`;
|
|
43
|
+
const known = blendsByPair.get(pair);
|
|
44
|
+
if (known !== undefined) {
|
|
45
|
+
return known;
|
|
46
|
+
}
|
|
47
|
+
const swatchLuminance = relativeLuminance(srgbOf(color));
|
|
48
|
+
const groundLuminance = relativeLuminance(srgbOf(ground));
|
|
49
|
+
const ratio = (Math.max(swatchLuminance, groundLuminance) + 0.05) /
|
|
50
|
+
(Math.min(swatchLuminance, groundLuminance) + 0.05);
|
|
51
|
+
const blends = ratio < NON_TEXT_CONTRAST;
|
|
52
|
+
blendsByPair.set(pair, blends);
|
|
53
|
+
return blends;
|
|
54
|
+
}
|
|
7
55
|
|
|
8
56
|
class ChartTooltipPanelComponent {
|
|
9
57
|
/** The category and the readings the panel prints. */
|
|
10
58
|
context = input.required(...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
11
59
|
/** The chart's projected `#dsChartTooltip` template. Null renders the built-in rows. */
|
|
12
60
|
template = input(null, ...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
61
|
+
host = inject(ElementRef);
|
|
62
|
+
constructor() {
|
|
63
|
+
// Before the frame paints, so a ring never lands a frame after its row.
|
|
64
|
+
afterRenderEffect({
|
|
65
|
+
earlyRead: () => {
|
|
66
|
+
this.context();
|
|
67
|
+
const host = this.host.nativeElement;
|
|
68
|
+
const ground = getComputedStyle(host).backgroundColor;
|
|
69
|
+
return [...host.querySelectorAll('.swatch')].map((swatch) => [
|
|
70
|
+
swatch,
|
|
71
|
+
swatchBlendsInto(getComputedStyle(swatch).backgroundColor, ground),
|
|
72
|
+
]);
|
|
73
|
+
},
|
|
74
|
+
write: (swatches) => {
|
|
75
|
+
for (const [swatch, blends] of swatches()) {
|
|
76
|
+
swatch.classList.toggle('ringed', blends);
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
13
81
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartTooltipPanelComponent, isStandalone: true, selector: "ds-chart-tooltip-panel", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" } }, ngImport: i0, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);--_chart-tooltip-hatch-color: var(--ds-chart-hatch-color);--_chart-tooltip-hatch-width: var(--ds-chart-hatch-width);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)
|
|
82
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: ChartTooltipPanelComponent, isStandalone: true, selector: "ds-chart-tooltip-panel", inputs: { context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" } }, ngImport: i0, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);--_chart-tooltip-hatch-color: var(--ds-chart-hatch-color);--_chart-tooltip-hatch-width: var(--ds-chart-hatch-width);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)}.swatch.ringed{box-shadow:inset 0 0 0 1.5px var(--_chart-tooltip-text-color)}.swatch.hatched{background-image:linear-gradient(-45deg,transparent calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% + var(--_chart-tooltip-hatch-width) / 2),transparent calc(50% + var(--_chart-tooltip-hatch-width) / 2))}.value{font-variant-numeric:tabular-nums;font-weight:var(--font-weight-medium)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
15
83
|
}
|
|
16
84
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartTooltipPanelComponent, decorators: [{
|
|
17
85
|
type: Component,
|
|
@@ -20,8 +88,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
20
88
|
// carries the same label and value in its `aria-label`, so exposing the panel
|
|
21
89
|
// makes a screen reader read each reading twice.
|
|
22
90
|
'aria-hidden': 'true',
|
|
23
|
-
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);--_chart-tooltip-hatch-color: var(--ds-chart-hatch-color);--_chart-tooltip-hatch-width: var(--ds-chart-hatch-width);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)
|
|
24
|
-
}], propDecorators: { context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }] } });
|
|
91
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (template(); as projected) {\n <ng-container\n [ngTemplateOutlet]=\"projected\"\n [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n} @else {\n @if (context().category) {\n <p class=\"category\">\n {{ context().category }}\n </p>\n }\n\n <ul class=\"entries\">\n @for (entry of context().entries; track $index) {\n <li class=\"entry\">\n <span\n class=\"swatch\"\n [class.hatched]=\"entry.hatched\"\n [style.background-color]=\"entry.color\">\n </span>\n\n <span class=\"label\">\n {{ entry.label }}\n </span>\n\n <span class=\"value\">\n {{ entry.formatted }}\n </span>\n\n @if (entry.detail) {\n <span class=\"detail\">\n {{ entry.detail }}\n </span>\n }\n </li>\n }\n </ul>\n}\n", styles: [":host{--_chart-tooltip-bg-color: var(--ds-chart-tooltip-bg-color);--_chart-tooltip-text-color: var(--ds-chart-tooltip-text-color);--_chart-tooltip-border-color: var(--ds-chart-tooltip-border-color);--_chart-tooltip-hatch-color: var(--ds-chart-hatch-color);--_chart-tooltip-hatch-width: var(--ds-chart-hatch-width);display:block;background:var(--_chart-tooltip-bg-color);color:var(--_chart-tooltip-text-color);border:var(--border-width-default) solid var(--_chart-tooltip-border-color);border-radius:var(--ds-radius-control);box-shadow:var(--ds-elevation-overlay);padding:var(--space-2) var(--space-2-5);max-width:var(--tooltip-maxw);max-height:calc(100dvh - 2 * var(--space-3));overflow-y:auto;z-index:var(--layer-tooltip);font:var(--font-weight-regular) var(--font-size-xs)/var(--line-height-base) var(--font-sans);pointer-events:none}.category{margin:0 0 var(--space-1-5);font-weight:var(--font-weight-medium)}.entries{display:grid;gap:var(--space-1);margin:0;padding:0;list-style:none}.entry{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:var(--space-2)}.detail{grid-column:2/-1;margin-block-start:calc(var(--space-1) * -1);color:var(--_chart-tooltip-text-color);opacity:.7;font-size:var(--font-size-2xs)}.swatch{inline-size:var(--space-3);block-size:var(--space-3);border-radius:var(--radius-pill)}.swatch.ringed{box-shadow:inset 0 0 0 1.5px var(--_chart-tooltip-text-color)}.swatch.hatched{background-image:linear-gradient(-45deg,transparent calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% - var(--_chart-tooltip-hatch-width) / 2),var(--_chart-tooltip-hatch-color) calc(50% + var(--_chart-tooltip-hatch-width) / 2),transparent calc(50% + var(--_chart-tooltip-hatch-width) / 2))}.value{font-variant-numeric:tabular-nums;font-weight:var(--font-weight-medium)}\n"] }]
|
|
92
|
+
}], ctorParameters: () => [], propDecorators: { context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }] } });
|
|
25
93
|
|
|
26
94
|
const POINTER_GAP_PX = 10;
|
|
27
95
|
// A fingertip covers roughly 40 CSS px, so a touch-opened panel has to clear the tap
|
|
@@ -32,8 +100,7 @@ const TOUCH_GAP_PX = 48;
|
|
|
32
100
|
// past what the margin leaves is one push cannot fit.
|
|
33
101
|
const VIEWPORT_MARGIN_PX = 12;
|
|
34
102
|
// Four fallbacks are what make the panel flip out of a small dashboard card rather than be
|
|
35
|
-
// clipped by it. Above first, held or not: the
|
|
36
|
-
// of a panel that opens upward.
|
|
103
|
+
// clipped by it. Above first, held or not: the panel opens over the mark it is about.
|
|
37
104
|
function positionsFor(gap) {
|
|
38
105
|
return [
|
|
39
106
|
{
|
|
@@ -187,26 +254,34 @@ function coarsePointer() {
|
|
|
187
254
|
* Pointer and keyboard write the same pair, so a chart wires `pointerenter` and `focus` to
|
|
188
255
|
* `enter` and gets one code path rather than two.
|
|
189
256
|
*
|
|
257
|
+
* A POINTER WAITS. It is answered once it has rested on a mark for `hoverDelayMs`, and at once
|
|
258
|
+
* while the chart has already answered it; focus, a tap and a pin are answered at once.
|
|
259
|
+
*
|
|
190
260
|
* A TAP LATCHES. A touch fires `pointerleave` the moment the finger lifts, so without this the
|
|
191
261
|
* panel would flash and vanish; latched, it stays until the next tap lands outside the mark. Call
|
|
192
262
|
* from an injection context — the release listener is torn down with the component.
|
|
193
263
|
*
|
|
194
264
|
* @internal
|
|
195
265
|
*/
|
|
196
|
-
function chartActiveMark(lingerMs = () => 0) {
|
|
266
|
+
function chartActiveMark(lingerMs = () => 0, hoverDelayMs = () => 0) {
|
|
197
267
|
const index = signal(-1, ...(ngDevMode ? [{ debugName: "index" }] : /* istanbul ignore next */ []));
|
|
198
268
|
const origin = signal(null, ...(ngDevMode ? [{ debugName: "origin" }] : /* istanbul ignore next */ []));
|
|
199
269
|
// One flag for two ways of arriving at the same state: a tap, which has no hover to hold the
|
|
200
270
|
// panel open, and a deliberate click under `pinOnClick`. Both release the same way.
|
|
201
271
|
const pinned = signal(false, ...(ngDevMode ? [{ debugName: "pinned" }] : /* istanbul ignore next */ []));
|
|
272
|
+
// A tap latches on its pointer event and the browser then clicks the same mark; that click belongs
|
|
273
|
+
// to the tap, and must not read as the second press that lets go.
|
|
274
|
+
let tapLatched = false;
|
|
202
275
|
let pendingClear = null;
|
|
203
276
|
// The element that OWNS the handlers, which is not always the tooltip anchor: a column anchors
|
|
204
277
|
// its panel to the bar while the whole cell answers the pointer. A press is "outside" only when
|
|
205
278
|
// it misses this, or a click on the cell beside the bar would release the pin and immediately
|
|
206
279
|
// re-take it, leaving the pin looking stuck.
|
|
207
280
|
let host = null;
|
|
281
|
+
const dwell = chartDwell(hoverDelayMs);
|
|
208
282
|
const clear = () => {
|
|
209
283
|
pinned.set(false);
|
|
284
|
+
tapLatched = false;
|
|
210
285
|
host = null;
|
|
211
286
|
cancelPendingClear();
|
|
212
287
|
index.set(-1);
|
|
@@ -303,6 +378,7 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
303
378
|
};
|
|
304
379
|
if (typeof document !== 'undefined') {
|
|
305
380
|
inject(DestroyRef).onDestroy(() => {
|
|
381
|
+
dwell.cancel();
|
|
306
382
|
cancelPendingClear();
|
|
307
383
|
document.removeEventListener('pointerdown', release, true);
|
|
308
384
|
document.removeEventListener('keydown', releaseOnEscape, true);
|
|
@@ -320,36 +396,33 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
320
396
|
if (pinned()) {
|
|
321
397
|
return;
|
|
322
398
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
document.addEventListener('pointerover', trackPointer, true);
|
|
327
|
-
}
|
|
328
|
-
if (typeof document !== 'undefined' &&
|
|
329
|
-
event instanceof PointerEvent &&
|
|
330
|
-
event.pointerType === 'touch') {
|
|
331
|
-
hold();
|
|
332
|
-
}
|
|
399
|
+
// Taken now: `currentTarget` is gone by the time a delayed answer runs.
|
|
400
|
+
const target = mark ?? event.currentTarget;
|
|
401
|
+
dwell.schedule(at, () => answer(at, event, anchor, target), event);
|
|
333
402
|
},
|
|
334
403
|
setIndex(at) {
|
|
335
404
|
if (pinned()) {
|
|
336
405
|
return;
|
|
337
406
|
}
|
|
407
|
+
dwell.cancel();
|
|
338
408
|
cancelPendingClear();
|
|
339
409
|
index.set(at);
|
|
340
410
|
},
|
|
341
411
|
leave() {
|
|
412
|
+
dwell.cancel();
|
|
342
413
|
if (pinned()) {
|
|
343
414
|
return;
|
|
344
415
|
}
|
|
345
416
|
scheduleClear();
|
|
346
417
|
},
|
|
347
418
|
release() {
|
|
419
|
+
dwell.cancel();
|
|
348
420
|
if (typeof document !== 'undefined') {
|
|
349
421
|
clear();
|
|
350
422
|
}
|
|
351
423
|
},
|
|
352
424
|
pin(at, event, anchor, mark) {
|
|
425
|
+
dwell.cancel();
|
|
353
426
|
if (typeof document === 'undefined') {
|
|
354
427
|
return;
|
|
355
428
|
}
|
|
@@ -357,9 +430,14 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
357
430
|
// through `release` by the time the click lands, so this only ever sees a fresh mark or the
|
|
358
431
|
// pinned one.
|
|
359
432
|
if (pinned() && index() === at) {
|
|
433
|
+
if (tapLatched) {
|
|
434
|
+
tapLatched = false;
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
360
437
|
clear();
|
|
361
438
|
return;
|
|
362
439
|
}
|
|
440
|
+
tapLatched = false;
|
|
363
441
|
// Re-aiming while already pinned keeps `pinned` true throughout, so nothing that renders on
|
|
364
442
|
// it — the Unpin control, the held mark's styling — unmounts between the two marks.
|
|
365
443
|
aim(at, event, anchor, mark);
|
|
@@ -368,11 +446,94 @@ function chartActiveMark(lingerMs = () => 0) {
|
|
|
368
446
|
}
|
|
369
447
|
},
|
|
370
448
|
};
|
|
449
|
+
function answer(at, event, anchor, target) {
|
|
450
|
+
if (pinned()) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
aim(at, event, anchor, target);
|
|
454
|
+
cancelPendingClear();
|
|
455
|
+
if (typeof document !== 'undefined') {
|
|
456
|
+
document.addEventListener('pointerover', trackPointer, true);
|
|
457
|
+
}
|
|
458
|
+
if (typeof document !== 'undefined' &&
|
|
459
|
+
event instanceof PointerEvent &&
|
|
460
|
+
event.pointerType === 'touch') {
|
|
461
|
+
hold();
|
|
462
|
+
tapLatched = true;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** Radius of the pin disc, in plot pixels. A mark that places a disc inside itself keeps this
|
|
468
|
+
* much room from its edge.
|
|
469
|
+
*
|
|
470
|
+
* @internal */
|
|
471
|
+
const CHART_PIN_RADIUS = 11;
|
|
472
|
+
/** How far a disc sits inside the top edge of what it holds. At one radius it sits flush against
|
|
473
|
+
* the edge and reads as part of the mark rather than as a badge on it.
|
|
474
|
+
*
|
|
475
|
+
* @internal */
|
|
476
|
+
const CHART_PIN_GAP = 4;
|
|
477
|
+
const GLYPH_SIZE = 14;
|
|
478
|
+
/**
|
|
479
|
+
* The disc an SVG chart draws on the mark or category it holds. Drawn rather than composed:
|
|
480
|
+
* `ds-icon`'s host is an HTML element, and an element the SVG specification does not know renders
|
|
481
|
+
* nothing inside a canvas. The opaque disc is what keeps the glyph legible on any series colour.
|
|
482
|
+
* Centred on the host's origin; place it with a `transform`.
|
|
483
|
+
*
|
|
484
|
+
* @internal
|
|
485
|
+
*/
|
|
486
|
+
class ChartPinMarkerComponent {
|
|
487
|
+
radius = CHART_PIN_RADIUS;
|
|
488
|
+
glyphSize = GLYPH_SIZE;
|
|
489
|
+
glyphOffset = -GLYPH_SIZE / 2;
|
|
490
|
+
glyph = inject(DomSanitizer).bypassSecurityTrustHtml(ICONS.pin);
|
|
491
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartPinMarkerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
492
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.22", type: ChartPinMarkerComponent, isStandalone: true, selector: "g[dsChartPinMarker]", host: { attributes: { "aria-hidden": "true" }, classAttribute: "pin-marker" }, ngImport: i0, template: `
|
|
493
|
+
<svg:circle class="pin-disc" [attr.r]="radius" />
|
|
494
|
+
|
|
495
|
+
<svg:svg
|
|
496
|
+
class="pin-glyph"
|
|
497
|
+
viewBox="0 0 24 24"
|
|
498
|
+
fill="none"
|
|
499
|
+
stroke="currentColor"
|
|
500
|
+
stroke-width="1.75"
|
|
501
|
+
stroke-linecap="round"
|
|
502
|
+
stroke-linejoin="round"
|
|
503
|
+
[attr.x]="glyphOffset"
|
|
504
|
+
[attr.y]="glyphOffset"
|
|
505
|
+
[attr.width]="glyphSize"
|
|
506
|
+
[attr.height]="glyphSize"
|
|
507
|
+
[innerHTML]="glyph" />
|
|
508
|
+
`, isInline: true, styles: [":host{pointer-events:none}.pin-disc{fill:var(--surface-default);stroke:var(--border-divider);stroke-width:var(--border-width-default)}.pin-glyph{color:var(--text-primary)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
371
509
|
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: ChartPinMarkerComponent, decorators: [{
|
|
511
|
+
type: Component,
|
|
512
|
+
args: [{ selector: 'g[dsChartPinMarker]', standalone: true, template: `
|
|
513
|
+
<svg:circle class="pin-disc" [attr.r]="radius" />
|
|
514
|
+
|
|
515
|
+
<svg:svg
|
|
516
|
+
class="pin-glyph"
|
|
517
|
+
viewBox="0 0 24 24"
|
|
518
|
+
fill="none"
|
|
519
|
+
stroke="currentColor"
|
|
520
|
+
stroke-width="1.75"
|
|
521
|
+
stroke-linecap="round"
|
|
522
|
+
stroke-linejoin="round"
|
|
523
|
+
[attr.x]="glyphOffset"
|
|
524
|
+
[attr.y]="glyphOffset"
|
|
525
|
+
[attr.width]="glyphSize"
|
|
526
|
+
[attr.height]="glyphSize"
|
|
527
|
+
[innerHTML]="glyph" />
|
|
528
|
+
`, host: {
|
|
529
|
+
class: 'pin-marker',
|
|
530
|
+
'aria-hidden': 'true',
|
|
531
|
+
}, encapsulation: ViewEncapsulation.Emulated, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{pointer-events:none}.pin-disc{fill:var(--surface-default);stroke:var(--border-divider);stroke-width:var(--border-width-default)}.pin-glyph{color:var(--text-primary)}\n"] }]
|
|
532
|
+
}] });
|
|
372
533
|
|
|
373
534
|
/**
|
|
374
535
|
* Generated bundle index. Do not edit.
|
|
375
536
|
*/
|
|
376
537
|
|
|
377
|
-
export { ChartTooltipDirective, chartActiveMark };
|
|
538
|
+
export { CHART_PIN_GAP, CHART_PIN_RADIUS, ChartPinMarkerComponent, ChartTooltipDirective, chartActiveMark };
|
|
378
539
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map
|