@copilotkit/web-components 1.62.2 → 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.
@@ -36,8 +36,12 @@ const drawerStyles = css`
36
36
  display: block;
37
37
  height: 100%;
38
38
  box-sizing: border-box;
39
- font-family:
40
- var(--cpk-drawer-font-family, ui-sans-serif, system-ui, sans-serif);
39
+ font-family: var(
40
+ --cpk-drawer-font-family,
41
+ ui-sans-serif,
42
+ system-ui,
43
+ sans-serif
44
+ );
41
45
  font-size: var(--cpk-drawer-font-size, 14px);
42
46
  line-height: var(--cpk-drawer-line-height, 1.4);
43
47
  color: var(--cpk-drawer-fg, var(--foreground, ${tok(T.fg)}));
@@ -73,9 +77,13 @@ const drawerStyles = css`
73
77
  --_danger: var(--cpk-drawer-danger, var(--destructive, ${tok(T.danger)}));
74
78
  --_border: var(--cpk-drawer-border, var(--border, ${tok(T.border)}));
75
79
  --_ring: var(--cpk-drawer-ring, var(--ring, ${tok(T.ring)}));
76
- --_radius: var(--cpk-drawer-radius, var(--radius, ${tok(T.radius)}));
80
+ --_indicator: var(--cpk-drawer-indicator, #5b94e4);
81
+ /* Cap the corner radius at 4px (per designer) — themeable but never larger. */
82
+ --_radius: min(
83
+ var(--cpk-drawer-radius, var(--radius, ${tok(T.radius)})),
84
+ 4px
85
+ );
77
86
  --_width: var(--cpk-drawer-width, 320px);
78
- --_rail-width: var(--cpk-drawer-rail-width, 56px);
79
87
  }
80
88
 
81
89
  :host([hidden]) {
@@ -95,19 +103,13 @@ const drawerStyles = css`
95
103
  border-right: 1px solid var(--_border);
96
104
  overflow: hidden;
97
105
  transition: width 0.2s ease;
98
- /* Positioning context for the confirm-delete dialog's absolutely-positioned
99
- backdrop (see .dialog-backdrop). Without this the backdrop's inset:0
100
- resolves against the initial containing block (the viewport) and its
101
- low z-index competes in the light-DOM root stacking context, so on
102
- desktop the dialog escapes the drawer column and paints UNDER the chat
103
- input (which sits in a sibling column). Anchoring here confines the
104
- modal to the drawer, where its z-index only needs to beat the rows.
105
- The mobile path already establishes its own context via position:fixed. */
106
- position: relative;
107
- }
108
-
109
- .root.collapsed {
110
- width: var(--_rail-width);
106
+ /* The confirm-delete dialog no longer needs a positioning context here: it
107
+ is a native <dialog> opened with showModal(), which renders in the
108
+ browser top layer independent of any stacking context (ENT-1051). No
109
+ other direct child of .root is absolutely positioned (the filter and
110
+ row-action popovers anchor to their own positioned ancestors), so .root
111
+ stays static. The mobile path establishes its own context via
112
+ position:fixed. */
111
113
  }
112
114
 
113
115
  /* Mobile: off-canvas overlay (modal pattern). */
@@ -125,6 +127,13 @@ const drawerStyles = css`
125
127
  transform: translateX(0);
126
128
  }
127
129
 
