import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
import React__default, { forwardRef } from 'react';
import cls from 'classnames';
import { base as base$2 } from './variations/_view/base.js';
import { base as base$1 } from './variations/_size/base.js';
import { base as base$4 } from './variations/_disabled/base.js';
import { base as base$3 } from './variations/_read-only/base.js';
import { base as base$5 } from './variations/_hint-view/base.js';
import { base as base$6 } from './variations/_hint-size/base.js';
import { LabelWrapper, TitleCaption, ContentWrapper, ContentChildrenWrapper, Helpers, LeftHelper, RightHelper, base } from './InformationWrapper.styles.js';
import { classes } from './InformationWrapper.tokens.js';
import { LabelComponent } from './ui/Label/Label.js';

var _excluded = ["size", "view", "children", "label", "labelHtmlFor", "labelPlacement", "hasRequiredIndicator", "requiredIndicatorPlacement", "optional", "optionalText", "hintText", "hintTrigger", "hintView", "hintSize", "hintTargetIcon", "hintPlacement", "hintHasArrow", "hintOffset", "hintWidth", "hintContentLeft", "titleCaption", "leftHelper", "rightHelper", "readOnly", "disabled"];
var informationWrapperRoot = function informationWrapperRoot(Root) {
  return /*#__PURE__*/forwardRef(function (_ref, ref) {
    var size = _ref.size,
      view = _ref.view,
      children = _ref.children,
      label = _ref.label,
      labelHtmlFor = _ref.labelHtmlFor,
      _ref$labelPlacement = _ref.labelPlacement,
      labelPlacement = _ref$labelPlacement === void 0 ? 'top' : _ref$labelPlacement,
      hasRequiredIndicator = _ref.hasRequiredIndicator,
      _ref$requiredIndicato = _ref.requiredIndicatorPlacement,
      requiredIndicatorPlacement = _ref$requiredIndicato === void 0 ? 'right' : _ref$requiredIndicato,
      optional = _ref.optional,
      optionalText = _ref.optionalText,
      hintText = _ref.hintText,
      _ref$hintTrigger = _ref.hintTrigger,
      hintTrigger = _ref$hintTrigger === void 0 ? 'hover' : _ref$hintTrigger,
      _ref$hintView = _ref.hintView,
      hintView = _ref$hintView === void 0 ? 'default' : _ref$hintView,
      _ref$hintSize = _ref.hintSize,
      hintSize = _ref$hintSize === void 0 ? 'm' : _ref$hintSize,
      hintTargetIcon = _ref.hintTargetIcon,
      _ref$hintPlacement = _ref.hintPlacement,
      hintPlacement = _ref$hintPlacement === void 0 ? 'auto' : _ref$hintPlacement,
      hintHasArrow = _ref.hintHasArrow,
      hintOffset = _ref.hintOffset,
      hintWidth = _ref.hintWidth,
      hintContentLeft = _ref.hintContentLeft,
      titleCaption = _ref.titleCaption,
      leftHelper = _ref.leftHelper,
      rightHelper = _ref.rightHelper,
      readOnly = _ref.readOnly,
      disabled = _ref.disabled,
      rest = _objectWithoutProperties(_ref, _excluded);
    var hasHelpers = leftHelper || rightHelper;
    return /*#__PURE__*/React__default.createElement(Root, _extends({
      ref: ref,
      size: size,
      view: view,
      disabled: disabled,
      readOnly: readOnly
    }, hintText && {
      hintView: hintView,
      hintSize: hintSize
    }, rest), /*#__PURE__*/React__default.createElement(LabelWrapper, {
      className: cls(_defineProperty({}, classes.withoutLabel, !label)),
      hasLabel: Boolean(label),
      hasCaption: Boolean(titleCaption)
    }, (labelPlacement === 'top' || !label) && /*#__PURE__*/React__default.createElement(LabelComponent, {
      size: size,
      hasRequiredIndicator: hasRequiredIndicator,
      requiredIndicatorPlacement: requiredIndicatorPlacement,
      optional: optional,
      optionalText: optionalText,
      label: label,
      labelHtmlFor: labelHtmlFor,
      titleCaption: titleCaption,
      hintText: hintText,
      hintTrigger: hintTrigger,
      hintTargetIcon: hintTargetIcon,
      hintPlacement: hintPlacement,
      hintHasArrow: hintHasArrow,
      hintOffset: hintOffset,
      hintWidth: hintWidth,
      hintContentLeft: hintContentLeft,
      disabled: disabled
    }), titleCaption && /*#__PURE__*/React__default.createElement(TitleCaption, {
      hasLabel: Boolean(label)
    }, titleCaption)), /*#__PURE__*/React__default.createElement(ContentWrapper, null, Boolean(label) && labelPlacement === 'left' && /*#__PURE__*/React__default.createElement(LabelComponent, {
      hasRequiredIndicator: hasRequiredIndicator,
      requiredIndicatorPlacement: requiredIndicatorPlacement,
      optional: optional,
      optionalText: optionalText,
      label: label,
      labelHtmlFor: labelHtmlFor,
      titleCaption: titleCaption,
      hintText: hintText,
      hintTrigger: hintTrigger,
      hintTargetIcon: hintTargetIcon,
      hintPlacement: hintPlacement,
      hintHasArrow: hintHasArrow,
      hintOffset: hintOffset,
      hintWidth: hintWidth,
      hintContentLeft: hintContentLeft
    }), /*#__PURE__*/React__default.createElement(ContentChildrenWrapper, null, children, hasHelpers && /*#__PURE__*/React__default.createElement(Helpers, null, leftHelper && /*#__PURE__*/React__default.createElement(LeftHelper, {
      className: classes.leftHelper
    }, leftHelper), rightHelper && /*#__PURE__*/React__default.createElement(RightHelper, null, rightHelper)))));
  });
};
var informationWrapperConfig = {
  name: 'InformationWrapper',
  tag: 'div',
  layout: informationWrapperRoot,
  base: base,
  variations: {
    size: {
      css: base$1
    },
    view: {
      css: base$2
    },
    readOnly: {
      css: base$3,
      attrs: true
    },
    disabled: {
      css: base$4,
      attrs: true
    },
    hintView: {
      css: base$5
    },
    hintSize: {
      css: base$6
    }
  },
  defaults: {
    size: 's',
    view: 'default'
  }
};

export { informationWrapperConfig, informationWrapperRoot };
