"use client"; import "./components/ui/tidal.css"; import { useId, useMemo, useState } from "react"; import { TidalFeatureComparisonTable, type TidalComparisonColumn, type TidalComparisonFeature } from "./components/ui/feature-comparison-table"; import "./components/ui/feature-comparison-table.css"; const tidalExampleStyles = ".tidal-scope .feature-comparison-demo {\n width: min(100%, 1080px);\n margin-inline: auto;\n}\n\n.tidal-scope .feature-comparison-demo-switcher {\n display: flex;\n width: fit-content;\n max-width: 100%;\n gap: 3px;\n margin: 0 auto 14px;\n padding: 3px;\n background: var(--t-subtle);\n border: 1px solid var(--t-border);\n border-radius: 13px;\n}\n\n.tidal-scope .feature-comparison-demo-switcher button {\n min-width: 0;\n min-height: 44px;\n padding: 8px 15px;\n color: var(--t-muted);\n background: transparent;\n border: 0;\n border-radius: var(--t-radius-control);\n font: inherit;\n font-size: 11px;\n font-weight: 720;\n line-height: 1.25;\n cursor: pointer;\n overflow-wrap: anywhere;\n transition:\n color 180ms,\n background 180ms,\n box-shadow 180ms,\n transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .feature-comparison-demo-switcher button[aria-pressed=\"true\"] {\n color: var(--t-ink);\n background: var(--t-surface);\n box-shadow:\n 0 0 0 1px var(--t-border),\n 0 5px 14px -11px #000000a6;\n}\n\n.tidal-scope .feature-comparison-demo-switcher button:active {\n transform: scale(0.97);\n}\n\n.tidal-scope .feature-comparison-demo-switcher button:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 2px;\n}\n\n.tidal-scope .feature-comparison-demo-status {\n min-height: 1.4em;\n margin: 11px 6px 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.4;\n text-align: center;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .feature-comparison-demo-notes {\n display: grid;\n grid-template-columns: auto minmax(0, 1fr);\n gap: 10px 16px;\n margin-top: 12px;\n padding: 15px 17px;\n color: var(--t-muted);\n background: var(--t-subtle);\n border: 1px solid var(--t-border);\n border-radius: var(--t-radius-control);\n font-size: 11px;\n line-height: 1.45;\n scroll-margin-block: 20px;\n}\n\n.tidal-scope .feature-comparison-demo-notes strong {\n color: var(--t-ink);\n font-weight: 760;\n}\n\n.tidal-scope .feature-comparison-demo-notes span {\n min-width: 0;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .feature-comparison-demo-notes:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n@container tidal-feature-comparison (max-width: 430px) {\n .tidal-scope .feature-comparison-demo-switcher {\n width: 100%;\n }\n\n .tidal-scope .feature-comparison-demo-switcher button {\n flex: 1 1 0;\n padding-inline: 10px;\n }\n\n .tidal-scope .feature-comparison-demo-notes {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n\n@media (hover: none), (pointer: coarse) {\n .tidal-scope .feature-comparison-demo-switcher button {\n font-size: 16px;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .feature-comparison-demo-switcher button {\n transition-duration: 0s;\n }\n\n .tidal-scope .feature-comparison-demo-switcher button:active {\n transform: none;\n }\n}"; type ComparisonId = "workspace" | "review"; const FEATURES: Record = { workspace: [ { id: "organize", label: "Primary organization", description: "How sample work is arranged", values: { board: { kind: "text", value: "Status columns" }, list: { kind: "text", value: "Ordered rows" }, calendar: { kind: "text", value: "Dated entries" }, }, }, { id: "reorder", label: "Direct reordering", values: { board: { kind: "available" }, list: { kind: "available" }, calendar: { kind: "unavailable" }, }, }, { id: "dates", label: "Date context", values: { board: { kind: "text", value: "Card detail" }, list: { kind: "text", value: "Date column" }, calendar: { kind: "available", label: "Visible on canvas" }, }, }, { id: "scan", label: "Useful for", description: "Fictional sample use case", values: { board: { kind: "text", value: "Work stages" }, list: { kind: "text", value: "Dense review" }, calendar: { kind: "text", value: "Scheduled work" }, }, }, ], review: [ { id: "structure", label: "Review structure", values: { thread: { kind: "text", value: "Nested replies" }, queue: { kind: "text", value: "Ordered decisions" }, log: { kind: "text", value: "Chronological entries" }, }, }, { id: "decision", label: "Explicit decision state", values: { thread: { kind: "unavailable" }, queue: { kind: "available", label: "Approve or return" }, log: { kind: "unavailable" }, }, }, { id: "context", label: "Discussion context", values: { thread: { kind: "available" }, queue: { kind: "text", value: "Decision note" }, log: { kind: "text", value: "Entry detail" }, }, }, { id: "scan", label: "Useful for", description: "Fictional sample use case", values: { thread: { kind: "text", value: "Open discussion" }, queue: { kind: "text", value: "Formal review" }, log: { kind: "text", value: "Change history" }, }, }, ], }; export function FeatureComparisonTableDemo() { const instanceId = useId().replace(/:/g, ""); const [comparison, setComparison] = useState("workspace"); const [selected, setSelected] = useState("board"); const [message, setMessage] = useState( "Board view is selected for this local sample.", ); const notesId = `feature-comparison-notes-${instanceId}`; const columns = useMemo(() => { const choose = (id: string, label: string) => ({ kind: "button" as const, id: `choose-${id}`, label: selected === id ? "Selected locally" : `Choose ${label}`, accessibleLabel: `Choose ${label} for the local sample`, variant: selected === id ? ("primary" as const) : ("secondary" as const), buttonProps: { "aria-pressed": selected === id }, onAction: () => { setSelected(id); setMessage(`${label} is selected for this local sample.`); }, }); if (comparison === "workspace") { return [ { id: "board", label: "Board view", accessibleLabel: "Board view", description: "Grouped by workflow state", badge: selected === "board" ? "Selected" : undefined, action: choose("board", "Board view"), }, { id: "list", label: "List view", accessibleLabel: "List view", description: "Rows with visible fields", badge: selected === "list" ? "Selected" : undefined, action: choose("list", "List view"), }, { id: "calendar", label: "Calendar view", accessibleLabel: "Calendar view", description: "Work arranged by date", badge: selected === "calendar" ? "Selected" : undefined, action: { kind: "link", id: "calendar-notes", label: "Read sample notes", accessibleLabel: "Read Calendar view sample notes", href: `#${notesId}`, }, }, ]; } return [ { id: "thread", label: "Comment thread", accessibleLabel: "Comment thread", description: "Conversation beside work", badge: selected === "thread" ? "Selected" : undefined, action: choose("thread", "Comment thread"), }, { id: "queue", label: "Approval queue", accessibleLabel: "Approval queue", description: "Items awaiting a decision", badge: selected === "queue" ? "Selected" : undefined, action: choose("queue", "Approval queue"), }, { id: "log", label: "Change log", accessibleLabel: "Change log", description: "A dated record of changes", badge: selected === "log" ? "Selected" : undefined, action: { kind: "link", id: "log-notes", label: "Read sample notes", accessibleLabel: "Read Change log sample notes", href: `#${notesId}`, }, }, ]; }, [comparison, notesId, selected]); function changeComparison(next: ComparisonId) { setComparison(next); const nextSelected = next === "workspace" ? "board" : "thread"; setSelected(nextSelected); setMessage( next === "workspace" ? "Workspace view comparison loaded locally." : "Review format comparison loaded locally.", ); } return (

{message}

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