mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-20 12:30:04 +00:00
git-subtree-dir: packages/browseros-agent git-subtree-mainline:8f148d0918git-subtree-split:90bd4be300
93 lines
2.0 KiB
TypeScript
93 lines
2.0 KiB
TypeScript
import { Handle, Position } from '@xyflow/react'
|
|
import type { ComponentProps } from 'react'
|
|
import {
|
|
Card,
|
|
CardAction,
|
|
CardContent,
|
|
CardDescription,
|
|
CardFooter,
|
|
CardHeader,
|
|
CardTitle,
|
|
} from '@/components/ui/card'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
export type NodeProps = ComponentProps<typeof Card> & {
|
|
handles: {
|
|
target: boolean
|
|
source: boolean
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const Node = ({ handles, className, ...props }: NodeProps) => (
|
|
<Card
|
|
className={cn(
|
|
'node-container relative size-full h-auto w-sm gap-0 rounded-md p-0',
|
|
className,
|
|
)}
|
|
{...props}
|
|
>
|
|
{handles.target && <Handle position={Position.Left} type="target" />}
|
|
{handles.source && <Handle position={Position.Right} type="source" />}
|
|
{props.children}
|
|
</Card>
|
|
)
|
|
|
|
export type NodeHeaderProps = ComponentProps<typeof CardHeader>
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const NodeHeader = ({ className, ...props }: NodeHeaderProps) => (
|
|
<CardHeader
|
|
className={cn('gap-0.5 rounded-t-md border-b bg-secondary p-3!', className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
|
|
export type NodeTitleProps = ComponentProps<typeof CardTitle>
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const NodeTitle = (props: NodeTitleProps) => <CardTitle {...props} />
|
|
|
|
export type NodeDescriptionProps = ComponentProps<typeof CardDescription>
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const NodeDescription = (props: NodeDescriptionProps) => (
|
|
<CardDescription {...props} />
|
|
)
|
|
|
|
export type NodeActionProps = ComponentProps<typeof CardAction>
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const NodeAction = (props: NodeActionProps) => <CardAction {...props} />
|
|
|
|
export type NodeContentProps = ComponentProps<typeof CardContent>
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const NodeContent = ({ className, ...props }: NodeContentProps) => (
|
|
<CardContent className={cn('p-3', className)} {...props} />
|
|
)
|
|
|
|
export type NodeFooterProps = ComponentProps<typeof CardFooter>
|
|
|
|
/**
|
|
* @public
|
|
*/
|
|
export const NodeFooter = ({ className, ...props }: NodeFooterProps) => (
|
|
<CardFooter
|
|
className={cn('rounded-b-md border-t bg-secondary p-3!', className)}
|
|
{...props}
|
|
/>
|
|
)
|