{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "modal-dialog",
  "type": "registry:item",
  "title": "Modal Dialog",
  "description": "A modal dialog on the native <dialog>: the page behind is inert, focus moves into the dialog and back to where it was, and Escape, the close button or a click on the backdrop closes it. `open` is two-way.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "app"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/modal-dialog.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/modal-dialog.js",
      "content": "// Generated by zubra from modal-dialog.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { effect, hasSlot, id } from '@zubra/runtime';\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"modal-dialog\";\n\nexport default $define(tag, {\n  props: {\n    \"open\": { attribute: \"open\", default: false, required: false, model: true },\n    \"label\": { attribute: \"label\", default: \"Dialog\", required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [\"actions\", \"default\", \"heading\"],\n  events: [\"openchange\"],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (modal-dialog) to ([data-zb-slotted=\\\"modal-dialog\\\"]) {\\n  dialog { padding: 0; border: 0; border-radius: calc(var(--radius, 0.625rem) * 1.44); width: min(32rem, calc(100vw - 2rem)); background: var(--card, #ffffff); color: var(--foreground, #1d2130); box-shadow: 0 24px 64px #0d122040; }\\n  /* Opening and closing: scales up into place and fades, and back; the browser keeps it in the top layer until it's done. */\\n  dialog { opacity: 0; scale: 0.96; translate: 0 0.5rem; transition: opacity var(--duration-normal, 200ms) var(--ease-out, ease-out), scale var(--duration-normal, 200ms) var(--ease-out, ease-out), translate var(--duration-normal, 200ms) var(--ease-out, ease-out), overlay var(--duration-normal, 200ms) allow-discrete, display var(--duration-normal, 200ms) allow-discrete; }\\n  dialog[open] { opacity: 1; scale: 1; translate: 0; }\\n  @starting-style { dialog[open] { opacity: 0; scale: 0.96; translate: 0 0.5rem; } }\\n  dialog::backdrop { background: #0d122000; transition: background-color var(--duration-normal, 200ms) var(--ease-out, ease-out), overlay var(--duration-normal, 200ms) allow-discrete, display var(--duration-normal, 200ms) allow-discrete; }\\n  dialog[open]::backdrop { background: #0d122066; }\\n  @starting-style { dialog[open]::backdrop { background: #0d122000; } }\\n  @media (prefers-reduced-motion: reduce) { *, *::before, *::after, ::backdrop { transition-duration: 0s !important; animation-duration: 0s !important; } }\\n  .panel { display: grid; gap: 1rem; padding: 1.1rem 1.25rem 1.25rem; }\\n  header { display: flex; align-items: center; gap: 1rem; }\\n  h2 { flex: 1; margin: 0; font-size: 1.1rem; }\\n  .close { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; }\\n  .close:hover { background: var(--accent, #f2f4f8); }\\n  footer { display: flex; justify-content: flex-end; gap: 0.5rem; }\\n}\\n}\\n\",\n  template: \"\\n  <dialog>\\n    <div class=\\\"panel\\\">\\n      <header>\\n        <h2><!--[--><!--]--></h2>\\n        <button type=\\\"button\\\" class=\\\"close\\\" aria-label=\\\"Close\\\">×</button>\\n      </header>\\n      <div class=\\\"body\\\"><!--[--><!--]--></div>\\n      <!--[--><!--]-->\\n    </div>\\n  </dialog>\\n\",\n  setup($p, $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 headingId = id()\n  const hasActions = hasSlot('actions')\n  const dialog = __zubraState(null)\n  // A click on the backdrop closes the dialog, but not one that started inside it (a text\n  // selection dragged past the edge).\n  const pressedBackdrop = __zubraState(false)\n\n  // Follow `open` (from outside or inside): show the dialog modally, or close it.\n  effect(() => {\n    if (!dialog.get()) return\n    if ($p.open && !dialog.get().open) dialog.get().showModal()\n    else if (!$p.open && dialog.get().open) dialog.get().close()\n  })\n    return [\n      { path: [0], ref: () => (($el) => (__zubraAssign(dialog, $el))) },\n      { path: [0], attribute: \"aria-labelledby\", value: () => $r(headingId) },\n      { path: [0], on: \"close\", handler: () => (() => ($p.open = false)) },\n      { path: [0], on: \"pointerdown\", handler: () => ((event) => (__zubraAssign(pressedBackdrop, event.target === dialog.get()))) },\n      { path: [0], on: \"click\", handler: () => (() => pressedBackdrop.get() && ($p.open = false)), modifiers: { self: true } },\n      { path: [0, 0, 0, 0], attribute: \"id\", value: () => $r(headingId) },\n      { path: [0, 0, 0, 0, 0], slot: \"heading\", fallback: { template: \"<!---->\", parts: () => [{ path: [0], anchor: () => $t($p.label) }] } },\n      { path: [0, 0, 0, 1], on: \"click\", handler: () => (() => ($p.open = false)) },\n      { path: [0, 0, 1, 0], slot: \"default\", fallback: null },\n      { path: [0, 0, 2], when: () => $r(hasActions), blocks: [{ template: \"<footer><!--[--><!--]--></footer>\", parts: () => [{ path: [0], on: \"click\", handler: () => ((event) => event.target.closest?.(\"[data-close]\") && ($p.open = false)) }, { path: [0, 0], slot: \"actions\", fallback: null }] }, null] },\n    ];\n  },\n});\n"
    }
  ]
}
