"use client"; import "./components/ui/tidal.css"; import { useId, useState } from "react"; import { TidalColorPicker } from "./components/ui/color-picker"; import "./components/ui/color-picker.css"; const tidalExampleStyles = ".tidal-scope .color-picker-demo,\n.tidal-scope .color-picker-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .color-picker-demo {\n width: 100%;\n min-width: 0;\n container: color-picker-demo / inline-size;\n}\n\n.tidal-scope .color-picker-demo-frame {\n min-width: 0;\n padding: 20px;\n border: 1px solid var(--t-border);\n border-radius: 22px;\n background: var(--t-subtle);\n}\n\n.tidal-scope .color-picker-demo-frame form {\n min-width: 0;\n margin: 0;\n}\n\n@container color-picker-demo (max-width: 520px) {\n .tidal-scope .color-picker-demo-frame {\n padding: 8px;\n }\n}"; const PRESETS = [ { id: "ink", value: "#171717", label: "Ink" }, { id: "graphite", value: "#525252", label: "Graphite" }, { id: "silver", value: "#a3a3a3", label: "Silver" }, { id: "white", value: "#ffffff", label: "White" }, ] as const; export function ColorPickerDemo() { const generatedId = useId().replace(/:/g, ""); const formId = `color-picker-${generatedId}-form`; const [value, setValue] = useState("#171717"); const [message, setMessage] = useState("Ink selected."); return (
event.preventDefault()} onReset={() => { setValue("#171717"); setMessage("Color reset to Ink."); }} > { setValue(nextValue); setMessage( source === "preset" ? "Preset selected." : source === "color" ? "Color updated." : "Hex color updated.", ); }} presets={PRESETS.map((preset) => ({ ...preset, accessibleLabel: `Use ${preset.label}, ${preset.value}`, }))} required hint="Use six hexadecimal digits, such as #171717." colorInputProps={{ name: "sampleColor", form: formId }} hexInputProps={{ name: "sampleHex", form: formId }} resetAction={{ label: "Reset color", accessibleLabel: "Reset color to Ink", buttonProps: { form: formId }, }} footer={ {message} Sample data. Changes stay in this preview. } />
); } export default function AgentExample() { return (
); }