@thalassic/ui 22.19.0 → 22.19.2

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, PLATFORM_ID, DestroyRef, numberAttribute, output, viewChild, contentChild, Component, ViewContainerRef, DOCUMENT, afterRenderEffect, linkedSignal, Injectable, Renderer2, ElementRef, makeEnvironmentProviders, TemplateRef, forwardRef, effect, afterNextRender, Injector, RendererStyleFlags2, viewChildren, untracked, contentChildren, isDevMode, provideEnvironmentInitializer } from '@angular/core';
2
+ import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, PLATFORM_ID, DestroyRef, numberAttribute, output, viewChild, contentChild, Component, ViewContainerRef, DOCUMENT, afterRenderEffect, linkedSignal, Service, Renderer2, effect, ElementRef, Injectable, makeEnvironmentProviders, TemplateRef, forwardRef, afterNextRender, Injector, RendererStyleFlags2, viewChildren, untracked, contentChildren, isDevMode, provideEnvironmentInitializer } from '@angular/core';
3
3
  import { CdkVirtualScrollViewport, CdkFixedSizeVirtualScroll, CdkVirtualForOf } from '@angular/cdk/scrolling';
4
4
  import { startOfWeek, startOfMonth, endOfWeek, endOfMonth, addDays, eachDayOfInterval, startOfDay, isSameMonth, format, isSameDay, subMonths, isBefore, isAfter, differenceInCalendarDays, addHours, differenceInMinutes, isSameWeek, addMonths, addWeeks, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, setMinutes, setHours, setYear } from 'date-fns';
5
5
  import { isPlatformBrowser, NgTemplateOutlet, NgComponentOutlet, LocationStrategy } from '@angular/common';
