/* eslint-disable react-perf/jsx-no-new-object-as-prop */ /* eslint-disable react-perf/jsx-no-new-function-as-prop */ import { createElements, createLinks, GraphProvider, Paper, useUpdateElement, type InferElement, } from '@joint/react'; import '../index.css'; import { PRIMARY, LIGHT, PAPER_CLASSNAME } from 'storybook-config/theme'; import { HTMLNode } from 'storybook-config/decorators/with-simple-data'; const initialElements = createElements([ { id: '1', label: 'Node 1', color: PRIMARY, x: 100, y: 0 }, { id: '2', label: 'Node 2', color: PRIMARY, x: 100, y: 200 }, ]); const initialEdges = createLinks([ { id: 'e1-2', source: '1', target: '2', attrs: { line: { stroke: LIGHT, }, }, }, ]); type BaseElementWithData = InferElement; function RenderElement({ color, id }: BaseElementWithData) { const setColor = useUpdateElement(id, 'color'); return ( { setColor(event.target.value); }} defaultValue={color} /> ); } function Main() { return (
); } export default function WithColor() { return (
); }