@ids-group-ltd/ids-design-system 0.12.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +603 -6
  2. package/components.md +85 -2
  3. package/docs/agent/INDEX.md +11 -1
  4. package/docs/agent/charts/chart-colour-which-palette-a-chart-takes.md +9 -0
  5. package/docs/agent/charts/chart-frame-the-box-a-chart-draws-around-itself.md +12 -0
  6. package/docs/agent/charts/ds-bar-chart.md +15 -0
  7. package/docs/agent/charts/ds-column-chart.md +14 -0
  8. package/docs/agent/charts/ds-donut-chart.md +17 -0
  9. package/docs/agent/charts/ds-funnel-chart.md +16 -0
  10. package/docs/agent/charts/ds-line-chart.md +15 -0
  11. package/docs/agent/forms/ds-button.md +4 -2
  12. package/docs/agent/forms/ds-number-stepper.md +1 -0
  13. package/docs/agent/navigation/ds-sidenav-item.md +1 -0
  14. package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +2 -2
  15. package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
  16. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +16 -14
  17. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
  18. package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +2 -2
  19. package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -1
  20. package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +161 -0
  21. package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -0
  22. package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +2 -2
  23. package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
  24. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +58 -8
  25. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
  26. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +43 -0
  27. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -0
  28. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +197 -0
  29. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -0
  30. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +1 -0
  31. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
  32. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +1 -0
  33. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
  34. package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +173 -0
  35. package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -0
  36. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +9 -6
  37. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
  38. package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs +299 -0
  39. package/fesm2022/ids-group-ltd-ids-design-system-components-donut-chart.mjs.map +1 -0
  40. package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +2 -2
  41. package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -1
  42. package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +2 -2
  43. package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -1
  44. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +69 -17
  45. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
  46. package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +1 -1
  47. package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -1
  48. package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +366 -0
  49. package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -0
  50. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +10 -14
  51. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
  52. package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +631 -0
  53. package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -0
  54. package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +1 -1
  55. package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
  56. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +1 -0
  57. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
  58. package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +2 -2
  59. package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
  60. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +1 -0
  61. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
  62. package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +2 -2
  63. package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
  64. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +2 -10
  65. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
  66. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +1 -0
  67. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
  68. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +9 -6
  69. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
  70. package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +18 -7
  71. package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
  72. package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +1 -0
  73. package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
  74. package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +4 -3
  75. package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -1
  76. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +1 -0
  77. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
  78. package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +1 -1
  79. package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs.map +1 -1
  80. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +30 -71
  81. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
  82. package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +2 -2
  83. package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -1
  84. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +1 -0
  85. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
  86. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +1 -0
  87. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
  88. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +31 -9
  89. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
  90. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +393 -5
  91. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
  92. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +17 -1
  93. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
  94. package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +3 -0
  95. package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
  96. package/fesm2022/ids-group-ltd-ids-design-system.mjs +10 -1
  97. package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
  98. package/migrations/0.13.0.json +530 -0
  99. package/package.json +57 -1
  100. package/styles/_chart-data-table.scss +95 -0
  101. package/styles/_chart-frame.scss +53 -0
  102. package/styles/_chart-interactive.scss +40 -0
  103. package/styles/_chart-motion.scss +45 -0
  104. package/styles/_focus.scss +1 -1
  105. package/styles/_tokens-charts.scss +149 -39
  106. package/styles/_tokens.scss +17 -4
  107. package/themes/dark/_theme.scss +37 -29
  108. package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +11 -9
  109. package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +104 -0
  110. package/types/ids-group-ltd-ids-design-system-components-button.d.ts +37 -4
  111. package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +34 -0
  112. package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +78 -0
  113. package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +105 -0
  114. package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +4 -1
  115. package/types/ids-group-ltd-ids-design-system-components-donut-chart.d.ts +113 -0
  116. package/types/ids-group-ltd-ids-design-system-components-field-group.d.ts +52 -11
  117. package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +109 -0
  118. package/types/ids-group-ltd-ids-design-system-components-input.d.ts +5 -7
  119. package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +241 -0
  120. package/types/ids-group-ltd-ids-design-system-components-select.d.ts +5 -2
  121. package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +16 -4
  122. package/types/ids-group-ltd-ids-design-system-components-table.d.ts +13 -28
  123. package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +11 -1
  124. package/types/ids-group-ltd-ids-design-system-components.d.ts +154 -4
  125. package/types/ids-group-ltd-ids-design-system-core.d.ts +12 -1
  126. package/types/ids-group-ltd-ids-design-system.d.ts +9 -2
@@ -1,8 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { input, ViewEncapsulation, Component, inject, ElementRef, HostListener, Directive } from '@angular/core';
2
+ import { input, ViewEncapsulation, Component, inject, ElementRef, booleanAttribute, HostListener, Directive } from '@angular/core';
3
3
  import { Overlay } from '@angular/cdk/overlay';
4
4
  import { ComponentPortal } from '@angular/cdk/portal';
5
5
  import { prepareOverlayEnter } from '@ids-group-ltd/ids-design-system/components';
6
+ import { isTextClipped } from '@ids-group-ltd/ids-design-system/core';
6
7
 
7
8
  class TooltipPanelComponent {
8
9
  /** Tooltip text content. */
@@ -26,6 +27,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
26
27
  }, encapsulation: ViewEncapsulation.Emulated, styles: ["@charset \"UTF-8\";:host{--_tooltip-bg-color: var(--ds-tooltip-bg-color, var(--surface-inverted));--_tooltip-text-color: var(--ds-tooltip-text-color, var(--text-inverted));--_tooltip-radius: var(--ds-tooltip-radius, var(--ds-radius-control));--_tooltip-shadow: var(--ds-tooltip-shadow, var(--ds-elevation-overlay));--_tooltip-max-width: var(--ds-tooltip-max-width, var(--tooltip-maxw));--_tooltip-padding: var(--ds-tooltip-padding, var(--space-1-5) var(--space-2-5));display:block;position:relative;background:var(--_tooltip-bg-color);color:var(--_tooltip-text-color);font:var(--font-weight-medium) var(--font-size-xs)/var(--line-height-base) var(--font-sans);padding:var(--_tooltip-padding);border-radius:var(--_tooltip-radius);max-width:var(--_tooltip-max-width);z-index:var(--layer-tooltip);box-shadow:var(--_tooltip-shadow)}:host:after{content:\"\";position:absolute;width:var(--space-2);height:var(--space-2);background:var(--_tooltip-bg-color);transform:rotate(45deg)}:host(.bottom):after{top:calc(var(--tooltip-arrow) / -2);left:50%;margin-left:calc(var(--tooltip-arrow) / -2)}:host(.top):after{bottom:calc(var(--tooltip-arrow) / -2);left:50%;margin-left:calc(var(--tooltip-arrow) / -2)}:host(.left):after{right:calc(var(--tooltip-arrow) / -2);top:50%;margin-top:calc(var(--tooltip-arrow) / -2)}:host(.right):after{left:calc(var(--tooltip-arrow) / -2);top:50%;margin-top:calc(var(--tooltip-arrow) / -2)}\n"] }]
