'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
var React = require('react');
var index = require('../../utils/index.js');
var base = require('./variations/_size/base.js');
var base$1 = require('./variations/_gap/base.js');
var base$3 = require('./variations/_shape/base.js');
var base$2 = require('./variations/_orientation/base.js');
var base$4 = require('./variations/_stretching/base.js');
var TextFieldGroup_styles = require('./TextFieldGroup.styles.js');
var TextFieldGroup_tokens = require('./TextFieldGroup.tokens.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var React__default = /*#__PURE__*/_interopDefault(React);

var _excluded = ["children", "className", "size", "stretching", "gap", "orientation", "shape", "isCommonTextFieldStyles"];
var textFieldGroupRoot = function textFieldGroupRoot(Root) {
  return /*#__PURE__*/React.forwardRef(function (props, ref) {
    var children = props.children,
      className = props.className,
      size = props.size,
      _props$stretching = props.stretching,
      stretching = _props$stretching === void 0 ? 'auto' : _props$stretching,
      _props$gap = props.gap,
      gap = _props$gap === void 0 ? 'dense' : _props$gap,
      _props$orientation = props.orientation,
      orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
      _props$shape = props.shape,
      shape = _props$shape === void 0 ? 'default' : _props$shape,
      _props$isCommonTextFi = props.isCommonTextFieldStyles,
      isCommonTextFieldStyles = _props$isCommonTextFi === void 0 ? true : _props$isCommonTextFi,
      rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
    var orientationClass = TextFieldGroup_tokens.classes[orientation];
    var gapClass = TextFieldGroup_tokens.classes[gap];
    var shapeClass = TextFieldGroup_tokens.classes[shape];
    var stretchingClass = TextFieldGroup_tokens.classes["".concat(stretching, "Stretching")];
    var overrideStylesClass = isCommonTextFieldStyles ? TextFieldGroup_tokens.classes.textFieldGroupOverrideStyles : undefined;
    return /*#__PURE__*/React__default.default.createElement(Root, _rollupPluginBabelHelpers.extends({
      ref: ref,
      size: size,
      gap: gap,
      shape: shape,
      orientation: orientation,
      className: index.cx(overrideStylesClass, orientationClass, gapClass, shapeClass, stretchingClass, className)
    }, rest), children);
  });
};
var textFieldGroupConfig = {
  name: 'TextFieldGroup',
  tag: 'div',
  layout: textFieldGroupRoot,
  base: TextFieldGroup_styles.base,
  variations: {
    size: {
      css: base.base
    },
    gap: {
      css: base$1.base
    },
    orientation: {
      css: base$2.base
    },
    shape: {
      css: base$3.base
    },
    stretching: {
      css: base$4.base
    }
  },
  defaults: {
    size: 'm',
    gap: 'dense',
    orientation: 'horizontal',
    shape: 'default',
    stretching: 'auto'
  }
};

exports.textFieldGroupConfig = textFieldGroupConfig;
exports.textFieldGroupRoot = textFieldGroupRoot;
