react-show-more-text 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # React Show More Text 1.7.0
1
+ # React Show More Text 1.7.1
2
2
 
3
3
  [![NPM version][npm-image]][npm-url]
4
4
  [![Downloads][downloads-image]][npm-url]
package/lib/Truncate.js CHANGED
@@ -8,7 +8,22 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
11
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /**
12
+ * LICENSE
13
+ * https://github.com/pablosichert/react-truncate/blob/master/LICENSE.md
14
+ *
15
+ * ISC License
16
+ Copyright (c) 2016, One.com
17
+
18
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is
19
+ hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
22
+ INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
23
+ FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
24
+ DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
25
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26
+ */ // Initial version of react-truncate module (v2.4.0)
12
27
  class Truncate extends _react.default.Component {
13
28
  constructor() {
14
29
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -283,6 +298,9 @@ class Truncate extends _react.default.Component {
283
298
  window.removeEventListener("resize", onResize);
284
299
  window.cancelAnimationFrame(timeout);
285
300
  }
301
+
302
+ // Shim innerText to consistently break lines at <br/> but not at \n
303
+
286
304
  render() {
287
305
  const {
288
306
  elements: {
@@ -319,7 +337,7 @@ class Truncate extends _react.default.Component {
319
337
  }), /*#__PURE__*/_react.default.createElement("span", {
320
338
  style: {
321
339
  display: "block",
322
- maxWidth: "".concat(spanProps.width, "px")
340
+ maxWidth: spanProps.width > 0 ? "".concat(spanProps.width, "px") : "unset"
323
341
  }
324
342
  }, text), /*#__PURE__*/_react.default.createElement("span", {
325
343
  ref: textEl => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-show-more-text",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "The text surrounded by the component will be truncated. Anything surrounded by the component could be evaluated as text. The component react-show-more-text/ShowMoreText is fork of react-show-more/ShowMore, applied improvements, works with React 16.x.x, added onClick event.",
5
5
  "main": "lib/ShowMoreText.js",
6
6
  "files": [