feat(design): the field family, the dropdown trigger, native controls, the no-raw-input lint rule (E28 S3c)

- ui/Input, Textarea, InnerInput + fieldClass (A4): the >= 3:1 edge, a 2px accent
  focus edge, the danger edge for invalid, md/sm/xs/heading rungs, 1rem and 44 on touch
- ui/SelectTrigger (A5): SortControl, FilterSelect, the view switcher and the date
  filter on one trigger, a pill in a toolbar, r8 in a form
- ui/NativeControls (A6): Checkbox, CheckRow, Slider, ColorInput
- every raw input swept (~100 sites); inputCls retired; local/input-primitive
- useReturnFocus: an in-place editor hands the focus back to its trigger on
  Enter/Escape (the playlist and Plex title renames, the priority number);
  the Plex playlist rename gains Escape and an accessible name
- back to top: a round 48 FAB (owner decision); DESIGN.md A2 and the log
This commit is contained in:
2026-09-24 23:48:22 +02:00
parent 81936e9f56
commit dac9d89f91
63 changed files with 923 additions and 416 deletions
@@ -0,0 +1,43 @@
import { fileURLToPath } from "node:url";
import { ESLint } from "eslint";
import { describe, expect, it } from "vitest";
// `local/input-primitive` (eslint.config.js): every text field is ui/Input, Textarea or InnerInput and
// every checkbox / slider / colour well a NativeControls primitive (docs/DESIGN.md A4, A6; E28 S3c).
// ~100 hand-styled boxes were swept; this pins that the rule keeping a new one out fires, and where it
// stands down.
const RULE = "local/input-primitive";
const FRONTEND = fileURLToPath(new URL("../../", import.meta.url));
async function hits(source: string, filePath = "src/components/__probe.tsx"): Promise<number> {
const eslint = new ESLint({ cwd: FRONTEND });
const [result] = await eslint.lintText(source, { filePath });
return (result?.messages ?? []).filter((m) => m.ruleId === RULE).length;
}
describe("a hand-rolled field", () => {
it("is refused anywhere outside the field primitives, text box or native control", async () => {
const text = 'export const A = () => <input className="border px-2" />;\n';
expect(await hits(text)).toBe(1);
expect(await hits(text, "src/design-lab/__probe.tsx")).toBe(1);
// …and in a ui/ composite: the pager's page box is an Input too.
expect(await hits(text, "src/components/ui/Pager.tsx")).toBe(1);
expect(await hits("export const B = () => <textarea />;\n")).toBe(1);
expect(await hits('export const C = () => <input type="checkbox" />;\n')).toBe(1);
expect(await hits('export const D = () => <input type="range" />;\n')).toBe(1);
});
it("passes in a field primitive, for a file picker, and for the primitives themselves", async () => {
for (const file of ["Input.tsx", "NativeControls.tsx"])
expect(await hits("export const E = () => <input />;\n", `src/components/ui/${file}`)).toBe(
0,
);
expect(await hits('export const F = () => <input type="file" hidden />;\n')).toBe(0);
expect(
await hits(
'import { Input } from "./ui/Input";\nexport const G = () => <Input className="w-full" />;\n',
),
).toBe(0);
});
});