27
28
  }], propDecorators: { text: [{ type: i0.Input, args: [{ isSignal: true, alias: "text", required: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: true }] }], panelId: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelId", required: false }] }] } });
28
29
 
30
+ const TRIGGER_GAP_PX = 8;
29
31
  let nextId = 0;
30
32
  class TooltipDirective {
31
33
  overlay = inject(Overlay);
@@ -40,6 +42,22 @@ class TooltipDirective {
40
42
  /** Milliseconds before the tip appears. Hiding is immediate — this delay only ever
41
43
  * suppresses a tip the pointer passed over on its way somewhere else. */
42
44
  dsTooltipDelay = input(120, ...(ngDevMode ? [{ debugName: "dsTooltipDelay" }] : /* istanbul ignore next */ []));
45
+ /** Show the tip only while the host is actually showing less text than it holds. For a label
46
+ * that already reads in full, a tip repeating it is noise. Re-tested on every open, so a tip
47
+ * appears and stops appearing as the column, panel or window is resized, with no observer to
48
+ * run.
49
+ *
50
+ * With this on, `dsTooltip` may be left empty and the host's own text is disclosed. That is
51
+ * what makes it usable on projected content, where the component holding the tip cannot know
52
+ * what it was handed. */
53
+ dsTooltipWhenClipped = input(false, { ...(ngDevMode ? { debugName: "dsTooltipWhenClipped" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
54
+ tipText() {
55
+ const given = this.dsTooltip();
56
+ if (given || !this.dsTooltipWhenClipped()) {
57
+ return given;
58
+ }
59
+ return (this.host.nativeElement.textContent ?? '').trim();
60
+ }
43
61
  ref = null;
44
62
  timer = null;
45
63
  tipId = `ds-tooltip-${++nextId}`;
@@ -75,7 +93,11 @@ class TooltipDirective {
75
93
  this.onClose();
76
94
  }
77
95
  scheduleShow() {
78
- if (!this.dsTooltip()) {
96
+ if (!this.tipText()) {
97
+ return;
98
+ }
99
+ if (this.dsTooltipWhenClipped() &&
100
+ !isTextClipped(this.host.nativeElement)) {
79
101
  return;
80
102
  }
81
103
  if (this.timer !== null) {
@@ -134,7 +156,7 @@ class TooltipDirective {
134
156
  });
135
157
  prepareOverlayEnter(this.ref, this.host.nativeElement, positionStrategy);
136
158
  const cmpRef = this.ref.attach(new ComponentPortal(TooltipPanelComponent));
137
- cmpRef.setInput('text', this.dsTooltip());
159
+ cmpRef.setInput('text', this.tipText());
138
160
  cmpRef.setInput('placement', placement);
139
161
  cmpRef.setInput('panelId', this.tipId);
140
162
  const described = this.focusedTarget ?? this.host.nativeElement;
@@ -150,7 +172,7 @@ class TooltipDirective {
150
172
  originY: 'top',
151
173
  overlayX: 'center',
152
174
  overlayY: 'bottom',
153
- offsetY: -8,
175
+ offsetY: -TRIGGER_GAP_PX,
154
176
  };
155
177
  case 'bottom':
156
178
  return {
@@ -158,7 +180,7 @@ class TooltipDirective {
158
180
  originY: 'bottom',
159
181
  overlayX: 'center',
160
182
  overlayY: 'top',
161
- offsetY: 8,
183
+ offsetY: TRIGGER_GAP_PX,
162
184
  };
163
185
  case 'left':
164
186
  return {
@@ -166,7 +188,7 @@ class TooltipDirective {
166
188
  originY: 'center',
167
189
  overlayX: 'end',
168
190
  overlayY: 'center',
169
- offsetX: -8,
191
+ offsetX: -TRIGGER_GAP_PX,
170
192
  };
171
193
  case 'right':
172
194
  return {
@@ -174,7 +196,7 @@ class TooltipDirective {
174
196
  originY: 'center',
175
197
  overlayX: 'start',
176
198
  overlayY: 'center',
177
- offsetX: 8,
199
+ offsetX: TRIGGER_GAP_PX,
178
200
  };
179
201
  }
180
202
  }
@@ -182,7 +204,7 @@ class TooltipDirective {
182
204
  this.onClose();
183
205
  }
184
206
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
185
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: TooltipDirective, isStandalone: true, selector: "[dsTooltip]", inputs: { dsTooltip: { classPropertyName: "dsTooltip", publicName: "dsTooltip", isSignal: true, isRequired: false, transformFunction: null }, dsTooltipPlacement: { classPropertyName: "dsTooltipPlacement", publicName: "dsTooltipPlacement", isSignal: true, isRequired: false, transformFunction: null }, dsTooltipDelay: { classPropertyName: "dsTooltipDelay", publicName: "dsTooltipDelay", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onPointerEnter()", "focusin": "onFocusIn($event)", "focusout": "onFocusOut()", "mouseleave": "onClose()", "click": "onClose()", "keydown.escape": "onEscape()" } }, ngImport: i0 });
207
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.22", type: TooltipDirective, isStandalone: true, selector: "[dsTooltip]", inputs: { dsTooltip: { classPropertyName: "dsTooltip", publicName: "dsTooltip", isSignal: true, isRequired: false, transformFunction: null }, dsTooltipPlacement: { classPropertyName: "dsTooltipPlacement", publicName: "dsTooltipPlacement", isSignal: true, isRequired: false, transformFunction: null }, dsTooltipDelay: { classPropertyName: "dsTooltipDelay", publicName: "dsTooltipDelay", isSignal: true, isRequired: false, transformFunction: null }, dsTooltipWhenClipped: { classPropertyName: "dsTooltipWhenClipped", publicName: "dsTooltipWhenClipped", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onPointerEnter()", "focusin": "onFocusIn($event)", "focusout": "onFocusOut()", "mouseleave": "onClose()", "click": "onClose()", "keydown.escape": "onEscape()" } }, ngImport: i0 });
186
208
  }
187
209
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TooltipDirective, decorators: [{
188
210
  type: Directive,
@@ -190,7 +212,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
190
212
  selector: '[dsTooltip]',
191
213
  standalone: true,
192
214
  }]
193
- }], propDecorators: { dsTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsTooltip", required: false }] }], dsTooltipPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsTooltipPlacement", required: false }] }], dsTooltipDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsTooltipDelay", required: false }] }], onPointerEnter: [{
215
+ }], propDecorators: { dsTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsTooltip", required: false }] }], dsTooltipPlacement: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsTooltipPlacement", required: false }] }], dsTooltipDelay: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsTooltipDelay", required: false }] }], dsTooltipWhenClipped: [{ type: i0.Input, args: [{ isSignal: true, alias: "dsTooltipWhenClipped", required: false }] }], onPointerEnter: [{
194
216
  type: HostListener,