@@ -981,6 +981,12 @@ class AbstractSelect extends ValueFormControl {
981
981
  * opens it from the ones that follow while it stays open.
982
982
  */
983
983
  _panelWasOpen = false;
984
+ /**
985
+ * Whether the virtualized viewport last rendered with nothing in it. Its height is sized to
986
+ * the options, so an empty list collapses it to zero — and a measurement taken then would
987
+ * describe a viewport that no longer exists once options arrive.
988
+ */
989
+ _viewportWasCollapsed = true;
984
990
  /**
985
991
  * Keeps the active option visible inside the scrolling panel. Focus stays on the
986
992
  * trigger and only `aria-activedescendant` moves, so the browser never scrolls the
@@ -997,17 +1003,22 @@ class AbstractSelect extends ValueFormControl {
997
1003
  if (!isOpen)
998
1004
  return;
999
1005
  const virtualScroll = this.virtualScrollRef();
1000
- // The overlay pane is attached (and re-attached — it is reused across opens)
1001
- // after the panel's view is created, so the viewport's cached measurement is
1002
- // stale until it is re-measured in the first render of an open panel.
1003
- if (virtualScroll && !wasOpen)
1006
+ // The option elements are re-created when the visible list changes, so the scroll
1007
+ // has to re-run then too, not only when the index moves.
1008
+ const optionCount = this.visibleOptions().length;
1009
+ const viewportWasCollapsed = this._viewportWasCollapsed;
1010
+ this._viewportWasCollapsed = optionCount === 0;
1011
+ // The overlay pane is attached (and re-attached — it is reused across opens) after the
1012
+ // panel's view is created, so the viewport's cached measurement is stale until it is
1013
+ // re-measured in the first render of an open panel. A panel opened on an empty list —
1014
+ // everything filtered out, or a list still being fetched — measures a viewport of no
1015
+ // height, so the first options to arrive call for a fresh measurement too.
1016
+ if (virtualScroll && (!wasOpen || (viewportWasCollapsed && optionCount > 0))) {
1004
1017
  virtualScroll.checkViewportSize();
1018
+ }
1005
1019
  const index = this.activeIndex();
1006
1020
  if (index < 0)
1007
1021
  return;
1008
- // The option elements are re-created when the visible list changes, so the scroll
1009
- // has to re-run then too, not only when the index moves.
1010
- this.visibleOptions();
1011
1022
  if (virtualScroll) {
1012
1023
  // `aria-activedescendant` may only reference a rendered element; scrolling the
1013
1024
  // index into view keeps it inside the rendered window, and the viewport's render
@@ -1096,12 +1107,19 @@ class AbstractSelect extends ValueFormControl {
1096
1107
  array.push(`${this.CLASS_NAME}--${this.size()}`);
1097
1108
  if (this.fluid())
1098
1109
  array.push(`${this.CLASS_NAME}--fluid`);
1099
- return array.concat(this.controlClasses());
1110
+ return array.concat(this.hostStateClasses(), this.controlClasses());
1100
1111
  }, /* @ts-ignore */
1101
1112
  ...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
1102
1113
  get listboxId() {
1103
1114
  return `${this.uniqueId}-listbox`;
1104
1115
  }
1116
+ /**
1117
+ * Host modifiers for states only one control has, listed alongside the shared ones. Read from
1118
+ * within the host-class computation, so signals a control reads here stay reactive.
1119
+ */
1120
+ hostStateClasses() {
1121
+ return [];
1122
+ }
1105
1123
  /**
1106
1124
  * Narrows the option list shown in the panel. The listbox controls show every option; an editable
1107
1125
  * combobox overrides this to filter by the typed query.
@@ -1398,12 +1416,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
1398
1416
  }]
1399
1417
  }], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }, { type: i0.Output, args: ["contentChange"] }], templateData: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateData", required: false }] }, { type: i0.Output, args: ["templateDataChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }, { type: i0.Output, args: ["colorChange"] }], arrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "arrow", required: true }] }, { type: i0.Output, args: ["arrowChange"] }], arrowPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "arrowPosition", required: false }] }, { type: i0.Output, args: ["arrowPositionChange"] }] } });
1400
1418
 
1419
+ /**
1420
+ * Owns the one tooltip overlay every trigger shares. A single tooltip is visible at a time
1421
+ * across the page: opening one asks whoever holds the current tooltip to let go first, so a
1422
+ * hovered element and a focused element elsewhere cannot leave two bubbles on screen.
1423
+ *
1424
+ * Every call names the trigger making it and is ignored unless that trigger holds the visible
1425
+ * tooltip, so one tearing itself down can never close a tooltip that has since moved on.
1426
+ */
1401
1427
  class TooltipService {
1402
1428
  // Injections
1403
1429
  _overlay = inject(Overlay);
1404
1430
  // State
1431
+ _owner = null;
1405
1432
  _overlayRef = null;
1406
1433
  _tooltipRef = null;
1434
+ _positionStrategy = null;
1407
1435
  _positionSubscription = null;
1408
1436
  /**
1409
1437
  * Edge the visible tooltip settled on. The strategy applies its position while the portal is
@@ -1411,8 +1439,9 @@ class TooltipService {
1411
1439
  */
1412
1440
  _arrowPosition = null;
1413
1441
  // Public methods
1414
- show(origin, positions) {
1415
- this.dispose();
1442
+ show(owner, origin, positions) {
1443
+ this._releaseOwner();
1444
+ this._owner = owner;
1416
1445
  this._overlayRef = this._overlay.create({
1417
1446
  positionStrategy: this._createPositionStrategy(origin, positions),
1418
1447
  scrollStrategy: this._overlay.scrollStrategies.reposition(),
@@ -1421,29 +1450,39 @@ class TooltipService {
1421
1450
  this._tooltipRef.instance.arrowPosition.set(this._arrowPosition);
1422
1451
  return this._tooltipRef;
1423
1452
  }
1424
- move(origin, positions) {
1425
- if (!this._overlayRef)
1453
+ /** Re-anchors the visible tooltip, following a cursor it is bound to. */
1454
+ move(owner, point) {
1455
+ if (this._owner !== owner)
1456
+ return;
1457
+ const overlayRef = this._overlayRef;
1458
+ const positionStrategy = this._positionStrategy;
1459
+ if (!overlayRef || !positionStrategy)
1426
1460
  return;
1427
- this._overlayRef.updatePositionStrategy(this._createPositionStrategy(origin, positions));
1461
+ // Re-targeting the strategy already attached, rather than building a replacement, keeps a
1462
+ // stream of pointer moves from allocating a strategy and a subscription per event.
1463
+ positionStrategy.setOrigin(point);
1464
+ overlayRef.updatePosition();
1428
1465
  }
1429
- // Detaches the tooltip so Angular's `animate.leave` plays the exit animation,
1430
- // then disposes the pane once that animation finishes. The pane is kept alive
1431
- // in the meantime so it is not torn down mid-animation.
1432
- hide() {
1433
- if (!this._overlayRef)
1466
+ /**
1467
+ * Detaches the tooltip so Angular's `animate.leave` plays the exit animation, then disposes the
1468
+ * pane once that animation finishes. The pane is kept alive in the meantime so it is not torn
1469
+ * down mid-animation.
1470
+ */
1471
+ hide(owner) {
1472
+ if (this._owner !== owner)
1434
1473
  return;
1435
1474
  const overlayRef = this._overlayRef;
1436
1475
  this._overlayRef = null;
1437
1476
  this._reset();
1477
+ if (!overlayRef)
1478
+ return;
1438
1479
  overlayRef.detach();
1439
1480
  disposeAfterLeaveAnimation(overlayRef);
1440
1481
  }
1441
- dispose() {
1442
- if (!this._overlayRef)
1482
+ dispose(owner) {
1483
+ if (this._owner !== owner)
1443
1484
  return;
1444
- this._overlayRef.dispose();
1445
- this._overlayRef = null;
1446
- this._reset();
1485
+ this._disposeOverlay();
1447
1486
  }
1448
1487
  // Private methods
1449
1488
  /**
@@ -1464,22 +1503,42 @@ class TooltipService {
1464
1503
  return;
1465
1504
  tooltipRef.instance.arrowPosition.set(this._arrowPosition);
1466
1505
  });
1506
+ this._positionStrategy = positionStrategy;
1467
1507
  return positionStrategy;
1468
1508
  }
1509
+ /** Takes the tooltip back from its owner, so the next one starts from an empty stage. */
1510
+ _releaseOwner() {
1511
+ const owner = this._owner;
1512
+ if (owner)
1513
+ owner.releaseTooltip();
1514
+ // An owner that did not let go leaves its overlay behind, and it cannot outlive the tooltip
1515
+ // replacing it.
1516
+ this._disposeOverlay();
1517
+ }
1518
+ _disposeOverlay() {
1519
+ const overlayRef = this._overlayRef;
1520
+ this._overlayRef = null;
1521
+ this._reset();
1522
+ if (!overlayRef)
1523
+ return;
1524
+ overlayRef.dispose();
1525
+ }
1469
1526
  /** Drops everything tied to the overlay that just went away. */
1470
1527
  _reset() {
1528
+ this._owner = null;
1471
1529
  this._tooltipRef = null;
1530
+ this._positionStrategy = null;
1472
1531
  this._arrowPosition = null;
1473
1532
  if (!this._positionSubscription)
1474
1533
  return;
1475
1534
  this._positionSubscription.unsubscribe();
1476
1535
  this._positionSubscription = null;
1477
1536
  }
1478
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1479
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipService });
1537
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipService, deps: [], target: i0.ɵɵFactoryTarget.Service });
1538
+ static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.5", ngImport: i0, type: TooltipService });
1480
1539
  }
1481
1540
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipService, decorators: [{
1482
- type: Injectable
1541
+ type: Service
1483
1542
  }] });
1484
1543
 
1485
1544
  const DEFAULT_TOOLTIP_CONFIG = {
@@ -1500,11 +1559,15 @@ const TOOLTIP_CONFIG = new InjectionToken('TOOLTIP_CONFIG', {
1500
1559
  * Shared machinery behind every tooltip trigger: the appearance inputs, the overlay lifecycle,
1501
1560
  * and the `aria-describedby` link. A subclass owns only *when* a tooltip opens and *which*
1502
1561
  * element it anchors to — `[tlsTooltip]` binds its own host, `[tlsTooltipDelegate]` resolves an
1503
- * item out of a delegated event — and calls `_show` / `_hide` accordingly.
1562
+ * item out of a delegated event — and records or drops show requests accordingly.
1563
+ *
1564
+ * A tooltip can be asked for by a hover, by keyboard focus, and by a tap at the same time. Each
1565
+ * source is tracked on its own and the most recent one is the tooltip on screen, so an
1566
+ * interaction ending only takes back what it asked for: a pointer leaving an element that is
1567
+ * still focused does not dismiss the tooltip focus is entitled to (WCAG 1.4.13).
1504
1568
  *
1505
- * One tooltip is visible at a time per trigger; showing for a different anchor closes the
1506
- * previous one first, and showing for the anchor already open is a no-op so a hovered element
1507
- * receiving focus does not rebuild the overlay.
1569
+ * The tooltip overlay itself is shared across the page, so opening one here closes any other
1570
+ * trigger's.
1508
1571
  */
1509
1572
  class TooltipTrigger {
1510
1573
  // Injections
@@ -1528,10 +1591,21 @@ class TooltipTrigger {
1528
1591
  tooltipArrow = input(this._config.arrow, /* @ts-ignore */
1529
1592
  ...(ngDevMode ? [{ debugName: "tooltipArrow" }] : /* istanbul ignore next */ []));
1530
1593
  // State
1594
+ /**
1595
+ * Live show requests, keyed by the source that made them and held in the order they arrived.
1596
+ * The last one in is the one on screen; emptying the map hides the tooltip.
1597
+ */
1598
+ _requests = new Map();
1531
1599
  /** Element the visible tooltip is anchored to, `null` while nothing is shown. */
1532
1600
  _anchor = null;
1601
+ _tooltipRef = signal(null, /* @ts-ignore */
1602
+ ...(ngDevMode ? [{ debugName: "_tooltipRef" }] : /* istanbul ignore next */ []));
1533
1603
  /** Id of the description the visible tooltip added, so only that one is taken back. */
1534
1604
  _describedById = null;
1605
+ /** Element that description was put on, which is not always the anchor. */
1606
+ _describedElement = null;
1607
+ /** Teardown of the document listeners that only run while a tooltip is visible. */
1608
+ _dismissListeners = [];
1535
1609
  // Computed
1536
1610
  _positions = computed(() => {
1537
1611
  const positions = this.tooltipPositions();
@@ -1540,91 +1614,211 @@ class TooltipTrigger {
1540
1614
  return buildOverlayPositions(this.tooltipPosition(), this.tooltipOffset());
1541
1615
  }, /* @ts-ignore */
1542
1616
  ...(ngDevMode ? [{ debugName: "_positions" }] : /* istanbul ignore next */ []));
1617
+ constructor() {
1618
+ // A tooltip already on screen when the trigger is disabled goes with it.
1619
+ effect(() => {
1620
+ if (this.tooltipDisabled())
1621
+ this._hideAll();
1622
+ });
1623
+ // Appearance is applied when the tooltip opens and kept live from there, so an input
1624
+ // changing under a visible tooltip reaches it.
1625
+ effect(() => {
1626
+ const tooltipRef = this._tooltipRef();
1627
+ if (!tooltipRef)
1628
+ return;
1629
+ tooltipRef.instance.color.set(this.tooltipColor());
1630
+ tooltipRef.instance.arrow.set(this.tooltipArrow());
1631
+ });
1632
+ }
1543
1633
  // Accessors
1544
1634
  /** Anchor of the visible tooltip, for a subclass deciding whether an event concerns it. */
1545
1635
  get anchor() {
1546
1636
  return this._anchor;
1547
1637
  }
1548
- // Protected methods
1549
- /** Dismisses the tooltip without moving the pointer or focus (WCAG 1.4.13). */
1550
- onEscape() {
1551
- this._hide();
1638
+ // Public methods
1639
+ /** Gives up the shared tooltip, along with every reason this trigger was showing one. */
1640
+ releaseTooltip() {
1641
+ this._requests.clear();
1642
+ this._close();
1552
1643
  }
1553
- /**
1554
- * Opens the tooltip for `anchor`. `point` anchors to the cursor instead, when the origin is
1555
- * configured that way and the caller has a pointer position to give.
1556
- */
1557
- _show(anchor, content, data = null, point) {
1644
+ // Protected methods
1645
+ /** Records `source` as wanting the tooltip described by `request`, and shows it. */
1646
+ _show(source, request) {
1558
1647
  if (this.tooltipDisabled())
1559
1648
  return;
1560
- // Re-showing for the anchor already open would rebuild the overlay for nothing.
1561
- if (this._anchor === anchor)
1562
- return;
1563
1649
  // Nothing to render — empty content would show a bare bubble.
1564
- if (!content)
1650
+ if (!request.content)
1651
+ return;
1652
+ // Re-inserting moves the request to the end, keeping the map in the order requests arrived.
1653
+ this._requests.delete(source);
1654
+ this._requests.set(source, request);
1655
+ this._present();
1656
+ }
1657
+ /** Takes back what `source` asked for, leaving a tooltip any other source still wants. */
1658
+ _hide(source) {
1659
+ if (!this._requests.delete(source))
1660
+ return;
1661
+ this._present();
1662
+ }
1663
+ /** Drops every reason at once — a dismissal, rather than the end of one interaction. */
1664
+ _hideAll() {
1665
+ if (this._requests.size === 0)
1565
1666
  return;
1566
- this._hide();
1567
- this._anchor = anchor;
1568
- const origin = this.tooltipOrigin() === 'cursor' && point ? point : anchor;
1569
- const tooltipRef = this._tooltipService.show(origin, this._positions());
1570
- tooltipRef.instance.content.set(content);
1571
- tooltipRef.instance.templateData.set(data);
1667
+ this._requests.clear();
1668
+ this._present();
1669
+ }
1670
+ /** Whether a tap is what is currently holding the tooltip on `anchor`, which another tap ends. */
1671
+ _isTapped(anchor) {
1672
+ const request = this._requests.get('touch');
1673
+ if (!request)
1674
+ return false;
1675
+ return request.anchor === anchor;
1676
+ }
1677
+ /** Re-states the content of every live request, so an input changing reaches a visible tooltip. */
1678
+ _updateContent(content, data) {
1679
+ if (this._requests.size === 0)
1680
+ return;
1681
+ if (!content) {
1682
+ this._hideAll();
1683
+ return;
1684
+ }
1685
+ for (const [source, request] of this._requests) {
1686
+ this._requests.set(source, { ...request, content, data });
1687
+ }
1688
+ this._present();
1689
+ }
1690
+ // Private methods
1691
+ /** Brings the tooltip in line with the requests: the newest one, or none at all. */
1692
+ _present() {
1693
+ const request = this._latestRequest();
1694
+ if (!request) {
1695
+ this._close();
1696
+ return;
1697
+ }
1698
+ if (this._anchor !== request.anchor) {
1699
+ this._close();
1700
+ this._open(request);
1701
+ return;
1702
+ }
1703
+ const tooltipRef = this._tooltipRef();
1704
+ if (tooltipRef)
1705
+ this._applyContent(tooltipRef, request);
1706
+ }
1707
+ _open(request) {
1708
+ this._anchor = request.anchor;
1709
+ const origin = this.tooltipOrigin() === 'cursor' && request.point ? request.point : request.anchor;
1710
+ const tooltipRef = this._tooltipService.show(this, origin, this._positions());
1572
1711
  tooltipRef.instance.color.set(this.tooltipColor());
1573
1712
  tooltipRef.instance.arrow.set(this.tooltipArrow());
1574
- // A description identical to the accessible name would be announced twice; the tooltip is
1575
- // purely visual then and the link is omitted.
1576
- if (anchor.getAttribute('aria-label') === content)
1577
- return;
1578
- this._describedById = tooltipRef.instance.id;
1579
- addDescribedBy(this._renderer, anchor, this._describedById);
1713
+ this._tooltipRef.set(tooltipRef);
1714
+ this._applyContent(tooltipRef, request);
1715
+ this._listenWhileVisible();
1580
1716
  }
1581
- _hide() {
1582
- const anchor = this._anchor;
1583
- if (!anchor)
1717
+ _close() {
1718
+ if (!this._anchor)
1584
1719
  return;
1585
1720
  this._anchor = null;
1586
- this._tooltipService.hide();
1587
- this._undescribe(anchor);
1721
+ this._tooltipRef.set(null);
1722
+ this._unlisten();
1723
+ this._tooltipService.hide(this);
1724
+ this._undescribe();
1725
+ }
1726
+ _applyContent(tooltipRef, request) {
1727
+ tooltipRef.instance.content.set(request.content);
1728
+ tooltipRef.instance.templateData.set(request.data);
1729
+ this._describe(tooltipRef, request);
1730
+ }
1731
+ /**
1732
+ * Links the described element to the tooltip, following focus as it moves between controls the
1733
+ * anchor wraps. A description identical to the accessible name would be announced twice; the
1734
+ * tooltip is purely visual then and the link is omitted.
1735
+ */
1736
+ _describe(tooltipRef, request) {
1737
+ const element = request.describedElement;
1738
+ if (element.getAttribute('aria-label') === request.content) {
1739
+ this._undescribe();
1740
+ return;
1741
+ }
1742
+ if (this._describedElement === element && this._describedById)
1743
+ return;
1744
+ this._undescribe();
1745
+ this._describedElement = element;
1746
+ this._describedById = tooltipRef.instance.id;
1747
+ addDescribedBy(this._renderer, element, this._describedById);
1588
1748
  }
1589
- // Private methods
1590
1749
  /** Takes back only the description this trigger added, leaving the consumer's own intact. */
1591
- _undescribe(anchor) {
1750
+ _undescribe() {
1751
+ const element = this._describedElement;
1592
1752
  const describedById = this._describedById;
1593
- if (!describedById)
1594
- return;
1753
+ this._describedElement = null;
1595
1754
  this._describedById = null;
1596
- removeDescribedBy(this._renderer, anchor, describedById);
1755
+ if (!element || !describedById)
1756
+ return;
1757
+ removeDescribedBy(this._renderer, element, describedById);
1758
+ }
1759
+ _latestRequest() {
1760
+ let latest = null;
1761
+ for (const request of this._requests.values())
1762
+ latest = request;
1763
+ return latest;
1764
+ }
1765
+ /**
1766
+ * Binds the dismissals that belong to a visible tooltip and nothing else, so a page full of
1767
+ * triggers carries no document listeners for the tooltips it is not showing.
1768
+ */
1769
+ _listenWhileVisible() {
1770
+ this._unlisten();
1771
+ this._dismissListeners.push(this._renderer.listen('document', 'keydown', (event) => {
1772
+ // Dismissible without moving the pointer or focus (WCAG 1.4.13).
1773
+ if (event.key === 'Escape')
1774
+ this._hideAll();
1775
+ }),
1776
+ // A tap leaves no pointer to move away and no Escape key to press, so the next tap
1777
+ // outside the anchor is what takes the tooltip back.
1778
+ this._renderer.listen('document', 'pointerdown', (event) => {
1779
+ if (event.pointerType !== 'touch')
1780
+ return;
1781
+ if (!this._requests.has('touch'))
1782
+ return;
1783
+ const anchor = this._anchor;
1784
+ const target = event.target;
1785
+ if (anchor && target instanceof Node && anchor.contains(target))
1786
+ return;
1787
+ this._hideAll();
1788
+ }));
1789
+ }
1790
+ _unlisten() {
1791
+ for (const unlisten of this._dismissListeners)
1792
+ unlisten();
1793
+ this._dismissListeners = [];
1597
1794
  }
1598
1795
  // Lifecycle
1599
1796
  ngOnDestroy() {
1600
- const anchor = this._anchor;
1601
- if (anchor)
1602
- this._undescribe(anchor);
1797
+ this._undescribe();
1798
+ this._requests.clear();
1603
1799
  this._anchor = null;
1604
- this._tooltipService.dispose();
1800
+ this._tooltipRef.set(null);
1801
+ this._unlisten();
1802
+ this._tooltipService.dispose(this);
1605
1803
  }
1606
1804
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1607
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipTrigger, isStandalone: true, inputs: { tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipOrigin: { classPropertyName: "tooltipOrigin", publicName: "tooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, tooltipPositions: { classPropertyName: "tooltipPositions", publicName: "tooltipPositions", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipOffset: { classPropertyName: "tooltipOffset", publicName: "tooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, tooltipColor: { classPropertyName: "tooltipColor", publicName: "tooltipColor", isSignal: true, isRequired: false, transformFunction: null }, tooltipArrow: { classPropertyName: "tooltipArrow", publicName: "tooltipArrow", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "document:keydown.escape": "onEscape()" } }, ngImport: i0 });
1805
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipTrigger, isStandalone: true, inputs: { tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipOrigin: { classPropertyName: "tooltipOrigin", publicName: "tooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, tooltipPositions: { classPropertyName: "tooltipPositions", publicName: "tooltipPositions", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipOffset: { classPropertyName: "tooltipOffset", publicName: "tooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, tooltipColor: { classPropertyName: "tooltipColor", publicName: "tooltipColor", isSignal: true, isRequired: false, transformFunction: null }, tooltipArrow: { classPropertyName: "tooltipArrow", publicName: "tooltipArrow", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
1608
1806
  }
1609
1807
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipTrigger, decorators: [{
1610
- type: Directive,
1611
- args: [{
1612
- host: {
1613
- '(document:keydown.escape)': 'onEscape()',
1614
- },
1615
- }]
1616
- }], propDecorators: { tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }], tooltipOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOrigin", required: false }] }], tooltipPositions: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPositions", required: false }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], tooltipOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOffset", required: false }] }], tooltipColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipColor", required: false }] }], tooltipArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipArrow", required: false }] }] } });
1808
+ type: Directive
1809
+ }], ctorParameters: () => [], propDecorators: { tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }], tooltipOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOrigin", required: false }] }], tooltipPositions: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPositions", required: false }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], tooltipOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOffset", required: false }] }], tooltipColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipColor", required: false }] }], tooltipArrow: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipArrow", required: false }] }] } });
1617
1810
 
