File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed
packages/ui/src/components/popover Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Anchor } from '@radix-ui/react-popover' ;
2+
3+ import { cn } from '@/lib/utils' ;
4+
5+ import { popoverVariants } from './popover-varianst' ;
6+ import type { PopoverAnchorProps } from './types' ;
7+
8+ const PopoverAnchor = ( props : PopoverAnchorProps ) => {
9+ const { className, ...rest } = props ;
10+
11+ const { anchor } = popoverVariants ( ) ;
12+
13+ const mergedCls = cn ( anchor ( ) , className ) ;
14+
15+ return (
16+ < Anchor
17+ className = { mergedCls }
18+ data-slot = "combobox-anchor"
19+ { ...rest }
20+ />
21+ ) ;
22+ } ;
23+
24+ export default PopoverAnchor ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export const popoverVariants = tv({
55 size : 'md'
66 } ,
77 slots : {
8+ anchor : 'w-full' ,
89 arrow : 'w-1em h-0.5em fill-popover stroke-border' ,
910 content : [
1011 `w-auto rounded-md border bg-popover text-popover-foreground shadow-md outline-none z-50 will-change-transform` ,
Original file line number Diff line number Diff line change 11import type {
22 // eslint-disable-next-line sort/import-members
33 PopoverPortalProps ,
4+ PopoverAnchorProps as _PopoverAnchorProps ,
45 PopoverArrowProps as _PopoverArrowProps ,
56 PopoverContentProps as _PopoverContentProps ,
67 PopoverProps as _PopoverProps
@@ -28,3 +29,5 @@ export type PopoverProps = _PopoverProps &
2829 showArrow ?: boolean ;
2930 trigger ?: React . ReactNode ;
3031 } ;
32+
33+ export type PopoverAnchorProps = BaseNodeProps < _PopoverAnchorProps > ;
You can’t perform that action at this time.
0 commit comments