UNPKG

@mui/x-data-grid-premium

Version:

The Premium plan edition of the MUI X Data Grid Components.

54 lines (53 loc) 1.7 kB
'use client'; import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; const _excluded = ["className", "children", "direction"]; import * as React from 'react'; import clsx from 'clsx'; import { styled } from '@mui/material/styles'; import { getDataGridUtilityClass } from '@mui/x-data-grid-pro'; import composeClasses from '@mui/utils/composeClasses'; import { ResizablePanelContext } from "./ResizablePanelContext.mjs"; import { useGridRootProps } from "../../hooks/utils/useGridRootProps.mjs"; import { jsx as _jsx } from "react/jsx-runtime"; const useUtilityClasses = ownerState => { const { classes } = ownerState; const slots = { root: ['resizablePanel'] }; return composeClasses(slots, getDataGridUtilityClass, classes); }; const ResizablePanelRoot = styled('div', { name: 'MuiDataGrid', slot: 'ResizablePanel' })({ position: 'relative' }); function ResizablePanel(props) { const { className, children, direction = 'horizontal' } = props, other = _objectWithoutPropertiesLoose(props, _excluded); const rootProps = useGridRootProps(); const classes = useUtilityClasses(rootProps); const ref = React.useRef(null); const contextValue = React.useMemo(() => ({ rootRef: ref, direction }), [direction]); return /*#__PURE__*/_jsx(ResizablePanelContext.Provider, { value: contextValue, children: /*#__PURE__*/_jsx(ResizablePanelRoot, _extends({ className: clsx(classes.root, className), ownerState: rootProps }, other, { ref: ref, children: children })) }); } export { ResizablePanel };