195
217
  args: ['mouseenter']
196
218
  }], onFocusIn: [{
@@ -1 +1 @@
1
- {"version":3,"file":"ids-group-ltd-ids-design-system-components-tooltip.mjs","sources":["../../../src/lib/components/tooltip/tooltip-panel.component.ts","../../../src/lib/components/tooltip/tooltip.directive.ts","../../../src/lib/components/tooltip/ids-group-ltd-ids-design-system-components-tooltip.ts"],"sourcesContent":["import { Component, ViewEncapsulation, input } from '@angular/core';\nimport type { TooltipPlacement } from './tooltip.types';\n\n@Component({\n selector: 'ds-tooltip-panel',\n standalone: true,\n template: `{{ text() }}`,\n styleUrl: './tooltip-panel.component.scss',\n host: {\n role: 'tooltip',\n '[attr.id]': 'panelId()',\n '[class.top]': \"placement() === 'top'\",\n '[class.bottom]': \"placement() === 'bottom'\",\n '[class.left]': \"placement() === 'left'\",\n '[class.right]': \"placement() === 'right'\",\n },\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class TooltipPanelComponent {\n /** Tooltip text content. */\n readonly text = input.required<string>();\n /** Side of the trigger the panel is positioned on; also drives the arrow class. */\n readonly placement = input.required<TooltipPlacement>();\n /** Element `id`, referenced by the trigger's `aria-describedby`. */\n readonly panelId = input<string>('');\n}\n","import {\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n inject,\n input,\n} from '@angular/core';\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { TooltipPanelComponent } from './tooltip-panel.component';\nimport { prepareOverlayEnter } from '@ids-group-ltd/ids-design-system/components';\nimport type { TooltipPlacement } from './tooltip.types';\n\nlet nextId = 0;\n\n@Directive({\n selector: '[dsTooltip]',\n standalone: true,\n})\nexport class TooltipDirective implements OnDestroy {\n private readonly overlay = inject(Overlay);\n private readonly host = inject(ElementRef<HTMLElement>);\n\n /** Tip text. An empty string is how you turn the tooltip off — a host bound to a\n * value that may be blank needs no separate condition. */\n readonly dsTooltip = input<string>('');\n /** Which side the tip opens on. It does NOT flip: only the requested side is\n * offered to the overlay, so a tip with no room there is pushed rather than moved\n * to the opposite side. */\n readonly dsTooltipPlacement = input<TooltipPlacement>('top');\n /** Milliseconds before the tip appears. Hiding is immediate — this delay only ever\n * suppresses a tip the pointer passed over on its way somewhere else. */\n readonly dsTooltipDelay = input<number>(120);\n\n private ref: OverlayRef | null = null;\n private timer: number | null = null;\n private readonly tipId = `ds-tooltip-${++nextId}`;\n\n /**\n * Where `aria-describedby` belongs, when focus is involved. A host that is not\n * focusable itself never reaches a screen reader — `ds-menu-item` carries\n * `role=\"none\"` and puts the real `<button>` inside — so describing the host\n * describes something the user never focuses. `focusin` bubbles, so its target\n * IS whatever took focus; recording it is what keeps this directive out of the\n * host component's internal DOM. A pointer-only open leaves this null and\n * falls back to the host, where no screen reader is involved anyway.\n */\n private focusedTarget: HTMLElement | null = null;\n\n /**\n * Where `aria-describedby` was actually written, remembered so teardown strips\n * it from the same element. Not derivable at teardown: focus can arrive after\n * the panel opened (hover, then click or arrow onto it), which moves\n * `focusedTarget` and would otherwise strand the attribute on the host,\n * pointing at a panel that no longer exists.\n */\n private describedElement: HTMLElement | null = null;\n\n @HostListener('mouseenter')\n protected onPointerEnter(): void {\n this.scheduleShow();\n }\n\n @HostListener('focusin', ['$event'])\n protected onFocusIn(event: FocusEvent): void {\n if (event.target instanceof HTMLElement) {\n this.focusedTarget = event.target;\n }\n this.scheduleShow();\n }\n\n @HostListener('focusout')\n protected onFocusOut(): void {\n this.focusedTarget = null;\n this.onClose();\n }\n\n private scheduleShow(): void {\n if (!this.dsTooltip()) {\n return;\n }\n if (this.timer !== null) {\n clearTimeout(this.timer);\n }\n this.timer = window.setTimeout(() => this.show(), this.dsTooltipDelay());\n }\n\n // Close on activation too: clicking the thing the tip describes is a clear\n // dismiss, and a re-rendered anchor (e.g. a navigated sidenav item) under a\n // stationary cursor fires no mouseleave, which would otherwise strand the panel.\n @HostListener('mouseleave')\n @HostListener('click')\n protected onClose(): void {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this.disposeRef();\n }\n\n private disposeRef(): void {\n this.ref?.dispose();\n this.ref = null;\n const described = this.describedElement;\n if (!described) {\n return;\n }\n this.describedElement = null;\n const remaining = (described.getAttribute('aria-describedby') ?? '')\n .split(' ')\n .filter((id: string) => id && id !== this.tipId)\n .join(' ');\n if (remaining) {\n described.setAttribute('aria-describedby', remaining);\n } else {\n described.removeAttribute('aria-describedby');\n }\n }\n\n @HostListener('keydown.escape')\n protected onEscape(): void {\n if (this.ref) {\n this.onClose();\n }\n }\n\n private show(): void {\n // A re-render or re-entrant hover can call show() with a panel still open;\n // dispose it first so the OverlayRef isn't leaked and aria-describedby\n // doesn't accumulate the same id twice.\n this.disposeRef();\n const placement = this.dsTooltipPlacement();\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([this.positionFor(placement)]);\n\n this.ref = this.overlay.create({\n positionStrategy,\n panelClass: 'ds-overlay-pane',\n scrollStrategy: this.overlay.scrollStrategies.close(),\n });\n prepareOverlayEnter(this.ref, this.host.nativeElement, positionStrategy);\n\n const cmpRef = this.ref.attach(new ComponentPortal(TooltipPanelComponent));\n cmpRef.setInput('text', this.dsTooltip());\n cmpRef.setInput('placement', placement);\n cmpRef.setInput('panelId', this.tipId);\n const described = this.focusedTarget ?? this.host.nativeElement;\n this.describedElement = described;\n const existing = described.getAttribute('aria-describedby');\n described.setAttribute(\n 'aria-describedby',\n existing ? `${existing} ${this.tipId}` : this.tipId,\n );\n }\n\n private positionFor(placement: TooltipPlacement) {\n switch (placement) {\n case 'top':\n return {\n originX: 'center' as const,\n originY: 'top' as const,\n overlayX: 'center' as const,\n overlayY: 'bottom' as const,\n offsetY: -8,\n };\n case 'bottom':\n return {\n originX: 'center' as const,\n originY: 'bottom' as const,\n overlayX: 'center' as const,\n overlayY: 'top' as const,\n offsetY: 8,\n };\n case 'left':\n return {\n originX: 'start' as const,\n originY: 'center' as const,\n overlayX: 'end' as const,\n overlayY: 'center' as const,\n offsetX: -8,\n };\n case 'right':\n return {\n originX: 'end' as const,\n originY: 'center' as const,\n overlayX: 'start' as const,\n overlayY: 'center' as const,\n offsetX: 8,\n };\n }\n }\n\n ngOnDestroy(): void {\n this.onClose();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAkBa,qBAAqB,CAAA;;AAEvB,IAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,0EAAU;;AAE/B,IAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,+EAAoB;;AAE9C,IAAA,OAAO,GAAG,KAAK,CAAS,EAAE,8EAAC;wGANzB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAArB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,qBAAqB,ssBAZtB,CAAA,YAAA,CAAc,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,s4CAAA,CAAA,EAAA,CAAA;;4FAYb,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAfjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA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AA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,kBAAA,EAAA,EAAA,iBAAA,EAAA,oBAAA,EAAA,UAAA,EAAA,oBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,EAAA,iBAAA,EAAA,gBAAA,EAAA,UAAA,EAAA,gBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,YAAA,EAAA,kBAAA,EAAA,SAAA,EAAA,mBAAA,EAAA,UAAA,EAAA,cAAA,EAAA,YAAA,EAAA,WAAA,EAAA,OAAA,EAAA,WAAA,EAAA,gBAAA,EAAA,YAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAhB,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAJ5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;sBAwCE,YAAY;uBAAC,YAAY;;sBAKzB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC;;sBAQlC,YAAY;uBAAC,UAAU;;sBAmBvB,YAAY;uBAAC,YAAY;;sBACzB,YAAY;uBAAC,OAAO;;sBA4BpB,YAAY;uBAAC,gBAAgB;;;ACxHhC;;AAEG;;;;"}
1
+ {"version":3,"file":"ids-group-ltd-ids-design-system-components-tooltip.mjs","sources":["../../../src/lib/components/tooltip/tooltip-panel.component.ts","../../../src/lib/components/tooltip/tooltip.directive.ts","../../../src/lib/components/tooltip/ids-group-ltd-ids-design-system-components-tooltip.ts"],"sourcesContent":["import { Component, ViewEncapsulation, input } from '@angular/core';\nimport type { TooltipPlacement } from './tooltip.types';\n\n@Component({\n selector: 'ds-tooltip-panel',\n standalone: true,\n template: `{{ text() }}`,\n styleUrl: './tooltip-panel.component.scss',\n host: {\n role: 'tooltip',\n '[attr.id]': 'panelId()',\n '[class.top]': \"placement() === 'top'\",\n '[class.bottom]': \"placement() === 'bottom'\",\n '[class.left]': \"placement() === 'left'\",\n '[class.right]': \"placement() === 'right'\",\n },\n encapsulation: ViewEncapsulation.Emulated,\n})\nexport class TooltipPanelComponent {\n /** Tooltip text content. */\n readonly text = input.required<string>();\n /** Side of the trigger the panel is positioned on; also drives the arrow class. */\n readonly placement = input.required<TooltipPlacement>();\n /** Element `id`, referenced by the trigger's `aria-describedby`. */\n readonly panelId = input<string>('');\n}\n","import {\n Directive,\n ElementRef,\n HostListener,\n OnDestroy,\n booleanAttribute,\n inject,\n input,\n} from '@angular/core';\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { TooltipPanelComponent } from './tooltip-panel.component';\nimport { prepareOverlayEnter } from '@ids-group-ltd/ids-design-system/components';\nimport { isTextClipped } from '@ids-group-ltd/ids-design-system/core';\nimport type { TooltipPlacement } from './tooltip.types';\n\nconst TRIGGER_GAP_PX = 8;\n\nlet nextId = 0;\n\n@Directive({\n selector: '[dsTooltip]',\n standalone: true,\n})\nexport class TooltipDirective implements OnDestroy {\n private readonly overlay = inject(Overlay);\n private readonly host = inject(ElementRef<HTMLElement>);\n\n /** Tip text. An empty string is how you turn the tooltip off — a host bound to a\n * value that may be blank needs no separate condition. */\n readonly dsTooltip = input<string>('');\n /** Which side the tip opens on. It does NOT flip: only the requested side is\n * offered to the overlay, so a tip with no room there is pushed rather than moved\n * to the opposite side. */\n readonly dsTooltipPlacement = input<TooltipPlacement>('top');\n /** Milliseconds before the tip appears. Hiding is immediate — this delay only ever\n * suppresses a tip the pointer passed over on its way somewhere else. */\n readonly dsTooltipDelay = input<number>(120);\n /** Show the tip only while the host is actually showing less text than it holds. For a label\n * that already reads in full, a tip repeating it is noise. Re-tested on every open, so a tip\n * appears and stops appearing as the column, panel or window is resized, with no observer to\n * run.\n *\n * With this on, `dsTooltip` may be left empty and the host's own text is disclosed. That is\n * what makes it usable on projected content, where the component holding the tip cannot know\n * what it was handed. */\n readonly dsTooltipWhenClipped = input(false, { transform: booleanAttribute });\n\n private tipText(): string {\n const given = this.dsTooltip();\n if (given || !this.dsTooltipWhenClipped()) {\n return given;\n }\n\n return (this.host.nativeElement.textContent ?? '').trim();\n }\n\n private ref: OverlayRef | null = null;\n private timer: number | null = null;\n private readonly tipId = `ds-tooltip-${++nextId}`;\n\n /**\n * Where `aria-describedby` belongs, when focus is involved. A host that is not\n * focusable itself never reaches a screen reader — `ds-menu-item` carries\n * `role=\"none\"` and puts the real `<button>` inside — so describing the host\n * describes something the user never focuses. `focusin` bubbles, so its target\n * IS whatever took focus; recording it is what keeps this directive out of the\n * host component's internal DOM. A pointer-only open leaves this null and\n * falls back to the host, where no screen reader is involved anyway.\n */\n private focusedTarget: HTMLElement | null = null;\n\n /**\n * Where `aria-describedby` was actually written, remembered so teardown strips\n * it from the same element. Not derivable at teardown: focus can arrive after\n * the panel opened (hover, then click or arrow onto it), which moves\n * `focusedTarget` and would otherwise strand the attribute on the host,\n * pointing at a panel that no longer exists.\n */\n private describedElement: HTMLElement | null = null;\n\n @HostListener('mouseenter')\n protected onPointerEnter(): void {\n this.scheduleShow();\n }\n\n @HostListener('focusin', ['$event'])\n protected onFocusIn(event: FocusEvent): void {\n if (event.target instanceof HTMLElement) {\n this.focusedTarget = event.target;\n }\n this.scheduleShow();\n }\n\n @HostListener('focusout')\n protected onFocusOut(): void {\n this.focusedTarget = null;\n this.onClose();\n }\n\n private scheduleShow(): void {\n if (!this.tipText()) {\n return;\n }\n if (\n this.dsTooltipWhenClipped() &&\n !isTextClipped(this.host.nativeElement)\n ) {\n return;\n }\n if (this.timer !== null) {\n clearTimeout(this.timer);\n }\n this.timer = window.setTimeout(() => this.show(), this.dsTooltipDelay());\n }\n\n // Close on activation too: clicking the thing the tip describes is a clear\n // dismiss, and a re-rendered anchor (e.g. a navigated sidenav item) under a\n // stationary cursor fires no mouseleave, which would otherwise strand the panel.\n @HostListener('mouseleave')\n @HostListener('click')\n protected onClose(): void {\n if (this.timer !== null) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this.disposeRef();\n }\n\n private disposeRef(): void {\n this.ref?.dispose();\n this.ref = null;\n const described = this.describedElement;\n if (!described) {\n return;\n }\n this.describedElement = null;\n const remaining = (described.getAttribute('aria-describedby') ?? '')\n .split(' ')\n .filter((id: string) => id && id !== this.tipId)\n .join(' ');\n if (remaining) {\n described.setAttribute('aria-describedby', remaining);\n } else {\n described.removeAttribute('aria-describedby');\n }\n }\n\n @HostListener('keydown.escape')\n protected onEscape(): void {\n if (this.ref) {\n this.onClose();\n }\n }\n\n private show(): void {\n // A re-render or re-entrant hover can call show() with a panel still open;\n // dispose it first so the OverlayRef isn't leaked and aria-describedby\n // doesn't accumulate the same id twice.\n this.disposeRef();\n const placement = this.dsTooltipPlacement();\n const positionStrategy = this.overlay\n .position()\n .flexibleConnectedTo(this.host)\n .withPositions([this.positionFor(placement)]);\n\n this.ref = this.overlay.create({\n positionStrategy,\n panelClass: 'ds-overlay-pane',\n scrollStrategy: this.overlay.scrollStrategies.close(),\n });\n prepareOverlayEnter(this.ref, this.host.nativeElement, positionStrategy);\n\n const cmpRef = this.ref.attach(new ComponentPortal(TooltipPanelComponent));\n cmpRef.setInput('text', this.tipText());\n cmpRef.setInput('placement', placement);\n cmpRef.setInput('panelId', this.tipId);\n const described = this.focusedTarget ?? this.host.nativeElement;\n this.describedElement = described;\n const existing = described.getAttribute('aria-describedby');\n described.setAttribute(\n 'aria-describedby',\n existing ? `${existing} ${this.tipId}` : this.tipId,\n );\n }\n\n private positionFor(placement: TooltipPlacement) {\n switch (placement) {\n case 'top':\n return {\n originX: 'center' as const,\n originY: 'top' as const,\n overlayX: 'center' as const,\n overlayY: 'bottom' as const,\n offsetY: -TRIGGER_GAP_PX,\n };\n case 'bottom':\n return {\n originX: 'center' as const,\n originY: 'bottom' as const,\n overlayX: 'center' as const,\n overlayY: 'top' as const,\n offsetY: TRIGGER_GAP_PX,\n };\n case 'left':\n return {\n originX: 'start' as const,\n originY: 'center' as const,\n overlayX: 'end' as const,\n overlayY: 'center' as const,\n offsetX: -TRIGGER_GAP_PX,\n };\n case 'right':\n return {\n originX: 'end' as const,\n originY: 'center' as const,\n overlayX: 'start' as const,\n overlayY: 'center' as const,\n offsetX: TRIGGER_GAP_PX,\n };\n }\n }\n\n ngOnDestroy(): void {\n this.onClose();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAkBa,qBAAqB,CAAA;;AAEvB,IAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,0EAAU;;AAE/B,IAAA,SAAS,GAAG,KAAK,CAAC,QAAQ,+EAAoB;;AAE9C,IAAA,OAAO,GAAG,KAAK,CAAS,EAAE,8EAAC;wGANzB,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAArB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,IAAA,EAAA,qBAAqB,ssBAZtB,CAAA,YAAA,CAAc,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,s4CAAA,CAAA,EAAA,CAAA;;4FAYb,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAfjC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,kBAAkB,EAAA,UAAA,EAChB,IAAI,EAAA,QAAA,EACN,CAAA,YAAA,CAAc,EAAA,IAAA,EAElB;AACJ,wBAAA,IAAI,EAAE,SAAS;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5B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;sBA0DE,YAAY;uBAAC,YAAY;;sBAKzB,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC;;sBAQlC,YAAY;uBAAC,UAAU;;sBAyBvB,YAAY;uBAAC,YAAY;;sBACzB,YAAY;uBAAC,OAAO;;sBA4BpB,YAAY;uBAAC,gBAAgB;;;ACpJhC;;AAEG;;;;"}
@@ -1,8 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, computed, signal, untracked, afterRenderEffect, TemplateRef, Directive, Injector, DestroyRef, afterNextRender, isDevMode, input, booleanAttribute, effect, ElementRef, DOCUMENT } from '@angular/core';
2
+ import { inject, computed, signal, PLATFORM_ID, DestroyRef, untracked, afterRenderEffect, TemplateRef, Directive, Injector, afterNextRender, isDevMode, input, booleanAttribute, effect, ElementRef, DOCUMENT } from '@angular/core';
3
3
  import { DS_CONFIG } from '@ids-group-ltd/ids-design-system/core';
4
+ import { isPlatformBrowser } from '@angular/common';
4
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
6
  import { NgForm, FormGroupDirective, NgControl } from '@angular/forms';
7
+ import { Router, ActivatedRoute, UrlTree } from '@angular/router';
6
8
 
7
9
  /**
8
10
  * Resolve one brand string against the app-level default. `ds-sidenav` and
@@ -19,6 +21,316 @@ function resolveBrandValue(value, key) {
19
21
  return computed(() => value() ?? config.brand?.[key] ?? '');
20
22
  }
21
23
 
24
+ // GENERATED by tools/generate-chart-palette.mjs. Do not edit. Values are var()
25
+ // references, not resolved colours, so a consumer overriding the token still wins
26
+ // at runtime.
27
+ /** @internal Exported for the chart entry points that import it across the boundary;
28
+ * not part of the package surface. */
29
+ const chartColors = {
30
+ series1: 'var(--ds-chart-series-1-color)',
31
+ series2: 'var(--ds-chart-series-2-color)',
32
+ series3: 'var(--ds-chart-series-3-color)',
33
+ series4: 'var(--ds-chart-series-4-color)',
34
+ series5: 'var(--ds-chart-series-5-color)',
35
+ series6: 'var(--ds-chart-series-6-color)',
36
+ series7: 'var(--ds-chart-series-7-color)',
37
+ series8: 'var(--ds-chart-series-8-color)',
38
+ seriesDefault: 'var(--ds-chart-series-default-color)',
39
+ seriesAccent: 'var(--ds-chart-series-accent-color)',
40
+ ramp1: 'var(--ds-chart-ramp-1-color)',
41
+ ramp2: 'var(--ds-chart-ramp-2-color)',
42
+ ramp3: 'var(--ds-chart-ramp-3-color)',
43
+ ramp4: 'var(--ds-chart-ramp-4-color)',
44
+ ramp5: 'var(--ds-chart-ramp-5-color)',
45
+ ramp6: 'var(--ds-chart-ramp-6-color)',
46
+ ramp7: 'var(--ds-chart-ramp-7-color)',
47
+ ramp8: 'var(--ds-chart-ramp-8-color)',
48
+ };
49
+ /** @internal See chartColors. */
50
+ const CHART_SERIES_COLORS = [
51
+ chartColors.series1,
52
+ chartColors.series2,
53
+ chartColors.series3,
54
+ chartColors.series4,
55
+ chartColors.series5,
56
+ chartColors.series6,
57
+ chartColors.series7,
58
+ chartColors.series8,
59
+ ];
60
+ /** @internal See chartColors. */
61
+ const CHART_RAMP_COLORS = [
62
+ chartColors.ramp1,
63
+ chartColors.ramp2,
64
+ chartColors.ramp3,
65
+ chartColors.ramp4,
66
+ chartColors.ramp5,
67
+ chartColors.ramp6,
68
+ chartColors.ramp7,
69
+ chartColors.ramp8,
70
+ ];
71
+
72
+ const numberFormatters = new Map();
73
+ function numberFormatter(locale) {
74
+ const key = locale ?? 'default';
75
+ let formatter = numberFormatters.get(key);
76
+ if (!formatter) {
77
+ formatter = new Intl.NumberFormat(locale);
78
+ numberFormatters.set(key, formatter);
79
+ }
80
+ return formatter;
81
+ }
82
+ /** @internal */
83
+ function formatValue(value, locale) {
84
+ if (!Number.isFinite(value)) {
85
+ return '—';
86
+ }
87
+ return numberFormatter(locale).format(value);
88
+ }
89
+ /** @internal */
90
+ function formatPercent(value, total) {
91
+ if (!total || !Number.isFinite(value) || !Number.isFinite(total)) {
92
+ return '—';
93
+ }
94
+ const percent = (value / total) * 100;
95
+ // A real share must never print as an exact zero: at one decimal, 214 of 987,654,321 rounds to
96
+ // "0.0%" beside a bar too short to see, and the row reads as nothing when it is not nothing.
97
+ if (percent !== 0 && Math.abs(percent) < 0.05) {
98
+ return percent > 0 ? '<0.1%' : '>-0.1%';
99
+ }
100
+ return `${percent.toFixed(1)}%`;
101
+ }
102
+ /** Whole percentages that sum to exactly 100. Rounding each share on its own
103
+ * gives 33/33/33 for three equal parts, and a legend that visibly loses 1%.
104
+ *
105
+ * @internal Exported for the chart entry points; not part of the package surface. */
106
+ function largestRemainder(values) {
107
+ const total = values.reduce((sum, value) => sum + value, 0);
108
+ if (!total) {
109
+ return values.map(() => 0);
110
+ }
111
+ const exact = values.map((value) => (value / total) * 100);
112
+ const floors = exact.map(Math.floor);
113
+ let remaining = 100 - floors.reduce((sum, value) => sum + value, 0);
114
+ const order = exact
115
+ .map((value, index) => ({ index, fraction: value - Math.floor(value) }))
116
+ .sort((a, b) => b.fraction - a.fraction);
117
+ const result = [...floors];
118
+ for (const { index } of order) {
119
+ if (remaining <= 0) {
120
+ break;
121
+ }
122
+ result[index]++;
123
+ remaining--;
124
+ }
125
+ return result;
126
+ }
127
+ /** @internal */
128
+ function formatTick(value, step) {
129
+ if (!Number.isFinite(value)) {
130
+ return '';
131
+ }
132
+ if (Math.abs(value) < 1000) {
133
+ return String(value);
134
+ }
135
+ // The unit follows the STEP, not the value, so every label on one axis carries the same suffix:
136
+ // a step of 200M labels 1e9 as 1000M, never 1B beside 800M.
137
+ const units = [
138
+ { suffix: 'B', scale: 1e9 },
139
+ { suffix: 'M', scale: 1e6 },
140
+ { suffix: 'K', scale: 1e3 },
141
+ ];
142
+ const unit = units.find((candidate) => Math.abs(step) >= candidate.scale) ?? units[2];
143
+ const scaled = value / unit.scale;
144
+ // A step that divides its unit evenly needs no decimal; one that does not needs exactly one on
145
+ // EVERY label, so an axis reads 1.0K · 1.5K · 2.0K rather than mixing 1K with 1.5K. Rounding the
146
+ // whole branch matters too: a caller passing a raw datum instead of a tick would otherwise print
147
+ // every digit of the division, as 987.654321M.
148
+ return step % unit.scale === 0
149
+ ? `${Math.round(scaled)}${unit.suffix}`
150
+ : `${scaled.toFixed(1)}${unit.suffix}`;
151
+ }
152
+
153
+ /** Container width as a signal. It is 0 under SSR, while the container is
154
+ * `display: none`, and before the first observation.
155
+ *
156
+ * @internal */
157
+ function elementWidth(host) {
158
+ const width = signal(0, ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
159
+ if (!isPlatformBrowser(inject(PLATFORM_ID))) {
160
+ return width.asReadonly();
161
+ }
162
+ const observer = new ResizeObserver((entries) => {
163
+ width.set(Math.round(entries[0]?.contentRect.width ?? 0));
164
+ });
165
+ observer.observe(host.nativeElement);
166
+ inject(DestroyRef).onDestroy(() => observer.disconnect());
167
+ return width.asReadonly();
168
+ }
169
+
170
+ const E10 = Math.sqrt(50);
171
+ const E5 = Math.sqrt(10);
172
+ const E2 = Math.sqrt(2);
173
+ /** d3's tick-increment rule. A naive `max / count` produces steps like 482, which
174
+ * no reader parses; this snaps to 1, 2, 5 or 10 times a power of ten. */
175
+ function tickIncrement(domainMax, targetCount) {
176
+ const step = domainMax / Math.max(1, targetCount);
177
+ const power = Math.floor(Math.log10(step));
178
+ const error = step / Math.pow(10, power);
179
+ const factor = error >= E10 ? 10 : error >= E5 ? 5 : error >= E2 ? 2 : 1;
180
+ return factor * Math.pow(10, power);
181
+ }
182
+ /** @internal */
183
+ function tickValues(domainMax, targetCount) {
184
+ if (!Number.isFinite(domainMax) || domainMax <= 0) {
185
+ return [0];
186
+ }
187
+ const step = tickIncrement(domainMax, targetCount);
188
+ const out = [];
189
+ for (let i = 0; i <= Math.ceil(domainMax / step); i++) {
190
+ out.push(i * step);
191
+ }
192
+ return out;
193
+ }
194
+ /** @internal */
195
+ function niceMax(domainMax, targetCount) {
196
+ if (!Number.isFinite(domainMax) || domainMax <= 0) {
197
+ return 0;
198
+ }
199
+ const step = tickIncrement(domainMax, targetCount);
200
+ return Math.ceil(domainMax / step) * step;
201
+ }
202
+ /** Distance between two ticks, which `formatTick` needs to pick a precision. A
203
+ * degenerate series yields a single tick and therefore no step.
204
+ *
205
+ * @internal */
206
+ function tickStep(ticks) {
207
+ return ticks.length > 1 ? ticks[1] - ticks[0] : 0;
208
+ }
209
+ /** @internal */
210
+ function linearScale(domainMax, rangeSize) {
211
+ if (!Number.isFinite(domainMax) || domainMax <= 0) {
212
+ return () => 0;
213
+ }
214
+ return (value) => (value / domainMax) * rangeSize;
215
+ }
216
+ /** @internal */
217
+ function bandScale(count, rangeSize, paddingRatio) {
218
+ if (count <= 0) {
219
+ return {
220
+ bandWidth: 0,
221
+ step: 0,
222
+ count: 0,
223
+ position: () => 0,
224
+ indexAt: () => -1,
225
+ };
226
+ }
227
+ const step = rangeSize / count;
228
+ const bandWidth = step * (1 - paddingRatio);
229
+ return {
230
+ bandWidth,
231
+ step,
232
+ count,
233
+ position: (index) => step * index + (step - bandWidth) / 2,
234
+ indexAt: (offset) => Math.min(count - 1, Math.max(0, Math.floor(offset / step))),
235
+ };
236
+ }
237
+
238
+ // Past this the entrance stops reading as one gesture and starts reading as a queue: at 40ms a
239
+ // 100-mark series would otherwise take four seconds to finish arriving.
240
+ const STAGGER_CAP_MS = 300;
241
+ /** Entrance delay for the mark at `index`, in milliseconds. `stepMs` of `0` is the default and
242
+ * means no stagger at all.
243
+ *
244
+ * @internal */
245
+ function staggerDelay(index, stepMs) {
246
+ if (!(stepMs > 0) || !Number.isFinite(index) || index <= 0) {
247
+ return 0;
248
+ }
249
+ return Math.min(index * stepMs, STAGGER_CAP_MS);
250
+ }
251
+
252
+ /** Where a roving tabindex lands after `key`, or `null` when the key does not traverse.
253
+ *
254
+ * The ends wrap, as they do in `ds-radio-group`: a chart's marks are a closed set, and Home and
255
+ * End are the direct way to either extreme.
256
+ *
257
+ * @internal */
258
+ function nextRovingIndex(key, current, count) {
259
+ if (!Number.isFinite(count) || count <= 0) {
260
+ return null;
261
+ }
262
+ switch (key) {
263
+ case 'ArrowRight':
264
+ case 'ArrowDown':
265
+ return (current + 1) % count;
266
+ case 'ArrowLeft':
267
+ case 'ArrowUp':
268
+ return (current - 1 + count) % count;
269
+ case 'Home':
270
+ return 0;
271
+ case 'End':
272
+ return count - 1;
273
+ default:
274
+ return null;
275
+ }
276
+ }
277
+ /** Moves DOM focus to the mark `index` within `scope`, which is what makes the roving tabindex a
278
+ * traversal rather than a state change nobody can see. `within` narrows the search for a chart
279
+ * whose marks repeat the same index once per series.
280
+ *
281
+ * @internal */
282
+ function focusMark(scope, index, within = '') {
283
+ const target = scope?.querySelector(`${within}[data-mark-index="${index}"]`);
284
+ if (target instanceof HTMLElement || target instanceof SVGElement) {
285
+ target.focus();
286
+ }
287
+ }
288
+
289
+ function trendOf(values) {
290
+ const first = values[0];
291
+ const last = values[values.length - 1];
292
+ const rose = values.every((value, index) => index === 0 || value > values[index - 1]);
293
+ const fell = values.every((value, index) => index === 0 || value < values[index - 1]);
294
+ if (rose) {
295
+ return 'Rising throughout';
296
+ }
297
+ if (fell) {
298
+ return 'Falling throughout';
299
+ }
300
+ if (last > first) {
301
+ return 'Rising overall';
302
+ }
303
+ if (last < first) {
304
+ return 'Falling overall';
305
+ }
306
+ return 'Ending where it started';
307
+ }
308
+ /** The sentence a screen reader gets as the chart's accessible name. Generated rather than
309
+ * required, because a required one is a field that gets left at the component's default and then
310
+ * lies.
311
+ *
312
+ * The ORDER is the contract: what the chart is and its scale, then the trend, then the extremes,
313
+ * then where the numbers are. Blind readers rank a recital of the encoding lowest of the four
314
+ * levels of chart description, and the encoding is the one thing a screen-reader user cannot use.
315
+ *
316
+ * @internal */
317
+ function describeSeries(label, points, format = formatValue, tableFollows = true) {
318
+ const pointer = tableFollows ? ' Full values in the table below.' : '';
319
+ if (points.length === 0) {
320
+ return `${label}. No data.`;
321
+ }
322
+ if (points.length === 1) {
323
+ return `${label}, one point: ${format(points[0].value)} at ${points[0].label}.${pointer}`;
324
+ }
325
+ const lowest = points.reduce((min, point) => point.value < min.value ? point : min);
326
+ const highest = points.reduce((max, point) => point.value > max.value ? point : max);
327
+ return (`${label}, ${points.length} points, ` +
328
+ `${format(lowest.value)} to ${format(highest.value)}. ` +
329
+ `${trendOf(points.map((point) => point.value))}. ` +
330
+ `Highest in ${highest.label} at ${format(highest.value)}, ` +
331
+ `lowest in ${lowest.label} at ${format(lowest.value)}.${pointer}`);
332
+ }
333
+
22
334
  /**
23
335
  * @fileoverview How many chips fit one line of a trigger, measured rather than
24
336
  * guessed.
@@ -312,9 +624,14 @@ function resolveFieldMessage(sources) {
312
624
  }, ...(ngDevMode ? [{ debugName: "advisoryText" }] : /* istanbul ignore next */ []));
313
625
  // Advisory errors are deliberately absent: a warning does not make a control
314
626
  // invalid, so it never sets aria-invalid and never blocks a submit guard.
315
- const invalid = computed(() => sources.invalid() ||
316
- sources.error().length > 0 ||
317
- (blocking().length > 0 && interacted()), ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
627
+ // Disabled wins over every source of invalidity. Measured in Chrome's accessibility tree:
628
+ // `aria-invalid` on a NATIVELY disabled input still reports invalid=true and the node is not
629
+ // ignored, so disabling does not make the attribute inert — the reader still hears "invalid" on
630
+ // a control they cannot act on.
631
+ const invalid = computed(() => !(sources.disabled?.() ?? false) &&
632
+ (sources.invalid() ||
633
+ sources.error().length > 0 ||
634
+ (blocking().length > 0 && interacted())), ...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
318
635
  // Message inputs trim via `trimmedText`, so a non-empty string here is real
319
636
  // text — a new one declared without that transform breaks this quietly.
320
637
  const message = computed(() => {
@@ -726,6 +1043,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
726
1043
  }]
727
1044
  }] });
