@instructure/ui-truncate-list 8.56.0 → 8.56.2-pr-snapshot-1721749364069
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 +16 -0
- package/lib/TruncateList/TruncateListLocator.js +2 -2
- package/lib/TruncateList/index.js +16 -17
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.56.2-pr-snapshot-1721749364069](https://github.com/instructure/instructure-ui/compare/v8.56.1...v8.56.2-pr-snapshot-1721749364069) (2024-07-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-truncate-list
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @instructure/ui-truncate-list
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [8.56.0](https://github.com/instructure/instructure-ui/compare/v8.55.1...v8.56.0) (2024-05-06)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @instructure/ui-truncate-list
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TruncateListLocator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
8
|
var _uiTestQueries = require("@instructure/ui-test-queries");
|
|
9
9
|
var _index = require("./index");
|
|
10
10
|
/*
|
|
@@ -32,7 +32,7 @@ var _index = require("./index");
|
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
35
|
-
const TruncateListLocator = exports.TruncateListLocator = (0,
|
|
35
|
+
const TruncateListLocator = exports.TruncateListLocator = (0, _uiTestLocator.locator)(_index.TruncateList.selector, {
|
|
36
36
|
findAllListItems: (...args) => {
|
|
37
37
|
return (0, _uiTestQueries.findAll)('li', ...args);
|
|
38
38
|
},
|
|
@@ -7,11 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.TruncateList = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _debounce = require("@instructure/debounce");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var _getComputedStyle2 = require("@instructure/ui-dom-utils/lib/getComputedStyle.js");
|
|
10
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
11
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
12
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
13
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
15
14
|
var _emotion = require("@instructure/emotion");
|
|
16
15
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
17
16
|
var _props = require("./props");
|
|
@@ -45,7 +44,7 @@ var _dec, _dec2, _class, _class2;
|
|
|
45
44
|
category: components/utilities
|
|
46
45
|
---
|
|
47
46
|
**/
|
|
48
|
-
let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0,
|
|
47
|
+
let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_styles.default, null), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class TruncateList extends _react.Component {
|
|
49
48
|
constructor(props) {
|
|
50
49
|
super(props);
|
|
51
50
|
this.ref = null;
|
|
@@ -63,18 +62,18 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
63
62
|
const _this$props = this.props,
|
|
64
63
|
fixMenuTriggerWidth = _this$props.fixMenuTriggerWidth,
|
|
65
64
|
itemSpacing = _this$props.itemSpacing;
|
|
66
|
-
const itemSpacingPx = (0,
|
|
67
|
-
const menuTriggerWidthPx = (0,
|
|
65
|
+
const itemSpacingPx = (0, _uiUtils.px)(itemSpacing);
|
|
66
|
+
const menuTriggerWidthPx = (0, _uiUtils.px)(fixMenuTriggerWidth || this.state.menuTriggerWidth);
|
|
68
67
|
let visibleItemsCount = 0;
|
|
69
68
|
if (this.ref) {
|
|
70
|
-
const _getBoundingClientRec = (0,
|
|
69
|
+
const _getBoundingClientRec = (0, _uiDomUtils.getBoundingClientRect)(this.ref),
|
|
71
70
|
navWidth = _getBoundingClientRec.width;
|
|
72
|
-
const _getComputedStyle = (0,
|
|
71
|
+
const _getComputedStyle = (0, _uiDomUtils.getComputedStyle)(this.ref),
|
|
73
72
|
paddingInlineStart = _getComputedStyle.paddingInlineStart,
|
|
74
73
|
paddingInlineEnd = _getComputedStyle.paddingInlineEnd;
|
|
75
|
-
const navWidthWithoutPadding = navWidth - (0,
|
|
74
|
+
const navWidthWithoutPadding = navWidth - (0, _uiUtils.px)(paddingInlineStart) - (0, _uiUtils.px)(paddingInlineEnd);
|
|
76
75
|
const itemWidths = Array.from(this.ref.getElementsByTagName('li')).map(item => {
|
|
77
|
-
const _getBoundingClientRec2 = (0,
|
|
76
|
+
const _getBoundingClientRec2 = (0, _uiDomUtils.getBoundingClientRect)(item),
|
|
78
77
|
width = _getBoundingClientRec2.width;
|
|
79
78
|
return width;
|
|
80
79
|
});
|
|
@@ -119,7 +118,7 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
119
118
|
componentDidMount() {
|
|
120
119
|
var _this$props$makeStyle, _this$props2;
|
|
121
120
|
(_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
|
|
122
|
-
const _getBoundingClientRec3 = (0,
|
|
121
|
+
const _getBoundingClientRec3 = (0, _uiDomUtils.getBoundingClientRect)(this.ref),
|
|
123
122
|
origWidth = _getBoundingClientRec3.width;
|
|
124
123
|
this._debouncedHandleResize = (0, _debounce.debounce)(this.handleResize, this.props.debounce, {
|
|
125
124
|
leading: true,
|
|
@@ -136,7 +135,7 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
136
135
|
});
|
|
137
136
|
|
|
138
137
|
// On first render we only render the trigger to measure it
|
|
139
|
-
const menuTriggerWidth = this.props.fixMenuTriggerWidth ? (0,
|
|
138
|
+
const menuTriggerWidth = this.props.fixMenuTriggerWidth ? (0, _uiUtils.px)(this.props.fixMenuTriggerWidth) : this.calcMenuTriggerWidth();
|
|
140
139
|
this.setState({
|
|
141
140
|
menuTriggerWidth
|
|
142
141
|
}, () => {
|
|
@@ -198,12 +197,12 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
198
197
|
return 0;
|
|
199
198
|
}
|
|
200
199
|
if (fixMenuTriggerWidth) {
|
|
201
|
-
return (0,
|
|
200
|
+
return (0, _uiUtils.px)(fixMenuTriggerWidth);
|
|
202
201
|
}
|
|
203
202
|
const children = this._menuTriggerRef.children;
|
|
204
203
|
let width = 0;
|
|
205
204
|
Array.from(children).forEach(child => {
|
|
206
|
-
width += (0,
|
|
205
|
+
width += (0, _uiDomUtils.getBoundingClientRect)(child).width;
|
|
207
206
|
});
|
|
208
207
|
return width;
|
|
209
208
|
}
|
|
@@ -217,7 +216,7 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
217
216
|
hiddenChildren = this.hiddenChildren;
|
|
218
217
|
return (0, _emotion.jsx)("ul", Object.assign({
|
|
219
218
|
ref: this.handleRef
|
|
220
|
-
}, (0,
|
|
219
|
+
}, (0, _uiReactUtils.omitProps)(this.props, _props.allowedProps), {
|
|
221
220
|
// we have to pass style and className
|
|
222
221
|
// (e.g. if emotion style is provided, it will be passed as a className)
|
|
223
222
|
className: className,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-truncate-list",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
4
4
|
"description": "A TruncateList 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.23.2",
|
|
27
|
-
"@instructure/console": "8.56.
|
|
28
|
-
"@instructure/debounce": "8.56.
|
|
29
|
-
"@instructure/emotion": "8.56.
|
|
30
|
-
"@instructure/shared-types": "8.56.
|
|
31
|
-
"@instructure/ui-dom-utils": "8.56.
|
|
32
|
-
"@instructure/ui-react-utils": "8.56.
|
|
33
|
-
"@instructure/ui-testable": "8.56.
|
|
34
|
-
"@instructure/ui-utils": "8.56.
|
|
27
|
+
"@instructure/console": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/debounce": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
32
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
33
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
34
|
+
"@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
35
35
|
"prop-types": "^15.8.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
39
|
-
"@instructure/ui-color-utils": "8.56.
|
|
40
|
-
"@instructure/ui-test-locator": "8.56.
|
|
41
|
-
"@instructure/ui-test-queries": "8.56.
|
|
42
|
-
"@instructure/ui-test-utils": "8.56.
|
|
43
|
-
"@instructure/ui-themes": "8.56.
|
|
38
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
39
|
+
"@instructure/ui-color-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
40
|
+
"@instructure/ui-test-locator": "8.56.2-pr-snapshot-1721749364069",
|
|
41
|
+
"@instructure/ui-test-queries": "8.56.2-pr-snapshot-1721749364069",
|
|
42
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
43
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=16.8 <=18"
|