1618
1811
  /**
1619
1812
  * Serves tooltips for a whole subtree from one instance. Any descendant carrying the content
1620
1813
  * attribute (`data-tooltip` by default) gets a tooltip, without each one needing its own
1621
1814
  * `[tlsTooltip]`. Events are delegated to this host, so a grid of hundreds of cells costs one
1622
- * directive, one overlay service and one set of listeners rather than one of each per cell.
1815
+ * directive and one set of listeners rather than one of each per cell.
1623
1816
  *
1624
1817
  * Interaction matches `[tlsTooltip]`: hover for mouse and pen, tap-to-toggle for touch, show
1625
1818
  * on keyboard focus, dismiss on Escape without moving the pointer or focus (WCAG 1.4.13), and
1626
- * `aria-describedby` linking the item to the visible tooltip — joining any description the item
1627
- * already carries, and omitted entirely when the item's `aria-label` already says the same thing.
1819
+ * `aria-describedby` linking the visible tooltip to the item — or, when focus is inside a
1820
+ * composite item, to the control holding it — joining any description that element already
1821
+ * carries, and omitted entirely when its `aria-label` already says the same thing.
1628
1822
  *
1629
1823
  * Trade-off: content is a plain string read from an attribute when the tooltip opens, so a
1630
1824
  * `TemplateRef` tooltip is not available here and an attribute change while the tooltip is
@@ -1652,23 +1846,21 @@ class TooltipDelegateDirective extends TooltipTrigger {
1652
1846
  // A touch "over" is a tap, not a hover — toggle instead. The default is not prevented,
1653
1847
  // so the tap still activates an interactive item.
1654
1848
  if (event.pointerType === 'touch') {
1655
- if (this.anchor === item) {
1656
- this._hide();
1849
+ if (this._isTapped(item)) {
1850
+ this._hide('touch');
1657
1851
  }
1658
1852
  else {
1659
- this._showItem(item);
1853
+ this._showItem('touch', item);
1660
1854
  }
1661
1855
  return;
1662
1856
  }
1663
- this._showItem(item, { x: event.clientX, y: event.clientY });
1857
+ this._showItem('hover', item, { x: event.clientX, y: event.clientY });
1664
1858
  }
1665
1859
  onPointerMove(event) {
1666
1860
  if (event.pointerType === 'touch')
1667
1861
  return;
1668
- if (!this.anchor)
1669
- return;
1670
1862
  if (this.tooltipOrigin() === 'cursor') {
1671
- this._tooltipService.move({ x: event.clientX, y: event.clientY }, this._positions());
1863
+ this._tooltipService.move(this, { x: event.clientX, y: event.clientY });
1672
1864
  }
1673
1865
  }
1674
1866
  onPointerOut(event) {
@@ -1676,25 +1868,27 @@ class TooltipDelegateDirective extends TooltipTrigger {
1676
1868
  // hiding here would undo the toggle the tap just made.
1677
1869
  if (event.pointerType === 'touch')
1678
1870
  return;
1679
- if (!this.anchor)
1871
+ // Crossing into another item — or between children of the one being left — is not a leave:
1872
+ // the `pointerover` that follows re-anchors the tooltip without it ever coming down.
1873
+ if (this._resolveItem(event.relatedTarget))
1680
1874
  return;
1681
- // Crossing between children of the same item is not a leave.
1682
- if (this._resolveItem(event.relatedTarget) === this.anchor)
1683
- return;
1684
- this._hide();
1875
+ this._hide('hover');
1685
1876
  }
1686
1877
  onFocusIn(event) {
1687
1878
  const item = this._resolveItem(event.target);
1688
1879
  if (!item)
1689
1880
  return;
1690
- // No cursor to anchor to; a focus-triggered tooltip always anchors to the item.
1691
- this._showItem(item);
1881
+ // No cursor to anchor to; a focus-triggered tooltip always anchors to the item. An item that
1882
+ // is a composite holds the control focus actually landed on, and that is what it describes.
1883
+ const focused = event.target;
1884
+ this._showItem('focus', item, null, focused instanceof HTMLElement ? focused : null);
1692
1885
  }
1693
1886
  onFocusOut(event) {
1694
1887
  // Focus moving between children of the same item is not a leave.
1695
- if (this._resolveItem(event.relatedTarget) === this.anchor)
1888
+ const item = this._resolveItem(event.relatedTarget);
1889
+ if (item && item === this.anchor)
1696
1890
  return;
1697
- this._hide();
1891
+ this._hide('focus');
1698
1892
  }
1699
1893
  // Private methods
1700
1894
  /** The tooltip-owning ancestor of `target` within this subtree, if there is one. */
