import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { forwardRef } from 'react';
import { cx } from '../../utils/index.js';
import { base } from './Grid.styles.js';
import { base as base$1 } from './variations/_view/base.js';
import { getGridViewClass } from './utils/index.js';

var _excluded = ["children", "view", "className", "style", "maxWidth"];
var gridRoot = function gridRoot(Root) {
  return /*#__PURE__*/forwardRef(function (props, ref) {
    var children = props.children,
      view = props.view,
      className = props.className,
      style = props.style,
      maxWidth = props.maxWidth,
      rest = _objectWithoutProperties(props, _excluded);
    var viewClass = getGridViewClass(view || 'default');
    var maxWidthValue = view === 'legacy' ? '90rem' : null;
    var maxWidthToken = maxWidthValue || maxWidth ? {
      '--plasma_private-grid-max-width': maxWidth || maxWidthValue
    } : {};
    return /*#__PURE__*/React__default.createElement(Root, _extends({
      ref: ref,
      view: view,
      className: cx(viewClass, className),
      style: _objectSpread2(_objectSpread2({}, maxWidthToken), style)
    }, rest), children);
  });
};
var gridConfig = {
  name: 'Grid',
  tag: 'div',
  layout: gridRoot,
  base: base,
  variations: {
    view: {
      css: base$1
    }
  },
  defaults: {
    view: 'default'
  }
};

export { gridConfig, gridRoot };
