@copilotkit/web-components 1.62.1 → 1.62.2-canary.1784333495

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,10 +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
- }
1460
-
1461
- .root.collapsed {
1462
- 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. */
1463
1474
  }
1464
1475
 
1465
1476
  /* Mobile: off-canvas overlay (modal pattern). */
@@ -1477,6 +1488,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1477
1488
  transform: translateX(0);
1478
1489
  }
1479
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
+
1480
1498
  .backdrop {
1481
1499
  position: fixed;
1482
1500
  inset: 0;
@@ -1488,29 +1506,50 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1488
1506
  cursor: pointer;
1489
1507
  }
1490
1508
 
1491
- /* Mobile-only floating affordance to OPEN the off-canvas drawer. Rendered by
1492
- the element itself so phones always have a way in with no host wiring. */
1493
- .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 {
1494
1515
  position: fixed;
1495
1516
  z-index: 998;
1496
- /* 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
1497
1518
  header controls (e.g. vertically centering it on a toggle group). */
1498
- top: var(--cpk-drawer-launcher-top, 12px);
1499
- left: var(--cpk-drawer-launcher-left, 12px);
1519
+ top: var(--cpk-drawer-launcher-top, 24px);
1520
+ left: var(--cpk-drawer-launcher-left, 24px);
1500
1521
  display: inline-flex;
1501
1522
  align-items: center;
1502
- justify-content: center;
1503
- width: 40px;
1504
- height: 40px;
1505
- border-radius: 999px;
1523
+ gap: 2px;
1524
+ padding: 6px;
1525
+ border-radius: var(--_radius);
1506
1526
  border: 1px solid var(--_border);
1507
1527
  background: var(--_surface);
1508
1528
  color: var(--_surface-fg);
1509
- cursor: pointer;
1510
1529
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
1511
1530
  }
1512
1531
 
1513
- .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 {
1514
1553
  width: 18px;
1515
1554
  height: 18px;
1516
1555
  display: block;
@@ -1519,33 +1558,176 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1519
1558
  .header {
1520
1559
  display: flex;
1521
1560
  align-items: center;
1522
- justify-content: space-between;
1523
1561
  gap: 8px;
1524
1562
  padding: 12px;
1525
- border-bottom: 1px solid var(--_border);
1526
1563
  }
1527
1564
 
1528
- .filters {
1529
- display: flex;
1530
- gap: 4px;
1531
- 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;
1532
1570
  }
1533
1571
 
1534
- .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;
1535
1577
  flex: 1;
1536
- padding: 6px 10px;
1537
- 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;
1538
1590
  border-radius: var(--_radius);
1539
- background: var(--_bg);
1591
+ background: transparent;
1540
1592
  color: var(--_muted-fg);
1541
1593
  cursor: pointer;
1542
1594
  font: inherit;
1543
1595
  }
1544
1596
 
1545
- .filter-btn[aria-pressed="true"] {
1546
- background: var(--_accent);
1547
- color: var(--_accent-fg);
1548
- 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;
1549
1731
  }
1550
1732
 
1551
1733
  .list {
@@ -1577,12 +1759,25 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1577
1759
  position: relative;
1578
1760
  }
1579
1761
 
1580
- /* The entry animation leaves each row with a (non-none) transform, making it
1581
- its own stacking context — which would paint the name tooltip UNDER the
1582
- following rows (their text bled through the bubble). Lifting the hovered
1583
- row's z-index re-floats its tooltip above the rows beneath it. */
1584
- .row.name-clipped:hover {
1585
- 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;
1586
1781
  }
1587
1782
 
