@truenas/ui-components 0.1.66 → 0.1.67

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.1.66",
3
+ "version": "0.1.67",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { ElementRef, OnDestroy, AfterViewInit, OnInit, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef, InjectionToken, Signal, PipeTransform, ViewContainerRef, AfterViewChecked, ComponentRef } from '@angular/core';
2
+ import { OnDestroy, ElementRef, AfterViewInit, OnInit, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef, InjectionToken, Signal, PipeTransform, ViewContainerRef, AfterViewChecked, ComponentRef } from '@angular/core';
3
3
  import { ControlValueAccessor, NgControl } from '@angular/forms';
4
4
  import { ComponentHarness, BaseHarnessFilters, HarnessPredicate, HarnessLoader } from '@angular/cdk/testing';
5
5
  import { SafeHtml, SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
@@ -14,8 +14,10 @@ import { Overlay } from '@angular/cdk/overlay';
14
14
  import { DialogConfig, DialogRef } from '@angular/cdk/dialog';
15
15
  import { ComponentType } from '@angular/cdk/portal';
16
16
 
17
- declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccessor {
17
+ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccessor, OnDestroy {
18
18
  private readonly elementRef;
19
+ private readonly overlay;
20
+ private readonly viewContainerRef;
19
21
  /** Unique instance ID for ARIA linkage */
20
22
  protected readonly uid: string;
21
23
  /** All available options */
@@ -32,14 +34,31 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
32
34
  filterFn: _angular_core.InputSignal<((option: T, searchTerm: string) => boolean) | undefined>;
33
35
  /** Text shown when no options match the search */
34
36
  noResultsText: _angular_core.InputSignal<string>;
35
- /** Maximum number of options to render */
37
+ /**
38
+ * Maximum number of options to render.
39
+ *
40
+ * Defaults to `Infinity` so browsing the open dropdown without a search term
41
+ * never silently truncates a long list. Pass an explicit cap if you want to
42
+ * limit how many filtered results are rendered at once.
43
+ */
36
44
  maxResults: _angular_core.InputSignal<number>;
45
+ /**
46
+ * Max height of the dropdown panel before it scrolls. Accepts a number
47
+ * (interpreted as `px`) or any CSS length string (e.g. `'320px'`,
48
+ * `'min(320px, 40vh)'`). Surfaced as the `--tn-autocomplete-panel-max-height`
49
+ * custom property so it can also be themed in CSS.
50
+ */
51
+ panelMaxHeight: _angular_core.InputSignal<string | number>;
37
52
  /** Test ID attribute */
38
53
  testId: _angular_core.InputSignal<string>;
39
54
  /** Emits when an option is selected */
40
55
  optionSelected: _angular_core.OutputEmitterRef<T>;
41
56
  /** Reference to the input element */
42
57
  inputEl: _angular_core.Signal<ElementRef<HTMLInputElement> | undefined>;
58
+ /** Template for the dropdown panel, portaled into a CDK overlay on open. */
59
+ private dropdownTemplate;
60
+ /** Normalized panel max-height as a CSS length string. */
61
+ protected panelMaxHeightValue: _angular_core.Signal<string>;
43
62
  /** Current search term typed by the user */
44
63
  protected searchTerm: _angular_core.WritableSignal<string>;
45
64
  /** Whether the dropdown is open */
@@ -58,7 +77,11 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
58
77
  protected hasResults: _angular_core.Signal<boolean>;
59
78
  private onChange;
60
79
  private onTouched;
61
- constructor();
80
+ /** Live overlay holding the dropdown panel, or undefined when closed. */
81
+ private overlayRef?;
82
+ /** Subscriptions tied to the current overlay; torn down on close. */
83
+ private overlaySubs;
84
+ ngOnDestroy(): void;
62
85
  writeValue(value: T | null): void;
63
86
  registerOnChange(fn: (value: T | null) => void): void;
64
87
  registerOnTouched(fn: () => void): void;
@@ -69,10 +92,22 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
69
92
  onOptionClick(option: T): void;
70
93
  onKeydown(event: KeyboardEvent): void;
71
94
  private selectOption;
95
+ private open;
72
96
  private close;
97
+ /**
98
+ * Attach the dropdown panel as a CDK overlay anchored to the input.
99
+ *
100
+ * Why an overlay (vs. an inline absolutely-positioned panel): the panel is
101
+ * appended to the overlay container on `document.body`, so it can never be
102
+ * clipped by an ancestor's `overflow: hidden`/`auto` (e.g. a surrounding
103
+ * card). CDK also flips the panel above the input near the viewport edge and
104
+ * matches its width to the input. Mirrors TnSelectComponent's approach.
105
+ */
106
+ private attachOverlay;
107
+ private detachOverlay;
73
108
  private scrollToHighlighted;
74
109
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnAutocompleteComponent<any>, never>;
75
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnAutocompleteComponent<any>, "tn-autocomplete", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "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; }; "filterFn": { "alias": "filterFn"; "required": false; "isSignal": true; }; "noResultsText": { "alias": "noResultsText"; "required": false; "isSignal": true; }; "maxResults": { "alias": "maxResults"; "required": false; "isSignal": true; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, { "optionSelected": "optionSelected"; }, never, never, true, never>;
110
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnAutocompleteComponent<any>, "tn-autocomplete", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "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; }; "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; }; "testId": { "alias": "testId"; "required": false; "isSignal": true; }; }, { "optionSelected": "optionSelected"; }, never, never, true, never>;
76
111
  }
77
112
 
78
113
  /**
@@ -2284,7 +2319,7 @@ declare class TnTabsComponent implements AfterContentInit, AfterViewInit, OnDest
2284
2319
  tabHeader: _angular_core.Signal<ElementRef<HTMLElement>>;
2285
2320
  selectedIndex: _angular_core.InputSignal<number>;
2286
2321
  orientation: _angular_core.InputSignal<"horizontal" | "vertical">;
2287
- highlightPosition: _angular_core.InputSignal<"left" | "right" | "top" | "bottom">;
2322
+ highlightPosition: _angular_core.InputSignal<"bottom" | "top" | "left" | "right">;
2288
2323
  /**
2289
2324
  * Test-id applied to the tablist root element. Rendered under whichever attribute name
2290
2325
  * is configured via `TN_TEST_ATTR` (default `data-testid`).