import { Slot } from "@radix-ui/react-slot"; import { useNodeId, useReactFlow } from "@xyflow/react"; import { EllipsisVertical, Trash } from "lucide-react"; import { forwardRef, HTMLAttributes, ReactNode,useCallback } from "react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { cn } from "@/lib/utils"; /* NODE HEADER -------------------------------------------------------------- */ export type NodeHeaderProps = HTMLAttributes; /** * A container for a consistent header layout intended to be used inside the * `` component. */ export const NodeHeader = forwardRef( ({ className, ...props }, ref) => { return (
` component. className, )} /> ); }, ); NodeHeader.displayName = "NodeHeader"; /* NODE HEADER TITLE -------------------------------------------------------- */ export type NodeHeaderTitleProps = HTMLAttributes & { asChild?: boolean; }; /** * The title text for the node. To maintain a native application feel, the title * text is not selectable. */ export const NodeHeaderTitle = forwardRef< HTMLHeadingElement, NodeHeaderTitleProps >(({ className, asChild, ...props }, ref) => { const Comp = asChild ? Slot : "h3"; return ( ); }); NodeHeaderTitle.displayName = "NodeHeaderTitle"; /* NODE HEADER ICON --------------------------------------------------------- */ export type NodeHeaderIconProps = HTMLAttributes; export const NodeHeaderIcon = forwardRef( ({ className, ...props }, ref) => { return ( *]:size-5")} /> ); }, ); NodeHeaderIcon.displayName = "NodeHeaderIcon"; /* NODE HEADER ACTIONS ------------------------------------------------------ */ export type NodeHeaderActionsProps = HTMLAttributes; /** * A container for right-aligned action buttons in the node header. */ export const NodeHeaderActions = forwardRef< HTMLDivElement, NodeHeaderActionsProps >(({ className, ...props }, ref) => { return (
); }); NodeHeaderActions.displayName = "NodeHeaderActions"; /* NODE HEADER ACTION ------------------------------------------------------- */ export type NodeHeaderActionProps = React.ComponentProps<"button"> & { label: string; }; /** * A thin wrapper around the `