1588
1783
  @keyframes cpk-drawer-row-in {
@@ -1595,19 +1790,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1595
1790
  .row.active {
1596
1791
  background: var(--_accent);
1597
1792
  color: var(--_accent-fg);
1598
- 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. */
1599
1796
  }
1600
1797
 
1601
1798
  .row.archived .row-name {
1602
1799
  color: var(--_muted-fg);
1800
+ font-style: italic;
1603
1801
  }
1604
1802
 
1605
1803
  .row-name {
1606
- /* The outer name element owns NO overflow clip so it can host the name
1607
- tooltip pseudo-element; the inner .row-name-text does the ellipsis. */
1608
1804
  flex: 1;
1609
1805
  min-width: 0;
1610
- position: relative;
1611
1806
  }
1612
1807
 
1613
1808
  .row-name-text {
@@ -1617,41 +1812,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1617
1812
  white-space: nowrap;
1618
1813
  }
1619
1814
 
1620
- /* Name tooltip: matches the row-action tooltip (instant primary bubble with
1621
- an arrow), shown ONLY when the name is clipped. Positioned below the name,
1622
- wrapping within the drawer width (a long name can't fit one line). */
1623
- .row-name.name-clipped[data-tooltip]:hover::after {
1624
- content: attr(data-tooltip);
1625
- position: absolute;
1626
- left: 0;
1627
- top: calc(100% + 6px);
1628
- white-space: normal;
1629
- max-width: 240px;
1630
- background: var(--_primary);
1631
- color: var(--_primary-fg);
1632
- border-radius: 6px;
1633
- padding: 4px 8px;
1634
- font-size: 12px;
1635
- line-height: 1.4;
1636
- box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
1637
- pointer-events: none;
1638
- z-index: 20;
1639
- }
1640
-
1641
- .row-name.name-clipped[data-tooltip]:hover::before {
1642
- content: "";
1643
- position: absolute;
1644
- left: 10px;
1645
- top: calc(100% + 1.5px);
1646
- transform: rotate(45deg);
1647
- width: 7px;
1648
- height: 7px;
1649
- background: var(--_primary);
1650
- border-radius: 1px;
1651
- pointer-events: none;
1652
- z-index: 21;
1653
- }
1654
-
1655
1815
  .row-name.placeholder {
1656
1816
  color: var(--_muted-fg);
1657
1817
  font-style: italic;
@@ -1682,78 +1842,111 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1682
1842
  cursor: pointer;
1683
1843
  font: inherit;
1684
1844
  padding: 5px;
1685
- border-radius: 6px;
1686
- }
1687
-
1688
- /* Instant tooltip (matches the react components' delayDuration:0) styled to
1689
- match the CPK standard tooltip: a solid primary-colored bubble with
1690
- primary-foreground text, rounded corners, no border, and a small arrow —
1691
- NOT a surface/bordered box (which reads as a button). Rendered to the LEFT
1692
- of the action so the list's vertical overflow never clips it; the native
1693
- \`title\` tooltip is avoided because its show-delay is browser-fixed (~1.5s)
1694
- and cannot be tuned. */
1695
- .row-action[data-tooltip]:hover::after,
1696
- .row-action[data-tooltip]:focus-visible::after {
1697
- 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 {
1698
1898
  position: absolute;
1699
- right: calc(100% + 8px);
1700
- top: 50%;
1701
- transform: translateY(-50%);
1702
- white-space: nowrap;
1703
- background: var(--_primary);
1704
- color: var(--_primary-fg);
1705
- border-radius: 6px;
1706
- padding: 4px 8px;
1707
- font-size: 12px;
1708
- 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);
1709
1910
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
1710
- pointer-events: none;
1711
- z-index: 20;
1712
1911
  }
1713
1912
 
1714
- /* Arrow: a small rotated square at the bubble's right edge, pointing at the
1715
- action — same primary fill as the bubble. */
1716
- .row-action[data-tooltip]:hover::before,
1717
- .row-action[data-tooltip]:focus-visible::before {
1718
- content: "";
1719
- position: absolute;
1720
- right: calc(100% + 4.5px);
1721
- top: 50%;
1722
- transform: translateY(-50%) rotate(45deg);
1723
- width: 7px;
1724
- height: 7px;
1725
- background: var(--_primary);
1726
- border-radius: 1px;
1727
- pointer-events: none;
1728
- 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);
1729
1920
  }
1730
1921
 
