"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _constants = require("../../constants");
var _Text = _interopRequireDefault(require("../../../Text"));
var _constants2 = require("../../../Text/constants");
var _SuffixSt = require("./Suffix.st.css.js");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/FieldSet/components/Suffix/Suffix.tsx";
var CharactersLeft = _ref => {
  var {
    lengthLeft,
    labelSize
  } = _ref;
  if (lengthLeft === undefined) return null;
  var colorProps = lengthLeft >= 0 ? {
    light: true,
    secondary: true
  } : {
    skin: _constants2.SKINS.error
  };
  return /*#__PURE__*/_react.default.createElement(_Text.default, (0, _extends2.default)({
    className: (0, _SuffixSt.st)(_SuffixSt.classes.charCount, {
      labelSize
    }),
    size: _constants2.SIZES.small,
    weight: _constants2.WEIGHTS.normal
  }, colorProps, {
    dataHook: _constants.dataHooks.counter,
    children: lengthLeft,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 27,
      columnNumber: 5
    }
  }));
};
var Suffix = _ref2 => {
  var {
    suffix,
    charCount,
    labelPlacement,
    hasInlineElements,
    labelSize
  } = _ref2;
  return /*#__PURE__*/_react.default.createElement("div", {
    "aria-hidden": true,
    "data-hook": _constants.dataHooks.suffix,
    className: (0, _SuffixSt.st)(_SuffixSt.classes.root, {
      noLabel: labelPlacement !== 'top',
      hasInlineElements
    }),
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 54,
      columnNumber: 5
    }
  }, suffix !== null && suffix !== void 0 ? suffix : /*#__PURE__*/_react.default.createElement(CharactersLeft, {
    lengthLeft: charCount,
    labelSize: labelSize,
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 63,
      columnNumber: 9
    }
  }));
};
var _default = exports.default = Suffix;
//# sourceMappingURL=Suffix.js.map