"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Box = exports.systemProps = exports.truncate = void 0;

var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));

var _base = _interopRequireDefault(require("@emotion/styled/base"));

var _shouldForwardProp2 = require("@styled-system/should-forward-prop");

var _styledSystem = require("styled-system");

var _config = _interopRequireDefault(require("./config"));

var truncate = function truncate($props) {
  if ($props.isTruncated) {
    return {
      overflow: 'hidden',
      textOverflow: 'ellipsis',
      whiteSpace: 'nowrap'
    };
  }

  return {};
};

exports.truncate = truncate;
var systemProps = (0, _styledSystem.compose)(_styledSystem.layout, _styledSystem.color, _styledSystem.space, _styledSystem.background, _styledSystem.border, _styledSystem.grid, _styledSystem.position, _styledSystem.shadow, _styledSystem.typography, _styledSystem.flexbox, _config["default"]);
exports.systemProps = systemProps;

var _shouldForwardProp = (0, _shouldForwardProp2.createShouldForwardProp)([].concat((0, _toConsumableArray2["default"])(_shouldForwardProp2.props), ['d', 'textDecoration', 'pointerEvents', 'visibility', 'transform', 'cursor', 'fill', 'stroke']));
/**
 * htmlWidth and htmlHeight is used in the <Image />
 * component to support the native `width` and `height` attributes
 *
 * https://github.com/chakra-ui/chakra-ui/issues/149
 */


var nativeHTMLPropAlias = ['htmlWidth', 'htmlHeight'];
var Box = ( /*#__PURE__*/0, _base["default"])('div', process.env.NODE_ENV === "production" ? {
  shouldForwardProp: function shouldForwardProp(prop) {
    if (typeof prop === 'string') {
      if (nativeHTMLPropAlias.includes(prop)) {
        return true;
      }

      return _shouldForwardProp(prop);
    }

    return false;
  },
  target: "ehh2tzb0"
} : {
  shouldForwardProp: function shouldForwardProp(prop) {
    if (typeof prop === 'string') {
      if (nativeHTMLPropAlias.includes(prop)) {
        return true;
      }

      return _shouldForwardProp(prop);
    }

    return false;
  },
  target: "ehh2tzb0",
  label: "Box"
})(truncate, systemProps, process.env.NODE_ENV === "production" ? ""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UHJvcChwcm9wKTtcbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9LFxufSkodHJ1bmNhdGUsIHN5c3RlbVByb3BzKTtcbiJdfQ== */");
exports.Box = Box;
//# sourceMappingURL=Box.js.map