Files
deepseek-harness/packages/client/ui-primitives/src/Menu.module.css
T

286 lines
6.4 KiB
CSS

.root {
position: relative;
display: inline-flex;
}
/* Compact translucent dropdown card shared by feature menus. */
.list,
.submenu {
/* min-widths below are the design's outer card widths — include the pad. */
box-sizing: border-box;
padding: 4px;
display: flex;
flex-direction: column;
gap: 0;
border: 0;
--dsw-elevation-stroke-color: var(--dsw-alias-border-l1);
box-shadow: var(--dsw-elevation-prominent);
/* Elevated surface: the scrollbar thumb takes the l2 elevation tokens. The
declaration sits on the card rather than on `.scrollable .viewport`
because the elevation is a property of this surface, and the custom
properties inherit down to whichever descendant actually scrolls (see
ui-theme styles/scrollbar.css for the rebinding contract). */
--dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2);
--dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2);
}
/* Primary cards grow with their content between compact and readable bounds. */
.list {
position: absolute;
top: calc(100% + 4px);
left: 0;
z-index: 100;
min-width: 144px;
max-width: 360px;
}
/* Portal mode: fixed in the viewport, coordinates supplied inline from the
* anchor rect (side/align resolved in JS, the in-place offset rules above
* don't apply). Portaled lists must layer above modal overlays (z 1000) —
* an anchor inside a dialog still expects its menu on top. */
.portal {
position: fixed;
top: auto;
left: auto;
z-index: 1100;
}
/* Open above the anchor (empty-state workspace chip: figma 122:9481). */
.sideTop {
top: auto;
bottom: calc(100% + 4px);
}
.alignEnd {
left: auto;
right: 0;
}
/* Viewport fit: the card stops 12px short of the viewport's top/bottom edges
* (the portal MARGIN in Menu.tsx; the top side widens to the frame's published
* top clearance, the macOS window strip) and taller content scrolls inside
* .viewport, so a pinned .footer stays visible. Menus with submenu rows skip
* this class — the overflow clip would crop the side card, so they rely on
* staying short. */
.scrollable {
max-height: calc(100vh - 12px - max(12px, var(--dsh-frame-top-clearance, 12px)));
}
.viewport {
display: flex;
flex-direction: column;
min-height: 0;
}
.scrollable .viewport {
overflow-y: auto;
}
/* Pinned rows below the scroll region; l2 hairline (l1 is near-invisible on
* the menu surface) mirrors the .separator spacing. */
.footer {
flex: none;
display: flex;
flex-direction: column;
margin-top: 3px;
padding-top: 3px;
border-top: 0.5px solid var(--dsw-alias-border-l2);
}
.itemWrap {
position: relative;
}
/* Menu cell: compact text, icon, and selection spacing. */
.item {
display: flex;
align-items: center;
gap: 6px;
width: 100%;
min-height: 34px;
padding: 6px 8px;
border: none;
border-radius: var(--dsw-radius-md);
background: transparent;
cursor: pointer;
font-size: 13px;
line-height: 20px;
color: var(--dsw-alias-label-primary);
text-align: left;
}
.item:hover:not(:disabled) {
background: var(--dsw-alias-interactive-bg-hover);
}
/* Arrow navigation moves real focus, so the row the keyboard is on carries the
same fill the pointer gets: the fill is the row's focus indication, and the
browser's default ring would double it. */
.item:focus-visible:not(:disabled) {
background: var(--dsw-alias-interactive-bg-hover);
outline: none;
}
.denseList .item {
min-height: 30px;
padding-block: 4px;
}
.denseList .label {
padding-block: 3px;
}
.list.compactList,
.submenu.compactList {
min-width: 156px;
padding: 4px;
}
.compactList .item {
min-height: 24px;
gap: 5px;
padding: 2px 6px;
border-radius: var(--dsw-radius-sm);
font-size: 11px;
line-height: 17px;
}
.compactList .itemIcon {
width: 12px;
height: 12px;
}
.compactList .separator {
margin: 2px;
}
.compactList .label {
padding: 3px 6px;
font-size: 10px;
line-height: 15px;
}
.item:disabled {
opacity: 0.4;
cursor: not-allowed;
}
.itemIcon {
display: inline-flex;
flex: none;
width: 14px;
height: 14px;
align-items: center;
justify-content: center;
color: var(--dsw-alias-menu-icon);
}
.itemIcon svg,
.check {
width: 14px;
height: 14px;
}
.compactList .itemIcon svg,
.compactList .check {
width: 12px;
height: 12px;
}
.itemLabel {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.shortcut {
flex: none;
margin-inline-start: auto;
}
.shortcut .shortcutKeys {
color: var(--dsw-alias-label-caption);
font-size: 11px;
line-height: 16px;
}
.check {
flex: none;
color: var(--dsw-alias-label-primary);
}
/* Selected cell keeps the plain fill (marker is the trailing check); the
* class remains as a hook for owner-side emphasis. */
.selected {
background: transparent;
}
/* Fill-mode selection: the row holds the hover fill instead of a check. */
.selectedFill {
background: var(--dsw-alias-interactive-bg-hover);
}
/* Destructive row: error text/icon, danger hover fill. */
.danger {
color: var(--dsw-alias-state-error-primary);
}
.danger .itemIcon {
color: var(--dsw-alias-state-error-primary);
}
.danger:hover:not(:disabled) {
background: var(--dsw-alias-interactive-bg-hover-danger);
}
.danger:focus-visible:not(:disabled) {
background: var(--dsw-alias-interactive-bg-hover-danger);
outline: none;
}
/* Heading row: non-interactive small grey text, padding aligned with items. */
.label {
padding: 6px 8px;
font-size: 11px;
line-height: 15px;
color: var(--dsw-alias-label-tertiary);
}
/* Separator cell (figma 122:9481): py 4 / px 2 around the hairline. l2, not
* l1, for the same reason as .footer: l1 is near-invisible on this surface. */
.separator {
height: 0.5px;
margin: 3px 2px;
background: var(--dsw-alias-border-l2);
}
/* A data separator directly followed by a row that starts a group draws one
* line, not two; a group start on the list's first row draws none. */
.separator + .separator,
.separator + .itemWrap > .separator:first-child,
.itemWrap:first-child > .separator:first-child {
display: none;
}
/* The submenu aligns with the parent's bottom edge. Its hit bridge covers
* the menu inset and the 6px gap so pointer movement keeps it open. */
.submenu {
position: absolute;
top: auto;
bottom: -4px;
left: calc(100% + 10px);
z-index: 101;
min-width: 163px;
}
.submenu::before {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: -10px;
width: 10px;
}