/* eslint-disable react-perf/jsx-no-new-object-as-prop */ import { LIGHT, PAPER_CLASSNAME, PRIMARY, TEXT } from 'storybook-config/theme'; import '../index.css'; import { createElements, createLinks, GraphProvider, MeasuredNode, Paper, type InferElement, type RenderElement, } from '@joint/react'; import { useCallback } from 'react'; const initialEdges = createLinks([ { id: 'e1-2', source: '1', target: '2', attrs: { line: { stroke: LIGHT, }, }, }, ]); const initialElements = createElements([ { id: '1', label: 'Node 1', x: 100, y: 0 }, { id: '2', label: 'Node 2', x: 100, y: 200 }, ]); type BaseElementWithData = InferElement; function RenderedRect({ width, height, label }: BaseElementWithData) { const textMargin = 20; const cornerRadius = 5; return ( <> { element.size(width + textMargin, height + textMargin); }} > {label} ); } function Main() { const renderElement: RenderElement = useCallback( (props) => , [] ); return (
); } export default function App() { return (
); }