@instructure/ui-truncate-text 8.25.1-snapshot-10 → 8.25.1-snapshot-13
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/CHANGELOG.md +1 -1
- package/es/TruncateText/index.js +23 -28
- package/es/TruncateText/utils/truncate.js +9 -10
- package/lib/TruncateText/index.js +23 -28
- package/lib/TruncateText/utils/truncate.js +9 -10
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [8.25.1-snapshot-
|
|
6
|
+
## [8.25.1-snapshot-13](https://github.com/instructure/instructure-ui/compare/v8.25.0...v8.25.1-snapshot-13) (2022-06-22)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-truncate-text
|
|
9
9
|
|
package/es/TruncateText/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _dec3, _class;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _class2;
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* The MIT License (MIT)
|
|
@@ -43,28 +43,22 @@ category: components
|
|
|
43
43
|
---
|
|
44
44
|
@tsProps
|
|
45
45
|
**/
|
|
46
|
-
let TruncateText = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = hack(['shouldTruncateWhenInvisible']), _dec(_class = _dec2(_class = _dec3(_class = class TruncateText extends Component {
|
|
47
|
-
static displayName = "TruncateText";
|
|
48
|
-
static componentId = 'TruncateText';
|
|
49
|
-
static allowedProps = allowedProps;
|
|
50
|
-
static propTypes = propTypes;
|
|
51
|
-
static defaultProps = {
|
|
52
|
-
maxLines: 1,
|
|
53
|
-
ellipsis: '\u2026',
|
|
54
|
-
truncate: 'character',
|
|
55
|
-
position: 'end',
|
|
56
|
-
ignore: [' ', '.', ','],
|
|
57
|
-
debounce: 0
|
|
58
|
-
};
|
|
59
|
-
ref = null;
|
|
60
|
-
_text;
|
|
61
|
-
_debounced;
|
|
62
|
-
_stage = null;
|
|
63
|
-
_wasTruncated;
|
|
64
|
-
_resizeListener;
|
|
65
|
-
|
|
46
|
+
let TruncateText = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec3 = hack(['shouldTruncateWhenInvisible']), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TruncateText extends Component {
|
|
66
47
|
constructor(props) {
|
|
67
48
|
super(props);
|
|
49
|
+
this.ref = null;
|
|
50
|
+
this._text = void 0;
|
|
51
|
+
this._debounced = void 0;
|
|
52
|
+
this._stage = null;
|
|
53
|
+
this._wasTruncated = void 0;
|
|
54
|
+
this._resizeListener = void 0;
|
|
55
|
+
|
|
56
|
+
this.update = () => {
|
|
57
|
+
if (this.ref) {
|
|
58
|
+
this.setState(this.initialState);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
68
62
|
this.state = this.initialState;
|
|
69
63
|
}
|
|
70
64
|
|
|
@@ -182,12 +176,6 @@ let TruncateText = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
182
176
|
})(), `[TruncateText] Some children are too deep in the node tree and will not render.`);
|
|
183
177
|
}
|
|
184
178
|
|
|
185
|
-
update = () => {
|
|
186
|
-
if (this.ref) {
|
|
187
|
-
this.setState(this.initialState);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
179
|
truncate() {
|
|
192
180
|
if (!this.state.needsSecondRender) {
|
|
193
181
|
return;
|
|
@@ -276,6 +264,13 @@ let TruncateText = (_dec = withStyle(generateStyle, generateComponentTheme), _de
|
|
|
276
264
|
}, ensureSingleChild(children))), truncatedElement);
|
|
277
265
|
}
|
|
278
266
|
|
|
279
|
-
}
|
|
267
|
+
}, _class2.displayName = "TruncateText", _class2.componentId = 'TruncateText', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
|
|
268
|
+
maxLines: 1,
|
|
269
|
+
ellipsis: '\u2026',
|
|
270
|
+
truncate: 'character',
|
|
271
|
+
position: 'end',
|
|
272
|
+
ignore: [' ', '.', ','],
|
|
273
|
+
debounce: 0
|
|
274
|
+
}, _class2)) || _class) || _class) || _class);
|
|
280
275
|
export default TruncateText;
|
|
281
276
|
export { TruncateText };
|
|
@@ -58,18 +58,17 @@ function truncate(element, options) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
class Truncator {
|
|
61
|
-
_options;
|
|
62
|
-
_stage;
|
|
63
|
-
_parent;
|
|
64
|
-
_nodeMap;
|
|
65
|
-
_defaultStringData;
|
|
66
|
-
_nodeDataIndexes;
|
|
67
|
-
_maxHeight;
|
|
68
|
-
_maxWidth;
|
|
69
|
-
_maxLines;
|
|
70
|
-
|
|
71
61
|
constructor(element) {
|
|
72
62
|
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
63
|
+
this._options = void 0;
|
|
64
|
+
this._stage = void 0;
|
|
65
|
+
this._parent = void 0;
|
|
66
|
+
this._nodeMap = void 0;
|
|
67
|
+
this._defaultStringData = void 0;
|
|
68
|
+
this._nodeDataIndexes = void 0;
|
|
69
|
+
this._maxHeight = void 0;
|
|
70
|
+
this._maxWidth = void 0;
|
|
71
|
+
this._maxLines = void 0;
|
|
73
72
|
const parentElement = element !== null && element !== void 0 && element.parentElement ? element === null || element === void 0 ? void 0 : element.parentElement : void 0;
|
|
74
73
|
this._options = {
|
|
75
74
|
parent: options.parent || parentElement,
|
|
@@ -37,7 +37,7 @@ var _truncate = _interopRequireDefault(require("./utils/truncate"));
|
|
|
37
37
|
|
|
38
38
|
var _props = require("./props");
|
|
39
39
|
|
|
40
|
-
var _dec, _dec2, _dec3, _class;
|
|
40
|
+
var _dec, _dec2, _dec3, _class, _class2;
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
---
|
|
@@ -45,28 +45,22 @@ category: components
|
|
|
45
45
|
---
|
|
46
46
|
@tsProps
|
|
47
47
|
**/
|
|
48
|
-
let TruncateText = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec3 = (0, _hack.hack)(['shouldTruncateWhenInvisible']), _dec(_class = _dec2(_class = _dec3(_class = class TruncateText extends _react.Component {
|
|
49
|
-
static displayName = "TruncateText";
|
|
50
|
-
static componentId = 'TruncateText';
|
|
51
|
-
static allowedProps = _props.allowedProps;
|
|
52
|
-
static propTypes = _props.propTypes;
|
|
53
|
-
static defaultProps = {
|
|
54
|
-
maxLines: 1,
|
|
55
|
-
ellipsis: '\u2026',
|
|
56
|
-
truncate: 'character',
|
|
57
|
-
position: 'end',
|
|
58
|
-
ignore: [' ', '.', ','],
|
|
59
|
-
debounce: 0
|
|
60
|
-
};
|
|
61
|
-
ref = null;
|
|
62
|
-
_text;
|
|
63
|
-
_debounced;
|
|
64
|
-
_stage = null;
|
|
65
|
-
_wasTruncated;
|
|
66
|
-
_resizeListener;
|
|
67
|
-
|
|
48
|
+
let TruncateText = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec3 = (0, _hack.hack)(['shouldTruncateWhenInvisible']), _dec(_class = _dec2(_class = _dec3(_class = (_class2 = class TruncateText extends _react.Component {
|
|
68
49
|
constructor(props) {
|
|
69
50
|
super(props);
|
|
51
|
+
this.ref = null;
|
|
52
|
+
this._text = void 0;
|
|
53
|
+
this._debounced = void 0;
|
|
54
|
+
this._stage = null;
|
|
55
|
+
this._wasTruncated = void 0;
|
|
56
|
+
this._resizeListener = void 0;
|
|
57
|
+
|
|
58
|
+
this.update = () => {
|
|
59
|
+
if (this.ref) {
|
|
60
|
+
this.setState(this.initialState);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
70
64
|
this.state = this.initialState;
|
|
71
65
|
}
|
|
72
66
|
|
|
@@ -186,12 +180,6 @@ let TruncateText = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
186
180
|
})(), `[TruncateText] Some children are too deep in the node tree and will not render.`);
|
|
187
181
|
}
|
|
188
182
|
|
|
189
|
-
update = () => {
|
|
190
|
-
if (this.ref) {
|
|
191
|
-
this.setState(this.initialState);
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
|
|
195
183
|
truncate() {
|
|
196
184
|
if (!this.state.needsSecondRender) {
|
|
197
185
|
return;
|
|
@@ -282,7 +270,14 @@ let TruncateText = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
|
|
|
282
270
|
}, (0, _ensureSingleChild.ensureSingleChild)(children))), truncatedElement);
|
|
283
271
|
}
|
|
284
272
|
|
|
285
|
-
}
|
|
273
|
+
}, _class2.displayName = "TruncateText", _class2.componentId = 'TruncateText', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
|
|
274
|
+
maxLines: 1,
|
|
275
|
+
ellipsis: '\u2026',
|
|
276
|
+
truncate: 'character',
|
|
277
|
+
position: 'end',
|
|
278
|
+
ignore: [' ', '.', ','],
|
|
279
|
+
debounce: 0
|
|
280
|
+
}, _class2)) || _class) || _class) || _class);
|
|
286
281
|
exports.TruncateText = TruncateText;
|
|
287
282
|
var _default = TruncateText;
|
|
288
283
|
exports.default = _default;
|
|
@@ -78,18 +78,17 @@ function truncate(element, options) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
class Truncator {
|
|
81
|
-
_options;
|
|
82
|
-
_stage;
|
|
83
|
-
_parent;
|
|
84
|
-
_nodeMap;
|
|
85
|
-
_defaultStringData;
|
|
86
|
-
_nodeDataIndexes;
|
|
87
|
-
_maxHeight;
|
|
88
|
-
_maxWidth;
|
|
89
|
-
_maxLines;
|
|
90
|
-
|
|
91
81
|
constructor(element) {
|
|
92
82
|
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
83
|
+
this._options = void 0;
|
|
84
|
+
this._stage = void 0;
|
|
85
|
+
this._parent = void 0;
|
|
86
|
+
this._nodeMap = void 0;
|
|
87
|
+
this._defaultStringData = void 0;
|
|
88
|
+
this._nodeDataIndexes = void 0;
|
|
89
|
+
this._maxHeight = void 0;
|
|
90
|
+
this._maxWidth = void 0;
|
|
91
|
+
this._maxLines = void 0;
|
|
93
92
|
const parentElement = element !== null && element !== void 0 && element.parentElement ? element === null || element === void 0 ? void 0 : element.parentElement : void 0;
|
|
94
93
|
this._options = {
|
|
95
94
|
parent: options.parent || parentElement,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-truncate-text",
|
|
3
|
-
"version": "8.25.1-snapshot-
|
|
3
|
+
"version": "8.25.1-snapshot-13",
|
|
4
4
|
"description": "A TruncateText component made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,23 +24,23 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.13.10",
|
|
27
|
-
"@instructure/console": "8.25.1-snapshot-
|
|
28
|
-
"@instructure/debounce": "8.25.1-snapshot-
|
|
29
|
-
"@instructure/emotion": "8.25.1-snapshot-
|
|
30
|
-
"@instructure/shared-types": "8.25.1-snapshot-
|
|
31
|
-
"@instructure/ui-dom-utils": "8.25.1-snapshot-
|
|
32
|
-
"@instructure/ui-react-utils": "8.25.1-snapshot-
|
|
33
|
-
"@instructure/ui-testable": "8.25.1-snapshot-
|
|
34
|
-
"@instructure/ui-utils": "8.25.1-snapshot-
|
|
27
|
+
"@instructure/console": "8.25.1-snapshot-13",
|
|
28
|
+
"@instructure/debounce": "8.25.1-snapshot-13",
|
|
29
|
+
"@instructure/emotion": "8.25.1-snapshot-13",
|
|
30
|
+
"@instructure/shared-types": "8.25.1-snapshot-13",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.25.1-snapshot-13",
|
|
32
|
+
"@instructure/ui-react-utils": "8.25.1-snapshot-13",
|
|
33
|
+
"@instructure/ui-testable": "8.25.1-snapshot-13",
|
|
34
|
+
"@instructure/ui-utils": "8.25.1-snapshot-13",
|
|
35
35
|
"escape-html": "^1",
|
|
36
36
|
"prop-types": "^15"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@instructure/ui-babel-preset": "8.25.1-snapshot-
|
|
40
|
-
"@instructure/ui-color-utils": "8.25.1-snapshot-
|
|
41
|
-
"@instructure/ui-test-utils": "8.25.1-snapshot-
|
|
42
|
-
"@instructure/ui-text": "8.25.1-snapshot-
|
|
43
|
-
"@instructure/ui-themes": "8.25.1-snapshot-
|
|
39
|
+
"@instructure/ui-babel-preset": "8.25.1-snapshot-13",
|
|
40
|
+
"@instructure/ui-color-utils": "8.25.1-snapshot-13",
|
|
41
|
+
"@instructure/ui-test-utils": "8.25.1-snapshot-13",
|
|
42
|
+
"@instructure/ui-text": "8.25.1-snapshot-13",
|
|
43
|
+
"@instructure/ui-themes": "8.25.1-snapshot-13",
|
|
44
44
|
"@types/escape-html": "^1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|