Source snapshot bcc79fcc · Declared package version 7.0.4. This page combines the checked-in package guide and manifest; commands and runtime behavior were not executed in this review.
roleVariants is optional. Each role entry may override variants for the whole surface (surface) and per component key (components).
Hook
tsx
import { usePersonalizedVariants } from "@lssm-tech/lib.personalized-presentation";
import { NavRail, type NavRailProps } from "@lssm-tech/lib.cockpit-kit-web/ui/NavRail";
function PersonalizedNavRail(props: NavRailProps) {
const variants = usePersonalizedVariants("NavRail"); // { density, expansion }
return <NavRail {...props} {...variants} />;
}
Resolution order, lowest precedence first:
prefs through the schema bridge (density from prefs.density,
expansion from prefs.dataDepth).
roleVariants[role].surface.
roleVariants[role].components[componentKey].
Override values outside the cockpit-kit literal unions are ignored, so untyped role configuration falls back to the preference mapping. Outside a provider the hook returns the cockpit-kit defaults (comfortable, expanded). The optional type argument narrows the result and accepts only wired variants:
usePersonalizedVariants<{ density: Density }>("Row") returns { density }.
Utiliser resolvePersonalizedVariants({ role, prefs, componentKey, roleVariants })
from ./variant-resolution for the same resolution outside React.
These are package-manifest entry points. Named symbols listed above come from the capability catalogue; this is not an exhaustive TypeScript symbol reference.