mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 21:10:59 +00:00
Bundle of small reconcile fixes from the W10 QA round: - Switch tap-target padding -12 px -> -13 px closes the 1.6 px vertical short-fall to spec-strict WCAG 2.5.5 (design M1). - animate-pulse skeleton sites in daily-briefing, trend-annotation and doctor-report dialog now carry motion-reduce:animate-none (design M2). - Doctor-report unavailable rows render with text-muted-foreground instead of line-through so the visual reads as 'unavailable' rather than 'deleted'; the italic hint line below still carries the semantic (design M4). - WelcomeCarousel scrollIntoView now reads scrollBehaviorForUser from src/lib/motion so all four advertised call-sites share the helper (simplifier L-1). - Coach replay-injection audit row renamed audit.coach.replay-injection -> insights.coach.replay_injection to match the <surface>.<verb> convention across the audit ledger (simplifier L-2). - /api/integrations/withings/resume drops the unused request param (the handler reads neither body nor headers; requireAuth scopes the call) (simplifier M-4). - verifyRegistration body gets the same Zod boundary narrow W13 L-3 added to verifyAuthentication; SimpleWebAuthn still owns cryptographic validation (senior-dev L-1).
44 lines
2.0 KiB
TypeScript
44 lines
2.0 KiB
TypeScript
"use client";
|
||
|
||
import * as React from "react";
|
||
import { Switch as SwitchPrimitive } from "radix-ui";
|
||
|
||
import { cn } from "@/lib/utils";
|
||
|
||
function Switch({
|
||
className,
|
||
size = "default",
|
||
...props
|
||
}: React.ComponentProps<typeof SwitchPrimitive.Root> & {
|
||
size?: "sm" | "default";
|
||
}) {
|
||
return (
|
||
<SwitchPrimitive.Root
|
||
data-slot="switch"
|
||
data-size={size}
|
||
className={cn(
|
||
// v1.4.43 W5-H1 — extend the WCAG 2.5.5 hit target to 44×44 px via
|
||
// a `::before` pseudo-element while leaving the visual track at
|
||
// 18×32 px. The same trick is used on Input (v1.4.34 IW-G). The
|
||
// wrapping `relative` and `before:absolute … before:inset-[-13px]`
|
||
// pair guarantees pointer events bubble up from the larger zone
|
||
// without disturbing layout. v1.4.43 W10 design-M1 — `-13px` (not
|
||
// `-12px`) takes the 18.4 px track + 26 px padding to 44.4 px and
|
||
// closes the 1.6 px vertical short fall to spec-strict 2.5.5.
|
||
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none before:absolute before:inset-[-13px] before:content-[''] focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6",
|
||
className,
|
||
)}
|
||
{...props}
|
||
>
|
||
<SwitchPrimitive.Thumb
|
||
data-slot="switch-thumb"
|
||
className={cn(
|
||
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0",
|
||
)}
|
||
/>
|
||
</SwitchPrimitive.Root>
|
||
);
|
||
}
|
||
|
||
export { Switch };
|