'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React from 'react';
import { useListDrawerContext } from '../../../elements/ListDrawer/Provider.js';
import { DefaultCell } from '../../../elements/Table/DefaultCell/index.js';
import { useTableColumns } from '../../../providers/TableColumns/index.js';
import './index.scss';
const baseClass = 'default-cell';
const CellPropsContext = /*#__PURE__*/ React.createContext(null);
export const useCellProps = ()=>React.use(CellPropsContext);
export const RenderDefaultCell = ({ clientProps, columnIndex, isLinkedColumn })=>{
    const { drawerSlug, onSelect } = useListDrawerContext();
    const { LinkedCellOverride } = useTableColumns();
    const propsToPass = {
        ...clientProps,
        columnIndex
    };
    if (isLinkedColumn && drawerSlug) {
        propsToPass.className = `${baseClass}__first-cell`;
        propsToPass.link = false;
        propsToPass.onClick = ({ collectionSlug: rowColl, rowData })=>{
            if (typeof onSelect === 'function') {
                onSelect({
                    collectionSlug: rowColl,
                    doc: rowData,
                    docID: rowData.id
                });
            }
        };
    }
    return /*#__PURE__*/ _jsxDEV(CellPropsContext, {
        value: propsToPass,
        children: isLinkedColumn && LinkedCellOverride ? LinkedCellOverride : /*#__PURE__*/ _jsxDEV(DefaultCell, {
            ...propsToPass
        }, void 0, false, {
            fileName: "src/providers/TableColumns/RenderDefaultCell/index.tsx",
            lineNumber: 47,
            columnNumber: 68
        }, this)
    }, void 0, false, {
        fileName: "src/providers/TableColumns/RenderDefaultCell/index.tsx",
        lineNumber: 46,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=index.js.map