{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button-irreversible",
  "type": "registry:component",
  "title": "Button Irreversible",
  "description": "A two-step danger row that expands in place into a warning with marching hazard stripes, a list of consequences and a checkbox. The final button stays locked until the user acknowledges.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "buttons",
    "danger zone",
    "delete account",
    "two step",
    "warning",
    "settings",
    "confirm"
  ],
  "docs": "https://hyperblur.dev/effects/button-irreversible",
  "files": [
    {
      "path": "registry/hyperblur/button-irreversible.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/button-irreversible.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ButtonIrreversibleProps\n  extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\" | \"title\"> {\n  label?: string;\n  description?: string;\n  title?: string;\n  consequences?: string[];\n  acknowledge?: string;\n  confirmLabel?: string;\n  cancelLabel?: string;\n  doneLabel?: string;\n  accent?: string;\n  open?: boolean;\n  defaultOpen?: boolean;\n  resetAfter?: number;\n  disabled?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  onConfirm?: () => void;\n  onCancel?: () => void;\n}\n\nconst css = `\n.hb-xd12 {\n  box-sizing: border-box;\n  width: 100%;\n  max-width: 340px;\n  font-family: inherit;\n  font-size: 0.8125rem;\n  color: #ededed;\n}\n.hb-xd12 *, .hb-xd12 *::before, .hb-xd12 *::after { box-sizing: border-box; }\n.hb-xd12-shell {\n  position: relative;\n  overflow: hidden;\n  border-radius: 12px;\n  background: linear-gradient(180deg, #161616, #121212);\n  border: 1px solid color-mix(in srgb, var(--hb-xd12-c) 26%, #262626);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 1px 2px rgba(0,0,0,0.5);\n  transition: border-color 0.35s ease, box-shadow 0.45s ease, background 0.45s ease;\n}\n.hb-xd12[data-open=\"true\"] .hb-xd12-shell {\n  border-color: color-mix(in srgb, var(--hb-xd12-c) 55%, #262626);\n  background:\n    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--hb-xd12-c) 14%, transparent), transparent 70%),\n    linear-gradient(180deg, #170f10, #110c0c);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 0 4px color-mix(in srgb, var(--hb-xd12-c) 10%, transparent), 0 18px 40px -20px color-mix(in srgb, var(--hb-xd12-c) 70%, transparent);\n}\n.hb-xd12-shell::before {\n  content: \"\";\n  position: absolute;\n  inset: 0 0 auto;\n  height: 2px;\n  background: repeating-linear-gradient(-45deg, var(--hb-xd12-c) 0 6px, transparent 6px 12px);\n  background-size: 17px 2px;\n  opacity: 0;\n  transition: opacity 0.3s ease;\n}\n.hb-xd12[data-open=\"true\"] .hb-xd12-shell::before { opacity: 0.9; animation: hb-xd12-march 0.9s linear infinite; }\n.hb-xd12-trigger {\n  display: flex;\n  align-items: center;\n  gap: 11px;\n  width: 100%;\n  margin: 0;\n  padding: 11px 12px;\n  font: inherit;\n  text-align: left;\n  color: inherit;\n  background: transparent;\n  border: 0;\n  cursor: pointer;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-xd12-trigger:focus-visible { outline: 2px solid var(--hb-xd12-c); outline-offset: -2px; border-radius: 12px; }\n.hb-xd12-trigger:disabled { opacity: 0.45; cursor: not-allowed; }\n.hb-xd12-ico {\n  display: grid;\n  place-items: center;\n  flex: none;\n  width: 30px;\n  height: 30px;\n  border-radius: 9px;\n  color: color-mix(in srgb, var(--hb-xd12-c) 70%, #fff);\n  background: color-mix(in srgb, var(--hb-xd12-c) 14%, #141414);\n  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-xd12-c) 30%, transparent);\n  transition: background 0.3s ease, color 0.3s ease;\n}\n.hb-xd12[data-open=\"true\"] .hb-xd12-ico { color: #fff; background: var(--hb-xd12-c); }\n.hb-xd12-tt { display: flex; flex: 1; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.3; }\n.hb-xd12-tt b { font-weight: 600; color: color-mix(in srgb, var(--hb-xd12-c) 35%, #fff); }\n.hb-xd12-tt small { overflow: hidden; font-size: 0.72rem; color: #8f8f8f; text-overflow: ellipsis; white-space: nowrap; }\n.hb-xd12-step {\n  flex: none;\n  padding: 2px 7px;\n  font-family: var(--font-mono), ui-monospace, monospace;\n  font-size: 0.64rem;\n  letter-spacing: 0.04em;\n  color: #a1a1a1;\n  border: 1px solid #2a2a2a;\n  border-radius: 999px;\n  transition: color 0.3s ease, border-color 0.3s ease;\n}\n.hb-xd12[data-open=\"true\"] .hb-xd12-step { color: color-mix(in srgb, var(--hb-xd12-c) 50%, #fff); border-color: color-mix(in srgb, var(--hb-xd12-c) 40%, #2a2a2a); }\n.hb-xd12-chev { flex: none; color: #737373; transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1); }\n.hb-xd12[data-open=\"true\"] .hb-xd12-chev { transform: rotate(180deg); }\n.hb-xd12-panel {\n  display: grid;\n  grid-template-rows: 0fr;\n  transition: grid-template-rows 0.5s cubic-bezier(0.6, 0, 0.15, 1);\n}\n.hb-xd12[data-open=\"true\"] .hb-xd12-panel { grid-template-rows: 1fr; }\n.hb-xd12-inner { min-height: 0; overflow: hidden; }\n.hb-xd12-body {\n  display: flex;\n  flex-direction: column;\n  gap: 9px;\n  padding: 0 12px 12px;\n  opacity: 0;\n  transform: translateY(-6px);\n  transition: opacity 0.25s ease, transform 0.4s cubic-bezier(0.2, 1, 0.3, 1);\n}\n.hb-xd12[data-open=\"true\"] .hb-xd12-body { opacity: 1; transform: none; transition-delay: 0.12s; }\n.hb-xd12-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 9px 0 0; list-style: none; border-top: 1px solid #2a1c1d; }\n.hb-xd12-list li { display: flex; align-items: flex-start; gap: 7px; line-height: 1.35; color: #b5b5b5; font-size: 0.75rem; }\n.hb-xd12-list li::before {\n  content: \"\";\n  flex: none;\n  width: 5px;\n  height: 5px;\n  margin-top: 0.42em;\n  border-radius: 1px;\n  background: var(--hb-xd12-c);\n  transform: rotate(45deg);\n}\n.hb-xd12-ack { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: #d4d4d4; cursor: pointer; user-select: none; }\n.hb-xd12-ack input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }\n.hb-xd12-box {\n  display: grid;\n  place-items: center;\n  flex: none;\n  width: 16px;\n  height: 16px;\n  color: #fff;\n  border: 1px solid #3a3a3a;\n  border-radius: 5px;\n  background: #0d0d0d;\n  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;\n}\n.hb-xd12-box path { stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 0.3s cubic-bezier(0.6, 0, 0.3, 1); }\n.hb-xd12-ack input:checked + .hb-xd12-box { background: var(--hb-xd12-c); border-color: var(--hb-xd12-c); }\n.hb-xd12-ack input:checked + .hb-xd12-box path { stroke-dashoffset: 0; }\n.hb-xd12-ack input:focus-visible + .hb-xd12-box { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-xd12-c) 35%, transparent); }\n.hb-xd12-acts { display: flex; gap: 8px; }\n.hb-xd12-btn {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 6px;\n  height: 34px;\n  margin: 0;\n  padding: 0 12px;\n  font: inherit;\n  font-weight: 600;\n  white-space: nowrap;\n  border-radius: 9px;\n  cursor: pointer;\n  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease, transform 0.15s ease;\n}\n.hb-xd12-btn:active:not([aria-disabled=\"true\"]) { transform: scale(0.97); }\n.hb-xd12-btn:focus-visible { outline: 2px solid color-mix(in srgb, var(--hb-xd12-c) 70%, #fff); outline-offset: 2px; }\n.hb-xd12-cancel { color: #d4d4d4; background: #1c1c1c; border: 1px solid #2c2c2c; }\n.hb-xd12-cancel:hover { background: #242424; }\n.hb-xd12-go {\n  flex: 1;\n  color: #6b6b6b;\n  background: #181818;\n  border: 1px solid #262626;\n  cursor: not-allowed;\n}\n.hb-xd12[data-ack=\"true\"] .hb-xd12-go {\n  color: #fff;\n  cursor: pointer;\n  border-color: color-mix(in srgb, var(--hb-xd12-c) 70%, #000);\n  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 60%), var(--hb-xd12-c);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 8px 20px -10px var(--hb-xd12-c);\n}\n.hb-xd12-done {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  padding: 9px 0 0;\n  border-top: 1px solid #2a1c1d;\n  font-weight: 600;\n  color: color-mix(in srgb, var(--hb-xd12-c) 40%, #fff);\n  animation: hb-xd12-in 0.4s cubic-bezier(0.2, 1.2, 0.4, 1);\n}\n@keyframes hb-xd12-march { to { background-position: 17px 0; } }\n@keyframes hb-xd12-in { from { opacity: 0; transform: translateY(5px); } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-xd12-shell, .hb-xd12-panel, .hb-xd12-body, .hb-xd12-chev, .hb-xd12-box path, .hb-xd12-btn { transition: none; }\n  .hb-xd12[data-open=\"true\"] .hb-xd12-shell::before, .hb-xd12-done { animation: none; }\n}\n`;\n\nexport function ButtonIrreversible({\n  label = \"Delete account\",\n  description = \"Remove your workspace, files and billing history\",\n  title = \"This can't be undone\",\n  consequences = [\"4 projects and 1,286 files are erased within 24 hours\", \"Your Pro plan ends today, with no refund for the remaining 19 days\"],\n  acknowledge = \"I understand this is permanent\",\n  confirmLabel = \"Delete permanently\",\n  cancelLabel = \"Cancel\",\n  doneLabel = \"Account scheduled for deletion\",\n  accent = \"#ef4444\",\n  open: openProp,\n  defaultOpen = false,\n  resetAfter = 3000,\n  disabled = false,\n  onOpenChange,\n  onConfirm,\n  onCancel,\n  className = \"\",\n  style,\n  ...rest\n}: ButtonIrreversibleProps) {\n  const id = React.useId();\n  const [inner, setInner] = React.useState(defaultOpen);\n  const [ack, setAck] = React.useState(false);\n  const [done, setDone] = React.useState(false);\n  const triggerRef = React.useRef<HTMLButtonElement>(null);\n  const ackRef = React.useRef<HTMLInputElement>(null);\n  const latest = React.useRef({ onOpenChange, onConfirm, onCancel });\n  const open = openProp ?? inner;\n\n  React.useEffect(() => {\n    latest.current = { onOpenChange, onConfirm, onCancel };\n  }, [onOpenChange, onConfirm, onCancel]);\n\n  const setOpen = React.useCallback(\n    (next: boolean) => {\n      if (openProp === undefined) setInner(next);\n      latest.current.onOpenChange?.(next);\n      if (!next) setAck(false);\n    },\n    [openProp],\n  );\n\n  React.useEffect(() => {\n    if (!done || resetAfter <= 0) return;\n    const t = window.setTimeout(() => {\n      setDone(false);\n      setOpen(false);\n    }, resetAfter);\n    return () => window.clearTimeout(t);\n  }, [done, resetAfter, setOpen]);\n\n  const close = (cancelled: boolean) => {\n    setOpen(false);\n    if (cancelled) latest.current.onCancel?.();\n    triggerRef.current?.focus({ preventScroll: true });\n  };\n\n  return (\n    <div\n      className={`hb-xd12 ${className}`.trim()}\n      data-open={open}\n      data-ack={ack}\n      style={{ \"--hb-xd12-c\": accent, ...style } as React.CSSProperties}\n      onKeyDown={(e) => {\n        if (e.key === \"Escape\" && open && !done) {\n          e.stopPropagation();\n          close(true);\n        }\n      }}\n      {...rest}\n    >\n      <style href=\"hb-button-irreversible\" precedence=\"default\">{css}</style>\n      <div className=\"hb-xd12-shell\">\n        <button\n          ref={triggerRef}\n          type=\"button\"\n          className=\"hb-xd12-trigger\"\n          disabled={disabled}\n          aria-expanded={open}\n          aria-controls={`${id}-panel`}\n          onClick={() => {\n            if (done) return;\n            if (open) close(true);\n            else {\n              setOpen(true);\n              window.setTimeout(() => ackRef.current?.focus({ preventScroll: true }), 220);\n            }\n          }}\n        >\n          <span className=\"hb-xd12-ico\" aria-hidden=\"true\">\n            <svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n              <path d=\"M12 3l9.5 17h-19z\" />\n              <path d=\"M12 10v4.5M12 17.5v.01\" />\n            </svg>\n          </span>\n          <span className=\"hb-xd12-tt\">\n            <b>{open ? title : label}</b>\n            <small>{open ? \"Review what happens next\" : description}</small>\n          </span>\n          <span className=\"hb-xd12-step\" aria-hidden=\"true\">{open ? \"2 / 2\" : \"1 / 2\"}</span>\n          <svg className=\"hb-xd12-chev\" viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n            <path d=\"M6 9l6 6 6-6\" />\n          </svg>\n        </button>\n        <div className=\"hb-xd12-panel\" id={`${id}-panel`} role=\"group\" aria-label={title} inert={!open}>\n          <div className=\"hb-xd12-inner\">\n            <div className=\"hb-xd12-body\">\n              <ul className=\"hb-xd12-list\">\n                {consequences.map((c) => (\n                  <li key={c}>{c}</li>\n                ))}\n              </ul>\n              {done ? (\n                <div className=\"hb-xd12-done\" role=\"status\" aria-live=\"polite\">\n                  <svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\"><path d=\"M5 12.5l4.5 4.5L19 7.5\" /></svg>\n                  {doneLabel}\n                </div>\n              ) : (\n                <>\n                  <label className=\"hb-xd12-ack\">\n                    <input ref={ackRef} type=\"checkbox\" checked={ack} onChange={(e) => setAck(e.target.checked)} />\n                    <span className=\"hb-xd12-box\" aria-hidden=\"true\">\n                      <svg viewBox=\"0 0 24 24\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\"><path d=\"M5 12.5l4.5 4.5L19 7.5\" pathLength={20} /></svg>\n                    </span>\n                    {acknowledge}\n                  </label>\n                  <div className=\"hb-xd12-acts\">\n                    <button type=\"button\" className=\"hb-xd12-btn hb-xd12-cancel\" onClick={() => close(true)}>\n                      {cancelLabel}\n                    </button>\n                    <button\n                      type=\"button\"\n                      className=\"hb-xd12-btn hb-xd12-go\"\n                      aria-disabled={!ack || undefined}\n                      onClick={() => {\n                        if (!ack) {\n                          ackRef.current?.focus();\n                          return;\n                        }\n                        setDone(true);\n                        latest.current.onConfirm?.();\n                      }}\n                    >\n                      <svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <path d=\"M4 7h16M9 7V4.5h6V7M6 7l1 13h10l1-13\" />\n                      </svg>\n                      {confirmLabel}\n                    </button>\n                  </div>\n                </>\n              )}\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}