import "./components/ui/tidal.css"; import { useId, useRef, useState, type FormEvent } from "react"; import { TidalInputGroup, type TidalInputGroupAction } from "./components/ui/input-group"; import "./components/ui/input-group.css"; const tidalExampleStyles = ".tidal-scope .input-group-demo {\n width: min(100%, 520px);\n min-width: 0;\n color: var(--t-ink);\n}\n\n.tidal-scope .input-group-demo-form {\n display: grid;\n gap: 28px;\n}\n\n.tidal-scope .input-group-demo-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 14px;\n min-width: 0;\n padding-top: 18px;\n border-top: 1px solid var(--t-border);\n}\n\n.tidal-scope .input-group-demo-footer p {\n min-width: 0;\n margin: 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.55;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .input-group-demo-footer > button {\n min-width: 112px;\n min-height: 44px;\n padding: 9px 14px;\n border: 1px solid var(--t-border);\n border-radius: var(--t-radius-control);\n background: var(--t-surface);\n color: var(--t-ink);\n font: inherit;\n font-size: 12px;\n font-weight: 630;\n cursor: pointer;\n transition:\n background-color 140ms,\n color 140ms,\n transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .input-group-demo-footer > button:hover {\n background: var(--t-ink);\n color: var(--t-surface);\n}\n\n.tidal-scope .input-group-demo-footer > button:active {\n transform: scale(0.98);\n}\n\n.tidal-scope .input-group-demo-footer > button:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n@container preview-stage (max-width: 420px) {\n .tidal-scope .input-group-demo-footer {\n align-items: stretch;\n flex-direction: column;\n }\n\n .tidal-scope .input-group-demo-footer > button {\n width: 100%;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .input-group-demo-footer > button {\n transition: none;\n }\n\n .tidal-scope .input-group-demo-footer > button:active {\n transform: none;\n }\n}"; export function InputGroupDemo() { const generatedId = useId().replace(/:/g, ""); const budgetId = `${generatedId}-budget`; const pathId = `${generatedId}-path`; const budgetRef = useRef(null); const [budget, setBudget] = useState("48"); const [path, setPath] = useState("launch-brief"); const [error, setError] = useState(""); const [status, setStatus] = useState("Edit either local sample field."); const budgetActions: readonly TidalInputGroupAction[] = [ { actionId: "apply-budget", label: "Apply", type: "submit", }, ]; const pathActions: readonly TidalInputGroupAction[] = [ { actionId: "set-path-sample", label: "Use sample", onClick: () => { setPath("workspace-notes"); setStatus("The sample workspace path changed locally."); }, }, ]; function submitBudget(event: FormEvent) { event.preventDefault(); const node = budgetRef.current; if (!node?.checkValidity() || Number(budget) <= 0) { setError("Enter an amount greater than zero."); node?.focus({ preventScroll: true }); return; } setError(""); setStatus(`Local budget preview: $${budget} USD per month.`); } return (
{ setBudget("48"); setPath("launch-brief"); setError(""); setStatus("The local sample was reset."); }} > { setBudget(event.currentTarget.value); setError(""); }} prefix="$" prefixLabel="US dollars" unit="USD / month" unitLabel="US dollars per month" actions={budgetActions} description="This preview validates and formats the value locally." error={error || undefined} /> { setPath(event.currentTarget.value); setStatus("The sample path has unsaved local changes."); }} prefix="northstar /" prefixLabel="Northstar workspace prefix" suffix=".preview" suffixLabel="Preview suffix" actions={pathActions} autoComplete="off" spellCheck={false} />

{status}

); } export default function AgentExample() { return (
); }