{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "newsletter-signup",
  "type": "registry:item",
  "title": "Newsletter Signup",
  "description": "An email signup: a heading, a line on what people get, one email field and a button. It checks the address with the browser's own validation, fires `subscribe` with it, and says thank you in place (announced). Without JavaScript it's a plain form that posts to `action`.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "section"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/newsletter-signup.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/newsletter-signup.js",
      "content": "// Generated by zubra from newsletter-signup.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { emit, id } from '@zubra/runtime';\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"newsletter-signup\";\n\nexport default $define(tag, {\n  props: {\n    \"heading\": { attribute: \"heading\", default: \"Get the newsletter\", required: false },\n    \"text\": { attribute: \"text\", default: \"\", required: false },\n    \"button\": { attribute: \"button\", default: \"Subscribe\", required: false },\n    \"thanks\": { attribute: \"thanks\", default: \"Thanks! Check your inbox to confirm.\", required: false },\n    \"note\": { attribute: \"note\", default: \"\", required: false },\n    \"action\": { attribute: \"action\", default: \"\", required: false },\n    \"name\": { attribute: \"name\", default: \"email\", required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [],\n  events: [\"subscribe\"],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (newsletter-signup) to ([data-zb-slotted=\\\"newsletter-signup\\\"]) {\\n  :scope { display: block; }\\n  .signup { display: grid; gap: 0.75rem; padding: clamp(1.25rem, 4vw, 2rem); border: 1px solid var(--border, #e4e4e7); border-radius: calc(var(--radius, 0.625rem) * 1.3); background: var(--card, #fff); }\\n  h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.01em; }\\n  .signup-text { margin: 0; color: color-mix(in oklab, var(--muted-foreground, #71717a) 75%, var(--foreground, #18181b)); }\\n  form { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }\\n  input { flex: 1 1 14rem; min-width: 0; padding: 0.6rem 0.8rem; border: 1px solid var(--input, #e4e4e7); border-radius: calc(var(--radius, 0.625rem) * 0.8); background: var(--background, #fff); color: var(--foreground, #18181b); font: inherit; }\\n  input:focus-visible { outline: none; border-color: var(--ring, #a1a1aa); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring, #a1a1aa) 40%, transparent); }\\n  button { padding: 0.6rem 1.1rem; border: 0; border-radius: calc(var(--radius, 0.625rem) * 0.8); background: var(--primary, #18181b); color: var(--primary-foreground, #fafafa); font: inherit; font-weight: 600; cursor: pointer; }\\n  button:focus-visible { outline: 2px solid var(--ring, #a1a1aa); outline-offset: 2px; }\\n  .signup-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\\n  .signup-done { margin: 0; padding: 0.6rem 0.8rem; border-radius: calc(var(--radius, 0.625rem) * 0.8); background: color-mix(in oklab, oklch(0.6 0.15 150) 14%, var(--background, #fff)); font-weight: 600; }\\n  .signup-small { margin: 0; font-size: 0.8rem; color: color-mix(in oklab, var(--muted-foreground, #71717a) 75%, var(--foreground, #18181b)); }\\n}\\n}\\n\",\n  template: \"\\n  <div class=\\\"signup\\\">\\n    <h2></h2>\\n    <!--[--><!--]-->\\n    <div role=\\\"status\\\"><!--[--><!--]--></div>\\n    <!--[--><!--]-->\\n    <!--[--><!--]-->\\n  </div>\\n\",\n  setup($p, $emit) {\n    const emit = $emit;\nfunction __zubraAssign(signal, value) { signal.set(value); return value }\nfunction __zubraUpdate(signal, delta, prefix) { const old = signal.get(); signal.set(old + delta); return prefix ? old + delta : old }\n                                           \n\n  const fieldId = id()\n  const email = __zubraState(\"\")\n  const done = __zubraState(false)\n\n  function submit(event) {\n    event.preventDefault()\n    if (!event.target.reportValidity()) return\n    if (!emit('subscribe', email.get())) return\n    __zubraAssign(done, true)\n  }\n    return [\n      { path: [0, 0], text: () => $t($p.heading) },\n      { path: [0, 1], when: () => $p.text, blocks: [{ template: \"<p class=\\\"signup-text\\\"></p>\", parts: () => [{ path: [0], text: () => $t($p.text) }] }, null] },\n      { path: [0, 2, 0], when: () => $r(done), blocks: [{ template: \"<p class=\\\"signup-done\\\"></p>\", parts: () => [{ path: [0], text: () => $t($p.thanks) }] }, null] },\n      { path: [0, 3], when: () => !($r(done)), blocks: [{ template: \"<form method=\\\"post\\\">\\n      <label class=\\\"signup-label\\\">Email address</label>\\n      <input type=\\\"email\\\" required autocomplete=\\\"email\\\" placeholder=\\\"you@example.com\\\">\\n      <button type=\\\"submit\\\"></button>\\n    </form>\", parts: () => [{ path: [0], attribute: \"action\", url: true, value: () => ($p.action || null) }, { path: [0], on: \"submit\", handler: () => $r(submit) }, { path: [0, 0], attribute: \"for\", value: () => $r(fieldId) }, { path: [0, 1], attribute: \"id\", value: () => $r(fieldId) }, { path: [0, 1], attribute: \"name\", value: () => $p.name }, { path: [0, 1], attribute: \"value\", value: () => $r(email) }, { path: [0, 1], on: \"input\", handler: () => ((event) => (__zubraAssign(email, event.target.value))) }, { path: [0, 2], text: () => $t($p.button) }] }, null] },\n      { path: [0, 4], when: () => $p.note, blocks: [{ template: \"<p class=\\\"signup-small\\\"></p>\", parts: () => [{ path: [0], text: () => $t($p.note) }] }, null] },\n    ];\n  },\n});\n"
    }
  ]
}
