{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "button-trash-lid",
  "type": "registry:component",
  "title": "Button Trash Lid",
  "description": "A pill button with a little bin whose lid tips open on hover. Clicking drops a sheet of paper inside, the lid slams with a squash and a counter badge pops up.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "buttons",
    "button",
    "trash",
    "delete",
    "icon",
    "animation",
    "toolbar"
  ],
  "docs": "https://hyperblur.dev/effects/button-trash-lid",
  "files": [
    {
      "path": "registry/hyperblur/button-trash-lid.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/button-trash-lid.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface ButtonTrashLidProps\n  extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | \"onClick\" | \"color\"> {\n  children?: React.ReactNode;\n  doneLabel?: React.ReactNode;\n  accent?: string;\n  size?: \"sm\" | \"md\" | \"lg\";\n  resetAfter?: number;\n  onDelete?: () => void;\n}\n\nconst css = `\n.hb-xd3 {\n  --hb-xd3-h: 2.75rem;\n  --hb-xd3-fs: 0.875rem;\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  gap: 0.7em;\n  box-sizing: border-box;\n  height: var(--hb-xd3-h);\n  margin: 0;\n  padding: 0 1.15em 0 0.3em;\n  font-family: inherit;\n  font-size: var(--hb-xd3-fs);\n  font-weight: 600;\n  letter-spacing: -0.005em;\n  color: #ededed;\n  white-space: nowrap;\n  background: linear-gradient(180deg, #1c1c1c, #131313);\n  border: 1px solid #2a2a2a;\n  border-radius: 999px;\n  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 1px 2px rgba(0,0,0,0.5), 0 10px 24px -14px rgba(0,0,0,0.9);\n  cursor: pointer;\n  -webkit-tap-highlight-color: transparent;\n  transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1);\n}\n.hb-xd3 *, .hb-xd3 *::before, .hb-xd3 *::after { box-sizing: border-box; }\n.hb-xd3[data-size=\"sm\"] { --hb-xd3-h: 2.25rem; --hb-xd3-fs: 0.8125rem; }\n.hb-xd3[data-size=\"lg\"] { --hb-xd3-h: 3.25rem; --hb-xd3-fs: 1rem; }\n.hb-xd3:hover:not(:disabled) { border-color: color-mix(in srgb, var(--hb-xd3-c) 45%, #2a2a2a); }\n.hb-xd3:active:not(:disabled) { transform: scale(0.97); }\n.hb-xd3:focus-visible { outline: 2px solid var(--hb-xd3-c); outline-offset: 3px; }\n.hb-xd3:disabled { opacity: 0.45; cursor: not-allowed; }\n.hb-xd3-chip {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: calc(var(--hb-xd3-h) - 0.6em);\n  height: calc(var(--hb-xd3-h) - 0.6em);\n  border-radius: 999px;\n  color: color-mix(in srgb, var(--hb-xd3-c) 75%, #fff);\n  background: radial-gradient(100% 100% at 50% 0%, color-mix(in srgb, var(--hb-xd3-c) 30%, #1a0c0d), color-mix(in srgb, var(--hb-xd3-c) 12%, #0e0707));\n  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-xd3-c) 30%, transparent), inset 0 1px 0 rgba(255,255,255,0.08);\n  transition: box-shadow 0.3s ease, background 0.3s ease;\n}\n.hb-xd3:hover:not(:disabled) .hb-xd3-chip, .hb-xd3:focus-visible .hb-xd3-chip {\n  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hb-xd3-c) 55%, transparent), 0 0 18px -4px color-mix(in srgb, var(--hb-xd3-c) 70%, transparent);\n}\n.hb-xd3-can { width: 56%; height: 56%; overflow: visible; }\n.hb-xd3-lid {\n  transform-box: fill-box;\n  transform-origin: 8% 100%;\n  transition: transform 0.45s cubic-bezier(0.3, 1.8, 0.5, 1);\n}\n.hb-xd3:hover:not(:disabled) .hb-xd3-lid, .hb-xd3:focus-visible .hb-xd3-lid { transform: translateY(-1.5px) rotate(-24deg); }\n.hb-xd3[data-phase=\"drop\"] .hb-xd3-lid { animation: hb-xd3-lid 0.8s cubic-bezier(0.3, 0.9, 0.4, 1) forwards; }\n.hb-xd3[data-phase=\"drop\"] .hb-xd3-body { animation: hb-xd3-squash 0.8s ease forwards; }\n.hb-xd3-body { transform-box: fill-box; transform-origin: 50% 100%; }\n.hb-xd3-paper {\n  position: absolute;\n  left: 50%;\n  top: 0;\n  width: 42%;\n  height: 50%;\n  margin-left: -21%;\n  border-radius: 2px;\n  background:\n    linear-gradient(225deg, transparent 0 22%, #c9c2c2 22% 30%, transparent 30%),\n    repeating-linear-gradient(180deg, transparent 0 3px, rgba(0,0,0,0.22) 3px 4px) 2px 5px / calc(100% - 4px) 60% no-repeat,\n    #f4f0f0;\n  box-shadow: 0 2px 4px rgba(0,0,0,0.5);\n  opacity: 0;\n  pointer-events: none;\n}\n.hb-xd3[data-phase=\"drop\"] .hb-xd3-paper { animation: hb-xd3-paper 0.8s cubic-bezier(0.5, 0, 0.75, 0.4) forwards; }\n.hb-xd3-text {\n  display: grid;\n  overflow: hidden;\n  height: 1.3em;\n}\n.hb-xd3-text > span {\n  grid-area: 1 / 1;\n  line-height: 1.3em;\n  transition: transform 0.5s cubic-bezier(0.6, 0, 0.2, 1), opacity 0.3s ease;\n}\n.hb-xd3-b { transform: translateY(110%); opacity: 0; color: color-mix(in srgb, var(--hb-xd3-c) 55%, #fff); }\n.hb-xd3[data-phase=\"done\"] .hb-xd3-a { transform: translateY(-110%); opacity: 0; }\n.hb-xd3[data-phase=\"done\"] .hb-xd3-b { transform: none; opacity: 1; }\n.hb-xd3-count {\n  position: absolute;\n  top: -3px;\n  right: -3px;\n  min-width: 15px;\n  height: 15px;\n  padding: 0 4px;\n  font-size: 9px;\n  font-weight: 700;\n  line-height: 15px;\n  text-align: center;\n  color: #fff;\n  background: var(--hb-xd3-c);\n  border: 2px solid #151515;\n  border-radius: 999px;\n  transform: scale(0);\n  transition: transform 0.4s cubic-bezier(0.3, 1.8, 0.5, 1);\n}\n.hb-xd3[data-phase=\"done\"] .hb-xd3-count { transform: scale(1); }\n.hb-xd3-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n@keyframes hb-xd3-lid {\n  0% { transform: translateY(-2px) rotate(-38deg); }\n  55% { transform: translateY(-2px) rotate(-38deg); }\n  72% { transform: translateY(0.5px) rotate(4deg); }\n  84% { transform: rotate(-3deg); }\n  100% { transform: rotate(0); }\n}\n@keyframes hb-xd3-squash {\n  0%, 66% { transform: scale(1, 1); }\n  76% { transform: scale(1.1, 0.88); }\n  88% { transform: scale(0.97, 1.04); }\n  100% { transform: scale(1, 1); }\n}\n@keyframes hb-xd3-paper {\n  0% { opacity: 0; transform: translateY(-115%) rotate(-14deg); }\n  18% { opacity: 1; transform: translateY(-95%) rotate(-8deg); }\n  60% { opacity: 1; transform: translateY(18%) rotate(4deg) scale(0.75); }\n  70% { opacity: 0; transform: translateY(40%) rotate(4deg) scale(0.6); }\n  100% { opacity: 0; transform: translateY(40%) scale(0.6); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-xd3, .hb-xd3-lid, .hb-xd3-text > span, .hb-xd3-count { transition: none; }\n  .hb-xd3[data-phase=\"drop\"] .hb-xd3-lid, .hb-xd3[data-phase=\"drop\"] .hb-xd3-body, .hb-xd3[data-phase=\"drop\"] .hb-xd3-paper { animation: none; }\n}\n`;\n\nexport function ButtonTrashLid({\n  children = \"Move to trash\",\n  doneLabel = \"In the trash\",\n  accent = \"#ef4444\",\n  size = \"md\",\n  resetAfter = 2400,\n  onDelete,\n  disabled = false,\n  type = \"button\",\n  className = \"\",\n  style,\n  ...rest\n}: ButtonTrashLidProps) {\n  const [phase, setPhase] = React.useState<\"idle\" | \"drop\" | \"done\">(\"idle\");\n  const [count, setCount] = React.useState(0);\n  const latest = React.useRef(onDelete);\n\n  React.useEffect(() => {\n    latest.current = onDelete;\n  }, [onDelete]);\n\n  React.useEffect(() => {\n    if (phase === \"drop\") {\n      const reduce = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n      const t = window.setTimeout(() => {\n        setPhase(\"done\");\n        latest.current?.();\n      }, reduce ? 0 : 640);\n      return () => window.clearTimeout(t);\n    }\n    if (phase === \"done\" && resetAfter > 0) {\n      const t = window.setTimeout(() => setPhase(\"idle\"), resetAfter);\n      return () => window.clearTimeout(t);\n    }\n  }, [phase, resetAfter]);\n\n  return (\n    <button\n      type={type}\n      className={`hb-xd3 ${className}`.trim()}\n      data-size={size}\n      data-phase={phase}\n      disabled={disabled}\n      aria-disabled={phase !== \"idle\" || undefined}\n      style={{ \"--hb-xd3-c\": accent, ...style } as React.CSSProperties}\n      onClick={() => {\n        if (phase !== \"idle\") return;\n        setCount((c) => c + 1);\n        setPhase(\"drop\");\n      }}\n      {...rest}\n    >\n      <style href=\"hb-button-trash-lid\" precedence=\"default\">{css}</style>\n      <span className=\"hb-xd3-chip\" aria-hidden=\"true\">\n        <span className=\"hb-xd3-paper\" />\n        <svg className=\"hb-xd3-can\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n          <g className=\"hb-xd3-lid\">\n            <path d=\"M3.5 6.5h17\" />\n            <path d=\"M9.5 6.5V4.2h5v2.3\" />\n          </g>\n          <g className=\"hb-xd3-body\">\n            <path d=\"M5.5 9.5l1.1 10.2c.1.8.7 1.3 1.5 1.3h7.8c.8 0 1.4-.5 1.5-1.3l1.1-10.2\" />\n            <path d=\"M10 12.5v5M14 12.5v5\" />\n          </g>\n        </svg>\n        <span className=\"hb-xd3-count\">{count}</span>\n      </span>\n      <span className=\"hb-xd3-text\">\n        <span className=\"hb-xd3-a\" aria-hidden={phase === \"done\"}>{children}</span>\n        <span className=\"hb-xd3-b\" aria-hidden={phase !== \"done\"}>{doneLabel}</span>\n      </span>\n      <span className=\"hb-xd3-sr\" role=\"status\" aria-live=\"polite\">{phase === \"done\" ? doneLabel : \"\"}</span>\n    </button>\n  );\n}\n"
    }
  ]
}