MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / DialogContent

Function DialogContent

packages/react/src/components/dialog.tsx:46–95  ·  view source on GitHub ↗
({
  className,
  children,
  showCloseButton = true,
  onInteractOutside,
  forceOverlay = false,
  ...props
}: React.ComponentProps<typeof DialogPrimitive.Content> & {
  showCloseButton?: boolean;
  /** Pair with `<Dialog modal={false}>`: Radix renders no overlay in non-modal
   *  mode, so this renders a plain dim layer instead. It still eats outside
   *  clicks (which dismiss via onInteractOutside), so the dialog keeps its
   *  modal look while the wheel stays free for portaled popups. */
  forceOverlay?: boolean;
})

Source from the content-addressed store, hash-verified

44const PORTALED_POPUP_SELECTOR = "[data-slot='combobox-content'],[data-slot='select-content']";
45
46function DialogContent({
47 className,
48 children,
49 showCloseButton = true,
50 onInteractOutside,
51 forceOverlay = false,
52 ...props
53}: React.ComponentProps<typeof DialogPrimitive.Content> & {
54 showCloseButton?: boolean;
55 /** Pair with `<Dialog modal={false}>`: Radix renders no overlay in non-modal
56 * mode, so this renders a plain dim layer instead. It still eats outside
57 * clicks (which dismiss via onInteractOutside), so the dialog keeps its
58 * modal look while the wheel stays free for portaled popups. */
59 forceOverlay?: boolean;
60}) {
61 return (
62 <DialogPortal data-slot="dialog-portal">
63 <DialogOverlay />
64 {forceOverlay ? (
65 <div aria-hidden data-slot="dialog-overlay" className="fixed inset-0 z-50 bg-black/50" />
66 ) : null}
67 <DialogPrimitive.Content
68 data-slot="dialog-content"
69 onInteractOutside={(event) => {
70 const target = event.detail.originalEvent.target;
71 if (target instanceof Element && target.closest(PORTALED_POPUP_SELECTOR)) {
72 event.preventDefault();
73 }
74 onInteractOutside?.(event);
75 }}
76 className={cn(
77 "fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",
78 className,
79 )}
80 {...props}
81 >
82 {children}
83 {showCloseButton && (
84 <DialogPrimitive.Close
85 data-slot="dialog-close"
86 className="absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4"
87 >
88 <XIcon />
89 <span className="sr-only">Close</span>
90 </DialogPrimitive.Close>
91 )}
92 </DialogPrimitive.Content>
93 </DialogPortal>
94 );
95}
96
97function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
98 return (

Callers

nothing calls this directly

Calls 1

cnFunction · 0.90

Tested by

no test coverage detected