@ids-group-ltd/ids-design-system 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/CHANGELOG.md +289 -0
  2. package/agent/INDEX.md +1 -1
  3. package/agent/feedback/ds-alert.md +3 -2
  4. package/agent/feedback/ds-chat-message.md +3 -3
  5. package/agent/feedback/ds-chat-step.md +1 -1
  6. package/agent/feedback/ds-chat-steps.md +1 -1
  7. package/agent/feedback/ds-chat-thread.md +2 -2
  8. package/agent/feedback/ds-empty-state.md +2 -1
  9. package/agent/feedback/ds-tree.md +4 -2
  10. package/agent/forms/ds-chat-input.md +3 -3
  11. package/agent/foundations/tokens.md +2 -2
  12. package/agent/navigation/ds-splitter.md +1 -1
  13. package/components.md +22 -18
  14. package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +5 -3
  15. package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
  16. package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +2 -2
  17. package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
  18. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +2 -2
  19. package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
  20. package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +2 -2
  21. package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
  22. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +2 -2
  23. package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
  24. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +2 -2
  25. package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
  26. package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs +184 -72
  27. package/fesm2022/ids-group-ltd-ids-design-system-components-chat.mjs.map +1 -1
  28. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +2 -2
  29. package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -1
  30. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +2 -2
  31. package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
  32. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +2 -2
  33. package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
  34. package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +2 -2
  35. package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
  36. package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +14 -7
  37. package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -1
  38. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +2 -2
  39. package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -1
  40. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +2 -2
  41. package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
  42. package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +4 -4
  43. package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
  44. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +2 -2
  45. package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
  46. package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +2 -2
  47. package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
  48. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +2 -2
  49. package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
  50. package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +23 -12
  51. package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -1
  52. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +2 -2
  53. package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -1
  54. package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +2 -2
  55. package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -1
  56. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +2 -2
  57. package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -1
  58. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +2 -2
  59. package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
  60. package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs +116 -10
  61. package/fesm2022/ids-group-ltd-ids-design-system-components-splitter.mjs.map +1 -1
  62. package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +2 -2
  63. package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
  64. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +2 -2
  65. package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -1
  66. package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +2 -2
  67. package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
  68. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +2 -2
  69. package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
  70. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +4 -2
  71. package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
  72. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +2 -2
  73. package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
  74. package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +2 -2
  75. package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -1
  76. package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +2 -2
  77. package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -1
  78. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +4 -19
  79. package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -1
  80. package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +84 -9
  81. package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -1
  82. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +31 -4
  83. package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
  84. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +33 -0
  85. package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
  86. package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +4 -2
  87. package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -1
  88. package/fesm2022/ids-group-ltd-ids-design-system.mjs +1 -1
  89. package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
  90. package/migrations/0.11.2.json +1 -0
  91. package/migrations/1.0.1.json +4 -0
  92. package/migrations/1.0.2.json +9 -1
  93. package/migrations/1.1.0.json +25 -0
  94. package/migrations/1.1.1.json +190 -0
  95. package/migrations/1.1.2.json +135 -0
  96. package/migrations/README.md +9 -7
  97. package/package.json +4 -1
  98. package/schematics/check-overrides/surface.json +29 -3
  99. package/stylelint/index.mjs +17 -3
  100. package/stylelint/known-tokens.mjs +139 -0
  101. package/stylelint/report.mjs +185 -0
  102. package/stylelint/tokens.mjs +160 -0
  103. package/stylelint/use-tokens.mjs +397 -0
  104. package/styles/_check-box.scss +2 -2
  105. package/styles/_dropdown-overlay.scss +5 -2
  106. package/styles/_field-box.scss +2 -2
  107. package/styles/_tokens.scss +8 -0
  108. package/themes/README.md +1 -1
  109. package/themes/_semantic.scss +13 -0
  110. package/themes/dark/_theme.scss +15 -3
  111. package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +3 -1
  112. package/types/ids-group-ltd-ids-design-system-components-chat.d.ts +58 -5
  113. package/types/ids-group-ltd-ids-design-system-components-empty-state.d.ts +7 -2
  114. package/types/ids-group-ltd-ids-design-system-components-splitter.d.ts +15 -1
  115. package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +2 -0
  116. package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +57 -3
  117. package/types/ids-group-ltd-ids-design-system-components.d.ts +8 -4
  118. package/types/ids-group-ltd-ids-design-system-core.d.ts +40 -0
  119. package/types/ids-group-ltd-ids-design-system.d.ts +3 -3
@@ -1,7 +1,43 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, TemplateRef, Directive, ElementRef, input, model, output, contentChild, signal, computed, afterEveryRender, ViewEncapsulation, Component } from '@angular/core';
2
+ import { inject, TemplateRef, Directive, ElementRef, input, model, booleanAttribute, output, contentChild, signal, computed, afterEveryRender, afterNextRender, ViewEncapsulation, Component } from '@angular/core';
3
3
  import { NgTemplateOutlet } from '@angular/common';
4
4
  import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
5
+ import { DS_INTL, DS_INTL_DEFAULTS } from '@ids-group-ltd/ids-design-system/core';
6
+
7
+ /**
8
+ * Content drawn in place of a `ds-tree` row's label, for a label of more than one line or one
9
+ * that mixes styles.
10
+ *
11
+ * ```html
12
+ * <ds-tree [nodes]="layers">
13
+ * <ng-template dsTreeLabel let-node>
14
+ * <span class="tag">{{ tags[node.id] }}</span>
15
+ * <span class="text">{{ node.label }}</span>
16
+ * </ng-template>
17
+ * </ds-tree>
18
+ * ```
19
+ *
20
+ * The row grows to the template's height and the label takes the width between the icon and
21
+ * the trailing content, so an element inside it can cut its text with an ellipsis. The text the
22
+ * template renders is the row's accessible name; a template that draws no text needs a
23
+ * visually hidden element with the name in it. A click inside it selects the row as a click on
24
+ * the default label does.
25
+ */
26
+ class TreeLabelDirective {
27
+ template = inject(TemplateRef);
28
+ static ngTemplateContextGuard(_directive, _context) {
29
+ return true;
30
+ }
31
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeLabelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
32
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.22", type: TreeLabelDirective, isStandalone: true, selector: "ng-template[dsTreeLabel]", ngImport: i0 });
33
+ }
34
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeLabelDirective, decorators: [{
35
+ type: Directive,
36
+ args: [{
37
+ selector: 'ng-template[dsTreeLabel]',
38
+ standalone: true,
39
+ }]
40
+ }] });
5
41
 
6
42
  /**
7
43
  * Content drawn at the end of every `ds-tree` row: a badge, a count, a small icon button.
@@ -39,6 +75,7 @@ const PARKED_TABINDEX = 'data-ds-tree-tabindex';
39
75
  let nextId = 0;
40
76
  class TreeComponent {
41
77
  host = inject(ElementRef);
78
+ intl = inject(DS_INTL);
42
79
  /** Root-level nodes; nest via `children`. */
43
80
  nodes = input([], ...(ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []));
44
81
  /** Ids of the expanded nodes. */
