@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.
@@ -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,10 +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
- }
99
-
100
- .root.collapsed {
101
- 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. */
102
113
  }
103
114
 
104
115
  /* Mobile: off-canvas overlay (modal pattern). */
@@ -116,6 +127,13 @@ const drawerStyles = css`
116
127
  transform: translateX(0);
117
128
  }
118
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
+
119
137
  .backdrop {
120
138
  position: fixed;
121
139
  inset: 0;
@@ -127,29 +145,50 @@ const drawerStyles = css`
127
145
  cursor: pointer;
128
146
  }
129
147
 
130
- /* Mobile-only floating affordance to OPEN the off-canvas drawer. Rendered by
131
- the element itself so phones always have a way in with no host wiring. */
132
- .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 {
133
154
  position: fixed;
134
155
  z-index: 998;
135
- /* 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
136
157
  header controls (e.g. vertically centering it on a toggle group). */
137
- top: var(--cpk-drawer-launcher-top, 12px);
138
- left: var(--cpk-drawer-launcher-left, 12px);
158
+ top: var(--cpk-drawer-launcher-top, 24px);
159
+ left: var(--cpk-drawer-launcher-left, 24px);
139
160
  display: inline-flex;
140
161
  align-items: center;
141
- justify-content: center;
142
- width: 40px;
143
- height: 40px;
144
- border-radius: 999px;
162
+ gap: 2px;
163
+ padding: 6px;
164
+ border-radius: var(--_radius);
145
165
  border: 1px solid var(--_border);
146
166
  background: var(--_surface);
147
167
  color: var(--_surface-fg);
148
- cursor: pointer;
149
168
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.12);
150
169
  }
151
170
 
152
- .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 {
153
192
  width: 18px;
154
193
  height: 18px;
155
194
  display: block;
@@ -158,33 +197,176 @@ const drawerStyles = css`
158
197
  .header {
159
198
  display: flex;
160
199
  align-items: center;
161
- justify-content: space-between;
162
200
  gap: 8px;
163
201
  padding: 12px;
164
- border-bottom: 1px solid var(--_border);
165
202
  }
166
203
 
167
- .filters {
168
- display: flex;
169
- gap: 4px;
170
- 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;
171
209
  }
172
210
 
173
- .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;
174
216
  flex: 1;
175
- padding: 6px 10px;
176
- 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;
177
229
  border-radius: var(--_radius);
178
- background: var(--_bg);
230
+ background: transparent;
179
231
  color: var(--_muted-fg);
180
232
  cursor: pointer;
181
233
  font: inherit;
182
234
  }
183
235
 
184
- .filter-btn[aria-pressed="true"] {
185
- background: var(--_accent);
186
- color: var(--_accent-fg);
187
- 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;
188
370
  }
189
371
 
190
372
  .list {
@@ -216,12 +398,25 @@ const drawerStyles = css`
216
398
  position: relative;
217
399
  }
218
400
 
219
- /* The entry animation leaves each row with a (non-none) transform, making it
220
- its own stacking context — which would paint the name tooltip UNDER the
221
- following rows (their text bled through the bubble). Lifting the hovered
222
- row's z-index re-floats its tooltip above the rows beneath it. */
223
- .row.name-clipped:hover {
224
- 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;
225
420
  }
226
421
 
227
422
  @keyframes cpk-drawer-row-in {
@@ -234,19 +429,19 @@ const drawerStyles = css`
234
429
  .row.active {
235
430
  background: var(--_accent);
236
431
  color: var(--_accent-fg);
237
- 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. */
238
435
  }
239
436
 
240
437
  .row.archived .row-name {
241
438
  color: var(--_muted-fg);
439
+ font-style: italic;
242
440
  }
243
441
 
244
442
  .row-name {
245
- /* The outer name element owns NO overflow clip so it can host the name
246
- tooltip pseudo-element; the inner .row-name-text does the ellipsis. */
247
443
  flex: 1;
248
444
  min-width: 0;
249
- position: relative;
250
445
  }
251
446
 
252
447
  .row-name-text {
@@ -256,41 +451,6 @@ const drawerStyles = css`
256
451
  white-space: nowrap;
257
452
  }
258
453
 
