// @ts-nocheck — vendored, see PROVENANCE.md "use client"; import { useState } from "react"; import { motion } from "motion/react"; import { FONTS, Palette, SHAPES, ShapeScale, Theme } from "../lib/tokens"; import { ensureFontLoaded } from "../lib/theme"; import { Lang, t, useLang } from "../lib/i18n"; import { Icon } from "./M3Node"; import { Toggle } from "./ui"; const shapeLabel = (k: ShapeScale, lang: Lang) => (k === "square" ? t("shapeSquare", lang) : k === "full" ? t("shapeFull", lang) : t("shapeRounded", lang)); /** the corner radius a 28dp default becomes under each scale, for the option art */ const previewR = (k: ShapeScale) => (k === "square" ? 6 : k === "full" ? 28 : 16); function Hint({ p, children }: { p: Palette; children: React.ReactNode }) { return
{children}
; } function OptionCard({ on, onClick, p, label, children, }: { on: boolean; onClick: () => void; p: Palette; label: string; children: React.ReactNode; }) { return ( ); } /** Three cards, each drawing a button, a FAB and a card at that corner scale. */ export function ShapePanel({ p, theme, onChange }: { p: Palette; theme: Theme; onChange: (patch: Partial) => void }) { const lang = useLang(); return (
{t("shapeScale", lang)}
{SHAPES.map((sh) => { const r = previewR(sh.key); const on = theme.shape === sh.key; return ( ); })}
{t("shapeHint", lang)}
); } /** Typeface rows rendered in their own face, and the emphasized switch with a live sample. */ export function TypePanel({ p, theme, onChange }: { p: Palette; theme: Theme; onChange: (patch: Partial) => void }) { const lang = useLang(); return (
{t("fontFamily", lang)}
{FONTS.map((f) => { const on = theme.font === f.key; ensureFontLoaded(f.key); return ( ); })}
onChange({ emphasized })} p={p} icon="format_bold" label={t("emphasized", lang)} grow /> {t("emphasizedHint", lang)}
); } /** Two option cards that replay their own motion when chosen, plus a tap-to-try dot. */ export function MotionPanel({ p, theme, onChange }: { p: Palette; theme: Theme; onChange: (patch: Partial) => void }) { const lang = useLang(); const [tick, setTick] = useState(0); const expressive = theme.motion === "expressive"; const transition = expressive ? { type: "spring" as const, stiffness: 380, damping: 18, mass: 1 } : { duration: 0.35, ease: [0.2, 0, 0, 1] as const }; return (
{t("motionScheme", lang)}
{ onChange({ motion: "standard" }); setTick((n) => n + 1); }} p={p} label={t("motionStandard", lang)}> { onChange({ motion: "expressive" }); setTick((n) => n + 1); }} p={p} label={t("motionExpressive", lang)}>
{t("motionHint", lang)}
); }