1731
- /* While the delete-confirmation dialog is open, suppress row-action tooltips:
1732
- the clicked trash button keeps :focus-visible (and may stay hovered), which
1733
- would otherwise leave its "Delete" tooltip floating over the dialog. */
1734
- .root.confirming .row-action[data-tooltip]:hover::after,
1735
- .root.confirming .row-action[data-tooltip]:focus-visible::after,
1736
- .root.confirming .row-action[data-tooltip]:hover::before,
1737
- .root.confirming .row-action[data-tooltip]:focus-visible::before {
1738
- content: none;
1739
- 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;
1740
1934
  }
1741
1935
 
1742
- .row-action:hover,
1743
- .row-action:focus-visible {
1936
+ .row-menu-item:hover,
1937
+ .row-menu-item:focus-visible {
1744
1938
  background: var(--_muted);
1745
- color: inherit;
1746
1939
  }
1747
1940
 
1748
- .row-action.danger:hover,
1749
- .row-action.danger:focus-visible {
1941
+ .row-menu-item.danger:hover,
1942
+ .row-menu-item.danger:focus-visible {
1750
1943
  color: var(--_danger);
1751
1944
  }
1752
1945
 
1753
- .row-action-icon {
1946
+ .row-menu-item .row-action-icon,
1947
+ .row-menu-item .icon {
1754
1948
  width: 15px;
1755
1949
  height: 15px;
1756
- display: block;
1757
1950
  }
1758
1951
 
1759
1952
  button.primary {
@@ -1818,27 +2011,44 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1818
2011
  display: none;
1819
2012
  }
1820
2013
 
1821
- .dialog-backdrop {
1822
- position: absolute;
1823
- inset: 0;
1824
- background: rgba(0, 0, 0, 0.3);
1825
- display: flex;
1826
- align-items: center;
1827
- justify-content: center;
1828
- z-index: 10;
1829
- }
1830
-
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. */
1831
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));
1832
2034
  background: var(--_surface);
1833
2035
  color: var(--_surface-fg);
1834
2036
  border-radius: var(--_radius);
1835
- padding: 16px;
1836
- 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] {
1837
2043
  display: flex;
1838
2044
  flex-direction: column;
1839
2045
  gap: 12px;
1840
2046
  }
1841
2047
 
2048
+ .dialog::backdrop {
2049
+ background: rgba(0, 0, 0, 0.3);
2050
+ }
2051
+
1842
2052
  .dialog-actions {
1843
2053
  display: flex;
1844
2054
  justify-content: flex-end;
@@ -1942,9 +2152,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1942
2152
  <line x1="14" x2="14" y1="11" y2="17" />
1943
2153
  </svg>
1944
2154
  `;
1945
- const iconLauncher = T$1`
2155
+ const iconSidebar = T$1`
1946
2156
  <svg
1947
- class="launcher-icon"
2157
+ class="icon"
1948
2158
  viewBox="0 0 24 24"
1949
2159
  fill="none"
1950
2160
  stroke="currentColor"
@@ -1955,7 +2165,51 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1955
2165
  >
1956
2166
  <rect width="18" height="18" x="3" y="3" rx="2" />
1957
2167
  <path d="M9 3v18" />
1958
- <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" />
1959
2213
  </svg>
1960
2214
  `;
1961
2215
  /**
@@ -1964,7 +2218,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1964
2218
  *
1965
2219
  * Pure VIEW: domain data (threads/loading/error/etc.) comes IN as properties and
1966
2220
  * user intent goes OUT as bubbling+composed DOM `CustomEvent`s. The element owns
1967
- * VIEW state (open/collapsed, Active/All filter, confirm-delete dialog, per-row
2221
+ * VIEW state (open, Active/All filter, confirm-delete dialog, per-row
1968
2222
  * animations) while the consumer owns DOMAIN state. `open` is additionally
1969
2223
  * externally controllable via the `open` property + `open-change` event so a
1970
2224
  * host can coordinate mobile open/close.
@@ -1975,6 +2229,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1975
2229
  constructor(..._args) {
1976
2230
  super(..._args);
1977
2231
  this.label = "Threads";
2232
+ this.recentLabel = "Recent Conversations";
1978
2233
  this.threads = [];
1979
2234
  this.loading = false;
1980
2235
  this.error = null;
@@ -1984,21 +2239,34 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1984
2239
  this.hasMore = false;
1985
2240
  this.fetchingMore = false;
1986
2241
  this.fetchMoreError = null;
1987
- this.open = true;
2242
+ this.open = false;
1988
2243
  this.collapsed = false;
2244
+ this.collapsible = true;
1989
2245
  this._filter = "active";
1990
2246
  this._confirmingDeleteId = null;
1991
2247
  this._viewportIsMobile = false;
2248
+ this._hasHeader = false;
1992
2249
  this._hasMemories = false;
1993
2250
  this._hasFooter = false;
2251
+ this._filterOpen = false;
2252
+ this._openMenuId = null;
1994
2253
  this._mediaQuery = null;
1995
2254
  this._onMediaChange = (event) => {
1996
2255
  this._viewportIsMobile = event.matches;
1997
2256
  };
1998
2257
  this._onKeyDown = (event) => {
1999
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
+ }
2000
2269
  if (this._confirmingDeleteId !== null) {
2001
- this._confirmingDeleteId = null;
2002
2270
  event.stopPropagation();
2003
2271
  return;
2004
2272
  }
@@ -2010,8 +2278,23 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2010
2278
  }
2011
2279
  if (event.key === "Tab") this._trapTab(event);
2012
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
+ };
2013
2295
  this._seenNamed = /* @__PURE__ */ new Set();
2014
2296
  this._justRevealed = /* @__PURE__ */ new Set();
2297
+ this._repositionConfirm = () => this._positionConfirmDialog();
2015
2298
  this._scrollLocked = false;
2016
2299
  this._prevBodyOverflow = "";
2017
2300
  this._trapTab = (event) => {
@@ -2039,12 +2322,19 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2039
2322
  this._mediaQuery.addEventListener("change", this._onMediaChange);
2040
2323
  }
2041
2324
  this.addEventListener("keydown", this._onKeyDown);
2325
+ if (typeof document !== "undefined") document.addEventListener("pointerdown", this._onDocumentPointerDown);
2042
2326
  }
