Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/frontend/packages/shared/src/dropdown/Dropdown.css
iris 9fdde2ec63 swarm-ui: menus, popovers, toasts and dialogs fade in, with one motion guard
Dialogs, toasts, popovers, dropdowns and the filter popover appeared with no
transition, and the header menu had a keyframe of its own. theme.css holds
--enter and --fade, off under reduced motion and the motion setting's reduce,
and each floating box uses them.
2026-11-28 09:46:32 +01:00

81 lines
2.7 KiB
CSS

/* <Dropdown> — anchored option list. `position: absolute` against the
caller's `position: relative` wrapper (see Dropdown.tsx's file-top
comment) so it hangs directly under the badge that opened it.
`--bg-elev` is the same elevated-surface slot the badge uses when
open (../badge/Badge.css), so the pair reads as one continuous panel. */
/* Reusable wrapper for the "badge that opens a `Dropdown` right
underneath itself" shape: `position: relative` is what lets
`.ui-dropdown`'s `position: absolute` above anchor to this box
instead of the page. A couple of callers predate this and declare
their own page-scoped copy of the same two rules (agent's
`StatusChips.css` `.status-chip-anchor`, swarm-ui's
`ComponentsPage.css` `.components-badge-anchor`) — left alone here
rather than migrated as a drive-by, but a *new* caller should reach
for this instead of reinventing a third one. */
.ui-dropdown-anchor {
position: relative;
display: inline-block;
}
.ui-dropdown {
animation: var(--enter);
position: absolute;
top: calc(100% + 0.25em);
left: 0;
z-index: var(--z-popover);
display: flex;
flex-direction: column;
min-width: 12em;
padding: 0.25em;
background: var(--bg-elev);
border: 1px solid var(--border);
border-radius: var(--radius-md);
box-shadow: var(--shadow-pop);
}
.ui-dropdown-end {
right: 0;
left: auto;
}
.ui-dropdown-item {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.1em;
min-height: 2.75em;
padding: 0.4em 0.7em;
border: none;
border-radius: var(--radius-sm);
background: transparent;
color: var(--fg);
font: inherit;
text-align: left;
cursor: pointer;
}
.ui-dropdown-item:hover {
background: var(--border);
}
.ui-dropdown-item-active {
background: var(--purple-dim);
}
.ui-dropdown-item-active .ui-dropdown-item-label::before {
content: "✓ ";
color: var(--purple);
}
/* Destructive action row (cancel turn) — ported from the old standalone
`.btn-cancel-turn`'s red-on-transparent look now that it lives here
instead of its own button (mara: "if the cancel turn button moves
into the dropdown, it should be fine"). */
.ui-dropdown-item-danger {
color: var(--red);
}
.ui-dropdown-item-danger:hover {
background: color-mix(in srgb, var(--red) 12%, transparent);
}
.ui-dropdown-item-desc {
font-size: 0.8em;
/* `--muted-on-dim`, not bare `--muted`: an *active* item's row bg is
`--purple-dim` (above), the same low-contrast-on-elevated-fill case
Badge.css hit — see theme.css's `--muted-on-dim` comment. Inactive
rows are transparent (falls through to `--bg-elev`), where the two
vars read close enough that this doesn't cost anything there. */
color: var(--muted-on-dim);
}