@truenas/ui-components 0.3.22 → 0.3.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truenas/ui-components",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -5,11 +5,11 @@ import { ControlValueAccessor, NgControl, AbstractControl } from '@angular/forms
5
5
  import { ComponentHarness, BaseHarnessFilters, HarnessPredicate, TestKey, HarnessLoader } from '@angular/cdk/testing';
6
6
  import { SafeHtml, SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
7
7
  import { ComponentFixture } from '@angular/core/testing';
8
- import { SelectionModel, DataSource } from '@angular/cdk/collections';
8
+ import { SelectionModel, DataSource, CollectionViewer } from '@angular/cdk/collections';
9
9
  import * as rxjs from 'rxjs';
10
10
  import { Observable, BehaviorSubject } from 'rxjs';
11
11
  import * as i1 from '@angular/cdk/tree';
12
- import { CdkTree, FlatTreeControl, CdkTreeNode, CdkNestedTreeNode, CdkTreeNodeOutletContext, CdkTreeNodeDef } from '@angular/cdk/tree';
12
+ import { CdkTree, CdkTreeNode, CdkNestedTreeNode, CdkTreeNodeOutletContext, CdkTreeNodeDef } from '@angular/cdk/tree';
13
13
  export { FlatTreeControl } from '@angular/cdk/tree';
14
14
  import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
15
15
  import { Overlay } from '@angular/cdk/overlay';
@@ -119,6 +119,31 @@ declare function composeTestId(type: string | null | undefined, value: TnTestIdV
119
119
  */
120
120
  declare function controlTestId(testId: Signal<TnTestIdValue>): Signal<TnTestIdValue>;
121
121
 
122
+ /**
123
+ * Minimal structural shape of a dropdown option for test-id derivation.
124
+ * Satisfied by `TnSelectOption` / `TnAutocompleteOption` (and any future
125
+ * option-like shape) without coupling the test-id module to component types.
126
+ */
127
+ interface TnOptionTestIdSource {
128
+ label: string;
129
+ value?: unknown;
130
+ }
131
+ /**
132
+ * Derive the test-id segments for a dropdown option row, consumed by
133
+ * `[tnTestId]` with `tnTestIdType="option"`. The component's resolved base
134
+ * (explicit `testId`, else the bound control name) scopes a per-option
135
+ * discriminator so ids stay unique across instances: base `user` + option
136
+ * value `jane-doe` → `option-user-jane-doe`; with no base → `option-jane-doe`.
137
+ *
138
+ * The discriminator comes from `extractor` when provided (a component's
139
+ * `optionTestIdKey` input), else the option's primitive `value`, else its
140
+ * `label`. Shared by `tn-select` and `tn-autocomplete` so the derivation
141
+ * rules can't drift between dropdown components; synthetic rows with fixed
142
+ * discriminators (e.g. select's `allowEmpty` option) are handled by the
143
+ * caller before delegating here.
144
+ */
145
+ declare function optionTestId<O extends TnOptionTestIdSource>(base: TnTestIdValue, option: O, extractor?: (option: O) => string | number | null | undefined): (string | number | null | undefined)[];
146
+
122
147
  /**
123
148
  * Test-id attribute names supported by the library.
124
149
  *
@@ -357,11 +382,8 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
357
382
  isOptionFocused(option: TnSelectOption<T>): boolean;
358
383
  /**
359
384
  * Test-id segments for an option row, consumed by `[tnTestId]` with
360
- * `tnTestIdType="option"`. The select's resolved base (explicit `testId`, else
361
- * the bound control name) scopes each option so ids stay unique across selects:
362
- * base `quick-filters` + option value `ssd` → `option-quick-filters-ssd`; with
363
- * no base → `option-ssd`. The discriminator comes from `optionTestIdKey` when
364
- * provided, else the option's primitive `value`, else its `label`.
385
+ * `tnTestIdType="option"` — see {@link optionTestId} for the derivation
386
+ * rules (shared with `tn-autocomplete`).
365
387
  */
366
388
  protected optionTestIdParts(option: TnSelectOption<T>): (string | number | null | undefined)[];
367
389
  private onChange;
@@ -571,6 +593,20 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
571
593
  ariaLabel: _angular_core.InputSignal<string | undefined>;
572
594
  /** Test ID attribute */
573
595
  testId: _angular_core.InputSignal<TnTestIdValue>;
596
+ /** Test-id base, falling back to the bound control name when `testId` is unset. */
597
+ protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
598
+ /**
599
+ * Optional extractor for the per-option test-id discriminator. Defaults to
600
+ * the option's `value` (when a string/number) or its `label`. Provide this
601
+ * when option values are objects, or to pick a more stable/unique key —
602
+ * mirrors `tn-select`'s input of the same name.
603
+ *
604
+ * @example
605
+ * ```html
606
+ * <tn-autocomplete testId="user" [optionTestIdKey]="(o) => o.value.id" ... />
607
+ * ```
608
+ */
609
+ optionTestIdKey: _angular_core.InputSignal<((option: TnAutocompleteOption<T>) => string | number | null | undefined) | undefined>;
574
610
  /**
575
611
  * ARIA wiring from an enclosing `tn-form-field` (label, error/hint,
576
612
  * invalid, required). All-null when standalone or when `ariaLabel` overrides.
@@ -664,6 +700,21 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
664
700
  * cursor (which is conveyed via `aria-activedescendant`).
665
701
  */
666
702
  protected isOptionSelected(option: TnAutocompleteOption<T>): boolean;
703
+ /**
704
+ * Test-id segments for an option row, consumed by `[tnTestId]` with
705
+ * `tnTestIdType="option"` — see {@link optionTestId} for the derivation
706
+ * rules (shared with `tn-select`).
707
+ */
708
+ protected optionTestIdParts(option: TnAutocompleteOption<T>): (string | number | null | undefined)[];
709
+ /**
710
+ * Test-id segments for the loading / no-results status rows, consumed by
711
+ * `[tnTestId]` with `tnTestIdType="autocomplete"` so they nest under the
712
+ * input's own id: base `user` → `autocomplete-user-loading` /
713
+ * `autocomplete-user-no-results` (unscoped `autocomplete-loading` /
714
+ * `autocomplete-no-results` with no base). Mirrors webui's ix-combobox,
715
+ * which stamps its status option so automation can assert on those states.
716
+ */
717
+ protected statusTestIdParts(status: 'loading' | 'no-results'): (string | number | null | undefined)[];
667
718
  /**
668
719
  * Index of the committed value's option in the visible list, or -1 when
669
720
  * nothing is committed or the match is absent/disabled. Used to seed the
@@ -713,7 +764,7 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
713
764
  private detachOverlay;
714
765
  private scrollToHighlighted;
715
766
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnAutocompleteComponent<any>, never>;
716
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnAutocompleteComponent<any>, "tn-autocomplete", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "requireSelection": { "alias": "requireSelection"; "required": false; "isSignal": true; }; "allowCustomValue": { "alias": "allowCustomValue"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "required": false; "isSignal": true; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "noResultsText": { "alias": "noResultsText"; "required": false; "isSignal": true; }; "maxResults": { "alias": "maxResults"; "required": false; "isSignal": true; }; "panelMaxHeight": { "alias": "panelMaxHeight"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, { "optionSelected": "optionSelected"; "searchChange": "searchChange"; "loadMore": "loadMore"; "opened": "opened"; }, never, never, true, never>;
767
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnAutocompleteComponent<any>, "tn-autocomplete", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "compareWith": { "alias": "compareWith"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "requireSelection": { "alias": "requireSelection"; "required": false; "isSignal": true; }; "allowCustomValue": { "alias": "allowCustomValue"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "required": false; "isSignal": true; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "noResultsText": { "alias": "noResultsText"; "required": false; "isSignal": true; }; "maxResults": { "alias": "maxResults"; "required": false; "isSignal": true; }; "panelMaxHeight": { "alias": "panelMaxHeight"; "required": false; "isSignal": true; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; "optionTestIdKey": { "alias": "optionTestIdKey"; "required": false; "isSignal": true; }; }, { "optionSelected": "optionSelected"; "searchChange": "searchChange"; "loadMore": "loadMore"; "opened": "opened"; }, never, never, true, never>;
717
768
  }
718
769
 
719
770
  /**
@@ -6393,6 +6444,52 @@ declare class TnTablePagerHarness extends ComponentHarness {
6393
6444
  interface TnTablePagerHarnessFilters extends BaseHarnessFilters {
6394
6445
  }
6395
6446
 
6447
+ /**
6448
+ * Interface for tree expansion state management.
6449
+ * This interface replaces the deprecated TreeControl from @angular/cdk/tree.
6450
+ *
6451
+ * It provides the same methods as the deprecated TreeControl interface
6452
+ * without directly referencing the deprecated type.
6453
+ *
6454
+ * Both FlatTreeControl and NestedTreeControl implement all these methods,
6455
+ * so this interface maintains full compatibility with existing code.
6456
+ */
6457
+ interface TnTreeExpansion<T, K = T> {
6458
+ /** The saved tree nodes data for `expandAll` action. */
6459
+ dataNodes: T[];
6460
+ /** The expansion model */
6461
+ expansionModel: SelectionModel<K>;
6462
+ /** Whether the data node is expanded or collapsed. Return true if it's expanded. */
6463
+ isExpanded(dataNode: T): boolean;
6464
+ /** Get all descendants of a data node */
6465
+ getDescendants(dataNode: T): T[];
6466
+ /** Expand or collapse data node */
6467
+ toggle(dataNode: T): void;
6468
+ /** Expand one data node */
6469
+ expand(dataNode: T): void;
6470
+ /** Collapse one data node */
6471
+ collapse(dataNode: T): void;
6472
+ /** Expand all the dataNodes in the tree */
6473
+ expandAll(): void;
6474
+ /** Collapse all the dataNodes in the tree */
6475
+ collapseAll(): void;
6476
+ /** Toggle a data node by expand/collapse it and all its descendants */
6477
+ toggleDescendants(dataNode: T): void;
6478
+ /** Expand a data node and all its descendants */
6479
+ expandDescendants(dataNode: T): void;
6480
+ /** Collapse a data node and all its descendants */
6481
+ collapseDescendants(dataNode: T): void;
6482
+ /** Get depth of a given data node, return the level number. This is for flat tree node. */
6483
+ readonly getLevel: (dataNode: T) => number;
6484
+ /**
6485
+ * Whether the data node is expandable. Returns true if expandable.
6486
+ * This is for flat tree node.
6487
+ */
6488
+ readonly isExpandable: (dataNode: T) => boolean;
6489
+ /** Gets a stream that emits whenever the given data node's children change. */
6490
+ readonly getChildren: (dataNode: T) => Observable<T[]> | T[] | undefined | null;
6491
+ }
6492
+
6396
6493
  /** Flat node with expandable and level information */
6397
6494
  interface TnFlatTreeNode<T = unknown> {
6398
6495
  data: T;
@@ -6413,18 +6510,36 @@ declare class TnTreeFlattener<T, F> {
6413
6510
  }
6414
6511
  /**
6415
6512
  * Data source for flat tree.
6513
+ *
6514
+ * Optionally supports client-side filtering and sorting: set `filterPredicate`
6515
+ * (and call `filter(query)`) and/or `sortComparer`. Both are opt-in; when unset
6516
+ * the datasource behaves exactly as before.
6416
6517
  */
6417
6518
  declare class TnTreeFlatDataSource<T, F> extends DataSource<F> {
6418
6519
  private _treeControl;
6419
6520
  private _treeFlattener;
6521
+ /** When set, `filter(query)` re-renders the tree from `filterPredicate(data, query)`. */
6522
+ filterPredicate?: (data: T[], query: string) => T[];
6523
+ /** When set, incoming `data` is sorted (top level) before flattening. */
6524
+ sortComparer?: (a: T, b: T) => number;
6420
6525
  private _flattenedData;
6421
6526
  private _expandedData;
6422
6527
  private _data;
6423
- constructor(_treeControl: FlatTreeControl<F>, _treeFlattener: TnTreeFlattener<T, F>);
6528
+ private _filteredData;
6529
+ private filterValue;
6530
+ private readonly filterChanged$;
6531
+ private readonly disconnect$;
6532
+ constructor(_treeControl: TnTreeExpansion<F>, _treeFlattener: TnTreeFlattener<T, F>);
6424
6533
  get data(): T[];
6425
6534
  set data(value: T[]);
6535
+ /** The currently filtered (unflattened) data; equals `data` until `filter()` is used. */
6536
+ get filteredData(): T[];
6426
6537
  connect(): Observable<F[]>;
6427
6538
  disconnect(): void;
6539
+ /** Filters the tree using `filterPredicate` (debounced). No-op until `filterPredicate` is set. */
6540
+ filter(query: string): void;
6541
+ private flattenData;
6542
+ private detectFilterChanges;
6428
6543
  private _getExpandedNodesWithLevel;
6429
6544
  }
6430
6545
  declare class TnTreeComponent<T, K = T> extends CdkTree<T, K> {
@@ -6446,6 +6561,20 @@ declare class TnTreeNodeComponent<T, K = T> extends CdkTreeNode<T, K> {
6446
6561
  }
6447
6562
 
6448
6563
  declare class TnNestedTreeNodeComponent<T, K = T> extends CdkNestedTreeNode<T, K> {
6564
+ /**
6565
+ * Accessible label for the built-in toggle button. Pass a translated string;
6566
+ * defaults to the previous hardcoded value.
6567
+ */
6568
+ readonly toggleAriaLabel: _angular_core.InputSignal<string>;
6569
+ /** Semantic test-id base applied to the built-in toggle button (`button-` prefixed). */
6570
+ readonly toggleTestId: _angular_core.InputSignal<TnTestIdValue>;
6571
+ /**
6572
+ * Suppresses the built-in toggle button (and its alignment spacer) so the
6573
+ * consumer can render a fully custom toggle in the projected content.
6574
+ */
6575
+ readonly hideToggle: _angular_core.InputSignalWithTransform<boolean, unknown>;
6576
+ private readonly changeDetectorRef;
6577
+ private destroyed;
6449
6578
  constructor();
6450
6579
  /** The tree node's level in the tree */
6451
6580
  get level(): number;
@@ -6453,8 +6582,24 @@ declare class TnNestedTreeNodeComponent<T, K = T> extends CdkNestedTreeNode<T, K
6453
6582
  get isExpandable(): boolean;
6454
6583
  /** Whether the tree node is expanded */
6455
6584
  get isExpanded(): boolean;
6585
+ /**
6586
+ * CDK inserts child node views synchronously from `ngAfterContentInit`, i.e.
6587
+ * mid-change-detection. Because the outlet here lives in PROJECTED content
6588
+ * whose view container has already been traversed for the current pass, the
6589
+ * new views would miss their first check and trip dev-mode NG0100. Defer the
6590
+ * insertion to a microtask so the views are created outside change detection
6591
+ * and get a normal first check on the pass that `markForCheck` schedules.
6592
+ */
6593
+ protected updateChildrenNodes(children?: T[]): void;
6594
+ /**
6595
+ * Toggles the node; with the Alt key held, toggles the node together with all
6596
+ * of its descendants. Replaces `cdkTreeNodeToggle` on the built-in button so
6597
+ * the Alt behavior is deterministic (a stacked template listener would run in
6598
+ * an unspecified order relative to the CDK toggle's own click handler).
6599
+ */
6600
+ protected toggleNode(event: Event): void;
6456
6601
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnNestedTreeNodeComponent<any, any>, never>;
6457
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnNestedTreeNodeComponent<any, any>, "tn-nested-tree-node", ["tnNestedTreeNode"], {}, {}, never, ["*", "[slot=children]"], true, never>;
6602
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnNestedTreeNodeComponent<any, any>, "tn-nested-tree-node", ["tnNestedTreeNode"], { "toggleAriaLabel": { "alias": "toggleAriaLabel"; "required": false; "isSignal": true; }; "toggleTestId": { "alias": "toggleTestId"; "required": false; "isSignal": true; }; "hideToggle": { "alias": "hideToggle"; "required": false; "isSignal": true; }; }, {}, never, ["*", "[slot=children]"], true, [{ directive: typeof TnTestIdDirective; inputs: { "tnTestId": "testId"; }; outputs: {}; }]>;
6458
6603
  }
6459
6604
 
6460
6605
  declare class TnTreeNodeOutletDirective {
@@ -6462,6 +6607,228 @@ declare class TnTreeNodeOutletDirective {
6462
6607
  static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TnTreeNodeOutletDirective, "[tnTreeNodeOutlet]", never, {}, {}, never, never, true, [{ directive: typeof i1.CdkTreeNodeOutlet; inputs: {}; outputs: {}; }]>;
6463
6608
  }
6464
6609
 
6610
+ /**
6611
+ * Data source for nested trees (`tn-nested-tree-node`).
6612
+ *
6613
+ * Optionally supports client-side filtering and sorting: set `filterPredicate`
6614
+ * (and call `filter(query)`) and/or `sortComparer` (applied recursively through
6615
+ * `children`). Both are opt-in.
6616
+ */
6617
+ declare class TnNestedTreeDataSource<T extends {
6618
+ children?: T[];
6619
+ }> extends DataSource<T> {
6620
+ /** When set, `filter(query)` re-renders the tree from `filterPredicate(data, query)`. */
6621
+ filterPredicate?: (data: T[], query: string) => T[];
6622
+ /** When set, incoming `data` is sorted recursively before rendering. */
6623
+ sortComparer?: (a: T, b: T) => number;
6624
+ private filterValue;
6625
+ private readonly filterChanged$;
6626
+ private readonly _data;
6627
+ private readonly _filteredData;
6628
+ private readonly disconnect$;
6629
+ get data(): T[];
6630
+ set data(value: T[]);
6631
+ constructor(initialData?: T[]);
6632
+ connect(collectionViewer: CollectionViewer): Observable<T[]>;
6633
+ disconnect(): void;
6634
+ /** Filters the tree using `filterPredicate` (debounced). No-op until `filterPredicate` is set. */
6635
+ filter(query: string): void;
6636
+ private detectFilterChanges;
6637
+ private sort;
6638
+ }
6639
+
6640
+ /**
6641
+ * Factory functions for creating tree controls without triggering deprecation warnings
6642
+ * in consuming code.
6643
+ *
6644
+ * ## Why we still use deprecated TreeControl classes
6645
+ *
6646
+ * Angular CDK deprecated TreeControl, FlatTreeControl, and NestedTreeControl in v19,
6647
+ * with plans to remove them in v21. However, a complete replacement API has not been
6648
+ * provided yet.
6649
+ *
6650
+ * ### The Problem with Current Migration Path
6651
+ *
6652
+ * The deprecation message suggests using `levelAccessor` or `childrenAccessor` on CdkTree,
6653
+ * but these are only for describing your data structure - they don't provide:
6654
+ *
6655
+ * 1. **Programmatic access to expansion state** - CdkTree's `_expansionModel` is private
6656
+ * 2. **Access to data nodes** - Needed for operations like `expandAll()`
6657
+ * 3. **Helper methods** - Like `getDescendants()`, `isExpandable()`, `getLevel()`
6658
+ * 4. **External expansion control** - Data sources need to react to expansion changes
6659
+ *
6660
+ * ### Our Solution: Centralized Technical Debt
6661
+ *
6662
+ * This file encapsulates ALL usage of deprecated TreeControl classes:
6663
+ *
6664
+ * - Consumers work with the `TnTreeExpansion` interface (not deprecated)
6665
+ * - When Angular provides a proper replacement API, only this file changes and the
6666
+ * `TnTreeExpansion` interface stays stable, making the migration transparent
6667
+ *
6668
+ * @see https://github.com/angular/components/issues/29856 - GitHub issue discussing the migration gap
6669
+ */
6670
+ /** Optional configuration for flat tree control */
6671
+ interface FlatTreeControlOptions<T, K> {
6672
+ trackBy?: (dataNode: T) => K;
6673
+ }
6674
+ /** Optional configuration for nested tree control */
6675
+ interface NestedTreeControlOptions<T, K> {
6676
+ isExpandable?: (dataNode: T) => boolean;
6677
+ trackBy?: (dataNode: T) => K;
6678
+ }
6679
+ /**
6680
+ * Creates a flat tree control for managing expansion state of flat tree structures.
6681
+ *
6682
+ * @param getLevel - Function that returns the level/depth of a node
6683
+ * @param isExpandable - Function that returns whether a node can be expanded
6684
+ * @param options - Optional configuration including trackBy function
6685
+ * @returns TnTreeExpansion instance for managing tree state
6686
+ *
6687
+ * @example
6688
+ * ```ts
6689
+ * const treeControl = createFlatTreeControl<DatasetDetails, string>(
6690
+ * (dataset) => (dataset?.name?.split('/')?.length || 0) - 1,
6691
+ * (dataset) => Number(dataset?.children?.length) > 0,
6692
+ * { trackBy: (dataset) => dataset.id }
6693
+ * );
6694
+ * ```
6695
+ */
6696
+ declare function createFlatTreeControl<T, K = T>(getLevel: (dataNode: T) => number, isExpandable: (dataNode: T) => boolean, options?: FlatTreeControlOptions<T, K>): TnTreeExpansion<T, K>;
6697
+ /**
6698
+ * Creates a nested tree control for managing expansion state of nested tree structures.
6699
+ *
6700
+ * @param getChildren - Function that returns the children of a node
6701
+ * @param options - Optional configuration including isExpandable and trackBy functions
6702
+ * @returns TnTreeExpansion instance for managing tree state
6703
+ *
6704
+ * @example
6705
+ * ```ts
6706
+ * const treeControl = createNestedTreeControl<VDevNode, string>(
6707
+ * (vdev) => vdev.children,
6708
+ * { trackBy: (vdev) => vdev.guid }
6709
+ * );
6710
+ * ```
6711
+ */
6712
+ declare function createNestedTreeControl<T, K = T>(getChildren: (dataNode: T) => Observable<T[]> | T[] | undefined | null, options?: NestedTreeControlOptions<T, K>): TnTreeExpansion<T, K>;
6713
+
6714
+ /** Filters for finding `TnTreeNodeHarness` instances. */
6715
+ interface TnTreeNodeHarnessFilters extends BaseHarnessFilters {
6716
+ /** Only find nodes whose text matches the given value. */
6717
+ text?: string | RegExp;
6718
+ /** Only find nodes whose expansion state matches. */
6719
+ expanded?: boolean;
6720
+ /** Only find nodes at the given 0-based level (root nodes are 0). */
6721
+ level?: number;
6722
+ }
6723
+ /** Filters for finding `TnTreeHarness` instances. */
6724
+ type TnTreeHarnessFilters = BaseHarnessFilters;
6725
+ /**
6726
+ * Harness for interacting with a single `tn-tree-node` or `tn-nested-tree-node`.
6727
+ *
6728
+ * Levels are 0-based (root nodes are level 0), matching the values consumers pass
6729
+ * to tree controls — the DOM's 1-based `aria-level` is converted internally.
6730
+ */
6731
+ declare class TnTreeNodeHarness extends ComponentHarness {
6732
+ static hostSelector: string;
6733
+ /** The built-in nested-node toggle button (absent on flat nodes, leaves, and `hideToggle` nodes). */
6734
+ private readonly nestedToggle;
6735
+ /** The flat node's row, which acts as its toggle surface. */
6736
+ private readonly flatRow;
6737
+ /**
6738
+ * Gets a `HarnessPredicate` that can be used to search for a tree node with
6739
+ * specific attributes.
6740
+ *
6741
+ * @param options Options for filtering which instances are considered a match.
6742
+ * @returns A `HarnessPredicate` configured with the given options.
6743
+ */
6744
+ static with(options?: TnTreeNodeHarnessFilters): HarnessPredicate<TnTreeNodeHarness>;
6745
+ /**
6746
+ * Gets the node's own text, excluding any descendant tree nodes and the
6747
+ * built-in toggle button.
6748
+ *
6749
+ * @returns Promise resolving to the node's text.
6750
+ */
6751
+ getText(): Promise<string>;
6752
+ /**
6753
+ * Gets the node's 0-based level (root nodes are 0).
6754
+ *
6755
+ * @returns Promise resolving to the level.
6756
+ */
6757
+ getLevel(): Promise<number>;
6758
+ /**
6759
+ * Whether the node is expandable (advertises `aria-expanded`).
6760
+ *
6761
+ * @returns Promise resolving to true if the node is expandable.
6762
+ */
6763
+ isExpandable(): Promise<boolean>;
6764
+ /**
6765
+ * Whether an expandable node is currently expanded.
6766
+ *
6767
+ * @returns Promise resolving to true if `aria-expanded="true"`.
6768
+ */
6769
+ isExpanded(): Promise<boolean>;
6770
+ /**
6771
+ * Toggles the node's expansion by clicking its toggle surface — the built-in
6772
+ * toggle button on a nested node, or the row itself on a flat node. Throws for
6773
+ * nested nodes rendered with `hideToggle` (interact with the custom toggle
6774
+ * directly in that case).
6775
+ */
6776
+ toggle(): Promise<void>;
6777
+ /**
6778
+ * Toggles the node together with all of its descendants (Alt+click on the
6779
+ * built-in nested-node toggle).
6780
+ */
6781
+ toggleWithDescendants(): Promise<void>;
6782
+ /**
6783
+ * Expands the node if it is expandable and currently collapsed.
6784
+ */
6785
+ expand(): Promise<void>;
6786
+ /**
6787
+ * Collapses the node if it is currently expanded.
6788
+ */
6789
+ collapse(): Promise<void>;
6790
+ private getToggle;
6791
+ }
6792
+ /**
6793
+ * Harness for interacting with `tn-tree` in tests.
6794
+ *
6795
+ * @example
6796
+ * ```typescript
6797
+ * const tree = await loader.getHarness(TnTreeHarness);
6798
+ * const roots = await tree.getNodes({ level: 0 });
6799
+ * await roots[0].expand();
6800
+ * expect(await tree.getNodeTexts()).toContain('child');
6801
+ * ```
6802
+ */
6803
+ declare class TnTreeHarness extends ComponentHarness {
6804
+ static hostSelector: string;
6805
+ /**
6806
+ * Gets a `HarnessPredicate` that can be used to search for a tree with
6807
+ * specific attributes.
6808
+ *
6809
+ * @param options Options for filtering which instances are considered a match.
6810
+ * @returns A `HarnessPredicate` configured with the given options.
6811
+ */
6812
+ static with(options?: TnTreeHarnessFilters): HarnessPredicate<TnTreeHarness>;
6813
+ /**
6814
+ * Gets the harnesses for the tree's nodes (all levels, in document order).
6815
+ *
6816
+ * Note: nested trees render collapsed subtrees into the DOM (hidden via CSS),
6817
+ * so nodes under a collapsed parent are still returned — filter by `level` or
6818
+ * check the parent's `isExpanded()` when visibility matters.
6819
+ *
6820
+ * @param filter Optional filter to narrow the nodes.
6821
+ * @returns Promise resolving to the matching node harnesses.
6822
+ */
6823
+ getNodes(filter?: TnTreeNodeHarnessFilters): Promise<TnTreeNodeHarness[]>;
6824
+ /**
6825
+ * Gets the text of every node currently rendered, in document order.
6826
+ *
6827
+ * @returns Promise resolving to an array of node texts.
6828
+ */
6829
+ getNodeTexts(): Promise<string[]>;
6830
+ }
6831
+
6465
6832
  /**
6466
6833
  * A single flattened tree node prepared for virtual-scroll rendering.
6467
6834
  *
@@ -9359,5 +9726,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
9359
9726
  */
9360
9727
  declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
9361
9728
 
9362
- export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_CONTEXT, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardFooterActionsDirective, TnCardHeaderActionsDirective, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnChipHarness, TnChipInputComponent, TnChipInputHarness, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFileInputComponent, TnFileInputHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnFormSectionComponent, TnFormSectionHarness, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnStepperHarness, TnStepperNextDirective, TnStepperPreviousDirective, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TnTreeVirtualScrollNodeOutletDirective, TnTreeVirtualScrollViewComponent, TnTreeVirtualScrollViewHarness, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, controlTestId, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, defaultTreeItemSize, formatSize, injectTnFormFieldAria, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
9363
- export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, ButtonToggleHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, ChipHarnessFilters, CreateFolderEvent, DateInputHarnessFilters, DateRange, DateRangeInputHarnessFilters, DialogHarnessFilters, EmptyHarnessFilters, ExpansionPanelHarnessFilters, FileInputHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FormFieldHarnessFilters, FormSectionHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelMarkupSegment, LabelMarkupSegmentType, LabelType, LucideIconOptions, MenuHarnessFilters, MockIconRegistry, MockSpriteLoader, PathSegment, PlatformType, ProgressBarMode, RadioHarnessFilters, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SizeStandard, SlideToggleColor, SlideToggleHarnessFilters, SpinnerMode, SpriteConfig, StepperHarnessFilters, SubscriptSizing, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnAutocompleteOption, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnChipInputHarnessFilters, TnChipInputOption, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnFormFieldAriaBindings, TnFormFieldContext, TnFormFieldErrorMessage, TnFormFieldErrorMessages, TnFormFieldErrorResolver, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnSortEvent, TnTableDataProvider, TnTableDataSource, TnTableHarnessFilters, TnTablePagerHarnessFilters, TnTablePagerLabels, TnTablePagination, TnTestAttrName, TnTestIdValue, TnThemeDefinition, TnToastCall, TnToastConfig, TnTreeVirtualNodeData, TnTreeVirtualScrollViewHarnessFilters, TooltipPosition, YearCell };
9729
+ export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_CONTEXT, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardFooterActionsDirective, TnCardHeaderActionsDirective, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnChipHarness, TnChipInputComponent, TnChipInputHarness, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFileInputComponent, TnFileInputHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnFormSectionComponent, TnFormSectionHarness, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeDataSource, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnStepperHarness, TnStepperNextDirective, TnStepperPreviousDirective, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeHarness, TnTreeNodeComponent, TnTreeNodeHarness, TnTreeNodeOutletDirective, TnTreeVirtualScrollNodeOutletDirective, TnTreeVirtualScrollViewComponent, TnTreeVirtualScrollViewHarness, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, controlTestId, createFlatTreeControl, createLucideLibrary, createNestedTreeControl, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, defaultTreeItemSize, formatSize, injectTnFormFieldAria, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, optionTestId, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
9730
+ export type { AutocompleteHarnessFilters, BannerHarnessFilters, ButtonHarnessFilters, ButtonToggleHarnessFilters, CalendarCell, CheckboxHarnessFilters, ChipColor, ChipHarnessFilters, CreateFolderEvent, DateInputHarnessFilters, DateRange, DateRangeInputHarnessFilters, DialogHarnessFilters, EmptyHarnessFilters, ExpansionPanelHarnessFilters, FileInputHarnessFilters, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, FlatTreeControlOptions, FormFieldHarnessFilters, FormSectionHarnessFilters, IconButtonHarnessFilters, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, IconTestingMockOverrides, InputHarnessFilters, KeyCombination, LabelMarkupSegment, LabelMarkupSegmentType, LabelType, LucideIconOptions, MenuHarnessFilters, MockIconRegistry, MockSpriteLoader, NestedTreeControlOptions, PathSegment, PlatformType, ProgressBarMode, RadioHarnessFilters, ResolvedIcon, SelectHarnessFilters, ShortcutHandler, SidePanelHarnessFilters, SizeStandard, SlideToggleColor, SlideToggleHarnessFilters, SpinnerMode, SpriteConfig, StepperHarnessFilters, SubscriptSizing, TabChangeEvent, TabHarnessFilters, TabPanelHarnessFilters, TabsHarnessFilters, TnAutocompleteOption, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnChipInputHarnessFilters, TnChipInputOption, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnDrawerMode, TnDrawerPosition, TnEmptySize, TnFlatTreeNode, TnFormFieldAriaBindings, TnFormFieldContext, TnFormFieldErrorMessage, TnFormFieldErrorMessages, TnFormFieldErrorResolver, TnMenuItem, TnOptionTestIdSource, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnSortEvent, TnTableDataProvider, TnTableDataSource, TnTableHarnessFilters, TnTablePagerHarnessFilters, TnTablePagerLabels, TnTablePagination, TnTestAttrName, TnTestIdValue, TnThemeDefinition, TnToastCall, TnToastConfig, TnTreeExpansion, TnTreeHarnessFilters, TnTreeNodeHarnessFilters, TnTreeVirtualNodeData, TnTreeVirtualScrollViewHarnessFilters, TooltipPosition, YearCell };