import "./components/ui/tidal.css"; import { useEffect, useLayoutEffect, useRef, useState, type FormEvent } from "react"; import { CheckCircle2, FileCheck2, RotateCcw } from "lucide-react"; import { TidalSignInForm } from "./components/ui/sign-in-form"; import "./components/ui/sign-in-form.css"; const tidalExampleStyles = ".tidal-scope .sign-in-demo-specimen {\n width: 100%;\n max-width: 680px;\n min-width: 0;\n overflow: hidden;\n border: 1px solid var(--t-border);\n border-radius: 18px;\n background: var(--t-subtle);\n color: var(--t-ink);\n box-shadow: 0 24px 48px -36px #00000052;\n container-type: inline-size;\n}\n\n.tidal-scope .sign-in-demo-layout {\n display: grid;\n grid-template-columns: minmax(0, 1fr);\n min-width: 0;\n}\n\n.tidal-scope .sign-in-demo-specimen,\n.tidal-scope .sign-in-demo-specimen * {\n box-sizing: border-box;\n}\n\n.tidal-scope .sign-in-demo-kicker {\n display: block;\n color: var(--t-muted);\n font-size: 11px;\n font-weight: 600;\n letter-spacing: 1px;\n line-height: 1.4;\n}\n\n.tidal-scope .sign-in-demo-stage {\n display: grid;\n place-items: center;\n min-width: 0;\n padding: 28px;\n background:\n linear-gradient(var(--t-border) 1px, transparent 1px),\n linear-gradient(90deg, var(--t-border) 1px, transparent 1px),\n var(--t-subtle);\n background-size: 22px 22px;\n}\n\n.tidal-scope .sign-in-demo-stage > .tidal-sign-in-form {\n max-width: 450px;\n}\n\n.tidal-scope .sign-in-demo-prepared {\n width: 100%;\n max-width: 450px;\n padding: 42px 31px;\n border: 1px solid var(--t-border);\n border-radius: 18px;\n background: var(--t-surface);\n text-align: center;\n box-shadow: 0 22px 44px -34px #0000004a;\n}\n\n.tidal-scope .sign-in-demo-prepared-icon {\n position: relative;\n display: grid;\n place-items: center;\n width: 58px;\n height: 58px;\n margin: 0 auto 24px;\n border-radius: 15px;\n background: var(--t-ink);\n color: var(--t-surface);\n transform: rotate(-4deg);\n}\n\n.tidal-scope .sign-in-demo-prepared-icon > svg:last-child {\n position: absolute;\n inset-inline-end: -5px;\n bottom: -5px;\n box-sizing: content-box;\n padding: 4px;\n border: 3px solid var(--t-surface);\n border-radius: 50%;\n background: var(--t-surface);\n color: var(--t-ink);\n}\n\n.tidal-scope .sign-in-demo-prepared h3 {\n margin: 12px 0 11px;\n color: var(--t-ink);\n font-size: 25px;\n font-weight: 500;\n line-height: 1.15;\n letter-spacing: -0.8px;\n text-wrap: balance;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .sign-in-demo-prepared h3:focus {\n outline: 2px solid var(--t-accent);\n outline-offset: 5px;\n border-radius: 4px;\n}\n\n.tidal-scope .sign-in-demo-prepared > p {\n max-width: 330px;\n margin: 0 auto 24px;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.7;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .sign-in-demo-prepared > button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n min-height: 44px;\n padding: 9px 14px;\n border: 1px solid var(--t-border);\n border-radius: 10px;\n background: var(--t-surface);\n color: var(--t-ink);\n font: inherit;\n font-size: 11px;\n cursor: pointer;\n transition:\n background 160ms,\n transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .sign-in-demo-prepared > button:hover {\n background: var(--t-wash);\n}\n\n.tidal-scope .sign-in-demo-prepared > button:active {\n transform: scale(0.98);\n}\n\n.tidal-scope .sign-in-demo-prepared > button:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n@container (max-width: 390px) {\n .tidal-scope .sign-in-demo-stage {\n padding: 12px;\n background-size: 18px 18px;\n }\n\n .tidal-scope .sign-in-demo-prepared {\n padding: 34px 21px;\n }\n}\n\n@media (prefers-reduced-motion: no-preference) {\n .tidal-scope .sign-in-demo-prepared {\n animation: sign-in-demo-enter 430ms var(--t-ease-out) both;\n }\n\n .tidal-scope .sign-in-demo-prepared-icon {\n animation: sign-in-demo-icon 460ms var(--t-ease-spring) both;\n }\n}\n\n@keyframes sign-in-demo-enter {\n from {\n opacity: 0;\n transform: translateY(7px);\n }\n to {\n opacity: 1;\n transform: none;\n }\n}\n\n@keyframes sign-in-demo-icon {\n from {\n opacity: 0;\n transform: scale(0.7) rotate(-13deg);\n }\n to {\n opacity: 1;\n transform: scale(1) rotate(-4deg);\n }\n}"; type DemoPhase = "ready" | "checking" | "prepared"; export function SignInFormDemo() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [emailError, setEmailError] = useState(""); const [passwordError, setPasswordError] = useState(""); const [phase, setPhase] = useState("ready"); const emailInput = useRef(null); const preparedHeading = useRef(null); const timer = useRef | undefined>(undefined); const restoreEmailFocus = useRef(false); const focusOwner = useRef(null); useEffect(() => () => clearTimeout(timer.current), []); useLayoutEffect(() => { if (phase === "prepared") { const active = document.activeElement; if (active === document.body || active === focusOwner.current) preparedHeading.current?.focus({ preventScroll: true }); focusOwner.current = null; } else if (phase === "ready" && restoreEmailFocus.current) { restoreEmailFocus.current = false; emailInput.current?.focus({ preventScroll: true }); } }, [phase]); function reset() { clearTimeout(timer.current); timer.current = undefined; focusOwner.current = null; setEmail(""); setPassword(""); setEmailError(""); setPasswordError(""); restoreEmailFocus.current = true; setPhase("ready"); } function cancelPreparationOnEdit() { if (phase !== "checking") return; clearTimeout(timer.current); timer.current = undefined; focusOwner.current = null; setPhase("ready"); } function handleSubmit(event: FormEvent) { event.preventDefault(); clearTimeout(timer.current); focusOwner.current = (event.nativeEvent as SubmitEvent).submitter instanceof HTMLElement ? (event.nativeEvent as SubmitEvent).submitter : document.activeElement instanceof HTMLElement ? document.activeElement : null; setEmailError(""); setPasswordError(""); setPhase("checking"); timer.current = setTimeout(() => { timer.current = undefined; setEmail(""); setPassword(""); setPhase("prepared"); }, 680); } return (
{phase === "prepared" ? (
LOCAL CHECK COMPLETE

Form prepared locally.

The sample passed browser validation. No account was checked, no sign-in happened, and no values were saved.

) : ( ) => { cancelPreparationOnEdit(); setEmail(event.target.value); setEmailError(""); }, onInvalid: (event: import("react").InvalidEvent) => { const input = event.currentTarget; setEmailError( input.validity.valueMissing ? "Enter an email address to continue." : "Use an email address in the format name@example.com.", ); }, }} passwordInputProps={{ value: password, placeholder: "Sample only", onChange: (event: import("react").ChangeEvent) => { cancelPreparationOnEdit(); setPassword(event.target.value); setPasswordError(""); }, onInvalid: () => { setPasswordError("Enter a sample password to continue."); }, }} footer={ Preview only. Authentication and account recovery are not connected. } /> )}
); } export default function AgentExample() { return (
); }