import React from 'react'
import { GridCellDefault } from '../components/cell-default'

type GridCellDefaultRendererProps = {
    label: string
    tabIndex: number
}

const GridCellDefaultRendererImpl = ({
    label,
    tabIndex,
}: GridCellDefaultRendererProps) => (
    <GridCellDefault tabIndex={tabIndex} label={label} />
)

/**
 * This default cell renderer takes content from the label
 * of a cell. This can be configured by overriding `value`
 * or `label` function for a cell (`label` will take precedence
 * if provided)
 *
 * It ultimately renders the `GridCellDefault` component.
 */
export const GridCellDefaultRenderer = React.memo(
    GridCellDefaultRendererImpl
) as typeof GridCellDefaultRendererImpl
