/*! * Copyright (c) Microsoft. All rights reserved. * Licensed under the MIT license. See LICENSE file in the project. */ import { DataType } from '@datashaper/schema' import { memo } from 'react' import { Case, Default, Switch } from 'react-if' import { categories, getValue, isBlank, isEmpty, } from '../ArqueroDetailsList.utils.js' import { useNumberMagnitude } from '../hooks/useNumberMagnitude.js' import { ArrayDropdownCell } from './ArrayDropdownCell.js' import { BlankCell } from './BlankCell.js' import { CellContainer } from './CellContainer.js' import { EmptyCell } from './EmptyCell.js' import type { FeatureCellProps } from './FeaturesCell.types.js' import { BooleanSymbolCell, CategoricalBarCell, DateCell, DefaultCell, NumberMagnitudeCell, SparkbarCell, SparklineCell, TextCell, } from './index.js' export type { FeatureCellProps } from './FeaturesCell.types.js' /** * Chooses what to render based on the features prop */ export const FeaturesCell: React.FC = memo( function FeaturesCell(props) { const { features, field, metadata, item, column, index, onSelect } = props const type = field?.type const value = getValue(item, column) const magnitude = useNumberMagnitude(value, metadata, type) const histogram = categories(value) return ( ) }, )