2043
2327
  disconnectedCallback() {
2044
2328
  var _this$_mediaQuery;
2045
2329
  super.disconnectedCallback();
2046
2330
  (_this$_mediaQuery = this._mediaQuery) === null || _this$_mediaQuery === void 0 || _this$_mediaQuery.removeEventListener("change", this._onMediaChange);
2047
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");
2048
2338
  this._releaseScrollLock();
2049
2339
  }
2050
2340
  willUpdate(changed) {
@@ -2062,6 +2352,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2062
2352
  if (this._confirmingDeleteId !== null) {
2063
2353
  if (!this._visibleThreads().some((t) => t.id === this._confirmingDeleteId)) this._confirmingDeleteId = null;
2064
2354
  }
2355
+ if (this._openMenuId !== null) {
2356
+ if (!this._visibleThreads().some((t) => t.id === this._openMenuId)) this._openMenuId = null;
2357
+ }
2065
2358
  }
2066
2359
  }
2067
2360
  updated(changed) {
@@ -2069,23 +2362,22 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2069
2362
  this._applyScrollLock();
2070
2363
  this._focusFirstFocusable();
2071
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
+ }
2072
2380
  if (this._justRevealed.size > 0) this._justRevealed = /* @__PURE__ */ new Set();
2073
- this._syncNameClipping();
2074
- }
2075
- /**
2076
- * Marks each row whose name text is truncated with `name-clipped`, so the CSS
2077
- * shows the name tooltip ONLY when the full name isn't already visible (an
2078
- * always-on bubble over every row on hover would be noise). Measured after
2079
- * render because truncation depends on the laid-out width.
2080
- */
2081
- _syncNameClipping() {
2082
- this.renderRoot.querySelectorAll(".row-name").forEach((name) => {
2083
- var _name$closest;
2084
- const text = name.querySelector(".row-name-text");
2085
- const clipped = !!text && text.scrollWidth > text.clientWidth;
2086
- name.classList.toggle("name-clipped", clipped);
2087
- (_name$closest = name.closest(".row")) === null || _name$closest === void 0 || _name$closest.classList.toggle("name-clipped", clipped);
2088
- });
2089
2381
  }