@@ -1709,20 +1903,25 @@ class TooltipDelegateDirective extends TooltipTrigger {
1709
1903
  return null;
1710
1904
  return item;
1711
1905
  }
1712
- _showItem(item, point) {
1906
+ _showItem(source, item, point = null, describedElement = null) {
1713
1907
  const content = item.getAttribute(this.contentAttribute());
1714
1908
  if (!content)
1715
1909
  return;
1716
- this._show(item, content, null, point);
1910
+ this._show(source, {
1911
+ anchor: item,
1912
+ describedElement: describedElement ?? item,
1913
+ content,
1914
+ data: null,
1915
+ point,
1916
+ });
1717
1917
  }
1718
1918
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDelegateDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1719
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDelegateDirective, isStandalone: true, selector: "[tlsTooltipDelegate]", inputs: { contentAttribute: { classPropertyName: "contentAttribute", publicName: "tlsTooltipDelegate", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "pointerover": "onPointerOver($event)", "pointermove": "onPointerMove($event)", "pointerout": "onPointerOut($event)", "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)" } }, providers: [TooltipService], usesInheritance: true, ngImport: i0 });
1919
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDelegateDirective, isStandalone: true, selector: "[tlsTooltipDelegate]", inputs: { contentAttribute: { classPropertyName: "contentAttribute", publicName: "tlsTooltipDelegate", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "pointerover": "onPointerOver($event)", "pointermove": "onPointerMove($event)", "pointerout": "onPointerOut($event)", "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)" } }, usesInheritance: true, ngImport: i0 });
1720
1920
  }
