@instructure/ui-tree-browser 11.6.0 → 11.6.1-pr-snapshot-1779894247159

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 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.6.1-pr-snapshot-1779894247159](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.6.1-pr-snapshot-1779894247159) (2026-05-27)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-tree-browser
9
+
10
+
11
+
12
+
13
+
6
14
  # [11.6.0](https://github.com/instructure/instructure-ui/compare/v11.5.0...v11.6.0) (2026-02-18)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/ui-tree-browser
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
1
  /*
8
2
  * The MIT License (MIT)
9
3
  *
@@ -28,4 +22,16 @@ exports.allowedProps = void 0;
28
22
  * SOFTWARE.
29
23
  */
30
24
 
31
- const allowedProps = exports.allowedProps = ['id', 'size', 'variant', 'selected', 'focused', 'itemIcon', 'thumbnail', 'level', 'children', 'containerRef', 'onKeyDown', 'onClick'];
25
+ module.exports = {
26
+ presets: [
27
+ [
28
+ require('@instructure/ui-babel-preset'),
29
+ {
30
+ coverage: Boolean(process.env.COVERAGE),
31
+ esModules: Boolean(process.env.ES_MODULES),
32
+ removeConsole: process.env.NODE_ENV === 'production',
33
+ transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
34
+ }
35
+ ]
36
+ ]
37
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-tree-browser",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-pr-snapshot-1779894247159",
4
+ "type": "module",
4
5
  "description": "A component for displaying a hierarchical view of information",
5
6
  "author": "Instructure, Inc. Engineering and Product Design",
6
7
  "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
@@ -16,21 +16,21 @@
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
18
  "keycode": "^2",
19
- "@instructure/emotion": "11.6.0",
20
- "@instructure/shared-types": "11.6.0",
21
- "@instructure/ui-icons": "11.6.0",
22
- "@instructure/ui-img": "11.6.0",
23
- "@instructure/ui-react-utils": "11.6.0",
24
- "@instructure/ui-utils": "11.6.0"
19
+ "@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
20
+ "@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
21
+ "@instructure/ui-img": "11.6.1-pr-snapshot-1779894247159",
22
+ "@instructure/ui-icons": "11.6.1-pr-snapshot-1779894247159",
23
+ "@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159",
24
+ "@instructure/ui-utils": "11.6.1-pr-snapshot-1779894247159"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@testing-library/jest-dom": "^6.6.3",
28
28
  "@testing-library/react": "15.0.7",
29
29
  "vitest": "^3.2.2",
30
- "@instructure/ui-axe-check": "11.6.0",
31
- "@instructure/ui-babel-preset": "11.6.0",
32
- "@instructure/ui-color-utils": "11.6.0",
33
- "@instructure/ui-themes": "11.6.0"
30
+ "@instructure/ui-axe-check": "11.6.1-pr-snapshot-1779894247159",
31
+ "@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
32
+ "@instructure/ui-color-utils": "11.6.1-pr-snapshot-1779894247159",
33
+ "@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=18 <=19"
@@ -43,10 +43,8 @@
43
43
  ".": {
44
44
  "types": "./types/index.d.ts",
45
45
  "import": "./es/index.js",
46
- "require": "./lib/index.js",
47
46
  "default": "./es/index.js"
48
47
  },
49
- "./lib/*": "./lib/*",
50
48
  "./es/*": "./es/*",
51
49
  "./types/*": "./types/*",
52
50
  "./package.json": "./package.json",
@@ -56,7 +54,7 @@
56
54
  "lint": "ui-scripts lint",
57
55
  "lint:fix": "ui-scripts lint --fix",
58
56
  "clean": "ui-scripts clean",
59
- "build": "ui-scripts build --modules es,cjs",
57
+ "build": "ui-scripts build",
60
58
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
61
59
  "build:types": "tsc -p tsconfig.build.json",
62
60
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.TreeBrowserContext = void 0;
7
- var _react = require("react");
8
- /*
9
- * The MIT License (MIT)
10
- *
11
- * Copyright (c) 2015 - present Instructure, Inc.
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- * copies of the Software, and to permit persons to whom the Software is
18
- * furnished to do so, subject to the following conditions:
19
- *
20
- * The above copyright notice and this permission notice shall be included in all
21
- * copies or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
- * SOFTWARE.
30
- */
31
-
32
- /**
33
- * ---
34
- * category: components/contexts
35
- * ---
36
- * React context created by the `TreeBrowser` component to hold its data which are
37
- * read by its children.
38
- *
39
- * @module
40
- */
41
- const TreeBrowserContext = exports.TreeBrowserContext = /*#__PURE__*/(0, _react.createContext)({
42
- animation: true
43
- });
44
- var _default = exports.default = TreeBrowserContext;
@@ -1,162 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.TreeButton = void 0;
8
- var _react = require("react");
9
- var _Img = require("@instructure/ui-img/lib/Img");
10
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
11
- var _emotion = require("@instructure/emotion");
12
- var _styles = _interopRequireDefault(require("./styles"));
13
- var _theme = _interopRequireDefault(require("./theme"));
14
- var _props = require("./props");
15
- var _TreeBrowserContext = _interopRequireDefault(require("../TreeBrowserContext"));
16
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
17
- var _dec, _class, _TreeButton;
18
- /*
19
- * The MIT License (MIT)
20
- *
21
- * Copyright (c) 2015 - present Instructure, Inc.
22
- *
23
- * Permission is hereby granted, free of charge, to any person obtaining a copy
24
- * of this software and associated documentation files (the "Software"), to deal
25
- * in the Software without restriction, including without limitation the rights
26
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27
- * copies of the Software, and to permit persons to whom the Software is
28
- * furnished to do so, subject to the following conditions:
29
- *
30
- * The above copyright notice and this permission notice shall be included in all
31
- * copies or substantial portions of the Software.
32
- *
33
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39
- * SOFTWARE.
40
- */
41
- // Todo: merge TreeButton and TreeNode: TreeButton should be a special type of TreeNode
42
- /**
43
- ---
44
- parent: TreeBrowser
45
- id: TreeBrowser.Button
46
- ---
47
- **/
48
- let TreeButton = exports.TreeButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_TreeButton = class TreeButton extends _react.Component {
49
- constructor(...args) {
50
- super(...args);
51
- this.ref = null;
52
- this.handleRef = el => {
53
- if (el && typeof this.props.containerRef === 'function') {
54
- this.props.containerRef(el.parentElement);
55
- }
56
- this.ref = el;
57
- };
58
- }
59
- componentDidMount() {
60
- var _this$props$makeStyle, _this$props, _this$context;
61
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, {
62
- animation: (_this$context = this.context) === null || _this$context === void 0 ? void 0 : _this$context.animation
63
- });
64
- }
65
- componentDidUpdate() {
66
- var _this$props$makeStyle2, _this$props2, _this$context2;
67
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, {
68
- animation: (_this$context2 = this.context) === null || _this$context2 === void 0 ? void 0 : _this$context2.animation
69
- });
70
- }
71
- defaultContentRenderer(props) {
72
- const name = props.name,
73
- descriptor = props.descriptor,
74
- styles = props.styles;
75
- return (0, _jsxRuntime.jsxs)("span", {
76
- css: styles.layout,
77
- children: [this.renderImage(), (0, _jsxRuntime.jsxs)("span", {
78
- css: styles.text,
79
- children: [(0, _jsxRuntime.jsx)("span", {
80
- css: styles.textName,
81
- children: name
82
- }), descriptor ? (0, _jsxRuntime.jsx)("span", {
83
- css: styles.textDescriptor,
84
- title: descriptor,
85
- children: descriptor
86
- }) : null]
87
- })]
88
- });
89
- }
90
- renderImage() {
91
- const type = this.props.type;
92
- switch (type) {
93
- case 'collection':
94
- return this.renderCollectionIcon();
95
- case 'item':
96
- return this.renderItemImage();
97
- default:
98
- break;
99
- }
100
- return void 0;
101
- }
102
- renderCollectionIcon() {
103
- const _this$props3 = this.props,
104
- expanded = _this$props3.expanded,
105
- collectionIcon = _this$props3.collectionIcon,
106
- collectionIconExpanded = _this$props3.collectionIconExpanded,
107
- styles = _this$props3.styles;
108
- if (collectionIcon || collectionIconExpanded) {
109
- return (0, _jsxRuntime.jsx)("div", {
110
- css: styles === null || styles === void 0 ? void 0 : styles.icon,
111
- children: (0, _callRenderProp.callRenderProp)(expanded ? collectionIconExpanded : collectionIcon)
112
- });
113
- }
114
- return void 0;
115
- }
116
- renderItemImage() {
117
- const _this$props4 = this.props,
118
- thumbnail = _this$props4.thumbnail,
119
- itemIcon = _this$props4.itemIcon,
120
- styles = _this$props4.styles;
121
- if (thumbnail) {
122
- return (0, _jsxRuntime.jsx)("div", {
123
- css: styles === null || styles === void 0 ? void 0 : styles.thumbnail,
124
- children: (0, _jsxRuntime.jsx)(_Img.Img, {
125
- src: thumbnail,
126
- constrain: "cover",
127
- alt: ""
128
- })
129
- });
130
- }
131
- if (itemIcon) {
132
- return (0, _jsxRuntime.jsx)("div", {
133
- css: styles === null || styles === void 0 ? void 0 : styles.icon,
134
- children: (0, _callRenderProp.callRenderProp)(itemIcon)
135
- });
136
- }
137
- return void 0;
138
- }
139
- render() {
140
- const _this$props5 = this.props,
141
- styles = _this$props5.styles,
142
- renderContent = _this$props5.renderContent;
143
- const buttonContent = renderContent ? renderContent(this.props) : this.defaultContentRenderer(this.props);
144
- // VoiceOver can't navigate without the buttons, even though they don't do anything
145
- return (0, _jsxRuntime.jsx)("button", {
146
- ref: this.handleRef,
147
- tabIndex: -1,
148
- type: "button",
149
- css: styles === null || styles === void 0 ? void 0 : styles.treeButton,
150
- "data-cid": "TreeButton",
151
- children: buttonContent
152
- });
153
- }
154
- }, _TreeButton.displayName = "TreeButton", _TreeButton.componentId = 'TreeBrowser.Button', _TreeButton.allowedProps = _props.allowedProps, _TreeButton.contextType = _TreeBrowserContext.default, _TreeButton.defaultProps = {
155
- type: 'treeButton',
156
- size: 'medium',
157
- variant: 'folderTree',
158
- selected: false,
159
- focused: false,
160
- expanded: false
161
- }, _TreeButton)) || _class);
162
- var _default = exports.default = TreeButton;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- const allowedProps = exports.allowedProps = ['id', 'name', 'descriptor', 'type', 'size', 'variant', 'collectionIcon', 'collectionIconExpanded', 'itemIcon', 'thumbnail', 'onClick', 'expanded', 'selected', 'focused', 'level', 'containerRef', 'renderContent'];
@@ -1,336 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _emotion = require("@instructure/emotion");
8
- /*
9
- * The MIT License (MIT)
10
- *
11
- * Copyright (c) 2015 - present Instructure, Inc.
12
- *
13
- * Permission is hereby granted, free of charge, to any person obtaining a copy
14
- * of this software and associated documentation files (the "Software"), to deal
15
- * in the Software without restriction, including without limitation the rights
16
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
- * copies of the Software, and to permit persons to whom the Software is
18
- * furnished to do so, subject to the following conditions:
19
- *
20
- * The above copyright notice and this permission notice shall be included in all
21
- * copies or substantial portions of the Software.
22
- *
23
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
- * SOFTWARE.
30
- */
31
-
32
- const transform = (0, _emotion.keyframes)`
33
- 50% {
34
- opacity: 0.5;
35
- transform: translate3d(2%, 0, 0);
36
- }
37
-
38
- 100% {
39
- opacity: 1;
40
- transform: translate3d(0, 0, 0);
41
- }`;
42
- /**
43
- *
44
- * ---
45
- * private: true
46
- * ---
47
- * Generates the style object from the theme and provided additional information
48
- * @param {Object} componentTheme The theme variable object.
49
- * @param {Object} props the props of the component, the style is applied to
50
- * @param {Object} state the state of the component, the style is applied to
51
- * @return {Object} The final style object, which will be used in the component
52
- */
53
- const generateStyles = (componentTheme, props, state) => {
54
- const size = props.size,
55
- variant = props.variant,
56
- selected = props.selected,
57
- focused = props.focused,
58
- level = props.level;
59
- const isRootButton = level && level === 1;
60
- const sizeMap = {
61
- small: {
62
- folderTree: {
63
- before: {
64
- width: `calc(${componentTheme.baseSpacingSmall} - 0.0625rem)`
65
- },
66
- icon: {
67
- fontSize: `calc(${componentTheme.baseSpacingSmall} * 2)`,
68
- marginInlineEnd: componentTheme.baseSpacingSmall,
69
- marginInlineStart: '0'
70
- },
71
- thumbnail: {
72
- height: `calc(${componentTheme.baseSpacingSmall} * 2)`,
73
- width: `calc(${componentTheme.baseSpacingSmall}* 2)`,
74
- marginInlineEnd: componentTheme.baseSpacingSmall,
75
- marginInlineStart: '0'
76
- }
77
- },
78
- indent: {
79
- icon: {
80
- fontSize: `calc(${componentTheme.baseSpacingSmall} * 2)`,
81
- marginInlineEnd: `calc(${componentTheme.baseSpacingSmall} / 2)`,
82
- marginInlineStart: '0'
83
- },
84
- thumbnail: {
85
- height: `calc(${componentTheme.baseSpacingSmall} * 2)`,
86
- width: `calc(${componentTheme.baseSpacingSmall} * 2)`,
87
- marginInlineEnd: `calc(${componentTheme.baseSpacingSmall} / 2)`,
88
- marginInlineStart: '0'
89
- }
90
- },
91
- textName: {
92
- fontSize: componentTheme.nameFontSizeSmall
93
- },
94
- textDescriptor: {
95
- fontSize: componentTheme.descriptorFontSizeSmall
96
- }
97
- },
98
- medium: {
99
- folderTree: {
100
- before: {
101
- width: `calc(${componentTheme.baseSpacingMedium} - 0.0625rem)`
102
- },
103
- icon: {
104
- fontSize: `calc(${componentTheme.baseSpacingMedium} * 2)`,
105
- marginInlineEnd: componentTheme.baseSpacingMedium,
106
- marginInlineStart: '0'
107
- },
108
- thumbnail: {
109
- height: `calc(${componentTheme.baseSpacingMedium} * 2)`,
110
- width: `calc(${componentTheme.baseSpacingMedium} * 2)`,
111
- marginInlineEnd: componentTheme.baseSpacingMedium,
112
- marginInlineStart: '0'
113
- }
114
- },
115
- indent: {
116
- icon: {
117
- fontSize: `calc(${componentTheme.baseSpacingMedium} * 2)`,
118
- marginInlineEnd: `calc(${componentTheme.baseSpacingMedium} / 2)`,
119
- marginInlineStart: '0'
120
- },
121
- thumbnail: {
122
- height: `calc(${componentTheme.baseSpacingMedium} * 2)`,
123
- width: `calc(${componentTheme.baseSpacingMedium} * 2)`,
124
- marginInlineEnd: `calc(${componentTheme.baseSpacingMedium} / 2)`,
125
- marginInlineStart: '0'
126
- }
127
- },
128
- textName: {
129
- fontSize: componentTheme.nameFontSizeMedium
130
- },
131
- textDescriptor: {
132
- fontSize: componentTheme.descriptorFontSizeMedium
133
- }
134
- },
135
- large: {
136
- folderTree: {
137
- before: {
138
- width: `calc(${componentTheme.baseSpacingLarge} - 0.0625rem)`
139
- },
140
- icon: {
141
- fontSize: `calc(${componentTheme.baseSpacingLarge} * 2)`,
142
- marginInlineEnd: componentTheme.baseSpacingLarge,
143
- marginInlineStart: '0'
144
- },
145
- thumbnail: {
146
- height: `calc(${componentTheme.baseSpacingLarge} * 2)`,
147
- width: `calc(${componentTheme.baseSpacingLarge} * 2)`,
148
- marginInlineEnd: componentTheme.baseSpacingLarge,
149
- marginInlineStart: '0'
150
- }
151
- },
152
- indent: {
153
- icon: {
154
- fontSize: `calc(${componentTheme.baseSpacingLarge} * 2)`,
155
- marginInlineEnd: `calc(${componentTheme.baseSpacingLarge} / 2)`,
156
- marginInlineStart: '0'
157
- },
158
- thumbnail: {
159
- height: `calc(${componentTheme.baseSpacingLarge} * 2)`,
160
- width: `calc(${componentTheme.baseSpacingLarge}* 2)`,
161
- marginInlineEnd: `calc(${componentTheme.baseSpacingLarge} / 2)`,
162
- marginInlineStart: '0'
163
- }
164
- },
165
- textName: {
166
- fontSize: componentTheme.nameFontSizeLarge
167
- },
168
- textDescriptor: {
169
- fontSize: componentTheme.descriptorFontSizeLarge
170
- }
171
- }
172
- };
173
- const textStyle = {
174
- minWidth: '0.0625rem',
175
- lineHeight: componentTheme.textLineHeight,
176
- flex: 1
177
- };
178
- const textNameStyle = {
179
- display: 'block',
180
- overflow: 'hidden',
181
- whiteSpace: 'nowrap',
182
- textOverflow: 'ellipsis',
183
- ...sizeMap[size].textName
184
- };
185
- const layoutPadding = {
186
- small: {
187
- folderTree: {
188
- padding: `calc(${componentTheme.baseSpacingSmall} / 3) ${componentTheme.baseSpacingSmall}`
189
- },
190
- indent: {
191
- padding: `calc(${componentTheme.baseSpacingSmall} / 3) calc(${componentTheme.baseSpacingSmall} / 2)`
192
- }
193
- },
194
- medium: {
195
- folderTree: {
196
- padding: `calc(${componentTheme.baseSpacingMedium} / 3) ${componentTheme.baseSpacingMedium}`
197
- },
198
- indent: {
199
- padding: `calc(${componentTheme.baseSpacingMedium} / 3) calc(${componentTheme.baseSpacingMedium} / 2)`
200
- }
201
- },
202
- large: {
203
- folderTree: {
204
- padding: `calc(${componentTheme.baseSpacingLarge} / 3) ${componentTheme.baseSpacingLarge}`
205
- },
206
- indent: {
207
- padding: `calc(${componentTheme.baseSpacingLarge} / 3) calc(${componentTheme.baseSpacingLarge} / 2)`
208
- }
209
- }
210
- };
211
- return {
212
- treeButton: {
213
- label: 'treeButton',
214
- boxSizing: 'border-box',
215
- display: 'block',
216
- width: '100%',
217
- margin: '0',
218
- backgroundColor: 'transparent',
219
- textAlign: 'start',
220
- fontFamily: 'inherit',
221
- userSelect: 'none',
222
- cursor: 'pointer',
223
- border: 'none',
224
- borderRadius: componentTheme.borderRadius,
225
- position: 'relative',
226
- zIndex: 1,
227
- ...(state.animation ? {
228
- transform: 'translate3d(-2%, 0, 0)',
229
- opacity: 0.01,
230
- transformOrigin: 'left center',
231
- animationName: transform,
232
- animationDuration: '0.2s',
233
- animationFillMode: 'forwards',
234
- animationTimingFunction: 'ease-out',
235
- animationDelay: '0.2s'
236
- } : {}),
237
- outline: '0',
238
- padding: '0',
239
- ...(variant === 'folderTree' && !isRootButton && {
240
- '&::before': {
241
- content: '""',
242
- height: componentTheme.borderWidth,
243
- background: componentTheme.borderColor,
244
- position: 'absolute',
245
- insetInlineStart: '0',
246
- insetInlineEnd: 'auto',
247
- top: '50%',
248
- ...(selected && {
249
- visibility: 'hidden'
250
- }),
251
- ...sizeMap[size][variant].before
252
- },
253
- '&:hover::before': {
254
- visibility: 'hidden'
255
- }
256
- }),
257
- '&::after': {
258
- content: '""',
259
- pointerEvents: 'none',
260
- boxSizing: 'border-box',
261
- display: 'block',
262
- position: 'absolute',
263
- top: '-0.25rem',
264
- bottom: '-0.25rem',
265
- left: '-0.25rem',
266
- right: '-0.25rem',
267
- border: `${componentTheme.focusOutlineWidth} ${componentTheme.focusOutlineStyle} ${componentTheme.focusOutlineColor}`,
268
- borderRadius: `calc(${componentTheme.borderRadius} * 1.5)`,
269
- transition: 'all 0.2s',
270
- opacity: 0,
271
- transform: 'scale(0.95)',
272
- ...(focused && {
273
- opacity: 1,
274
- transform: 'scale(1)'
275
- })
276
- },
277
- '&:hover': {
278
- backgroundColor: selected ? componentTheme.selectedBackgroundColor : componentTheme.hoverBackgroundColor,
279
- '[class$=-treeButton__textName], [class$=-treeButton__textDescriptor], [class$=-treeButton__icon], [class$=-treeButton__node]': {
280
- color: componentTheme.hoverTextColor
281
- }
282
- },
283
- ...(selected && {
284
- backgroundColor: componentTheme.selectedBackgroundColor
285
- })
286
- },
287
- layout: {
288
- label: 'treeButton__layout',
289
- display: 'flex',
290
- alignItems: 'center',
291
- lineHeight: 1,
292
- minHeight: '2rem',
293
- ...layoutPadding[size][variant]
294
- },
295
- text: {
296
- label: 'treeButton__text',
297
- ...textStyle
298
- },
299
- textName: {
300
- label: 'treeButton__textName',
301
- ...textNameStyle,
302
- color: selected ? componentTheme.selectedTextColor : componentTheme.nameTextColor
303
- },
304
- textDescriptor: {
305
- label: 'treeButton__textDescriptor',
306
- display: 'block',
307
- overflow: 'hidden',
308
- whiteSpace: 'nowrap',
309
- textOverflow: 'ellipsis',
310
- marginTop: componentTheme.descriptorMarginTop,
311
- color: selected ? componentTheme.selectedTextColor : componentTheme.descriptorTextColor,
312
- ...sizeMap[size].textDescriptor
313
- },
314
- icon: {
315
- label: 'treeButton__icon',
316
- minWidth: '0.0625rem',
317
- position: 'relative',
318
- zIndex: 1,
319
- color: selected ? componentTheme.selectedTextColor : componentTheme.iconColor,
320
- display: 'flex',
321
- alignItems: 'center',
322
- justifyContent: 'center',
323
- ...sizeMap[size][variant].icon
324
- },
325
- thumbnail: {
326
- label: 'treeButton__thumbnail',
327
- ...sizeMap[size][variant].thumbnail
328
- },
329
- node: {
330
- label: 'treeButton__node',
331
- ...textStyle,
332
- ...textNameStyle
333
- }
334
- };
335
- };
336
- var _default = exports.default = generateStyles;