{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "popover", "title": "Popover", "description": "Polaris-styled Popover component.", "dependencies": [], "devDependencies": [ "@shopify/polaris-types" ], "registryDependencies": [ "@polaris-shadcn/theme", "@polaris-shadcn/utils" ], "files": [ { "path": "registry/templates/components/ui/popover.tsx", "content": "import * as React from \"react\";\nimport { cn } from \"../../lib/utils\";\n\ntype SButtonProps = React.ComponentPropsWithoutRef<\"s-button\">;\ntype SPopoverProps = React.ComponentPropsWithoutRef<\"s-popover\">;\n\nexport interface PopoverProps {\n children?: React.ReactNode;\n}\n\nexport interface PopoverTriggerProps extends Omit {\n className?: string;\n popoverId?: string;\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface PopoverContentProps extends SPopoverProps {\n className?: string;\n}\n\nexport interface PopoverCloseProps extends Omit {\n className?: string;\n popoverId?: string;\n asChild?: boolean;\n children?: React.ReactNode;\n}\n\n/** Props injected onto the cloned trigger/close child element. */\ntype PopoverCommandChildProps = SButtonProps & {\n className?: string;\n ref?: React.ForwardedRef;\n};\n\nconst Popover: React.FC = ({ children }) => {\n return <>{children};\n};\nPopover.displayName = \"Popover\";\n\nconst PopoverTrigger = React.forwardRef(\n ({ popoverId, command = \"--toggle\", children, asChild, ...props }, ref) => {\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(children as React.ReactElement, {\n ref,\n commandFor: popoverId,\n command,\n ...props,\n });\n }\n\n return (\n \n {children}\n \n );\n },\n);\nPopoverTrigger.displayName = \"PopoverTrigger\";\n\nconst PopoverContent = React.forwardRef(\n (\n {\n id,\n className,\n inlineSize = \"auto\",\n blockSize = \"auto\",\n minInlineSize,\n minBlockSize,\n maxInlineSize,\n maxBlockSize,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n \n {children}\n \n );\n },\n);\nPopoverContent.displayName = \"PopoverContent\";\n\nconst PopoverClose = React.forwardRef(\n ({ popoverId, children, asChild, ...props }, ref) => {\n if (asChild && React.isValidElement(children)) {\n return React.cloneElement(children as React.ReactElement, {\n ref,\n commandFor: popoverId,\n command: \"--hide\",\n ...props,\n });\n }\n\n return (\n \n {children}\n \n );\n },\n);\nPopoverClose.displayName = \"PopoverClose\";\n\nexport { Popover, PopoverTrigger, PopoverContent, PopoverClose };\n", "type": "registry:ui" } ], "type": "registry:ui" }