2090
2382
  _isMobileModalOpen() {
2091
2383
  return this._viewportIsMobile && this.open;
@@ -2095,6 +2387,63 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2095
2387
  this.open = next;
2096
2388
  this._emit("open-change", { open: next });
2097
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
+ }
2098
2447
  _setFilter(next) {
2099
2448
  if (this._filter === next) return;
2100
2449
  this._filter = next;
@@ -2176,22 +2525,17 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2176
2525
  });
2177
2526
  }
2178
2527
  render() {
2528
+ const desktopCollapsed = this.collapsible && this.collapsed && !this._viewportIsMobile;
2529
+ const mobileClosed = this._viewportIsMobile && !this.open;
2530
+ const showCluster = desktopCollapsed || mobileClosed;
2179
2531
  const rootClasses = {
2180
2532
  root: true,
2181
- collapsed: this.collapsed && !this._viewportIsMobile,
2182
2533
  mobile: this._viewportIsMobile,
2183
2534
  open: this.open,
2184
- confirming: this._confirmingDeleteId !== null
2535
+ collapsed: desktopCollapsed
2185
2536
  };
2186
2537
  return T$1`
2187
- ${this._viewportIsMobile && !this.open ? T$1`<button
2188
- class="launcher"
2189
- part="launcher"
2190
- aria-label="Open threads"
2191
- @click=${() => this._setOpen(true)}
2192
- >
2193
- <slot name="launcher-icon">${iconLauncher}</slot>
2194
- </button>` : A}
2538
+ ${showCluster ? this._renderCluster() : A}
2195
2539
  ${this._isMobileModalOpen() ? T$1`<button
2196
2540
  class="backdrop"
2197
2541
  part="backdrop"
@@ -2203,46 +2547,153 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2203
2547
  part="root"
2204
2548
  role=${this._isMobileModalOpen() ? "dialog" : "region"}
2205
2549
  aria-modal=${this._isMobileModalOpen() ? "true" : A}
2550
+ aria-hidden=${desktopCollapsed ? "true" : A}
2206
2551
  aria-label=${this.label}
2207
2552
  >
2208
- ${this._renderHeader()} ${this._renderBody()} ${this._renderMemories()}
2209
- ${this._renderFooter()} ${this._renderConfirmDialog()}
2553
+ ${desktopCollapsed ? A : T$1`${this._renderHeader()} ${this._renderBody()}
2554
+ ${this._renderMemories()} ${this._renderFooter()}
2555
+ ${this._renderConfirmDialog()}`}
2210
2556
  </div>
2211
2557
  `;
2212
2558
  }
2213
- _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);
2214
2569
  return T$1`
2215
- <div class="header" part="header">
2216
- <slot name="header"><span>${this.label}</span></slot>
2570
+ <div class="launcher-cluster" part="launcher-cluster">
2217
2571
  <button
2218
- class="primary"
2219
- part="new-thread-button"
2220
- aria-label="New thread"
2221
- @click=${() => this._emit("new-thread", {})}
2572
+ class="launcher"
2573
+ part="launcher"
2574
+ aria-label=${this._viewportIsMobile ? "Open threads" : "Expand threads"}
2575
+ @click=${onToggle}
2222
2576
  >
2223
- + New
2577
+ <slot name="launcher-icon">${iconSidebar}</slot>
2224
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}
2225
2621
  </div>
2226
- ${this.licensed && (!hasErrorMessage(this.error) || this.threads.length > 0) ? T$1`
2227
- <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
+ >
2228
2673
  <button
2229
- class="filter-btn"
2674
+ class="filter-opt"
2230
2675
  part="filter-active"
2231
2676
  aria-pressed=${this._filter === "active"}
2232
- @click=${() => this._setFilter("active")}
2677
+ @click=${() => {
2678
+ this._setFilter("active");
2679
+ this._filterOpen = false;
2680
+ }}
2233
2681
  >
2234
2682
  Active
2235
2683
  </button>
2236
2684
  <button
2237
- class="filter-btn"
2685
+ class="filter-opt"
2238
2686
  part="filter-all"
2239
2687
  aria-pressed=${this._filter === "all"}
2240
- @click=${() => this._setFilter("all")}
2688
+ @click=${() => {
2689
+ this._setFilter("all");
2690
+ this._filterOpen = false;
2691
+ }}
2241
2692
  >
2242
2693
  All
2243
2694
  </button>
2244
- </div>
2245
- ` : A}
2695
+ </div>` : A}
2696
+ </div>
2246
2697
  `;
