{
  "component": {
    "id": "newsletter-signup",
    "name": "Newsletter signup",
    "tier": "pro",
    "exampleId": "newsletter-signup",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/newsletter-signup-demo.tsx",
    "exportName": "NewsletterSignupDemo",
    "sha256": "ab6f8fc0a39694465e54a5c2d121877b53def5f805414490909b600f35f14733",
    "helperImports": [],
    "directComponentImports": [
      "newsletter-signup"
    ],
    "sampleBoundary": "Existing local demo fixture with fictional data and callbacks. No live service, customer data, access key, or Pro source is included."
  },
  "install": {
    "command": "npx shadcn@latest add @tidal-pro/newsletter-signup",
    "registryUrl": "https://tidalui.com/r/pro/newsletter-signup.json",
    "namespace": "@tidal-pro",
    "access": "pro",
    "sourceDelivery": "server-gated",
    "requiresAuthorization": true,
    "tokenSource": "local-env",
    "tokenEnvName": "TIDALUI_TOKEN",
    "cli": {
      "package": "shadcn",
      "requested": "latest"
    }
  },
  "installPlan": [
    {
      "order": 1,
      "kind": "primary",
      "dependency": "@tidal-pro/newsletter-signup",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/newsletter-signup",
      "registryUrl": "https://tidalui.com/r/pro/newsletter-signup.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/newsletter-signup.tsx",
    "exports": [
      "TidalNewsletterSignup",
      "TidalNewsletterSignupStatus"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/newsletter-signup.css",
      "components/ui/form-field.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [
      "lucide-react"
    ],
    "registry": [
      "https://tidalui.com/r/form-field.json"
    ],
    "additionalRegistry": [],
    "installClosure": [
      "form-field",
      "newsletter-signup"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/newsletter-signup.css",
      "components/ui/form-field.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/newsletter-signup.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/newsletter-signup-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "\"use client\";\n\nimport \"./components/ui/tidal.css\";\n\nimport { useEffect, useLayoutEffect, useRef, useState, type FormEvent, type InvalidEvent, type ReactNode } from \"react\";\n\nimport { RotateCcw } from \"lucide-react\";\n\nimport { TidalNewsletterSignup, type TidalNewsletterSignupStatus } from \"./components/ui/newsletter-signup\";\n\nimport \"./components/ui/newsletter-signup.css\";\n\nimport \"./components/ui/form-field.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .newsletter-signup-demo {\\n  width: 100%;\\n  max-width: 980px;\\n  min-width: 0;\\n  padding: 28px;\\n  border: 1px solid var(--t-border);\\n  border-radius: 18px;\\n  background:\\n    linear-gradient(var(--t-border) 1px, transparent 1px),\\n    linear-gradient(90deg, var(--t-border) 1px, transparent 1px),\\n    var(--t-subtle);\\n  background-size: 24px 24px;\\n  color: var(--t-ink);\\n  container-type: inline-size;\\n}\\n\\n.tidal-scope .newsletter-signup-demo,\\n.tidal-scope .newsletter-signup-demo * {\\n  box-sizing: border-box;\\n}\\n\\n.tidal-scope .newsletter-signup-demo-layout {\\n  min-width: 0;\\n}\\n\\n.tidal-scope .newsletter-signup-demo-layout > .tidal-newsletter-signup {\\n  max-width: none;\\n}\\n\\n.tidal-scope .newsletter-signup-demo-footer {\\n  display: flex;\\n  align-items: center;\\n  justify-content: space-between;\\n  gap: 12px;\\n  min-width: 0;\\n}\\n\\n.tidal-scope .newsletter-signup-demo-footer > span {\\n  min-width: 0;\\n  overflow-wrap: anywhere;\\n}\\n\\n.tidal-scope .newsletter-signup-demo-footer > button {\\n  display: inline-flex;\\n  align-items: center;\\n  justify-content: center;\\n  gap: 7px;\\n  min-width: 44px;\\n  min-height: 44px;\\n  flex: none;\\n  padding: 8px 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  font-size: 11px;\\n  cursor: pointer;\\n  transition:\\n    background 160ms,\\n    transform 140ms var(--t-ease-out);\\n}\\n\\n.tidal-scope .newsletter-signup-demo-footer > button:hover {\\n  background: var(--t-wash);\\n}\\n\\n.tidal-scope .newsletter-signup-demo-footer > button:active {\\n  transform: scale(0.98);\\n}\\n\\n.tidal-scope .newsletter-signup-demo-footer > button:focus-visible {\\n  outline: 2px solid var(--t-accent);\\n  outline-offset: 3px;\\n}\\n\\n@container (max-width: 500px) {\\n  .tidal-scope .newsletter-signup-demo-layout {\\n    min-width: 0;\\n  }\\n\\n  .tidal-scope .newsletter-signup-demo-footer {\\n    align-items: flex-start;\\n    flex-direction: column;\\n  }\\n\\n  .tidal-scope .newsletter-signup-demo-footer > button {\\n    width: 100%;\\n  }\\n}\\n\\n@media (max-width: 390px) {\\n  .tidal-scope .newsletter-signup-demo {\\n    padding: 10px;\\n    background-size: 18px 18px;\\n  }\\n}\\n\\n@media (prefers-reduced-motion: reduce) {\\n  .tidal-scope .newsletter-signup-demo-footer > button {\\n    transition: none;\\n  }\\n\\n  .tidal-scope .newsletter-signup-demo-footer > button:active {\\n    transform: none;\\n  }\\n}\";\n\nexport function NewsletterSignupDemo() {\n  const [email, setEmail] = useState(\"\");\n  const [emailError, setEmailError] = useState(\"\");\n  const [status, setStatus] = useState<TidalNewsletterSignupStatus>(\"idle\");\n  const [statusMessage, setStatusMessage] = useState<ReactNode>(null);\n  const [notice, setNotice] = useState(\n    \"Use sample values only. No newsletter service is connected.\",\n  );\n  const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n  const emailInput = useRef<HTMLInputElement>(null);\n  const statusRegion = useRef<HTMLDivElement>(null);\n  const focusEmailOnIdle = useRef(false);\n  const [errorFocusVersion, setErrorFocusVersion] = useState(0);\n\n  useEffect(() => () => clearTimeout(timer.current), []);\n\n  useLayoutEffect(() => {\n    if (status === \"success\" && document.activeElement === document.body) {\n      statusRegion.current\n        ?.querySelector<HTMLButtonElement>(\"button\")\n        ?.focus({ preventScroll: true });\n    }\n    if (status === \"error\") {\n      statusRegion.current?.focus({ preventScroll: true });\n      return;\n    }\n    if (status === \"idle\" && focusEmailOnIdle.current) {\n      focusEmailOnIdle.current = false;\n      emailInput.current?.focus({ preventScroll: true });\n    }\n  }, [errorFocusVersion, status]);\n\n  function cancelPendingForEdit() {\n    clearTimeout(timer.current);\n    if (status === \"pending\") {\n      setNotice(\"Local preparation cancelled because the sample changed.\");\n    } else if (status !== \"idle\") {\n      setNotice(\"Sample is ready to prepare again locally.\");\n    }\n    setStatus(\"idle\");\n    setStatusMessage(null);\n  }\n\n  function handleInvalid(event: InvalidEvent<HTMLInputElement>) {\n    event.preventDefault();\n    clearTimeout(timer.current);\n    const message = event.currentTarget.validity.valueMissing\n      ? \"Add a sample email address.\"\n      : \"Use a complete sample email address.\";\n    setEmailError(message);\n    setStatus(\"error\");\n    setStatusMessage(\"Review the sample email before preparing it locally.\");\n    setNotice(\"Native email validation stopped local preparation.\");\n    setErrorFocusVersion((current) => current + 1);\n  }\n\n  function handleSubmit(event: FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    clearTimeout(timer.current);\n    setEmailError(\"\");\n    setStatus(\"pending\");\n    setStatusMessage(\"Preparing this sample locally. Nothing is being sent.\");\n    setNotice(\"Local preparation is in progress.\");\n    timer.current = setTimeout(() => {\n      setStatus(\"success\");\n      setStatusMessage(\n        \"Sample prepared locally. No signup, message, or subscription was created.\",\n      );\n      setNotice(\"Local preparation completed without a network request.\");\n    }, 720);\n  }\n\n  function handleReset(event: FormEvent<HTMLFormElement>) {\n    if (event.defaultPrevented) return;\n    clearTimeout(timer.current);\n    setEmail(\"\");\n    setEmailError(\"\");\n    setStatus(\"idle\");\n    setStatusMessage(null);\n    setNotice(\"Sample cleared. No newsletter service is connected.\");\n    focusEmailOnIdle.current = false;\n    emailInput.current?.focus({ preventScroll: true });\n  }\n\n  function handleStatusAction(\n    current: Exclude<TidalNewsletterSignupStatus, \"idle\">,\n  ) {\n    clearTimeout(timer.current);\n    if (current === \"error\") {\n      emailInput.current?.focus({ preventScroll: true });\n      return;\n    }\n    setStatus(\"idle\");\n    setStatusMessage(null);\n    setNotice(\n      current === \"pending\"\n        ? \"Local preparation cancelled. The sample was not sent or saved.\"\n        : \"Edit the sample and prepare it again when ready.\",\n    );\n    focusEmailOnIdle.current = true;\n  }\n\n  const statusActionLabel =\n    status === \"pending\"\n      ? \"Cancel\"\n      : status === \"error\"\n        ? \"Review email\"\n        : status === \"success\"\n          ? \"Edit sample\"\n          : undefined;\n\n  return (\n    <section className=\"newsletter-signup-demo\">\n      <div className=\"newsletter-signup-demo-layout\">\n        <TidalNewsletterSignup\n          title=\"Useful product notes, once a month.\"\n          description=\"A focused email block for product updates. This local preview validates and prepares a sample without creating a signup.\"\n          emailLabel=\"Work email\"\n          emailDescription=\"Use a fictional address for this local preview.\"\n          emailError={emailError}\n          emailRef={emailInput}\n          emailInputProps={{\n            value: email,\n            placeholder: \"name@example.com\",\n            inputMode: \"email\",\n            onChange: (event: import(\"react\").ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n              setEmail(event.target.value);\n              setEmailError(\"\");\n              cancelPendingForEdit();\n            },\n            onInvalid: handleInvalid,\n          }}\n          status={status}\n          statusMessage={statusMessage}\n          statusRef={statusRegion}\n          statusActionLabel={statusActionLabel}\n          onStatusAction={handleStatusAction}\n          submitLabel=\"Prepare sample\"\n          pendingLabel=\"Preparing locally\"\n          onSubmit={handleSubmit}\n          onReset={handleReset}\n          consent=\"Consent and privacy language belongs to the consumer. This preview creates no subscription.\"\n          footer={\n            <div className=\"newsletter-signup-demo-footer\">\n              <span role=\"status\" aria-live=\"polite\">\n                {notice}\n              </span>\n              <button type=\"reset\">\n                <RotateCcw size={14} aria-hidden=\"true\" />\n                Clear sample\n              </button>\n            </div>\n          }\n        />\n      </div>\n    </section>\n  );\n}\n\nexport default function AgentExample() {\n  return (\n    <div className=\"tidal-scope\" data-theme=\"light\" dir=\"ltr\">\n      <style>{tidalExampleStyles}</style>\n      <NewsletterSignupDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/newsletter-signup.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "emailError",
      "type": "inferred-from-existing-demo",
      "initial": "\"\"",
      "setter": "setEmailError",
      "proposalCanBeRejected": false
    },
    {
      "prop": "status",
      "type": "inferred-from-existing-demo",
      "initial": "\"idle\"",
      "setter": "setStatus",
      "proposalCanBeRejected": false
    },
    {
      "prop": "statusMessage",
      "type": "inferred-from-existing-demo",
      "initial": "null",
      "setter": "setStatusMessage",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onReset",
      "nativeType": "React synthetic event or native callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onStatusAction",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onSubmit",
      "nativeType": "React synthetic event or native callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    }
  ],
  "nativeForm": {
    "participates": true,
    "names": [],
    "expectedFormData": {},
    "submitBehavior": "The existing demo's native form callback receives the submit event.",
    "resetBehavior": "Native reset behavior remains available where the demo renders a resettable control.",
    "disabledBehavior": "Disabled controls remain excluded from successful native form submission.",
    "readOnlyBehavior": "Read-only controls retain their value and remain inspectable by the consumer."
  },
  "accessibility": {
    "labelSource": "Consumer-provided label remains required where the component API requires one.",
    "semantics": "Preserve the component's native element and the semantics demonstrated by the source fixture.",
    "keyboard": [
      "Tab and Shift+Tab",
      "Enter or Space for native activation",
      "Arrow keys where the component exposes a composite control"
    ],
    "focusReturn": "Preserve browser focus order and visible focus.",
    "errorAnnouncement": "The existing error or alert path remains consumer-owned and should be announced by the rendered semantics.",
    "reducedMotion": "Verify prefers-reduced-motion with the existing component transition path.",
    "forcedColors": "Verify visible borders, text, and focus in forced-colors mode."
  },
  "responsive": {
    "widths": [
      320,
      390,
      768,
      1260
    ],
    "shortViewport": "Check the example at a 300px viewport height with keyboard or portal content visible.",
    "overflow": "The page should not gain horizontal overflow; component-local scrolling must remain intentional.",
    "touchTargetMinPx": 44,
    "coarseInputFontPx": 16
  },
  "errors": [
    {
      "fixture": "Exercise the existing demo's error, empty, loading, or invalid fixture.",
      "visibleResult": "The consumer-visible result must remain explicit and must not be replaced by a silent console error.",
      "focusResult": "Focus must remain on the triggering control or move to the announced error according to the native pattern.",
      "ownership": "Consumer-owned sample state only; no network request or customer data is used."
    }
  ],
  "verification": {
    "commands": [
      "npx tsc --noEmit",
      "npx vite build"
    ],
    "lockfile": "Use the consumer project's committed lockfile.",
    "browser": [
      "Chromium 1260x800",
      "Chromium 390x844",
      "Keyboard and reduced-motion pass"
    ]
  },
  "validation": {
    "consumerFixture": {
      "tsc": "pass",
      "viteBuild": "pass",
      "resourceModel": "Generated usage plus only the component files and CSS delivered by the primary item and listed registry dependencies."
    },
    "registryArtifact": "server-gated"
  },
  "exceptions": []
}
