/** * @upsetjs/react * https://github.com/upsetjs/upsetjs * * Copyright (c) 2021 Samuel Gratzl */ import type { ISetCombinations } from '@upsetjs/model'; import React, { Ref } from 'react'; import ExportButtons from '../../components/ExportButtons'; import QueryLegend from '../../components/QueryLegend'; import type { Handlers } from '../../hooks/useHandler'; import type { UpSetBaseElementProps, UpSetBaseLayoutProps, UpSetBaseMultiStyle, UpSetBaseStyleProps, UpSetBaseThemeProps, UpSetSelectionProps, } from '../../interfaces'; import { clsx } from '../../utils'; export interface SVGWrapperStyle { id: string; title?: React.ReactNode; description?: React.ReactNode; styles: UpSetBaseMultiStyle; classNames: UpSetBaseMultiStyle; } export interface SVGWrapperData { id: string; cs: { v: ISetCombinations }; sets: { format(v: number): string }; } export default function SVGWrapper({ rules, style, size, p, data, tRef, children, exportChart, selectionName, h, }: React.PropsWithChildren<{ rules: string; style: SVGWrapperStyle; selectionName?: string; size: { w: number; h: number; legend: { x: number }; area: { w: number } }; p: UpSetBaseElementProps & UpSetBaseLayoutProps & UpSetBaseThemeProps & UpSetBaseStyleProps & UpSetSelectionProps & UpSetBaseLayoutProps & { children?: React.ReactNode; }; data: SVGWrapperData; tRef: Ref; h: Handlers; exportChart: (evt: React.MouseEvent) => void; }>) { return ( {p.styleFactory!(rules)} {p.onClick && } {p.queryLegend && } {children} {p.children} ); }