@copilotkit/web-components 1.62.2-canary.1783457132 → 1.62.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1397,8 +1397,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1397
1397
  display: block;
1398
1398
  height: 100%;
1399
1399
  box-sizing: border-box;
1400
- font-family:
1401
- var(--cpk-drawer-font-family, ui-sans-serif, system-ui, sans-serif);
1400
+ font-family: var(
1401
+ --cpk-drawer-font-family,
1402
+ ui-sans-serif,
1403
+ system-ui,
1404
+ sans-serif
1405
+ );
1402
1406
  font-size: var(--cpk-drawer-font-size, 14px);
1403
1407
  line-height: var(--cpk-drawer-line-height, 1.4);
1404
1408
  color: var(--cpk-drawer-fg, var(--foreground, ${tok(T.fg)}));
@@ -1434,9 +1438,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1434
1438
  --_danger: var(--cpk-drawer-danger, var(--destructive, ${tok(T.danger)}));
1435
1439
  --_border: var(--cpk-drawer-border, var(--border, ${tok(T.border)}));
1436
1440
  --_ring: var(--cpk-drawer-ring, var(--ring, ${tok(T.ring)}));
1437
- --_radius: var(--cpk-drawer-radius, var(--radius, ${tok(T.radius)}));
1441
+ --_indicator: var(--cpk-drawer-indicator, #5b94e4);
1442
+ /* Cap the corner radius at 4px (per designer) — themeable but never larger. */
1443
+ --_radius: min(
1444
+ var(--cpk-drawer-radius, var(--radius, ${tok(T.radius)})),
1445
+ 4px
1446
+ );
1438
1447
  --_width: var(--cpk-drawer-width, 320px);
1439
- --_rail-width: var(--cpk-drawer-rail-width, 56px);
1440
1448
  }
1441
1449
 
1442
1450
  :host([hidden]) {
@@ -1456,19 +1464,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1456
1464
  border-right: 1px solid var(--_border);
1457
1465
  overflow: hidden;
1458
1466
  transition: width 0.2s ease;
1459
- /* Positioning context for the confirm-delete dialog's absolutely-positioned
1460
- backdrop (see .dialog-backdrop). Without this the backdrop's inset:0
1461
- resolves against the initial containing block (the viewport) and its
1462
- low z-index competes in the light-DOM root stacking context, so on
1463
- desktop the dialog escapes the drawer column and paints UNDER the chat
1464
- input (which sits in a sibling column). Anchoring here confines the
1465
- modal to the drawer, where its z-index only needs to beat the rows.
1466
- The mobile path already establishes its own context via position:fixed. */
1467
- position: relative;
1468
- }
1469
-
1470
- .root.collapsed {
1471
- width: var(--_rail-width);
1467
+ /* The confirm-delete dialog no longer needs a positioning context here: it
1468
+ is a native <dialog> opened with showModal(), which renders in the
1469
+ browser top layer independent of any stacking context (ENT-1051). No
1470
+ other direct child of .root is absolutely positioned (the filter and
1471
+ row-action popovers anchor to their own positioned ancestors), so .root
1472
+ stays static. The mobile path establishes its own context via
1473
+ position:fixed. */
1472
1474
  }
1473
1475
 
1474
1476
  /* Mobile: off-canvas overlay (modal pattern). */
@@ -1486,6 +1488,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1486
1488
  transform: translateX(0);
1487
1489
  }
1488
1490
 
1491
+ /* Desktop collapsed: the panel is replaced by the floating cluster, so remove
1492
+ it from the layout entirely. The host reclaims the reserved column via the
1493
+ --cpk-drawer-reserved-width:0px override the element sets on collapse. */
1494
+ .root.collapsed {
1495
+ display: none;
1496
+ }
1497
+
1489
1498
  .backdrop {
1490
1499
  position: fixed;
1491
1500
  inset: 0;
@@ -1497,29 +1506,50 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1497
1506
  cursor: pointer;
1498
1507
  }
1499
1508
 