@@ -49,15 +86,31 @@ class TreeComponent {
49
86
  selectedId = model(null, ...(ngDevMode ? [{ debugName: "selectedId" }] : /* istanbul ignore next */ []));
50
87
  /** Ids of the selected nodes, in `'multiple'` selection. */
51
88
  selectedIds = model([], ...(ngDevMode ? [{ debugName: "selectedIds" }] : /* istanbul ignore next */ []));
89
+ /** What expands and collapses a parent. `'row'`: activating the row (click, Enter, Space) selects
90
+ * it and toggles it. `'caret'`: activating the row only selects it, and the chevron is a button of
91
+ * its own that toggles. `'doubleClick'`: a click selects, a double click toggles. In every mode
92
+ * ArrowRight expands and ArrowLeft collapses the focused row. */
93
+ toggleOn = input('row', ...(ngDevMode ? [{ debugName: "toggleOn" }] : /* istanbul ignore next */ []));
94
+ /** Rows slide open and shut and the chevron turns when a parent expands or collapses. Off under
95
+ * `prefers-reduced-motion: reduce`. */
96
+ animate = input(true, { ...(ngDevMode ? { debugName: "animate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
52
97
  /** Fires with the node when a row is selected (click or Enter/Space), not when one is deselected. */
53
98
  nodeSelected = output();
54
99
  /** Fires with the node under the pointer or newly focused, and `null` when the pointer leaves the tree. */
55
100
  nodeHover = output();
101
+ label = contentChild(TreeLabelDirective, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
56
102
  trailing = contentChild(TreeTrailingDirective, ...(ngDevMode ? [{ debugName: "trailing" }] : /* istanbul ignore next */ []));
57
103
  idPrefix = `ds-tree-${++nextId}`;
58
104
  activeId = signal(null, ...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
59
105
  hoveredId = null;
106
+ // The rows of the first render are not revealed by a toggle, so they appear without motion.
107
+ rendered = signal(false, ...(ngDevMode ? [{ debugName: "rendered" }] : /* istanbul ignore next */ []));
108
+ motion = computed(() => this.animate() && this.rendered(), ...(ngDevMode ? [{ debugName: "motion" }] : /* istanbul ignore next */ []));
60
109
  multiple = computed(() => this.selection() === 'multiple', ...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
110
+ labels = computed(() => ({
111
+ ...DS_INTL_DEFAULTS.tree,
112
+ ...this.intl().tree,
113
+ }), ...(ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []));
61
114
  visibleNodes = computed(() => {
62
115
  const out = [];
63
116
  const walk = (list, level) => {
@@ -78,6 +131,7 @@ class TreeComponent {
78
131
  // Content inside a trailing template can change without a signal of the tree changing,
79
132
  // so its tab stops are re-parked after every render.
80
133
  afterEveryRender({ write: () => this.parkTrailingTabStops() });
134
+ afterNextRender(() => this.rendered.set(true));
81
135
  }
82
136
  isExpanded(id) {
83
137
  return this.expandedIds().has(id);
@@ -91,11 +145,31 @@ class TreeComponent {
91
145
  return this.effectiveActiveId() === id;
92
146
  }
93
147
  onRowClick(entry, event) {
94
- if (this.fromTrailing(event)) {
148
+ // The second click of a double click belongs to the toggle, not to a second selection.
149
+ if (this.fromTrailing(event) ||
150
+ (this.toggleOn() === 'doubleClick' && event.detail > 1)) {
95
151
  return;
96
152
  }
97
153
  this.activate(entry, event.shiftKey || event.ctrlKey || event.metaKey);
98
154
  }
155
+ onRowDoubleClick(entry, event) {
156
+ if (this.toggleOn() !== 'doubleClick' ||
157
+ this.fromTrailing(event) ||
158
+ event.shiftKey ||
159
+ event.ctrlKey ||
160
+ event.metaKey) {
161
+ return;
162
+ }
163
+ this.toggle(entry.node);
164
+ }
165
+ onCaretClick(entry, event) {
166
+ event.stopPropagation();
167
+ if (entry.node.disabled) {
168
+ return;
169
+ }
170
+ this.focusNode(entry.node.id);
171
+ this.toggle(entry.node);
172
+ }
99
173
  onRowFocus(entry) {
100
174
  this.activeId.set(entry.node.id);
101
175
  this.hover(entry.node);
@@ -159,7 +233,7 @@ class TreeComponent {
159
233
  event.preventDefault();
160
234
  }
161
235
  // A modified activation in multiple selection only adds or removes the node; every other
162
- // activation selects the node alone and toggles a parent.
236
+ // activation selects the node alone, and toggles a parent when the row is the toggle.
163
237
  activate(entry, modified) {
164
238
  const node = entry.node;
165
239
  if (node.disabled) {
@@ -184,7 +258,7 @@ class TreeComponent {
184
258
  this.selectedId.set(node.id);
185
259
  }
186
260
  this.nodeSelected.emit(node);
187
- if (entry.hasChildren) {
261
+ if (entry.hasChildren && this.toggleOn() === 'row') {
188
262
  this.toggle(node);
189
263
  }
190
264
  }
@@ -220,7 +294,7 @@ class TreeComponent {
220
294
  focusNode(id) {
221
295
  this.activeId.set(id);
222
296
  this.host.nativeElement
223
- .querySelector(`[data-node-id="${CSS.escape(id)}"]`)
297
+ .querySelector(`.row-shell:not(.is-leaving) > [data-node-id="${CSS.escape(id)}"]`)
224
298
  ?.focus();
225
299
  }
226
300
  fromTrailing(event) {
@@ -253,21 +327,22 @@ class TreeComponent {
253
327
  }
254
328
  }
255
329
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
256
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: TreeComponent, isStandalone: true, selector: "ds-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedIds: "expandedIdsChange", selectedId: "selectedIdChange", selectedIds: "selectedIdsChange", nodeSelected: "nodeSelected", nodeHover: "nodeHover" }, host: { attributes: { "role": "tree" }, listeners: { "keydown": "onKeydown($event)", "pointerleave": "hover(null)" }, properties: { "attr.aria-multiselectable": "multiple() ? 'true' : null" } }, queries: [{ propertyName: "trailing", first: true, predicate: TreeTrailingDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_tree-indent: var(--ds-tree-indent, var(--tree-indent));--_tree-row-padding-y: var(--ds-tree-row-padding-y, var(--tree-row-pad-y));--_tree-row-padding-x: var(--ds-tree-row-padding-x, var(--tree-row-pad-x));--_tree-row-hover-bg-color: var(--ds-tree-row-hover-bg-color, var(--surface-secondary));--_tree-row-selected-bg-color: var(--ds-tree-row-selected-bg-color, var(--accent-surface-tint));--_tree-row-selected-text-color: var(--ds-tree-row-selected-text-color, var(--accent-strong));--_tree-row-selected-icon-color: var(--ds-tree-row-selected-icon-color, var(--_tree-row-selected-text-color));--_tree-row-text-color: var(--ds-tree-row-text-color, var(--text-primary));--_tree-caret-icon-color: var(--ds-tree-caret-icon-color, var(--text-tertiary));display:flex;flex-direction:column}.row{display:flex;align-items:center;gap:var(--space-2);width:100%;padding:var(--_tree-row-padding-y) var(--_tree-row-padding-x) var(--_tree-row-padding-y) calc(var(--_tree-row-padding-x) + var(--_level, 0) * var(--_tree-indent));border:0;background:transparent;border-radius:var(--focus-ring-radius);color:var(--_tree-row-text-color);font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--duration-fast) var(--ease-standard)}.row:hover{background-color:var(--_tree-row-hover-bg-color)}.row:active:not([aria-disabled=true],:has(.trailing:active)){background-color:var(--surface-muted)}.row:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(-1 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.row[aria-disabled=true]{color:var(--text-disabled);cursor:not-allowed}.row.selected{background-color:var(--_tree-row-selected-bg-color);color:var(--_tree-row-selected-text-color);font-weight:var(--font-weight-semibold)}.caret{flex:none;color:var(--_tree-caret-icon-color)}.caret-spacer{flex:none;width:var(--space-4)}.node-icon{flex:none;color:var(--icon-default, var(--text-secondary))}.row.selected .node-icon{color:var(--_tree-row-selected-icon-color)}.label{min-width:0;overflow:clip visible;text-overflow:ellipsis;white-space:nowrap}.trailing{display:flex;flex:none;align-items:center;gap:var(--space-1);margin-block:calc(-1 * var(--_tree-row-padding-y));margin-inline-start:auto;font-weight:var(--font-weight-regular);cursor:default}.trailing:focus-within{position:relative;z-index:1}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
330
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: TreeComponent, isStandalone: true, selector: "ds-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: false, transformFunction: null }, expandedIds: { classPropertyName: "expandedIds", publicName: "expandedIds", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, selectedId: { classPropertyName: "selectedId", publicName: "selectedId", isSignal: true, isRequired: false, transformFunction: null }, selectedIds: { classPropertyName: "selectedIds", publicName: "selectedIds", isSignal: true, isRequired: false, transformFunction: null }, toggleOn: { classPropertyName: "toggleOn", publicName: "toggleOn", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { expandedIds: "expandedIdsChange", selectedId: "selectedIdChange", selectedIds: "selectedIdsChange", nodeSelected: "nodeSelected", nodeHover: "nodeHover" }, host: { attributes: { "role": "tree" }, listeners: { "keydown": "onKeydown($event)", "pointerleave": "hover(null)" }, properties: { "attr.aria-multiselectable": "multiple() ? 'true' : null", "class.is-animated": "animate()" } }, queries: [{ propertyName: "label", first: true, predicate: TreeLabelDirective, descendants: true, isSignal: true }, { propertyName: "trailing", first: true, predicate: TreeTrailingDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <div\n class=\"row-shell\"\n role=\"none\"\n [animate.enter]=\"motion() ? 'is-entering' : ''\"\n [animate.leave]=\"motion() ? 'is-leaving' : ''\">\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (dblclick)=\"onRowDoubleClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren && toggleOn() === 'caret') {\n <!-- The row keeps the focus and the tree its one tab stop: ArrowRight and ArrowLeft on the row are the keyboard toggle. -->\n <button\n type=\"button\"\n class=\"caret-button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"\n entry.expanded\n ? labels().collapse(entry.node.label)\n : labels().expand(entry.node.label)\n \"\n [disabled]=\"entry.node.disabled\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onCaretClick(entry, $event)\">\n <ds-icon\n class=\"caret\"\n name=\"chevronRight\"\n [class.expanded]=\"entry.expanded\"\n [size]=\"16\" />\n </button>\n } @else if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n name=\"chevronRight\"\n [class.expanded]=\"entry.expanded\"\n [size]=\"16\" />\n } @else if (!entry.node.icon) {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n @if (label(); as label) {\n <span\n class=\"custom-label\"\n [id]=\"idPrefix + '-' + index\">\n <ng-container\n *ngTemplateOutlet=\"\n label.template;\n context: {\n $implicit: entry.node,\n node: entry.node,\n level: entry.level,\n selected: isSelected(entry.node.id),\n disabled: !!entry.node.disabled,\n }\n \" />\n </span>\n } @else {\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n }\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_tree-indent: var(--ds-tree-indent, var(--tree-indent));--_tree-row-padding-y: var(--ds-tree-row-padding-y, var(--tree-row-pad-y));--_tree-row-padding-x: var(--ds-tree-row-padding-x, var(--tree-row-pad-x));--_tree-row-hover-bg-color: var(--ds-tree-row-hover-bg-color, var(--surface-secondary));--_tree-row-selected-bg-color: var(--ds-tree-row-selected-bg-color, var(--accent-surface-tint));--_tree-row-selected-text-color: var(--ds-tree-row-selected-text-color, var(--accent-strong));--_tree-row-selected-icon-color: var(--ds-tree-row-selected-icon-color, var(--_tree-row-selected-text-color));--_tree-row-text-color: var(--ds-tree-row-text-color, var(--text-primary));--_tree-caret-icon-color: var(--ds-tree-caret-icon-color, var(--text-tertiary));display:flex;flex-direction:column}.row-shell{display:grid;grid-template-rows:1fr}.row-shell.is-entering{animation:ds-tree-row-expand var(--duration-base) var(--ease-standard)}.row-shell.is-entering>.row{overflow:hidden;min-height:0;animation:ds-tree-row-padding-in var(--duration-base) var(--ease-standard)}@media(prefers-reduced-motion:reduce){.row-shell.is-entering,.row-shell.is-entering>.row{animation:none}}.row-shell.is-leaving{contain:inline-size;pointer-events:none;animation:ds-tree-row-collapse max(var(--duration-base),1ms) var(--ease-standard) both}.row-shell.is-leaving>.row{overflow:hidden;min-height:0;animation:ds-tree-row-padding-out max(var(--duration-base),1ms) var(--ease-standard) both}@keyframes ds-tree-row-expand{0%{grid-template-rows:0fr;opacity:0}}@keyframes ds-tree-row-collapse{to{grid-template-rows:0fr;opacity:0}}@keyframes ds-tree-row-padding-in{0%{padding-block:0}}@keyframes ds-tree-row-padding-out{to{padding-block:0}}.row{display:flex;align-items:center;gap:var(--space-2);width:100%;padding:var(--_tree-row-padding-y) var(--_tree-row-padding-x) var(--_tree-row-padding-y) calc(var(--_tree-row-padding-x) + var(--_level, 0) * var(--_tree-indent));border:0;background:transparent;border-radius:var(--focus-ring-radius);color:var(--_tree-row-text-color);font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--duration-fast) var(--ease-standard)}.row:hover{background-color:var(--_tree-row-hover-bg-color)}.row:active:not([aria-disabled=true],:has(.trailing:active)){background-color:var(--surface-muted)}.row:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(-1 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.row[aria-disabled=true]{color:var(--text-disabled);cursor:not-allowed}.row.selected{background-color:var(--_tree-row-selected-bg-color);color:var(--_tree-row-selected-text-color);font-weight:var(--font-weight-semibold)}.caret{flex:none;color:var(--_tree-caret-icon-color)}.caret.expanded{transform:rotate(90deg)}:host(.is-animated) .caret{transition:transform var(--duration-base) var(--ease-standard)}.caret-button{display:grid;flex:none;place-items:center;padding:0;border:0;border-radius:var(--radius-sm);background:transparent;color:inherit;cursor:pointer}.caret-button:disabled{cursor:not-allowed}.caret-button{position:relative}.caret-button:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.caret-button:focus-visible{outline-style:none}.caret-button:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.caret-spacer{flex:none;width:var(--space-4)}.node-icon{flex:none;color:var(--icon-default, var(--text-secondary))}.row.selected .node-icon{color:var(--_tree-row-selected-icon-color)}.label{min-width:0;overflow:clip visible;text-overflow:ellipsis;white-space:nowrap}.custom-label{flex:1;min-width:0}.trailing{display:flex;flex:none;align-items:center;gap:var(--space-1);margin-block:calc(-1 * var(--_tree-row-padding-y));margin-inline-start:auto;font-weight:var(--font-weight-regular);cursor:default}.trailing:focus-within{position:relative;z-index:1}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
257
331
  }
258
332
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: TreeComponent, decorators: [{
259
333
  type: Component,
260
334
  args: [{ selector: 'ds-tree', standalone: true, imports: [IconComponent, NgTemplateOutlet], encapsulation: ViewEncapsulation.Emulated, host: {
261
335
  role: 'tree',
262
336
  '[attr.aria-multiselectable]': "multiple() ? 'true' : null",
337
+ '[class.is-animated]': 'animate()',
263
338
  '(keydown)': 'onKeydown($event)',
264
339
  '(pointerleave)': 'hover(null)',
265
- }, template: "@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_tree-indent: var(--ds-tree-indent, var(--tree-indent));--_tree-row-padding-y: var(--ds-tree-row-padding-y, var(--tree-row-pad-y));--_tree-row-padding-x: var(--ds-tree-row-padding-x, var(--tree-row-pad-x));--_tree-row-hover-bg-color: var(--ds-tree-row-hover-bg-color, var(--surface-secondary));--_tree-row-selected-bg-color: var(--ds-tree-row-selected-bg-color, var(--accent-surface-tint));--_tree-row-selected-text-color: var(--ds-tree-row-selected-text-color, var(--accent-strong));--_tree-row-selected-icon-color: var(--ds-tree-row-selected-icon-color, var(--_tree-row-selected-text-color));--_tree-row-text-color: var(--ds-tree-row-text-color, var(--text-primary));--_tree-caret-icon-color: var(--ds-tree-caret-icon-color, var(--text-tertiary));display:flex;flex-direction:column}.row{display:flex;align-items:center;gap:var(--space-2);width:100%;padding:var(--_tree-row-padding-y) var(--_tree-row-padding-x) var(--_tree-row-padding-y) calc(var(--_tree-row-padding-x) + var(--_level, 0) * var(--_tree-indent));border:0;background:transparent;border-radius:var(--focus-ring-radius);color:var(--_tree-row-text-color);font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--duration-fast) var(--ease-standard)}.row:hover{background-color:var(--_tree-row-hover-bg-color)}.row:active:not([aria-disabled=true],:has(.trailing:active)){background-color:var(--surface-muted)}.row:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(-1 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.row[aria-disabled=true]{color:var(--text-disabled);cursor:not-allowed}.row.selected{background-color:var(--_tree-row-selected-bg-color);color:var(--_tree-row-selected-text-color);font-weight:var(--font-weight-semibold)}.caret{flex:none;color:var(--_tree-caret-icon-color)}.caret-spacer{flex:none;width:var(--space-4)}.node-icon{flex:none;color:var(--icon-default, var(--text-secondary))}.row.selected .node-icon{color:var(--_tree-row-selected-icon-color)}.label{min-width:0;overflow:clip visible;text-overflow:ellipsis;white-space:nowrap}.trailing{display:flex;flex:none;align-items:center;gap:var(--space-1);margin-block:calc(-1 * var(--_tree-row-padding-y));margin-inline-start:auto;font-weight:var(--font-weight-regular);cursor:default}.trailing:focus-within{position:relative;z-index:1}\n"] }]
266
- }], ctorParameters: () => [], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: false }] }], expandedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedIds", required: false }] }, { type: i0.Output, args: ["expandedIdsChange"] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], selectedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedId", required: false }] }, { type: i0.Output, args: ["selectedIdChange"] }], selectedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedIds", required: false }] }, { type: i0.Output, args: ["selectedIdsChange"] }], nodeSelected: [{ type: i0.Output, args: ["nodeSelected"] }], nodeHover: [{ type: i0.Output, args: ["nodeHover"] }], trailing: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeTrailingDirective), { isSignal: true }] }] } });
340
+ }, template: "@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <div\n class=\"row-shell\"\n role=\"none\"\n [animate.enter]=\"motion() ? 'is-entering' : ''\"\n [animate.leave]=\"motion() ? 'is-leaving' : ''\">\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (dblclick)=\"onRowDoubleClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren && toggleOn() === 'caret') {\n <!-- The row keeps the focus and the tree its one tab stop: ArrowRight and ArrowLeft on the row are the keyboard toggle. -->\n <button\n type=\"button\"\n class=\"caret-button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"\n entry.expanded\n ? labels().collapse(entry.node.label)\n : labels().expand(entry.node.label)\n \"\n [disabled]=\"entry.node.disabled\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onCaretClick(entry, $event)\">\n <ds-icon\n class=\"caret\"\n name=\"chevronRight\"\n [class.expanded]=\"entry.expanded\"\n [size]=\"16\" />\n </button>\n } @else if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n name=\"chevronRight\"\n [class.expanded]=\"entry.expanded\"\n [size]=\"16\" />\n } @else if (!entry.node.icon) {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n @if (label(); as label) {\n <span\n class=\"custom-label\"\n [id]=\"idPrefix + '-' + index\">\n <ng-container\n *ngTemplateOutlet=\"\n label.template;\n context: {\n $implicit: entry.node,\n node: entry.node,\n level: entry.level,\n selected: isSelected(entry.node.id),\n disabled: !!entry.node.disabled,\n }\n \" />\n </span>\n } @else {\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n }\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n </div>\n}\n", styles: [":where(:host){box-sizing:border-box;interpolate-size:allow-keywords}:where(*){box-sizing:border-box}:where(button,input,select,textarea){font-family:inherit}:where(h1,h2,h3,h4,h5,h6){margin:0}:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset);animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard);border-radius:var(--focus-ring-radius)}@media(forced-colors:active){:where(:host(:focus-visible),:focus-visible){outline:var(--focus-ring-width) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--_tree-indent: var(--ds-tree-indent, var(--tree-indent));--_tree-row-padding-y: var(--ds-tree-row-padding-y, var(--tree-row-pad-y));--_tree-row-padding-x: var(--ds-tree-row-padding-x, var(--tree-row-pad-x));--_tree-row-hover-bg-color: var(--ds-tree-row-hover-bg-color, var(--surface-secondary));--_tree-row-selected-bg-color: var(--ds-tree-row-selected-bg-color, var(--accent-surface-tint));--_tree-row-selected-text-color: var(--ds-tree-row-selected-text-color, var(--accent-strong));--_tree-row-selected-icon-color: var(--ds-tree-row-selected-icon-color, var(--_tree-row-selected-text-color));--_tree-row-text-color: var(--ds-tree-row-text-color, var(--text-primary));--_tree-caret-icon-color: var(--ds-tree-caret-icon-color, var(--text-tertiary));display:flex;flex-direction:column}.row-shell{display:grid;grid-template-rows:1fr}.row-shell.is-entering{animation:ds-tree-row-expand var(--duration-base) var(--ease-standard)}.row-shell.is-entering>.row{overflow:hidden;min-height:0;animation:ds-tree-row-padding-in var(--duration-base) var(--ease-standard)}@media(prefers-reduced-motion:reduce){.row-shell.is-entering,.row-shell.is-entering>.row{animation:none}}.row-shell.is-leaving{contain:inline-size;pointer-events:none;animation:ds-tree-row-collapse max(var(--duration-base),1ms) var(--ease-standard) both}.row-shell.is-leaving>.row{overflow:hidden;min-height:0;animation:ds-tree-row-padding-out max(var(--duration-base),1ms) var(--ease-standard) both}@keyframes ds-tree-row-expand{0%{grid-template-rows:0fr;opacity:0}}@keyframes ds-tree-row-collapse{to{grid-template-rows:0fr;opacity:0}}@keyframes ds-tree-row-padding-in{0%{padding-block:0}}@keyframes ds-tree-row-padding-out{to{padding-block:0}}.row{display:flex;align-items:center;gap:var(--space-2);width:100%;padding:var(--_tree-row-padding-y) var(--_tree-row-padding-x) var(--_tree-row-padding-y) calc(var(--_tree-row-padding-x) + var(--_level, 0) * var(--_tree-indent));border:0;background:transparent;border-radius:var(--focus-ring-radius);color:var(--_tree-row-text-color);font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-base) var(--font-sans);text-align:left;cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--duration-fast) var(--ease-standard)}.row:hover{background-color:var(--_tree-row-hover-bg-color)}.row:active:not([aria-disabled=true],:has(.trailing:active)){background-color:var(--surface-muted)}.row:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(-1 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.row[aria-disabled=true]{color:var(--text-disabled);cursor:not-allowed}.row.selected{background-color:var(--_tree-row-selected-bg-color);color:var(--_tree-row-selected-text-color);font-weight:var(--font-weight-semibold)}.caret{flex:none;color:var(--_tree-caret-icon-color)}.caret.expanded{transform:rotate(90deg)}:host(.is-animated) .caret{transition:transform var(--duration-base) var(--ease-standard)}.caret-button{display:grid;flex:none;place-items:center;padding:0;border:0;border-radius:var(--radius-sm);background:transparent;color:inherit;cursor:pointer}.caret-button:disabled{cursor:not-allowed}.caret-button{position:relative}.caret-button:before{content:\"\";position:absolute;top:50%;left:50%;width:max(100%,var(--hit-xs));height:max(100%,var(--hit-xs));translate:-50% -50%;border-radius:inherit}.caret-button:focus-visible{outline-style:none}.caret-button:focus-visible:before{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:calc(var(--focus-ring-offset) - 2 * var(--focus-ring-width));animation:ds-focus-ring-in var(--duration-fast) var(--ease-standard)}.caret-spacer{flex:none;width:var(--space-4)}.node-icon{flex:none;color:var(--icon-default, var(--text-secondary))}.row.selected .node-icon{color:var(--_tree-row-selected-icon-color)}.label{min-width:0;overflow:clip visible;text-overflow:ellipsis;white-space:nowrap}.custom-label{flex:1;min-width:0}.trailing{display:flex;flex:none;align-items:center;gap:var(--space-1);margin-block:calc(-1 * var(--_tree-row-padding-y));margin-inline-start:auto;font-weight:var(--font-weight-regular);cursor:default}.trailing:focus-within{position:relative;z-index:1}\n"] }]
341
+ }], ctorParameters: () => [], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: false }] }], expandedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandedIds", required: false }] }, { type: i0.Output, args: ["expandedIdsChange"] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], selectedId: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedId", required: false }] }, { type: i0.Output, args: ["selectedIdChange"] }], selectedIds: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedIds", required: false }] }, { type: i0.Output, args: ["selectedIdsChange"] }], toggleOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleOn", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }], nodeSelected: [{ type: i0.Output, args: ["nodeSelected"] }], nodeHover: [{ type: i0.Output, args: ["nodeHover"] }], label: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeLabelDirective), { isSignal: true }] }], trailing: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TreeTrailingDirective), { isSignal: true }] }] } });
267
342
 
