/* eslint-disable react-perf/jsx-no-new-object-as-prop */ import { createElements, createLinks, GraphProvider, MeasuredNode, Paper, type GraphProps, type InferElement, } from '@joint/react'; import '../../examples/index.css'; import { PAPER_CLASSNAME, PRIMARY } from 'storybook-config/theme'; // define initial elements const initialElements = createElements([ { id: '1', label: 'Hello', x: 100, y: 0, width: 100, height: 25 }, { id: '2', label: 'World', x: 100, y: 200, width: 100, height: 25 }, ]); // define initial edges const initialEdges = createLinks([ { id: 'e1-2', source: '1', target: '2', type: 'standard.Link', // if define type, it provide intellisense support attrs: { line: { stroke: PRIMARY, strokeWidth: 2, }, }, }, ]); // infer element type from the initial elements (this type can be used for later usage like RenderItem props) type CustomElement = InferElement; function RenderItem({ label, width, height }: CustomElement) { return (
{label}
); } function Main() { return (
); } export default function App(props: Readonly) { return (
); }