259
- /* Name tooltip: matches the row-action tooltip (instant primary bubble with
260
- an arrow), shown ONLY when the name is clipped. Positioned below the name,
261
- wrapping within the drawer width (a long name can't fit one line). */
262
- .row-name.name-clipped[data-tooltip]:hover::after {
263
- content: attr(data-tooltip);
264
- position: absolute;
265
- left: 0;
266
- top: calc(100% + 6px);
267
- white-space: normal;
268
- max-width: 240px;
269
- background: var(--_primary);
270
- color: var(--_primary-fg);
271
- border-radius: 6px;
272
- padding: 4px 8px;
273
- font-size: 12px;
274
- line-height: 1.4;
275
- box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
276
- pointer-events: none;
277
- z-index: 20;
278
- }
279
-
280
- .row-name.name-clipped[data-tooltip]:hover::before {
281
- content: "";
282
- position: absolute;
283
- left: 10px;
284
- top: calc(100% + 1.5px);
285
- transform: rotate(45deg);
286
- width: 7px;
287
- height: 7px;
288
- background: var(--_primary);
289
- border-radius: 1px;
290
- pointer-events: none;
291
- z-index: 21;
292
- }
293
-
294
454
  .row-name.placeholder {
295
455
  color: var(--_muted-fg);
296
456
  font-style: italic;
@@ -321,78 +481,111 @@ const drawerStyles = css`
321
481
  cursor: pointer;
322
482
  font: inherit;
323
483
  padding: 5px;
324
- border-radius: 6px;
325
- }
326
-
327
- /* Instant tooltip (matches the react components' delayDuration:0) styled to
328
- match the CPK standard tooltip: a solid primary-colored bubble with
329
- primary-foreground text, rounded corners, no border, and a small arrow —
330
- NOT a surface/bordered box (which reads as a button). Rendered to the LEFT
331
- of the action so the list's vertical overflow never clips it; the native
332
- \`title\` tooltip is avoided because its show-delay is browser-fixed (~1.5s)
333
- and cannot be tuned. */
334
- .row-action[data-tooltip]:hover::after,
335
- .row-action[data-tooltip]:focus-visible::after {
336
- 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 {
337
537
  position: absolute;
338
- right: calc(100% + 8px);
339
- top: 50%;
340
- transform: translateY(-50%);
341
- white-space: nowrap;
342
- background: var(--_primary);
343
- color: var(--_primary-fg);
344
- border-radius: 6px;
345
- padding: 4px 8px;
346
- font-size: 12px;
347
- 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);
348
549
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.18);
349
- pointer-events: none;
350
- z-index: 20;
351
550
  }
352
551
 
353
- /* Arrow: a small rotated square at the bubble's right edge, pointing at the
354
- action — same primary fill as the bubble. */
355
- .row-action[data-tooltip]:hover::before,
356
- .row-action[data-tooltip]:focus-visible::before {
357
- content: "";
358
- position: absolute;
359
- right: calc(100% + 4.5px);
360
- top: 50%;
361
- transform: translateY(-50%) rotate(45deg);
362
- width: 7px;
363
- height: 7px;
364
- background: var(--_primary);
365
- border-radius: 1px;
366
- pointer-events: none;
367
- 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);
368
559
  }
369
560
 
370
- /* While the delete-confirmation dialog is open, suppress row-action tooltips:
371
- the clicked trash button keeps :focus-visible (and may stay hovered), which
372
- would otherwise leave its "Delete" tooltip floating over the dialog. */
373
- .root.confirming .row-action[data-tooltip]:hover::after,
374
- .root.confirming .row-action[data-tooltip]:focus-visible::after,
375
- .root.confirming .row-action[data-tooltip]:hover::before,
376
- .root.confirming .row-action[data-tooltip]:focus-visible::before {
377
- content: none;
378
- 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;
379
573
  }
380
574
 
381
- .row-action:hover,
382
- .row-action:focus-visible {
575
+ .row-menu-item:hover,
576
+ .row-menu-item:focus-visible {
383
577
  background: var(--_muted);
384
- color: inherit;
385
578
  }
386
579
 
387
- .row-action.danger:hover,
388
- .row-action.danger:focus-visible {
580
+ .row-menu-item.danger:hover,
581
+ .row-menu-item.danger:focus-visible {
389
582
  color: var(--_danger);
390
583
  }
391
584
 
392
- .row-action-icon {
585
+ .row-menu-item .row-action-icon,
586
+ .row-menu-item .icon {
393
587
  width: 15px;
394
588
  height: 15px;
395
- display: block;
396
589
  }
397
590
 
398
591
  button.primary {
@@ -457,27 +650,44 @@ const drawerStyles = css`
457
650
  display: none;
458
651
  }
459
652
 
460
- .dialog-backdrop {
461
- position: absolute;
462
- inset: 0;
463
- background: rgba(0, 0, 0, 0.3);
464
- display: flex;
465
- align-items: center;
466
- justify-content: center;
467
- z-index: 10;
468
- }
469
-
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. */
470
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));
471
673
  background: var(--_surface);
472
674
  color: var(--_surface-fg);
473
675
  border-radius: var(--_radius);
474
- padding: 16px;
475
- 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] {
476
682
  display: flex;
477
683
  flex-direction: column;
478
684
  gap: 12px;
479
685
  }
480
686
 
687
+ .dialog::backdrop {
688
+ background: rgba(0, 0, 0, 0.3);
689
+ }
690
+
481
691
  .dialog-actions {
482
692
  display: flex;
483
693
  justify-content: flex-end;