268
343
  /**
269
344
  * Generated bundle index. Do not edit.
270
345
  */
271
346
 
272
- export { TreeComponent, TreeTrailingDirective };
347
+ export { TreeComponent, TreeLabelDirective, TreeTrailingDirective };
273
348
  //# sourceMappingURL=ids-group-ltd-ids-design-system-components-tree.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ids-group-ltd-ids-design-system-components-tree.mjs","sources":["../../../src/lib/components/tree/tree-trailing.directive.ts","../../../src/lib/components/tree/tree.component.ts","../../../src/lib/components/tree/tree.component.html","../../../src/lib/components/tree/ids-group-ltd-ids-design-system-components-tree.ts"],"sourcesContent":["import { Directive, TemplateRef, inject } from '@angular/core';\nimport type { TreeNode } from './tree.types';\n\n/** What a `dsTreeTrailing` template is handed: the row's node, as `$implicit` and again as `node`. */\nexport interface TreeTrailingContext {\n readonly $implicit: TreeNode;\n readonly node: TreeNode;\n}\n\n/**\n * Content drawn at the end of every `ds-tree` row: a badge, a count, a small icon button.\n *\n * ```html\n * <ds-tree [nodes]=\"layers\">\n * <ng-template dsTreeTrailing let-node>\n * <ds-badge size=\"sm\">{{ node.id }}</ds-badge>\n * </ng-template>\n * </ds-tree>\n * ```\n *\n * A click inside it neither selects nor toggles the row. Its controls are tab stops only on\n * the focused row: Tab from that row reaches them, and the other rows' controls stay out of\n * the tab order.\n */\n@Directive({\n selector: 'ng-template[dsTreeTrailing]',\n standalone: true,\n})\nexport class TreeTrailingDirective {\n readonly template = inject<TemplateRef<TreeTrailingContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _directive: TreeTrailingDirective,\n _context: unknown,\n ): _context is TreeTrailingContext {\n return true;\n }\n}\n","import {\n Component,\n ElementRef,\n ViewEncapsulation,\n afterEveryRender,\n computed,\n contentChild,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport { TreeTrailingDirective } from './tree-trailing.directive';\nimport type { TreeNode, TreeSelection } from './tree.types';\n\ninterface VisibleNode {\n node: TreeNode;\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n}\n\nconst FOCUSABLE =\n 'a[href], button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\nconst PARKED_TABINDEX = 'data-ds-tree-tabindex';\n\nlet nextId = 0;\n\n@Component({\n selector: 'ds-tree',\n standalone: true,\n imports: [IconComponent, NgTemplateOutlet],\n templateUrl: './tree.component.html',\n styleUrl: './tree.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'tree',\n '[attr.aria-multiselectable]': \"multiple() ? 'true' : null\",\n '(keydown)': 'onKeydown($event)',\n '(pointerleave)': 'hover(null)',\n },\n})\nexport class TreeComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /** Root-level nodes; nest via `children`. */\n readonly nodes = input<readonly TreeNode[]>([]);\n /** Ids of the expanded nodes. */\n readonly expandedIds = model<Set<string>>(new Set());\n /** `'multiple'` reads and writes `selectedIds`; `'single'` reads and writes `selectedId`. */\n readonly selection = input<TreeSelection>('single');\n /** Id of the selected node, in `'single'` selection. */\n readonly selectedId = model<string | null>(null);\n /** Ids of the selected nodes, in `'multiple'` selection. */\n readonly selectedIds = model<string[]>([]);\n /** Fires with the node when a row is selected (click or Enter/Space), not when one is deselected. */\n readonly nodeSelected = output<TreeNode>();\n /** Fires with the node under the pointer or newly focused, and `null` when the pointer leaves the tree. */\n readonly nodeHover = output<TreeNode | null>();\n\n protected readonly trailing = contentChild(TreeTrailingDirective);\n protected readonly idPrefix = `ds-tree-${++nextId}`;\n\n private readonly activeId = signal<string | null>(null);\n private hoveredId: string | null = null;\n\n protected readonly multiple = computed(() => this.selection() === 'multiple');\n\n protected readonly visibleNodes = computed<VisibleNode[]>(() => {\n const out: VisibleNode[] = [];\n const walk = (list: readonly TreeNode[], level: number): void => {\n for (const node of list) {\n const hasChildren = !!node.children?.length;\n const expanded = this.isExpanded(node.id);\n out.push({ node, level, hasChildren, expanded });\n if (hasChildren && expanded) {\n walk(node.children ?? [], level + 1);\n }\n }\n };\n walk(this.nodes(), 0);\n\n return out;\n });\n\n protected readonly effectiveActiveId = computed(\n () => this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null,\n );\n\n constructor() {\n // Content inside a trailing template can change without a signal of the tree changing,\n // so its tab stops are re-parked after every render.\n afterEveryRender({ write: () => this.parkTrailingTabStops() });\n }\n\n protected isExpanded(id: string): boolean {\n return this.expandedIds().has(id);\n }\n\n protected isSelected(id: string): boolean {\n return this.multiple()\n ? this.selectedIds().includes(id)\n : this.selectedId() === id;\n }\n\n protected isActive(id: string): boolean {\n return this.effectiveActiveId() === id;\n }\n\n protected onRowClick(entry: VisibleNode, event: MouseEvent): void {\n if (this.fromTrailing(event)) {\n return;\n }\n this.activate(entry, event.shiftKey || event.ctrlKey || event.metaKey);\n }\n\n protected onRowFocus(entry: VisibleNode): void {\n this.activeId.set(entry.node.id);\n this.hover(entry.node);\n }\n\n protected hover(node: TreeNode | null): void {\n const id = node?.id ?? null;\n if (id === this.hoveredId) {\n return;\n }\n this.hoveredId = id;\n this.nodeHover.emit(node);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.fromTrailing(event)) {\n return;\n }\n const visible = this.visibleNodes();\n const index = visible.findIndex(\n (entry) => entry.node.id === this.effectiveActiveId(),\n );\n if (index < 0) {\n return;\n }\n const current = visible[index];\n switch (event.key) {\n case 'ArrowDown':\n this.moveActive(index + 1);\n break;\n case 'ArrowUp':\n this.moveActive(index - 1);\n break;\n case 'Home':\n this.moveActive(0);\n break;\n case 'End':\n this.moveActive(visible.length - 1);\n break;\n case 'ArrowRight':\n if (current.hasChildren && !current.expanded) {\n this.toggle(current.node);\n } else if (current.hasChildren) {\n this.moveActive(index + 1);\n }\n break;\n case 'ArrowLeft':\n if (current.hasChildren && current.expanded) {\n this.toggle(current.node);\n } else {\n this.moveToParent(visible, index);\n }\n break;\n case 'Enter':\n case ' ':\n if (!event.repeat) {\n this.activate(\n current,\n event.shiftKey || event.ctrlKey || event.metaKey,\n );\n }\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n // A modified activation in multiple selection only adds or removes the node; every other\n // activation selects the node alone and toggles a parent.\n private activate(entry: VisibleNode, modified: boolean): void {\n const node = entry.node;\n if (node.disabled) {\n return;\n }\n this.activeId.set(node.id);\n if (this.multiple() && modified) {\n const ids = this.selectedIds();\n if (ids.includes(node.id)) {\n this.selectedIds.set(ids.filter((id) => id !== node.id));\n } else {\n this.selectedIds.set([...ids, node.id]);\n this.nodeSelected.emit(node);\n }\n\n return;\n }\n if (this.multiple()) {\n this.selectedIds.set([node.id]);\n } else {\n this.selectedId.set(node.id);\n }\n this.nodeSelected.emit(node);\n if (entry.hasChildren) {\n this.toggle(node);\n }\n }\n\n private toggle(node: TreeNode): void {\n if (node.disabled || !node.children?.length) {\n return;\n }\n const next = new Set(this.expandedIds());\n if (next.has(node.id)) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n }\n this.expandedIds.set(next);\n }\n\n private moveActive(targetIndex: number): void {\n const visible = this.visibleNodes();\n if (targetIndex < 0 || targetIndex >= visible.length) {\n return;\n }\n this.focusNode(visible[targetIndex].node.id);\n }\n\n private moveToParent(visible: VisibleNode[], index: number): void {\n const level = visible[index].level;\n for (let i = index - 1; i >= 0; i--) {\n if (visible[i].level < level) {\n this.focusNode(visible[i].node.id);\n\n return;\n }\n }\n }\n\n private focusNode(id: string): void {\n this.activeId.set(id);\n this.host.nativeElement\n .querySelector<HTMLElement>(`[data-node-id=\"${CSS.escape(id)}\"]`)\n ?.focus();\n }\n\n private fromTrailing(event: Event): boolean {\n return (\n event.target instanceof Element && !!event.target.closest('.trailing')\n );\n }\n\n // The tree keeps one tab stop: controls in a trailing template are tabbable on the active\n // row only, and get their own tabindex back when their row becomes active.\n private parkTrailingTabStops(): void {\n const activeId = this.effectiveActiveId();\n for (const area of this.host.nativeElement.querySelectorAll('.trailing')) {\n const onActiveRow =\n area.closest('[data-node-id]')?.getAttribute('data-node-id') ===\n activeId;\n const controls = area.querySelectorAll<HTMLElement>(\n onActiveRow ? `[${PARKED_TABINDEX}]` : FOCUSABLE,\n );\n for (const control of controls) {\n if (onActiveRow) {\n const own = control.getAttribute(PARKED_TABINDEX);\n control.removeAttribute(PARKED_TABINDEX);\n if (own) {\n control.setAttribute('tabindex', own);\n } else {\n control.removeAttribute('tabindex');\n }\n } else if (!control.hasAttribute(PARKED_TABINDEX)) {\n control.setAttribute(\n PARKED_TABINDEX,\n control.getAttribute('tabindex') ?? '',\n );\n control.setAttribute('tabindex', '-1');\n }\n }\n }\n }\n}\n","@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n [name]=\"entry.expanded ? 'chevronDown' : 'chevronRight'\"\n [size]=\"16\" />\n } @else {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AASA;;;;;;;;;;;;;;AAcG;MAKU,qBAAqB,CAAA;AACvB,IAAA,QAAQ,GAAG,MAAM,CAAmC,WAAW,CAAC;AAEzE,IAAA,OAAO,sBAAsB,CAC3B,U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tree-label.directive.ts","../../../src/lib/components/tree/tree-trailing.directive.ts","../../../src/lib/components/tree/tree.component.ts","../../../src/lib/components/tree/tree.component.html","../../../src/lib/components/tree/ids-group-ltd-ids-design-system-components-tree.ts"],"sourcesContent":["import { Directive, TemplateRef, inject } from '@angular/core';\nimport type { TreeNode } from './tree.types';\n\n/** What a `dsTreeLabel` template is handed: the row's node, its nesting level (`0` for a root\n * node) and whether the row is selected and disabled. */\nexport interface TreeLabelContext {\n readonly $implicit: TreeNode;\n readonly node: TreeNode;\n readonly level: number;\n readonly selected: boolean;\n readonly disabled: boolean;\n}\n\n/**\n * Content drawn in place of a `ds-tree` row's label, for a label of more than one line or one\n * that mixes styles.\n *\n * ```html\n * <ds-tree [nodes]=\"layers\">\n * <ng-template dsTreeLabel let-node>\n * <span class=\"tag\">{{ tags[node.id] }}</span>\n * <span class=\"text\">{{ node.label }}</span>\n * </ng-template>\n * </ds-tree>\n * ```\n *\n * The row grows to the template's height and the label takes the width between the icon and\n * the trailing content, so an element inside it can cut its text with an ellipsis. The text the\n * template renders is the row's accessible name; a template that draws no text needs a\n * visually hidden element with the name in it. A click inside it selects the row as a click on\n * the default label does.\n */\n@Directive({\n selector: 'ng-template[dsTreeLabel]',\n standalone: true,\n})\nexport class TreeLabelDirective {\n readonly template = inject<TemplateRef<TreeLabelContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _directive: TreeLabelDirective,\n _context: unknown,\n ): _context is TreeLabelContext {\n return true;\n }\n}\n","import { Directive, TemplateRef, inject } from '@angular/core';\nimport type { TreeNode } from './tree.types';\n\n/** What a `dsTreeTrailing` template is handed: the row's node, as `$implicit` and again as `node`. */\nexport interface TreeTrailingContext {\n readonly $implicit: TreeNode;\n readonly node: TreeNode;\n}\n\n/**\n * Content drawn at the end of every `ds-tree` row: a badge, a count, a small icon button.\n *\n * ```html\n * <ds-tree [nodes]=\"layers\">\n * <ng-template dsTreeTrailing let-node>\n * <ds-badge size=\"sm\">{{ node.id }}</ds-badge>\n * </ng-template>\n * </ds-tree>\n * ```\n *\n * A click inside it neither selects nor toggles the row. Its controls are tab stops only on\n * the focused row: Tab from that row reaches them, and the other rows' controls stay out of\n * the tab order.\n */\n@Directive({\n selector: 'ng-template[dsTreeTrailing]',\n standalone: true,\n})\nexport class TreeTrailingDirective {\n readonly template = inject<TemplateRef<TreeTrailingContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _directive: TreeTrailingDirective,\n _context: unknown,\n ): _context is TreeTrailingContext {\n return true;\n }\n}\n","import {\n Component,\n ElementRef,\n ViewEncapsulation,\n afterEveryRender,\n afterNextRender,\n booleanAttribute,\n computed,\n contentChild,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { IconComponent } from '@ids-group-ltd/ids-design-system/icons';\nimport {\n DS_INTL,\n DS_INTL_DEFAULTS,\n} from '@ids-group-ltd/ids-design-system/core';\nimport { TreeLabelDirective } from './tree-label.directive';\nimport { TreeTrailingDirective } from './tree-trailing.directive';\nimport type { TreeNode, TreeSelection, TreeToggleOn } from './tree.types';\n\ninterface VisibleNode {\n node: TreeNode;\n level: number;\n hasChildren: boolean;\n expanded: boolean;\n}\n\nconst FOCUSABLE =\n 'a[href], button, input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\nconst PARKED_TABINDEX = 'data-ds-tree-tabindex';\n\nlet nextId = 0;\n\n@Component({\n selector: 'ds-tree',\n standalone: true,\n imports: [IconComponent, NgTemplateOutlet],\n templateUrl: './tree.component.html',\n styleUrl: './tree.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n host: {\n role: 'tree',\n '[attr.aria-multiselectable]': \"multiple() ? 'true' : null\",\n '[class.is-animated]': 'animate()',\n '(keydown)': 'onKeydown($event)',\n '(pointerleave)': 'hover(null)',\n },\n})\nexport class TreeComponent {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly intl = inject(DS_INTL);\n\n /** Root-level nodes; nest via `children`. */\n readonly nodes = input<readonly TreeNode[]>([]);\n /** Ids of the expanded nodes. */\n readonly expandedIds = model<Set<string>>(new Set());\n /** `'multiple'` reads and writes `selectedIds`; `'single'` reads and writes `selectedId`. */\n readonly selection = input<TreeSelection>('single');\n /** Id of the selected node, in `'single'` selection. */\n readonly selectedId = model<string | null>(null);\n /** Ids of the selected nodes, in `'multiple'` selection. */\n readonly selectedIds = model<string[]>([]);\n /** What expands and collapses a parent. `'row'`: activating the row (click, Enter, Space) selects\n * it and toggles it. `'caret'`: activating the row only selects it, and the chevron is a button of\n * its own that toggles. `'doubleClick'`: a click selects, a double click toggles. In every mode\n * ArrowRight expands and ArrowLeft collapses the focused row. */\n readonly toggleOn = input<TreeToggleOn>('row');\n /** Rows slide open and shut and the chevron turns when a parent expands or collapses. Off under\n * `prefers-reduced-motion: reduce`. */\n readonly animate = input(true, { transform: booleanAttribute });\n /** Fires with the node when a row is selected (click or Enter/Space), not when one is deselected. */\n readonly nodeSelected = output<TreeNode>();\n /** Fires with the node under the pointer or newly focused, and `null` when the pointer leaves the tree. */\n readonly nodeHover = output<TreeNode | null>();\n\n protected readonly label = contentChild(TreeLabelDirective);\n protected readonly trailing = contentChild(TreeTrailingDirective);\n protected readonly idPrefix = `ds-tree-${++nextId}`;\n\n private readonly activeId = signal<string | null>(null);\n private hoveredId: string | null = null;\n // The rows of the first render are not revealed by a toggle, so they appear without motion.\n private readonly rendered = signal(false);\n\n protected readonly motion = computed(() => this.animate() && this.rendered());\n protected readonly multiple = computed(() => this.selection() === 'multiple');\n protected readonly labels = computed(() => ({\n ...DS_INTL_DEFAULTS.tree,\n ...this.intl().tree,\n }));\n\n protected readonly visibleNodes = computed<VisibleNode[]>(() => {\n const out: VisibleNode[] = [];\n const walk = (list: readonly TreeNode[], level: number): void => {\n for (const node of list) {\n const hasChildren = !!node.children?.length;\n const expanded = this.isExpanded(node.id);\n out.push({ node, level, hasChildren, expanded });\n if (hasChildren && expanded) {\n walk(node.children ?? [], level + 1);\n }\n }\n };\n walk(this.nodes(), 0);\n\n return out;\n });\n\n protected readonly effectiveActiveId = computed(\n () => this.activeId() ?? this.visibleNodes()[0]?.node.id ?? null,\n );\n\n constructor() {\n // Content inside a trailing template can change without a signal of the tree changing,\n // so its tab stops are re-parked after every render.\n afterEveryRender({ write: () => this.parkTrailingTabStops() });\n afterNextRender(() => this.rendered.set(true));\n }\n\n protected isExpanded(id: string): boolean {\n return this.expandedIds().has(id);\n }\n\n protected isSelected(id: string): boolean {\n return this.multiple()\n ? this.selectedIds().includes(id)\n : this.selectedId() === id;\n }\n\n protected isActive(id: string): boolean {\n return this.effectiveActiveId() === id;\n }\n\n protected onRowClick(entry: VisibleNode, event: MouseEvent): void {\n // The second click of a double click belongs to the toggle, not to a second selection.\n if (\n this.fromTrailing(event) ||\n (this.toggleOn() === 'doubleClick' && event.detail > 1)\n ) {\n return;\n }\n this.activate(entry, event.shiftKey || event.ctrlKey || event.metaKey);\n }\n\n protected onRowDoubleClick(entry: VisibleNode, event: MouseEvent): void {\n if (\n this.toggleOn() !== 'doubleClick' ||\n this.fromTrailing(event) ||\n event.shiftKey ||\n event.ctrlKey ||\n event.metaKey\n ) {\n return;\n }\n this.toggle(entry.node);\n }\n\n protected onCaretClick(entry: VisibleNode, event: MouseEvent): void {\n event.stopPropagation();\n if (entry.node.disabled) {\n return;\n }\n this.focusNode(entry.node.id);\n this.toggle(entry.node);\n }\n\n protected onRowFocus(entry: VisibleNode): void {\n this.activeId.set(entry.node.id);\n this.hover(entry.node);\n }\n\n protected hover(node: TreeNode | null): void {\n const id = node?.id ?? null;\n if (id === this.hoveredId) {\n return;\n }\n this.hoveredId = id;\n this.nodeHover.emit(node);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.fromTrailing(event)) {\n return;\n }\n const visible = this.visibleNodes();\n const index = visible.findIndex(\n (entry) => entry.node.id === this.effectiveActiveId(),\n );\n if (index < 0) {\n return;\n }\n const current = visible[index];\n switch (event.key) {\n case 'ArrowDown':\n this.moveActive(index + 1);\n break;\n case 'ArrowUp':\n this.moveActive(index - 1);\n break;\n case 'Home':\n this.moveActive(0);\n break;\n case 'End':\n this.moveActive(visible.length - 1);\n break;\n case 'ArrowRight':\n if (current.hasChildren && !current.expanded) {\n this.toggle(current.node);\n } else if (current.hasChildren) {\n this.moveActive(index + 1);\n }\n break;\n case 'ArrowLeft':\n if (current.hasChildren && current.expanded) {\n this.toggle(current.node);\n } else {\n this.moveToParent(visible, index);\n }\n break;\n case 'Enter':\n case ' ':\n if (!event.repeat) {\n this.activate(\n current,\n event.shiftKey || event.ctrlKey || event.metaKey,\n );\n }\n break;\n default:\n return;\n }\n event.preventDefault();\n }\n\n // A modified activation in multiple selection only adds or removes the node; every other\n // activation selects the node alone, and toggles a parent when the row is the toggle.\n private activate(entry: VisibleNode, modified: boolean): void {\n const node = entry.node;\n if (node.disabled) {\n return;\n }\n this.activeId.set(node.id);\n if (this.multiple() && modified) {\n const ids = this.selectedIds();\n if (ids.includes(node.id)) {\n this.selectedIds.set(ids.filter((id) => id !== node.id));\n } else {\n this.selectedIds.set([...ids, node.id]);\n this.nodeSelected.emit(node);\n }\n\n return;\n }\n if (this.multiple()) {\n this.selectedIds.set([node.id]);\n } else {\n this.selectedId.set(node.id);\n }\n this.nodeSelected.emit(node);\n if (entry.hasChildren && this.toggleOn() === 'row') {\n this.toggle(node);\n }\n }\n\n private toggle(node: TreeNode): void {\n if (node.disabled || !node.children?.length) {\n return;\n }\n const next = new Set(this.expandedIds());\n if (next.has(node.id)) {\n next.delete(node.id);\n } else {\n next.add(node.id);\n }\n this.expandedIds.set(next);\n }\n\n private moveActive(targetIndex: number): void {\n const visible = this.visibleNodes();\n if (targetIndex < 0 || targetIndex >= visible.length) {\n return;\n }\n this.focusNode(visible[targetIndex].node.id);\n }\n\n private moveToParent(visible: VisibleNode[], index: number): void {\n const level = visible[index].level;\n for (let i = index - 1; i >= 0; i--) {\n if (visible[i].level < level) {\n this.focusNode(visible[i].node.id);\n\n return;\n }\n }\n }\n\n private focusNode(id: string): void {\n this.activeId.set(id);\n this.host.nativeElement\n .querySelector<HTMLElement>(\n `.row-shell:not(.is-leaving) > [data-node-id=\"${CSS.escape(id)}\"]`,\n )\n ?.focus();\n }\n\n private fromTrailing(event: Event): boolean {\n return (\n event.target instanceof Element && !!event.target.closest('.trailing')\n );\n }\n\n // The tree keeps one tab stop: controls in a trailing template are tabbable on the active\n // row only, and get their own tabindex back when their row becomes active.\n private parkTrailingTabStops(): void {\n const activeId = this.effectiveActiveId();\n for (const area of this.host.nativeElement.querySelectorAll('.trailing')) {\n const onActiveRow =\n area.closest('[data-node-id]')?.getAttribute('data-node-id') ===\n activeId;\n const controls = area.querySelectorAll<HTMLElement>(\n onActiveRow ? `[${PARKED_TABINDEX}]` : FOCUSABLE,\n );\n for (const control of controls) {\n if (onActiveRow) {\n const own = control.getAttribute(PARKED_TABINDEX);\n control.removeAttribute(PARKED_TABINDEX);\n if (own) {\n control.setAttribute('tabindex', own);\n } else {\n control.removeAttribute('tabindex');\n }\n } else if (!control.hasAttribute(PARKED_TABINDEX)) {\n control.setAttribute(\n PARKED_TABINDEX,\n control.getAttribute('tabindex') ?? '',\n );\n control.setAttribute('tabindex', '-1');\n }\n }\n }\n }\n}\n","@for (entry of visibleNodes(); track entry.node.id; let index = $index) {\n <div\n class=\"row-shell\"\n role=\"none\"\n [animate.enter]=\"motion() ? 'is-entering' : ''\"\n [animate.leave]=\"motion() ? 'is-leaving' : ''\">\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events -- Enter and Space reach the host keydown handler, which activates the focused row -->\n <div\n class=\"row\"\n role=\"treeitem\"\n [attr.data-node-id]=\"entry.node.id\"\n [attr.aria-level]=\"entry.level + 1\"\n [attr.aria-expanded]=\"entry.hasChildren ? entry.expanded : null\"\n [attr.aria-selected]=\"isSelected(entry.node.id)\"\n [attr.aria-disabled]=\"entry.node.disabled ? 'true' : null\"\n [attr.aria-labelledby]=\"idPrefix + '-' + index\"\n [attr.aria-describedby]=\"\n trailing() ? idPrefix + '-' + index + '-trailing' : null\n \"\n [attr.tabindex]=\"isActive(entry.node.id) ? 0 : -1\"\n [class.selected]=\"isSelected(entry.node.id)\"\n [style.--_level]=\"entry.level\"\n (click)=\"onRowClick(entry, $event)\"\n (dblclick)=\"onRowDoubleClick(entry, $event)\"\n (focus)=\"onRowFocus(entry)\"\n (pointerenter)=\"hover(entry.node)\">\n @if (entry.hasChildren && toggleOn() === 'caret') {\n <!-- The row keeps the focus and the tree its one tab stop: ArrowRight and ArrowLeft on the row are the keyboard toggle. -->\n <button\n type=\"button\"\n class=\"caret-button\"\n tabindex=\"-1\"\n [attr.aria-label]=\"\n entry.expanded\n ? labels().collapse(entry.node.label)\n : labels().expand(entry.node.label)\n \"\n [disabled]=\"entry.node.disabled\"\n (mousedown)=\"$event.preventDefault()\"\n (click)=\"onCaretClick(entry, $event)\">\n <ds-icon\n class=\"caret\"\n name=\"chevronRight\"\n [class.expanded]=\"entry.expanded\"\n [size]=\"16\" />\n </button>\n } @else if (entry.hasChildren) {\n <ds-icon\n class=\"caret\"\n name=\"chevronRight\"\n [class.expanded]=\"entry.expanded\"\n [size]=\"16\" />\n } @else if (!entry.node.icon) {\n <span class=\"caret-spacer\"></span>\n }\n\n @if (entry.node.icon; as icon) {\n <ds-icon\n class=\"node-icon\"\n [name]=\"icon\"\n [size]=\"16\" />\n }\n\n @if (label(); as label) {\n <span\n class=\"custom-label\"\n [id]=\"idPrefix + '-' + index\">\n <ng-container\n *ngTemplateOutlet=\"\n label.template;\n context: {\n $implicit: entry.node,\n node: entry.node,\n level: entry.level,\n selected: isSelected(entry.node.id),\n disabled: !!entry.node.disabled,\n }\n \" />\n </span>\n } @else {\n <span\n class=\"label\"\n [id]=\"idPrefix + '-' + index\">\n {{ entry.node.label }}\n </span>\n }\n\n @if (trailing(); as trailing) {\n <span\n class=\"trailing\"\n [id]=\"idPrefix + '-' + index + '-trailing'\">\n <ng-container\n *ngTemplateOutlet=\"\n trailing.template;\n context: { $implicit: entry.node, node: entry.node }\n \" />\n </span>\n }\n </div>\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAaA;;;;;;;;;;;;;;;;;;AAkBG;MAKU,kBAAkB,CAAA;AACpB,IAAA,QAAQ,GAAG,MAAM,CAAgC,WAAW,CAAC;AAEtE,IAAA,OAAO,sBAAsB,CAC3B,UAA8B,EAC9B,QAAiB,EAAA;AAEjB,QAAA,OAAO,IAAI;IACb;wGARW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,0BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,0BAA0B;AACpC,oBAAA,UAAU,EAAE,IAAI;AACjB,iBAAA;;;AC1BD;;;;;;;;;;;;;;AAcG;MAKU,qBAAqB,CAAA;AACvB,IAAA,QAAQ,GAAG,MAAM,CAAmC,WAAW,CAAC;AAEzE,IAAA,OAAO,sBAAsB,CAC3B,UAAiC,EACjC,QAAiB,EAAA;AAEjB,QAAA,OAAO,IAAI;IACb;wGARW,qBAAqB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAArB,qBAAqB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,6BAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAArB,qBAAqB,EAAA,UAAA,EAAA,CAAA;kBAJjC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,6BAA6B;AACvC,oBAAA,UAAU,EA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A,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,UAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,SAAA,EAAA,QAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,SAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,MAAA,EAAA,IAAA,EAAA,CAAA,WAAA,CAAA,EAAA,CAAA,EAAA,KAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,YAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,UAAA,CAAA,MAAA,kBAAkB,0FACf,qBAAqB,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;AEjFlE;;AAEG;;;;"}
