{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "quick-actions-grid",
  "title": "Quick Actions Grid",
  "description": "A grid of shortcut tiles for a dashboard home: coloured icons with a hover glow and a ripple when pressed, number keys 1–9 to run them, a filter, a Recent row, and an Edit mode where tiles wiggle, can be removed and new ones added from a library.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/quick-actions-grid/quick-actions-grid.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type ActionIcon = \"project\" | \"invite\" | \"invoice\" | \"import\" | \"schedule\" | \"connect\" | \"report\" | \"ticket\" | \"doc\" | \"meeting\" | \"payment\" | \"export\";\n\nexport interface QuickAction {\n  id: string;\n  label: string;\n  description?: string;\n  icon: ActionIcon;\n  color?: string;\n}\n\nexport interface QuickActionsGridProps {\n  title?: string;\n  /** Every action people can pin. */\n  library?: QuickAction[];\n  /** Ids pinned to the grid, in order. */\n  pinned?: string[];\n  onAction?: (id: string) => void;\n  onPinnedChange?: (ids: string[]) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", faint: \"rgba(245,244,241,0.36)\", card: \"#121212\", tile: \"#161616\", border: \"rgba(255,255,255,0.09)\", chip: \"rgba(255,255,255,0.06)\", hover: \"rgba(255,255,255,0.05)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", ring: \"rgba(245,244,241,0.6)\", red: \"#F87171\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", card: \"#FFFFFF\", tile: \"#FAFAF8\", border: \"rgba(10,10,10,0.09)\", chip: \"rgba(10,10,10,0.05)\", hover: \"rgba(10,10,10,0.03)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", ring: \"rgba(10,10,10,0.5)\", red: \"#DC2626\" },\n};\n\nconst DEFAULT_LIBRARY: QuickAction[] = [\n  { id: \"project\", label: \"New project\", description: \"Start from a blank board\", icon: \"project\", color: \"#FB923C\" },\n  { id: \"invite\", label: \"Invite teammate\", description: \"Send an email invite\", icon: \"invite\", color: \"#60A5FA\" },\n  { id: \"invoice\", label: \"Create invoice\", description: \"Bill a client\", icon: \"invoice\", color: \"#4ADE80\" },\n  { id: \"import\", label: \"Import CSV\", description: \"Contacts, deals or tasks\", icon: \"import\", color: \"#A78BFA\" },\n  { id: \"schedule\", label: \"Schedule post\", description: \"Plan social content\", icon: \"schedule\", color: \"#F472B6\" },\n  { id: \"connect\", label: \"Connect app\", description: \"Browse integrations\", icon: \"connect\", color: \"#2DD4BF\" },\n  { id: \"report\", label: \"Weekly report\", description: \"Share a summary\", icon: \"report\", color: \"#FBBF24\" },\n  { id: \"ticket\", label: \"Open ticket\", description: \"Ask support for help\", icon: \"ticket\", color: \"#F87171\" },\n  { id: \"doc\", label: \"New doc\", description: \"Write a spec or note\", icon: \"doc\", color: \"#93C5FD\" },\n  { id: \"meeting\", label: \"Book meeting\", description: \"Find a free slot\", icon: \"meeting\", color: \"#C4B5FD\" },\n  { id: \"payment\", label: \"Request payment\", description: \"Send a payment link\", icon: \"payment\", color: \"#86EFAC\" },\n  { id: \"export\", label: \"Export data\", description: \"Download as CSV\", icon: \"export\", color: \"#FCD34D\" },\n];\n\nconst ICONS: Record<ActionIcon, React.ReactNode> = {\n  project: <path d=\"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm9 3v6m-3-3h6\" />,\n  invite: <path d=\"M15 19v-1a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v1M9 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm10-2v6m3-3h-6\" />,\n  invoice: <path d=\"M6 3h12v18l-3-2-3 2-3-2-3 2V3Zm3 5h6m-6 4h6m-6 4h3\" />,\n  import: <path d=\"M12 3v12m0 0-4-4m4 4 4-4M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2\" />,\n  schedule: <path d=\"M8 3v3m8-3v3M4 9h16M5 6h14a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm7 7v3l2 1\" />,\n  connect: <path d=\"M9 7V3m6 4V3M7 7h10v4a5 5 0 0 1-10 0V7Zm5 9v5\" />,\n  report: <path d=\"M4 20V10m6 10V4m6 16v-7m4 7H2\" />,\n  ticket: <path d=\"M4 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v2a2 2 0 0 0 0 4v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2a2 2 0 0 0 0-4V7Zm10-2v12\" />,\n  doc: <path d=\"M14 3H6v18h12V7l-4-4Zm0 0v4h4M9 13h6m-6 4h4\" />,\n  meeting: <path d=\"M3 7a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm13 3 5-3v10l-5-3\" />,\n  payment: <path d=\"M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm0 3h18M7 15h3\" />,\n  export: <path d=\"M12 15V3m0 0L8 7m4-4 4 4M4 15v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4\" />,\n};\nfunction glyph(icon: ActionIcon, size = 18) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      {ICONS[icon]}\n    </svg>\n  );\n}\n\nexport function QuickActionsGrid({ title = \"Quick actions\", library = DEFAULT_LIBRARY, pinned: pinnedProp = [\"project\", \"invite\", \"invoice\", \"import\", \"schedule\", \"connect\", \"report\", \"ticket\"], onAction, onPinnedChange, theme = \"dark\", className }: QuickActionsGridProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [pinned, setPinned] = React.useState<string[]>(pinnedProp);\n  const [editing, setEditing] = React.useState(false);\n  const [recent, setRecent] = React.useState<string[]>([\"invoice\", \"invite\"]);\n  const [pressed, setPressed] = React.useState<{ id: string; n: number } | null>(null);\n  const [toast, setToast] = React.useState<string | null>(null);\n  const [q, setQ] = React.useState(\"\");\n  const pressN = React.useRef(0);\n  const timer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  React.useEffect(\n    () => () => {\n      if (timer.current) clearTimeout(timer.current);\n    },\n    [],\n  );\n\n  const byId = (id: string) => library.find((a) => a.id === id);\n  const query = q.trim().toLowerCase();\n  const grid = pinned.map(byId).filter((a): a is QuickAction => !!a && (!query || `${a.label} ${a.description ?? \"\"}`.toLowerCase().includes(query)));\n  const unpinned = library.filter((a) => !pinned.includes(a.id));\n\n  const run = (a: QuickAction) => {\n    if (editing) return;\n    pressN.current += 1;\n    setPressed({ id: a.id, n: pressN.current });\n    setRecent((r) => [a.id, ...r.filter((x) => x !== a.id)].slice(0, 4));\n    onAction?.(a.id);\n    setToast(`${a.label} started`);\n    if (timer.current) clearTimeout(timer.current);\n    timer.current = setTimeout(() => setToast(null), 1800);\n  };\n  const setPins = (next: string[]) => {\n    setPinned(next);\n    onPinnedChange?.(next);\n  };\n  const onKey = (e: React.KeyboardEvent) => {\n    if (editing || e.metaKey || e.ctrlKey || e.altKey) return;\n    const tag = (e.target as HTMLElement).tagName;\n    if (tag === \"INPUT\" || tag === \"TEXTAREA\") return;\n    const n = Number(e.key);\n    if (n >= 1 && n <= 9 && grid[n - 1]) {\n      e.preventDefault();\n      run(grid[n - 1]);\n    }\n  };\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.card } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"relative mx-auto max-w-4xl px-4 py-10 @[640px]:px-6 @[640px]:py-14\">\n        <div className=\"rounded-2xl border p-5 @[640px]:p-6\" style={{ background: p.card, borderColor: p.border }} onKeyDown={onKey}>\n          <div className=\"flex flex-wrap items-center justify-between gap-3\">\n            <div>\n              <h2 className=\"m-0 text-[18px] font-semibold tracking-[-0.01em]\">{title}</h2>\n              <p className=\"m-0 mt-0.5 text-[12.5px]\" style={{ color: p.faint }}>\n                {editing ? \"Remove or add actions, then press Done.\" : \"Click an action, or press 1–9 while the grid has focus.\"}\n              </p>\n            </div>\n            <div className=\"flex w-full gap-2 @[560px]:w-auto\">\n              {!editing && (\n                <label className=\"relative min-w-0 flex-1 @[560px]:w-48 @[560px]:flex-none\">\n                  <span className=\"sr-only\">Filter actions</span>\n                  <svg className=\"pointer-events-none absolute top-1/2 left-3 -translate-y-1/2\" width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\" style={{ color: p.faint }}>\n                    <circle cx=\"11\" cy=\"11\" r=\"7\" />\n                    <path d=\"m20 20-3.5-3.5\" />\n                  </svg>\n                  <input type=\"search\" value={q} onChange={(e) => setQ(e.target.value)} placeholder=\"Filter\" className={cn(\"h-9 w-full rounded-lg border pr-3 pl-8 text-[13px]\", focus)} style={{ borderColor: p.border, background: \"transparent\", color: p.text, ...ring }} />\n                </label>\n              )}\n              <button\n                type=\"button\"\n                aria-pressed={editing}\n                onClick={() => {\n                  setEditing((e) => !e);\n                  setQ(\"\");\n                }}\n                className={cn(\"h-9 shrink-0 cursor-pointer rounded-lg border px-3.5 text-[13px] font-medium\", focus)}\n                style={{ borderColor: editing ? \"transparent\" : p.border, background: editing ? p.on : \"transparent\", color: editing ? p.onText : p.text, ...ring }}\n              >\n                {editing ? \"Done\" : \"Edit\"}\n              </button>\n            </div>\n          </div>\n\n          <ul className=\"m-0 mt-5 grid list-none grid-cols-2 gap-2.5 p-0 @[560px]:grid-cols-3 @[760px]:grid-cols-4\">\n            <AnimatePresence initial={false} mode=\"popLayout\">\n              {grid.map((a, i) => (\n                <motion.li key={a.id} layout={!reduce} initial={reduce ? false : { opacity: 0, scale: 0.9 }} animate={editing && !reduce ? { opacity: 1, scale: 1, rotate: [0, -1.2, 1.2, 0] } : { opacity: 1, scale: 1, rotate: 0 }} exit={reduce ? undefined : { opacity: 0, scale: 0.85, transition: { duration: 0.15 } }} transition={editing && !reduce ? { rotate: { duration: 0.35, repeat: Infinity, delay: (i % 3) * 0.08 }, default: { duration: 0.2 } } : { duration: 0.2 }} className=\"relative\">\n                  <motion.button\n                    type=\"button\"\n                    onClick={() => run(a)}\n                    disabled={editing}\n                    whileTap={reduce || editing ? undefined : { scale: 0.96 }}\n                    aria-keyshortcuts={!editing && i < 9 ? String(i + 1) : undefined}\n                    className={cn(\"group relative flex h-full w-full cursor-pointer flex-col items-start gap-3 overflow-hidden rounded-xl border p-3.5 text-left transition-colors disabled:cursor-default\", focus)}\n                    style={{ borderColor: p.border, background: p.tile, color: p.text, ...ring }}\n                  >\n                    <span className=\"pointer-events-none absolute inset-0 opacity-0 transition-opacity duration-300 group-hover:opacity-100\" style={{ background: `radial-gradient(120px circle at 20% 0%, ${a.color ?? p.on}22, transparent 70%)` }} aria-hidden=\"true\" />\n                    {pressed?.id === a.id && (\n                      <motion.span key={pressed.n} className=\"pointer-events-none absolute top-1/2 left-1/2 h-10 w-10 -translate-x-1/2 -translate-y-1/2 rounded-full\" style={{ background: a.color ?? p.on }} initial={{ scale: 0, opacity: 0.35 }} animate={{ scale: 8, opacity: 0 }} transition={{ duration: reduce ? 0 : 0.6, ease: \"easeOut\" }} aria-hidden=\"true\" />\n                    )}\n                    <span className=\"relative flex w-full items-start justify-between\">\n                      <span className=\"flex h-9 w-9 items-center justify-center rounded-lg\" style={{ background: `${a.color ?? p.on}1F`, color: a.color ?? p.text }}>\n                        {glyph(a.icon)}\n                      </span>\n                      {!editing && i < 9 && (\n                        <kbd className=\"rounded border px-1.5 font-mono text-[10.5px]\" style={{ borderColor: p.border, color: p.faint }}>\n                          {i + 1}\n                        </kbd>\n                      )}\n                    </span>\n                    <span className=\"relative min-w-0\">\n                      <span className=\"block text-[13.5px] font-medium\">{a.label}</span>\n                      {a.description && (\n                        <span className=\"mt-0.5 block text-[12px] leading-snug\" style={{ color: p.faint }}>\n                          {a.description}\n                        </span>\n                      )}\n                    </span>\n                  </motion.button>\n                  <AnimatePresence>\n                    {editing && (\n                      <motion.button type=\"button\" initial={reduce ? false : { scale: 0 }} animate={{ scale: 1 }} exit={reduce ? undefined : { scale: 0 }} onClick={() => setPins(pinned.filter((x) => x !== a.id))} disabled={pinned.length <= 1} aria-label={`Remove ${a.label}`} className={cn(\"absolute -top-2 -right-2 z-10 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full border-0 text-[13px] leading-none disabled:opacity-40\", focus)} style={{ background: p.red, color: \"#fff\", ...ring }}>\n                        ×\n                      </motion.button>\n                    )}\n                  </AnimatePresence>\n                </motion.li>\n              ))}\n            </AnimatePresence>\n          </ul>\n          {grid.length === 0 && (\n            <p className=\"m-0 py-8 text-center text-[13.5px]\" style={{ color: p.muted }}>\n              No pinned action matches “{q}”.\n            </p>\n          )}\n\n          <AnimatePresence initial={false}>\n            {editing && (\n              <motion.div initial={reduce ? false : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? undefined : { height: 0, opacity: 0 }} className=\"overflow-hidden\">\n                <div className=\"mt-5 border-t pt-4\" style={{ borderColor: p.border }}>\n                  <p className=\"m-0 mb-2.5 text-[12.5px]\" style={{ color: p.faint }}>\n                    {unpinned.length ? \"Add an action\" : \"Every action is pinned.\"}\n                  </p>\n                  <ul className=\"m-0 flex list-none flex-wrap gap-2 p-0\">\n                    <AnimatePresence initial={false} mode=\"popLayout\">\n                      {unpinned.map((a) => (\n                        <motion.li key={a.id} layout={!reduce} initial={reduce ? false : { opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} exit={reduce ? undefined : { opacity: 0, scale: 0.9 }}>\n                          <button type=\"button\" onClick={() => setPins([...pinned, a.id])} className={cn(\"flex h-9 cursor-pointer items-center gap-2 rounded-full border border-dashed bg-transparent pr-3.5 pl-2 text-[13px]\", focus)} style={{ borderColor: p.faint, color: p.text, ...ring }} aria-label={`Add ${a.label}`}>\n                            <span className=\"flex h-6 w-6 items-center justify-center rounded-full\" style={{ background: `${a.color ?? p.on}1F`, color: a.color ?? p.text }}>\n                              {glyph(a.icon, 13)}\n                            </span>\n                            {a.label}\n                            <span style={{ color: p.faint }} aria-hidden=\"true\">\n                              +\n                            </span>\n                          </button>\n                        </motion.li>\n                      ))}\n                    </AnimatePresence>\n                  </ul>\n                </div>\n              </motion.div>\n            )}\n          </AnimatePresence>\n\n          {!editing && recent.length > 0 && (\n            <div className=\"mt-5 flex flex-wrap items-center gap-2 border-t pt-4\" style={{ borderColor: p.border }}>\n              <span className=\"text-[12.5px]\" style={{ color: p.faint }} id={`${uid}-recent`}>\n                Recent\n              </span>\n              <ul className=\"m-0 flex list-none flex-wrap gap-1.5 p-0\" aria-labelledby={`${uid}-recent`}>\n                <AnimatePresence initial={false} mode=\"popLayout\">\n                  {recent.map((id) => {\n                    const a = byId(id);\n                    if (!a) return null;\n                    return (\n                      <motion.li key={id} layout={!reduce} initial={reduce ? false : { opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }} exit={reduce ? undefined : { opacity: 0 }}>\n                        <button type=\"button\" onClick={() => run(a)} className={cn(\"flex h-7 cursor-pointer items-center gap-1.5 rounded-full border-0 px-2.5 text-[12.5px]\", focus)} style={{ background: p.chip, color: p.muted, ...ring }}>\n                          <span style={{ color: a.color }}>{glyph(a.icon, 12)}</span>\n                          {a.label}\n                        </button>\n                      </motion.li>\n                    );\n                  })}\n                </AnimatePresence>\n              </ul>\n            </div>\n          )}\n        </div>\n\n        <div className=\"pointer-events-none absolute inset-x-0 bottom-4 flex justify-center px-4\" aria-live=\"polite\">\n          <AnimatePresence>\n            {toast && (\n              <motion.div key={toast + (pressed?.n ?? 0)} initial={reduce ? false : { opacity: 0, y: 10 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0, y: 6 }} className=\"rounded-full px-4 py-2 text-[13px] font-medium shadow-lg\" style={{ background: p.on, color: p.onText }}>\n                {toast}\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default QuickActionsGrid;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}