/** * @upsetjs/react * https://github.com/upsetjs/upsetjs * * Copyright (c) 2021 Samuel Gratzl */ import type { ISetCombination } from '@upsetjs/model'; import React, { PropsWithChildren, ReactElement } from 'react'; import { mergeColor } from '../../components/utils'; import { clsx } from '../../utils'; import type { KMapDataInfo } from '../derive/deriveDataDependent'; import type { KMapStyleInfo } from '../derive/deriveStyleDependent'; import type { UpSetSelection } from '../../components/interfaces'; export type KMapCellProps = PropsWithChildren<{ d: ISetCombination; i: number; style: KMapStyleInfo; data: KMapDataInfo; className?: string; h: UpSetSelection; }>; const KMapCell = /*!#__PURE__*/ React.memo(function KMapCell({ d, i, h, className, data, style }: KMapCellProps) { const l = data.cs.l[i]; const y = data.cs.scale(d.cardinality); const x = (data.cell - data.cs.bandWidth) / 2; return ( {style.tooltips && ( {d.name}: {data.sets.format(d.cardinality)} )} {data.sets.format(d.cardinality)} ); }); export default KMapCell as (props: KMapCellProps) => ReactElement;