{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "instant",
  "title": "Instant",
  "description": "Keyboard-opened overlays do not animate: they answer a deliberate key press and are opened constantly.",
  "registryDependencies": [],
  "files": [
    {
      "path": "registry/ikada/lib/ikada/instant.tsx",
      "content": "\"use client\";\n\nimport { createContext, useCallback, useContext, useState } from \"react\";\n\n/**\n * Keyboard-opened overlays do not animate: they answer a deliberate key press and\n * are opened constantly. Roots wrap `onOpenChange` with `useInstantOpen`, share the\n * result through context, and the popup sets `data-sb-instant` on itself.\n */\nconst InstantContext = createContext(false);\nexport const InstantProvider = InstantContext.Provider;\nexport const useInstant = (): boolean => useContext(InstantContext);\n\n/** A key press, or a click with `detail === 0` (Enter or Space on a button). */\nexport function isKeyboardEvent(event: Event | undefined): boolean {\n  if (!event) return false;\n  if (event.type.startsWith(\"key\")) return true;\n  return event instanceof MouseEvent && event.type === \"click\" && event.detail === 0;\n}\n\nexport function useInstantOpen<Details extends { event: Event }>(\n  onOpenChange?: (open: boolean, details: Details) => void,\n): [boolean, (open: boolean, details: Details) => void] {\n  const [instant, setInstant] = useState(false);\n  const handle = useCallback(\n    (open: boolean, details: Details) => {\n      if (open) setInstant(isKeyboardEvent(details.event));\n      onOpenChange?.(open, details);\n    },\n    [onOpenChange],\n  );\n  return [instant, handle];\n}\n\n/** The attribute popups spread so CSS can switch the transition off. */\nexport const instantAttr = (instant: boolean): { \"data-sb-instant\"?: \"\" } => (instant ? { \"data-sb-instant\": \"\" } : {});\n",
      "type": "registry:lib",
      "target": "@components/ikada/lib/instant.tsx"
    }
  ],
  "categories": [
    "utilities"
  ],
  "type": "registry:lib"
}