"use client"; import "./components/ui/tidal.css"; import { useLayoutEffect, useRef, useState, type MouseEvent } from "react"; import { TidalNavigationMenu, type TidalNavigationMenuItem } from "./components/ui/navigation-menu"; import "./components/ui/navigation-menu.css"; const tidalExampleStyles = ".tidal-scope .navigation-menu-demo,\n.tidal-scope .navigation-menu-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .navigation-menu-demo {\n display: grid;\n width: min(100%, 720px);\n min-width: 0;\n gap: 14px;\n padding: clamp(8px, 2.5cqi, 20px);\n color: var(--t-ink);\n font-family: Inter, ui-sans-serif, system-ui, sans-serif;\n}\n\n.tidal-scope .navigation-menu-demo-preview {\n display: grid;\n gap: 7px;\n}\n\n.tidal-scope .navigation-menu-demo-preview > span,\n.tidal-scope .navigation-menu-demo-detail > span {\n color: inherit;\n font-size: 10px;\n font-weight: 750;\n letter-spacing: 0.09em;\n line-height: 1.35;\n text-transform: uppercase;\n}\n\n.tidal-scope .navigation-menu-demo-preview strong {\n font-size: 19px;\n font-weight: 630;\n letter-spacing: -0.025em;\n line-height: 1.18;\n}\n\n.tidal-scope .navigation-menu-demo-preview p,\n.tidal-scope .navigation-menu-demo-detail p,\n.tidal-scope .navigation-menu-demo-note {\n margin: 0;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .navigation-menu-demo-preview p {\n color: color-mix(in srgb, var(--t-surface) 72%, transparent);\n font-size: 11px;\n line-height: 1.45;\n}\n\n.tidal-scope .navigation-menu-demo-detail {\n display: grid;\n min-width: 0;\n gap: 5px;\n padding: 18px;\n background: var(--t-subtle);\n border: 1px solid var(--t-border);\n border-radius: 18px;\n}\n\n.tidal-scope .navigation-menu-demo-detail > span {\n color: var(--t-muted);\n}\n\n.tidal-scope .navigation-menu-demo-detail strong {\n font-size: clamp(18px, 4cqi, 25px);\n font-weight: 620;\n letter-spacing: -0.03em;\n line-height: 1.18;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .navigation-menu-demo-detail p {\n color: var(--t-muted);\n font-size: 12px;\n line-height: 1.5;\n}\n\n.tidal-scope .navigation-menu-demo-note {\n padding-top: 10px;\n color: var(--t-muted);\n border-top: 1px solid var(--t-border);\n font-size: 11px;\n line-height: 1.45;\n}"; const descriptions: Record = { analytics: "Revenue, retention and product signals.", automations: "Rules that keep routine work moving.", inbox: "One place for customer conversations.", guides: "Practical setup notes for each workflow.", pricing: "Compare the sample plan structure.", }; function isPlainClick(event: MouseEvent) { return ( event.button === 0 && !event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey ); } export function NavigationMenuDemo() { const [openId, setOpenId] = useState("product"); const [selected, setSelected] = useState("analytics"); const detailRef = useRef(null); const selectionFocusIntent = useRef(false); const selectedLinkWasFocused = useRef(false); useLayoutEffect(() => { if (!selectionFocusIntent.current) return; selectionFocusIntent.current = false; const shouldFocus = selectedLinkWasFocused.current || document.activeElement === document.body; selectedLinkWasFocused.current = false; if (shouldFocus) detailRef.current?.focus({ preventScroll: true }); }, [selected, openId]); function sampleLink(id: string) { return (event: MouseEvent) => { if (!isPlainClick(event)) return; event.preventDefault(); selectionFocusIntent.current = true; selectedLinkWasFocused.current = document.activeElement === event.currentTarget; setSelected(id); setOpenId(null); }; } const items: readonly TidalNavigationMenuItem[] = [ { kind: "group", id: "product", label: "Product", description: "Explore workspace tools", destinations: [ { id: "analytics", label: "Analytics", description: descriptions.analytics, href: "#navigation-menu-detail", active: selected === "analytics", anchorProps: { onClick: sampleLink("analytics") }, }, { id: "automations", label: "Automations", description: descriptions.automations, href: "#navigation-menu-detail", active: selected === "automations", anchorProps: { onClick: sampleLink("automations") }, }, { id: "inbox", label: "Inbox", description: descriptions.inbox, href: "#navigation-menu-detail", active: selected === "inbox", anchorProps: { onClick: sampleLink("inbox") }, }, ], preview: (
Workspace Three connected tools

Open a destination to update the local detail below.

), }, { kind: "group", id: "resources", label: "Resources", destinations: [ { id: "guides", label: "Guides", description: descriptions.guides, href: "#navigation-menu-detail", active: selected === "guides", anchorProps: { onClick: sampleLink("guides") }, }, ], }, { kind: "link", id: "pricing", label: "Pricing", description: descriptions.pricing, href: "#navigation-menu-detail", active: selected === "pricing", anchorProps: { onClick: sampleLink("pricing") }, }, ]; return (

Sample navigation. Selection changes only this preview.

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