1721
1921
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDelegateDirective, decorators: [{
1722
1922
  type: Directive,
1723
1923
  args: [{
1724
1924
  selector: '[tlsTooltipDelegate]',
1725
- providers: [TooltipService],
1726
1925
  host: {
1727
1926
  '(pointerover)': 'onPointerOver($event)',
1728
1927
  '(pointermove)': 'onPointerMove($event)',
@@ -1734,46 +1933,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
1734
1933
  }], propDecorators: { contentAttribute: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsTooltipDelegate", required: false }] }] } });
1735
1934
 
1736
1935
  /**
1737
- * Attaches a tooltip to the host element. Shows on hover and on keyboard focus,
1738
- * toggles on touch, and dismisses on Escape without moving the pointer or focus
1739
- * (WCAG 1.4.13). The tooltip is linked to the host via `aria-describedby` while
1740
- * visible, joining any description the host already carries rather than replacing
1741
- * it, and leaving that one behind when the tooltip hides.
1936
+ * Attaches a tooltip to the host element. Shows on hover and on focus landing anywhere inside
1937
+ * the host — a host that only wraps its real control is served as well as one that is the
1938
+ * control — toggles on touch, and dismisses on Escape without moving the pointer or focus
1939
+ * (WCAG 1.4.13). While visible the tooltip is linked with `aria-describedby` to the element it
1940
+ * describes: the host, or the control inside it that holds focus, since a description is only
1941
+ * announced on the element that has it. The link joins any description that element already
1942
+ * carries rather than replacing it, and leaves that one behind when the tooltip hides.
1742
1943
  *
1743
1944
  * Interaction is driven by pointer events, branching on `pointerType`: mouse
1744
1945
  * and pen get hover semantics, touch gets tap-to-toggle. A single stream avoids
1745
1946
  * the synthesized mouse events browsers replay after a tap.
1746
1947
  *
1948
+ * Content is live: a tooltip already on screen follows the input it was opened with.
1949
+ *
1747
1950
  * Serving many elements at once costs one instance each; `[tlsTooltipDelegate]`
1748
1951
  * serves a whole subtree from one instead.
1749
1952
  */
1750
1953
  class TooltipDirective extends TooltipTrigger {
1751
1954
  // Injections
1752
- _elementRef = inject(ElementRef);
1955
+ _element = inject(ElementRef).nativeElement;
1753
1956
  // Inputs
1754
1957
  content = input('', { ...(ngDevMode ? { debugName: "content" } : /* istanbul ignore next */ {}), alias: 'tlsTooltip' });
1755
1958
  data = input(null, /* @ts-ignore */
1756
1959
  ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
1960
+ constructor() {
1961
+ super();
1962
+ // The text of a visible tooltip follows the input, so a label that changes under a pointer
1963
+ // resting on it is not a stale one until the next hover.
1964
+ effect(() => this._updateContent(this.content(), this.data()));
1965
+ }
1757
1966
  // Protected methods
1758
1967
  onPointerEnter(event) {
1759
1968
  // A touch "enter" is a tap, not a hover — toggle instead. The default is
1760
1969
  // not prevented, so the tap still activates an interactive host.
1761
1970
  if (event.pointerType === 'touch') {
1762
- if (this.anchor) {
1763
- this._hide();
1971
+ if (this._isTapped(this._element)) {
1972
+ this._hide('touch');
1764
1973
  }
1765
1974
  else {
1766
- this._showHost();
1975
+ this._showHost('touch');
1767
1976
  }
1768
1977
  return;
1769
1978
  }
1770
- this._showHost({ x: event.clientX, y: event.clientY });
1979
+ this._showHost('hover', { x: event.clientX, y: event.clientY });
1771
1980
  }
1772
1981
  onPointerMove(event) {
1773
1982
  if (event.pointerType === 'touch')
1774
1983
  return;
1775
1984
  if (this.tooltipOrigin() === 'cursor') {
1776
- this._tooltipService.move({ x: event.clientX, y: event.clientY }, this._positions());
1985
+ this._tooltipService.move(this, { x: event.clientX, y: event.clientY });
1777
1986
  }
1778
1987
  }
1779
1988
  onPointerLeave(event) {
@@ -1781,36 +1990,50 @@ class TooltipDirective extends TooltipTrigger {
1781
1990
  // same gesture; hiding here would undo the toggle the tap just made.
1782
1991
  if (event.pointerType === 'touch')
1783
1992
  return;
1784
- this._hide();
1993
+ this._hide('hover');
1785
1994
  }
1786
- onFocus() {
1995
+ onFocusIn(event) {
1996
+ // `focus` does not bubble, so a host that only wraps its real control — a button component
1997
+ // whose <button> is inside the template — would never hear about the focus its own tooltip
1998
+ // is for. `focusin` does, and the control that took focus is what the tooltip describes.
1999
+ const focused = event.target;
1787
2000
  // No cursor to anchor to; a focus-triggered tooltip always anchors to the element.
1788
- this._showHost();
2001
+ this._showHost('focus', null, focused instanceof HTMLElement ? focused : null);
1789
2002
  }
1790
- onBlur() {
1791
- this._hide();
2003
+ onFocusOut(event) {
2004
+ // Focus moving between controls inside the host is not a leave.
2005
+ const next = event.relatedTarget;
2006
+ if (next instanceof Node && this._element.contains(next))
2007
+ return;
2008
+ this._hide('focus');
1792
2009
  }
1793
2010
  // Private methods
1794
- _showHost(point) {
1795
- this._show(this._elementRef.nativeElement, this.content(), this.data(), point);
2011
+ _showHost(source, point = null, describedElement = null) {
2012
+ const anchor = this._element;
2013
+ this._show(source, {
2014
+ anchor,
2015
+ describedElement: describedElement ?? anchor,
2016
+ content: this.content(),
2017
+ data: this.data(),
2018
+ point,
2019
+ });
1796
2020
  }
1797
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
1798
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDirective, isStandalone: true, selector: "[tlsTooltip]", inputs: { content: { classPropertyName: "content", publicName: "tlsTooltip", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "pointerenter": "onPointerEnter($event)", "pointermove": "onPointerMove($event)", "pointerleave": "onPointerLeave($event)", "focus": "onFocus()", "blur": "onBlur()" } }, providers: [TooltipService], usesInheritance: true, ngImport: i0 });
2021
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2022
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: TooltipDirective, isStandalone: true, selector: "[tlsTooltip]", inputs: { content: { classPropertyName: "content", publicName: "tlsTooltip", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "pointerenter": "onPointerEnter($event)", "pointermove": "onPointerMove($event)", "pointerleave": "onPointerLeave($event)", "focusin": "onFocusIn($event)", "focusout": "onFocusOut($event)" } }, usesInheritance: true, ngImport: i0 });
1799
2023
  }
1800
2024
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: TooltipDirective, decorators: [{
1801
2025
  type: Directive,
1802
2026
  args: [{
1803
2027
  selector: '[tlsTooltip]',
1804
- providers: [TooltipService],
1805
2028
  host: {
1806
2029
  '(pointerenter)': 'onPointerEnter($event)',
1807
2030
  '(pointermove)': 'onPointerMove($event)',
1808
2031
  '(pointerleave)': 'onPointerLeave($event)',
1809
- '(focus)': 'onFocus()',
1810
- '(blur)': 'onBlur()',
2032
+ '(focusin)': 'onFocusIn($event)',
2033
+ '(focusout)': 'onFocusOut($event)',
1811
2034
  },
1812
2035
  }]
1813
- }], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsTooltip", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
2036
+ }], ctorParameters: () => [], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsTooltip", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
1814
2037
 
1815
2038
  /** Days in a calendar week; the grid renders one weekday row each. */
1816
2039
  const DAYS_PER_WEEK$1 = 7;
@@ -2122,13 +2345,13 @@ class ActivityHeatmap {
2122
2345
  return buildActivityThresholds(maxCount, this.resolvedLevels());
2123
2346
  }
2124
2347
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ActivityHeatmap, deps: [], target: i0.ɵɵFactoryTarget.Component });
2125
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ActivityHeatmap, isStandalone: true, selector: "tls-activity-heatmap", inputs: { entries: { classPropertyName: "entries", publicName: "entries", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, levels: { classPropertyName: "levels", publicName: "levels", isSignal: true, isRequired: false, transformFunction: null }, thresholds: { classPropertyName: "thresholds", publicName: "thresholds", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null }, weekdayLabelInterval: { classPropertyName: "weekdayLabelInterval", publicName: "weekdayLabelInterval", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showMonthLabels: { classPropertyName: "showMonthLabels", publicName: "showMonthLabels", isSignal: true, isRequired: false, transformFunction: null }, showWeekdayLabels: { classPropertyName: "showWeekdayLabels", publicName: "showWeekdayLabels", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, showTooltip: { classPropertyName: "showTooltip", publicName: "showTooltip", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { daySelect: "daySelect" }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<div class=\"tls-activity-heatmap__viewport\">\n <div class=\"tls-activity-heatmap__chart\" [style.--tls-activity-heatmap-weeks]=\"weekCount()\">\n @if (showMonthLabels()) {\n <!-- Month headings repeat the dates already announced on every cell, so they stay decorative. -->\n <div class=\"tls-activity-heatmap__months\" aria-hidden=\"true\">\n @for (month of months(); track month.column) {\n <span\n class=\"tls-activity-heatmap__month\"\n [style.grid-column]=\"month.column + ' / span ' + month.span\"\n >\n {{ month.label }}\n </span>\n }\n </div>\n }\n\n @if (showWeekdayLabels()) {\n <div class=\"tls-activity-heatmap__weekdays\" aria-hidden=\"true\">\n @for (row of rows(); track $index) {\n <span class=\"tls-activity-heatmap__weekday\">{{ row.label }}</span>\n }\n </div>\n }\n\n <!-- One delegated tooltip serves every cell, so a year of days costs a single directive\n and overlay service instead of one per cell. -->\n <div\n ngGrid\n tlsTooltipDelegate\n class=\"tls-activity-heatmap__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [tooltipDisabled]=\"!showTooltip()\"\n [attr.aria-label]=\"gridLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n >\n @for (row of rows(); track $index) {\n <div ngGridRow class=\"tls-activity-heatmap__row\">\n @for (day of row.days; track day.date.getTime()) {\n <!-- Padding days stay navigable so arrow keys never dead-end on the grid's corners;\n they are only unselectable and announce themselves as outside the range. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-activity-heatmap__day\"\n [class.tls-activity-heatmap__day--outside]=\"!day.inRange\"\n [class.tls-activity-heatmap__day--today]=\"day.isToday\"\n [selectable]=\"day.inRange\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(day.level)\"\n [attr.aria-label]=\"day.label\"\n [attr.data-tooltip]=\"day.inRange ? day.label : null\"\n (click)=\"onDaySelect(day)\"\n (keydown.enter)=\"onDaySelect(day)\"\n (keydown.space)=\"onDaySpace($event, day)\"\n ></div>\n }\n </div>\n }\n </div>\n </div>\n</div>\n\n@if (showLegend()) {\n <div class=\"tls-activity-heatmap__legend\">\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendLess }}</span>\n\n <!-- Sample swatches carry no information the \"less \u2026 more\" captions don't already give. -->\n @for (level of legendLevels(); track level) {\n <span\n class=\"tls-activity-heatmap__legend-swatch\"\n aria-hidden=\"true\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(level)\"\n ></span>\n }\n\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendMore }}</span>\n </div>\n}\n", dependencies: [{ kind: "directive", type: Grid, selector: "[ngGrid]", inputs: ["enableSelection", "disabled", "softDisabled", "focusMode", "rowWrap", "colWrap", "multi", "selectionMode", "tabindex"], exportAs: ["ngGrid"] }, { kind: "directive", type: GridRow, selector: "[ngGridRow]", inputs: ["rowIndex"], exportAs: ["ngGridRow"] }, { kind: "directive", type: GridCell, selector: "[ngGridCell]", inputs: ["id", "role", "rowSpan", "colSpan", "rowIndex", "colIndex", "disabled", "selected", "selectable", "tabindex"], outputs: ["selectedChange"], exportAs: ["ngGridCell"] }, { kind: "directive", type: TooltipDelegateDirective, selector: "[tlsTooltipDelegate]", inputs: ["tlsTooltipDelegate"] }] });
2348
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ActivityHeatmap, isStandalone: true, selector: "tls-activity-heatmap", inputs: { entries: { classPropertyName: "entries", publicName: "entries", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, levels: { classPropertyName: "levels", publicName: "levels", isSignal: true, isRequired: false, transformFunction: null }, thresholds: { classPropertyName: "thresholds", publicName: "thresholds", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null }, weekdayLabelInterval: { classPropertyName: "weekdayLabelInterval", publicName: "weekdayLabelInterval", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showMonthLabels: { classPropertyName: "showMonthLabels", publicName: "showMonthLabels", isSignal: true, isRequired: false, transformFunction: null }, showWeekdayLabels: { classPropertyName: "showWeekdayLabels", publicName: "showWeekdayLabels", isSignal: true, isRequired: false, transformFunction: null }, showLegend: { classPropertyName: "showLegend", publicName: "showLegend", isSignal: true, isRequired: false, transformFunction: null }, showTooltip: { classPropertyName: "showTooltip", publicName: "showTooltip", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { daySelect: "daySelect" }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<div class=\"tls-activity-heatmap__viewport\">\n <div class=\"tls-activity-heatmap__chart\" [style.--tls-activity-heatmap-weeks]=\"weekCount()\">\n @if (showMonthLabels()) {\n <!-- Month headings repeat the dates already announced on every cell, so they stay decorative. -->\n <div class=\"tls-activity-heatmap__months\" aria-hidden=\"true\">\n @for (month of months(); track month.column) {\n <span\n class=\"tls-activity-heatmap__month\"\n [style.grid-column]=\"month.column + ' / span ' + month.span\"\n >\n {{ month.label }}\n </span>\n }\n </div>\n }\n\n @if (showWeekdayLabels()) {\n <div class=\"tls-activity-heatmap__weekdays\" aria-hidden=\"true\">\n @for (row of rows(); track $index) {\n <span class=\"tls-activity-heatmap__weekday\">{{ row.label }}</span>\n }\n </div>\n }\n\n <!-- One delegated tooltip serves every cell, so a year of days costs a single directive\n instead of one per cell. -->\n <div\n ngGrid\n tlsTooltipDelegate\n class=\"tls-activity-heatmap__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [tooltipDisabled]=\"!showTooltip()\"\n [attr.aria-label]=\"gridLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n >\n @for (row of rows(); track $index) {\n <div ngGridRow class=\"tls-activity-heatmap__row\">\n @for (day of row.days; track day.date.getTime()) {\n <!-- Padding days stay navigable so arrow keys never dead-end on the grid's corners;\n they are only unselectable and announce themselves as outside the range. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-activity-heatmap__day\"\n [class.tls-activity-heatmap__day--outside]=\"!day.inRange\"\n [class.tls-activity-heatmap__day--today]=\"day.isToday\"\n [selectable]=\"day.inRange\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(day.level)\"\n [attr.aria-label]=\"day.label\"\n [attr.data-tooltip]=\"day.inRange ? day.label : null\"\n (click)=\"onDaySelect(day)\"\n (keydown.enter)=\"onDaySelect(day)\"\n (keydown.space)=\"onDaySpace($event, day)\"\n ></div>\n }\n </div>\n }\n </div>\n </div>\n</div>\n\n@if (showLegend()) {\n <div class=\"tls-activity-heatmap__legend\">\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendLess }}</span>\n\n <!-- Sample swatches carry no information the \"less \u2026 more\" captions don't already give. -->\n @for (level of legendLevels(); track level) {\n <span\n class=\"tls-activity-heatmap__legend-swatch\"\n aria-hidden=\"true\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(level)\"\n ></span>\n }\n\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendMore }}</span>\n </div>\n}\n", dependencies: [{ kind: "directive", type: Grid, selector: "[ngGrid]", inputs: ["enableSelection", "disabled", "softDisabled", "focusMode", "rowWrap", "colWrap", "multi", "selectionMode", "tabindex"], exportAs: ["ngGrid"] }, { kind: "directive", type: GridRow, selector: "[ngGridRow]", inputs: ["rowIndex"], exportAs: ["ngGridRow"] }, { kind: "directive", type: GridCell, selector: "[ngGridCell]", inputs: ["id", "role", "rowSpan", "colSpan", "rowIndex", "colIndex", "disabled", "selected", "selectable", "tabindex"], outputs: ["selectedChange"], exportAs: ["ngGridCell"] }, { kind: "directive", type: TooltipDelegateDirective, selector: "[tlsTooltipDelegate]", inputs: ["tlsTooltipDelegate"] }] });
2126
2349
  }
2127
2350
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ActivityHeatmap, decorators: [{
2128
2351
  type: Component,
2129
2352
  args: [{ selector: 'tls-activity-heatmap', imports: [Grid, GridRow, GridCell, TooltipDelegateDirective], host: {
2130
2353
  '[class]': 'hostClasses()',
2131
- }, template: "<div class=\"tls-activity-heatmap__viewport\">\n <div class=\"tls-activity-heatmap__chart\" [style.--tls-activity-heatmap-weeks]=\"weekCount()\">\n @if (showMonthLabels()) {\n <!-- Month headings repeat the dates already announced on every cell, so they stay decorative. -->\n <div class=\"tls-activity-heatmap__months\" aria-hidden=\"true\">\n @for (month of months(); track month.column) {\n <span\n class=\"tls-activity-heatmap__month\"\n [style.grid-column]=\"month.column + ' / span ' + month.span\"\n >\n {{ month.label }}\n </span>\n }\n </div>\n }\n\n @if (showWeekdayLabels()) {\n <div class=\"tls-activity-heatmap__weekdays\" aria-hidden=\"true\">\n @for (row of rows(); track $index) {\n <span class=\"tls-activity-heatmap__weekday\">{{ row.label }}</span>\n }\n </div>\n }\n\n <!-- One delegated tooltip serves every cell, so a year of days costs a single directive\n and overlay service instead of one per cell. -->\n <div\n ngGrid\n tlsTooltipDelegate\n class=\"tls-activity-heatmap__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [tooltipDisabled]=\"!showTooltip()\"\n [attr.aria-label]=\"gridLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n >\n @for (row of rows(); track $index) {\n <div ngGridRow class=\"tls-activity-heatmap__row\">\n @for (day of row.days; track day.date.getTime()) {\n <!-- Padding days stay navigable so arrow keys never dead-end on the grid's corners;\n they are only unselectable and announce themselves as outside the range. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-activity-heatmap__day\"\n [class.tls-activity-heatmap__day--outside]=\"!day.inRange\"\n [class.tls-activity-heatmap__day--today]=\"day.isToday\"\n [selectable]=\"day.inRange\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(day.level)\"\n [attr.aria-label]=\"day.label\"\n [attr.data-tooltip]=\"day.inRange ? day.label : null\"\n (click)=\"onDaySelect(day)\"\n (keydown.enter)=\"onDaySelect(day)\"\n (keydown.space)=\"onDaySpace($event, day)\"\n ></div>\n }\n </div>\n }\n </div>\n </div>\n</div>\n\n@if (showLegend()) {\n <div class=\"tls-activity-heatmap__legend\">\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendLess }}</span>\n\n <!-- Sample swatches carry no information the \"less \u2026 more\" captions don't already give. -->\n @for (level of legendLevels(); track level) {\n <span\n class=\"tls-activity-heatmap__legend-swatch\"\n aria-hidden=\"true\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(level)\"\n ></span>\n }\n\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendMore }}</span>\n </div>\n}\n" }]
2354
+ }, template: "<div class=\"tls-activity-heatmap__viewport\">\n <div class=\"tls-activity-heatmap__chart\" [style.--tls-activity-heatmap-weeks]=\"weekCount()\">\n @if (showMonthLabels()) {\n <!-- Month headings repeat the dates already announced on every cell, so they stay decorative. -->\n <div class=\"tls-activity-heatmap__months\" aria-hidden=\"true\">\n @for (month of months(); track month.column) {\n <span\n class=\"tls-activity-heatmap__month\"\n [style.grid-column]=\"month.column + ' / span ' + month.span\"\n >\n {{ month.label }}\n </span>\n }\n </div>\n }\n\n @if (showWeekdayLabels()) {\n <div class=\"tls-activity-heatmap__weekdays\" aria-hidden=\"true\">\n @for (row of rows(); track $index) {\n <span class=\"tls-activity-heatmap__weekday\">{{ row.label }}</span>\n }\n </div>\n }\n\n <!-- One delegated tooltip serves every cell, so a year of days costs a single directive\n instead of one per cell. -->\n <div\n ngGrid\n tlsTooltipDelegate\n class=\"tls-activity-heatmap__grid\"\n rowWrap=\"nowrap\"\n colWrap=\"nowrap\"\n [tooltipDisabled]=\"!showTooltip()\"\n [attr.aria-label]=\"gridLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n >\n @for (row of rows(); track $index) {\n <div ngGridRow class=\"tls-activity-heatmap__row\">\n @for (day of row.days; track day.date.getTime()) {\n <!-- Padding days stay navigable so arrow keys never dead-end on the grid's corners;\n they are only unselectable and announce themselves as outside the range. -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -- ngGridCell manages role and roving tabindex -->\n <div\n ngGridCell\n class=\"tls-activity-heatmap__day\"\n [class.tls-activity-heatmap__day--outside]=\"!day.inRange\"\n [class.tls-activity-heatmap__day--today]=\"day.isToday\"\n [selectable]=\"day.inRange\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(day.level)\"\n [attr.aria-label]=\"day.label\"\n [attr.data-tooltip]=\"day.inRange ? day.label : null\"\n (click)=\"onDaySelect(day)\"\n (keydown.enter)=\"onDaySelect(day)\"\n (keydown.space)=\"onDaySpace($event, day)\"\n ></div>\n }\n </div>\n }\n </div>\n </div>\n</div>\n\n@if (showLegend()) {\n <div class=\"tls-activity-heatmap__legend\">\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendLess }}</span>\n\n <!-- Sample swatches carry no information the \"less \u2026 more\" captions don't already give. -->\n @for (level of legendLevels(); track level) {\n <span\n class=\"tls-activity-heatmap__legend-swatch\"\n aria-hidden=\"true\"\n [style.--tls-activity-heatmap-intensity]=\"intensity(level)\"\n ></span>\n }\n\n <span class=\"tls-activity-heatmap__legend-label\">{{ legendMore }}</span>\n </div>\n}\n" }]
2132
2355
  }], propDecorators: { entries: [{ type: i0.Input, args: [{ isSignal: true, alias: "entries", required: false }] }], startDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "startDate", required: false }] }], endDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "endDate", required: false }] }], levels: [{ type: i0.Input, args: [{ isSignal: true, alias: "levels", required: false }] }], thresholds: [{ type: i0.Input, args: [{ isSignal: true, alias: "thresholds", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }], weekdayLabelInterval: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekdayLabelInterval", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], showMonthLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showMonthLabels", required: false }] }], showWeekdayLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "showWeekdayLabels", required: false }] }], showLegend: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLegend", required: false }] }], showTooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTooltip", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], daySelect: [{ type: i0.Output, args: ["daySelect"] }] } });
