@instructure/ui-tree-browser 8.56.1 → 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 +8 -0
- package/lib/TreeBrowser/TreeBrowserLocator.js +3 -3
- package/lib/TreeBrowser/TreeButton/index.js +7 -7
- package/lib/TreeBrowser/TreeCollection/index.js +4 -4
- package/lib/TreeBrowser/TreeCollection/props.js +3 -3
- package/lib/TreeBrowser/TreeNode/index.js +6 -6
- package/lib/TreeBrowser/index.js +8 -10
- package/lib/TreeBrowser/props.js +2 -2
- package/package.json +14 -14
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
|
+
## [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-tree-browser
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [8.56.1](https://github.com/instructure/instructure-ui/compare/v8.56.0...v8.56.1) (2024-06-13)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-tree-browser
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TreeBrowserLocator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiTestLocator = require("@instructure/ui-test-locator");
|
|
8
8
|
var _index = require("./index");
|
|
9
9
|
/*
|
|
10
10
|
* The MIT License (MIT)
|
|
@@ -31,10 +31,10 @@ var _index = require("./index");
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
// TODO: if we make a TreeBrowserItem component + locator we could use it here.
|
|
34
|
-
const TreeBrowserItemLocator = (0,
|
|
34
|
+
const TreeBrowserItemLocator = (0, _uiTestLocator.locator)('[role="treeitem"]');
|
|
35
35
|
|
|
36
36
|
// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
|
|
37
|
-
const TreeBrowserLocator = exports.TreeBrowserLocator = (0,
|
|
37
|
+
const TreeBrowserLocator = exports.TreeBrowserLocator = (0, _uiTestLocator.locator)(_index.TreeBrowser.selector, {
|
|
38
38
|
findAllItems: (...args) => {
|
|
39
39
|
return TreeBrowserItemLocator.findAll(...args);
|
|
40
40
|
},
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.TreeButton = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
10
|
+
var _uiImg = require("@instructure/ui-img");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
12
|
var _emotion = require("@instructure/emotion");
|
|
13
13
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
14
14
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -45,7 +45,7 @@ parent: TreeBrowser
|
|
|
45
45
|
id: TreeBrowser.Button
|
|
46
46
|
---
|
|
47
47
|
**/
|
|
48
|
-
let TreeButton = exports.TreeButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
48
|
+
let TreeButton = exports.TreeButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class TreeButton extends _react.Component {
|
|
49
49
|
constructor(...args) {
|
|
50
50
|
super(...args);
|
|
51
51
|
this.ref = null;
|
|
@@ -100,7 +100,7 @@ let TreeButton = exports.TreeButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
100
100
|
if (collectionIcon || collectionIconExpanded) {
|
|
101
101
|
return (0, _emotion.jsx)("div", {
|
|
102
102
|
css: styles === null || styles === void 0 ? void 0 : styles.icon
|
|
103
|
-
}, (0,
|
|
103
|
+
}, (0, _uiReactUtils.callRenderProp)(expanded ? collectionIconExpanded : collectionIcon));
|
|
104
104
|
}
|
|
105
105
|
return void 0;
|
|
106
106
|
}
|
|
@@ -112,7 +112,7 @@ let TreeButton = exports.TreeButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
112
112
|
if (thumbnail) {
|
|
113
113
|
return (0, _emotion.jsx)("div", {
|
|
114
114
|
css: styles === null || styles === void 0 ? void 0 : styles.thumbnail
|
|
115
|
-
}, (0, _emotion.jsx)(
|
|
115
|
+
}, (0, _emotion.jsx)(_uiImg.Img, {
|
|
116
116
|
src: thumbnail,
|
|
117
117
|
constrain: "cover",
|
|
118
118
|
alt: ""
|
|
@@ -121,7 +121,7 @@ let TreeButton = exports.TreeButton = (_dec = (0, _emotion.withStyle)(_styles.de
|
|
|
121
121
|
if (itemIcon) {
|
|
122
122
|
return (0, _emotion.jsx)("div", {
|
|
123
123
|
css: styles === null || styles === void 0 ? void 0 : styles.icon
|
|
124
|
-
}, (0,
|
|
124
|
+
}, (0, _uiReactUtils.callRenderProp)(itemIcon));
|
|
125
125
|
}
|
|
126
126
|
return void 0;
|
|
127
127
|
}
|
|
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.TreeCollection = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var
|
|
10
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
11
11
|
var _emotion = require("@instructure/emotion");
|
|
12
|
-
var
|
|
12
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
13
13
|
var _TreeButton = require("../TreeButton");
|
|
14
14
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
15
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
@@ -47,7 +47,7 @@ parent: TreeBrowser
|
|
|
47
47
|
id: TreeBrowser.Collection
|
|
48
48
|
---
|
|
49
49
|
**/
|
|
50
|
-
let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
50
|
+
let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class TreeCollection extends _react.Component {
|
|
51
51
|
constructor(props) {
|
|
52
52
|
super(props);
|
|
53
53
|
this.ref = null;
|
|
@@ -214,7 +214,7 @@ let TreeCollection = exports.TreeCollection = (_dec = (0, _emotion.withStyle)(_s
|
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
onBlur: e => this.handleBlur(e, itemHash)
|
|
217
|
-
}), (0,
|
|
217
|
+
}), (0, _uiReactUtils.safeCloneElement)(child, itemProps));
|
|
218
218
|
}
|
|
219
219
|
renderCollectionNode(collection, position) {
|
|
220
220
|
return (0, _emotion.jsx)(TreeCollection, Object.assign({}, this.props, {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
10
|
var _TreeNode = require("../TreeNode");
|
|
11
11
|
/*
|
|
12
12
|
* The MIT License (MIT)
|
|
@@ -53,8 +53,8 @@ const propTypes = exports.propTypes = {
|
|
|
53
53
|
numChildren: _propTypes.default.number,
|
|
54
54
|
level: _propTypes.default.number.isRequired,
|
|
55
55
|
position: _propTypes.default.number,
|
|
56
|
-
renderBeforeItems:
|
|
57
|
-
renderAfterItems:
|
|
56
|
+
renderBeforeItems: _uiPropTypes.Children.oneOf([_TreeNode.TreeNode]),
|
|
57
|
+
renderAfterItems: _uiPropTypes.Children.oneOf([_TreeNode.TreeNode]),
|
|
58
58
|
containerRef: _propTypes.default.func,
|
|
59
59
|
isCollectionFlattened: _propTypes.default.bool,
|
|
60
60
|
renderContent: _propTypes.default.func,
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.TreeNode = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var _uiImg = require("@instructure/ui-img");
|
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
11
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
12
12
|
var _emotion = require("@instructure/emotion");
|
|
13
13
|
var _styles = _interopRequireDefault(require("../TreeButton/styles"));
|
|
14
14
|
var _theme = _interopRequireDefault(require("../TreeButton/theme"));
|
|
@@ -48,7 +48,7 @@ id: TreeBrowser.Node
|
|
|
48
48
|
A helper class used to render the :renderBeforeItems and :renderAfterItems
|
|
49
49
|
in the TreeBrowser.
|
|
50
50
|
**/
|
|
51
|
-
let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
51
|
+
let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class TreeNode extends _react.Component {
|
|
52
52
|
constructor(...args) {
|
|
53
53
|
super(...args);
|
|
54
54
|
this.ref = null;
|
|
@@ -75,7 +75,7 @@ let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.defaul
|
|
|
75
75
|
if (thumbnail) {
|
|
76
76
|
return (0, _emotion.jsx)("div", {
|
|
77
77
|
css: styles === null || styles === void 0 ? void 0 : styles.thumbnail
|
|
78
|
-
}, (0, _emotion.jsx)(
|
|
78
|
+
}, (0, _emotion.jsx)(_uiImg.Img, {
|
|
79
79
|
src: thumbnail,
|
|
80
80
|
constrain: "cover",
|
|
81
81
|
alt: ""
|
|
@@ -84,7 +84,7 @@ let TreeNode = exports.TreeNode = (_dec = (0, _emotion.withStyle)(_styles.defaul
|
|
|
84
84
|
if (itemIcon) {
|
|
85
85
|
return (0, _emotion.jsx)("div", {
|
|
86
86
|
css: styles === null || styles === void 0 ? void 0 : styles.icon
|
|
87
|
-
}, (0,
|
|
87
|
+
}, (0, _uiReactUtils.callRenderProp)(itemIcon));
|
|
88
88
|
}
|
|
89
89
|
return void 0;
|
|
90
90
|
}
|
package/lib/TreeBrowser/index.js
CHANGED
|
@@ -7,11 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.TreeBrowser = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _keycode = _interopRequireDefault(require("keycode"));
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
|
|
14
|
-
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
10
|
+
var _uiIcons = require("@instructure/ui-icons");
|
|
11
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
12
|
+
var _uiTestable = require("@instructure/ui-testable");
|
|
15
13
|
var _emotion = require("@instructure/emotion");
|
|
16
14
|
var _TreeCollection = require("./TreeCollection");
|
|
17
15
|
var _TreeButton = require("./TreeButton");
|
|
@@ -49,7 +47,7 @@ var _dec, _dec2, _class, _class2;
|
|
|
49
47
|
category: components
|
|
50
48
|
---
|
|
51
49
|
**/
|
|
52
|
-
let TreeBrowser = exports.TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0,
|
|
50
|
+
let TreeBrowser = exports.TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _uiTestable.testable)(), _dec(_class = _dec2(_class = (_class2 = class TreeBrowser extends _react.Component {
|
|
53
51
|
constructor(props) {
|
|
54
52
|
super(props);
|
|
55
53
|
this.ref = null;
|
|
@@ -267,7 +265,7 @@ let TreeBrowser = exports.TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
267
265
|
renderRoot() {
|
|
268
266
|
return this.collections.sort(this.props.sortOrder).map((collection, i) => (0, _emotion.jsx)(_TreeCollection.TreeCollection, Object.assign({
|
|
269
267
|
key: i
|
|
270
|
-
}, (0,
|
|
268
|
+
}, (0, _uiReactUtils.pickProps)((0, _uiReactUtils.omitProps)(this.props), _TreeCollection.TreeCollection.allowedProps), this.getCollectionProps(collection), {
|
|
271
269
|
selection: this.state.selection,
|
|
272
270
|
onItemClick: this.handleItemClick,
|
|
273
271
|
onCollectionClick: this.handleCollectionClick,
|
|
@@ -295,9 +293,9 @@ let TreeBrowser = exports.TreeBrowser = (_dec = (0, _emotion.withStyle)(_styles.
|
|
|
295
293
|
size: 'medium',
|
|
296
294
|
variant: 'folderTree',
|
|
297
295
|
showRootCollection: true,
|
|
298
|
-
collectionIcon:
|
|
299
|
-
collectionIconExpanded:
|
|
300
|
-
itemIcon:
|
|
296
|
+
collectionIcon: _uiIcons.IconFolderLine,
|
|
297
|
+
collectionIconExpanded: _uiIcons.IconFolderLine,
|
|
298
|
+
itemIcon: _uiIcons.IconDocumentLine,
|
|
301
299
|
getItemProps: props => props,
|
|
302
300
|
getCollectionProps: props => props,
|
|
303
301
|
defaultExpanded: [],
|
package/lib/TreeBrowser/props.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.propTypes = exports.allowedProps = void 0;
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var
|
|
9
|
+
var _uiPropTypes = require("@instructure/ui-prop-types");
|
|
10
10
|
/*
|
|
11
11
|
* The MIT License (MIT)
|
|
12
12
|
*
|
|
@@ -42,7 +42,7 @@ const propTypes = exports.propTypes = {
|
|
|
42
42
|
collections: _propTypes.default.object.isRequired,
|
|
43
43
|
items: _propTypes.default.object.isRequired,
|
|
44
44
|
rootId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
45
|
-
expanded: (0,
|
|
45
|
+
expanded: (0, _uiPropTypes.controllable)(_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])), 'onCollectionToggle'),
|
|
46
46
|
defaultExpanded: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])),
|
|
47
47
|
selectionType: _propTypes.default.oneOf(['none', 'single']),
|
|
48
48
|
size: _propTypes.default.oneOf(['small', 'medium', 'large']),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-tree-browser",
|
|
3
|
-
"version": "8.56.
|
|
3
|
+
"version": "8.56.2-pr-snapshot-1721749364069",
|
|
4
4
|
"description": "A component for displaying a hierarchical view of information",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,22 +23,22 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "8.56.
|
|
27
|
-
"@instructure/ui-color-utils": "8.56.
|
|
28
|
-
"@instructure/ui-test-locator": "8.56.
|
|
29
|
-
"@instructure/ui-test-utils": "8.56.
|
|
30
|
-
"@instructure/ui-themes": "8.56.
|
|
26
|
+
"@instructure/ui-babel-preset": "8.56.2-pr-snapshot-1721749364069",
|
|
27
|
+
"@instructure/ui-color-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
28
|
+
"@instructure/ui-test-locator": "8.56.2-pr-snapshot-1721749364069",
|
|
29
|
+
"@instructure/ui-test-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
30
|
+
"@instructure/ui-themes": "8.56.2-pr-snapshot-1721749364069"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.23.2",
|
|
34
|
-
"@instructure/emotion": "8.56.
|
|
35
|
-
"@instructure/shared-types": "8.56.
|
|
36
|
-
"@instructure/ui-icons": "8.56.
|
|
37
|
-
"@instructure/ui-img": "8.56.
|
|
38
|
-
"@instructure/ui-prop-types": "8.56.
|
|
39
|
-
"@instructure/ui-react-utils": "8.56.
|
|
40
|
-
"@instructure/ui-testable": "8.56.
|
|
41
|
-
"@instructure/ui-utils": "8.56.
|
|
34
|
+
"@instructure/emotion": "8.56.2-pr-snapshot-1721749364069",
|
|
35
|
+
"@instructure/shared-types": "8.56.2-pr-snapshot-1721749364069",
|
|
36
|
+
"@instructure/ui-icons": "8.56.2-pr-snapshot-1721749364069",
|
|
37
|
+
"@instructure/ui-img": "8.56.2-pr-snapshot-1721749364069",
|
|
38
|
+
"@instructure/ui-prop-types": "8.56.2-pr-snapshot-1721749364069",
|
|
39
|
+
"@instructure/ui-react-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
40
|
+
"@instructure/ui-testable": "8.56.2-pr-snapshot-1721749364069",
|
|
41
|
+
"@instructure/ui-utils": "8.56.2-pr-snapshot-1721749364069",
|
|
42
42
|
"keycode": "^2.2.1",
|
|
43
43
|
"prop-types": "^15.8.1"
|
|
44
44
|
},
|