1500
- /* Mobile-only floating affordance to OPEN the off-canvas drawer. Rendered by
1501
- the element itself so phones always have a way in with no host wiring. */
1502
- .launcher {
1509
+ /* Floating launcher cluster (Figma "closed" mockup): a rounded surface card
1510
+ holding the sidebar toggle + a "New Conversation" (+) icon button. Rendered
1511
+ by the element itself in the mobile-closed AND desktop-collapsed states so
1512
+ there is always a way to reopen/expand — and to start a new conversation —
1513
+ with no host wiring. */
1514
+ .launcher-cluster {
1503
1515
  position: fixed;
1504
1516
  z-index: 998;
1505
- /* Position is themeable so a host can line the launcher up with its own
1517
+ /* Position is themeable so a host can line the cluster up with its own
1506
1518
  header controls (e.g. vertically centering it on a toggle group). */
1507
- top: var(--cpk-drawer-launcher-top, 12px);
1508
- left: var(--cpk-drawer-launcher-left, 12px);
1519
+ top: var(--cpk-drawer-launcher-top, 24px);
1520
+ left: var(--cpk-drawer-launcher-left, 24px);
1509
1521
  display: inline-flex;
1510
1522
  align-items: center;
1511
- justify-content: center;
1512
- width: 40px;
1513
- height: 40px;
1514
- border-radius: 999px;
1523
+ gap: 2px;
1524
+ padding: 6px;
1525
+ border-radius: var(--_radius);
1515
1526
  border: 1px solid var(--_border);
1516
1527
  background: var(--_surface);
1517
1528
  color: var(--_surface-fg);
1518
- cursor: pointer;
1519
1529
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
1520
1530
  }
1521
1531
 
1522
- .launcher-icon {
1532
+ .launcher {
1533
+ display: inline-flex;
1534
+ align-items: center;
1535
+ justify-content: center;
1536
+ width: 32px;
1537
+ height: 32px;
1538
+ padding: 6px;
1539
+ border: 0;
1540
+ border-radius: calc(var(--_radius) - 3px);
1541
+ background: transparent;
1542
+ color: var(--_surface-fg);
1543
+ cursor: pointer;
1544
+ font: inherit;
1545
+ }
1546
+
1547
+ .launcher:hover,
1548
+ .launcher:focus-visible {
1549
+ background: var(--_muted);
1550
+ }
1551
+
1552
+ .launcher .icon {
1523
1553
  width: 18px;
1524
1554
  height: 18px;
1525
1555
  display: block;
@@ -1528,33 +1558,176 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1528
1558
  .header {
1529
1559
  display: flex;
1530
1560
  align-items: center;
1531
- justify-content: space-between;
1532
1561
  gap: 8px;
1533
1562
  padding: 12px;
1534
- border-bottom: 1px solid var(--_border);
1535
1563
  }
1536
1564
 
1537
- .filters {
1538
- display: flex;
1539
- gap: 4px;
1540
- padding: 8px 12px;
1565
+ /* The header is hidden until a consumer projects slot="header" content
1566
+ (the redesign has no built-in header controls). Mirrors the memories/footer
1567
+ gating so an empty padded header bar never renders above the list. */
1568
+ .header[hidden] {
1569
+ display: none;
1541
1570
  }
1542
1571
 
1543
- .filter-btn {
1572
+ /* Optional consumer projection surface. When a consumer projects into
1573
+ slot="header" it fills the header row. */
1574
+ .header slot[name="header"] {
1575
+ display: flex;
1576
+ align-items: center;
1544
1577
  flex: 1;
1545
- padding: 6px 10px;
1546
- border: 1px solid var(--_border);
1578
+ min-width: 0;
1579
+ }
1580
+
1581
+ .icon-btn {
1582
+ position: relative;
1583
+ display: inline-flex;
1584
+ align-items: center;
1585
+ justify-content: center;
1586
+ width: 32px;
1587
+ height: 32px;
1588
+ padding: 6px;
1589
+ border: 0;
1547
1590
  border-radius: var(--_radius);
1548
- background: var(--_bg);
1591
+ background: transparent;
1549
1592
  color: var(--_muted-fg);
1550
1593
  cursor: pointer;
1551
1594
  font: inherit;
1552
1595
  }
1553
1596
 
1554
- .filter-btn[aria-pressed="true"] {
1555
- background: var(--_accent);
1556
- color: var(--_accent-fg);
1557
- border-color: var(--_ring);
1597
+ /* "Filter applied" indicator dot at the funnel's bottom-right (Figma archived
1598
+ view). Shown only when a non-default filter is active. */
1599
+ .filter-dot {
1600
+ position: absolute;
1601
+ right: 3px;
1602
+ bottom: 4px;
1603
+ width: 6px;
1604
+ height: 6px;
1605
+ border-radius: 50%;
1606
+ background: var(--_indicator);
1607
+ pointer-events: none;
1608
+ }
1609
+
1610
+ .icon-btn:hover,
1611
+ .icon-btn:focus-visible {
1612
+ background: var(--_muted);
1613
+ color: inherit;
1614
+ }
1615
+
1616
+ .icon-btn[aria-pressed="true"] {
1617
+ background: var(--_muted);
1618
+ color: inherit;
1619
+ }
1620
+
1621
+ .icon {
1622
+ width: 20px;
1623
+ height: 20px;
1624
+ display: block;
1625
+ }
1626
+
1627
+ .new-conversation {
1628
+ display: flex;
1629
+ align-items: center;
1630
+ gap: 12px;
1631
+ /* No top margin by default: the header bar (the collapse toggle on desktop,
1632
+ the close button on mobile-open) sits above this row and supplies the top
1633
+ spacing — the header-hidden case re-adds it below. Horizontal geometry
1634
+ matches the list rows: the hover background insets 12px (like a row's
1635
+ highlight) and, with 10px inner padding, the icon's left edge lands at
1636
+ 22px — the same x as the thread names below (list padding 12 + row
1637
+ padding 10). */
1638
+ margin: 0 12px;
1639
+ padding: 8px 10px;
1640
+ border: 0;
1641
+ border-radius: var(--_radius);
1642
+ background: transparent;
1643
+ color: inherit;
1644
+ cursor: pointer;
1645
+ font: inherit;
1646
+ text-align: left;
1647
+ }
1648
+
1649
+ /* Only when the header bar is fully hidden (collapsible=false AND no projected
1650
+ header content) is this row the first element — give it the top spacing the
1651
+ header would otherwise supply. */
1652
+ .header[hidden] + .new-conversation {
1653
+ margin-top: 12px;
1654
+ }
1655
+
1656
+ .new-conversation:hover,
1657
+ .new-conversation:focus-visible {
1658
+ background: var(--_muted);
1659
+ }
1660
+
1661
+ .new-conversation .icon {
1662
+ width: 16px;
1663
+ height: 16px;
1664
+ }
1665
+
1666
+ .section-heading {
1667
+ position: relative;
1668
+ display: flex;
1669
+ align-items: center;
1670
+ justify-content: space-between;
1671
+ /* Match the list rows' content edge: "Recent Conversations" lands at 22px
1672
+ (margin 12 + padding 10), aligned with the thread names and the New
1673
+ Conversation icon; the funnel sits 22px from the right, over the kebabs. */
1674
+ padding: 8px 10px;
1675
+ margin: 0 12px;
1676
+ }
1677
+
1678
+ .section-title {
1679
+ font-size: 11px;
1680
+ font-weight: 600;
1681
+ letter-spacing: 0.02em;
1682
+ color: var(--_muted-fg);
1683
+ text-transform: none;
1684
+ }
1685
+
1686
+ .icon-btn.small {
1687
+ width: 24px;
1688
+ height: 24px;
1689
+ padding: 4px;
1690
+ }
1691
+
1692
+ .icon-btn.small .icon {
1693
+ width: 16px;
1694
+ height: 16px;
1695
+ }
1696
+
1697
+ .filter-popover {
1698
+ position: absolute;
1699
+ right: 0;
1700
+ top: calc(100% + 4px);
1701
+ z-index: 15;
1702
+ display: flex;
1703
+ flex-direction: column;
1704
+ min-width: 120px;
1705
+ padding: 4px;
1706
+ background: var(--_surface);
1707
+ color: var(--_surface-fg);
1708
+ border: 1px solid var(--_border);
1709
+ border-radius: var(--_radius);
1710
+ box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
1711
+ }
1712
+
1713
+ .filter-opt {
1714
+ border: 0;
1715
+ background: transparent;
1716
+ color: inherit;
1717
+ cursor: pointer;
1718
+ font: inherit;
1719
+ text-align: left;
1720
+ padding: 6px 8px;
1721
+ border-radius: 4px;
1722
+ }
1723
+
1724
+ .filter-opt:hover,
1725
+ .filter-opt:focus-visible {
1726
+ background: var(--_muted);
1727
+ }
1728
+
1729
+ .filter-opt[aria-pressed="true"] {
1730
+ font-weight: 600;
1558
1731
  }
1559
1732
 
1560
1733
  .list {
@@ -1586,12 +1759,25 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1586
1759
  position: relative;
1587
1760
  }
1588
1761
 
1589
- /* The entry animation leaves each row with a (non-none) transform, making it
1590
- its own stacking context — which would paint the name tooltip UNDER the
1591
- following rows (their text bled through the bubble). Lifting the hovered
1592
- row's z-index re-floats its tooltip above the rows beneath it. */
1593
- .row.name-clipped:hover {
1594
- z-index: 2;
1762
+ /* Lift the interacted row above later rows so its kebab popover (which paints
1763
+ inside the row's own transform stacking context) is not clipped by / drawn
1764
+ under the rows below it. */
1765
+ .row:hover,
1766
+ .row:focus-within,
1767
+ .row.menu-open {
1768
+ z-index: 3;
1769
+ }
1770
+
1771
+ /* While a kebab menu is open, the popover only covers part of the rows it
1772
+ overlaps, so the rest of the list would still respond to hover — revealing
1773
+ other rows' kebabs and (under a host \`::part(row):hover\` theme) painting a
1774
+ hover background "through"/around the open menu. Freeze pointer events on
1775
+ every OTHER row so the menu reads as a single focused surface. The owner
1776
+ row (\`.menu-open\`) and its popover stay interactive, and a pointerdown that
1777
+ lands on a frozen row still reaches the document handler that closes the
1778
+ menu, so click-away dismissal is preserved. */
1779
+ .list.menu-open .row:not(.menu-open) {
1780
+ pointer-events: none;
1595
1781
  }
1596
1782
 
1597
1783
  @keyframes cpk-drawer-row-in {
@@ -1604,19 +1790,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1604
1790
  .row.active {
1605
1791
  background: var(--_accent);
1606
1792
  color: var(--_accent-fg);
1607
- border-color: var(--_ring);
1793
+ /* No border on the selected row — the background change alone marks it
1794
+ (per designer). The base row keeps its 1px transparent border so the
1795
+ layout stays stable. */
1608
1796
  }
1609
1797
 
1610
1798
  .row.archived .row-name {
1611
1799
  color: var(--_muted-fg);
1800
+ font-style: italic;
1612
1801
  }
1613
1802
 
1614
1803
  .row-name {
1615
- /* The outer name element owns NO overflow clip so it can host the name
1616
- tooltip pseudo-element; the inner .row-name-text does the ellipsis. */
1617
1804
  flex: 1;
1618
1805
  min-width: 0;
1619
- position: relative;
1620
1806
  }
1621
1807
 
1622
1808
  .row-name-text {
@@ -1626,41 +1812,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1626
1812
  white-space: nowrap;
1627
1813
  }
1628
1814
 
1629
- /* Name tooltip: matches the row-action tooltip (instant primary bubble with
1630
- an arrow), shown ONLY when the name is clipped. Positioned below the name,
1631
- wrapping within the drawer width (a long name can't fit one line). */
1632
- .row-name.name-clipped[data-tooltip]:hover::after {
1633
- content: attr(data-tooltip);
1634
- position: absolute;
1635
- left: 0;
1636
- top: calc(100% + 6px);
1637
- white-space: normal;
1638
- max-width: 240px;
1639
- background: var(--_primary);
1640
- color: var(--_primary-fg);
1641
- border-radius: 6px;
1642
- padding: 4px 8px;
1643
- font-size: 12px;
1644
- line-height: 1.4;
1645
- box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
1646
- pointer-events: none;
1647
- z-index: 20;
1648
- }
1649
-
1650
- .row-name.name-clipped[data-tooltip]:hover::before {
1651
- content: "";
1652
- position: absolute;
1653
- left: 10px;
1654
- top: calc(100% + 1.5px);
1655
- transform: rotate(45deg);
1656
- width: 7px;
1657
- height: 7px;
1658
- background: var(--_primary);
1659
- border-radius: 1px;
1660
- pointer-events: none;
1661
- z-index: 21;
1662
- }
1663
-
1664
1815
  .row-name.placeholder {
1665
1816
  color: var(--_muted-fg);
1666
1817
  font-style: italic;
@@ -1691,78 +1842,111 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1691
1842
  cursor: pointer;
1692
1843
  font: inherit;
1693
1844
  padding: 5px;
1694
- border-radius: 6px;
1695
- }
1696
-
1697
- /* Instant tooltip (matches the react components' delayDuration:0) styled to
1698
- match the CPK standard tooltip: a solid primary-colored bubble with
1699
- primary-foreground text, rounded corners, no border, and a small arrow —
1700
- NOT a surface/bordered box (which reads as a button). Rendered to the LEFT
1701
- of the action so the list's vertical overflow never clips it; the native
1702
- \`title\` tooltip is avoided because its show-delay is browser-fixed (~1.5s)
1703
- and cannot be tuned. */
1704
- .row-action[data-tooltip]:hover::after,
1705
- .row-action[data-tooltip]:focus-visible::after {
1706
- content: attr(data-tooltip);
1845
+ border-radius: 4px;
1846
+ }
1847
+
1848
+ .row-action:hover,
1849
+ .row-action:focus-visible {
1850
+ background: var(--_muted);
1851
+ color: inherit;
1852
+ }
1853
+
1854
+ .row-action-icon {
1855
+ width: 15px;
1856
+ height: 15px;
1857
+ display: block;
1858
+ }
1859
+
1860
+ /* Per-row kebab trigger: hidden at rest, revealed when the row is hovered,
1861
+ focused (keyboard), active (selected), or its menu is open. */
1862
+ .row-menu {
1863
+ flex: none;
1864
+ display: inline-flex;
1865
+ align-items: center;
1866
+ justify-content: center;
1867
+ width: 24px;
1868
+ height: 24px;
1869
+ padding: 4px;
1870
+ border: 0;
1871
+ border-radius: 4px;
1872
+ background: transparent;
1873
+ color: var(--_muted-fg);
1874
+ cursor: pointer;
1875
+ font: inherit;
1876
+ opacity: 0;
1877
+ }
1878
+
1879
+ .row:hover .row-menu,
1880
+ .row:focus-within .row-menu,
1881
+ .row.active .row-menu,
1882
+ .row-menu[aria-expanded="true"] {
1883
+ opacity: 1;
1884
+ }
1885
+
1886
+ .row-menu:hover,
1887
+ .row-menu:focus-visible {
1888
+ background: var(--_muted);
1889
+ color: inherit;
1890
+ }
1891
+
1892
+ .row-menu .icon {
1893
+ width: 16px;
1894
+ height: 16px;
1895
+ }
1896
+
1897
+ .row-menu-popover {
1707
1898
  position: absolute;
1708
- right: calc(100% + 8px);
1709
- top: 50%;
1710
- transform: translateY(-50%);
1711
- white-space: nowrap;
1712
- background: var(--_primary);
1713
- color: var(--_primary-fg);
1714
- border-radius: 6px;
1715
- padding: 4px 8px;
1716
- font-size: 12px;
1717
- line-height: 1.4;
1899
+ right: 8px;
1900
+ top: calc(100% - 4px);
1901
+ z-index: 16;
1902
+ display: flex;
1903
+ flex-direction: column;
1904
+ min-width: 140px;
1905
+ padding: 4px;
1906
+ background: var(--_surface);
1907
+ color: var(--_surface-fg);
1908
+ border: 1px solid var(--_border);
1909
+ border-radius: var(--_radius);
1718
1910
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
1719
- pointer-events: none;
1720
- z-index: 20;
1721
1911
  }
1722
1912
 
1723
- /* Arrow: a small rotated square at the bubble's right edge, pointing at the
1724
- action — same primary fill as the bubble. */
1725
- .row-action[data-tooltip]:hover::before,
1726
- .row-action[data-tooltip]:focus-visible::before {
1727
- content: "";
1728
- position: absolute;
1729
- right: calc(100% + 4.5px);
1730
- top: 50%;
1731
- transform: translateY(-50%) rotate(45deg);
1732
- width: 7px;
1733
- height: 7px;
1734
- background: var(--_primary);
1735
- border-radius: 1px;
1736
- pointer-events: none;
1737
- z-index: 21;
1913
+ /* Rows in the lower portion of the list open their kebab menu UPWARD so it is
1914
+ not clipped by the list's overflow scroll box (.list is overflow-y:auto,
1915
+ which also clips the x-axis). Anchoring to the button's top edge via
1916
+ \`bottom\` keeps the popover inside the list's visible area for bottom rows. */
1917
+ .row.menu-up .row-menu-popover {
1918
+ top: auto;
1919
+ bottom: calc(100% - 4px);
1738
1920
  }
1739
1921
 
1740
- /* While the delete-confirmation dialog is open, suppress row-action tooltips:
1741
- the clicked trash button keeps :focus-visible (and may stay hovered), which
1742
- would otherwise leave its "Delete" tooltip floating over the dialog. */
1743
- .root.confirming .row-action[data-tooltip]:hover::after,
1744
- .root.confirming .row-action[data-tooltip]:focus-visible::after,
1745
- .root.confirming .row-action[data-tooltip]:hover::before,
1746
- .root.confirming .row-action[data-tooltip]:focus-visible::before {
1747
- content: none;
1748
- display: none;
1922
+ .row-menu-item {
1923
+ display: flex;
1924
+ align-items: center;
1925
+ gap: 8px;
1926
+ border: 0;
1927
+ background: transparent;
1928
+ color: inherit;
1929
+ cursor: pointer;
1930
+ font: inherit;
1931
+ text-align: left;
1932
+ padding: 6px 8px;
1933
+ border-radius: 4px;
1749
1934
  }
1750
1935
 
1751
- .row-action:hover,
1752
- .row-action:focus-visible {
1936
+ .row-menu-item:hover,
1937
+ .row-menu-item:focus-visible {
1753
1938
  background: var(--_muted);
1754
- color: inherit;
1755
1939
  }
1756
1940
 
1757
- .row-action.danger:hover,
1758
- .row-action.danger:focus-visible {
1941
+ .row-menu-item.danger:hover,
1942
+ .row-menu-item.danger:focus-visible {
1759
1943
  color: var(--_danger);
1760
1944
  }
1761
1945
 
1762
- .row-action-icon {
1946
+ .row-menu-item .row-action-icon,
1947
+ .row-menu-item .icon {
1763
1948
  width: 15px;
1764
1949
  height: 15px;
1765
- display: block;
1766
1950
  }
1767
1951
 
1768
1952
  button.primary {
@@ -1827,27 +2011,44 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1827
2011
  display: none;
1828
2012
  }
1829
2013
 
1830
- .dialog-backdrop {
1831
- position: absolute;
1832
- inset: 0;
1833
- background: rgba(0, 0, 0, 0.3);
1834
- display: flex;
1835
- align-items: center;
1836
- justify-content: center;
1837
- z-index: 10;
1838
- }
1839
-
2014
+ /* Confirm-delete dialog — a native <dialog> opened with showModal(). It lives
2015
+ in the browser TOP LAYER, so it can never be painted under other UI (the
2016
+ old CSS-positioned overlay was trapped in the drawer host's stacking
2017
+ context and appeared under the chat's welcome view — ENT-1051). The UA
2018
+ centers it in the viewport via margin:auto; we reset the UA chrome and
2019
+ apply the drawer's surface-card look. */
1840
2020
  .dialog {
2021
+ /* Top-layer (showModal) so it is never clipped, but centered over the DRAWER
2022
+ PANEL rather than the viewport: JS sets --confirm-cx/cy from the visible
2023
+ .root rect (falls back to viewport-center when unmeasured, e.g. jsdom).
2024
+ Width is capped to the drawer band so it reads as "inside the drawer". */
2025
+ margin: 0;
2026
+ position: fixed;
2027
+ left: var(--confirm-cx, 50%);
2028
+ top: var(--confirm-cy, 50%);
2029
+ transform: translate(-50%, -50%);
2030
+ border: 0;
2031
+ padding: 16px;
2032
+ width: max-content;
2033
+ max-width: min(80vw, calc(var(--_width) - 24px));
1841
2034
  background: var(--_surface);
1842
2035
  color: var(--_surface-fg);
1843
2036
  border-radius: var(--_radius);
1844
- padding: 16px;
1845
- max-width: 80%;
2037
+ }
2038
+
2039
+ /* Only lay out the card contents when open. A closed <dialog> is display:none
2040
+ via the UA stylesheet, and author display rules must not override that (or
2041
+ an empty box would leak), so the flex layout is scoped to [open]. */
2042
+ .dialog[open] {
1846
2043
  display: flex;
1847
2044
  flex-direction: column;
1848
2045
  gap: 12px;
1849
2046
  }
1850
2047
 
2048
+ .dialog::backdrop {
2049
+ background: rgba(0, 0, 0, 0.3);
2050
+ }
2051
+
1851
2052
  .dialog-actions {
1852
2053
  display: flex;
1853
2054
  justify-content: flex-end;
@@ -1951,9 +2152,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1951
2152
  <line x1="14" x2="14" y1="11" y2="17" />
1952
2153
  </svg>
1953
2154
  `;
1954
- const iconLauncher = T$1`
2155
+ const iconSidebar = T$1`
1955
2156
  <svg
1956
- class="launcher-icon"
2157
+ class="icon"
1957
2158
  viewBox="0 0 24 24"
1958
2159
  fill="none"
1959
2160
  stroke="currentColor"
@@ -1964,7 +2165,51 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1964
2165
  >
1965
2166
  <rect width="18" height="18" x="3" y="3" rx="2" />
1966
2167
  <path d="M9 3v18" />
1967
- <path d="m14 9 3 3-3 3" />
2168
+ </svg>
2169
+ `;
2170
+ /**
2171
+ * Header / control icons for the redesigned drawer chrome (ENT-1051). Inlined
2172
+ * lucide glyphs (`square-plus`, `filter`, `ellipsis-vertical`) drawn with
2173
+ * `currentColor` so they inherit the button's themed color — the element cannot
2174
+ * depend on a React icon library.
2175
+ */
2176
+ const iconPlusSquare = T$1`
2177
+ <svg
2178
+ class="icon"
2179
+ viewBox="0 0 24 24"
2180
+ fill="none"
2181
+ stroke="currentColor"
2182
+ stroke-width="2"
2183
+ stroke-linecap="round"
2184
+ stroke-linejoin="round"
2185
+ aria-hidden="true"
2186
+ >
2187
+ <rect width="18" height="18" x="3" y="3" rx="2" />
2188
+ <path d="M8 12h8" />
2189
+ <path d="M12 8v8" />
2190
+ </svg>
2191
+ `;
2192
+ const iconFunnel = T$1`
2193
+ <svg
2194
+ class="icon"
2195
+ viewBox="0 0 24 24"
2196
+ fill="none"
2197
+ stroke="currentColor"
2198
+ stroke-width="2"
2199
+ stroke-linecap="round"
2200
+ stroke-linejoin="round"
2201
+ aria-hidden="true"
2202
+ >
2203
+ <line x1="3" y1="5" x2="21" y2="5" />
2204
+ <line x1="6" y1="12" x2="18" y2="12" />
2205
+ <line x1="10" y1="19" x2="14" y2="19" />
2206
+ </svg>
2207
+ `;
2208
+ const iconKebab = T$1`
2209
+ <svg class="icon" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
2210
+ <circle cx="12" cy="5" r="1.6" />
2211
+ <circle cx="12" cy="12" r="1.6" />
2212
+ <circle cx="12" cy="19" r="1.6" />
1968
2213
  </svg>
1969
2214
  `;
1970
2215
  /**
@@ -1973,7 +2218,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1973
2218
  *
1974
2219
  * Pure VIEW: domain data (threads/loading/error/etc.) comes IN as properties and
1975
2220
  * user intent goes OUT as bubbling+composed DOM `CustomEvent`s. The element owns
1976
- * VIEW state (open/collapsed, Active/All filter, confirm-delete dialog, per-row
2221
+ * VIEW state (open, Active/All filter, confirm-delete dialog, per-row
1977
2222
  * animations) while the consumer owns DOMAIN state. `open` is additionally
1978
2223
  * externally controllable via the `open` property + `open-change` event so a
1979
2224
  * host can coordinate mobile open/close.
@@ -1984,6 +2229,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1984
2229
  constructor(..._args) {
1985
2230
  super(..._args);
1986
2231
  this.label = "Threads";
2232
+ this.recentLabel = "Recent Conversations";
1987
2233
  this.threads = [];
1988
2234
  this.loading = false;
1989
2235
  this.error = null;
@@ -1993,21 +2239,34 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1993
2239
  this.hasMore = false;
1994
2240
  this.fetchingMore = false;
1995
2241
  this.fetchMoreError = null;
1996
- this.open = true;
2242
+ this.open = false;
1997
2243
  this.collapsed = false;
2244
+ this.collapsible = true;
1998
2245
  this._filter = "active";
1999
2246
  this._confirmingDeleteId = null;
2000
2247
  this._viewportIsMobile = false;
2248
+ this._hasHeader = false;
2001
2249
  this._hasMemories = false;
2002
2250
  this._hasFooter = false;
2251
+ this._filterOpen = false;
2252
+ this._openMenuId = null;
2003
2253
  this._mediaQuery = null;
2004
2254
  this._onMediaChange = (event) => {
2005
2255
  this._viewportIsMobile = event.matches;
2006
2256
  };
2007
2257
  this._onKeyDown = (event) => {
2008
2258
  if (event.key === "Escape") {
2259
+ if (this._openMenuId !== null) {
2260
+ this._openMenuId = null;
2261
+ event.stopPropagation();
2262
+ return;
2263
+ }
2264
+ if (this._filterOpen) {
2265
+ this._filterOpen = false;
2266
+ event.stopPropagation();
2267
+ return;
2268
+ }
2009
2269
  if (this._confirmingDeleteId !== null) {
2010
- this._confirmingDeleteId = null;
2011
2270
  event.stopPropagation();
2012
2271
  return;
2013
2272
  }
@@ -2019,8 +2278,23 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2019
2278
  }
2020
2279
  if (event.key === "Tab") this._trapTab(event);
2021
2280
  };
2281
+ this._onDocumentPointerDown = (event) => {
2282
+ if (!this._filterOpen && this._openMenuId === null) return;
2283
+ const path = event.composedPath();
2284
+ if (this._filterOpen) {
2285
+ const popover = this.renderRoot.querySelector("[part=\"filters\"]");
2286
+ const trigger = this.renderRoot.querySelector("[part=\"filter-toggle\"]");
2287
+ if (!(popover && path.includes(popover) || trigger && path.includes(trigger))) this._filterOpen = false;
2288
+ }
2289
+ if (this._openMenuId !== null) {
2290
+ const popover = this.renderRoot.querySelector("[part=\"row-menu-popover\"]");
2291
+ const trigger = this.renderRoot.querySelector(".row.menu-open [part=\"row-menu\"]");
2292
+ if (!(popover && path.includes(popover) || trigger && path.includes(trigger))) this._openMenuId = null;
2293
+ }
2294
+ };
2022
2295
  this._seenNamed = /* @__PURE__ */ new Set();
2023
2296
  this._justRevealed = /* @__PURE__ */ new Set();
2297
+ this._repositionConfirm = () => this._positionConfirmDialog();
2024
2298
  this._scrollLocked = false;
2025
2299
  this._prevBodyOverflow = "";
2026
2300
  this._trapTab = (event) => {
@@ -2048,12 +2322,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2048
2322
  this._mediaQuery.addEventListener("change", this._onMediaChange);
2049
2323
  }
2050
2324
  this.addEventListener("keydown", this._onKeyDown);
2325
+ if (typeof document !== "undefined") document.addEventListener("pointerdown", this._onDocumentPointerDown);
2051
2326
  }
2052
2327
  disconnectedCallback() {
2053
2328
  var _this$_mediaQuery;
2054
2329
  super.disconnectedCallback();
2055
2330
  (_this$_mediaQuery = this._mediaQuery) === null || _this$_mediaQuery === void 0 || _this$_mediaQuery.removeEventListener("change", this._onMediaChange);
2056
2331
  this.removeEventListener("keydown", this._onKeyDown);
2332
+ if (typeof document !== "undefined") document.removeEventListener("pointerdown", this._onDocumentPointerDown);
2333
+ if (typeof window !== "undefined") {
2334
+ window.removeEventListener("scroll", this._repositionConfirm, true);
2335
+ window.removeEventListener("resize", this._repositionConfirm);
2336
+ }
2337
+ if (typeof document !== "undefined") document.documentElement.style.removeProperty("--cpk-drawer-reserved-width");
2057
2338
  this._releaseScrollLock();
2058
2339
  }
2059
2340
  willUpdate(changed) {
@@ -2071,6 +2352,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2071
2352
  if (this._confirmingDeleteId !== null) {
2072
2353
  if (!this._visibleThreads().some((t) => t.id === this._confirmingDeleteId)) this._confirmingDeleteId = null;
2073
2354
  }
2355
+ if (this._openMenuId !== null) {
2356
+ if (!this._visibleThreads().some((t) => t.id === this._openMenuId)) this._openMenuId = null;
2357
+ }
2074
2358
  }
2075
2359
  }
2076
2360
  updated(changed) {
@@ -2078,23 +2362,22 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2078
2362
  this._applyScrollLock();
2079
2363
  this._focusFirstFocusable();
2080
2364
  } else this._releaseScrollLock();
2365
+ if (changed.has("collapsed") || changed.has("collapsible") || changed.has("_viewportIsMobile")) this._syncReservedWidth();
2366
+ const dialog = this.renderRoot.querySelector("dialog");
2367
+ if (dialog) {
2368
+ const id = this._confirmingDeleteId;
2369
+ if (id !== null && !dialog.open) {
2370
+ typeof dialog.showModal === "function" ? dialog.showModal() : dialog.setAttribute("open", "");
2371
+ this._positionConfirmDialog();
2372
+ window.addEventListener("scroll", this._repositionConfirm, true);
2373
+ window.addEventListener("resize", this._repositionConfirm);
2374
+ } else if (id === null && dialog.open) {
2375
+ typeof dialog.close === "function" ? dialog.close() : dialog.removeAttribute("open");
2376
+ window.removeEventListener("scroll", this._repositionConfirm, true);
2377
+ window.removeEventListener("resize", this._repositionConfirm);
2378
+ }
2379
+ }
2081
2380
  if (this._justRevealed.size > 0) this._justRevealed = /* @__PURE__ */ new Set();
2082
- this._syncNameClipping();
2083
- }
2084
- /**
2085
- * Marks each row whose name text is truncated with `name-clipped`, so the CSS
2086
- * shows the name tooltip ONLY when the full name isn't already visible (an
2087
- * always-on bubble over every row on hover would be noise). Measured after
2088
- * render because truncation depends on the laid-out width.
2089
- */
2090
- _syncNameClipping() {
2091
- this.renderRoot.querySelectorAll(".row-name").forEach((name) => {
2092
- var _name$closest;
2093
- const text = name.querySelector(".row-name-text");
2094
- const clipped = !!text && text.scrollWidth > text.clientWidth;
2095
- name.classList.toggle("name-clipped", clipped);
2096
- (_name$closest = name.closest(".row")) === null || _name$closest === void 0 || _name$closest.classList.toggle("name-clipped", clipped);
2097
- });
2098
2381
  }
2099
2382
  _isMobileModalOpen() {
2100
2383
  return this._viewportIsMobile && this.open;
@@ -2104,6 +2387,63 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2104
2387
  this.open = next;
2105
2388
  this._emit("open-change", { open: next });
2106
2389
  }
2390
+ _setCollapsed(next) {
2391
+ if (this.collapsed === next) return;
2392
+ this.collapsed = next;
2393
+ this._emit("collapse-change", { collapsed: next });
2394
+ }
2395
+ /**
2396
+ * Signal the drawer's reserved layout width to the host so a desktop collapse
2397
+ * reclaims the column instead of leaving an empty gap. On desktop-collapse we
2398
+ * set `--cpk-drawer-reserved-width: 0px` on the document root; a host whose
2399
+ * grid reads `grid-template-columns: var(--cpk-drawer-reserved-width, 320px) …`
2400
+ * inherits it and collapses the track (with its own transition). Expanded/mobile
2401
+ * clears the override so the host's fallback width applies — which also means
2402
+ * the default (expanded) render never sets it, so there is no hydration flicker.
2403
+ *
2404
+ * It is set on `document.documentElement` (not `parentElement`) BECAUSE the
2405
+ * element is nested inside a framework wrapper host, so its parent is the
2406
+ * wrapper — not the grid container, which is an ancestor a child's custom
2407
+ * property can't reach. `:root` inheritance reaches the grid regardless of
2408
+ * wrapper nesting. Best-effort + namespaced, single-drawer-per-document; a host
2409
+ * with multiple drawers or a custom layout should instead react to the
2410
+ * `collapse-change` event.
2411
+ */
2412
+ _syncReservedWidth() {
2413
+ if (typeof document === "undefined") return;
2414
+ const desktopCollapsed = this.collapsible && this.collapsed && !this._viewportIsMobile;
2415
+ const root = document.documentElement;
2416
+ if (desktopCollapsed) root.style.setProperty("--cpk-drawer-reserved-width", "0px");
2417
+ else root.style.removeProperty("--cpk-drawer-reserved-width");
2418
+ }
2419
+ /**
2420
+ * Center the confirm-delete <dialog> over the drawer PANEL's on-screen box
2421
+ * (not the viewport). The dialog stays a top-layer `showModal()` element so it
2422
+ * is never clipped, but we drive its center via `--confirm-cx/cy` measured
2423
+ * from the visible `.root` rect — so it reads as "inside the drawer" per the
2424
+ * ENT-1051 design while keeping the top-layer robustness. Falls back to
2425
+ * viewport-center (the CSS default) when the panel isn't measurable
2426
+ * (SSR/jsdom).
2427
+ */
2428
+ _positionConfirmDialog() {
2429
+ const dialog = this.renderRoot.querySelector("dialog");
2430
+ const root = this.renderRoot.querySelector(".root");
2431
+ if (!dialog) return;
2432
+ const rect = root === null || root === void 0 ? void 0 : root.getBoundingClientRect();
2433
+ if (!rect || rect.width === 0 && rect.height === 0) {
2434
+ dialog.style.removeProperty("--confirm-cx");
2435
+ dialog.style.removeProperty("--confirm-cy");
2436
+ return;
2437
+ }
2438
+ const vw = window.innerWidth;
2439
+ const vh = window.innerHeight;
2440
+ const visLeft = Math.max(rect.left, 0);
2441
+ const visRight = Math.min(rect.right, vw);
2442
+ const visTop = Math.max(rect.top, 0);
2443
+ const visBottom = Math.min(rect.bottom, vh);
2444
+ dialog.style.setProperty("--confirm-cx", `${(visLeft + visRight) / 2}px`);
2445
+ dialog.style.setProperty("--confirm-cy", `${(visTop + visBottom) / 2}px`);
2446
+ }
2107
2447
  _setFilter(next) {
2108
2448
  if (this._filter === next) return;
2109
2449
  this._filter = next;
@@ -2185,22 +2525,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2185
2525
  });
2186
2526
  }
2187
2527
  render() {
2528
+ const desktopCollapsed = this.collapsible && this.collapsed && !this._viewportIsMobile;
2529
+ const mobileClosed = this._viewportIsMobile && !this.open;
2530
+ const showCluster = desktopCollapsed || mobileClosed;
2188
2531
  const rootClasses = {
2189
2532
  root: true,
2190
- collapsed: this.collapsed && !this._viewportIsMobile,
2191
2533
  mobile: this._viewportIsMobile,
2192
2534
  open: this.open,
2193
- confirming: this._confirmingDeleteId !== null
2535
+ collapsed: desktopCollapsed
2194
2536
  };
2195
2537
  return T$1`
2196
- ${this._viewportIsMobile && !this.open ? T$1`<button
2197
- class="launcher"
2198
- part="launcher"
2199
- aria-label="Open threads"
2200
- @click=${() => this._setOpen(true)}
2201
- >
2202
- <slot name="launcher-icon">${iconLauncher}</slot>
2203
- </button>` : A}
2538
+ ${showCluster ? this._renderCluster() : A}
2204
2539
  ${this._isMobileModalOpen() ? T$1`<button
2205
2540
  class="backdrop"
2206
2541
  part="backdrop"
@@ -2212,46 +2547,153 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2212
2547
  part="root"
2213
2548
  role=${this._isMobileModalOpen() ? "dialog" : "region"}
2214
2549
  aria-modal=${this._isMobileModalOpen() ? "true" : A}
2550
+ aria-hidden=${desktopCollapsed ? "true" : A}
2215
2551
  aria-label=${this.label}
2216
2552
  >
2217
- ${this._renderHeader()} ${this._renderBody()} ${this._renderMemories()}
2218
- ${this._renderFooter()} ${this._renderConfirmDialog()}
2553
+ ${desktopCollapsed ? A : T$1`${this._renderHeader()} ${this._renderBody()}
2554
+ ${this._renderMemories()} ${this._renderFooter()}
2555
+ ${this._renderConfirmDialog()}`}
2219
2556
  </div>
2220
2557
  `;
2221
2558
  }
2222
- _renderHeader() {
2559
+ /**
2560
+ * Floating launcher cluster from the Figma "closed" mockup: a sidebar-glyph
2561
+ * toggle + a "New Conversation" (+) icon button. Shown in TWO states — the
2562
+ * mobile closed state (toggle opens the off-canvas modal) and the desktop
2563
+ * collapsed state (toggle expands the sidebar). The primary toggle keeps
2564
+ * `part="launcher"` for mobile-launcher theme compat; the new-thread button is
2565
+ * suppressed in the locked/unlicensed view, mirroring the New Conversation row.
2566
+ */
2567
+ _renderCluster() {
2568
+ const onToggle = this._viewportIsMobile ? () => this._setOpen(true) : () => this._setCollapsed(false);
2223
2569
  return T$1`
2224
- <div class="header" part="header">
2225
- <slot name="header"><span>${this.label}</span></slot>
2570
+ <div class="launcher-cluster" part="launcher-cluster">
2226
2571
  <button
2227
- class="primary"
2228
- part="new-thread-button"
2229
- aria-label="New thread"
2230
- @click=${() => this._emit("new-thread", {})}
2572
+ class="launcher"
2573
+ part="launcher"
2574
+ aria-label=${this._viewportIsMobile ? "Open threads" : "Expand threads"}
2575
+ @click=${onToggle}
2231
2576
  >
2232
- + New
2577
+ <slot name="launcher-icon">${iconSidebar}</slot>
2233
2578
  </button>
2579
+ ${this.licensed ? T$1`<button
2580
+ class="launcher launcher-new-thread"
2581
+ part="launcher-new-thread"
2582
+ aria-label="New Conversation"
2583
+ @click=${() => this._emit("new-thread", {})}
2584
+ >
2585
+ ${iconPlusSquare}
2586
+ </button>` : A}
2587
+ </div>
2588
+ `;
2589
+ }
2590
+ _renderHeader() {
2591
+ const showMobileClose = this._viewportIsMobile && this.open;
2592
+ const showCollapseToggle = this.collapsible && !this._viewportIsMobile;
2593
+ return T$1`
2594
+ <div
2595
+ class="header"
2596
+ part="header"
2597
+ ?hidden=${!this._hasHeader && !showMobileClose && !showCollapseToggle}
2598
+ >
2599
+ <slot
2600
+ name="header"
2601
+ @slotchange=${(e) => {
2602
+ this._hasHeader = e.target.assignedElements().length > 0;
2603
+ }}
2604
+ ></slot>
2605
+ ${showCollapseToggle ? T$1`<button
2606
+ class="icon-btn"
2607
+ part="collapse-toggle"
2608
+ aria-label="Collapse threads"
2609
+ @click=${() => this._setCollapsed(true)}
2610
+ >
2611
+ ${iconSidebar}
2612
+ </button>` : A}
2613
+ ${showMobileClose ? T$1`<button
2614
+ class="icon-btn"
2615
+ part="close-toggle"
2616
+ aria-label="Close threads"
2617
+ @click=${() => this._setOpen(false)}
2618
+ >
2619
+ ${iconSidebar}
2620
+ </button>` : A}
2234
2621
  </div>
2235
- ${this.licensed && (!hasErrorMessage(this.error) || this.threads.length > 0) ? T$1`
2236
- <div class="filters" part="filters" role="group" aria-label="Filter threads">
2622
+ ${this.licensed ? this._renderNewConversation() : A}
2623
+ ${this._renderSectionHeading()}
2624
+ `;
2625
+ }
2626
+ /**
2627
+ * Dedicated full-width "New Conversation" row. Keeps `part="new-thread-button"`
2628
+ * and fires the existing `new-thread` event, so wrappers/themes that hook the
2629
+ * old header pill are unaffected.
2630
+ */
2631
+ _renderNewConversation() {
2632
+ return T$1`
2633
+ <button
2634
+ class="new-conversation"
2635
+ part="new-thread-button"
2636
+ @click=${() => this._emit("new-thread", {})}
2637
+ >
2638
+ ${iconPlusSquare}
2639
+ <span>New Conversation</span>
2640
+ </button>
2641
+ `;
2642
+ }
2643
+ /**
2644
+ * "Recent Conversations" section heading with a funnel button that opens the
2645
+ * Active/All filter popover. Only shown when the list region is shown
2646
+ * (licensed, and not the full-panel error/empty-before-load) — mirrors the
2647
+ * old filters gate. The popover options keep `part="filter-active"` /
2648
+ * `part="filter-all"` and still emit `filter-change` via `_setFilter`.
2649
+ */
2650
+ _renderSectionHeading() {
2651
+ if (!this.licensed || hasErrorMessage(this.error) && this.threads.length === 0) return A;
2652
+ return T$1`
2653
+ <div class="section-heading" part="section-heading">
2654
+ <span class="section-title">${this.recentLabel}</span>
2655
+ <button
2656
+ class="icon-btn small"
2657
+ part="filter-toggle"
2658
+ aria-label="Filter threads"
2659
+ aria-expanded=${this._filterOpen}
2660
+ @click=${() => this._filterOpen = !this._filterOpen}
2661
+ >
2662
+ ${iconFunnel}
2663
+ ${this._filter !== "active" ? T$1`
2664
+ <span class="filter-dot" part="filter-indicator"></span>
2665
+ ` : A}
2666
+ </button>
2667
+ ${this._filterOpen ? T$1`<div
2668
+ class="filter-popover"
2669
+ part="filters"
2670
+ role="group"
2671
+ aria-label="Filter threads"
2672
+ >
2237
2673
  <button
2238
- class="filter-btn"
2674
+ class="filter-opt"
2239
2675
  part="filter-active"
2240
2676
  aria-pressed=${this._filter === "active"}
2241
- @click=${() => this._setFilter("active")}
2677
+ @click=${() => {
2678
+ this._setFilter("active");
2679
+ this._filterOpen = false;
2680
+ }}
2242
2681
  >
2243
2682
  Active
2244
2683
  </button>
2245
2684
  <button
2246
- class="filter-btn"
2685
+ class="filter-opt"
2247
2686
  part="filter-all"
2248
2687
  aria-pressed=${this._filter === "all"}
2249
- @click=${() => this._setFilter("all")}
2688
+ @click=${() => {
2689
+ this._setFilter("all");
2690
+ this._filterOpen = false;
2691
+ }}
2250
2692
  >
2251
2693
  All
2252
2694
  </button>
2253
- </div>
2254
- ` : A}
2695
+ </div>` : A}
2696
+ </div>
2255
2697
  `;
2256
2698
  }
2257
2699
  _renderBody() {
@@ -2292,7 +2734,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2292
2734
  }
2293
2735
  _renderError() {
2294
2736
  return T$1`
2295
- <div class="state error" part="error" role="alert" data-testid="drawer-error">
2737
+ <div
2738
+ class="state error"
2739
+ part="error"
2740
+ role="alert"
2741
+ data-testid="drawer-error"
2742
+ >
2296
2743
  <p>${this.error}</p>
2297
2744
  <button
2298
2745
  class="primary"
@@ -2319,21 +2766,30 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2319
2766
  </div>
2320
2767
  `;
2321
2768
  return T$1`
2322
- <ul class="list" part="list" role="listbox" aria-label=${this.label}>
2323
- ${c(visible, (thread) => thread.id, (thread) => this._renderRow(thread))}
2769
+ <ul
2770
+ class=${this._openMenuId !== null ? "list menu-open" : "list"}
2771
+ part="list"
2772
+ role="listbox"
2773
+ aria-label=${this.label}
2774
+ >
2775
+ ${c(visible, (thread) => thread.id, (thread, index) => this._renderRow(thread, index, visible.length))}
2324
2776
  </ul>
2325
2777
  ${this._renderFetchMore()}
2326
2778
  `;
2327
2779
  }
2328
- _renderRow(thread) {
2329
- var _thread$name, _thread$name2, _thread$name3;
2780
+ _renderRow(thread, index = 0, total = 1) {
2330
2781
  const isActive = thread.id === this.activeThreadId;
2331
2782
  const hasName = thread.name !== null && thread.name !== "";
2783
+ const displayName = hasName ? thread.name : "New thread";
2332
2784
  const justRevealed = this._justRevealed.has(thread.id);
2785
+ const menuOpen = this._openMenuId === thread.id;
2786
+ const menuUp = menuOpen && total > 1 && index >= total / 2;
2333
2787
  const rowClasses = {
2334
2788
  row: true,
2335
2789
  active: isActive,
2336
- archived: thread.archived
2790
+ archived: thread.archived,
2791
+ "menu-open": menuOpen,
2792
+ "menu-up": menuUp
2337
2793
  };
2338
2794
  const nameClasses = {
2339
2795
  "row-name": true,
@@ -2341,14 +2797,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2341
2797
  revealed: justRevealed
2342
2798
  };
2343
2799
  const slotName = rowSlotName(thread.id);
2344
- const nameSpan = T$1`<span
2345
- class=${e(nameClasses)}
2346
- part="row-name"
2347
- data-tooltip=${hasName ? thread.name : A}
2348
- >
2349
- <span class="row-name-text"
2350
- >${hasName ? thread.name : "New thread"}</span
2351
- >
2800
+ const nameSpan = T$1`<span class=${e(nameClasses)} part="row-name">
2801
+ <span class="row-name-text">${displayName}</span>
2352
2802
  </span>`;
2353
2803
  return T$1`
2354
2804
  <li
@@ -2358,50 +2808,76 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2358
2808
  aria-selected=${isActive ? "true" : "false"}
2359
2809
  tabindex="0"
2360
2810
  data-thread-id=${thread.id}
2361
- @click=${() => this._emit("thread-selected", { threadId: thread.id })}
2811
+ @click=${() => {
2812
+ this._openMenuId = null;
2813
+ this._emit("thread-selected", { threadId: thread.id });
2814
+ }}
2362
2815
  @keydown=${(e) => {
2363
2816
  if (e.key === "Enter" || e.key === " ") {
2364
2817
  e.preventDefault();
2818
+ this._openMenuId = null;
2365
2819
  this._emit("thread-selected", { threadId: thread.id });
2366
2820
  }
2367
2821
  }}
2368
2822
  >
2369
2823
  ${slotName !== null ? T$1`<slot name=${slotName}>${nameSpan}</slot>` : nameSpan}
2370
- ${thread.archived ? T$1`<button
2371
- class="row-action"
2372
- part="row-unarchive"
2373
- data-tooltip="Unarchive"
2374
- aria-label=${`Unarchive thread ${(_thread$name = thread.name) !== null && _thread$name !== void 0 ? _thread$name : "New thread"}`}
2375
- @click=${(e) => {
2824
+ <button
2825
+ class="row-menu"
2826
+ part="row-menu"
2827
+ aria-label=${`Actions for ${displayName}`}
2828
+ aria-haspopup="menu"
2829
+ aria-expanded=${menuOpen}
2830
+ @click=${(e) => {
2376
2831
  e.stopPropagation();
2377
- this._emit("unarchive", { threadId: thread.id });
2832
+ this._openMenuId = menuOpen ? null : thread.id;
2378
2833
  }}
2834
+ >
2835
+ ${iconKebab}
2836
+ </button>
2837
+ ${menuOpen ? T$1`<div
2838
+ class="row-menu-popover"
2839
+ part="row-menu-popover"
2840
+ role="menu"
2379
2841
  >
2380
- ${iconUnarchive}
2381
- </button>` : T$1`<button
2382
- class="row-action"
2383
- part="row-archive"
2384
- data-tooltip="Archive"
2385
- aria-label=${`Archive thread ${(_thread$name2 = thread.name) !== null && _thread$name2 !== void 0 ? _thread$name2 : "New thread"}`}
2386
- @click=${(e) => {
2842
+ ${thread.archived ? T$1`<button
2843
+ class="row-menu-item"
2844
+ part="row-unarchive"
2845
+ role="menuitem"
2846
+ aria-label=${`Unarchive thread ${displayName}`}
2847
+ @click=${(e) => {
2848
+ e.stopPropagation();
2849
+ this._openMenuId = null;
2850
+ this._emit("unarchive", { threadId: thread.id });
2851
+ }}
2852
+ >
2853
+ ${iconUnarchive}<span>Unarchive</span>
2854
+ </button>` : T$1`<button
2855
+ class="row-menu-item"
2856
+ part="row-archive"
2857
+ role="menuitem"
2858
+ aria-label=${`Archive thread ${displayName}`}
2859
+ @click=${(e) => {
2387
2860
  e.stopPropagation();
2861
+ this._openMenuId = null;
2388
2862
  this._emit("archive", { threadId: thread.id });
2389
2863
  }}
2390
- >
2391
- ${iconArchive}
2392
- </button>`}
2393
- <button
2394
- class="row-action danger"
2395
- part="row-delete"
2396
- data-tooltip="Delete"
2397
- aria-label=${`Delete thread ${(_thread$name3 = thread.name) !== null && _thread$name3 !== void 0 ? _thread$name3 : "New thread"}`}
2398
- @click=${(e) => {
2864
+ >
2865
+ ${iconArchive}<span>Archive</span>
2866
+ </button>`}
2867
+ <button
2868
+ class="row-menu-item danger"
2869
+ part="row-delete"
2870
+ role="menuitem"
2871
+ aria-label=${`Delete thread ${displayName}`}
2872
+ @click=${(e) => {
2399
2873
  e.stopPropagation();
2874
+ this._openMenuId = null;
2400
2875
  this._confirmingDeleteId = thread.id;
2401
2876
  }}
2402
- >
2403
- ${iconDelete}
2404
- </button>
2877
+ >
2878
+ ${iconDelete}<span>Delete</span>
2879
+ </button>
2880
+ </div>` : A}
2405
2881
  </li>
2406
2882
  `;
2407
2883
  }
@@ -2456,41 +2932,59 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2456
2932
  </div>
2457
2933
  `;
2458
2934
  }
2935
+ /**
2936
+ * Confirm-delete dialog, rendered as a native `<dialog>` that is ALWAYS
2937
+ * present in the shadow DOM so `updated()` can drive `showModal()`/`close()`
2938
+ * against it. Opening with `showModal()` puts it in the browser TOP LAYER, so
2939
+ * it can never be painted under other UI — the previous CSS-positioned overlay
2940
+ * was trapped in the drawer host's stacking context and appeared under the
2941
+ * chat's welcome view (ENT-1051). The `::backdrop` pseudo-element (styled in
2942
+ * styles.ts) provides the scrim natively.
2943
+ *
2944
+ * The actionable content (message + Cancel/Delete, bound to the captured id)
2945
+ * renders only while confirming, so a closed dialog holds nothing stale.
2946
+ * Native dismissal is wired via `@cancel` (Escape) and a backdrop-click check.
2947
+ */
2459
2948
  _renderConfirmDialog() {
2460
- if (this._confirmingDeleteId === null) return A;
2461
2949
  const id = this._confirmingDeleteId;
2462
2950
  return T$1`
2463
- <div class="dialog-backdrop" part="dialog-backdrop">
2464
- <div
2465
- class="dialog"
2466
- part="confirm-dialog"
2467
- role="alertdialog"
2468
- aria-modal="true"
2469
- aria-label="Confirm delete"
2470
- data-testid="drawer-confirm-delete"
2471
- >
2472
- <p>Delete this thread? This cannot be undone.</p>
2473
- <div class="dialog-actions">
2474
- <button
2475
- class="row-action"
2476
- part="confirm-cancel"
2477
- @click=${() => this._confirmingDeleteId = null}
2478
- >
2479
- Cancel
2480
- </button>
2481
- <button
2482
- class="primary"
2483
- part="confirm-delete"
2484
- @click=${() => {
2951
+ <dialog
2952
+ class="dialog"
2953
+ part="confirm-dialog"
2954
+ role="alertdialog"
2955
+ aria-label="Confirm delete"
2956
+ data-testid="drawer-confirm-delete"
2957
+ @cancel=${(event) => {
2958
+ event.preventDefault();
2959
+ this._confirmingDeleteId = null;
2960
+ }}
2961
+ @click=${(event) => {
2962
+ if (event.target === event.currentTarget) this._confirmingDeleteId = null;
2963
+ }}
2964
+ >
2965
+ ${id !== null ? T$1`
2966
+ <p>Delete this thread? This cannot be undone.</p>
2967
+ <div class="dialog-actions">
2968
+ <button
2969
+ class="row-action"
2970
+ part="confirm-cancel"
2971
+ @click=${() => this._confirmingDeleteId = null}
2972
+ >
2973
+ Cancel
2974
+ </button>
2975
+ <button
2976
+ class="primary"
2977
+ part="confirm-delete"
2978
+ @click=${() => {
2485
2979
  this._confirmingDeleteId = null;
2486
2980
  this._emit("delete", { threadId: id });
2487
2981
  }}
2488
- >
2489
- Delete
2490
- </button>
2491
- </div>
2492
- </div>
2493
- </div>
2982
+ >
2983
+ Delete
2984
+ </button>
2985
+ </div>
2986
+ ` : A}
2987
+ </dialog>
2494
2988
  `;
2495
2989
  }
2496
2990
  };
@@ -2521,6 +3015,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2521
3015
  type: String
2522
3016
  },
2523
3017
  label: { type: String },
3018
+ recentLabel: {
3019
+ attribute: "recent-label",
3020
+ type: String
3021
+ },
3022
+ collapsible: { type: Boolean },
2524
3023
  open: {
2525
3024
  type: Boolean,
2526
3025
  reflect: true
@@ -2532,8 +3031,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2532
3031
  _filter: { state: true },
2533
3032
  _confirmingDeleteId: { state: true },
2534
3033
  _viewportIsMobile: { state: true },
3034
+ _hasHeader: { state: true },
2535
3035
  _hasMemories: { state: true },
2536
- _hasFooter: { state: true }
3036
+ _hasFooter: { state: true },
3037
+ _filterOpen: { state: true },
3038
+ _openMenuId: { state: true }
2537
3039
  };
2538
3040
 
2539
3041
  //#endregion