2247
2698
  }
2248
2699
  _renderBody() {
@@ -2283,7 +2734,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2283
2734
  }
2284
2735
  _renderError() {
2285
2736
  return T$1`
2286
- <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
+ >
2287
2743
  <p>${this.error}</p>
2288
2744
  <button
2289
2745
  class="primary"
@@ -2310,21 +2766,30 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2310
2766
  </div>
2311
2767
  `;
2312
2768
  return T$1`
2313
- <ul class="list" part="list" role="listbox" aria-label=${this.label}>
2314
- ${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))}
2315
2776
  </ul>
2316
2777
  ${this._renderFetchMore()}
2317
2778
  `;
2318
2779
  }
2319
- _renderRow(thread) {
2320
- var _thread$name, _thread$name2, _thread$name3;
2780
+ _renderRow(thread, index = 0, total = 1) {
2321
2781
  const isActive = thread.id === this.activeThreadId;
2322
2782
  const hasName = thread.name !== null && thread.name !== "";
2783
+ const displayName = hasName ? thread.name : "New thread";
2323
2784
  const justRevealed = this._justRevealed.has(thread.id);
2785
+ const menuOpen = this._openMenuId === thread.id;
2786
+ const menuUp = menuOpen && total > 1 && index >= total / 2;
2324
2787
  const rowClasses = {
2325
2788
  row: true,
2326
2789
  active: isActive,
2327
- archived: thread.archived
2790
+ archived: thread.archived,
2791
+ "menu-open": menuOpen,
2792
+ "menu-up": menuUp
2328
2793
  };
2329
2794
  const nameClasses = {
2330
2795
  "row-name": true,
@@ -2332,14 +2797,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2332
2797
  revealed: justRevealed
2333
2798
  };
2334
2799
  const slotName = rowSlotName(thread.id);
2335
- const nameSpan = T$1`<span
2336
- class=${e(nameClasses)}
2337
- part="row-name"
2338
- data-tooltip=${hasName ? thread.name : A}
2339
- >
2340
- <span class="row-name-text"
2341
- >${hasName ? thread.name : "New thread"}</span
2342
- >
2800
+ const nameSpan = T$1`<span class=${e(nameClasses)} part="row-name">
2801
+ <span class="row-name-text">${displayName}</span>
2343
2802
  </span>`;
2344
2803
  return T$1`
2345
2804
  <li
@@ -2349,50 +2808,76 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2349
2808
  aria-selected=${isActive ? "true" : "false"}
2350
2809
  tabindex="0"
2351
2810
  data-thread-id=${thread.id}
2352
- @click=${() => this._emit("thread-selected", { threadId: thread.id })}
2811
+ @click=${() => {
2812
+ this._openMenuId = null;
2813
+ this._emit("thread-selected", { threadId: thread.id });
2814
+ }}
2353
2815
  @keydown=${(e) => {
2354
2816
  if (e.key === "Enter" || e.key === " ") {
2355
2817
  e.preventDefault();
2818
+ this._openMenuId = null;
2356
2819
  this._emit("thread-selected", { threadId: thread.id });
2357
2820
  }
2358
2821
  }}
2359
2822
  >
2360
2823
  ${slotName !== null ? T$1`<slot name=${slotName}>${nameSpan}</slot>` : nameSpan}
2361
- ${thread.archived ? T$1`<button
2362
- class="row-action"
2363
- part="row-unarchive"
2364
- data-tooltip="Unarchive"
2365
- aria-label=${`Unarchive thread ${(_thread$name = thread.name) !== null && _thread$name !== void 0 ? _thread$name : "New thread"}`}
2366
- @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) => {
2367
2831
  e.stopPropagation();
2368
- this._emit("unarchive", { threadId: thread.id });
2832
+ this._openMenuId = menuOpen ? null : thread.id;
2369
2833
  }}
2834
+ >
2835
+ ${iconKebab}
2836
+ </button>
2837
+ ${menuOpen ? T$1`<div
2838
+ class="row-menu-popover"
2839
+ part="row-menu-popover"
2840
+ role="menu"
2370
2841
  >
2371
- ${iconUnarchive}
2372
- </button>` : T$1`<button
2373
- class="row-action"
2374
- part="row-archive"
2375
- data-tooltip="Archive"
2376
- aria-label=${`Archive thread ${(_thread$name2 = thread.name) !== null && _thread$name2 !== void 0 ? _thread$name2 : "New thread"}`}
2377
- @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) => {
2378
2860
  e.stopPropagation();
2861
+ this._openMenuId = null;
2379
2862
  this._emit("archive", { threadId: thread.id });
2380
2863
  }}
2381
- >
2382
- ${iconArchive}
2383
- </button>`}
2384
- <button
2385
- class="row-action danger"
2386
- part="row-delete"
2387
- data-tooltip="Delete"
2388
- aria-label=${`Delete thread ${(_thread$name3 = thread.name) !== null && _thread$name3 !== void 0 ? _thread$name3 : "New thread"}`}
2389
- @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) => {
2390
2873
  e.stopPropagation();
2874
+ this._openMenuId = null;
2391
2875
  this._confirmingDeleteId = thread.id;
2392
2876
  }}
2393
- >
2394
- ${iconDelete}
2395
- </button>
2877
+ >
2878
+ ${iconDelete}<span>Delete</span>
2879
+ </button>
2880
+ </div>` : A}
2396
2881
  </li>
