{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "popup",
  "type": "registry:ui",
  "title": "Popup",
  "description": "Popup is a floating panel anchored to a trigger, built on Radix Popover.",
  "dependencies": [
    "@radix-ui/react-popover@^1.1.15",
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/scroll-area.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/popup/Popup.context.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/Popup.context.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\n\ntype PopupContainerContextValue = {\n  setTitleId: (id: string | undefined) => void;\n  setDescriptionId: (id: string | undefined) => void;\n};\n\nexport const PopupContainerContext = React.createContext<PopupContainerContextValue | undefined>(\n  undefined,\n);\n\nexport const usePopupLabelId = (kind: 'title' | 'description', idProp: string | undefined) => {\n  const generatedId = React.useId();\n  const id = idProp ?? generatedId;\n  const context = React.useContext(PopupContainerContext);\n  const register = kind === 'title' ? context?.setTitleId : context?.setDescriptionId;\n\n  React.useLayoutEffect(() => {\n    if (!register) return;\n    register(id);\n    return () => register(undefined);\n  }, [register, id]);\n\n  return id;\n};\n"
    },
    {
      "path": "src/components/popup/Popup.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/Popup.tsx",
      "content": "'use client';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { PopupClose } from './PopupClose';\nimport { PopupContainer } from './PopupContainer';\nimport { PopupContent } from './PopupContent';\nimport { PopupDescription } from './PopupDescription';\nimport { PopupFooter } from './PopupFooter';\nimport { PopupHeader } from './PopupHeader';\nimport { PopupTitle } from './PopupTitle';\nimport { PopupTrigger } from './PopupTrigger';\n\nconst Popup = PopoverPrimitive.Root as typeof PopoverPrimitive.Root & {\n  Close: typeof PopupClose;\n  Container: typeof PopupContainer;\n  Content: typeof PopupContent;\n  Description: typeof PopupDescription;\n  Footer: typeof PopupFooter;\n  Header: typeof PopupHeader;\n  Title: typeof PopupTitle;\n  Trigger: typeof PopupTrigger;\n};\n\nPopup.displayName = 'Popup';\nPopup.Close = PopupClose;\nPopup.Container = PopupContainer;\nPopup.Content = PopupContent;\nPopup.Description = PopupDescription;\nPopup.Footer = PopupFooter;\nPopup.Header = PopupHeader;\nPopup.Title = PopupTitle;\nPopup.Trigger = PopupTrigger;\n\nexport { Popup };\n"
    },
    {
      "path": "src/components/popup/Popup.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/Popup.types.ts",
      "content": "import type * as PopoverPrimitive from '@radix-ui/react-popover';\nimport type { ComponentProps, ComponentPropsWithoutRef, HTMLAttributes } from 'react';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\n\nexport type PopupProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Root>;\n\n/** The portal destination for floating content. */\nexport type PopupPortalProps = ComponentProps<typeof PopoverPrimitive.Portal>;\n\n/** The control that opens or toggles the associated content. */\nexport type PopupTriggerProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Trigger>;\n\n/** A control that closes the associated dialog. */\nexport type PopupCloseProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Close>;\n\n/** The floating surface or stack containing feedback content. */\nexport type PopupContainerProps = ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> &\n  MotionProps & {\n    /** Prevents closing the popup by clicking outside or pressing Escape. */\n    persistent?: boolean;\n    /** DOM element to portal the popup content into. Defaults to `document.body`. */\n    portalContainer?: PopupPortalProps['container'];\n  };\n\n/** The header area for a title and supporting content. */\nexport type PopupHeaderProps = HTMLAttributes<HTMLDivElement>;\n\n/** The primary title text. */\nexport type PopupTitleProps = HTMLAttributes<HTMLHeadingElement>;\n\n/** Supporting descriptive text. */\nexport type PopupDescriptionProps = HTMLAttributes<HTMLParagraphElement>;\n\n/** The content surface rendered within `Popup`. */\nexport type PopupContentProps = HTMLAttributes<HTMLDivElement> & {\n  /** Additional className applied to the inner scroll content wrapper. */\n  contentClassName?: string;\n};\n\n/** The action area beneath the main content. */\nexport type PopupFooterProps = HTMLAttributes<HTMLDivElement>;\n"
    },
    {
      "path": "src/components/popup/Popup.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/Popup.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\nimport { cn } from '@/lib/wideset/utils';\n\nexport const popupContainerClassName = cn(\n  'rounded-ws-container-lg flex w-[492px] flex-col',\n  'bg-ws-static-overlay',\n  'shadow-ws-high',\n  'z-ws-popout',\n  'outline-hidden',\n);\n\nexport const popupContainerMotionVariants = cva('', {\n  variants: {\n    enabled: {\n      true: cn(\n        'origin-radix-popover',\n        'transition-none',\n        'data-[state=open]:animate-in data-[state=closed]:animate-out',\n        'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n        'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n        'data-[side=bottom]:ws-slide-in-from-top-2',\n        'data-[side=left]:slide-in-from-right-ws-2',\n        'data-[side=right]:ws-slide-in-from-left-2',\n        'data-[side=top]:slide-in-from-bottom-ws-2',\n        'ease-(--ws-motion-ease-smooth-out) data-[state=open]:duration-(--ws-motion-duration-fast)',\n        'data-[state=closed]:duration-(--ws-motion-duration-quick)',\n      ),\n      false: '',\n    },\n  },\n  defaultVariants: { enabled: true },\n});\n"
    },
    {
      "path": "src/components/popup/PopupClose.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupClose.tsx",
      "content": "'use client';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as React from 'react';\n\nimport type { PopupCloseProps } from './Popup.types';\n\nconst PopupClose = React.forwardRef<\n  React.ComponentRef<typeof PopoverPrimitive.Close>,\n  PopupCloseProps\n>((props, ref) => <PopoverPrimitive.Close ref={ref} data-slot=\"popup-close\" {...props} />);\nPopupClose.displayName = 'Popup.Close';\n\nexport { PopupClose };\n"
    },
    {
      "path": "src/components/popup/PopupContainer.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupContainer.tsx",
      "content": "'use client';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { PopupContainerContext } from './Popup.context';\nimport type { PopupContainerProps } from './Popup.types';\nimport { popupContainerClassName, popupContainerMotionVariants } from './Popup.variants';\n\nconst PopupContainer = React.forwardRef<\n  React.ComponentRef<typeof PopoverPrimitive.Content>,\n  PopupContainerProps\n>(\n  (\n    {\n      className,\n      children,\n      align = 'start',\n      sideOffset = 8,\n      persistent = false,\n      portalContainer,\n      defaultMotion,\n      ...props\n    },\n    ref,\n  ) => {\n    const motion = useDefaultMotion(defaultMotion);\n    const [titleId, setTitleId] = React.useState<string>();\n    const [descriptionId, setDescriptionId] = React.useState<string>();\n    const contextValue = React.useMemo(() => ({ setTitleId, setDescriptionId }), []);\n    const content = (\n      <PopoverPrimitive.Content\n        ref={ref}\n        data-slot=\"popup-container\"\n        aria-labelledby={props['aria-label'] ? undefined : titleId}\n        aria-describedby={descriptionId}\n        align={align}\n        sideOffset={sideOffset}\n        className={cn(\n          popupContainerClassName,\n          popupContainerMotionVariants({ enabled: motion }),\n          className,\n        )}\n        onPointerDownOutside={(event) => (persistent ? event.preventDefault() : undefined)}\n        onEscapeKeyDown={(event) => (persistent ? event.preventDefault() : undefined)}\n        {...props}\n      >\n        <PopupContainerContext.Provider value={contextValue}>\n          {children}\n        </PopupContainerContext.Provider>\n      </PopoverPrimitive.Content>\n    );\n\n    // Portals to document.body by default, like Select.Content: rendered in place the popup is\n    // clipped by a Modal / Sidepanel and trapped in their stacking context, below z-ws-popout.\n    // The Portal gates mounting on its own forceMount, so Content forceMount must reach it too.\n    return (\n      <PopoverPrimitive.Portal container={portalContainer} forceMount={props.forceMount}>\n        {content}\n      </PopoverPrimitive.Portal>\n    );\n  },\n);\nPopupContainer.displayName = 'Popup.Container';\n\nexport { PopupContainer };\n"
    },
    {
      "path": "src/components/popup/PopupContent.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupContent.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { ScrollArea } from '../scroll-area/ScrollArea';\nimport type { PopupContentProps } from './Popup.types';\n\nconst PopupContent = React.forwardRef<HTMLDivElement, PopupContentProps>(\n  ({ className, contentClassName, children, ...props }, ref) => (\n    <ScrollArea className={cn('grow', className)}>\n      <div\n        ref={ref}\n        data-slot=\"popup-content\"\n        className={cn('p-ws-11 min-h-full', contentClassName)}\n        {...props}\n      >\n        {children}\n      </div>\n    </ScrollArea>\n  ),\n);\nPopupContent.displayName = 'Popup.Content';\n\nexport { PopupContent };\n"
    },
    {
      "path": "src/components/popup/PopupDescription.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupDescription.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { usePopupLabelId } from './Popup.context';\nimport type { PopupDescriptionProps } from './Popup.types';\n\nconst PopupDescription = React.forwardRef<HTMLParagraphElement, PopupDescriptionProps>(\n  ({ className, id: idProp, ...props }, ref) => {\n    const id = usePopupLabelId('description', idProp);\n    return (\n      <p\n        ref={ref}\n        id={id}\n        data-slot=\"popup-description\"\n        className={cn('text-ws-static-subtle typography-body-md', className)}\n        {...props}\n      />\n    );\n  },\n);\nPopupDescription.displayName = 'Popup.Description';\n\nexport { PopupDescription };\n"
    },
    {
      "path": "src/components/popup/PopupFooter.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupFooter.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { PopupFooterProps } from './Popup.types';\n\nconst PopupFooter = React.forwardRef<HTMLDivElement, PopupFooterProps>(\n  ({ className, ...props }, ref) => (\n    <div\n      ref={ref}\n      data-slot=\"popup-footer\"\n      className={cn(\n        'border-ws-static-base bg-ws-static-alpha-subtle rounded-b-ws-container-lg gap-ws-5 px-ws-11 py-ws-9 flex items-center justify-end border-t',\n        className,\n      )}\n      {...props}\n    />\n  ),\n);\nPopupFooter.displayName = 'Popup.Footer';\n\nexport { PopupFooter };\n"
    },
    {
      "path": "src/components/popup/PopupHeader.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupHeader.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { PopupHeaderProps } from './Popup.types';\n\nconst PopupHeader = React.forwardRef<HTMLDivElement, PopupHeaderProps>(\n  ({ className, ...props }, ref) => (\n    <div\n      ref={ref}\n      data-slot=\"popup-header\"\n      className={cn('border-ws-static-base px-ws-11 py-ws-9 border-b', className)}\n      {...props}\n    />\n  ),\n);\nPopupHeader.displayName = 'Popup.Header';\n\nexport { PopupHeader };\n"
    },
    {
      "path": "src/components/popup/PopupTitle.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupTitle.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { usePopupLabelId } from './Popup.context';\nimport type { PopupTitleProps } from './Popup.types';\n\nconst PopupTitle = React.forwardRef<HTMLHeadingElement, PopupTitleProps>(\n  ({ className, children, id: idProp, ...props }, ref) => {\n    const id = usePopupLabelId('title', idProp);\n    return (\n      <h2\n        ref={ref}\n        id={id}\n        data-slot=\"popup-title\"\n        className={cn('text-ws-static-strong typography-subtitle-sm', className)}\n        {...props}\n      >\n        {children}\n      </h2>\n    );\n  },\n);\nPopupTitle.displayName = 'Popup.Title';\n\nexport { PopupTitle };\n"
    },
    {
      "path": "src/components/popup/PopupTrigger.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/popup/PopupTrigger.tsx",
      "content": "'use client';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\nimport * as React from 'react';\n\nimport type { PopupTriggerProps } from './Popup.types';\n\nconst PopupTrigger = React.forwardRef<\n  React.ComponentRef<typeof PopoverPrimitive.Trigger>,\n  PopupTriggerProps\n>((props, ref) => <PopoverPrimitive.Trigger ref={ref} data-slot=\"popup-trigger\" {...props} />);\nPopupTrigger.displayName = 'Popup.Trigger';\n\nexport { PopupTrigger };\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
