react-show-more-text 1.5.2 → 1.6.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/LICENSE +1 -1
- package/README.md +13 -9
- package/lib/ShowMoreText.js +20 -15
- package/lib/Truncate.js +18 -12
- package/package.json +18 -6
- package/CHANGELOG.md +0 -49
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2022, Devzone Tech
|
|
2
2
|
|
|
3
3
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
# React Show More Text 1.
|
|
1
|
+
# React Show More Text 1.6.1
|
|
2
2
|
|
|
3
3
|
[![NPM version][npm-image]][npm-url]
|
|
4
4
|
[![Downloads][downloads-image]][npm-url]
|
|
5
5
|
[![Build status][travis-image]][travis-url]
|
|
6
|
-
[![Dependency status][david-dm-image]][david-dm-url]
|
|
7
6
|
|
|
8
|
-
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.
|
|
7
|
+
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, React 18.x.x added onClick event.
|
|
9
8
|
|
|
10
9
|
## Demo
|
|
11
10
|
|
|
@@ -86,11 +85,12 @@ class Foo extends Component {
|
|
|
86
85
|
| className | string | '' | Class name(s) to add on component content wrapper div. | `'wrapper-class'`, `'wrapper-class-1 wrapper-class-2'` |
|
|
87
86
|
| anchorClass | string | '' | Class name(s) to add to the anchor elements. | `'my-anchor-class'`, `'class-1 class-2'` |
|
|
88
87
|
| onClick | Function | | Function executed on click on 'Show more' or 'Show less' | `onClick={this.executeOnClick}` |
|
|
89
|
-
| expanded | boolean | 'false' | Control the text to be shown as expanded | `expanded={true}`
|
|
90
|
-
| expandByClick | boolean | 'true' | Cancel the default anchor click expand behavior | `expandByClick={false}`
|
|
88
|
+
| expanded | boolean | 'false' | Control the text to be shown as expanded | `expanded={true}` |
|
|
89
|
+
| expandByClick | boolean | 'true' | Cancel the default anchor click expand behavior | `expandByClick={false}` |
|
|
91
90
|
| width | number | `0` | If not `0`, the calculation of the content will be based on this number. | |
|
|
92
91
|
| keepNewLines | boolean | 'false' | Controls the new lines in text to be kept or not. When set to true, only strings can be passed in as children, and not html nodes. | `keepNewLines={true}` |
|
|
93
92
|
| truncatedEndingComponent | string | '...' | Control the text to be shown at the end of short text | `truncatedEndingComponent={'... '}` |
|
|
93
|
+
| onTruncate | Function | undefined | Function executed on click on Truncate | `onTruncate={() => {alert('Turncated!')}}` |
|
|
94
94
|
|
|
95
95
|
## Developing
|
|
96
96
|
|
|
@@ -118,10 +118,14 @@ Compile to ES5 from /src to /lib
|
|
|
118
118
|
$ npm run compile
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
Storybook usage
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
$ npm run storybook --legacy-peer-deps=true
|
|
125
|
+
```
|
|
126
|
+
|
|
121
127
|
[npm-url]: https://npmjs.org/package/react-show-more-text
|
|
122
128
|
[downloads-image]: http://img.shields.io/npm/dm/react-show-more-text.svg
|
|
123
129
|
[npm-image]: https://badge.fury.io/js/react-show-more-text.svg
|
|
124
|
-
[travis-url]: https://travis-ci.com/devzonetech/react-show-more-text
|
|
125
|
-
[travis-image]: https://travis-ci.com/devzonetech/react-show-more-text.svg?branch=master
|
|
126
|
-
[david-dm-url]: https://david-dm.org/devzonetech/react-show-more-text
|
|
127
|
-
[david-dm-image]: https://david-dm.org/devzonetech/react-show-more-text.svg
|
|
130
|
+
[travis-url]: https://app.travis-ci.com/github/devzonetech/react-show-more-text
|
|
131
|
+
[travis-image]: https://travis-ci.com/devzonetech/react-show-more-text.svg?branch=master
|
package/lib/ShowMoreText.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -13,31 +15,29 @@ var _Truncate = _interopRequireDefault(require("./Truncate"));
|
|
|
13
15
|
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
|
|
20
|
-
function
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
21
|
|
|
22
22
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
23
|
|
|
24
24
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
25
|
|
|
26
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
27
27
|
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
28
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
29
|
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
30
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
31
|
|
|
32
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
33
|
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
34
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
35
|
|
|
36
36
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
37
|
|
|
38
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
38
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
39
|
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
40
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
41
|
|
|
42
42
|
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; }
|
|
43
43
|
|
|
@@ -64,6 +64,8 @@ var ShowMoreText = /*#__PURE__*/function (_Component) {
|
|
|
64
64
|
if (truncated) {
|
|
65
65
|
_this.truncateRef.onResize();
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
_this.props.onTruncate && _this.props.onTruncate();
|
|
67
69
|
}
|
|
68
70
|
});
|
|
69
71
|
|
|
@@ -74,7 +76,7 @@ var ShowMoreText = /*#__PURE__*/function (_Component) {
|
|
|
74
76
|
|
|
75
77
|
if (!_self.props.expandByClick) {
|
|
76
78
|
if (_self.props.onClick) {
|
|
77
|
-
_self.props.onClick(_self.state.expanded);
|
|
79
|
+
_self.props.onClick(_self.state.expanded, event);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
return;
|
|
@@ -85,7 +87,7 @@ var ShowMoreText = /*#__PURE__*/function (_Component) {
|
|
|
85
87
|
expanded: !_this.state.expanded
|
|
86
88
|
}, function () {
|
|
87
89
|
if (_self.props.onClick) {
|
|
88
|
-
_self.props.onClick(_self.state.expanded);
|
|
90
|
+
_self.props.onClick(_self.state.expanded, event);
|
|
89
91
|
}
|
|
90
92
|
});
|
|
91
93
|
}
|
|
@@ -130,7 +132,8 @@ var ShowMoreText = /*#__PURE__*/function (_Component) {
|
|
|
130
132
|
className = _this$props.className,
|
|
131
133
|
width = _this$props.width,
|
|
132
134
|
keepNewLines = _this$props.keepNewLines,
|
|
133
|
-
truncatedEndingComponent = _this$props.truncatedEndingComponent
|
|
135
|
+
truncatedEndingComponent = _this$props.truncatedEndingComponent,
|
|
136
|
+
onTruncate = _this$props.onTruncate;
|
|
134
137
|
var _this$state = this.state,
|
|
135
138
|
expanded = _this$state.expanded,
|
|
136
139
|
truncated = _this$state.truncated;
|
|
@@ -181,7 +184,8 @@ _defineProperty(ShowMoreText, "defaultProps", {
|
|
|
181
184
|
width: 0,
|
|
182
185
|
keepNewLines: false,
|
|
183
186
|
truncatedEndingComponent: '... ',
|
|
184
|
-
expandByClick: true
|
|
187
|
+
expandByClick: true,
|
|
188
|
+
onTruncate: undefined
|
|
185
189
|
});
|
|
186
190
|
|
|
187
191
|
_defineProperty(ShowMoreText, "propTypes", {
|
|
@@ -196,7 +200,8 @@ _defineProperty(ShowMoreText, "propTypes", {
|
|
|
196
200
|
width: _propTypes.PropTypes.number,
|
|
197
201
|
keepNewLines: _propTypes.PropTypes.bool,
|
|
198
202
|
truncatedEndingComponent: _propTypes.PropTypes.node,
|
|
199
|
-
expandByClick: _propTypes.PropTypes.bool
|
|
203
|
+
expandByClick: _propTypes.PropTypes.bool,
|
|
204
|
+
onTruncate: _propTypes.PropTypes.func
|
|
200
205
|
});
|
|
201
206
|
|
|
202
207
|
var _default = ShowMoreText;
|
package/lib/Truncate.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
@@ -9,11 +11,11 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
11
|
|
|
10
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
var _excluded = ["children", "ellipsis", "lines"];
|
|
13
15
|
|
|
14
|
-
function
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
|
|
16
|
-
function _extends() { _extends = Object.assign
|
|
18
|
+
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); }
|
|
17
19
|
|
|
18
20
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
19
21
|
|
|
@@ -23,21 +25,21 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
23
25
|
|
|
24
26
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
25
27
|
|
|
26
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
27
29
|
|
|
28
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
30
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
31
|
|
|
30
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
33
|
|
|
32
34
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
35
|
|
|
34
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
36
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
37
|
|
|
36
38
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
39
|
|
|
38
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
40
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
41
|
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
43
|
|
|
42
44
|
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; }
|
|
43
45
|
|
|
@@ -328,7 +330,7 @@ var Truncate = /*#__PURE__*/function (_React$Component) {
|
|
|
328
330
|
this.canvasContext = canvas.getContext('2d');
|
|
329
331
|
calcTargetWidth(function () {
|
|
330
332
|
// Node not needed in document tree to read its content
|
|
331
|
-
if (text) {
|
|
333
|
+
if (text && text.parentNode) {
|
|
332
334
|
text.parentNode.removeChild(text);
|
|
333
335
|
}
|
|
334
336
|
});
|
|
@@ -353,7 +355,11 @@ var Truncate = /*#__PURE__*/function (_React$Component) {
|
|
|
353
355
|
var ellipsis = this.elements.ellipsis,
|
|
354
356
|
onResize = this.onResize,
|
|
355
357
|
timeout = this.timeout;
|
|
356
|
-
|
|
358
|
+
|
|
359
|
+
if (ellipsis.parentNode) {
|
|
360
|
+
ellipsis.parentNode.removeChild(ellipsis);
|
|
361
|
+
}
|
|
362
|
+
|
|
357
363
|
window.removeEventListener('resize', onResize);
|
|
358
364
|
window.cancelAnimationFrame(timeout);
|
|
359
365
|
}
|
|
@@ -367,7 +373,7 @@ var Truncate = /*#__PURE__*/function (_React$Component) {
|
|
|
367
373
|
children = _this$props.children,
|
|
368
374
|
ellipsis = _this$props.ellipsis,
|
|
369
375
|
lines = _this$props.lines,
|
|
370
|
-
spanProps = _objectWithoutProperties(_this$props,
|
|
376
|
+
spanProps = _objectWithoutProperties(_this$props, _excluded),
|
|
371
377
|
targetWidth = this.state.targetWidth,
|
|
372
378
|
getLines = this.getLines,
|
|
373
379
|
onTruncate = this.onTruncate;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-show-more-text",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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": [
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"report-coverage": "npm run coverage | coveralls",
|
|
17
17
|
"test": "./node_modules/.bin/jest",
|
|
18
18
|
"test:watch": "./node_modules/.bin/jest --watch",
|
|
19
|
-
"travis": "npm run compile && npm run test"
|
|
19
|
+
"travis": "npm run compile && npm run test",
|
|
20
|
+
"storybook": "start-storybook -p 6006",
|
|
21
|
+
"build-storybook": "build-storybook"
|
|
20
22
|
},
|
|
21
23
|
"repository": {
|
|
22
24
|
"type": "git",
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
"author": "Zdravko Shishmanov <zdrsoft@gmail.com>",
|
|
39
41
|
"license": "ISC",
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"react": "
|
|
43
|
+
"react": "16 - 18.x"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@babel/cli": "^7.12.1",
|
|
@@ -46,14 +48,23 @@
|
|
|
46
48
|
"@babel/plugin-proposal-class-properties": "^7.12.1",
|
|
47
49
|
"@babel/preset-env": "^7.12.1",
|
|
48
50
|
"@babel/preset-react": "^7.12.1",
|
|
51
|
+
"@storybook/addon-actions": "^6.5.12",
|
|
52
|
+
"@storybook/addon-essentials": "^6.4.22",
|
|
53
|
+
"@storybook/addon-interactions": "^6.5.12",
|
|
54
|
+
"@storybook/addon-links": "^6.5.12",
|
|
55
|
+
"@storybook/builder-webpack4": "^6.5.12",
|
|
56
|
+
"@storybook/manager-webpack4": "^6.5.12",
|
|
57
|
+
"@storybook/react": "^6.1.21",
|
|
58
|
+
"@storybook/testing-library": "^0.0.13",
|
|
49
59
|
"babel-eslint": "^10.1.0",
|
|
60
|
+
"babel-loader": "^8.2.5",
|
|
50
61
|
"babel-preset-minify": "^0.5.1",
|
|
51
62
|
"canvas": "^2.8.0",
|
|
52
63
|
"core-js": "^3.6.5",
|
|
53
64
|
"coveralls": "^3.0.7",
|
|
54
65
|
"enzyme": "^3.11.0",
|
|
55
66
|
"enzyme-adapter-react-16": "^1.15.5",
|
|
56
|
-
"eslint": "^
|
|
67
|
+
"eslint": "^8.24.0",
|
|
57
68
|
"eslint-config-onelint": "^3.0.0",
|
|
58
69
|
"eslint-config-onelint-react": "^2.0.1",
|
|
59
70
|
"eslint-config-react-app": "^6.0.0",
|
|
@@ -63,8 +74,9 @@
|
|
|
63
74
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
64
75
|
"eslint-plugin-react": "^7.21.5",
|
|
65
76
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
66
|
-
"jest": "^
|
|
67
|
-
"jest-
|
|
77
|
+
"jest": "^29.1.2",
|
|
78
|
+
"jest-environment-jsdom": "^29.1.2",
|
|
79
|
+
"jest-enzyme": "^4.2.0",
|
|
68
80
|
"nyc": "^14.1.1",
|
|
69
81
|
"onchange": "^6.1.1",
|
|
70
82
|
"react": "^16.14.0",
|
package/CHANGELOG.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
## [1.5.2] - 2021-11-24
|
|
5
|
-
- Maintenance
|
|
6
|
-
|
|
7
|
-
## [1.5.1] - 2021-11-24
|
|
8
|
-
- [#34](https://github.com/devzonetech/react-show-more-text/issues/34) Added props expandByClick true/false #34
|
|
9
|
-
|
|
10
|
-
## [1.5.0] - 2021-07-25
|
|
11
|
-
### Added
|
|
12
|
-
- [#31](https://github.com/devzonetech/react-show-more-text/issues/31) Ability to change or remove the ... at the end
|
|
13
|
-
- [#25](https://github.com/devzonetech/react-show-more-text/issues/25)Showing [@ at the end
|
|
14
|
-
### Fixed
|
|
15
|
-
- Dependencies updated
|
|
16
|
-
|
|
17
|
-
## [1.4.6] - 2020-11-01
|
|
18
|
-
### Fixed
|
|
19
|
-
- [#20](https://github.com/devzonetech/react-show-more-text/issues/20) Incorrect appearance
|
|
20
|
-
- [#23](https://github.com/devzonetech/react-show-more-text/issues/23) Show more/less anchor breaks in case of hash routers
|
|
21
|
-
|
|
22
|
-
## [1.4.5] - 2020-10-20
|
|
23
|
-
### Fixed
|
|
24
|
-
- [#12](https://github.com/devzonetech/react-show-more-text/issues/12) className prop for the wrapper div of component content
|
|
25
|
-
|
|
26
|
-
## [1.4.4] - 2020-08-21
|
|
27
|
-
### Fixed
|
|
28
|
-
- [#16](https://github.com/devzonetech/react-show-more-text/issues/16) @ showing at the end of the line
|
|
29
|
-
|
|
30
|
-
## [1.4.3] - 2020-08-08
|
|
31
|
-
### Fixed
|
|
32
|
-
- [#18](https://github.com/devzonetech/react-show-more-text/issues/18) Missing links, when the content surrounded by the component contains only one line
|
|
33
|
-
- [#16](https://github.com/devzonetech/react-show-more-text/issues/16) @ showing at the end of the line
|
|
34
|
-
|
|
35
|
-
## [1.4.2] - 2020-04-02
|
|
36
|
-
### Changed
|
|
37
|
-
- State update on unmounted component #14
|
|
38
|
-
- HTML tags for hyperlinks disabled when show-less #11
|
|
39
|
-
- Automated unit tests added in ShowMoreText.test.js file
|
|
40
|
-
- README file updated
|
|
41
|
-
- Improved example application
|
|
42
|
-
|
|
43
|
-
## [1.3.0] - 2019-12-20
|
|
44
|
-
### Changed
|
|
45
|
-
- Option to preserve newlines from plain text #4
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
49
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|