2397
2882
  `;
2398
2883
  }
@@ -2447,41 +2932,59 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2447
2932
  </div>
2448
2933
  `;
2449
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
+ */
2450
2948
  _renderConfirmDialog() {
2451
- if (this._confirmingDeleteId === null) return A;
2452
2949
  const id = this._confirmingDeleteId;
2453
2950
  return T$1`
2454
- <div class="dialog-backdrop" part="dialog-backdrop">
2455
- <div
2456
- class="dialog"
2457
- part="confirm-dialog"
2458
- role="alertdialog"
2459
- aria-modal="true"
2460
- aria-label="Confirm delete"
2461
- data-testid="drawer-confirm-delete"
2462
- >
2463
- <p>Delete this thread? This cannot be undone.</p>
2464
- <div class="dialog-actions">
2465
- <button
2466
- class="row-action"
2467
- part="confirm-cancel"
2468
- @click=${() => this._confirmingDeleteId = null}
2469
- >
2470
- Cancel
2471
- </button>
2472
- <button
2473
- class="primary"
2474
- part="confirm-delete"
2475
- @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=${() => {
2476
2979
  this._confirmingDeleteId = null;
2477
2980
  this._emit("delete", { threadId: id });
2478
2981
  }}
2479
- >
2480
- Delete
2481
- </button>
2482
- </div>
2483
- </div>
2484
- </div>
2982
+ >
2983
+ Delete
2984
+ </button>
2985
+ </div>
2986
+ ` : A}
2987
+ </dialog>
2485
2988
  `;
2486
2989
  }
2487
2990
  };
@@ -2512,6 +3015,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2512
3015
  type: String
2513
3016
  },
2514
3017
  label: { type: String },
3018
+ recentLabel: {
3019
+ attribute: "recent-label",
3020
+ type: String
3021
+ },
3022
+ collapsible: { type: Boolean },
2515
3023
  open: {
2516
3024
  type: Boolean,
2517
3025
  reflect: true
@@ -2523,8 +3031,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2523
3031
  _filter: { state: true },
2524
3032
  _confirmingDeleteId: { state: true },
2525
3033
  _viewportIsMobile: { state: true },
3034
+ _hasHeader: { state: true },
2526
3035
  _hasMemories: { state: true },
2527
- _hasFooter: { state: true }
3036
+ _hasFooter: { state: true },
3037
+ _filterOpen: { state: true },
3038
+ _openMenuId: { state: true }
2528
3039
  };
2529
3040
 
2530
3041
  //#endregion