feat(t5): Auswahlgruppe mit Haken, Karten-Variante, Plus/Minus (T5a A6)

- ChoiceGroup nach Spec 10.2: gewählt mit Haken und 2-px-Tintenrahmen,
  „Nicht geprüft“ gestrichelt; neue Variante appearance="cards" mit Icon
  und Beschreibung (Winter-Ergebnis, Darstellung, Behördenmeldung).
- Eigenbau-Radios in Behördenmeldung, Phänologie-Bericht und
  Zeilen-Ausrichtung durch ChoiceGroup ersetzt.
- Button pressed → aria-pressed (Fett/Kursiv, „Aufbau als Liste“);
  Druck-Versatz nur mit motion-full.
- NumberStepper (ganze Schritte) für Winter-Waben, Milbenzahl (neu und
  bearbeiten), Weiselzellen, Entnahme/Zählbestand, Startposition; Entnahme
  nur 1 bis Restmenge, Startposition höchstens 1000.
- Baukasten-Wächter: Radios nur in ChoiceGroup, aria-pressed nur in
  Button und Kalender, auch in Objektform und .ts-Dateien.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick.RosenloecherandClaude Opus 5.5 committed 2026-10-16 18:44:31 +02:00
1 parent 6ac9eef93b
commit 208e9baaf0
30 files changed
+809 -198

No files matched your search

+12 -2
View File
@@ -9,7 +9,7 @@ const HIT_AREA =
"relative pointer-coarse:after:absolute pointer-coarse:after:top-1/2 pointer-coarse:after:left-1/2 pointer-coarse:after:size-11 pointer-coarse:after:-translate-1/2"
const buttonVariants = cva(
"group/button inline-flex shrink-0 items-center justify-center rounded-xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all select-none active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-inset aria-invalid:ring-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
"group/button inline-flex shrink-0 items-center justify-center rounded-xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all select-none motion-full:active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-1 aria-invalid:ring-inset aria-invalid:ring-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
{
variants: {
variant: {
@@ -49,15 +49,25 @@ const buttonVariants = cva(
}
)
interface ButtonProps extends ButtonPrimitive.Props, VariantProps<typeof buttonVariants> {
/**
* A toolbar toggle (bold, italic, a list view): sets aria-pressed. Not for a choice between
* options - that is a ChoiceGroup (spec 10.2).
*/
pressed?: boolean
}
function Button({
className,
variant = "default",
size = "default",
pressed,
...props
}: ButtonPrimitive.Props & VariantProps<typeof buttonVariants>) {
}: ButtonProps) {
return (
<ButtonPrimitive
data-slot="button"
aria-pressed={pressed}
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
@@ -78,4 +78,26 @@ describe("ui sizes, type and focus (spec 4.5, 4.6)", () => {
expect(has(classes, "aria-invalid:ring-destructive")).toBe(true);
expect(classes).not.toMatch(/ring-destructive\/20/);
});
it("Button pressed sets aria-pressed", () => {
const { rerender } = render(
<Button pressed aria-label="Fett">
B
</Button>,
);
expect(screen.getByRole("button", { name: "Fett" })).toHaveAttribute("aria-pressed", "true");
rerender(
<Button pressed={false} aria-label="Fett">
B
</Button>,
);
expect(screen.getByRole("button", { name: "Fett" })).toHaveAttribute("aria-pressed", "false");
rerender(<Button aria-label="Fett">B</Button>);
expect(screen.getByRole("button", { name: "Fett" })).not.toHaveAttribute("aria-pressed");
});
it("the press nudge of a button only moves with the motion level full", () => {
render(<Button>Los</Button>);
const classes = screen.getByRole("button", { name: "Los" }).className;
expect(has(classes, "motion-full:active:not-aria-[haspopup]:translate-y-px")).toBe(true);
expect(classes).not.toMatch(/(^|\s)active:not-aria-\[haspopup\]:translate-y-px/);
});
});