"use client"; import "./components/ui/tidal.css"; import { useId, useLayoutEffect, useRef, useState } from "react"; import { TidalSettingsPanel, type TidalSettingsGroup } from "./components/ui/settings-panel"; import "./components/ui/settings-panel.css"; const tidalExampleStyles = ".tidal-scope .settings-panel-demo,\n.tidal-scope .settings-panel-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .settings-panel-demo {\n width: 100%;\n min-width: 0;\n padding: clamp(14px, 3.2vw, 38px);\n color: var(--t-ink);\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: 24px 24px;\n border-radius: 22px;\n container: settings-demo / inline-size;\n}\n\n.tidal-scope .settings-panel-demo-layout {\n display: grid;\n width: 100%;\n max-width: 1040px;\n min-width: 0;\n gap: 16px;\n margin: 0 auto;\n}\n\n.tidal-scope .settings-panel-demo-page {\n min-width: 0;\n padding: 18px;\n color: var(--t-ink);\n background: var(--t-surface);\n border: 1px solid var(--t-border);\n border-radius: 18px;\n box-shadow: 0 20px 45px -40px #00000070;\n}\n\n.tidal-scope .settings-panel-demo-page > header,\n.tidal-scope .settings-panel-demo-page > footer {\n display: flex;\n min-width: 0;\n align-items: flex-end;\n justify-content: space-between;\n gap: 16px;\n}\n\n.tidal-scope .settings-panel-demo-page > header > div {\n min-width: 0;\n}\n\n.tidal-scope .settings-panel-demo-page > header span,\n.tidal-scope .settings-panel-demo-page > footer span {\n color: var(--t-muted);\n font-size: 11px;\n font-weight: 650;\n letter-spacing: 0.08em;\n line-height: 1.45;\n text-transform: uppercase;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .settings-panel-demo-page h3 {\n margin: 5px 0 0;\n font-size: 22px;\n font-weight: 560;\n letter-spacing: -0.035em;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .settings-panel-demo-page > header > span {\n text-align: end;\n}\n\n.tidal-scope .settings-panel-demo-page-grid {\n display: grid;\n grid-template-columns: minmax(120px, 0.45fr) minmax(0, 1fr);\n gap: 10px;\n min-width: 0;\n margin: 17px 0;\n}\n\n.tidal-scope .settings-panel-demo-page ul,\n.tidal-scope .settings-panel-demo-page-content {\n min-width: 0;\n padding: 12px;\n background: var(--t-subtle);\n border: 1px solid var(--t-border);\n border-radius: 10px;\n}\n\n.tidal-scope .settings-panel-demo-page ul {\n display: flex;\n flex-direction: column;\n margin: 0;\n list-style: none;\n}\n\n.tidal-scope .settings-panel-demo-page ul > li {\n display: flex;\n min-height: 36px;\n align-items: center;\n padding-inline: 10px;\n color: var(--t-muted);\n border-inline-start: 2px solid transparent;\n font-size: 11px;\n line-height: 1.4;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .settings-panel-demo-page[data-density=\"compact\"] ul > li {\n min-height: 28px;\n}\n\n.tidal-scope .settings-panel-demo-page ul > li[data-active=\"true\"] {\n color: var(--t-ink);\n background: var(--t-surface);\n border-inline-start-color: var(--t-ink);\n}\n\n.tidal-scope .settings-panel-demo-page-content {\n display: flex;\n min-height: 124px;\n flex-direction: column;\n justify-content: center;\n gap: 7px;\n}\n\n.tidal-scope .settings-panel-demo-page-content strong {\n font-size: 14px;\n font-weight: 620;\n line-height: 1.4;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .settings-panel-demo-page-content span {\n max-width: 54ch;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.6;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .settings-panel-demo-page > footer {\n align-items: center;\n padding-top: 15px;\n border-top: 1px solid var(--t-border);\n}\n\n.tidal-scope .settings-panel-demo-page > footer strong {\n font-size: 11px;\n font-weight: 650;\n}\n\n.tidal-scope .settings-panel-demo-boundary {\n margin: 0;\n padding: 0 4px;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.6;\n text-align: center;\n overflow-wrap: anywhere;\n}\n\n@container settings-demo (max-width: 480px) {\n .tidal-scope .settings-panel-demo {\n padding: 10px;\n background-size: 18px 18px;\n border-radius: 18px;\n }\n\n .tidal-scope .settings-panel-demo-page {\n padding: 15px;\n }\n\n .tidal-scope .settings-panel-demo-page > header {\n align-items: flex-start;\n flex-direction: column;\n gap: 7px;\n }\n\n .tidal-scope .settings-panel-demo-page > header > span {\n text-align: start;\n }\n\n .tidal-scope .settings-panel-demo-page-grid {\n grid-template-columns: minmax(0, 1fr);\n }\n}"; type Density = "comfortable" | "compact"; type StartView = "overview" | "activity"; interface SamplePreferences { density: Density; startView: StartView; weeklyDigest: boolean; } const INITIAL_PREFERENCES: SamplePreferences = { density: "comfortable", startView: "overview", weeklyDigest: false, }; const DENSITY_LABELS: Record = { comfortable: "Comfortable", compact: "Compact", }; const VIEW_LABELS: Record = { overview: "Overview", activity: "Activity", }; function samePreferences(first: SamplePreferences, second: SamplePreferences) { return ( first.density === second.density && first.startView === second.startView && first.weeklyDigest === second.weeklyDigest ); } export function SettingsPanelDemo() { const pageTitleId = useId(); const pageTitleRef = useRef(null); const focusPageAfterApply = useRef(false); const [draft, setDraft] = useState(INITIAL_PREFERENCES); const [applied, setApplied] = useState(INITIAL_PREFERENCES); const [message, setMessage] = useState( "The local page sample uses the default preferences.", ); const dirty = !samePreferences(draft, applied); useLayoutEffect(() => { if (!focusPageAfterApply.current) return; focusPageAfterApply.current = false; pageTitleRef.current?.focus({ preventScroll: true }); }, [applied]); const groups: readonly TidalSettingsGroup[] = [ { id: "workspace", title: "Workspace view", description: "Choose how this sample page is arranged.", fields: [ { id: "density", kind: "select", name: "density", label: "Navigation density", description: "Changes the spacing in the local page sample.", value: draft.density, options: [ { value: "comfortable", label: "Comfortable" }, { value: "compact", label: "Compact" }, ], onValueChange: (value) => { setDraft((current) => ({ ...current, density: value as Density, })); setMessage( "Navigation density changed locally. Apply to preview it.", ); }, }, { id: "start-view", kind: "radio", name: "startView", label: "Start page", description: "Select the view shown in the sample page.", value: draft.startView, required: true, options: [ { id: "overview", value: "overview", label: "Overview", description: "Summary and open work", }, { id: "activity", value: "activity", label: "Activity", description: "Recent sample changes", }, ], onValueChange: (value) => { setDraft((current) => ({ ...current, startView: value as StartView, })); setMessage("Start page changed locally. Apply to preview it."); }, }, ], }, { id: "updates", title: "Updates", description: "Control one sample communication preference.", fields: [ { id: "weekly-digest", kind: "toggle", name: "weeklyDigest", label: "Weekly digest", description: "Shows whether a fictional digest is included in this preview.", checked: draft.weeklyDigest, onCheckedChange: (checked) => { setDraft((current) => ({ ...current, weeklyDigest: checked, })); setMessage( "Digest preference changed locally. Apply to preview it.", ); }, }, ], }, ]; function applyPreferences(event: React.FormEvent) { event.preventDefault(); focusPageAfterApply.current = true; setApplied(draft); setMessage( `Local page updated: ${DENSITY_LABELS[draft.density]} spacing, ${VIEW_LABELS[draft.startView]} start page, weekly digest ${draft.weeklyDigest ? "shown" : "hidden"}. Nothing was saved.`, ); } function resetPreferences() { setDraft(INITIAL_PREFERENCES); setApplied(INITIAL_PREFERENCES); setMessage( "Local preferences reset. No account, workspace, or saved setting changed.", ); } return (
{dirty ? "Unapplied local changes. " : ""} {message}

} />
LOCAL PAGE SAMPLE

{VIEW_LABELS[applied.startView]}

{DENSITY_LABELS[applied.density]} spacing
  • Overview
  • Activity
  • Projects
{applied.startView === "overview" ? "Three sample priorities" : "Five sample updates"} Preview content changes only after the native Apply button submits locally.
Weekly digest {applied.weeklyDigest ? "Shown" : "Hidden"}

This demo changes only React state in the rendered preview. It makes no request, creates no account, and writes no stored preference.

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