Skip to content
Myr

popover.tsx

This file

Path

apps/web/src/components/ui/popover.tsx

89 lines · 2.5 KiB · TypeScript

Last changed by

Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e

History of this file

Take it

Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a

lines 1–38why, one step back
1"use client";
23import { Popover as PopoverPrimitive } from "@base-ui/react/popover";4import { cn } from "cn";5import * as React from "react";67function Popover({ ...props }: PopoverPrimitive.Root.Props) {8 return <PopoverPrimitive.Root data-slot="popover" {...props} />;9}1011function PopoverTrigger({ ...props }: PopoverPrimitive.Trigger.Props) {12 return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />;13}1415function PopoverContent({16 className,17 align = "center",18 alignOffset = 0,19 side = "bottom",20 sideOffset = 4,21 ...props22}: PopoverPrimitive.Popup.Props &23 Pick<24 PopoverPrimitive.Positioner.Props,25 "align" | "alignOffset" | "side" | "sideOffset"26 >) {27 return (28 <PopoverPrimitive.Portal>29 <PopoverPrimitive.Positioner30 align={align}31 alignOffset={alignOffset}32 side={side}33 sideOffset={sideOffset}34 className="isolate z-50"35 >36 <PopoverPrimitive.Popup37 data-slot="popover-content"38 className={cn(

Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e

line 39why, one step back
39 "bg-popover text-popover-foreground ring-input data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-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 text-ui z-50 flex w-72 origin-(--transform-origin) flex-col gap-2.5 rounded-none p-2.5 ring-1 outline-hidden duration-100",

Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a

lines 40–52why, one step back
40 className
41 )}42 {...props}43 />44 </PopoverPrimitive.Positioner>45 </PopoverPrimitive.Portal>46 );47}4849function PopoverHeader({ className, ...props }: React.ComponentProps<"div">) {50 return (51 <div52 data-slot="popover-header"

Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e

line 53why, one step back
53 className={cn("text-ui flex flex-col gap-1", className)}

Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a

lines 54–62why, one step back
54 {...props}
55 />56 );57}5859function PopoverTitle({ className, ...props }: PopoverPrimitive.Title.Props) {60 return (61 <PopoverPrimitive.Title62 data-slot="popover-title"

Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e

line 63why, one step back
63 className={cn("text-ui font-semibold", className)}

Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a

lines 64–75why, one step back
64 {...props}
65 />66 );67}6869function PopoverDescription({70 className,71 ...props72}: PopoverPrimitive.Description.Props) {73 return (74 <PopoverPrimitive.Description75 data-slot="popover-description"

Draw text, controls, prose and code from one set of tokensoscabrielbefore adoption60f862e

line 76why, one step back
76 className={cn("text-muted-foreground text-ui", className)}

Give the web its W9 dependencies, components, project nav, line and revision helpers, and a stub for every new pageoscabrielbefore adoption254268a

lines 77–89why, one step back
77 {...props}
78 />79 );80}8182export {83 Popover,84 PopoverContent,85 PopoverDescription,86 PopoverHeader,87 PopoverTitle,88 PopoverTrigger,89};