728
1045
 
1046
+ // The query string is a subset match and the fragment is ignored in both: a sort order, a page
1047
+ // number or an open accordion does not make it a different page.
1048
+ const EXACT_PATH = {
1049
+ paths: 'exact',
1050
+ queryParams: 'subset',
1051
+ fragment: 'ignored',
1052
+ matrixParams: 'ignored',
1053
+ };
1054
+ const PREFIX_PATH = {
1055
+ ...EXACT_PATH,
1056
+ paths: 'subset',
1057
+ };
729
1058
  /**
730
1059
  * No destination is a `<button>`, never an `<a href="#">`: a `#` href navigates, rewriting the URL
731
1060
  * and discarding the scroll position. Only the decision is shared — each control keeps its own
@@ -741,6 +1070,65 @@ function dsDestination(routerLink, href) {
741
1070
  return href() ? 'href' : 'button';
742
1071
  });
743
1072
  }
1073
+ /**
1074
+ * What a navigating control should announce, distinguishing the two things `routerLinkActive`
1075
+ * cannot tell apart.
1076
+ *
1077
+ * `routerLinkActive` matches by PREFIX, so deriving `aria-current="page"` from it makes a
1078
+ * "back to the section" link claim to be the page the reader is already on. ARIA separates the
1079
+ * two: `page` is the page you are on, `true` is the current section or an ancestor of it. So an
1080
+ * exact match announces `page`, a prefix match announces `true`, and anything else stays silent —
1081
+ * which is correct for a button and for a sidenav item without a branch between them.
1082
+ *
1083
+ * Feed the result to `RouterLinkActive.ariaCurrentWhenActive`, never to `[attr.aria-current]`: the
1084
+ * directive removes that attribute from its host in a microtask whenever its own input is unset,
1085
+ * so a template binding is written and then silently wiped. Consequence worth knowing — a narrowed
1086
+ * `routerLinkActiveOptions` narrows the announcement with it, because the directive writes nothing
1087
+ * while it considers the link inactive.
1088
+ *
1089
+ * Must be called from an injection context. Outside a router it returns the override or `null`,
1090
+ * so a control can render with no router present.
1091
+ *
1092
+ * @internal
1093
+ */
1094
+ function dsAriaCurrent(routerLink, modifiers, override) {
1095
+ const router = inject(Router, { optional: true });
1096
+ // `RouterLink` resolves its commands against the route it sits on, so a relative destination
1097
+ // (`routerLink="."`, `['..', 'sibling']`) means something different from the root. Resolving it
1098
+ // here without the same base would make `.` land on `/` — a prefix of every page, so the item
1099
+ // that IS the current page would announce `true` instead of `page`.
1100
+ const route = inject(ActivatedRoute, { optional: true });
1101
+ return computed(() => {
1102
+ // `null` is the consumer's way of saying "announce nothing"; the directive spells that
1103
+ // `undefined`, so the two meet here rather than at every call site.
1104
+ const explicit = override();
1105
+ if (explicit !== undefined) {
1106
+ return explicit ?? undefined;
1107
+ }
1108
+ const link = routerLink();
1109
+ if (!router || link === null) {
1110
+ return undefined;
1111
+ }
1112
+ const tree = link instanceof UrlTree
1113
+ ? link
1114
+ : router.createUrlTree(Array.isArray(link) ? [...link] : [link], {
1115
+ relativeTo: route ?? undefined,
1116
+ ...modifiers(),
1117
+ });
1118
+ // `lastSuccessfulNavigation` is only the reactive trigger. The comparison goes through
1119
+ // `Router.isActive`, which reads the LIVE url: the standalone `isActive()` helper compares
1120
+ // against that navigation's `finalUrl` instead, and an app that rewrites its path without
1121
+ // navigating — a docs page tracking the section under the reader, a wizard naming its step —
1122
+ // then keeps announcing the page it landed on. Deprecated in 21.1, and nothing public replaces
1123
+ // the live-url comparison.
1124
+ router.lastSuccessfulNavigation();
1125
+ return router.isActive(tree, EXACT_PATH)
1126
+ ? 'page'
1127
+ : router.isActive(tree, PREFIX_PATH)
1128
+ ? true
1129
+ : undefined;
1130
+ });
1131
+ }
744
1132
 
