var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React, { forwardRef } from "react";
import { DataGridPreferences } from "../../data-grid-preferences/index.js";
import { DataGridTable } from "../../data/table/root/DataGridTableRoot.js";
import { cl } from "../../utils/helpers/index.js";
import { useDataGridSettings } from "../hooks/useDataGridSettings.js";
import { DataGridContextProvider } from "./DataGridRoot.context.js";
/**
 * Component for displaying tabular data.
 *
 * **WARNING: This component is in active development and may receive breaking changes outside major releases!**
 *
 * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/datagrid)
 * @see 🏷️ {@link DataGridProps}
 *
 * @example
 * ```jsx
 * <DataGrid columns={columnDefs} data={rowData} getRowId={(row) => row.id}>
 *   <DataGrid.Preferences />
 *   <DataGrid.Table />
 * </DataGrid>
 * ```
 */
const DataGridInternal = forwardRef((_a, ref) => {
    var { children, className, columns, data, getRowId, selection, isLoading = false, settings, defaultSettings, onSettingsChange } = _a, rest = __rest(_a, ["children", "className", "columns", "data", "getRowId", "selection", "isLoading", "settings", "defaultSettings", "onSettingsChange"]);
    const { settings: resolvedSettings, updateSettings } = useDataGridSettings({
        settings,
        defaultSettings,
        onSettingsChange,
    });
    return (React.createElement("div", Object.assign({}, rest, { ref: ref, className: cl("aksel-data-grid", className) }),
        React.createElement(DataGridContextProvider, { columnDefinitions: columns, data: data, getRowId: getRowId, selection: selection, isLoading: isLoading, tableSettings: resolvedSettings, updateTableSettings: updateSettings }, children)));
});
const DataGrid = DataGridInternal;
DataGrid.Table = DataGridTable;
DataGrid.Preferences = DataGridPreferences;
// eslint-disable-next-line import/export
export { DataGrid, DataGridInternal }; // DataGridRoot needs to be exported b.c. of docgen
export default DataGrid;
//# sourceMappingURL=DataGridRoot.js.map