/** * @upsetjs/react * https://github.com/upsetjs/upsetjs * * Copyright (c) 2021 Samuel Gratzl */ import type { ISetCombination, ISet } from '@upsetjs/model'; import React, { PropsWithChildren, ReactElement } from 'react'; import CombinationChart from './CombinationChart'; import type { UpSetDataInfo } from '../derive/deriveDataDependent'; import type { UpSetSizeInfo } from '../derive/deriveSizeDependent'; import type { UpSetStyleInfo } from '../derive/deriveStyleDependent'; import SetChart from './SetChart'; import type { Handlers } from '../hooks/useHandler'; declare type UpSetChartProps = PropsWithChildren<{ size: UpSetSizeInfo; style: UpSetStyleInfo; data: UpSetDataInfo; h: Handlers; setChildrenFactory?: (set: ISet) => React.ReactNode; combinationChildrenFactory?: (combination: ISetCombination) => React.ReactNode; }>; const UpSetChart = /*!#__PURE__*/ React.memo(function UpSetChart({ data, size, style, h, setChildrenFactory, combinationChildrenFactory, }: UpSetChartProps) { return ( {data.sets.v.map((d, i) => ( {setChildrenFactory && setChildrenFactory(d)} ))} {data.cs.v.map((d, i) => ( {combinationChildrenFactory && combinationChildrenFactory(d)} ))} ); }); export default UpSetChart as (props: UpSetChartProps) => ReactElement;