import { getTranslation } from '@payloadcms/translations';
import React from 'react';
import getDataByPath from '../Form/getDataByPath.js';
import getSiblingData from '../Form/getSiblingData.js';
import { isComponent } from './types.js';
const baseClass = 'row-label';
export const RowLabel = (props)=>{
    const { className, data: dataFromProps, i18n, label, path, rowNumber } = props;
    const collapsibleData = getSiblingData(dataFromProps, path);
    const arrayData = getDataByPath(dataFromProps, path);
    const data = arrayData || collapsibleData;
    if (isComponent(label)) {
        const Label = label;
        return /*#__PURE__*/ React.createElement(Label, {
            data: data,
            index: rowNumber,
            path: path
        });
    }
    return /*#__PURE__*/ React.createElement("span", {
        className: [
            baseClass,
            className
        ].filter(Boolean).join(' '),
        style: {
            pointerEvents: 'none'
        }
    }, typeof label === 'function' ? label({
        data,
        index: rowNumber,
        path
    }) : getTranslation(label, i18n));
};

//# sourceMappingURL=index.js.map