"use client"; import "./components/ui/tidal.css"; import { useMemo, useState } from "react"; import { TidalCarousel, type TidalCarouselSlide } from "./components/ui/carousel"; import "./components/ui/carousel.css"; const tidalExampleStyles = ".tidal-scope .carousel-demo,\n.tidal-scope .carousel-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .carousel-demo {\n width: 100%;\n min-width: 0;\n container: carousel-demo / inline-size;\n}\n\n.tidal-scope .carousel-demo-frame {\n width: min(100%, 980px);\n min-width: 0;\n margin-inline: auto;\n padding: 18px;\n border: 1px solid var(--t-border);\n border-radius: 22px;\n background:\n linear-gradient(var(--t-border) 1px, transparent 1px) 0 0 / 32px 32px,\n linear-gradient(90deg, var(--t-border) 1px, transparent 1px) 0 0 / 32px 32px,\n var(--t-subtle);\n color: var(--t-ink);\n}\n\n.tidal-scope .carousel-demo-bar {\n display: flex;\n min-width: 0;\n min-height: 48px;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n margin-bottom: 10px;\n padding: 8px 11px;\n border: 1px solid var(--t-border);\n border-radius: 12px;\n background: var(--t-surface);\n}\n\n.tidal-scope .carousel-demo-bar > div {\n display: flex;\n min-width: 0;\n align-items: center;\n gap: 8px;\n}\n\n.tidal-scope .carousel-demo-bar > div > span {\n width: 10px;\n height: 10px;\n flex: none;\n border: 2px solid var(--t-ink);\n border-radius: 50%;\n box-shadow: inset 0 0 0 2px var(--t-surface);\n background: var(--t-ink);\n}\n\n.tidal-scope .carousel-demo-bar :is(strong, span) {\n min-width: 0;\n font-size: 11px;\n line-height: 1.4;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .carousel-demo-bar > span {\n color: var(--t-muted);\n text-align: end;\n}\n\n.tidal-scope .carousel-demo-slide {\n min-width: 0;\n min-height: 306px;\n padding: clamp(16px, 3.6cqi, 28px);\n background: var(--t-surface);\n}\n\n.tidal-scope .carousel-demo-slide > header {\n display: flex;\n min-width: 0;\n align-items: flex-start;\n justify-content: space-between;\n gap: 18px;\n padding-bottom: 17px;\n border-bottom: 1px solid var(--t-border);\n}\n\n.tidal-scope .carousel-demo-slide > header > div {\n display: grid;\n min-width: 0;\n gap: 4px;\n}\n\n.tidal-scope .carousel-demo-slide > header span {\n color: var(--t-muted);\n font-size: 11px;\n font-weight: 720;\n letter-spacing: 0.1em;\n line-height: 1.35;\n text-transform: uppercase;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .carousel-demo-slide > header h2 {\n margin: 0;\n font-size: clamp(24px, 5cqi, 38px);\n font-weight: 560;\n letter-spacing: -0.052em;\n line-height: 1;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .carousel-demo-slide > header > strong {\n flex: none;\n font-size: clamp(24px, 5cqi, 38px);\n font-variant-numeric: tabular-nums;\n font-weight: 540;\n letter-spacing: -0.06em;\n line-height: 1;\n}\n\n.tidal-scope .carousel-demo-progress {\n height: 7px;\n margin-top: 17px;\n overflow: hidden;\n border-radius: 99px;\n background: var(--t-wash);\n}\n\n.tidal-scope .carousel-demo-progress > span {\n display: block;\n height: 100%;\n border-radius: inherit;\n background: var(--t-ink);\n transition: width 420ms var(--t-ease-out);\n}\n\n.tidal-scope .carousel-demo-overview fieldset {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 7px;\n margin: 14px 0 0;\n padding: 0;\n border: 0;\n}\n\n.tidal-scope .carousel-demo-overview legend {\n position: absolute;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n.tidal-scope .carousel-demo-overview label {\n display: grid;\n min-width: 0;\n min-height: 48px;\n grid-template-columns: 44px minmax(0, 1fr);\n align-items: center;\n gap: 9px;\n padding: 2px 10px 2px 2px;\n border: 1px solid var(--t-border);\n border-radius: 10px;\n background: var(--t-surface);\n cursor: pointer;\n}\n\n.tidal-scope .carousel-demo-overview input {\n position: absolute;\n width: 1px;\n height: 1px;\n opacity: 0;\n}\n\n.tidal-scope .carousel-demo-overview label > span {\n display: grid;\n width: 44px;\n height: 44px;\n place-items: center;\n border: 1px solid var(--t-border);\n border-radius: 8px;\n background: var(--t-subtle);\n transition:\n color 180ms,\n background 180ms,\n transform 280ms var(--t-ease-spring);\n}\n\n.tidal-scope .carousel-demo-overview label > span::after {\n width: 11px;\n height: 6px;\n border-block-end: 2px solid currentColor;\n border-left: 2px solid currentColor;\n content: \"\";\n opacity: 0;\n transform: rotate(-45deg) scale(0.55);\n transition:\n opacity 160ms,\n transform 280ms var(--t-ease-spring);\n}\n\n.tidal-scope .carousel-demo-overview label[data-checked] > span {\n background: var(--t-ink);\n color: var(--t-surface);\n}\n\n.tidal-scope .carousel-demo-overview label[data-checked] > span::after {\n opacity: 1;\n transform: rotate(-45deg) scale(1);\n}\n\n.tidal-scope .carousel-demo-overview label > strong {\n min-width: 0;\n font-size: 11px;\n line-height: 1.4;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .carousel-demo-overview input:focus-visible + span {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n.tidal-scope .carousel-demo-file-layout {\n display: grid;\n min-width: 0;\n grid-template-columns: minmax(0, 1fr) minmax(180px, 0.7fr);\n gap: 10px;\n margin-top: 17px;\n}\n\n.tidal-scope .carousel-demo-file-list {\n display: grid;\n min-width: 0;\n gap: 5px;\n}\n\n.tidal-scope .carousel-demo-file-list button {\n display: grid;\n min-width: 0;\n min-height: 48px;\n grid-template-columns: 32px minmax(0, 1fr);\n align-items: center;\n gap: 9px;\n padding: 7px 10px;\n border: 1px solid var(--t-border);\n border-radius: 9px;\n background: var(--t-surface);\n color: var(--t-ink);\n font: inherit;\n text-align: start;\n cursor: pointer;\n}\n\n.tidal-scope .carousel-demo-file-list button[data-selected] {\n border-color: var(--t-ink);\n background: var(--t-ink);\n color: var(--t-surface);\n}\n\n.tidal-scope .carousel-demo-file-list button > span {\n width: 25px;\n height: 30px;\n border: 1px solid currentColor;\n border-radius: 4px;\n opacity: 0.7;\n}\n\n.tidal-scope .carousel-demo-file-list button > strong {\n min-width: 0;\n font-size: 11px;\n line-height: 1.4;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .carousel-demo-file-layout aside {\n display: grid;\n min-width: 0;\n align-content: end;\n gap: 7px;\n padding: 16px;\n border: 1px solid var(--t-border);\n border-radius: 10px;\n background: var(--t-subtle);\n}\n\n.tidal-scope .carousel-demo-file-layout aside :is(span, strong, small) {\n min-width: 0;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .carousel-demo-file-layout aside span,\n.tidal-scope .carousel-demo-file-layout aside small {\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.5;\n}\n\n.tidal-scope .carousel-demo-file-layout aside strong {\n font-size: 15px;\n line-height: 1.25;\n}\n\n.tidal-scope .carousel-demo-notes > label {\n display: grid;\n min-width: 0;\n gap: 7px;\n margin-top: 17px;\n}\n\n.tidal-scope .carousel-demo-notes > label > span {\n font-size: 11px;\n font-weight: 700;\n}\n\n.tidal-scope .carousel-demo-notes textarea {\n width: 100%;\n min-width: 0;\n min-height: 96px;\n resize: vertical;\n padding: 12px;\n border: 1px solid var(--t-border-strong);\n border-radius: 10px;\n background: var(--t-surface);\n color: var(--t-ink);\n font: inherit;\n font-size: 16px;\n line-height: 1.5;\n}\n\n.tidal-scope .carousel-demo-notes > div:last-child {\n display: grid;\n min-width: 0;\n grid-template-columns: minmax(0, 1fr) auto;\n align-items: center;\n gap: 10px;\n margin-top: 10px;\n}\n\n.tidal-scope .carousel-demo-notes p {\n min-width: 0;\n margin: 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.5;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .carousel-demo-notes p strong {\n color: var(--t-ink);\n}\n\n.tidal-scope .carousel-demo-notes button {\n min-width: 130px;\n min-height: 44px;\n padding: 8px 12px;\n border: 1px solid var(--t-ink);\n border-radius: 10px;\n background: var(--t-ink);\n color: var(--t-surface);\n font: inherit;\n font-size: 11px;\n font-weight: 680;\n cursor: pointer;\n}\n\n.tidal-scope .carousel-demo-file-list button:focus-visible,\n.tidal-scope .carousel-demo-notes :is(textarea, button):focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n.tidal-scope .carousel-demo-footer {\n min-width: 0;\n padding: 10px 12px 0;\n}\n\n.tidal-scope .carousel-demo-footer p {\n margin: 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.5;\n overflow-wrap: anywhere;\n}\n\n@container carousel-demo (max-width: 560px) {\n .tidal-scope .carousel-demo-frame {\n padding: 8px;\n border-radius: 16px;\n }\n\n .tidal-scope .carousel-demo-bar {\n align-items: flex-start;\n flex-direction: column;\n gap: 3px;\n }\n\n .tidal-scope .carousel-demo-bar > span {\n padding-inline-start: 18px;\n text-align: start;\n }\n\n .tidal-scope .carousel-demo-slide {\n min-height: 0;\n padding: 14px;\n }\n\n .tidal-scope .carousel-demo-overview fieldset,\n .tidal-scope .carousel-demo-file-layout,\n .tidal-scope .carousel-demo-notes > div:last-child {\n grid-template-columns: minmax(0, 1fr);\n }\n\n .tidal-scope .carousel-demo-file-layout aside {\n min-height: 94px;\n }\n\n .tidal-scope .carousel-demo-notes button {\n width: 100%;\n }\n}\n\n@container carousel-demo (max-width: 360px) {\n .tidal-scope .carousel-demo-slide > header {\n gap: 10px;\n }\n\n .tidal-scope .carousel-demo-slide > header h2,\n .tidal-scope .carousel-demo-slide > header > strong {\n font-size: 27px;\n }\n}\n\n@media (hover: none) and (pointer: coarse) {\n .tidal-scope .carousel-demo-file-list button,\n .tidal-scope .carousel-demo-notes button {\n font-size: 16px;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tidal-scope .carousel-demo-progress > span,\n .tidal-scope .carousel-demo-overview label > span,\n .tidal-scope .carousel-demo-overview label > span::after {\n transition: none;\n }\n}"; const INITIAL_CHECKS = { brief: true, cover: true, links: false, approval: false, }; const FILES = [ { id: "brief", name: "Launch brief.pdf", detail: "12 pages · 2.4 MB" }, { id: "cover", name: "Cover study.png", detail: "2400 × 1600 · 4.8 MB" }, { id: "notes", name: "Release notes.txt", detail: "18 KB · 34 lines" }, ] as const; export function CarouselDemo() { const [currentSlideId, setCurrentSlideId] = useState("overview"); const [checks, setChecks] = useState(INITIAL_CHECKS); const [selectedFileId, setSelectedFileId] = useState("brief"); const [note, setNote] = useState( "Confirm the final support link before the sample release review.", ); const [savedNote, setSavedNote] = useState(note); const [message, setMessage] = useState( "Overview is open with two of four checks complete.", ); const completeCount = Object.values(checks).filter(Boolean).length; const selectedFile = FILES.find((file) => file.id === selectedFileId)!; const slides = useMemo( () => [ { id: "overview", label: "Overview", controlLabel: "Overview", content: (
Release 1.8

Overview

{completeCount} / 4
Release checks {( [ ["brief", "Brief reviewed"], ["cover", "Cover approved"], ["links", "Support links checked"], ["approval", "Final approval recorded"], ] as const ).map(([key, label]) => ( ))}
), }, { id: "files", label: "Files", controlLabel: "Files", content: (
Three sample assets

Files

03
{FILES.map((file) => ( ))}
), }, { id: "notes", label: "Notes", controlLabel: "Notes", content: (
Review note

Notes

{String(note.length).padStart(2, "0")}