"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.TextWidthHelper = void 0;var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));

var _getDOMRect = require("../../lib/dom/getDOMRect");

var _TextWidthHelper2 = require("./TextWidthHelper.styles");

var THIN_SPACE = "\u2009";




/**
 * Херпер позволяет вычислить размеры блока с текстом
 */var
TextWidthHelper = exports.TextWidthHelper = /*#__PURE__*/function (_React$Component) {function TextWidthHelper() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
    element = null;_this.



















    elementRef = function (node) {return _this.element = node;};return _this;}(0, _inheritsLoose2.default)(TextWidthHelper, _React$Component);var _proto = TextWidthHelper.prototype;_proto.render = function render() {return /*#__PURE__*/_react.default.createElement("div", { className: _TextWidthHelper2.jsStyles.root() }, /*#__PURE__*/_react.default.createElement("div", { className: _TextWidthHelper2.jsStyles.textContainer(), ref: this.elementRef }, this.props.text || THIN_SPACE));};_proto.getTextWidth = function getTextWidth() {return (0, _getDOMRect.getDOMRect)(this.element).width;};_proto.getTextHeight = function getTextHeight() {return (0, _getDOMRect.getDOMRect)(this.element).height;};return TextWidthHelper;}(_react.default.Component);