Files
deepseek-harness/packages/client/ui-primitives/src/Switch.module.css
T
Yichen Jiang 452b2a816a refactor(client): share the capsule tag, switch, and idle state dot
Client feature plugins never import one another's components, so
ui-primitives is their only channel for sharing one. Nothing told an
author to look there first, and the package offered nothing to look
at: its README named six source files against forty-plus exports.

Add Tag (read-only capsule badge, eight tones) and Switch (36x20
toggle with a required accessible name), extend StateDotState with
idle for a tracked subject with no activity, and move ui-agent-preset,
ui-settings-plugins, and ui-settings-plugin-inventory onto them.

The plugin inventory's conditional tag referenced
--dsw-alias-state-warning-primary, which does not exist, so both
themes had been painting its hardcoded #b45309 fallback.

State the reuse rule as the first step of the new-component checklist,
and give the README a component catalog so the rule has something to
check. The rule is guidance, not a gate: a package may still write its
own control, and the Agent Note records the five that stay local.
2026-09-05 14:32:59 +08:00

43 lines
895 B
CSS

/* The on/off appearance keys off aria-checked rather than a parallel class, so
* the visual state cannot disagree with the state assistive technology reads. */
.switch {
box-sizing: border-box;
position: relative;
flex: 0 0 auto;
width: 36px;
height: 20px;
padding: 2px;
border: 0;
border-radius: 10px;
background: var(--dsw-alias-border-l3);
cursor: pointer;
}
.switch[aria-checked='true'] {
background: var(--dsw-alias-brand-primary);
}
.switch:disabled {
cursor: default;
opacity: 0.5;
}
.switch:focus-visible {
outline: 2px solid var(--dsw-alias-brand-primary);
outline-offset: 2px;
}
.thumb {
display: block;
width: 16px;
height: 16px;
border-radius: 50%;
corner-shape: round;
background: var(--dsw-alias-label-primary-foreground);
transition: transform 120ms ease;
}
.switch[aria-checked='true'] .thumb {
transform: translateX(16px);
}