@instructure/ui-truncate-list 11.7.8 → 11.7.9-snapshot-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/CHANGELOG.md +8 -0
- package/lib/TruncateList/index.js +15 -17
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-truncate-list
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-truncate-list
|
|
@@ -7,11 +7,9 @@ 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 _getBoundingClientRect = require("@instructure/ui-dom-utils/lib/getBoundingClientRect.js");
|
|
14
|
-
var _getCSSStyleDeclaration = require("@instructure/ui-dom-utils/lib/getCSSStyleDeclaration.js");
|
|
10
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
15
13
|
var _emotion = require("@instructure/emotion");
|
|
16
14
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
17
15
|
var _props = require("./props.js");
|
|
@@ -77,7 +75,7 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
77
75
|
this.props.makeStyles?.();
|
|
78
76
|
const {
|
|
79
77
|
width: origWidth
|
|
80
|
-
} = (0,
|
|
78
|
+
} = (0, _uiDomUtils.getBoundingClientRect)(this.ref);
|
|
81
79
|
this._debouncedHandleResize = (0, _debounce.debounce)(this.handleResize, this.props.debounce, {
|
|
82
80
|
leading: true,
|
|
83
81
|
trailing: true
|
|
@@ -94,7 +92,7 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
94
92
|
});
|
|
95
93
|
|
|
96
94
|
// On first render we only render the trigger to measure it
|
|
97
|
-
const menuTriggerWidth = this.props.fixMenuTriggerWidth ? (0,
|
|
95
|
+
const menuTriggerWidth = this.props.fixMenuTriggerWidth ? (0, _uiUtils.px)(this.props.fixMenuTriggerWidth) : this.calcMenuTriggerWidth();
|
|
98
96
|
this.setState({
|
|
99
97
|
menuTriggerWidth
|
|
100
98
|
}, () => {
|
|
@@ -159,14 +157,14 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
159
157
|
return 0;
|
|
160
158
|
}
|
|
161
159
|
if (fixMenuTriggerWidth) {
|
|
162
|
-
return (0,
|
|
160
|
+
return (0, _uiUtils.px)(fixMenuTriggerWidth);
|
|
163
161
|
}
|
|
164
162
|
const {
|
|
165
163
|
children
|
|
166
164
|
} = this._menuTriggerRef;
|
|
167
165
|
let width = 0;
|
|
168
166
|
Array.from(children).forEach(child => {
|
|
169
|
-
width += (0,
|
|
167
|
+
width += (0, _uiDomUtils.getBoundingClientRect)(child).width;
|
|
170
168
|
});
|
|
171
169
|
return width;
|
|
172
170
|
}
|
|
@@ -175,21 +173,21 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
175
173
|
fixMenuTriggerWidth,
|
|
176
174
|
itemSpacing
|
|
177
175
|
} = this.props;
|
|
178
|
-
const itemSpacingPx = (0,
|
|
179
|
-
const menuTriggerWidthPx = (0,
|
|
176
|
+
const itemSpacingPx = (0, _uiUtils.px)(itemSpacing);
|
|
177
|
+
const menuTriggerWidthPx = (0, _uiUtils.px)(fixMenuTriggerWidth || this.state.menuTriggerWidth);
|
|
180
178
|
let visibleItemsCount = 0;
|
|
181
179
|
if (this.ref) {
|
|
182
180
|
const {
|
|
183
181
|
width: navWidth
|
|
184
|
-
} = (0,
|
|
185
|
-
const style = (0,
|
|
182
|
+
} = (0, _uiDomUtils.getBoundingClientRect)(this.ref);
|
|
183
|
+
const style = (0, _uiDomUtils.getCSSStyleDeclaration)(this.ref);
|
|
186
184
|
const paddingInlineStart = style?.paddingInlineStart ?? '0';
|
|
187
185
|
const paddingInlineEnd = style?.paddingInlineEnd ?? '0';
|
|
188
|
-
const navWidthWithoutPadding = navWidth - (0,
|
|
186
|
+
const navWidthWithoutPadding = navWidth - (0, _uiUtils.px)(paddingInlineStart) - (0, _uiUtils.px)(paddingInlineEnd);
|
|
189
187
|
const itemWidths = Array.from(this.ref.getElementsByTagName('li')).map(item => {
|
|
190
188
|
const {
|
|
191
189
|
width
|
|
192
|
-
} = (0,
|
|
190
|
+
} = (0, _uiDomUtils.getBoundingClientRect)(item);
|
|
193
191
|
return width;
|
|
194
192
|
});
|
|
195
193
|
let currentWidth = 0;
|
|
@@ -239,13 +237,13 @@ let TruncateList = exports.TruncateList = (_dec = (0, _emotion.withStyle)(_style
|
|
|
239
237
|
} = this;
|
|
240
238
|
return (0, _jsxRuntime.jsxs)("ul", {
|
|
241
239
|
ref: this.handleRef,
|
|
242
|
-
...(0,
|
|
240
|
+
...(0, _uiReactUtils.omitProps)(this.props, _props.allowedProps),
|
|
243
241
|
// we have to pass style and className
|
|
244
242
|
// (e.g. if emotion style is provided, it will be passed as a className)
|
|
245
243
|
style: style,
|
|
246
244
|
className: className,
|
|
247
245
|
css: styles?.truncateList,
|
|
248
|
-
"data-cid": (0,
|
|
246
|
+
"data-cid": (0, _uiUtils.combineDataCid)('TruncateList', this.props),
|
|
249
247
|
children: [visibleChildren.map((child, index) => {
|
|
250
248
|
return (0, _jsxRuntime.jsx)("li", {
|
|
251
249
|
css: styles?.listItem,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-truncate-list",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
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",
|
|
@@ -15,20 +15,20 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-dom-utils": "11.7.
|
|
23
|
-
"@instructure/
|
|
24
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/console": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/debounce": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/emotion": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"vitest": "^5.0.0",
|
|
28
|
-
"@instructure/ui-axe-check": "11.7.
|
|
29
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
30
|
-
"@instructure/ui-color-utils": "11.7.
|
|
31
|
-
"@instructure/ui-themes": "11.7.
|
|
28
|
+
"@instructure/ui-axe-check": "11.7.9-snapshot-1",
|
|
29
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1",
|
|
30
|
+
"@instructure/ui-color-utils": "11.7.9-snapshot-1",
|
|
31
|
+
"@instructure/ui-themes": "11.7.9-snapshot-1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": ">=18 <=19"
|