Second step of the visual-redesign (tokens -> primitives -> surfaces): a small set of shared, token-driven primitives in @trails-cool/ui so both apps compose from one styled vocabulary instead of hand-rolling bg-white/text-gray-* per screen. - @trails-cool/ui now ships React components (Button variants+sizes, Badge tones, Card raised/subtle, Input) plus a tiny cn() helper. React is a peer dep; package builds with no bundling step. - Co-located jsdom unit tests (@testing-library/react) assert roles, token classes, variant switching, and behavior — run in the existing Unit Tests gate, cross-platform, no snapshot baseline needed. - Tailwind @source directive in both apps' styles.css so the package's token utility classes get generated. - Dev-only /dev/ui gallery route in the planner renders every primitive in all states — a zero-dependency stand-in for Storybook. Excluded from production builds (NODE_ENV guard in routes.ts). No app surfaces are refactored yet; adopting the primitives in the topbar/sidebar/etc. is the surface task groups. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
15 lines
628 B
TypeScript
15 lines
628 B
TypeScript
import type { InputHTMLAttributes } from "react";
|
|
import { cn } from "./cn.ts";
|
|
|
|
export type InputProps = InputHTMLAttributes<HTMLInputElement>;
|
|
|
|
const base =
|
|
"h-9 w-full rounded-md border border-border bg-bg-raised px-3 text-sm " +
|
|
"text-text-hi placeholder:text-text-lo transition-colors " +
|
|
"focus-visible:border-accent focus-visible:outline-none " +
|
|
"focus-visible:ring-2 focus-visible:ring-accent-border " +
|
|
"disabled:cursor-not-allowed disabled:opacity-50";
|
|
|
|
export function Input({ className, type = "text", ...props }: InputProps) {
|
|
return <input type={type} className={cn(base, className)} {...props} />;
|
|
}
|