{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "casework-announce",
  "title": "Casework live announcer",
  "description": "One polite live region per page for sort, filter and row-count announcements, so screen reader users hear what a table change did.",
  "files": [
    {
      "path": "casework/announce.tsx",
      "content": "import { useCallback, useEffect, useRef, useState } from \"react\";\n\n/**\n * One polite live region per page: sort, filter and row-count announcements.\n * The message clears after roughly a second so repeating the same\n * announcement re-fires the region. Kept apart from `shared.tsx`, which\n * already carries a command retry, so the timer here is never read as a\n * command's own retry bookkeeping.\n */\nexport function LiveAnnouncer({ message }: { message: string }) {\n  return (\n    <div className=\"sr-only\" role=\"status\" aria-live=\"polite\">\n      {message}\n    </div>\n  );\n}\n\nexport function useAnnouncement(): [string, (message: string) => void] {\n  const [message, setMessage] = useState(\"\");\n  const timer = useRef<ReturnType<typeof setTimeout>>(undefined);\n  useEffect(() => () => clearTimeout(timer.current), []);\n  const announce = useCallback((next: string) => {\n    setMessage(next);\n    clearTimeout(timer.current);\n    timer.current = setTimeout(() => setMessage(\"\"), 1000);\n  }, []);\n  return [message, announce];\n}\n",
      "type": "registry:block",
      "target": "@components/casework/announce.tsx"
    }
  ],
  "type": "registry:block"
}