| 1 | "use client"; |
| 2 | |
| 3 | import * as React from |
| 4 | import { cn } |
| 5 | import { DropdownMenu as |
| 6 | import { CheckIcon, ChevronRightIcon |
| 7 | |
| 8 | function DropdownMenu({ |
| 9 | ...props |
| 10 | }: React. |
| 11 | return <DropdownMenuPrimitive.Root data-slot |
| 12 | } |
| 13 | |
| 14 | function DropdownMenuPortal({ |
| 15 | ...props |
| 16 | }: React. |
| 17 | return ( |
| 18 | <DropdownMenuPrimitive.Portal data-slot=" |
| 19 | ); |
| 20 | } |
| 21 | |
| 22 | function DropdownMenuTrigger({ |
| 23 | ...props |
| 24 | }: React. |
| 25 | return ( |
| 26 | <DropdownMenuPrimitive.Trigger |
| 27 | data-slot="dropdown-menu-trigger" |
| 28 | {...props} |
| 29 | /> |
| 30 | ); |
| 31 | } |
| 32 | |
| 33 | function DropdownMenuContent({ |
| 34 | className, |
| 35 | align = "start" |
| 36 | sideOffset = 4, |
| 37 | ...props |
| 38 | }: React. |
| 39 | return ( |
| 40 | <DropdownMenuPrimitive.Portal> |
| 41 | <DropdownMenuPrimitive.Content |
| 42 | data-slot="dropdown-menu-content" |
| 43 | sideOffset={sideOffset} |
| 44 | align={align} |
| 45 | className={cn( |
| 46 | "z-50 max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 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 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", |
| 47 | className, |
| 48 | )} |
| 49 | {...props} |
| 50 | /> |
| 51 | </DropdownMenuPrimitive.Portal> |
| 52 | ); |
| 53 | } |
| 54 | |
| 55 | function DropdownMenuGroup({ |
| 56 | ...props |
| 57 | }: React. |
| 58 | return ( |
| 59 | <DropdownMenuPrimitive.Group data-slot=" |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | function DropdownMenuItem({ |
| 64 | className, |
| 65 | inset, |
| 66 | variant = "default" |
| 67 | ...props |
| 68 | }: React. |
| 69 | inset?: boolean |
| 70 | variant?: " |
| 71 | }) { |
| 72 | return ( |
| 73 | <DropdownMenuPrimitive.Item |
| 74 | data-slot="dropdown-menu-item" |
| 75 | data-inset={inset} |
| 76 | data-variant={variant} |
| 77 | className={cn( |
| 78 | "group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive", |
| 79 | className, |
| 80 | )} |
| 81 | {...props} |
| 82 | /> |
| 83 | ); |
| 84 | } |
| 85 | |
| 86 | function DropdownMenuCheckboxItem({ |
| 87 | className, |
| 88 | children, |
| 89 | checked, |
| 90 | inset, |
| 91 | ...props |
| 92 | }: React. |
| 93 | inset?: boolean |
| 94 | }) { |
| 95 | return ( |
| 96 | <DropdownMenuPrimitive.CheckboxItem |
| 97 | data-slot="dropdown-menu-checkbox-item" |
| 98 | data-inset={inset} |
| 99 | className={cn( |
| 100 | "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", |
| 101 | className, |
| 102 | )} |
| 103 | checked={checked} |
| 104 | {...props} |
| 105 | > |
| 106 | <span |
| 107 | className="pointer-events-none absolute right-2 flex items-center justify-center" |
| 108 | data-slot="dropdown-menu-checkbox-item-indicator" |
| 109 | > |
| 110 | <DropdownMenuPrimitive.ItemIndicator> |
| 111 | <CheckIcon /> |
| 112 | </DropdownMenuPrimitive.ItemIndicator> |
| 113 | </span> |
| 114 | {children} |
| 115 | </DropdownMenuPrimitive.CheckboxItem> |
| 116 | ); |
| 117 | } |
| 118 | |
| 119 | function DropdownMenuRadioGroup({ |
| 120 | ...props |
| 121 | }: React. |
| 122 | return ( |
| 123 | <DropdownMenuPrimitive.RadioGroup |
| 124 | data-slot="dropdown-menu-radio-group" |
| 125 | {...props} |
| 126 | /> |
| 127 | ); |
| 128 | } |
| 129 | |
| 130 | function DropdownMenuRadioItem({ |
| 131 | className, |
| 132 | children, |
| 133 | inset, |
| 134 | ...props |
| 135 | }: React. |
| 136 | inset?: boolean |
| 137 | }) { |
| 138 | return ( |
| 139 | <DropdownMenuPrimitive.RadioItem |
| 140 | data-slot="dropdown-menu-radio-item" |
| 141 | data-inset={inset} |
| 142 | className={cn( |
| 143 | "relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", |
| 144 | className, |
| 145 | )} |
| 146 | {...props} |
| 147 | > |
| 148 | <span |
| 149 | className="pointer-events-none absolute right-2 flex items-center justify-center" |
| 150 | data-slot="dropdown-menu-radio-item-indicator" |
| 151 | > |
| 152 | <DropdownMenuPrimitive.ItemIndicator> |
| 153 | <CheckIcon /> |
| 154 | </DropdownMenuPrimitive.ItemIndicator> |
| 155 | </span> |
| 156 | {children} |
| 157 | </DropdownMenuPrimitive.RadioItem> |
| 158 | ); |
| 159 | } |
| 160 | |
| 161 | function DropdownMenuLabel({ |
| 162 | className, |
| 163 | inset, |
| 164 | ...props |
| 165 | }: React. |
| 166 | inset?: boolean |
| 167 | }) { |
| 168 | return ( |
| 169 | <DropdownMenuPrimitive.Label |
| 170 | data-slot="dropdown-menu-label" |
| 171 | data-inset={inset} |
| 172 | className={cn( |
| 173 | "px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7", |
| 174 | className, |
| 175 | )} |
| 176 | {...props} |
| 177 | /> |
| 178 | ); |
| 179 | } |
| 180 | |
| 181 | function DropdownMenuSeparator({ |
| 182 | className, |
| 183 | ...props |
| 184 | }: React. |
| 185 | return ( |
| 186 | <DropdownMenuPrimitive.Separator |
| 187 | data-slot="dropdown-menu-separator" |
| 188 | className={cn(" |
| 189 | {...props} |
| 190 | /> |
| 191 | ); |
| 192 | } |
| 193 | |
| 194 | function DropdownMenuShortcut({ |
| 195 | className, |
| 196 | ...props |
| 197 | }: React. |
| 198 | return ( |
| 199 | <span |
| 200 | data-slot="dropdown-menu-shortcut" |
| 201 | className={cn( |
| 202 | "ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground", |
| 203 | className, |
| 204 | )} |
| 205 | {...props} |
| 206 | /> |
| 207 | ); |
| 208 | } |
| 209 | |
| 210 | function DropdownMenuSub({ |
| 211 | ...props |
| 212 | }: React. |
| 213 | return <DropdownMenuPrimitive.Sub data-slot |
| 214 | } |
| 215 | |
| 216 | function DropdownMenuSubTrigger({ |
| 217 | className, |
| 218 | inset, |
| 219 | children, |
| 220 | ...props |
| 221 | }: React. |
| 222 | inset?: boolean |
| 223 | }) { |
| 224 | return ( |
| 225 | <DropdownMenuPrimitive.SubTrigger |
| 226 | data-slot="dropdown-menu-sub-trigger" |
| 227 | data-inset={inset} |
| 228 | className={cn( |
| 229 | "flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", |
| 230 | className, |
| 231 | )} |
| 232 | {...props} |
| 233 | > |
| 234 | {children} |
| 235 | <ChevronRightIcon className=" |
| 236 | </DropdownMenuPrimitive.SubTrigger> |
| 237 | ); |
| 238 | } |
| 239 | |
| 240 | function DropdownMenuSubContent({ |
| 241 | className, |
| 242 | ...props |
| 243 | }: React. |
| 244 | return ( |
| 245 | <DropdownMenuPrimitive.SubContent |
| 246 | data-slot="dropdown-menu-sub-content" |
| 247 | className={cn( |
| 248 | "z-50 min-w-[96px] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 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 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", |
| 249 | className, |
| 250 | )} |
| 251 | {...props} |
| 252 | /> |
| 253 | ); |
| 254 | } |
| 255 | |
| 256 | export { |
| 257 | DropdownMenu, |
| 258 | DropdownMenuPortal, |
| 259 | DropdownMenuTrigger, |
| 260 | DropdownMenuContent, |
| 261 | DropdownMenuGroup, |
| 262 | DropdownMenuLabel, |
| 263 | DropdownMenuItem, |
| 264 | DropdownMenuCheckboxItem, |
| 265 | DropdownMenuRadioGroup, |
| 266 | DropdownMenuRadioItem, |
| 267 | DropdownMenuSeparator, |
| 268 | DropdownMenuShortcut, |
| 269 | DropdownMenuSub, |
| 270 | DropdownMenuSubTrigger, |
| 271 | DropdownMenuSubContent, |
| 272 | }; |