130
+ /* Desktop collapsed: the panel is replaced by the floating cluster, so remove
131
+ it from the layout entirely. The host reclaims the reserved column via the
132
+ --cpk-drawer-reserved-width:0px override the element sets on collapse. */
133
+ .root.collapsed {
134
+ display: none;
135
+ }
136
+
128
137
  .backdrop {
129
138
  position: fixed;
130
139
  inset: 0;
@@ -136,29 +145,50 @@ const drawerStyles = css`
136
145
  cursor: pointer;
137
146
  }
138
147
 
139
- /* Mobile-only floating affordance to OPEN the off-canvas drawer. Rendered by
140
- the element itself so phones always have a way in with no host wiring. */
141
- .launcher {
148
+ /* Floating launcher cluster (Figma "closed" mockup): a rounded surface card
149
+ holding the sidebar toggle + a "New Conversation" (+) icon button. Rendered
150
+ by the element itself in the mobile-closed AND desktop-collapsed states so
151
+ there is always a way to reopen/expand — and to start a new conversation —
152
+ with no host wiring. */
153
+ .launcher-cluster {
142
154
  position: fixed;
143
155
  z-index: 998;
144
- /* Position is themeable so a host can line the launcher up with its own
156
+ /* Position is themeable so a host can line the cluster up with its own
145
157
  header controls (e.g. vertically centering it on a toggle group). */
146
- top: var(--cpk-drawer-launcher-top, 12px);
147
- left: var(--cpk-drawer-launcher-left, 12px);
158
+ top: var(--cpk-drawer-launcher-top, 24px);
159
+ left: var(--cpk-drawer-launcher-left, 24px);
148
160
  display: inline-flex;
149
161
  align-items: center;
150
- justify-content: center;
151
- width: 40px;
152
- height: 40px;
153
- border-radius: 999px;
162
+ gap: 2px;
163
+ padding: 6px;
164
+ border-radius: var(--_radius);
154
165
  border: 1px solid var(--_border);
155
166
  background: var(--_surface);
156
167
  color: var(--_surface-fg);
157
- cursor: pointer;
158
168
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
159
169
  }
160
170
 
161
- .launcher-icon {
171
+ .launcher {
172
+ display: inline-flex;
173
+ align-items: center;
174
+ justify-content: center;
175
+ width: 32px;
176
+ height: 32px;
177
+ padding: 6px;
178
+ border: 0;
179
+ border-radius: calc(var(--_radius) - 3px);
180
+ background: transparent;
181
+ color: var(--_surface-fg);
182
+ cursor: pointer;
183
+ font: inherit;
184
+ }
185
+
186
+ .launcher:hover,
187
+ .launcher:focus-visible {
188
+ background: var(--_muted);
189
+ }
190
+
191
+ .launcher .icon {
162
192
  width: 18px;
163
193
  height: 18px;
164
194
  display: block;
@@ -167,33 +197,176 @@ const drawerStyles = css`
167
197
  .header {
168
198
  display: flex;
169
199
  align-items: center;
170
- justify-content: space-between;
171
200
  gap: 8px;
172
201
  padding: 12px;
173
- border-bottom: 1px solid var(--_border);
174
202
  }
175
203
 
176
- .filters {
177
- display: flex;
178
- gap: 4px;
179
- padding: 8px 12px;
204
+ /* The header is hidden until a consumer projects slot="header" content
205
+ (the redesign has no built-in header controls). Mirrors the memories/footer
206
+ gating so an empty padded header bar never renders above the list. */
207
+ .header[hidden] {
208
+ display: none;
180
209
  }
181
210
 
182
- .filter-btn {
211
+ /* Optional consumer projection surface. When a consumer projects into
212
+ slot="header" it fills the header row. */
213
+ .header slot[name="header"] {
214
+ display: flex;
215
+ align-items: center;
183
216
  flex: 1;
184
- padding: 6px 10px;
185
- border: 1px solid var(--_border);
217
+ min-width: 0;
218
+ }
219
+
220
+ .icon-btn {
221
+ position: relative;
222
+ display: inline-flex;
223
+ align-items: center;
224
+ justify-content: center;
225
+ width: 32px;
226
+ height: 32px;
227
+ padding: 6px;
228
+ border: 0;
186
229
  border-radius: var(--_radius);
187
- background: var(--_bg);
230
+ background: transparent;
188
231
  color: var(--_muted-fg);
189
232
  cursor: pointer;
190
233
  font: inherit;
191
234
  }
192
235
 
193
- .filter-btn[aria-pressed="true"] {
194
- background: var(--_accent);
195
- color: var(--_accent-fg);
196
- border-color: var(--_ring);
236
+ /* "Filter applied" indicator dot at the funnel's bottom-right (Figma archived
237
+ view). Shown only when a non-default filter is active. */
238
+ .filter-dot {
239
+ position: absolute;
240
+ right: 3px;
241
+ bottom: 4px;
242
+ width: 6px;
243
+ height: 6px;
244
+ border-radius: 50%;
245
+ background: var(--_indicator);
246
+ pointer-events: none;
247
+ }
248
+
249
+ .icon-btn:hover,
250
+ .icon-btn:focus-visible {
251
+ background: var(--_muted);
252
+ color: inherit;
253
+ }
254
+
255
+ .icon-btn[aria-pressed="true"] {
256
+ background: var(--_muted);
257
+ color: inherit;
258
+ }
259
+
260
+ .icon {
261
+ width: 20px;
262
+ height: 20px;
263
+ display: block;
264
+ }
265
+
266
+ .new-conversation {
267
+ display: flex;
268
+ align-items: center;
269
+ gap: 12px;
270
+ /* No top margin by default: the header bar (the collapse toggle on desktop,
271
+ the close button on mobile-open) sits above this row and supplies the top
272
+ spacing — the header-hidden case re-adds it below. Horizontal geometry
273
+ matches the list rows: the hover background insets 12px (like a row's
274
+ highlight) and, with 10px inner padding, the icon's left edge lands at
275
+ 22px — the same x as the thread names below (list padding 12 + row
276
+ padding 10). */
277
+ margin: 0 12px;
278
+ padding: 8px 10px;
279
+ border: 0;
280
+ border-radius: var(--_radius);
281
+ background: transparent;
282
+ color: inherit;
283
+ cursor: pointer;
284
+ font: inherit;
285
+ text-align: left;
286
+ }
287
+
288
+ /* Only when the header bar is fully hidden (collapsible=false AND no projected
289
+ header content) is this row the first element — give it the top spacing the
290
+ header would otherwise supply. */
291
+ .header[hidden] + .new-conversation {
292
+ margin-top: 12px;
293
+ }
294
+
295
+ .new-conversation:hover,
296
+ .new-conversation:focus-visible {
297
+ background: var(--_muted);
298
+ }
299
+
300
+ .new-conversation .icon {
301
+ width: 16px;
302
+ height: 16px;
303
+ }
304
+
305
+ .section-heading {
306
+ position: relative;
307
+ display: flex;
308
+ align-items: center;
309
+ justify-content: space-between;
310
+ /* Match the list rows' content edge: "Recent Conversations" lands at 22px
311
+ (margin 12 + padding 10), aligned with the thread names and the New
312
+ Conversation icon; the funnel sits 22px from the right, over the kebabs. */
313
+ padding: 8px 10px;
314
+ margin: 0 12px;
315
+ }
316
+
317
+ .section-title {
318
+ font-size: 11px;
319
+ font-weight: 600;
320
+ letter-spacing: 0.02em;
321
+ color: var(--_muted-fg);
322
+ text-transform: none;
323
+ }
324
+
325
+ .icon-btn.small {
326
+ width: 24px;
327
+ height: 24px;
328
+ padding: 4px;
329
+ }
330
+
331
+ .icon-btn.small .icon {
332
+ width: 16px;
333
+ height: 16px;
334
+ }
335
+
336
+ .filter-popover {
337
+ position: absolute;
338
+ right: 0;
339
+ top: calc(100% + 4px);
340
+ z-index: 15;
341
+ display: flex;
342
+ flex-direction: column;
343
+ min-width: 120px;
344
+ padding: 4px;
345
+ background: var(--_surface);
346
+ color: var(--_surface-fg);
347
+ border: 1px solid var(--_border);
348
+ border-radius: var(--_radius);
349
+ box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
350
+ }
351
+
352
+ .filter-opt {
353
+ border: 0;
354
+ background: transparent;
355
+ color: inherit;
356
+ cursor: pointer;
357
+ font: inherit;
358
+ text-align: left;
359
+ padding: 6px 8px;
360
+ border-radius: 4px;
361
+ }
362
+
363
+ .filter-opt:hover,
364
+ .filter-opt:focus-visible {
365
+ background: var(--_muted);
366
+ }
367
+
368
+ .filter-opt[aria-pressed="true"] {
369
+ font-weight: 600;
197
370
  }
198
371
 
199
372
  .list {
@@ -225,12 +398,25 @@ const drawerStyles = css`
225
398
  position: relative;
226
399
  }
227
400
 
228
- /* The entry animation leaves each row with a (non-none) transform, making it
229
- its own stacking context — which would paint the name tooltip UNDER the
230
- following rows (their text bled through the bubble). Lifting the hovered
231
- row's z-index re-floats its tooltip above the rows beneath it. */
232
- .row.name-clipped:hover {
233
- z-index: 2;
401
+ /* Lift the interacted row above later rows so its kebab popover (which paints
402
+ inside the row's own transform stacking context) is not clipped by / drawn
403
+ under the rows below it. */
404
+ .row:hover,
405
+ .row:focus-within,
406
+ .row.menu-open {
407
+ z-index: 3;
408
+ }
409
+
410
+ /* While a kebab menu is open, the popover only covers part of the rows it
411
+ overlaps, so the rest of the list would still respond to hover — revealing
412
+ other rows' kebabs and (under a host \`::part(row):hover\` theme) painting a
413
+ hover background "through"/around the open menu. Freeze pointer events on
414
+ every OTHER row so the menu reads as a single focused surface. The owner
415
+ row (\`.menu-open\`) and its popover stay interactive, and a pointerdown that
416
+ lands on a frozen row still reaches the document handler that closes the
417
+ menu, so click-away dismissal is preserved. */
418
+ .list.menu-open .row:not(.menu-open) {
419
+ pointer-events: none;
234
420
  }
235
421
 
236
422
  @keyframes cpk-drawer-row-in {
@@ -243,19 +429,19 @@ const drawerStyles = css`
243
429
  .row.active {
244
430
  background: var(--_accent);
245
431
  color: var(--_accent-fg);
246
- border-color: var(--_ring);
432
+ /* No border on the selected row — the background change alone marks it
433
+ (per designer). The base row keeps its 1px transparent border so the
434
+ layout stays stable. */
247
435
  }
248
436
 
249
437
  .row.archived .row-name {
250
438
  color: var(--_muted-fg);
439
+ font-style: italic;
251
440
  }
252
441
 
253
442
  .row-name {
254
- /* The outer name element owns NO overflow clip so it can host the name
255
- tooltip pseudo-element; the inner .row-name-text does the ellipsis. */
256
443
  flex: 1;
257
444
  min-width: 0;
258
- position: relative;
259
445
  }
260
446
 
261
447
  .row-name-text {
@@ -265,41 +451,6 @@ const drawerStyles = css`
265
451
  white-space: nowrap;
266
452
  }
267
453
 
268
- /* Name tooltip: matches the row-action tooltip (instant primary bubble with
269
- an arrow), shown ONLY when the name is clipped. Positioned below the name,
270
- wrapping within the drawer width (a long name can't fit one line). */
271
- .row-name.name-clipped[data-tooltip]:hover::after {
272
- content: attr(data-tooltip);
273
- position: absolute;
274
- left: 0;
275
- top: calc(100% + 6px);
276
- white-space: normal;
277
- max-width: 240px;
278
- background: var(--_primary);
279
- color: var(--_primary-fg);
280
- border-radius: 6px;
281
- padding: 4px 8px;
282
- font-size: 12px;
283
- line-height: 1.4;
284
- box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
285
- pointer-events: none;
286
- z-index: 20;
287
- }
288
-
289
- .row-name.name-clipped[data-tooltip]:hover::before {
290
- content: "";
291
- position: absolute;
292
- left: 10px;
293
- top: calc(100% + 1.5px);
294
- transform: rotate(45deg);
295
- width: 7px;
296
- height: 7px;
297
- background: var(--_primary);
298
- border-radius: 1px;
299
- pointer-events: none;
300
- z-index: 21;
301
- }
302
-
303
454
  .row-name.placeholder {
304
455
  color: var(--_muted-fg);
305
456
  font-style: italic;
@@ -330,78 +481,111 @@ const drawerStyles = css`
330
481
  cursor: pointer;
331
482
  font: inherit;
332
483
  padding: 5px;
333
- border-radius: 6px;
334
- }
335
-
336
- /* Instant tooltip (matches the react components' delayDuration:0) styled to
337
- match the CPK standard tooltip: a solid primary-colored bubble with
338
- primary-foreground text, rounded corners, no border, and a small arrow —
339
- NOT a surface/bordered box (which reads as a button). Rendered to the LEFT
340
- of the action so the list's vertical overflow never clips it; the native
341
- \`title\` tooltip is avoided because its show-delay is browser-fixed (~1.5s)
342
- and cannot be tuned. */
343
- .row-action[data-tooltip]:hover::after,
344
- .row-action[data-tooltip]:focus-visible::after {
345
- content: attr(data-tooltip);
484
+ border-radius: 4px;
485
+ }
486
+
487
+ .row-action:hover,
488
+ .row-action:focus-visible {
489
+ background: var(--_muted);
490
+ color: inherit;
491
+ }
492
+
493
+ .row-action-icon {
494
+ width: 15px;
495
+ height: 15px;
496
+ display: block;
497
+ }
498
+
499
+ /* Per-row kebab trigger: hidden at rest, revealed when the row is hovered,
500
+ focused (keyboard), active (selected), or its menu is open. */
501
+ .row-menu {
502
+ flex: none;
503
+ display: inline-flex;
504
+ align-items: center;
505
+ justify-content: center;
506
+ width: 24px;
507
+ height: 24px;
508
+ padding: 4px;
509
+ border: 0;
510
+ border-radius: 4px;
511
+ background: transparent;
512
+ color: var(--_muted-fg);
513
+ cursor: pointer;
514
+ font: inherit;
515
+ opacity: 0;
516
+ }
517
+
518
+ .row:hover .row-menu,
519
+ .row:focus-within .row-menu,
520
+ .row.active .row-menu,
521
+ .row-menu[aria-expanded="true"] {
522
+ opacity: 1;
523
+ }
524
+
525
+ .row-menu:hover,
526
+ .row-menu:focus-visible {
527
+ background: var(--_muted);
528
+ color: inherit;
529
+ }
530
+
531
+ .row-menu .icon {
532
+ width: 16px;
533
+ height: 16px;
534
+ }
535
+
536
+ .row-menu-popover {
346
537
  position: absolute;
347
- right: calc(100% + 8px);
348
- top: 50%;
349
- transform: translateY(-50%);
350
- white-space: nowrap;
351
- background: var(--_primary);
352
- color: var(--_primary-fg);
353
- border-radius: 6px;
354
- padding: 4px 8px;
355
- font-size: 12px;
356
- line-height: 1.4;
538
+ right: 8px;
539
+ top: calc(100% - 4px);
540
+ z-index: 16;
541
+ display: flex;
542
+ flex-direction: column;
543
+ min-width: 140px;
544
+ padding: 4px;
545
+ background: var(--_surface);
546
+ color: var(--_surface-fg);
547
+ border: 1px solid var(--_border);
548
+ border-radius: var(--_radius);
357
549
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
358
- pointer-events: none;
359
- z-index: 20;
360
550
  }
361
551
 
362
- /* Arrow: a small rotated square at the bubble's right edge, pointing at the
363
- action — same primary fill as the bubble. */
364
- .row-action[data-tooltip]:hover::before,
365
- .row-action[data-tooltip]:focus-visible::before {
366
- content: "";
367
- position: absolute;
368
- right: calc(100% + 4.5px);
369
- top: 50%;
370
- transform: translateY(-50%) rotate(45deg);
371
- width: 7px;
372
- height: 7px;
373
- background: var(--_primary);
374
- border-radius: 1px;
375
- pointer-events: none;
376
- z-index: 21;
552
+ /* Rows in the lower portion of the list open their kebab menu UPWARD so it is
553
+ not clipped by the list's overflow scroll box (.list is overflow-y:auto,
554
+ which also clips the x-axis). Anchoring to the button's top edge via
555
+ \`bottom\` keeps the popover inside the list's visible area for bottom rows. */
556
+ .row.menu-up .row-menu-popover {
557
+ top: auto;
558
+ bottom: calc(100% - 4px);
377
559
  }
378
560
 
379
- /* While the delete-confirmation dialog is open, suppress row-action tooltips:
380
- the clicked trash button keeps :focus-visible (and may stay hovered), which
381
- would otherwise leave its "Delete" tooltip floating over the dialog. */
382
- .root.confirming .row-action[data-tooltip]:hover::after,
383
- .root.confirming .row-action[data-tooltip]:focus-visible::after,
384
- .root.confirming .row-action[data-tooltip]:hover::before,
385
- .root.confirming .row-action[data-tooltip]:focus-visible::before {
386
- content: none;
387
- display: none;
561
+ .row-menu-item {
562
+ display: flex;
563
+ align-items: center;
564
+ gap: 8px;
565
+ border: 0;
566
+ background: transparent;
567
+ color: inherit;
568
+ cursor: pointer;
569
+ font: inherit;
570
+ text-align: left;
571
+ padding: 6px 8px;
572
+ border-radius: 4px;
388
573
  }
389
574
 
390
- .row-action:hover,
391
- .row-action:focus-visible {
575
+ .row-menu-item:hover,
576
+ .row-menu-item:focus-visible {
392
577
  background: var(--_muted);
393
- color: inherit;
394
578
  }
395
579
 
396
- .row-action.danger:hover,
397
- .row-action.danger:focus-visible {
580
+ .row-menu-item.danger:hover,
581
+ .row-menu-item.danger:focus-visible {
398
582
  color: var(--_danger);
399
583
  }
400
584
 
401
- .row-action-icon {
585
+ .row-menu-item .row-action-icon,
586
+ .row-menu-item .icon {
402
587
  width: 15px;
403
588
  height: 15px;
404
- display: block;
405
589
  }
406
590
 
407
591
  button.primary {
@@ -466,27 +650,44 @@ const drawerStyles = css`
466
650
  display: none;
467
651
  }
468
652
 
469
- .dialog-backdrop {
470
- position: absolute;
471
- inset: 0;
472
- background: rgba(0, 0, 0, 0.3);
473
- display: flex;
474
- align-items: center;
475
- justify-content: center;
476
- z-index: 10;
477
- }
478
-
653
+ /* Confirm-delete dialog — a native <dialog> opened with showModal(). It lives
654
+ in the browser TOP LAYER, so it can never be painted under other UI (the
655
+ old CSS-positioned overlay was trapped in the drawer host's stacking
656
+ context and appeared under the chat's welcome view — ENT-1051). The UA
657
+ centers it in the viewport via margin:auto; we reset the UA chrome and
658
+ apply the drawer's surface-card look. */
479
659
  .dialog {
660
+ /* Top-layer (showModal) so it is never clipped, but centered over the DRAWER
661
+ PANEL rather than the viewport: JS sets --confirm-cx/cy from the visible
662
+ .root rect (falls back to viewport-center when unmeasured, e.g. jsdom).
663
+ Width is capped to the drawer band so it reads as "inside the drawer". */
664
+ margin: 0;
665
+ position: fixed;
666
+ left: var(--confirm-cx, 50%);
667
+ top: var(--confirm-cy, 50%);
668
+ transform: translate(-50%, -50%);
669
+ border: 0;
670
+ padding: 16px;
671
+ width: max-content;
672
+ max-width: min(80vw, calc(var(--_width) - 24px));
480
673
  background: var(--_surface);
481
674
  color: var(--_surface-fg);
482
675
  border-radius: var(--_radius);
483
- padding: 16px;
484
- max-width: 80%;
676
+ }
677
+
678
+ /* Only lay out the card contents when open. A closed <dialog> is display:none
679
+ via the UA stylesheet, and author display rules must not override that (or
680
+ an empty box would leak), so the flex layout is scoped to [open]. */
681
+ .dialog[open] {
485
682
  display: flex;
486
683
  flex-direction: column;
487
684
  gap: 12px;
488
685
  }
489
686
 
687
+ .dialog::backdrop {
688
+ background: rgba(0, 0, 0, 0.3);
689
+ }
690
+
490
691
  .dialog-actions {
491
692
  display: flex;
492
693
  justify-content: flex-end;