@@ -2375,10 +2375,19 @@ function forwardOverlayTokens(overlayRef, host, tokens) {
2375
2375
  }
2376
2376
  }
2377
2377
  }
2378
- /** `overlayY` is the panel edge pinned to the trigger, so `top` means the panel hangs BELOW it.
2378
+ /** The side of the trigger a connection pair puts the panel on. An axis decides only where the
2379
+ * pair pins opposite edges together: a side pair aligning top edges keeps `overlayY: 'top'`.
2380
+ * A pair covering the trigger falls back to `overlayY`, so `top` means it hangs BELOW.
2379
2381
  * @internal
2380
2382
  */
2381
- function overlayPlacementOf(overlayY, overlayX) {
2383
+ function overlayPlacementOf({ originX, originY, overlayX, overlayY, }) {
2384
+ const opposite = (origin, overlay) => origin !== overlay && origin !== 'center' && overlay !== 'center';
2385
+ if (opposite(originY, overlayY)) {
2386
+ return overlayY === 'top' ? 'bottom' : 'top';
2387
+ }
2388
+ if (opposite(originX, overlayX)) {
2389
+ return overlayX === 'start' ? 'right' : 'left';
2390
+ }
2382
2391
  if (overlayY === 'top') {
2383
2392
  return 'bottom';
2384
2393
  }
@@ -2390,6 +2399,23 @@ function overlayPlacementOf(overlayY, overlayX) {
2390
2399
  }
2391
2400
  return 'left';
2392
2401
  }
2402
+ // Sets `--_overlay-arrow-x/y` on the panel: the trigger's centre in the panel's padding box.
2403
+ // positionChanges skips a re-apply that only pushes the pane; the styles CDK writes do not.
2404
+ // The pane is measured, not the panel: the panel's enter animation scales it.
2405
+ /** @internal */
2406
+ function pointArrowAtHost(ref, panel, host) {
2407
+ const pane = ref.overlayElement;
2408
+ const point = () => {
2409
+ const trigger = host.getBoundingClientRect();
2410
+ const box = pane.getBoundingClientRect();
2411
+ panel.style.setProperty('--_overlay-arrow-x', `${trigger.left + trigger.width / 2 - box.left - panel.clientLeft}px`);
2412
+ panel.style.setProperty('--_overlay-arrow-y', `${trigger.top + trigger.height / 2 - box.top - panel.clientTop}px`);
2413
+ };
2414
+ const observer = new MutationObserver(point);
2415
+ observer.observe(ref.hostElement, { attributeFilter: ['style'] });
2416
+ observer.observe(pane, { attributeFilter: ['style'] });
2417
+ ref.detachments().subscribe({ complete: () => observer.disconnect() });
2418
+ }
2393
2419
  /**
2394
2420
  * Primes a `ds-overlay-pane` for its enter animation. Call right after `overlay.create()`:
2395
2421
  * CDK positions in `afterNextRender`, so the placement stamp lands before the first painted
@@ -2402,7 +2428,8 @@ function prepareOverlayEnter(overlayRef, host, positionStrategy) {
2402
2428
  forwardOverlayTokens(overlayRef, host, OVERLAY_MOTION_TOKENS);
2403
2429
  forwardOverlayTokens(overlayRef, host, DROPDOWN_PANEL_TOKENS);
2404
2430
  positionStrategy?.positionChanges.subscribe(({ connectionPair }) => {
2405
- overlayRef.overlayElement.dataset['dsPlacement'] = overlayPlacementOf(connectionPair.overlayY, connectionPair.overlayX);
2431
+ overlayRef.overlayElement.dataset['dsPlacement'] =
2432
+ overlayPlacementOf(connectionPair);
2406
2433
  });
2407
2434
  }
2408
2435
  /** Closes a non-modal overlay on a pointer press outside it, EXCEPT on its trigger. Use with `hasBackdrop: false`.
@@ -2702,5 +2729,5 @@ function createTypeAhead() {
2702
2729
  * Generated bundle index. Do not edit.
2703
2730
  */
2704
2731
 
2705
- export { CHART_GLIDE_HEAD_START_MS, CHART_HEAT_COLORS, CHART_RAMP_COLORS, CHART_RENDER_GATE_PASSED, CHART_SERIES_COLORS, CHART_SKELETON_COUNT, CHART_TOOLTIP_LINGER_MS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChartBase, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsFormControlBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, afterTwoFrames, announceOptionCount, areaPath, bandPath, bandScale, chartColors, chartDelay, chartDwell, chartHoverDelayMs, chartOf, chartRenderGate, chartTiming, chartValueFormat, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, decimationTarget, describeSeries, describeShare, dimmedBy, disposeWithLeave, domainMinOf, dropdownMinWidth, dropdownOverlay, dsAriaCurrent, dsDestination, dwellHighlight, elementWidth, focusIsInside, focusMark, focusRescue, fontsLoaded, formatPercent, formatTick, formatValue, formatWholePercent, forwardOverlayTokens, labelInterval, largestRemainder, leaveMark, leftMark, linePath, lineSegments, linearScale, listenForEscape, listenForMarkFocus, lttbDecimate, markAt, markOf, minMaxDecimate, moveFocusOutOf, needsDecimating, nextControlId, nextRovingIndex, niceDomain, overlayPlacementOf, panelClassesOf, prepareOverlayEnter, readOnHostResize, resolveBrandValue, resolveChartDefaults, resolveFieldMessage, rotationWouldFit, roundStepAtLeast, rovingMarks, scrollActiveOptionIntoView, shareOfTotal, skeletonColumnHeights, skeletonFunnelClips, skeletonLineClip, skeletonMarkCount, skeletonWaterfallSteps, staggerDelay, tickValues, trimmedText, tweenMarks, valueControlBridge, watchElementWidth };
2732
+ export { CHART_GLIDE_HEAD_START_MS, CHART_HEAT_COLORS, CHART_RAMP_COLORS, CHART_RENDER_GATE_PASSED, CHART_SERIES_COLORS, CHART_SKELETON_COUNT, CHART_TOOLTIP_LINGER_MS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChartBase, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsFormControlBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, afterTwoFrames, announceOptionCount, areaPath, bandPath, bandScale, chartColors, chartDelay, chartDwell, chartHoverDelayMs, chartOf, chartRenderGate, chartTiming, chartValueFormat, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, decimationTarget, describeSeries, describeShare, dimmedBy, disposeWithLeave, domainMinOf, dropdownMinWidth, dropdownOverlay, dsAriaCurrent, dsDestination, dwellHighlight, elementWidth, focusIsInside, focusMark, focusRescue, fontsLoaded, formatPercent, formatTick, formatValue, formatWholePercent, forwardOverlayTokens, labelInterval, largestRemainder, leaveMark, leftMark, linePath, lineSegments, linearScale, listenForEscape, listenForMarkFocus, lttbDecimate, markAt, markOf, minMaxDecimate, moveFocusOutOf, needsDecimating, nextControlId, nextRovingIndex, niceDomain, overlayPlacementOf, panelClassesOf, pointArrowAtHost, prepareOverlayEnter, readOnHostResize, resolveBrandValue, resolveChartDefaults, resolveFieldMessage, rotationWouldFit, roundStepAtLeast, rovingMarks, scrollActiveOptionIntoView, shareOfTotal, skeletonColumnHeights, skeletonFunnelClips, skeletonLineClip, skeletonMarkCount, skeletonWaterfallSteps, staggerDelay, tickValues, trimmedText, tweenMarks, valueControlBridge, watchElementWidth };
2706
2733
  //# sourceMappingURL=ids-group-ltd-ids-design-system-components.mjs.map