2133
2356
 
2134
2357
  /**
@@ -5236,6 +5459,8 @@ const DEFAULT_AUTOCOMPLETE_CONFIG = {
5236
5459
  clearable: false,
5237
5460
  filterMode: 'contains',
5238
5461
  emptyMessage: 'No results',
5462
+ loadingMessage: 'Loading',
5463
+ minQueryLength: 0,
5239
5464
  clearLabel: 'Clear',
5240
5465
  virtualScroll: false,
5241
5466
  // The default option row: body-medium line-height (23px) plus block padding (2 × 8px).
@@ -5262,14 +5487,41 @@ class Autocomplete extends AbstractSelect {
5262
5487
  ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
5263
5488
  fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
5264
5489
  clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
5490
+ /**
5491
+ * How the typed query narrows the options. `none` hands that job over entirely — the list is
5492
+ * shown as given, which is what a list fetched per query needs.
5493
+ */
5265
5494
  filterMode = input(this._config.filterMode, /* @ts-ignore */
5266
5495
  ...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
5496
+ /**
5497
+ * Whether a search is in flight. While raised the panel reports the loading state in place of
5498
+ * the empty message, so a list that has not arrived yet stops reading like one that came back
5499
+ * with nothing.
5500
+ */
5501
+ loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
5502
+ /**
5503
+ * Characters the query must reach before it is emitted and before the panel shows options or
5504
+ * the empty message, so an empty field never asks for the whole collection. `0` places no
5505
+ * floor on it.
5506
+ */
5507
+ minQueryLength = input(this._config.minQueryLength, { ...(ngDevMode ? { debugName: "minQueryLength" } : /* istanbul ignore next */ {}), transform: numberAttribute });
5267
5508
  emptyMessage = input(this._config.emptyMessage, /* @ts-ignore */
5268
5509
  ...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
5510
+ loadingMessage = input(this._config.loadingMessage, /* @ts-ignore */
5511
+ ...(ngDevMode ? [{ debugName: "loadingMessage" }] : /* istanbul ignore next */ []));
5269
5512
  clearLabel = input(this._config.clearLabel, /* @ts-ignore */
5270
5513
  ...(ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []));
5271
5514
  virtualScroll = input(this._config.virtualScroll, { ...(ngDevMode ? { debugName: "virtualScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
5272
5515
  virtualScrollItemSize = input(this._config.virtualScrollItemSize, { ...(ngDevMode ? { debugName: "virtualScrollItemSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
5516
+ /**
5517
+ * The field's text, emitted as it is typed — the hook for answering a query from a source the
5518
+ * control does not hold. A typed term is emitted once it reaches {@link minQueryLength}, and an
5519
+ * empty field is emitted however it was emptied (typing, the clear button, a search abandoned by
5520
+ * closing the panel), so a listener is never left holding results for a term the field no longer
5521
+ * shows. Restoring a committed selection's label emits nothing: the item is already chosen, and
5522
+ * searching for it again is noise. Any debouncing belongs to the listener.
5523
+ */
5524
+ queryChange = output();
5273
5525
  hasValue = computed(() => {
5274
5526
  const value = this.value();
5275
5527
  return value !== null && value !== undefined;
@@ -5291,6 +5543,31 @@ class Autocomplete extends AbstractSelect {
5291
5543
  */
5292
5544
  query = linkedSignal(() => this.selectedLabel(), /* @ts-ignore */
5293
5545
  ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
5546
+ /** Whether the query has yet to reach the length below which the control stays silent. */
5547
+ belowMinQueryLength = computed(() => {
5548
+ // The label a committed selection puts in the field is not a query, however short it is,
5549
+ // so browsing an existing selection is never held to the floor a search has to clear.
5550
+ if (this.hasValue() && this.query() === this.selectedLabel())
5551
+ return false;
5552
+ return this.query().trim().length < this.minQueryLength();
5553
+ }, /* @ts-ignore */
5554
+ ...(ngDevMode ? [{ debugName: "belowMinQueryLength" }] : /* istanbul ignore next */ []));
5555
+ /**
5556
+ * Whether the panel has anything to put in its box: options, the loading state, or the empty
5557
+ * message. A query under {@link minQueryLength} produces none of the three, and an empty box is
5558
+ * worse than no box at all.
5559
+ */
5560
+ hasPanelContent = computed(() => {
5561
+ if (this.loading())
5562
+ return true;
5563
+ if (this.visibleOptions().length > 0)
5564
+ return true;
5565
+ return !this.belowMinQueryLength();
5566
+ }, /* @ts-ignore */
5567
+ ...(ngDevMode ? [{ debugName: "hasPanelContent" }] : /* istanbul ignore next */ []));
5568
+ /** Whether work is outstanding on the control: async validation, or a search in flight. */
5569
+ busy = computed(() => this.pending() || this.loading(), /* @ts-ignore */
5570
+ ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
5294
5571
  select(option) {
5295
5572
  if (option.disabled)
5296
5573
  return;
@@ -5302,9 +5579,14 @@ class Autocomplete extends AbstractSelect {
5302
5579
  }
5303
5580
  onInput(event) {
5304
5581
  const target = event.target;
5305
- this.query.set(target.value);
5582
+ this._setQuery(target.value);
5306
5583
  this.open();
5307
5584
  this.activeIndex.set(this.getInitialActiveIndex());
5585
+ // Typing is the only thing that emits a term; every other write of `query` re-derives it from
5586
+ // the committed selection, and a listener must not be sent a query nobody typed. An emptied
5587
+ // field is announced by the write itself, whatever emptied it.
5588
+ if (target.value !== '' && !this.belowMinQueryLength())
5589
+ this.queryChange.emit(target.value);
5308
5590
  }
5309
5591
  onKeydown(event) {
5310
5592
  if (event.key === 'ArrowDown') {
@@ -5347,6 +5629,12 @@ class Autocomplete extends AbstractSelect {
5347
5629
  }
5348
5630
  }
5349
5631
  filterVisibleOptions(options) {
5632
+ if (this.belowMinQueryLength())
5633
+ return [];
5634
+ // The options are already the answer to the query, decided wherever the list came from;
5635
+ // filtering them again here could only drop rows that answer it.
5636
+ if (this.filterMode() === 'none')
5637
+ return options;
5350
5638
  const query = this.query().trim().toLowerCase();
5351
5639
  if (!query)
5352
5640
  return options;
@@ -5358,13 +5646,20 @@ class Autocomplete extends AbstractSelect {
5358
5646
  }
5359
5647
  return options.filter(option => option.label.toLowerCase().includes(query));
5360
5648
  }
5649
+ hostStateClasses() {
5650
+ if (!this.loading())
5651
+ return [];
5652
+ return [`${this.hostClassBase}--loading`];
5653
+ }
5361
5654
  onClosed() {
5362
5655
  // Discard an unmatched free-text query, restoring the committed selection's label (or empty).
5363
- this.query.set(this.selectedLabel());
5656
+ this._setQuery(this.selectedLabel());
5364
5657
  }
5365
5658
  clear() {
5659
+ // The text goes first: dropping the value re-derives the field from the (now absent)
5660
+ // selection, which would erase the outgoing text before it can be seen as emptied.
5661
+ this._setQuery('');
5366
5662
  this.value.set(null);
5367
- this.query.set('');
5368
5663
  }
5369
5664
  getInitialActiveIndex() {
5370
5665
  const options = this.visibleOptions();
@@ -5378,15 +5673,28 @@ class Autocomplete extends AbstractSelect {
5378
5673
  commitActiveOption(option) {
5379
5674
  this.select(option);
5380
5675
  }
5676
+ // Private methods
5677
+ /**
5678
+ * Writes the field's text, announcing it whenever the write leaves the field empty. An empty
5679
+ * field is the one state a listener cannot infer from silence — its last results answer a term
5680
+ * that is gone — so it is reported no matter which route emptied the field. A write that lands
5681
+ * on text, including a committed selection's restored label, says nothing on its own.
5682
+ */
5683
+ _setQuery(text) {
5684
+ const emptied = text === '' && this.query() !== '';
5685
+ this.query.set(text);
5686
+ if (emptied)
5687
+ this.queryChange.emit('');
5688
+ }
5381
5689
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, deps: null, target: i0.ɵɵFactoryTarget.Component });
5382
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Autocomplete, isStandalone: true, selector: "tls-autocomplete", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], usesInheritance: true, ngImport: i0, template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-autocomplete__panel tls-autocomplete__panel--virtual\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-autocomplete__option\"\n role=\"presentation\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n @if (visibleOptions().length === 0) {\n <div class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</div>\n }\n </div>\n } @else {\n <ul\n class=\"tls-autocomplete__panel\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
5690
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Autocomplete, isStandalone: true, selector: "tls-autocomplete", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, minQueryLength: { classPropertyName: "minQueryLength", publicName: "minQueryLength", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, loadingMessage: { classPropertyName: "loadingMessage", publicName: "loadingMessage", isSignal: true, isRequired: false, transformFunction: null }, clearLabel: { classPropertyName: "clearLabel", publicName: "clearLabel", isSignal: true, isRequired: false, transformFunction: null }, virtualScroll: { classPropertyName: "virtualScroll", publicName: "virtualScroll", isSignal: true, isRequired: false, transformFunction: null }, virtualScrollItemSize: { classPropertyName: "virtualScrollItemSize", publicName: "virtualScrollItemSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", queryChange: "queryChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], usesInheritance: true, ngImport: i0, template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"busy() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<!--\n A live region is only announced reliably when it is already in the DOM before its text\n changes, so the region is permanent and the loading state writes into it. The panel's own\n notice is hidden from assistive technology to keep it from being read twice. Only a search\n behind an open panel is announced: a list nobody is looking at has nothing to report.\n-->\n<div class=\"tls-autocomplete__status\" role=\"status\">\n {{ loading() && isOpen() ? loadingMessage() : '' }}\n</div>\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-autocomplete__panel tls-autocomplete__panel--virtual\"\n [class.tls-autocomplete__panel--hidden]=\"!hasPanelContent()\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-autocomplete__option\"\n role=\"presentation\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n @if (visibleOptions().length === 0) {\n @if (loading()) {\n <div class=\"tls-autocomplete__loading\" role=\"presentation\" aria-hidden=\"true\">\n <tls-loader size=\"xs\" />\n {{ loadingMessage() }}\n </div>\n } @else if (!belowMinQueryLength()) {\n <div class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</div>\n }\n }\n </div>\n } @else {\n <ul\n class=\"tls-autocomplete__panel\"\n [class.tls-autocomplete__panel--hidden]=\"!hasPanelContent()\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n } @empty {\n @if (loading()) {\n <li class=\"tls-autocomplete__loading\" role=\"presentation\" aria-hidden=\"true\">\n <tls-loader size=\"xs\" />\n {{ loadingMessage() }}\n </li>\n } @else if (!belowMinQueryLength()) {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n }\n </ul>\n }\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: VirtualScroll, selector: "tls-virtual-scroll", inputs: ["items", "itemSize", "minBufferPx", "maxBufferPx", "orientation", "appendOnly", "templateCacheSize", "trackBy", "viewportRole", "viewportId", "ariaMultiselectable", "focusable", "ariaLabel", "ariaLabelledby", "ariaDescribedby"], outputs: ["scrolledIndexChange"] }] });
5383
5691
  }
5384
5692
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, decorators: [{
5385
5693
  type: Component,
5386
5694
  args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon, NgTemplateOutlet, VirtualScroll], host: {
5387
5695
  '[class]': 'hostClasses()',
5388
- }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-autocomplete__panel tls-autocomplete__panel--virtual\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-autocomplete__option\"\n role=\"presentation\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n @if (visibleOptions().length === 0) {\n <div class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</div>\n }\n </div>\n } @else {\n <ul\n class=\"tls-autocomplete__panel\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\n }\n</ng-template>\n" }]
5389
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }] } });
5696
+ }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"busy() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n [attr.aria-label]=\"clearLabel()\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<!--\n A live region is only announced reliably when it is already in the DOM before its text\n changes, so the region is permanent and the loading state writes into it. The panel's own\n notice is hidden from assistive technology to keep it from being read twice. Only a search\n behind an open panel is announced: a list nobody is looking at has nothing to report.\n-->\n<div class=\"tls-autocomplete__status\" role=\"status\">\n {{ loading() && isOpen() ? loadingMessage() : '' }}\n</div>\n\n<ng-template #panel>\n <ng-template #optionButton let-option let-index=\"index\" let-setsize=\"setsize\">\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n [attr.aria-posinset]=\"setsize !== null ? index + 1 : null\"\n [attr.aria-setsize]=\"setsize\"\n (click)=\"select(option)\"\n (pointerenter)=\"onOptionHover($event, index, option.disabled)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n </ng-template>\n\n @if (virtualScroll()) {\n <div\n class=\"tls-autocomplete__panel tls-autocomplete__panel--virtual\"\n [class.tls-autocomplete__panel--hidden]=\"!hasPanelContent()\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n >\n <tls-virtual-scroll\n [items]=\"visibleOptions()\"\n [itemSize]=\"virtualScrollItemSize()\"\n trackBy=\"value\"\n viewportRole=\"listbox\"\n [viewportId]=\"listboxId\"\n [focusable]=\"false\"\n [style.--tls-virtual-scroll-height]=\"virtualPanelHeight()\"\n >\n <ng-template #item let-option let-index=\"index\" let-count=\"count\">\n <div\n class=\"tls-autocomplete__option\"\n role=\"presentation\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: count }\"\n />\n </div>\n </ng-template>\n </tls-virtual-scroll>\n @if (visibleOptions().length === 0) {\n @if (loading()) {\n <div class=\"tls-autocomplete__loading\" role=\"presentation\" aria-hidden=\"true\">\n <tls-loader size=\"xs\" />\n {{ loadingMessage() }}\n </div>\n } @else if (!belowMinQueryLength()) {\n <div class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</div>\n }\n }\n </div>\n } @else {\n <ul\n class=\"tls-autocomplete__panel\"\n [class.tls-autocomplete__panel--hidden]=\"!hasPanelContent()\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <ng-container\n [ngTemplateOutlet]=\"optionButton\"\n [ngTemplateOutletContext]=\"{ $implicit: option, index: index, setsize: null }\"\n />\n </li>\n } @empty {\n @if (loading()) {\n <li class=\"tls-autocomplete__loading\" role=\"presentation\" aria-hidden=\"true\">\n <tls-loader size=\"xs\" />\n {{ loadingMessage() }}\n </li>\n } @else if (!belowMinQueryLength()) {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n }\n </ul>\n }\n</ng-template>\n" }]
5697
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], minQueryLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minQueryLength", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }], loadingMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingMessage", required: false }] }], clearLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearLabel", required: false }] }], virtualScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScroll", required: false }] }], virtualScrollItemSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "virtualScrollItemSize", required: false }] }], queryChange: [{ type: i0.Output, args: ["queryChange"] }] } });
5390
5698
 
5391
5699
  const DEFAULT_CHECKBOX_CONFIG = {};
5392
5700