@truenas/ui-components 0.7.10 → 0.7.11

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.7.10",
3
+ "version": "0.7.11",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -562,12 +562,34 @@ declare class TnSelectComponent<T = unknown> implements ControlValueAccessor, On
562
562
  * - **Enter / Space** opens the dropdown if closed; if open and an option
563
563
  * is highlighted, selects that option (in single mode) or toggles it
564
564
  * (in multiple mode).
565
- * - **Escape** closes the dropdown without changing the selection.
565
+ * - **Escape** is NOT here: it closes the dropdown without changing the
566
+ * selection, from `onHostKeydown` on this component's host element,
567
+ * because it also has to consume the key.
566
568
  *
567
569
  * All navigation keys call `event.preventDefault()` so the page does not
568
570
  * scroll while the user is moving through options.
569
571
  */
570
572
  onKeydown(event: KeyboardEvent): void;
573
+ /**
574
+ * Escape, which closes the dropdown and CONSUMES the key.
575
+ *
576
+ * Consuming matters because of what is usually underneath: since #322 a
577
+ * `tn-side-panel` is a CDK overlay listening for Escape through
578
+ * `OverlayKeyboardDispatcher`, which delivers to the top-most attached
579
+ * overlay that has subscribers. Closing the dropdown disposes this select's
580
+ * overlay mid-keystroke, taking it out of that stack — so an Escape left to
581
+ * carry on reached `<body>`, found the panel as the new top-most subscriber,
582
+ * and closed the whole form along with the dropdown (#324). A `tn-drawer` in
583
+ * `over` mode has a keydown handler of its own and closed the same way.
584
+ *
585
+ * Why this sits on the HOST rather than beside the other keys on the trigger:
586
+ * `stopPropagation()` stops ANCESTOR listeners, not other listeners on the
587
+ * same element. Called from the trigger it also hid Escape from a `tnTooltip`
588
+ * on this component, which dismisses a visible tooltip from a host listener —
589
+ * so the tooltip stayed up. From here, that directive still sees the key and
590
+ * only the containers ABOVE this select stop seeing it.
591
+ */
592
+ protected onHostKeydown(event: KeyboardEvent): void;
571
593
  private moveFocus;
572
594
  private activateFocusedOption;
573
595
  private scrollFocusedIntoView;
@@ -1146,6 +1168,31 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
1146
1168
  */
1147
1169
  private runAction;
1148
1170
  onKeydown(event: KeyboardEvent): void;
1171
+ /**
1172
+ * Escape, which cancels the draft, dismisses the panel, and — while the panel
1173
+ * is open — CONSUMES the key.
1174
+ *
1175
+ * Consuming matters because of what is usually underneath: since #322 a
1176
+ * `tn-side-panel` is a CDK overlay listening for Escape through
1177
+ * `OverlayKeyboardDispatcher`, which delivers to the top-most attached
1178
+ * overlay that has subscribers. Dismissing disposes this panel's overlay
1179
+ * mid-keystroke, taking it out of that stack — so an Escape left to carry on
1180
+ * reached `<body>`, found the side panel as the new top-most subscriber, and
1181
+ * closed the whole form along with the panel (#324). A `tn-drawer` in `over`
1182
+ * mode has a keydown handler of its own and closed the same way.
1183
+ *
1184
+ * With the panel already closed the key is NOT consumed: there is nothing to
1185
+ * dismiss and it belongs to whatever contains this field. The draft still
1186
+ * reverts, which is what the blur that follows would otherwise commit.
1187
+ *
1188
+ * Why this sits on the HOST rather than beside the other keys on the input:
1189
+ * `stopPropagation()` stops ANCESTOR listeners, not other listeners on the
1190
+ * same element. Called from the input it also hid Escape from a `tnTooltip`
1191
+ * on this component, which dismisses a visible tooltip from a host listener —
1192
+ * so the tooltip stayed up. From here, that directive still sees the key and
1193
+ * only the containers ABOVE this field stop seeing it.
1194
+ */
1195
+ protected onHostKeydown(event: KeyboardEvent): void;
1149
1196
  /**
1150
1197
  * `loadMore` normally fires from a scroll event, which never happens when
1151
1198
  * the current page is too short to overflow the panel — pagination would
@@ -1264,6 +1311,13 @@ declare class TnAutocompleteComponent<T = unknown> implements ControlValueAccess
1264
1311
  * matches its width to the input. Mirrors TnSelectComponent's approach.
1265
1312
  */
1266
1313
  private attachOverlay;
