@instructure/ui-truncate-list 8.27.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 ADDED
@@ -0,0 +1,17 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [8.27.1-snapshot-13](https://github.com/instructure/instructure-ui/compare/v8.27.0...v8.27.1-snapshot-13) (2022-08-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * **ui-truncate-list,ui:** add `TruncateList` utility component ([f8b17ea](https://github.com/instructure/instructure-ui/commit/f8b17ea8b60234f746fcd7576f1532f38d5bbe5f))
12
+
13
+
14
+
15
+
16
+
17
+ See the instructure-ui mono-repo [change log](#CHANGELOG) for past changes.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ ---
2
+ category: packages
3
+ ---
4
+
5
+ ## ui-truncate-list
6
+
7
+ [![npm][npm]][npm-url] 
8
+ [![MIT License][license-badge]][license] 
9
+ [![Code of Conduct][coc-badge]][coc]
10
+
11
+ A TruncateList utility component made by Instructure Inc.
12
+
13
+ ### Components
14
+
15
+ The `ui-truncate-list` package contains the following:
16
+
17
+ - [TruncateList](#TruncateList)
18
+
19
+ ### Installation
20
+
21
+ ```sh
22
+ yarn add @instructure/ui-truncate-list
23
+ ```
24
+
25
+ [npm]: https://img.shields.io/npm/v/@instructure/ui-truncate-list.svg
26
+ [npm-url]: https://npmjs.com/package/@instructure/ui-truncate-list
27
+ [license-badge]: https://img.shields.io/npm/l/instructure-ui.svg?style=flat-square
28
+ [license]: https://github.com/instructure/instructure-ui/blob/master/LICENSE
29
+ [coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
30
+ [coc]: https://github.com/instructure/instructure-ui/blob/master/CODE_OF_CONDUCT.md
@@ -0,0 +1,43 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import { locator } from '@instructure/ui-test-locator';
25
+ import { find, findAll } from '@instructure/ui-test-queries';
26
+ import { TruncateList } from './index'; // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
27
+
28
+ export const TruncateListLocator = locator(TruncateList.selector, {
29
+ findAllListItems: function () {
30
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
+ args[_key] = arguments[_key];
32
+ }
33
+
34
+ return findAll('li', ...args);
35
+ },
36
+ findMenuTriggerItem: function () {
37
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
38
+ args[_key2] = arguments[_key2];
39
+ }
40
+
41
+ return find('li[class*=-truncateList__menuTrigger]', ...args);
42
+ }
43
+ });
@@ -0,0 +1,272 @@
1
+ var _dec, _dec2, _class, _class2;
2
+
3
+ /*
4
+ * The MIT License (MIT)
5
+ *
6
+ * Copyright (c) 2015 - present Instructure, Inc.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ */
26
+
27
+ /** @jsx jsx */
28
+ import { Children, Component } from 'react';
29
+ import { debounce } from '@instructure/debounce';
30
+ import { px } from '@instructure/ui-utils';
31
+ import { testable } from '@instructure/ui-testable';
32
+ import { omitProps } from '@instructure/ui-react-utils';
33
+ import { getBoundingClientRect } from '@instructure/ui-dom-utils';
34
+ import { withStyle, jsx } from '@instructure/emotion';
35
+ import generateStyle from './styles';
36
+ import { propTypes, allowedProps } from './props';
37
+
38
+ /**
39
+ ---
40
+ category: components/utilities
41
+ ---
42
+ @tsProps
43
+ **/
44
+ let TruncateList = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _dec(_class = _dec2(_class = (_class2 = class TruncateList extends Component {
45
+ constructor(props) {
46
+ super(props);
47
+ this.ref = null;
48
+ this._menuTriggerRef = null;
49
+ this._debouncedHandleResize = void 0;
50
+ this._resizeListener = void 0;
51
+
52
+ this.handleRef = el => {
53
+ const elementRef = this.props.elementRef;
54
+ this.ref = el;
55
+
56
+ if (typeof elementRef === 'function') {
57
+ elementRef(el);
58
+ }
59
+ };
60
+
61
+ this.measureItems = () => {
62
+ const _this$props = this.props,
63
+ fixMenuTriggerWidth = _this$props.fixMenuTriggerWidth,
64
+ itemSpacing = _this$props.itemSpacing;
65
+ const itemSpacingPx = px(itemSpacing);
66
+ const menuTriggerWidthPx = px(fixMenuTriggerWidth || this.state.menuTriggerWidth);
67
+ let visibleItemsCount = 0;
68
+
69
+ if (this.ref) {
70
+ const _getBoundingClientRec = getBoundingClientRect(this.ref),
71
+ navWidth = _getBoundingClientRec.width;
72
+
73
+ const itemWidths = Array.from(this.ref.getElementsByTagName('li')).map(item => {
74
+ const _getBoundingClientRec2 = getBoundingClientRect(item),
75
+ width = _getBoundingClientRec2.width;
76
+
77
+ return width;
78
+ });
79
+ let currentWidth = 0;
80
+
81
+ for (let i = 0; i < itemWidths.length; i++) {
82
+ currentWidth += itemWidths[i]; // for the last item we don't need to calculate with the menu trigger
83
+
84
+ const maxWidth = i === itemWidths.length - 1 ? navWidth : navWidth - (menuTriggerWidthPx + itemSpacingPx);
85
+
86
+ if (currentWidth <= maxWidth) {
87
+ visibleItemsCount++;
88
+ } else {
89
+ break;
90
+ }
91
+ }
92
+ }
93
+
94
+ return {
95
+ visibleItemsCount
96
+ };
97
+ };
98
+
99
+ this.handleResize = () => {
100
+ this.setState({
101
+ isMeasuring: true
102
+ }, () => {
103
+ const _this$measureItems = this.measureItems(),
104
+ visibleItemsCount = _this$measureItems.visibleItemsCount;
105
+
106
+ if (typeof this.props.onUpdate === 'function') {
107
+ this.props.onUpdate({
108
+ visibleItemsCount
109
+ });
110
+ }
111
+
112
+ this.setState({
113
+ isMeasuring: false
114
+ });
115
+ });
116
+ };
117
+
118
+ this.state = {
119
+ isMeasuring: false,
120
+ menuTriggerWidth: void 0
121
+ };
122
+ }
123
+
124
+ componentDidMount() {
125
+ var _this$props$makeStyle, _this$props2;
126
+
127
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2);
128
+
129
+ const _getBoundingClientRec3 = getBoundingClientRect(this.ref),
130
+ origWidth = _getBoundingClientRec3.width;
131
+
132
+ this._debouncedHandleResize = debounce(this.handleResize, this.props.debounce, {
133
+ leading: true,
134
+ trailing: true
135
+ });
136
+ this._resizeListener = new ResizeObserver(entries => {
137
+ for (const entry of entries) {
138
+ const width = entry.contentRect.width;
139
+
140
+ if (origWidth !== width) {
141
+ var _this$_debouncedHandl;
142
+
143
+ (_this$_debouncedHandl = this._debouncedHandleResize) === null || _this$_debouncedHandl === void 0 ? void 0 : _this$_debouncedHandl.call(this);
144
+ }
145
+ }
146
+ }); // On first render we only render the trigger to measure it
147
+
148
+ const menuTriggerWidth = this.props.fixMenuTriggerWidth ? px(this.props.fixMenuTriggerWidth) : this.calcMenuTriggerWidth();
149
+ this.setState({
150
+ menuTriggerWidth
151
+ }, () => {
152
+ var _this$_resizeListener, _this$_debouncedHandl2;
153
+
154
+ (_this$_resizeListener = this._resizeListener) === null || _this$_resizeListener === void 0 ? void 0 : _this$_resizeListener.observe(this.ref);
155
+ (_this$_debouncedHandl2 = this._debouncedHandleResize) === null || _this$_debouncedHandl2 === void 0 ? void 0 : _this$_debouncedHandl2.call(this);
156
+ });
157
+ }
158
+
159
+ componentDidUpdate(prevProps, prevState) {
160
+ var _this$props$makeStyle2, _this$props3;
161
+
162
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3);
163
+
164
+ if (prevProps.fixMenuTriggerWidth !== this.props.fixMenuTriggerWidth || prevProps.itemSpacing !== this.props.itemSpacing) {
165
+ var _this$_debouncedHandl3;
166
+
167
+ (_this$_debouncedHandl3 = this._debouncedHandleResize) === null || _this$_debouncedHandl3 === void 0 ? void 0 : _this$_debouncedHandl3.call(this);
168
+ }
169
+
170
+ if (this.ref && prevState.isMeasuring && prevState.isMeasuring !== this.state.isMeasuring) {
171
+ const menuTriggerWidth = this.calcMenuTriggerWidth();
172
+
173
+ if (menuTriggerWidth && this.state.menuTriggerWidth !== menuTriggerWidth) {
174
+ this.setState({
175
+ menuTriggerWidth
176
+ }, () => {
177
+ var _this$_debouncedHandl4;
178
+
179
+ (_this$_debouncedHandl4 = this._debouncedHandleResize) === null || _this$_debouncedHandl4 === void 0 ? void 0 : _this$_debouncedHandl4.call(this);
180
+ });
181
+ }
182
+ }
183
+ }
184
+
185
+ componentWillUnmount() {
186
+ if (this._resizeListener) {
187
+ this._resizeListener.disconnect();
188
+ }
189
+
190
+ if (this._debouncedHandleResize) {
191
+ this._debouncedHandleResize.cancel();
192
+ }
193
+ }
194
+
195
+ get childrenArray() {
196
+ return Children.toArray(this.props.children);
197
+ }
198
+
199
+ get visibleChildren() {
200
+ const visibleItemsCount = this.props.visibleItemsCount;
201
+ const _this$state = this.state,
202
+ isMeasuring = _this$state.isMeasuring,
203
+ menuTriggerWidth = _this$state.menuTriggerWidth; // for the first render we need to measure the trigger width
204
+
205
+ if (typeof menuTriggerWidth === 'undefined') {
206
+ return [];
207
+ }
208
+
209
+ const visibleChildren = typeof visibleItemsCount === 'undefined' ? this.childrenArray : this.childrenArray.splice(0, visibleItemsCount);
210
+ return isMeasuring ? this.childrenArray : visibleChildren;
211
+ }
212
+
213
+ get hiddenChildren() {
214
+ const isMeasuring = this.state.isMeasuring;
215
+ return isMeasuring ? [] : this.childrenArray.splice(this.visibleChildren.length, this.childrenArray.length);
216
+ }
217
+
218
+ calcMenuTriggerWidth() {
219
+ const fixMenuTriggerWidth = this.props.fixMenuTriggerWidth;
220
+
221
+ if (!this._menuTriggerRef) {
222
+ return 0;
223
+ }
224
+
225
+ if (fixMenuTriggerWidth) {
226
+ return px(fixMenuTriggerWidth);
227
+ }
228
+
229
+ const children = this._menuTriggerRef.children;
230
+ let width = 0;
231
+ Array.from(children).forEach(child => {
232
+ width += getBoundingClientRect(child).width;
233
+ });
234
+ return width;
235
+ }
236
+
237
+ render() {
238
+ const _this$props4 = this.props,
239
+ styles = _this$props4.styles,
240
+ className = _this$props4.className,
241
+ style = _this$props4.style,
242
+ renderHiddenItemMenu = _this$props4.renderHiddenItemMenu;
243
+ const visibleChildren = this.visibleChildren,
244
+ hiddenChildren = this.hiddenChildren;
245
+ return jsx("ul", Object.assign({
246
+ ref: this.handleRef
247
+ }, omitProps(this.props, allowedProps), {
248
+ // we have to pass style and className
249
+ // (e.g. if emotion style is provided, it will be passed as a className)
250
+ className: className,
251
+ style: style,
252
+ css: styles === null || styles === void 0 ? void 0 : styles.truncateList
253
+ }), visibleChildren.map((child, index) => {
254
+ return jsx("li", {
255
+ key: index,
256
+ css: styles === null || styles === void 0 ? void 0 : styles.listItem
257
+ }, child);
258
+ }), typeof renderHiddenItemMenu === 'function' && hiddenChildren && hiddenChildren.length > 0 && jsx("li", {
259
+ key: "menuTrigger",
260
+ css: [styles === null || styles === void 0 ? void 0 : styles.listItem, styles === null || styles === void 0 ? void 0 : styles.menuTrigger],
261
+ ref: e => {
262
+ this._menuTriggerRef = e;
263
+ }
264
+ }, renderHiddenItemMenu(hiddenChildren)));
265
+ }
266
+
267
+ }, _class2.displayName = "TruncateList", _class2.componentId = 'TruncateList', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
268
+ itemSpacing: '0',
269
+ debounce: 300
270
+ }, _class2)) || _class) || _class);
271
+ export { TruncateList };
272
+ export default TruncateList;
@@ -0,0 +1,36 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import PropTypes from 'prop-types';
25
+ const propTypes = {
26
+ children: PropTypes.node,
27
+ visibleItemsCount: PropTypes.number,
28
+ onUpdate: PropTypes.func,
29
+ renderHiddenItemMenu: PropTypes.func,
30
+ itemSpacing: PropTypes.string,
31
+ fixMenuTriggerWidth: PropTypes.string,
32
+ debounce: PropTypes.number,
33
+ elementRef: PropTypes.func
34
+ };
35
+ const allowedProps = ['children', 'renderHiddenItemMenu', 'visibleItemsCount', 'itemSpacing', 'fixMenuTriggerWidth', 'debounce', 'onUpdate', 'elementRef'];
36
+ export { propTypes, allowedProps };
@@ -0,0 +1,75 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} props the props of the component, the style is applied to
32
+ * @param {Object} state the state of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = (_componentTheme, props) => {
36
+ const itemSpacing = props.itemSpacing,
37
+ fixMenuTriggerWidth = props.fixMenuTriggerWidth;
38
+ const listItemStyle = {
39
+ minWidth: '0.0625rem',
40
+ flexShrink: 0,
41
+ flexGrow: 0
42
+ };
43
+ return {
44
+ truncateList: {
45
+ label: 'truncateList',
46
+ boxSizing: 'border-box',
47
+ listStyleType: 'none',
48
+ margin: '0',
49
+ padding: '0',
50
+ display: 'flex',
51
+ justifyContent: 'flex-start',
52
+ alignItems: 'center'
53
+ },
54
+ listItem: {
55
+ label: 'truncateList__listItem',
56
+ ...listItemStyle,
57
+ '& + &': {
58
+ paddingInlineStart: itemSpacing
59
+ }
60
+ },
61
+ menuTrigger: {
62
+ label: 'truncateList__menuTrigger',
63
+ maxWidth: '100%',
64
+ ...(fixMenuTriggerWidth && {
65
+ width: fixMenuTriggerWidth
66
+ }),
67
+ paddingInlineStart: itemSpacing,
68
+ '&:first-of-type': {
69
+ paddingInlineStart: 0
70
+ }
71
+ }
72
+ };
73
+ };
74
+
75
+ export default generateStyle;
package/es/index.js ADDED
@@ -0,0 +1,24 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ export { TruncateList } from './TruncateList';
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TruncateListLocator = void 0;
7
+
8
+ var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
+
10
+ var _uiTestQueries = require("@instructure/ui-test-queries");
11
+
12
+ var _index = require("./index");
13
+
14
+ /*
15
+ * The MIT License (MIT)
16
+ *
17
+ * Copyright (c) 2015 - present Instructure, Inc.
18
+ *
19
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ * of this software and associated documentation files (the "Software"), to deal
21
+ * in the Software without restriction, including without limitation the rights
22
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ * copies of the Software, and to permit persons to whom the Software is
24
+ * furnished to do so, subject to the following conditions:
25
+ *
26
+ * The above copyright notice and this permission notice shall be included in all
27
+ * copies or substantial portions of the Software.
28
+ *
29
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ * SOFTWARE.
36
+ */
37
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
38
+ const TruncateListLocator = (0, _locator.locator)(_index.TruncateList.selector, {
39
+ findAllListItems: function () {
40
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
41
+ args[_key] = arguments[_key];
42
+ }
43
+
44
+ return (0, _uiTestQueries.findAll)('li', ...args);
45
+ },
46
+ findMenuTriggerItem: function () {
47
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
48
+ args[_key2] = arguments[_key2];
49
+ }
50
+
51
+ return (0, _uiTestQueries.find)('li[class*=-truncateList__menuTrigger]', ...args);
52
+ }
53
+ });
54
+ exports.TruncateListLocator = TruncateListLocator;