/* eslint-disable react-perf/jsx-no-new-function-as-prop */ /* eslint-disable no-shadow */ /* eslint-disable sonarjs/prefer-read-only-props */ import type { Meta, StoryObj } from '@storybook/react/*'; import { makeRootDocumentation, makeStory } from '@joint/react/src/stories/utils/make-story'; import { getAPILink } from '@joint/react/src/stories/utils/get-api-documentation-link'; import '../../stories/examples/index.css'; import { createElements, createLinks, GraphProvider, MeasuredNode, Paper, Port, useElement, } from '@joint/react'; import { PAPER_CLASSNAME, PRIMARY } from 'storybook-config/theme'; import { PortGroup } from './port-group'; const initialElements = createElements([ { id: '1', x: 100, y: 20, width: 100, height: 50, }, { id: '2', x: 200, y: 250, width: 100, height: 50, }, ]); const initialLinks = createLinks([ { id: 'e1-2', target: { id: '2', port: 'port-one', }, source: { id: '1', port: 'port-one', }, attrs: { line: { stroke: PRIMARY, }, }, }, ]); export type Story = StoryObj; const API_URL = getAPILink('Port.Group', 'variables'); function RenderItem(Story: React.FC) { const { width, height } = useElement(); return (
Test
); } function PaperDecorator(Story: React.FC) { const renderItem = () => RenderItem(Story); return ( ); } const meta: Meta = { title: 'Components/Port/Group', component: PortGroup, decorators: [PaperDecorator], parameters: makeRootDocumentation({ apiURL: API_URL, code: ` import { Port } from '@joint/react'; `, description: `Port Group is a container for ports. It can be used to group ports together and apply transformations to them. The group can be positioned using the position prop, which can be either 'absolute' or 'relative'.`, }), }; export default meta; export const Default = makeStory({ args: { children: (
), id: 'group-one', position: 'right', angle: 0, height: 1, }, apiURL: API_URL, name: 'Default group', });