@instructure/ui-tree-browser 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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 +13 -0
- package/es/TreeBrowser/v1/TreeBrowserContext.js +3 -36
- package/es/TreeBrowser/v1/TreeButton/index.js +120 -152
- package/es/TreeBrowser/v1/TreeButton/props.js +20 -26
- package/es/TreeBrowser/v1/TreeButton/styles.js +264 -305
- package/es/TreeBrowser/v1/TreeButton/theme.js +44 -79
- package/es/TreeBrowser/v1/TreeCollection/index.js +301 -359
- package/es/TreeBrowser/v1/TreeCollection/props.js +28 -26
- package/es/TreeBrowser/v1/TreeCollection/styles.js +88 -127
- package/es/TreeBrowser/v1/TreeCollection/theme.js +14 -48
- package/es/TreeBrowser/v1/TreeNode/index.js +82 -107
- package/es/TreeBrowser/v1/TreeNode/props.js +15 -26
- package/es/TreeBrowser/v1/index.js +273 -294
- package/es/TreeBrowser/v1/props.js +24 -35
- package/es/TreeBrowser/v1/styles.js +33 -68
- package/es/TreeBrowser/v1/theme.js +12 -44
- package/es/TreeBrowser/v2/TreeBrowserContext.js +3 -36
- package/es/TreeBrowser/v2/TreeButton/index.js +157 -200
- package/es/TreeBrowser/v2/TreeButton/props.js +21 -26
- package/es/TreeBrowser/v2/TreeButton/styles.js +240 -281
- package/es/TreeBrowser/v2/TreeCollection/index.js +306 -362
- package/es/TreeBrowser/v2/TreeCollection/props.js +28 -26
- package/es/TreeBrowser/v2/TreeCollection/styles.js +97 -137
- package/es/TreeBrowser/v2/TreeNode/index.js +115 -150
- package/es/TreeBrowser/v2/TreeNode/props.js +16 -26
- package/es/TreeBrowser/v2/index.js +286 -324
- package/es/TreeBrowser/v2/props.js +27 -35
- package/es/TreeBrowser/v2/styles.js +33 -69
- package/es/exports/a.js +1 -25
- package/es/exports/b.js +1 -25
- package/package.json +13 -19
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/TreeBrowser/v1/TreeBrowserContext.js +0 -44
- package/lib/TreeBrowser/v1/TreeButton/index.js +0 -169
- package/lib/TreeBrowser/v1/TreeButton/props.js +0 -31
- package/lib/TreeBrowser/v1/TreeButton/styles.js +0 -338
- package/lib/TreeBrowser/v1/TreeButton/theme.js +0 -86
- package/lib/TreeBrowser/v1/TreeCollection/index.js +0 -379
- package/lib/TreeBrowser/v1/TreeCollection/props.js +0 -31
- package/lib/TreeBrowser/v1/TreeCollection/styles.js +0 -140
- package/lib/TreeBrowser/v1/TreeCollection/theme.js +0 -55
- package/lib/TreeBrowser/v1/TreeNode/index.js +0 -122
- package/lib/TreeBrowser/v1/TreeNode/props.js +0 -31
- package/lib/TreeBrowser/v1/index.js +0 -328
- package/lib/TreeBrowser/v1/props.js +0 -40
- package/lib/TreeBrowser/v1/styles.js +0 -75
- package/lib/TreeBrowser/v1/theme.js +0 -51
- package/lib/TreeBrowser/v2/TreeBrowserContext.js +0 -44
- package/lib/TreeBrowser/v2/TreeButton/index.js +0 -220
- package/lib/TreeBrowser/v2/TreeButton/props.js +0 -31
- package/lib/TreeBrowser/v2/TreeButton/styles.js +0 -314
- package/lib/TreeBrowser/v2/TreeCollection/index.js +0 -381
- package/lib/TreeBrowser/v2/TreeCollection/props.js +0 -31
- package/lib/TreeBrowser/v2/TreeCollection/styles.js +0 -151
- package/lib/TreeBrowser/v2/TreeNode/index.js +0 -169
- package/lib/TreeBrowser/v2/TreeNode/props.js +0 -31
- package/lib/TreeBrowser/v2/index.js +0 -362
- package/lib/TreeBrowser/v2/props.js +0 -40
- package/lib/TreeBrowser/v2/styles.js +0 -77
- package/lib/exports/a.js +0 -33
- package/lib/exports/b.js +0 -33
- package/lib/package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
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-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @instructure/ui-tree-browser
|
|
@@ -1,39 +1,6 @@
|
|
|
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
1
|
import { createContext } from 'react';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
* category: components/contexts
|
|
29
|
-
* ---
|
|
30
|
-
* React context created by the `TreeBrowser` component to hold its data which are
|
|
31
|
-
* read by its children.
|
|
32
|
-
*
|
|
33
|
-
* @module
|
|
34
|
-
*/
|
|
35
|
-
const TreeBrowserContext = /*#__PURE__*/createContext({
|
|
36
|
-
animation: true
|
|
2
|
+
const TreeBrowserContext = createContext({
|
|
3
|
+
animation: true
|
|
37
4
|
});
|
|
38
5
|
export default TreeBrowserContext;
|
|
39
|
-
export { TreeBrowserContext };
|
|
6
|
+
export { TreeBrowserContext };
|
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Component } from 'react';
|
|
27
4
|
import { Img } from '@instructure/ui-img/v11_6';
|
|
28
5
|
import { callRenderProp } from '@instructure/ui-react-utils';
|
|
@@ -31,136 +8,127 @@ import generateStyles from './styles.js';
|
|
|
31
8
|
import generateComponentTheme from './theme.js';
|
|
32
9
|
import { allowedProps } from './props.js';
|
|
33
10
|
import TreeBrowserContext from '../TreeBrowserContext.js';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
11
|
+
class TreeButton extends Component {
|
|
12
|
+
static{
|
|
13
|
+
this.displayName = 'TreeButton';
|
|
14
|
+
}
|
|
15
|
+
static{
|
|
16
|
+
this.componentId = 'TreeBrowser.Button';
|
|
17
|
+
}
|
|
18
|
+
static{
|
|
19
|
+
this.allowedProps = allowedProps;
|
|
20
|
+
}
|
|
21
|
+
static{
|
|
22
|
+
this.contextType = TreeBrowserContext;
|
|
23
|
+
}
|
|
24
|
+
static{
|
|
25
|
+
this.defaultProps = {
|
|
26
|
+
type: 'treeButton',
|
|
27
|
+
size: 'medium',
|
|
28
|
+
variant: 'folderTree',
|
|
29
|
+
selected: false,
|
|
30
|
+
focused: false,
|
|
31
|
+
expanded: false
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
componentDidMount() {
|
|
35
|
+
this.props.makeStyles?.({
|
|
36
|
+
animation: this.context?.animation
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
componentDidUpdate() {
|
|
40
|
+
this.props.makeStyles?.({
|
|
41
|
+
animation: this.context?.animation
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
defaultContentRenderer(props) {
|
|
45
|
+
const { name, descriptor, styles } = props;
|
|
46
|
+
return /*#__PURE__*/ _jsxs("span", {
|
|
47
|
+
css: styles.layout,
|
|
48
|
+
children: [
|
|
49
|
+
this.renderImage(),
|
|
50
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
51
|
+
css: styles.text,
|
|
52
|
+
children: [
|
|
53
|
+
/*#__PURE__*/ _jsx("span", {
|
|
54
|
+
css: styles.textName,
|
|
55
|
+
children: name
|
|
56
|
+
}),
|
|
57
|
+
descriptor ? /*#__PURE__*/ _jsx("span", {
|
|
58
|
+
css: styles.textDescriptor,
|
|
59
|
+
title: descriptor,
|
|
60
|
+
children: descriptor
|
|
61
|
+
}) : null
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
renderImage() {
|
|
68
|
+
const { type } = this.props;
|
|
69
|
+
switch(type){
|
|
70
|
+
case 'collection':
|
|
71
|
+
return this.renderCollectionIcon();
|
|
72
|
+
case 'item':
|
|
73
|
+
return this.renderItemImage();
|
|
74
|
+
default:
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
100
78
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (collectionIcon || collectionIconExpanded) {
|
|
111
|
-
return _jsx("div", {
|
|
112
|
-
css: styles?.icon,
|
|
113
|
-
children: callRenderProp(expanded ? collectionIconExpanded : collectionIcon)
|
|
114
|
-
});
|
|
79
|
+
renderCollectionIcon() {
|
|
80
|
+
const { expanded, collectionIcon, collectionIconExpanded, styles } = this.props;
|
|
81
|
+
if (collectionIcon || collectionIconExpanded) {
|
|
82
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
83
|
+
css: styles?.icon,
|
|
84
|
+
children: callRenderProp(expanded ? collectionIconExpanded : collectionIcon)
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return undefined;
|
|
115
88
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
89
|
+
renderItemImage() {
|
|
90
|
+
const { thumbnail, itemIcon, styles } = this.props;
|
|
91
|
+
if (thumbnail) {
|
|
92
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
93
|
+
css: styles?.thumbnail,
|
|
94
|
+
children: /*#__PURE__*/ _jsx(Img, {
|
|
95
|
+
src: thumbnail,
|
|
96
|
+
constrain: "cover",
|
|
97
|
+
alt: ""
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (itemIcon) {
|
|
102
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
103
|
+
css: styles?.icon,
|
|
104
|
+
children: callRenderProp(itemIcon)
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
133
108
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
109
|
+
render() {
|
|
110
|
+
const { styles, renderContent } = this.props;
|
|
111
|
+
const buttonContent = renderContent ? renderContent(this.props) : this.defaultContentRenderer(this.props);
|
|
112
|
+
return /*#__PURE__*/ _jsx("button", {
|
|
113
|
+
ref: this.handleRef,
|
|
114
|
+
tabIndex: -1,
|
|
115
|
+
type: "button",
|
|
116
|
+
css: styles?.treeButton,
|
|
117
|
+
"data-cid": "TreeButton",
|
|
118
|
+
children: buttonContent
|
|
119
|
+
});
|
|
139
120
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
121
|
+
constructor(...args){
|
|
122
|
+
super(...args), this.ref = null, this.handleRef = (el)=>{
|
|
123
|
+
if (el && typeof this.props.containerRef === 'function') {
|
|
124
|
+
this.props.containerRef(el.parentElement);
|
|
125
|
+
}
|
|
126
|
+
this.ref = el;
|
|
127
|
+
};
|
|
145
128
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
styles,
|
|
151
|
-
renderContent
|
|
152
|
-
} = this.props;
|
|
153
|
-
const buttonContent = renderContent ? renderContent(this.props) : this.defaultContentRenderer(this.props);
|
|
154
|
-
// VoiceOver can't navigate without the buttons, even though they don't do anything
|
|
155
|
-
return _jsx("button", {
|
|
156
|
-
ref: this.handleRef,
|
|
157
|
-
tabIndex: -1,
|
|
158
|
-
type: "button",
|
|
159
|
-
css: styles?.treeButton,
|
|
160
|
-
"data-cid": "TreeButton",
|
|
161
|
-
children: buttonContent
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}) || _class);
|
|
129
|
+
}
|
|
130
|
+
TreeButton = _ts_decorate([
|
|
131
|
+
withStyle(generateStyles, generateComponentTheme)
|
|
132
|
+
], TreeButton);
|
|
165
133
|
export default TreeButton;
|
|
166
|
-
export { TreeButton };
|
|
134
|
+
export { TreeButton };
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['id', 'name', 'descriptor', 'type', 'size', 'variant', 'collectionIcon', 'collectionIconExpanded', 'itemIcon', 'thumbnail', 'onClick', 'expanded', 'selected', 'focused', 'level', 'containerRef', 'renderContent'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'id',
|
|
3
|
+
'name',
|
|
4
|
+
'descriptor',
|
|
5
|
+
'type',
|
|
6
|
+
'size',
|
|
7
|
+
'variant',
|
|
8
|
+
'collectionIcon',
|
|
9
|
+
'collectionIconExpanded',
|
|
10
|
+
'itemIcon',
|
|
11
|
+
'thumbnail',
|
|
12
|
+
'onClick',
|
|
13
|
+
'expanded',
|
|
14
|
+
'selected',
|
|
15
|
+
'focused',
|
|
16
|
+
'level',
|
|
17
|
+
'containerRef',
|
|
18
|
+
'renderContent'
|
|
19
|
+
];
|
|
20
|
+
export { allowedProps };
|