text: "use strict";
  var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
      if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
      return cooked;
  };
  var __assign = (this && this.__assign) || function () {
      __assign = Object.assign || function(t) {
          for (var s, i = 1, n = arguments.length; i < n; i++) {
              s = arguments[i];
              for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                  t[p] = s[p];
          }
          return t;
      };
      return __assign.apply(this, arguments);
  };
  var __importStar = (this && this.__importStar) || function (mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
      result["default"] = mod;
      return result;
  };
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  var React = __importStar(require("react"));
  var styled_1 = __importDefault(require("../../styled"));
  var automation_attribute_1 = __importDefault(require("../../_helpers/automation-attribute"));
  var container_styles_1 = __importDefault(require("../../_helpers/container-styles"));
  var tokens_1 = require("../../tokens");
  var alignItems = {
      top: 'flex-start',
      center: 'center',
      bottom: 'flex-end'
  };
  var justifyContent = {
      fill: 'space-between',
      'space-between': 'space-between',
      left: 'flex-start',
      right: 'flex-end'
  };
  var Stack = function (props) {
      var children;
      if (props.align === 'fill' || props.align === 'space-between') {
          children = React.Children.map(props.children, function (child, index) {
              var width = 0;
              if (props.widths) {
                  width = props.widths[index] || 0;
              }
              return (React.createElement(Stack.Item, __assign({ width: width }, automation_attribute_1.default('stack.item')), child));
          });
      }
      else {
          children = props.children;
      }
      return (React.createElement(Stack.Element, __assign({}, props, { align: props.align }, automation_attribute_1.default('stack')), children));
  };
  Stack.Element = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n  ", ";\n\n  display: flex;\n  flex-direction: row;\n  flex-wrap: nowrap;\n  align-items: ", ";\n  justify-content: ", ";\n  > * {\n    flex: ", ";\n    margin-right: ", ";\n  }\n  > *:last-child {\n    margin-right: 0;\n  }\n"], ["\n  ", ";\n\n  display: flex;\n  flex-direction: row;\n  flex-wrap: nowrap;\n  align-items: ", ";\n  justify-content: ", ";\n  > * {\n    flex: ", ";\n    margin-right: ", ";\n  }\n  > *:last-child {\n    margin-right: 0;\n  }\n"])), container_styles_1.default, function (props) { return alignItems[props.alignVertical]; }, function (props) { return justifyContent[props.align]; }, function (props) { return (props.align === 'fill' ? 1 : 'none'); }, function (props) { return (props.align === 'fill' ? tokens_1.spacing.xsmall : 0); });
  Stack.Item = styled_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n  flex-basis: ", "%;\n"], ["\n  flex-basis: ", "%;\n"])), function (props) { return props.width; });
  Stack.defaultProps = {
      align: 'fill',
      alignVertical: 'center'
  };
  exports.default = Stack;
  var templateObject_1, templateObject_2;
  //# sourceMappingURL=stack.js.map