import "./components/ui/tidal.css"; import { useState } from "react"; import { TidalAspectRatio } from "./components/ui/aspect-ratio"; import "./components/ui/aspect-ratio.css"; function tidalExampleAvatarDataUri(seed: unknown) { const text = String(seed).replace(/[^a-z0-9]/gi, "").slice(-2) || "UI"; const palette = ["#333333", "#555555", "#777777", "#999999", "#bbbbbb"]; const color = palette[Array.from(text).reduce((sum, character) => sum + character.charCodeAt(0), 0) % palette.length]; const svg = ``; return `data:image/svg+xml,${encodeURIComponent(svg)}`; } function tidalExampleImageDataUri(label: string) { const safeLabel = label.replace(/[<>&]/g, "").slice(0, 28) || "Sample image"; const svg = ``; return `data:image/svg+xml,${encodeURIComponent(svg)}`; } const tidalExampleStyles = ".tidal-scope .aspect-ratio-demo {\n width: min(100%, 390px);\n min-width: 0;\n}\n.tidal-scope .aspect-ratio-demo-options {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-bottom: 16px;\n}\n.tidal-scope .aspect-ratio-demo-options button {\n min-width: 56px;\n min-height: 44px;\n border: 1px solid var(--t-border);\n border-radius: 9px;\n background: var(--t-surface);\n color: var(--t-muted);\n font: inherit;\n font-size: 12px;\n cursor: pointer;\n}\n.tidal-scope .aspect-ratio-demo-options button[aria-pressed=\"true\"] {\n background: var(--t-ink);\n color: var(--t-surface);\n border-color: var(--t-ink);\n}\n.tidal-scope .aspect-ratio-demo-options button:focus-visible {\n outline: 2px solid var(--t-ink);\n outline-offset: 3px;\n}\n.tidal-scope .aspect-ratio-demo figure {\n margin: 0;\n}\n.tidal-scope .aspect-ratio-demo .tidal-aspect-ratio {\n border-radius: 16px;\n background: var(--t-soft);\n}\n.tidal-scope .aspect-ratio-demo img {\n object-position: 50% 38%;\n}\n.tidal-scope .aspect-ratio-demo figcaption {\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n gap: 8px;\n margin-top: 12px;\n color: var(--t-muted);\n font-size: 12px;\n line-height: 1.6;\n}"; const ratios = [ { label: "16:9", value: 16 / 9 }, { label: "4:3", value: 4 / 3 }, { label: "1:1", value: 1 }, ]; export function AspectRatioDemo() { const [ratio, setRatio] = useState(ratios[0]); return (