@c-rex/ui 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,169 +1,169 @@
1
- import * as React from "react"
2
- import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
3
- import { cva } from "class-variance-authority"
4
- import { ChevronDownIcon } from "lucide-react"
5
-
6
- import { cn } from "@c-rex/utils"
7
-
8
- function NavigationMenu({
9
- className,
10
- children,
11
- viewport = true,
12
- ...props
13
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
14
- viewport?: boolean
15
- }) {
16
- return (
17
- <NavigationMenuPrimitive.Root
18
- data-slot="navigation-menu"
19
- data-viewport={viewport}
20
- className={cn(
21
- "group/navigation-menu relative flex max-w-max flex-1 items-center",
22
- className
23
- )}
24
- {...props}
25
- >
26
- {children}
27
- {viewport && <NavigationMenuViewport />}
28
- </NavigationMenuPrimitive.Root>
29
- )
30
- }
31
-
32
- function NavigationMenuList({
33
- className,
34
- ...props
35
- }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
36
- return (
37
- <NavigationMenuPrimitive.List
38
- data-slot="navigation-menu-list"
39
- className={cn(
40
- "group flex flex-1 list-none items-center justify-center gap-1",
41
- className
42
- )}
43
- {...props}
44
- />
45
- )
46
- }
47
-
48
- function NavigationMenuItem({
49
- className,
50
- ...props
51
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
52
- return (
53
- <NavigationMenuPrimitive.Item
54
- data-slot="navigation-menu-item"
55
- className={cn("relative", className)}
56
- {...props}
57
- />
58
- )
59
- }
60
-
61
- function NavigationMenuTrigger({
62
- className,
63
- children,
64
- ...props
65
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
66
- return (
67
- <NavigationMenuPrimitive.Trigger
68
- data-slot="navigation-menu-trigger"
69
- className={cn(
70
- "group inline-flex h-9 w-max items-center justify-center rounded-full pl-4 pr-3 py-2 text-sm font-medium",
71
- "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
72
- "focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 ",
73
- "group",
74
- className
75
- )}
76
- {...props}
77
- >
78
- {children}{" "}
79
- <ChevronDownIcon
80
- className="relative top-[1px] transition duration-300 group-data-[state=open]:rotate-180"
81
- aria-hidden="true"
82
- />
83
- </NavigationMenuPrimitive.Trigger>
84
- )
85
- }
86
-
87
- function NavigationMenuContent({
88
- className,
89
- ...props
90
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
91
- return (
92
- <NavigationMenuPrimitive.Content
93
- data-slot="navigation-menu-content"
94
- className={cn(
95
- "data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 right-0 p-2 pr-2.5 absolute",
96
- "group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none z-50",
97
- className
98
- )}
99
- {...props}
100
- />
101
- )
102
- }
103
-
104
- function NavigationMenuViewport({
105
- className,
106
- ...props
107
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
108
- return (
109
- <div
110
- className={cn(
111
- "absolute top-full left-0 isolate z-50 flex justify-center"
112
- )}
113
- >
114
- <NavigationMenuPrimitive.Viewport
115
- data-slot="navigation-menu-viewport"
116
- className={cn(
117
- "origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]",
118
- className
119
- )}
120
- {...props}
121
- />
122
- </div>
123
- )
124
- }
125
-
126
- function NavigationMenuLink({
127
- className,
128
- ...props
129
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
130
- return (
131
- <NavigationMenuPrimitive.Link
132
- data-slot="navigation-menu-link"
133
- className={cn(
134
- "data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
135
- className
136
- )}
137
- {...props}
138
- />
139
- )
140
- }
141
-
142
- function NavigationMenuIndicator({
143
- className,
144
- ...props
145
- }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
146
- return (
147
- <NavigationMenuPrimitive.Indicator
148
- data-slot="navigation-menu-indicator"
149
- className={cn(
150
- "data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
151
- className
152
- )}
153
- {...props}
154
- >
155
- <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
156
- </NavigationMenuPrimitive.Indicator>
157
- )
158
- }
159
-
160
- export {
161
- NavigationMenu,
162
- NavigationMenuList,
163
- NavigationMenuItem,
164
- NavigationMenuContent,
165
- NavigationMenuTrigger,
166
- NavigationMenuLink,
167
- NavigationMenuIndicator,
168
- NavigationMenuViewport,
169
- }
1
+ import * as React from "react"
2
+ import * as NavigationMenuPrimitive from "@radix-ui/react-navigation-menu"
3
+ import { cva } from "class-variance-authority"
4
+ import { ChevronDownIcon } from "lucide-react"
5
+
6
+ import { cn } from "@c-rex/utils"
7
+
8
+ function NavigationMenu({
9
+ className,
10
+ children,
11
+ viewport = true,
12
+ ...props
13
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
14
+ viewport?: boolean
15
+ }) {
16
+ return (
17
+ <NavigationMenuPrimitive.Root
18
+ data-slot="navigation-menu"
19
+ data-viewport={viewport}
20
+ className={cn(
21
+ "group/navigation-menu relative flex max-w-max flex-1 items-center",
22
+ className
23
+ )}
24
+ {...props}
25
+ >
26
+ {children}
27
+ {viewport && <NavigationMenuViewport />}
28
+ </NavigationMenuPrimitive.Root>
29
+ )
30
+ }
31
+
32
+ function NavigationMenuList({
33
+ className,
34
+ ...props
35
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
36
+ return (
37
+ <NavigationMenuPrimitive.List
38
+ data-slot="navigation-menu-list"
39
+ className={cn(
40
+ "group flex flex-1 list-none items-center justify-center gap-1",
41
+ className
42
+ )}
43
+ {...props}
44
+ />
45
+ )
46
+ }
47
+
48
+ function NavigationMenuItem({
49
+ className,
50
+ ...props
51
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
52
+ return (
53
+ <NavigationMenuPrimitive.Item
54
+ data-slot="navigation-menu-item"
55
+ className={cn("relative", className)}
56
+ {...props}
57
+ />
58
+ )
59
+ }
60
+
61
+ function NavigationMenuTrigger({
62
+ className,
63
+ children,
64
+ ...props
65
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
66
+ return (
67
+ <NavigationMenuPrimitive.Trigger
68
+ data-slot="navigation-menu-trigger"
69
+ className={cn(
70
+ "group inline-flex h-9 w-max items-center justify-center rounded-full pl-4 pr-3 py-2 text-sm font-medium",
71
+ "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
72
+ "focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 ",
73
+ "group",
74
+ className
75
+ )}
76
+ {...props}
77
+ >
78
+ {children}{" "}
79
+ <ChevronDownIcon
80
+ className="relative top-[1px] transition duration-300 group-data-[state=open]:rotate-180"
81
+ aria-hidden="true"
82
+ />
83
+ </NavigationMenuPrimitive.Trigger>
84
+ )
85
+ }
86
+
87
+ function NavigationMenuContent({
88
+ className,
89
+ ...props
90
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
91
+ return (
92
+ <NavigationMenuPrimitive.Content
93
+ data-slot="navigation-menu-content"
94
+ className={cn(
95
+ "data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 right-0 p-2 pr-2.5 absolute",
96
+ "group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none z-50",
97
+ className
98
+ )}
99
+ {...props}
100
+ />
101
+ )
102
+ }
103
+
104
+ function NavigationMenuViewport({
105
+ className,
106
+ ...props
107
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
108
+ return (
109
+ <div
110
+ className={cn(
111
+ "absolute top-full left-0 isolate z-50 flex justify-center"
112
+ )}
113
+ >
114
+ <NavigationMenuPrimitive.Viewport
115
+ data-slot="navigation-menu-viewport"
116
+ className={cn(
117
+ "origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]",
118
+ className
119
+ )}
120
+ {...props}
121
+ />
122
+ </div>
123
+ )
124
+ }
125
+
126
+ function NavigationMenuLink({
127
+ className,
128
+ ...props
129
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
130
+ return (
131
+ <NavigationMenuPrimitive.Link
132
+ data-slot="navigation-menu-link"
133
+ className={cn(
134
+ "data-[active=true]:focus:bg-accent data-[active=true]:hover:bg-accent data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-ring/50 [&_svg:not([class*='text-'])]:text-muted-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4",
135
+ className
136
+ )}
137
+ {...props}
138
+ />
139
+ )
140
+ }
141
+
142
+ function NavigationMenuIndicator({
143
+ className,
144
+ ...props
145
+ }: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
146
+ return (
147
+ <NavigationMenuPrimitive.Indicator
148
+ data-slot="navigation-menu-indicator"
149
+ className={cn(
150
+ "data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden",
151
+ className
152
+ )}
153
+ {...props}
154
+ >
155
+ <div className="bg-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" />
156
+ </NavigationMenuPrimitive.Indicator>
157
+ )
158
+ }
159
+
160
+ export {
161
+ NavigationMenu,
162
+ NavigationMenuList,
163
+ NavigationMenuItem,
164
+ NavigationMenuContent,
165
+ NavigationMenuTrigger,
166
+ NavigationMenuLink,
167
+ NavigationMenuIndicator,
168
+ NavigationMenuViewport,
169
+ }
@@ -1,124 +1,124 @@
1
- import * as React from "react"
2
- import {
3
- ChevronLeftIcon,
4
- ChevronRightIcon,
5
- MoreHorizontalIcon,
6
- } from "lucide-react"
7
-
8
- import { cn } from "@c-rex/utils"
9
- import { Button, buttonVariants } from "./button"
10
-
11
- function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
12
- return (
13
- <nav
14
- role="navigation"
15
- aria-label="pagination"
16
- data-slot="pagination"
17
- className={cn("mx-auto flex w-full justify-center", className)}
18
- {...props}
19
- />
20
- )
21
- }
22
-
23
- function PaginationContent({
24
- className,
25
- ...props
26
- }: React.ComponentProps<"ul">) {
27
- return (
28
- <ul
29
- data-slot="pagination-content"
30
- className={cn("flex flex-row items-center gap-1", className)}
31
- {...props}
32
- />
33
- )
34
- }
35
-
36
- function PaginationItem({ ...props }: React.ComponentProps<"li">) {
37
- return <li data-slot="pagination-item" {...props} />
38
- }
39
-
40
- type PaginationLinkProps = {
41
- isActive?: boolean
42
- } & Pick<React.ComponentProps<typeof Button>, "size"> &
43
- React.ComponentProps<"a">
44
-
45
- function PaginationLink({
46
- className,
47
- isActive,
48
- size = "icon",
49
- ...props
50
- }: PaginationLinkProps) {
51
- return (
52
- <a
53
- aria-current={isActive ? "page" : undefined}
54
- data-slot="pagination-link"
55
- data-active={isActive}
56
- className={cn(
57
- buttonVariants({
58
- variant: isActive ? "outline" : "ghost",
59
- size,
60
- }),
61
- className
62
- )}
63
- {...props}
64
- />
65
- )
66
- }
67
-
68
- function PaginationPrevious({
69
- className,
70
- ...props
71
- }: React.ComponentProps<typeof PaginationLink>) {
72
- return (
73
- <PaginationLink
74
- aria-label="Go to previous page"
75
- size="default"
76
- className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
77
- {...props}
78
- >
79
- <ChevronLeftIcon />
80
- </PaginationLink>
81
- )
82
- }
83
-
84
- function PaginationNext({
85
- className,
86
- ...props
87
- }: React.ComponentProps<typeof PaginationLink>) {
88
- return (
89
- <PaginationLink
90
- aria-label="Go to next page"
91
- size="default"
92
- className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
93
- {...props}
94
- >
95
- <ChevronRightIcon />
96
- </PaginationLink>
97
- )
98
- }
99
-
100
- function PaginationEllipsis({
101
- className,
102
- ...props
103
- }: React.ComponentProps<"span">) {
104
- return (
105
- <span
106
- data-slot="pagination-ellipsis"
107
- className={cn("flex size-9 items-center justify-center", className)}
108
- {...props}
109
- >
110
- <MoreHorizontalIcon className="size-4" />
111
- <span className="sr-only">More pages</span>
112
- </span>
113
- )
114
- }
115
-
116
- export {
117
- Pagination,
118
- PaginationContent,
119
- PaginationLink,
120
- PaginationItem,
121
- PaginationPrevious,
122
- PaginationNext,
123
- PaginationEllipsis,
124
- }
1
+ import * as React from "react"
2
+ import {
3
+ ChevronLeftIcon,
4
+ ChevronRightIcon,
5
+ MoreHorizontalIcon,
6
+ } from "lucide-react"
7
+
8
+ import { cn } from "@c-rex/utils"
9
+ import { Button, buttonVariants } from "./button"
10
+
11
+ function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
12
+ return (
13
+ <nav
14
+ role="navigation"
15
+ aria-label="pagination"
16
+ data-slot="pagination"
17
+ className={cn("mx-auto flex w-full justify-center", className)}
18
+ {...props}
19
+ />
20
+ )
21
+ }
22
+
23
+ function PaginationContent({
24
+ className,
25
+ ...props
26
+ }: React.ComponentProps<"ul">) {
27
+ return (
28
+ <ul
29
+ data-slot="pagination-content"
30
+ className={cn("flex flex-row items-center gap-1", className)}
31
+ {...props}
32
+ />
33
+ )
34
+ }
35
+
36
+ function PaginationItem({ ...props }: React.ComponentProps<"li">) {
37
+ return <li data-slot="pagination-item" {...props} />
38
+ }
39
+
40
+ type PaginationLinkProps = {
41
+ isActive?: boolean
42
+ } & Pick<React.ComponentProps<typeof Button>, "size"> &
43
+ React.ComponentProps<"a">
44
+
45
+ function PaginationLink({
46
+ className,
47
+ isActive,
48
+ size = "icon",
49
+ ...props
50
+ }: PaginationLinkProps) {
51
+ return (
52
+ <a
53
+ aria-current={isActive ? "page" : undefined}
54
+ data-slot="pagination-link"
55
+ data-active={isActive}
56
+ className={cn(
57
+ buttonVariants({
58
+ variant: isActive ? "outline" : "ghost",
59
+ size,
60
+ }),
61
+ className
62
+ )}
63
+ {...props}
64
+ />
65
+ )
66
+ }
67
+
68
+ function PaginationPrevious({
69
+ className,
70
+ ...props
71
+ }: React.ComponentProps<typeof PaginationLink>) {
72
+ return (
73
+ <PaginationLink
74
+ aria-label="Go to previous page"
75
+ size="default"
76
+ className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
77
+ {...props}
78
+ >
79
+ <ChevronLeftIcon />
80
+ </PaginationLink>
81
+ )
82
+ }
83
+
84
+ function PaginationNext({
85
+ className,
86
+ ...props
87
+ }: React.ComponentProps<typeof PaginationLink>) {
88
+ return (
89
+ <PaginationLink
90
+ aria-label="Go to next page"
91
+ size="default"
92
+ className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
93
+ {...props}
94
+ >
95
+ <ChevronRightIcon />
96
+ </PaginationLink>
97
+ )
98
+ }
99
+
100
+ function PaginationEllipsis({
101
+ className,
102
+ ...props
103
+ }: React.ComponentProps<"span">) {
104
+ return (
105
+ <span
106
+ data-slot="pagination-ellipsis"
107
+ className={cn("flex size-9 items-center justify-center", className)}
108
+ {...props}
109
+ >
110
+ <MoreHorizontalIcon className="size-4" />
111
+ <span className="sr-only">More pages</span>
112
+ </span>
113
+ )
114
+ }
115
+
116
+ export {
117
+ Pagination,
118
+ PaginationContent,
119
+ PaginationLink,
120
+ PaginationItem,
121
+ PaginationPrevious,
122
+ PaginationNext,
123
+ PaginationEllipsis,
124
+ }
package/src/popover.tsx CHANGED
@@ -1,31 +1,31 @@
1
- import * as React from "react";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
3
-
4
- import { cn } from "@c-rex/utils";
5
-
6
- const Popover = PopoverPrimitive.Root;
7
-
8
- const PopoverTrigger = PopoverPrimitive.Trigger;
9
-
10
- const PopoverAnchor = PopoverPrimitive.Anchor;
11
-
12
- const PopoverContent = React.forwardRef<
13
- React.ElementRef<typeof PopoverPrimitive.Content>,
14
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15
- >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16
- <PopoverPrimitive.Portal>
17
- <PopoverPrimitive.Content
18
- ref={ref}
19
- align={align}
20
- sideOffset={sideOffset}
21
- className={cn(
22
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
23
- className,
24
- )}
25
- {...props}
26
- />
27
- </PopoverPrimitive.Portal>
28
- ));
29
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
30
-
31
- export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };
1
+ import * as React from "react";
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
3
+
4
+ import { cn } from "@c-rex/utils";
5
+
6
+ const Popover = PopoverPrimitive.Root;
7
+
8
+ const PopoverTrigger = PopoverPrimitive.Trigger;
9
+
10
+ const PopoverAnchor = PopoverPrimitive.Anchor;
11
+
12
+ const PopoverContent = React.forwardRef<
13
+ React.ElementRef<typeof PopoverPrimitive.Content>,
14
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15
+ >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
16
+ <PopoverPrimitive.Portal>
17
+ <PopoverPrimitive.Content
18
+ ref={ref}
19
+ align={align}
20
+ sideOffset={sideOffset}
21
+ className={cn(
22
+ "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
23
+ className,
24
+ )}
25
+ {...props}
26
+ />
27
+ </PopoverPrimitive.Portal>
28
+ ));
29
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
30
+
31
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor };