"use client"; import "./components/ui/tidal.css"; import { useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from "react"; import { TidalTagInput, type TidalTagInputSuggestion, type TidalTagInputTag } from "./components/ui/tag-input"; import "./components/ui/tag-input.css"; const tidalExampleStyles = ".tidal-scope .tag-input-demo,\n.tidal-scope .tag-input-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .tag-input-demo {\n width: 100%;\n min-width: 0;\n overflow: hidden;\n border: 1px solid var(--t-border);\n border-radius: 22px;\n background:\n linear-gradient(90deg, var(--t-border) 1px, transparent 1px) 0 0 / 28px 28px,\n linear-gradient(var(--t-border) 1px, transparent 1px) 0 0 / 28px 28px,\n var(--t-subtle);\n color: var(--t-ink);\n container: tag-input-demo / inline-size;\n}\n\n.tidal-scope .tag-input-demo-layout {\n display: grid;\n min-width: 0;\n grid-template-columns: minmax(0, 1.08fr) minmax(250px, 0.72fr);\n gap: 14px;\n padding: 20px;\n}\n\n.tidal-scope .tag-input-demo-editor {\n min-width: 0;\n padding: 27px;\n border: 1px solid var(--t-border);\n border-radius: 18px;\n background: var(--t-surface);\n box-shadow: 0 30px 70px -58px #0000009e;\n}\n\n.tidal-scope .tag-input-demo-heading {\n display: flex;\n min-width: 0;\n align-items: center;\n justify-content: space-between;\n gap: 14px;\n}\n\n.tidal-scope .tag-input-demo-heading > span {\n min-width: 0;\n color: var(--t-muted);\n font-size: 11px;\n font-weight: 740;\n letter-spacing: 0.12em;\n line-height: 1.35;\n text-transform: uppercase;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .tag-input-demo-heading > strong {\n flex: none;\n padding: 5px 8px;\n border: 1px solid var(--t-border);\n border-radius: 7px;\n font-size: 11px;\n font-variant-numeric: tabular-nums;\n line-height: 1.3;\n}\n\n.tidal-scope .tag-input-demo-editor > h2 {\n max-width: 16ch;\n margin: 15px 0 0;\n font-size: clamp(29px, 5.2cqi, 47px);\n font-weight: 560;\n letter-spacing: -0.058em;\n line-height: 0.98;\n text-wrap: balance;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .tag-input-demo-editor > p {\n max-width: 56ch;\n margin: 13px 0 22px;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.65;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .tag-input-demo-reset {\n display: inline-flex;\n min-width: 44px;\n min-height: 44px;\n align-items: center;\n justify-content: center;\n margin-top: 12px;\n padding: 8px 13px;\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 font-weight: 680;\n cursor: pointer;\n transition:\n border-color 180ms,\n background 180ms,\n transform 140ms var(--t-ease-out);\n}\n\n.tidal-scope .tag-input-demo-reset:hover {\n border-color: var(--t-ink);\n background: var(--t-subtle);\n}\n\n.tidal-scope .tag-input-demo-reset:active {\n transform: scale(0.97);\n}\n\n.tidal-scope .tag-input-demo-reset:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n.tidal-scope .tag-input-demo-board {\n min-width: 0;\n align-self: start;\n padding: 22px;\n border: 1px solid var(--t-ink);\n border-radius: 18px;\n background: var(--t-ink);\n color: var(--t-surface);\n box-shadow: 0 32px 70px -54px #000000c4;\n}\n\n.tidal-scope .tag-input-demo-board-head {\n display: flex;\n min-width: 0;\n align-items: center;\n justify-content: space-between;\n gap: 14px;\n padding-bottom: 17px;\n border-bottom: 1px solid\n color-mix(in srgb, var(--t-surface) 22%, var(--t-ink));\n}\n\n.tidal-scope .tag-input-demo-board-head > div {\n min-width: 0;\n}\n\n.tidal-scope .tag-input-demo-board-head > div > span {\n color: color-mix(in srgb, var(--t-surface) 60%, var(--t-ink));\n font-size: 11px;\n font-weight: 700;\n letter-spacing: 0.1em;\n line-height: 1.35;\n text-transform: uppercase;\n}\n\n.tidal-scope .tag-input-demo-board-head h3 {\n margin: 5px 0 0;\n font-size: 20px;\n font-weight: 590;\n letter-spacing: -0.035em;\n line-height: 1.1;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .tag-input-demo-board-head > span {\n display: grid;\n width: 44px;\n height: 44px;\n flex: none;\n place-items: center;\n border: 1px solid color-mix(in srgb, var(--t-surface) 28%, var(--t-ink));\n border-radius: 10px;\n font-size: 14px;\n font-variant-numeric: tabular-nums;\n font-weight: 620;\n}\n\n.tidal-scope .tag-input-demo-board ul {\n display: grid;\n gap: 8px;\n margin: 16px 0 0;\n padding: 0;\n list-style: none;\n}\n\n.tidal-scope .tag-input-demo-board li {\n min-width: 0;\n padding: 12px;\n border: 1px solid color-mix(in srgb, var(--t-surface) 20%, var(--t-ink));\n border-radius: 12px;\n background: color-mix(in srgb, var(--t-surface) 4%, var(--t-ink));\n animation: tag-input-row-in 420ms var(--t-ease-out) both;\n animation-delay: calc(var(--tag-row-index) * 55ms);\n}\n\n.tidal-scope .tag-input-demo-board li > div:first-child {\n display: flex;\n min-width: 0;\n align-items: baseline;\n justify-content: space-between;\n gap: 10px;\n}\n\n.tidal-scope .tag-input-demo-board li strong {\n min-width: 0;\n font-size: 11px;\n font-weight: 650;\n line-height: 1.35;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .tag-input-demo-board li > div:first-child > span {\n max-width: 44%;\n color: color-mix(in srgb, var(--t-surface) 62%, var(--t-ink));\n font-size: 11px;\n line-height: 1.35;\n text-align: end;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .tag-input-demo-progress {\n height: 4px;\n margin-top: 10px;\n overflow: hidden;\n border-radius: 999px;\n background: color-mix(in srgb, var(--t-surface) 18%, var(--t-ink));\n}\n\n.tidal-scope .tag-input-demo-progress > span {\n display: block;\n height: 100%;\n border-radius: inherit;\n background: var(--t-surface);\n transform-origin: left center;\n animation: tag-input-progress-in 620ms var(--t-ease-out) both;\n}\n\n.tidal-scope[dir=\"rtl\"] .tag-input-demo-progress > span {\n transform-origin: right center;\n}\n\n.tidal-scope .tag-input-demo-empty {\n display: grid;\n min-height: 184px;\n place-content: center;\n gap: 6px;\n text-align: center;\n}\n\n.tidal-scope .tag-input-demo-empty strong {\n font-size: 12px;\n}\n\n.tidal-scope .tag-input-demo-empty span {\n color: color-mix(in srgb, var(--t-surface) 64%, var(--t-ink));\n font-size: 11px;\n line-height: 1.45;\n}\n\n@container tag-input-demo (max-width: 760px) {\n .tidal-scope .tag-input-demo-layout {\n grid-template-columns: minmax(0, 1fr);\n padding: 10px;\n }\n\n .tidal-scope .tag-input-demo-editor {\n padding: 21px;\n }\n\n .tidal-scope .tag-input-demo-board {\n padding: 18px;\n }\n}\n\n@container tag-input-demo (max-width: 390px) {\n .tidal-scope .tag-input-demo-layout {\n gap: 8px;\n padding: 6px;\n }\n\n .tidal-scope .tag-input-demo-editor,\n .tidal-scope .tag-input-demo-board {\n padding: 15px;\n }\n\n .tidal-scope .tag-input-demo-editor > h2 {\n font-size: 29px;\n }\n}\n\n@keyframes tag-input-row-in {\n from {\n opacity: 0;\n transform: translateY(7px);\n }\n}\n\n@keyframes tag-input-progress-in {\n from {\n transform: scaleX(0);\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .tag-input-demo-board li,\n .tidal-scope .tag-input-demo-progress > span {\n animation: none;\n }\n\n .tidal-scope .tag-input-demo-reset {\n transition: none;\n }\n\n .tidal-scope .tag-input-demo-reset:active {\n transform: none;\n }\n}"; const ALL_TAGS: readonly TidalTagInputTag[] = [ { id: "review", value: "review", label: "Review", accessibleLabel: "Review" }, { id: "design", value: "design", label: "Design", accessibleLabel: "Design" }, { id: "copy", value: "copy", label: "Copy", accessibleLabel: "Copy" }, { id: "blocked", value: "blocked", label: "Blocked", accessibleLabel: "Blocked", }, { id: "ready", value: "ready", label: "Ready", accessibleLabel: "Ready" }, ]; const SAMPLE_ITEMS = [ { id: "brief", title: "Project brief", tags: ["review", "copy"], progress: 72, }, { id: "landing", title: "Landing page", tags: ["review", "design"], progress: 48, }, { id: "launch", title: "Launch checklist", tags: ["ready"], progress: 100 }, { id: "notes", title: "Interview notes", tags: ["blocked", "copy"], progress: 24, }, ] as const; export function TagInputDemo() { const [tags, setTags] = useState([ ALL_TAGS[0], ALL_TAGS[1], ]); const [query, setQuery] = useState(""); const [message, setMessage] = useState("Two labels selected."); const inputRef = useRef(null); const pendingInputFocus = useRef(false); useLayoutEffect(() => { if (!pendingInputFocus.current) return; pendingInputFocus.current = false; inputRef.current?.focus({ preventScroll: true }); }, [tags]); const suggestions = useMemo( () => ALL_TAGS.filter( (candidate) => !tags.some((tag) => tag.id === candidate.id) && candidate.accessibleLabel.toLowerCase().includes(query.toLowerCase()), ), [query, tags], ); const visibleItems = useMemo( () => SAMPLE_ITEMS.filter( (item) => tags.length === 0 || tags.some((tag) => item.tags.includes(tag.value as never)), ), [tags], ); const selectSuggestion = (suggestion: TidalTagInputSuggestion) => { const tag = ALL_TAGS.find((candidate) => candidate.id === suggestion.id); if (!tag) return; setTags((current) => [...current, tag]); setQuery(""); setMessage(`${tag.accessibleLabel} added.`); inputRef.current?.focus({ preventScroll: true }); }; return (
Review queue {visibleItems.length} visible
setQuery(value)} onRemoveTag={(tag) => { pendingInputFocus.current = true; setTags((current) => current.filter((candidate) => candidate.id !== tag.id), ); setMessage(`${tag.accessibleLabel} removed.`); }} suggestions={{ label: query ? `Suggestions for “${query}”` : "Available labels", accessibleLabel: "Available project labels", items: suggestions, onSelect: selectSuggestion, }} status={ {message} Sample data. Changes stay in this preview. } />
Tasks

Review queue

{visibleItems.length.toString().padStart(2, "0")}
{visibleItems.length ? (
    {visibleItems.map((item, index) => (
  • {item.title} {item.tags.join(" · ")}
  • ))}
) : (
No matching tasks. Remove a label or reset the filters.
)}
); } export default function AgentExample() { return (
); }