1314
+ /**
1315
+ * Escape's effect on this field: cancel the draft, then close.
1316
+ *
1317
+ * Shared by the overlay subscription above and `onHostKeydown`, which is
1318
+ * where Escape arrives while focus is in the field — open panel or closed.
1319
+ */
1320
+ private dismiss;
1267
1321
  private detachOverlay;
1268
1322
  private scrollToHighlighted;
1269
1323
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnAutocompleteComponent<any>, never>;
@@ -4389,6 +4443,29 @@ declare class TnChipInputComponent<T = string> implements ControlValueAccessor,
4389
4443
  protected onFocus(): void;
4390
4444
  protected onBlur(): void;
4391
4445
  protected onKeydown(event: KeyboardEvent): void;
4446
+ /**
4447
+ * Escape, which dismisses the suggestion panel and CONSUMES the key.
4448
+ *
4449
+ * Consuming matters because of what is usually underneath: since #322 a
4450
+ * `tn-side-panel` is a CDK overlay listening for Escape through
4451
+ * `OverlayKeyboardDispatcher`, which delivers to the top-most attached
4452
+ * overlay that has subscribers. Dismissing disposes this panel's overlay
4453
+ * mid-keystroke, taking it out of that stack — so an Escape left to carry on
4454
+ * reached `<body>`, found the side panel as the new top-most subscriber, and
4455
+ * closed the whole form along with the panel (#324). A `tn-drawer` in `over`
4456
+ * mode has a keydown handler of its own and closed the same way.
4457
+ *
4458
+ * With the panel already closed nothing happens here and the key belongs to
4459
+ * whatever contains this field — which is what it did before #324 too.
4460
+ *
4461
+ * Why this sits on the HOST rather than beside the other keys on the input:
4462
+ * `stopPropagation()` stops ANCESTOR listeners, not other listeners on the
4463
+ * same element. Called from the input it also hid Escape from a `tnTooltip`
4464
+ * on this component, which dismisses a visible tooltip from a host listener —
4465
+ * so the tooltip stayed up. From here, that directive still sees the key and
4466
+ * only the containers ABOVE this field stop seeing it.
4467
+ */
4468
+ protected onHostKeydown(event: KeyboardEvent): void;
4392
4469
  protected onSuggestionClick(option: TnChipInputOption<T>): void;
4393
4470
  /** Prevents the option `mousedown` from blurring the input before the click lands. */
4394
4471
  protected onSuggestionMousedown(event: MouseEvent): void;
