"use client"; import "./components/ui/tidal.css"; import { useId, useMemo, useState } from "react"; import { TidalBillingOverview, type TidalBillingAllowance, type TidalBillingInvoice } from "./components/ui/billing-overview"; import "./components/ui/billing-overview.css"; const tidalExampleStyles = ".tidal-scope .billing-overview-demo,\n.tidal-scope .billing-overview-demo * {\n box-sizing: border-box;\n}\n\n.tidal-scope .billing-overview-demo {\n width: 100%;\n max-width: 1160px;\n min-width: 0;\n container: billing-overview-demo / inline-size;\n}\n\n.tidal-scope .billing-overview-demo-frame {\n display: grid;\n width: 100%;\n min-width: 0;\n gap: 13px;\n padding: 20px;\n border: 1px solid var(--t-border);\n border-radius: 22px;\n background: var(--t-subtle);\n color: var(--t-ink);\n}\n\n.tidal-scope .billing-overview-demo-details {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 10px;\n}\n\n.tidal-scope .billing-overview-demo-details article {\n min-width: 0;\n padding: 18px 20px;\n border: 1px solid var(--t-border);\n border-radius: 18px;\n background: var(--t-surface);\n scroll-margin-block: 18px;\n}\n\n.tidal-scope .billing-overview-demo-details article:focus-visible {\n outline: 2px solid var(--t-accent);\n outline-offset: 3px;\n}\n\n.tidal-scope .billing-overview-demo-details article > span {\n color: var(--t-muted);\n font-size: 11px;\n font-weight: 680;\n letter-spacing: 0.09em;\n line-height: 1.35;\n text-transform: uppercase;\n}\n\n.tidal-scope .billing-overview-demo-details h3 {\n margin: 7px 0 0;\n font-size: 17px;\n font-weight: 650;\n letter-spacing: -0.035em;\n line-height: 1.25;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .billing-overview-demo-details p {\n margin: 7px 0 0;\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.55;\n overflow-wrap: anywhere;\n}\n\n.tidal-scope .billing-overview-demo-details dl {\n display: flex;\n gap: 18px;\n margin: 13px 0 0;\n}\n\n.tidal-scope .billing-overview-demo-details dl > div {\n min-width: 0;\n}\n\n.tidal-scope .billing-overview-demo-details dt {\n color: var(--t-muted);\n font-size: 11px;\n line-height: 1.35;\n}\n\n.tidal-scope .billing-overview-demo-details dd {\n margin: 3px 0 0;\n font-size: 11px;\n line-height: 1.4;\n overflow-wrap: anywhere;\n}\n\n@container billing-overview-demo (max-width: 520px) {\n .tidal-scope .billing-overview-demo-frame {\n gap: 9px;\n padding: 8px;\n }\n\n .tidal-scope .billing-overview-demo-details {\n grid-template-columns: minmax(0, 1fr);\n }\n\n .tidal-scope .billing-overview-demo-details article {\n padding: 16px;\n }\n}"; const PERIOD_ALLOWANCES: Record< "current" | "previous", readonly TidalBillingAllowance[] > = { current: [ { id: "briefs", label: "Sample briefs", valueLabel: "18 of 30", used: 18, limit: 30, description: "Fictional allowance for the current preview period.", }, { id: "exports", label: "Sample exports", valueLabel: "7 of 20", used: 7, limit: 20, description: "Local display data with no metered service attached.", }, { id: "review-hours", label: "Review hours", valueLabel: "12 of 40", used: 12, limit: 40, description: "A fictional time allowance for layout review.", }, { id: "archive-space", label: "Archive space", valueLabel: "4.2 of 10 GB", used: 4.2, limit: 10, description: "No file storage is measured by this preview.", }, ], previous: [ { id: "briefs", label: "Sample briefs", valueLabel: "24 of 30", used: 24, limit: 30, description: "Fictional allowance for the previous preview period.", }, { id: "exports", label: "Sample exports", valueLabel: "15 of 20", used: 15, limit: 20, description: "Local display data with no metered service attached.", }, { id: "review-hours", label: "Review hours", valueLabel: "31 of 40", used: 31, limit: 40, description: "A fictional time allowance for layout review.", }, { id: "archive-space", label: "Archive space", valueLabel: "6.8 of 10 GB", used: 6.8, limit: 10, description: "No file storage is measured by this preview.", }, ], }; interface InvoiceSeed { id: string; label: string; accessibleLabel: string; date: string; total: string; status: string; note: string; } const INVOICES: readonly InvoiceSeed[] = [ { id: "sample-1048", label: "Sample invoice 1048", accessibleLabel: "Sample invoice 1048", date: "October 1 sample", total: "$24.00 fictional", status: "Preview only", note: "A fictional monthly plan line with no payment transaction.", }, { id: "sample-1036", label: "Sample invoice 1036", accessibleLabel: "Sample invoice 1036", date: "September 1 sample", total: "$24.00 fictional", status: "Preview only", note: "A local invoice preview supplied directly to the component.", }, { id: "sample-1024", label: "Sample invoice 1024", accessibleLabel: "Sample invoice 1024", date: "August 1 sample", total: "$24.00 fictional", status: "Preview only", note: "No receipt, charge, account, or downloadable document exists.", }, ]; export function BillingOverviewDemo() { const generatedId = useId().replace(/:/g, ""); const planDetailId = `billing-${generatedId}-plan-detail`; const invoicePreviewId = `billing-${generatedId}-invoice-preview`; const [period, setPeriod] = useState<"current" | "previous">("current"); const [planDetailsShown, setPlanDetailsShown] = useState(false); const [selectedInvoiceId, setSelectedInvoiceId] = useState( null, ); const [message, setMessage] = useState( "Current fictional usage period selected.", ); const invoices = useMemo( () => INVOICES.map((invoice) => ({ ...invoice, destination: { href: `#${invoicePreviewId}`, label: `Preview ${invoice.accessibleLabel} on this page`, linkProps: { onClick: () => { setSelectedInvoiceId(invoice.id); setMessage(`${invoice.label} opened in the local preview.`); }, }, }, })), [invoicePreviewId], ); const selectedInvoice = INVOICES.find( (invoice) => invoice.id === selectedInvoiceId, ); return (
{ setPlanDetailsShown(true); setMessage( "Additional fictional plan details are visible locally.", ); }, }, }, }} allowances={PERIOD_ALLOWANCES[period]} invoices={invoices} invoiceCaption="Invoice history" periodControl={{ value: period, options: [ { value: "current", label: "Current period" }, { value: "previous", label: "Previous period" }, ], onValueChange: (value) => { const nextPeriod = value === "previous" ? "previous" : "current"; setPeriod(nextPeriod); setMessage( nextPeriod === "current" ? "Current fictional usage period selected." : "Previous fictional usage period selected.", ); }, }} footer={ {message} {" "} Sample billing data. No charge, purchase, or stored change occurs. } />
{planDetailsShown ? (
Plan detail

Studio

The expanded terms are now visible in the plan summary.

) : null}
{selectedInvoice ? (
Invoice preview

{selectedInvoice.label}

{selectedInvoice.note}

Date
{selectedInvoice.date}
Total
{selectedInvoice.total}
) : null}
); } export default function AgentExample() { return (
); }