@truenas/ui-components 0.4.10 → 0.4.12

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.4.10",
3
+ "version": "0.4.12",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -1,6 +1,6 @@
1
1
  import * as _truenas_ui_components from '@truenas/ui-components';
2
2
  import * as _angular_core from '@angular/core';
3
- import { Signal, InjectionToken, Renderer2, OnDestroy, ElementRef, AfterViewInit, OnInit, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef, TrackByFunction, OnChanges, DoCheck, SimpleChanges, PipeTransform, ViewContainerRef, AfterViewChecked, ComponentRef } from '@angular/core';
3
+ import { Signal, InjectionToken, Renderer2, OnDestroy, ElementRef, AfterViewInit, TemplateRef, AfterContentInit, Provider, ChangeDetectorRef, OnInit, TrackByFunction, OnChanges, DoCheck, SimpleChanges, PipeTransform, ViewContainerRef, AfterViewChecked, ComponentRef } from '@angular/core';
4
4
  import { ControlValueAccessor, NgControl, AbstractControl } from '@angular/forms';
5
5
  import { ComponentHarness, BaseHarnessFilters, HarnessPredicate, TestKey, HarnessLoader, ModifierKeys as ModifierKeys$1 } from '@angular/cdk/testing';
6
6
  import { SafeHtml, SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
@@ -1300,6 +1300,7 @@ declare class TnButtonComponent implements AfterViewInit {
1300
1300
  classes: _angular_core.Signal<string[]>;
1301
1301
  handleAnchorClick(event: MouseEvent): void;
1302
1302
  private hostRef;
1303
+ constructor();
1303
1304
  private innerRef;
1304
1305
  ngAfterViewInit(): void;
1305
1306
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnButtonComponent, never>;
@@ -1506,7 +1507,7 @@ declare class TnIconComponent {
1506
1507
  }
1507
1508
 
1508
1509
  type TooltipPosition = 'above' | 'below' | 'left' | 'right' | 'before' | 'after';
1509
- declare class TnTooltipDirective implements OnInit, OnDestroy {
1510
+ declare class TnTooltipDirective implements AfterViewInit, OnDestroy {
1510
1511
  message: _angular_core.InputSignal<string>;
1511
1512
  position: _angular_core.InputSignal<TooltipPosition>;
1512
1513
  disabled: _angular_core.InputSignal<boolean>;
@@ -1520,22 +1521,44 @@ declare class TnTooltipDirective implements OnInit, OnDestroy {
1520
1521
  private _isTooltipVisible;
1521
1522
  private _positionSub;
1522
1523
  private _tooltipId;
1523
- /**
1524
- * Only point `aria-describedby` at the tooltip when there is actually a message to
1525
- * describe. Otherwise every host (e.g. an icon button with no tooltip) would carry a
1526
- * dangling reference to a tooltip element that is never rendered.
1527
- */
1528
- protected get _ariaDescribedBy(): string | null;
1529
1524
  private _overlay;
1530
1525
  private _elementRef;
1531
1526
  private _viewContainerRef;
1532
1527
  private _overlayPositionBuilder;
1533
- ngOnInit(): void;
1528
+ private _ariaDescriber;
1529
+ private _viewInitialized;
1530
+ private _describedTarget;
1531
+ private _describedMessage;
1532
+ private _innerObserver;
1533
+ /**
1534
+ * Re-sync the description (see ngAfterViewInit) when the inputs change. The initial
1535
+ * write cannot happen here: on the first run the host's child components (e.g.
1536
+ * tn-button's inner `<button>`) have not rendered yet.
1537
+ */
1538
+ private readonly _syncDescriptionOnInputChange;
1539
+ /**
1540
+ * Expose the message to assistive tech via CDK's AriaDescriber: it keeps the text in
1541
+ * a persistent visually-hidden element (so `aria-describedby` never dangles — the
1542
+ * overlay tooltip only exists while shown) and adds/removes only its own id token,
1543
+ * leaving descriptions the control already carries (form hints, error ids) intact.
1544
+ * The description goes on the interactive element itself: the host when it is one,
1545
+ * otherwise the first interactive descendant (e.g. `<tn-button>`'s inner `<button>`),
1546
+ * because screen readers read descriptions off the focused control, not wrappers.
1547
+ */
1548
+ ngAfterViewInit(): void;
1549
+ private _syncAriaDescription;
1550
+ /**
1551
+ * The overlay tooltip renders its message as HTML (`[innerHTML]`), but AriaDescriber
1552
+ * writes the description as plain text — strip any markup so screen readers never
1553
+ * announce literal tags. DOMParser parses inert markup (no script execution).
1554
+ */
1555
+ private _plainTextMessage;
1556
+ private _removeAriaDescription;
1534
1557
  ngOnDestroy(): void;
1535
1558
  _onMouseEnter(): void;
1536
1559
  _onMouseLeave(): void;
1537
- _onFocus(): void;
1538
- _onBlur(): void;
1560
+ _onFocusIn(): void;
1561
+ _onFocusOut(event: FocusEvent): void;
1539
1562
  _onKeydown(event: KeyboardEvent): void;
1540
1563
  /** Shows the tooltip */
1541
1564
  show(delay?: number): void;
@@ -2977,6 +3000,15 @@ interface TnCardAction {
2977
3000
  handler: () => void;
2978
3001
  disabled?: boolean;
2979
3002
  icon?: string;
3003
+ /**
3004
+ * Tooltip for the action button — useful for explaining why an action is unavailable.
3005
+ * Shows on pointer hover (including while the action is disabled, since hover
3006
+ * retargets to the button's host element) and on keyboard focus while enabled. A
3007
+ * disabled native button is not focusable, so keyboard-only users cannot reach the
3008
+ * reason; screen reader users can still read it when browsing the button via its
3009
+ * persistent `aria-describedby` description.
3010
+ */
3011
+ tooltip?: string;
2980
3012
  /**
2981
3013
  * Test-id applied to the rendered action button. Rendered under whichever attribute name
2982
3014
  * is configured via `TN_TEST_ATTR` (default `data-testid`).
@@ -6419,16 +6451,26 @@ declare class TnTableComponent<T = unknown> implements OnInit {
6419
6451
  * Cells wrap regardless of this (that is the table's default), so reach for it only when equal
6420
6452
  * columns are actually wanted: it gives up the `auto` layout's content-proportional sizing,
6421
6453
  * which a table with one long text column among short ones usually wants to keep.
6454
+ *
6455
+ * Changes the layout algorithm only — the table still shrinks with its container, with no floor
6456
+ * unless {@link minColumnWidth} or {@link minWidth} sets one.
6422
6457
  */
6423
6458
  fixedLayout: _angular_core.InputSignal<boolean>;
6424
6459
  /**
6425
6460
  * Smallest width a column is allowed to shrink to before the host scrolls horizontally instead.
6426
- * Any CSS length.
6461
+ * Any CSS length. Empty (the default) applies no floor.
6462
+ *
6463
+ * `fixedLayout` makes the table fit its container exactly, so past a certain width the columns
6464
+ * keep shrinking and wrap every cell to a couple of characters per line: technically visible,
6465
+ * unreadable, and never scrollable. Set this to scroll instead once a column would go below it.
6466
+ * The floor is derived as this times the column count, so it scales with the table rather than
6467
+ * needing a hand-picked number per page.
6427
6468
  *
6428
- * `fixedLayout` makes the table fit its container exactly — so without a floor a narrow viewport
6429
- * just keeps shrinking the columns, wrapping every cell to a couple of characters per line:
6430
- * technically visible, unreadable, and never scrollable. The floor is derived as this times the
6431
- * column count, so it scales with the table rather than needing a hand-picked number per page.
6469
+ * Opt-in rather than on by default, because a derived floor cannot know the table's container: a
6470
+ * full-width page table has room for one, while the same table in a dashboard card or beside a
6471
+ * details pane would just scroll at every ordinary window size. Only the consumer knows which it
6472
+ * is — reach for it when the table can actually get narrow enough to matter, typically a
6473
+ * full-width table on a phone.
6432
6474
  *
6433
6475
  * Only applies with `fixedLayout`. Without it the table lays out `auto`, sizing to its content
6434
6476
  * and overflowing the host — which scrolls on its own.
@@ -6439,7 +6481,7 @@ declare class TnTableComponent<T = unknown> implements OnInit {
6439
6481
  * for this only when a specific table needs a floor its column count doesn't imply.
6440
6482
  */
6441
6483
  minWidth: _angular_core.InputSignal<string>;
6442
- /** The floor actually applied to the table — explicit if given, else derived. */
6484
+ /** The floor actually applied to the table — explicit if given, else derived, else none. */
6443
6485
  protected readonly resolvedMinWidth: _angular_core.Signal<string | null>;
6444
6486
  sortChange: _angular_core.OutputEmitterRef<TnSortEvent>;
6445
6487
  selectionChange: _angular_core.OutputEmitterRef<T[]>;