@@ -4778,6 +4855,7 @@ declare class TnMenuComponent implements OnDestroy {
4778
4855
  contextMenuTemplate: _angular_core.Signal<TemplateRef<unknown>>;
4779
4856
  private contextOverlayRef?;
4780
4857
  private contextBackdropSub?;
4858
+ private contextKeydownSub?;
4781
4859
  private overlay;
4782
4860
  private viewContainerRef;
4783
4861
  onMenuItemClick(item: TnMenuItem): void;
@@ -12639,6 +12717,25 @@ declare class TnDateRangeInputComponent implements ControlValueAccessor, OnInit,
12639
12717
  private updateDateFromSegments;
12640
12718
  private focusNextSegment;
12641
12719
  private focusPrevSegment;
12720
+ /**
12721
+ * Escape, which closes the calendar and CONSUMES the key. Same reasoning as
12722
+ * `TnDateInputComponent.onHostKeydown`, which this mirrors: opening does not
12723
+ * move focus into the overlay, so the real keystroke starts on a date
12724
+ * segment inside this host, where an ancestor such as a `tn-drawer` in
12725
+ * `over` mode would stop it before CDK's keyboard dispatcher ever ran — and
12726
+ * a calendar waiting on the dispatcher stayed open while the drawer closed
12727
+ * underneath it (#324).
12728
+ *
12729
+ * Consuming it also keeps a `tn-side-panel` from acting on the same key: the
12730
+ * panel is a CDK overlay subscribed through that dispatcher (#322), and
12731
+ * closing this calendar disposes its overlay mid-keystroke, leaving the
12732
+ * panel as the top-most subscriber for an Escape allowed to carry on.
12733
+ *
12734
+ * Closed, the key is not consumed; it belongs to whatever contains this
12735
+ * field. On the HOST rather than the segments so that `stopPropagation()`
12736
+ * still leaves a `tnTooltip` on this component able to see the key.
12737
+ */
12738
+ protected onHostKeydown(event: KeyboardEvent): void;
12642
12739
  openDatepicker(): void;
12643
12740
  close(): void;
12644
12741
  private createOverlay;
@@ -13404,6 +13501,34 @@ declare class TnDateInputComponent implements ControlValueAccessor, OnInit, OnDe
13404
13501
  private updateDateFromSegments;
13405
13502
  private focusNextSegment;
13406
13503
  private focusPrevSegment;
13504
+ /**
13505
+ * Escape, which closes the calendar and CONSUMES the key.
13506
+ *
13507
+ * Opening the calendar does not move focus into it, so the keystroke a user
13508
+ * actually makes starts on a date segment — inside this host, not inside the
13509
+ * overlay. That is the path the `keydownEvents()` subscription in
13510
+ * `createOverlay` cannot serve: CDK's `OverlayKeyboardDispatcher` listens on
13511
+ * `<body>`, so any ancestor that stops the key first means it never runs.
13512
+ * `tn-drawer` in `over` mode is exactly such an ancestor — it calls
13513
+ * `stopPropagation()` on Escape from a handler on its own panel element — so
13514
+ * a calendar left waiting for the dispatcher stayed open while the drawer
13515
+ * closed underneath it (#324).
13516
+ *
13517
+ * Consuming it also keeps a `tn-side-panel` from acting on the same key:
13518
+ * since #322 the panel is a CDK overlay subscribed through that dispatcher,
13519
+ * and closing this calendar disposes its overlay mid-keystroke, leaving the
13520
+ * panel as the top-most subscriber for an Escape allowed to carry on.
13521
+ *
13522
+ * With the calendar closed the key is NOT consumed: there is nothing to
13523
+ * close and it belongs to whatever contains this field.
13524
+ *
13525
+ * Why the HOST rather than the segment inputs: `stopPropagation()` stops
13526
+ * ANCESTOR listeners, not other listeners on the same element. From here a
13527
+ * `tnTooltip` on this component still sees Escape and dismisses itself, and
13528
+ * only the containers ABOVE this field stop seeing it — the same placement
13529
+ * `tn-select` and `tn-autocomplete` use.
13530
+ */
13531
+ protected onHostKeydown(event: KeyboardEvent): void;
13407
13532
  openDatepicker(): void;
13408
13533
  close(): void;
13409
13534
  private createOverlay;
@@ -15468,6 +15593,35 @@ declare class TnFilePickerComponent implements ControlValueAccessor, OnInit, OnD
15468
15593
  onPathCommit(event: Event): void;
15469
15594
  /** `openOnClick` entry point. */
15470
15595
  onInputClick(): void;
15596
+ /**
15597
+ * Escape, which closes the popup and CONSUMES the key.
15598
+ *
15599
+ * Opening the popup does not move focus into it, so the keystroke a user
15600
+ * actually makes starts on the path input — inside this host, not inside the
15601
+ * overlay. That is the path the `keydownEvents()` subscription in
15602
+ * `createOverlay` cannot serve: CDK's `OverlayKeyboardDispatcher` listens on
15603
+ * `<body>`, so any ancestor that stops the key first means it never runs.
15604
+ * `tn-drawer` in `over` mode is exactly such an ancestor — it calls
15605
+ * `stopPropagation()` on Escape from a handler on its own panel element — so
15606
+ * a picker left waiting for the dispatcher stayed open while the drawer
15607
+ * closed underneath it (#324).
15608
+ *
15609
+ * Consuming it also keeps a `tn-side-panel` from acting on the same key:
15610
+ * since #322 the panel is a CDK overlay subscribed through that dispatcher,
15611
+ * and closing this popup disposes its overlay mid-keystroke, leaving the
15612
+ * panel as the top-most subscriber for an Escape allowed to carry on.
15613
+ *
15614
+ * With the popup closed the key is NOT consumed: there is nothing to close
15615
+ * and it belongs to whatever contains this field. The inline-creation row is
15616
+ * unaffected either way — it lives in the popup, whose keydowns never reach
15617
+ * this host.
15618
+ *
15619
+ * Why the HOST rather than the input: `stopPropagation()` stops ANCESTOR
15620
+ * listeners, not other listeners on the same element. From here a `tnTooltip`
15621
+ * on this component still sees Escape and dismisses itself, and only the
15622
+ * containers ABOVE this field stop seeing it.
15623
+ */
15624
+ protected onHostKeydown(event: KeyboardEvent): void;
15471
15625
  openFilePicker(): void;
15472
15626
  close(): void;
15473
15627
  onItemClick(item: FileSystemItem): void;