{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "signin-block",
  "type": "registry:item",
  "title": "Signin Block",
  "description": "A sign-in form: email, password with show and hide, keep me signed in, reset and sign-up links, and an error that's announced. Submitting fires `signin`; with an `action` it also posts as a plain form.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "block"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json",
    "https://zubra-js.github.io/zubra-ui/r/toggle-switch.json"
  ],
  "files": [
    {
      "path": "components/signin-block.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/signin-block.js",
      "content": "// Generated by zubra from signin-block.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { effect, emit, id } from '@zubra/runtime';\nimport \"./toggle-switch.js\";\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"signin-block\";\n\nexport default $define(tag, {\n  props: {\n    \"heading\": { attribute: \"heading\", default: \"Sign in\", required: false },\n    \"intro\": { attribute: \"intro\", default: \"\", required: false },\n    \"action\": { attribute: \"action\", default: \"\", required: false },\n    \"error\": { attribute: \"error\", default: \"\", required: false },\n    \"errorField\": { attribute: \"error-field\", default: \"both\", required: false },\n    \"busy\": { attribute: \"busy\", default: false, required: false },\n    \"forgotHref\": { attribute: \"forgot-href\", default: \"\", required: false },\n    \"signupHref\": { attribute: \"signup-href\", default: \"\", required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [],\n  events: [\"signin\"],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (signin-block) to ([data-zb-slotted=\\\"signin-block\\\"]) {\\n  :scope { display: block; max-width: 24rem; margin-inline: auto; }\\n  form { padding: 1.75rem; border: 1px solid var(--border, #e4e4e7); border-radius: calc(var(--radius, 0.625rem) + 4px); background: var(--card, #fff); color: var(--card-foreground, #09090b); }\\n  fieldset { display: grid; gap: 1rem; margin: 0; padding: 0; border: 0; min-width: 0; }\\n  h2 { margin: 0; font-size: 1.4rem; line-height: 1.25; letter-spacing: -0.01em; }\\n  .signin-intro { margin: -0.6rem 0 0.25rem; color: var(--muted-foreground, #71717a); }\\n  .signin-field { display: grid; gap: 0.35rem; }\\n  .signin-label-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }\\n  label { font-size: 0.875rem; font-weight: 600; }\\n  input { box-sizing: border-box; width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--input, var(--border, #e4e4e7)); border-radius: calc(var(--radius, 0.625rem) - 2px); background: var(--background, #fff); color: inherit; font: inherit; font-size: 1rem; }\\n  input:focus-visible { outline: 2px solid var(--ring, #18181b); outline-offset: 1px; }\\n  input[aria-invalid=true] { border-color: var(--destructive, #dc2626); }\\n  .signin-password { position: relative; }\\n  .signin-password input { padding-right: 4.5rem; }\\n  .signin-reveal { position: absolute; top: 50%; right: 0.35rem; transform: translateY(-50%); min-height: 1.75rem; padding: 0.3rem 0.6rem; border: 0; border-radius: calc(var(--radius, 0.625rem) - 4px); background: none; color: var(--muted-foreground, #71717a); font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }\\n  .signin-reveal:hover { background: var(--accent, #f4f4f5); color: var(--accent-foreground, #18181b); }\\n  .signin-reveal:focus-visible { outline: 2px solid var(--ring, #18181b); outline-offset: 1px; }\\n  a { display: inline-block; padding-block: 0.25rem; color: var(--primary, #18181b); font-size: 0.875rem; font-weight: 500; text-underline-offset: 3px; }\\n  .signin-error { margin: 0; padding: 0.6rem 0.75rem; border-radius: calc(var(--radius, 0.625rem) - 2px); background: color-mix(in oklab, var(--destructive, #dc2626) 12%, transparent); color: var(--foreground, #09090b); font-size: 0.9rem; }\\n  .signin-submit { padding: 0.65rem 1rem; border: 0; border-radius: calc(var(--radius, 0.625rem) - 2px); background: var(--primary, #18181b); color: var(--primary-foreground, #fafafa); font: inherit; font-weight: 600; cursor: pointer; }\\n  .signin-submit:hover { opacity: 0.92; }\\n  .signin-submit:disabled { opacity: 0.6; cursor: progress; }\\n  .signin-submit:focus-visible { outline: 2px solid var(--ring, #18181b); outline-offset: 2px; }\\n  .signin-signup { margin: 0; text-align: center; color: var(--muted-foreground, #71717a); font-size: 0.875rem; }\\n}\\n}\\n\",\n  template: \"\\n  <form method=\\\"post\\\">\\n    <fieldset>\\n      <h2></h2>\\n      <!--[--><!--]-->\\n      <!--[--><!--]-->\\n      <div class=\\\"signin-field\\\">\\n        <label>Email</label>\\n        <input type=\\\"email\\\" name=\\\"email\\\" autocomplete=\\\"username\\\" required>\\n      </div>\\n      <div class=\\\"signin-field\\\">\\n        <div class=\\\"signin-label-row\\\">\\n          <label>Password</label>\\n          <!--[--><!--]-->\\n        </div>\\n        <div class=\\\"signin-password\\\">\\n          <input name=\\\"password\\\" autocomplete=\\\"current-password\\\" required>\\n          <button type=\\\"button\\\" class=\\\"signin-reveal\\\"></button>\\n        </div>\\n      </div>\\n      <toggle-switch name=\\\"remember\\\"></toggle-switch>\\n      <button type=\\\"submit\\\" class=\\\"signin-submit\\\"></button>\\n      <!--[--><!--]-->\\n    </fieldset>\\n  </form>\\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                             \n\n  const errorId = id()\n  const emailId = id()\n  const passwordId = id()\n  const showPassword = __zubraState(false)\n  const remember = __zubraState(true)\n  // Which fields have been edited since the error was set: they're no longer marked.\n  const edited = __zubraState({ email: false, password: false })\n  effect(() => {\n    if ($p.error) __zubraAssign(edited, { email: false, password: false })\n  })\n  const invalid = (field) => Boolean($p.error) && ($p.errorField === \"both\" || $p.errorField === field) && !edited.get()[field]\n\n  function submit(event) {\n    const data = new FormData(event.currentTarget)\n    if (!$p.action) event.preventDefault()\n    emit('signin', { email: String(data.get('email') ?? ''), password: String(data.get('password') ?? ''), remember: remember.get() })\n  }\n    return [\n      { path: [0], attribute: \"action\", url: true, value: () => ($p.action || null) },\n      { path: [0], on: \"submit\", handler: () => $r(submit) },\n      { path: [0], attribute: \"aria-busy\", value: () => ($p.busy ? \"true\" : \"false\") },\n      { path: [0], attribute: \"aria-describedby\", value: () => ($p.error ? $r(errorId) : null) },\n      { path: [0, 0], attribute: \"disabled\", boolean: true, value: () => $p.busy },\n      { path: [0, 0, 0], text: () => $t($p.heading) },\n      { path: [0, 0, 1], when: () => $p.intro, blocks: [{ template: \"<p class=\\\"signin-intro\\\"></p>\", parts: () => [{ path: [0], text: () => $t($p.intro) }] }, null] },\n      { path: [0, 0, 2], when: () => $p.error, blocks: [{ template: \"<p class=\\\"signin-error\\\" role=\\\"alert\\\"></p>\", parts: () => [{ path: [0], attribute: \"id\", value: () => $r(errorId) }, { path: [0], text: () => $t($p.error) }] }, null] },\n      { path: [0, 0, 3, 0], attribute: \"for\", value: () => $r(emailId) },\n      { path: [0, 0, 3, 1], attribute: \"id\", value: () => $r(emailId) },\n      { path: [0, 0, 3, 1], attribute: \"aria-invalid\", value: () => (invalid(\"email\") ? \"true\" : \"false\") },\n      { path: [0, 0, 3, 1], on: \"input\", handler: () => (() => (__zubraAssign(edited, { ...edited.get(), email: true }))) },\n      { path: [0, 0, 4, 0, 0], attribute: \"for\", value: () => $r(passwordId) },\n      { path: [0, 0, 4, 0, 1], when: () => $p.forgotHref, blocks: [{ template: \"<a>Forgot password?</a>\", parts: () => [{ path: [0], attribute: \"href\", url: true, value: () => $p.forgotHref }] }, null] },\n      { path: [0, 0, 4, 1, 0], attribute: \"id\", value: () => $r(passwordId) },\n      { path: [0, 0, 4, 1, 0], attribute: \"type\", value: () => ($r(showPassword) ? \"text\" : \"password\") },\n      { path: [0, 0, 4, 1, 0], attribute: \"aria-invalid\", value: () => (invalid(\"password\") ? \"true\" : \"false\") },\n      { path: [0, 0, 4, 1, 0], on: \"input\", handler: () => (() => (__zubraAssign(edited, { ...edited.get(), password: true }))) },\n      { path: [0, 0, 4, 1, 1], attribute: \"aria-controls\", value: () => $r(passwordId) },\n      { path: [0, 0, 4, 1, 1], attribute: \"aria-label\", value: () => ($r(showPassword) ? \"Hide password\" : \"Show password\") },\n      { path: [0, 0, 4, 1, 1], attribute: \"aria-pressed\", value: () => ($r(showPassword) ? \"true\" : \"false\") },\n      { path: [0, 0, 4, 1, 1], on: \"click\", handler: () => (() => (__zubraAssign(showPassword, !showPassword.get()))) },\n      { path: [0, 0, 4, 1, 1], text: () => $t(($r(showPassword) ? \"Hide\" : \"Show\")) },\n      { path: [0, 0, 5], property: \"label\", value: () => \"Keep me signed in\" },\n      { path: [0, 0, 5], property: \"checked\", value: () => $r(remember) },\n      { path: [0, 0, 5], on: \"checkedchange\", handler: () => ((event) => (__zubraAssign(remember, event.detail))) },\n      { path: [0, 0, 6], text: () => $t(($p.busy ? \"Signing in…\" : $p.heading)) },\n      { path: [0, 0, 7], when: () => $p.signupHref, blocks: [{ template: \"<p class=\\\"signin-signup\\\">New here? <a>Create an account</a></p>\", parts: () => [{ path: [0, 0], attribute: \"href\", url: true, value: () => $p.signupHref }] }, null] },\n    ];\n  },\n});\n"
    }
  ]
}
