Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/frontend/packages/shared/src/badge/Badge.css
iris e1aae29068 badge: add a quiet variant for icon-only header triggers
Badge's default look is a filled pill, right for status/picker chips
but wrong for an icon-only header button like the settings gear or
agent links trigger, which should read as chrome. Add variant='quiet'
(same naming/shape as Button's ButtonVariant) that drops the idle
background, keeping the existing hover/expanded feedback.

Apply it to the two icon-only Badge triggers: shared SettingsMenu
(used by both swarm-ui and the agent page) and the agent page's own
MetaNav links trigger. Add a components-page showcase sample so the
variant has a visible regression check going forward.
2026-08-29 20:28:19 +02:00

78 lines
2.8 KiB
CSS

/* <Badge> — pill-shaped status/control chip. Same touch-target floor as
the rest of the shared control set (2.75em ≈ 44px, WCAG 2.5.5) when
interactive; a plain display badge (no `onClick`) stays compact since
it's not a tap target at all. Colours are the shared base16-derived
vars (../theme.css) — `--bg-elev` is the same slot dropdowns/popovers
use, so an open Badge and the Dropdown it triggers read as one surface. */
.ui-badge {
display: inline-flex;
align-items: center;
gap: 0.35em;
padding: 0.15em 0.6em;
border-radius: 1em;
font: inherit;
font-size: 0.85em;
line-height: 1.4;
background: var(--purple-dim);
color: var(--fg);
border: none;
white-space: nowrap;
}
.ui-badge-interactive {
cursor: pointer;
min-height: 2.75em;
padding-inline: 0.8em;
}
.ui-badge-interactive:hover {
background: var(--border);
}
.ui-badge-interactive:disabled {
opacity: 0.6;
cursor: default;
}
/* `variant="quiet"` — icon-only header triggers (settings/links), not
status chips: no permanent fill, so it reads as chrome next to the
rest of the header rather than another data pill. The `:hover` and
`[aria-expanded='true']` rules above still apply — quiet only drops
the idle background, which is what mara's report was actually about. */
.ui-badge-quiet {
background: none;
}
.ui-badge-interactive[aria-expanded='true'] {
background: var(--bg-elev);
outline: 1px solid var(--purple);
}
.ui-badge-label {
color: var(--muted-on-dim); /* --muted alone is too low-contrast on this fill, see theme.css */
}
.ui-badge-value {
color: var(--fg);
}
.ui-badge-caret {
font-size: 0.75em;
color: var(--muted-on-dim);
}
/* Blended with `--fg`, not the raw accent — a stylix-fed scheme can pick
any hue/lightness for `--green`/`--amber`/etc., and nothing guarantees
an arbitrary accent clears 4.5:1 against `--purple-dim` the way the two
bundled palettes were hand-tuned to (see colors.css's comment above
`--latte-base08..0F`). `--fg` is the one color the base16 contract
already guarantees is legible on every surface in the theme, so mixing
toward it gives every accent a contrast floor without trying to
compute/fix an operator's own theme (mara, on the low-contrast-badges
report: "we cant fix a broken theme ... we need to follow base16
conventions or css mix new colors" — this is that; stock mocha/latte
keep their existing look, since both accents already sit close to
`--fg` in contrast terms). */
.ui-badge-positive .ui-badge-value {
color: color-mix(in srgb, var(--green) 60%, var(--fg));
}
.ui-badge-warning .ui-badge-value {
color: color-mix(in srgb, var(--amber) 60%, var(--fg));
}
.ui-badge-negative .ui-badge-value {
color: color-mix(in srgb, var(--red) 60%, var(--fg));
}
.ui-badge-accent .ui-badge-value {
color: color-mix(in srgb, var(--purple) 60%, var(--fg));
}