745
1133
  /**
746
1134
  * Replaces a picker panel's "no matches" row — an icon, a sentence in the app's
@@ -1376,5 +1764,5 @@ function createTypeAhead() {
1376
1764
  * Generated bundle index. Do not edit.
1377
1765
  */
1378
1766
 
1379
- export { DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, disposeWithLeave, dropdownOverlay, dsDestination, focusIsInside, forwardOverlayTokens, nextControlId, overlayPlacementOf, prepareOverlayEnter, resolveBrandValue, resolveFieldMessage, scrollActiveOptionIntoView, trimmedText, valueControlBridge };
1767
+ export { CHART_RAMP_COLORS, CHART_SERIES_COLORS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, bandScale, chartColors, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, describeSeries, disposeWithLeave, dropdownOverlay, dsAriaCurrent, dsDestination, elementWidth, focusIsInside, focusMark, formatPercent, formatTick, formatValue, forwardOverlayTokens, largestRemainder, linearScale, nextControlId, nextRovingIndex, niceMax, overlayPlacementOf, prepareOverlayEnter, resolveBrandValue, resolveFieldMessage, scrollActiveOptionIntoView, staggerDelay, tickStep, tickValues, trimmedText, valueControlBridge };
1380
1768
  //# sourceMappingURL=ids-group-ltd-ids-design-system-components.mjs.map