import { ComponentType, Group, Rect } from '../../jsx'; import { ItemLabel } from '../components'; import { getItemProps } from '../utils'; import { registerItem } from './registry'; import type { BaseItemProps } from './types'; export interface RoundedRectNodeProps extends BaseItemProps { width?: number; height?: number; padding?: number; } export const RoundedRectNode: ComponentType = (props) => { const [ { indexes, datum, themeColors, width = 300, height = 40, padding = 4, positionH = 'normal', }, restProps, ] = getItemProps(props, ['width', 'height', 'borderRadius', 'padding']); const borderRadius = height / 2; // Calculate text positioning const textX = borderRadius; const textY = padding; const textWidth = width - borderRadius * 2; const textHeight = height - padding * 2; return ( {/* Rounded rectangle background */} {/* Text label */} {datum.label} ); }; registerItem('rounded-rect-node', { component: RoundedRectNode, composites: ['label'], });