@truenas/ui-components 0.5.1 → 0.5.3

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.5.1",
3
+ "version": "0.5.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1520,12 +1520,15 @@ declare class TnTooltipDirective implements AfterViewInit, OnDestroy {
1520
1520
  private _hideTimeout;
1521
1521
  private _isTooltipVisible;
1522
1522
  private _positionSub;
1523
+ private _focusSub;
1523
1524
  private _tooltipId;
1524
1525
  private _overlay;
1525
1526
  private _elementRef;
1526
1527
  private _viewContainerRef;
1527
1528
  private _overlayPositionBuilder;
1528
1529
  private _ariaDescriber;
1530
+ private _focusMonitor;
1531
+ private _ngZone;
1529
1532
  private _viewInitialized;
1530
1533
  private _describedTarget;
1531
1534
  private _describedMessage;
@@ -1557,8 +1560,6 @@ declare class TnTooltipDirective implements AfterViewInit, OnDestroy {
1557
1560
  ngOnDestroy(): void;
1558
1561
  _onMouseEnter(): void;
1559
1562
  _onMouseLeave(): void;
1560
- _onFocusIn(): void;
1561
- _onFocusOut(event: FocusEvent): void;
1562
1563
  _onKeydown(event: KeyboardEvent): void;
1563
1564
  /** Shows the tooltip */
1564
1565
  show(delay?: number): void;
@@ -2856,9 +2857,12 @@ declare class TnChipInputComponent<T = string> implements ControlValueAccessor,
2856
2857
  /**
2857
2858
  * Semantic test-id base. The library prepends the `chip-input` element type
2858
2859
  * (e.g. `testId="tags"` → `chip-input-tags`); each chip and suggestion is
2859
- * scoped beneath it.
2860
+ * scoped beneath it. Falls back to the bound control name when unset, so
2861
+ * `<tn-chip-input formControlName="isnsServers">` emits `chip-input-isns-servers`.
2860
2862
  */
2861
2863
  testId: _angular_core.InputSignal<TnTestIdValue>;
2864
+ /** Test-id base, falling back to the bound control name when `testId` is unset. */
2865
+ protected resolvedTestId: _angular_core.Signal<TnTestIdValue>;
2862
2866
  /** Emits the committed value whenever a chip is added. */
2863
2867
  chipAdded: _angular_core.OutputEmitterRef<T>;
2864
2868
  /** Emits the removed value whenever a chip is removed. */
@@ -2917,8 +2921,38 @@ declare class TnChipInputComponent<T = string> implements ControlValueAccessor,
2917
2921
  protected removeChip(index: number): void;
2918
2922
  /** The label shown on a chip for a committed value. */
2919
2923
  protected displayLabel(value: T): string;
2920
- /** Scopes a per-chip test id beneath the component's base. */
2924
+ /**
2925
+ * Scopes a per-chip test id beneath the component's base.
2926
+ *
2927
+ * The discriminator is the value itself when primitive, else the matching
2928
+ * option's label — `String(value)` on an object is `[object Object]`, which
2929
+ * would stamp an identical id on every chip. Duplicates are worse than
2930
+ * absence for automation, so an object value with no option to name it yet
2931
+ * (options still loading) stays attribute-free rather than colliding. A primitive
2932
+ * that normalizes away is dropped for the same reason — see
2933
+ * {@link discriminatedTestId}.
2934
+ */
2921
2935
  protected chipTestId(value: T): TnTestIdValue;
2936
+ /**
2937
+ * Scopes a per-suggestion test id beneath the component's base, via the shared
2938
+ * dropdown-option derivation. Unlike `tn-select` / `tn-autocomplete`, which
2939
+ * emit an unscoped `option-<value>` when they have no base, an unidentified
2940
+ * chip-input stays attribute-free — its rows carry no page-unique id, so
2941
+ * emitting one would invite collisions between inputs.
2942
+ */
2943
+ protected suggestionTestId(option: TnChipInputOption<T>): TnTestIdValue;
2944
+ /**
2945
+ * Keeps a scoped id only when both halves of it survive normalization.
2946
+ *
2947
+ * The base has to be usable: an unscoped `chip-<value>` would collide across every
2948
+ * chip-input on the page, so unidentified inputs stay attribute-free. The
2949
+ * discriminator has to contribute a segment of its own, because
2950
+ * `kebabTestSegment` drops every run of non-alphanumerics — a value like `*`, `**`
2951
+ * or a CJK-only tag normalizes to nothing and collapses the id back to the bare
2952
+ * base, stamping the same id on every chip. That is the duplicate-id case the
2953
+ * object-value path already avoids, reached through a primitive instead.
2954
+ */
2955
+ private discriminatedTestId;
2922
2956
  private isCommitKey;
2923
2957
  /** Commits typed text: resolve it to an option's value, else accept as custom. */
2924
2958
  private commitText;
@@ -3225,6 +3259,13 @@ declare class TnCardComponent {
3225
3259
  titleQueryParams: _angular_core.InputSignal<Record<string, unknown> | undefined>;
3226
3260
  /** Help/hover text shown on the title via the tooltip directive. */
3227
3261
  titleTooltip: _angular_core.InputSignal<string | undefined>;
3262
+ /**
3263
+ * Accessible name for the help button that carries `titleTooltip`. Same reason as
3264
+ * `headerMenuTriggerAriaLabel`: the library cannot translate its own `'More information'`
3265
+ * default, so a consumer with an i18n layer passes an already-translated string here.
3266
+ */
3267
+ titleTooltipAriaLabel: _angular_core.InputSignal<string | undefined>;
3268
+ protected readonly resolvedTitleTooltipAriaLabel: _angular_core.Signal<string>;
3228
3269
  elevation: _angular_core.InputSignal<"none" | "low" | "medium" | "high">;
3229
3270
  padding: _angular_core.InputSignal<"small" | "large" | "medium">;
3230
3271
  padContent: _angular_core.InputSignal<boolean>;
@@ -3248,6 +3289,28 @@ declare class TnCardComponent {
3248
3289
  * (default `data-testid`).
3249
3290
  */
3250
3291
  headerMenuTriggerTestId: _angular_core.InputSignal<string | undefined>;
3292
+ /**
3293
+ * Accessible name for the kebab-menu trigger rendered when `headerMenu` is set.
3294
+ *
3295
+ * The library cannot translate its own default, so a consumer with an i18n layer must be able to
3296
+ * supply an already-translated string here — otherwise the trigger's only accessible name is the
3297
+ * English `'Card menu'` fallback. Also used as the trigger's tooltip when
3298
+ * `headerMenuTriggerTooltip` is not set.
3299
+ */
3300
+ headerMenuTriggerAriaLabel: _angular_core.InputSignal<string | undefined>;
3301
+ /**
3302
+ * Hover tooltip for the kebab-menu trigger. Defaults to `headerMenuTriggerAriaLabel`, so setting
3303
+ * a single translated string covers both the accessible name and the visible hint.
3304
+ */
3305
+ headerMenuTriggerTooltip: _angular_core.InputSignal<string | undefined>;
3306
+ protected readonly resolvedHeaderMenuAriaLabel: _angular_core.Signal<string>;
3307
+ /**
3308
+ * The trigger has no tooltip unless the consumer asks for one — either explicitly, or by naming
3309
+ * the trigger and letting that one string drive both. Falling back to the built-in `'Card menu'`
3310
+ * default instead would put a new hover hint on every existing `[headerMenu]` consumer, one that
3311
+ * only repeats the button's accessible name.
3312
+ */
3313
+ protected readonly resolvedHeaderMenuTooltip: _angular_core.Signal<string | undefined>;
3251
3314
  primaryAction: _angular_core.InputSignal<TnCardAction | undefined>;
3252
3315
  secondaryAction: _angular_core.InputSignal<TnCardAction | undefined>;
3253
3316
  footerLink: _angular_core.InputSignal<TnCardFooterLink | undefined>;
@@ -3266,7 +3329,7 @@ declare class TnCardComponent {
3266
3329
  onHeaderMenuItemClick(_item: TnMenuItem): void;
3267
3330
  getStatusClass(type?: string): string;
3268
3331
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnCardComponent, never>;
3269
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnCardComponent, "tn-card", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "titleLink": { "alias": "titleLink"; "required": false; "isSignal": true; }; "titleRouterLink": { "alias": "titleRouterLink"; "required": false; "isSignal": true; }; "titleQueryParams": { "alias": "titleQueryParams"; "required": false; "isSignal": true; }; "titleTooltip": { "alias": "titleTooltip"; "required": false; "isSignal": true; }; "elevation": { "alias": "elevation"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "padContent": { "alias": "padContent"; "required": false; "isSignal": true; }; "fillHeight": { "alias": "fillHeight"; "required": false; "isSignal": true; }; "bordered": { "alias": "bordered"; "required": false; "isSignal": true; }; "background": { "alias": "background"; "required": false; "isSignal": true; }; "headerStatus": { "alias": "headerStatus"; "required": false; "isSignal": true; }; "headerControl": { "alias": "headerControl"; "required": false; "isSignal": true; }; "headerMenu": { "alias": "headerMenu"; "required": false; "isSignal": true; }; "headerMenuTriggerTestId": { "alias": "headerMenuTriggerTestId"; "required": false; "isSignal": true; }; "primaryAction": { "alias": "primaryAction"; "required": false; "isSignal": true; }; "secondaryAction": { "alias": "secondaryAction"; "required": false; "isSignal": true; }; "footerLink": { "alias": "footerLink"; "required": false; "isSignal": true; }; }, {}, ["projectedHeader", "headerActions", "footerActions"], ["[tnCardHeader]", "*"], true, never>;
3332
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnCardComponent, "tn-card", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; "titleLink": { "alias": "titleLink"; "required": false; "isSignal": true; }; "titleRouterLink": { "alias": "titleRouterLink"; "required": false; "isSignal": true; }; "titleQueryParams": { "alias": "titleQueryParams"; "required": false; "isSignal": true; }; "titleTooltip": { "alias": "titleTooltip"; "required": false; "isSignal": true; }; "titleTooltipAriaLabel": { "alias": "titleTooltipAriaLabel"; "required": false; "isSignal": true; }; "elevation": { "alias": "elevation"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "padContent": { "alias": "padContent"; "required": false; "isSignal": true; }; "fillHeight": { "alias": "fillHeight"; "required": false; "isSignal": true; }; "bordered": { "alias": "bordered"; "required": false; "isSignal": true; }; "background": { "alias": "background"; "required": false; "isSignal": true; }; "headerStatus": { "alias": "headerStatus"; "required": false; "isSignal": true; }; "headerControl": { "alias": "headerControl"; "required": false; "isSignal": true; }; "headerMenu": { "alias": "headerMenu"; "required": false; "isSignal": true; }; "headerMenuTriggerTestId": { "alias": "headerMenuTriggerTestId"; "required": false; "isSignal": true; }; "headerMenuTriggerAriaLabel": { "alias": "headerMenuTriggerAriaLabel"; "required": false; "isSignal": true; }; "headerMenuTriggerTooltip": { "alias": "headerMenuTriggerTooltip"; "required": false; "isSignal": true; }; "primaryAction": { "alias": "primaryAction"; "required": false; "isSignal": true; }; "secondaryAction": { "alias": "secondaryAction"; "required": false; "isSignal": true; }; "footerLink": { "alias": "footerLink"; "required": false; "isSignal": true; }; }, {}, ["projectedHeader", "headerActions", "footerActions"], ["[tnCardHeader]", "*"], true, never>;
3270
3333
  }
3271
3334
 
3272
3335
  /**