@instructure/ui-tree-browser 11.7.3 → 11.7.4-pr-snapshot-1781695314229

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.
Files changed (86) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/LICENSE.md +1 -0
  3. package/{lib/TreeBrowser/v1/TreeNode/props.js → babel.config.cjs} +12 -7
  4. package/es/TreeBrowser/v1/TreeButton/index.js +8 -5
  5. package/es/TreeBrowser/v1/TreeCollection/index.js +6 -6
  6. package/es/TreeBrowser/v1/TreeNode/index.js +8 -5
  7. package/es/TreeBrowser/v1/index.js +9 -9
  8. package/es/TreeBrowser/v2/TreeButton/index.js +7 -4
  9. package/es/TreeBrowser/v2/TreeCollection/index.js +5 -5
  10. package/es/TreeBrowser/v2/TreeNode/index.js +6 -4
  11. package/es/TreeBrowser/v2/index.js +8 -11
  12. package/es/exports/a.js +5 -4
  13. package/es/exports/b.js +5 -4
  14. package/package.json +13 -18
  15. package/src/TreeBrowser/v1/TreeButton/index.tsx +5 -4
  16. package/src/TreeBrowser/v1/TreeCollection/index.tsx +7 -6
  17. package/src/TreeBrowser/v1/TreeCollection/props.ts +1 -1
  18. package/src/TreeBrowser/v1/TreeNode/index.tsx +5 -4
  19. package/src/TreeBrowser/v1/TreeNode/props.ts +1 -1
  20. package/src/TreeBrowser/v1/index.tsx +8 -7
  21. package/src/TreeBrowser/v2/TreeButton/index.tsx +4 -3
  22. package/src/TreeBrowser/v2/TreeCollection/index.tsx +6 -5
  23. package/src/TreeBrowser/v2/TreeCollection/props.ts +1 -1
  24. package/src/TreeBrowser/v2/TreeNode/index.tsx +4 -3
  25. package/src/TreeBrowser/v2/TreeNode/props.ts +1 -1
  26. package/src/TreeBrowser/v2/index.tsx +7 -13
  27. package/src/exports/a.ts +4 -4
  28. package/src/exports/b.ts +4 -4
  29. package/tsconfig.build.tsbuildinfo +1 -1
  30. package/types/TreeBrowser/v1/TreeButton/index.d.ts +4 -3
  31. package/types/TreeBrowser/v1/TreeButton/index.d.ts.map +1 -1
  32. package/types/TreeBrowser/v1/TreeCollection/index.d.ts +5 -4
  33. package/types/TreeBrowser/v1/TreeCollection/index.d.ts.map +1 -1
  34. package/types/TreeBrowser/v1/TreeCollection/props.d.ts +1 -1
  35. package/types/TreeBrowser/v1/TreeCollection/props.d.ts.map +1 -1
  36. package/types/TreeBrowser/v1/TreeNode/index.d.ts +3 -2
  37. package/types/TreeBrowser/v1/TreeNode/index.d.ts.map +1 -1
  38. package/types/TreeBrowser/v1/TreeNode/props.d.ts +1 -1
  39. package/types/TreeBrowser/v1/TreeNode/props.d.ts.map +1 -1
  40. package/types/TreeBrowser/v1/index.d.ts +4 -3
  41. package/types/TreeBrowser/v1/index.d.ts.map +1 -1
  42. package/types/TreeBrowser/v2/TreeButton/index.d.ts +4 -3
  43. package/types/TreeBrowser/v2/TreeButton/index.d.ts.map +1 -1
  44. package/types/TreeBrowser/v2/TreeCollection/index.d.ts +5 -4
  45. package/types/TreeBrowser/v2/TreeCollection/index.d.ts.map +1 -1
  46. package/types/TreeBrowser/v2/TreeCollection/props.d.ts +1 -1
  47. package/types/TreeBrowser/v2/TreeCollection/props.d.ts.map +1 -1
  48. package/types/TreeBrowser/v2/TreeNode/index.d.ts +3 -2
  49. package/types/TreeBrowser/v2/TreeNode/index.d.ts.map +1 -1
  50. package/types/TreeBrowser/v2/TreeNode/props.d.ts +1 -1
  51. package/types/TreeBrowser/v2/TreeNode/props.d.ts.map +1 -1
  52. package/types/TreeBrowser/v2/index.d.ts +4 -4
  53. package/types/TreeBrowser/v2/index.d.ts.map +1 -1
  54. package/types/exports/a.d.ts +4 -4
  55. package/types/exports/a.d.ts.map +1 -1
  56. package/types/exports/b.d.ts +4 -4
  57. package/types/exports/b.d.ts.map +1 -1
  58. package/lib/TreeBrowser/v1/TreeBrowserContext.js +0 -44
  59. package/lib/TreeBrowser/v1/TreeButton/index.js +0 -169
  60. package/lib/TreeBrowser/v1/TreeButton/props.js +0 -31
  61. package/lib/TreeBrowser/v1/TreeButton/styles.js +0 -338
  62. package/lib/TreeBrowser/v1/TreeButton/theme.js +0 -86
  63. package/lib/TreeBrowser/v1/TreeCollection/index.js +0 -382
  64. package/lib/TreeBrowser/v1/TreeCollection/props.js +0 -31
  65. package/lib/TreeBrowser/v1/TreeCollection/styles.js +0 -140
  66. package/lib/TreeBrowser/v1/TreeCollection/theme.js +0 -55
  67. package/lib/TreeBrowser/v1/TreeNode/index.js +0 -122
  68. package/lib/TreeBrowser/v1/index.js +0 -329
  69. package/lib/TreeBrowser/v1/props.js +0 -40
  70. package/lib/TreeBrowser/v1/styles.js +0 -75
  71. package/lib/TreeBrowser/v1/theme.js +0 -51
  72. package/lib/TreeBrowser/v2/TreeBrowserContext.js +0 -44
  73. package/lib/TreeBrowser/v2/TreeButton/index.js +0 -219
  74. package/lib/TreeBrowser/v2/TreeButton/props.js +0 -31
  75. package/lib/TreeBrowser/v2/TreeButton/styles.js +0 -314
  76. package/lib/TreeBrowser/v2/TreeCollection/index.js +0 -383
  77. package/lib/TreeBrowser/v2/TreeCollection/props.js +0 -31
  78. package/lib/TreeBrowser/v2/TreeCollection/styles.js +0 -151
  79. package/lib/TreeBrowser/v2/TreeNode/index.js +0 -168
  80. package/lib/TreeBrowser/v2/TreeNode/props.js +0 -31
  81. package/lib/TreeBrowser/v2/index.js +0 -366
  82. package/lib/TreeBrowser/v2/props.js +0 -40
  83. package/lib/TreeBrowser/v2/styles.js +0 -77
  84. package/lib/exports/a.js +0 -33
  85. package/lib/exports/b.js +0 -33
  86. package/lib/package.json +0 -1
@@ -1,219 +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 _latest = require("@instructure/ui-img/latest");
10
- var _emotion = require("@instructure/emotion");
11
- var _renderIconWithProps = require("@instructure/ui-icons/lib/IconPropsProvider/renderIconWithProps.js");
12
- var _styles = _interopRequireDefault(require("./styles"));
13
- var _props = require("./props");
14
- var _TreeBrowserContext = _interopRequireDefault(require("../TreeBrowserContext"));
15
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
- var _dec, _class;
17
- /*
18
- * The MIT License (MIT)
19
- *
20
- * Copyright (c) 2015 - present Instructure, Inc.
21
- *
22
- * Permission is hereby granted, free of charge, to any person obtaining a copy
23
- * of this software and associated documentation files (the "Software"), to deal
24
- * in the Software without restriction, including without limitation the rights
25
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
- * copies of the Software, and to permit persons to whom the Software is
27
- * furnished to do so, subject to the following conditions:
28
- *
29
- * The above copyright notice and this permission notice shall be included in all
30
- * copies or substantial portions of the Software.
31
- *
32
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
- * SOFTWARE.
39
- */
40
- // Todo: merge TreeButton and TreeNode: TreeButton should be a special type of TreeNode
41
- // Map TreeBrowser size tokens to icon size tokens
42
- const treeBrowserSizeToIconSize = {
43
- small: 'md',
44
- medium: 'lg',
45
- large: 'xl'
46
- };
47
-
48
- /**
49
- ---
50
- parent: TreeBrowser
51
- id: TreeBrowser.Button
52
- ---
53
- **/
54
- let TreeButton = exports.TreeButton = (_dec = (0, _emotion.withStyleNew)(_styles.default, 'TreeBrowserTreeButton'), _dec(_class = class TreeButton extends _react.Component {
55
- static displayName = "TreeButton";
56
- static componentId = 'TreeBrowser.Button';
57
- static allowedProps = _props.allowedProps;
58
- static contextType = _TreeBrowserContext.default;
59
- static defaultProps = {
60
- type: 'treeButton',
61
- size: 'medium',
62
- variant: 'folderTree',
63
- selected: false,
64
- focused: false,
65
- expanded: false,
66
- hoverable: true
67
- };
68
- ref = null;
69
- state = {
70
- isHovered: false
71
- };
72
- componentDidMount() {
73
- this.props.makeStyles?.({
74
- animation: this.context?.animation,
75
- hoverable: this.props.hoverable
76
- });
77
- }
78
- componentDidUpdate() {
79
- this.props.makeStyles?.({
80
- animation: this.context?.animation,
81
- hoverable: this.props.hoverable
82
- });
83
- }
84
- defaultContentRenderer(props) {
85
- const {
86
- name,
87
- descriptor,
88
- styles
89
- } = props;
90
- return (0, _jsxRuntime.jsxs)("span", {
91
- css: styles.layout,
92
- children: [this.renderImage(), (0, _jsxRuntime.jsxs)("span", {
93
- css: styles.text,
94
- children: [(0, _jsxRuntime.jsx)("span", {
95
- css: styles.textName,
96
- children: name
97
- }), descriptor ? (0, _jsxRuntime.jsx)("span", {
98
- css: styles.textDescriptor,
99
- title: descriptor,
100
- children: descriptor
101
- }) : null]
102
- })]
103
- });
104
- }
105
- getIconColor() {
106
- const {
107
- selected
108
- } = this.props;
109
- const {
110
- isHovered
111
- } = this.state;
112
-
113
- // Priority: selected > hover > default
114
- if (selected) return 'onColor';
115
- if (isHovered) return 'inverseColor';
116
- return 'baseColor';
117
- }
118
- renderImage() {
119
- const {
120
- type
121
- } = this.props;
122
- switch (type) {
123
- case 'collection':
124
- return this.renderCollectionIcon();
125
- case 'item':
126
- return this.renderItemImage();
127
- default:
128
- break;
129
- }
130
- return undefined;
131
- }
132
- renderCollectionIcon() {
133
- const {
134
- expanded,
135
- collectionIcon,
136
- collectionIconExpanded,
137
- styles,
138
- size
139
- } = this.props;
140
- if (collectionIcon || collectionIconExpanded) {
141
- const icon = expanded ? collectionIconExpanded : collectionIcon;
142
- const iconSize = treeBrowserSizeToIconSize[size];
143
- const iconColor = this.getIconColor();
144
- const iconElement = (0, _renderIconWithProps.renderIconWithProps)(icon, iconSize, iconColor);
145
- return (0, _jsxRuntime.jsx)("div", {
146
- css: styles?.icon,
147
- children: iconElement
148
- });
149
- }
150
- return undefined;
151
- }
152
- renderItemImage() {
153
- const {
154
- thumbnail,
155
- itemIcon,
156
- styles,
157
- size
158
- } = this.props;
159
- if (thumbnail) {
160
- return (0, _jsxRuntime.jsx)("div", {
161
- css: styles?.thumbnail,
162
- children: (0, _jsxRuntime.jsx)(_latest.Img, {
163
- src: thumbnail,
164
- constrain: "cover",
165
- alt: ""
166
- })
167
- });
168
- }
169
- if (itemIcon) {
170
- const iconSize = treeBrowserSizeToIconSize[size];
171
- const iconColor = this.getIconColor();
172
- const iconElement = (0, _renderIconWithProps.renderIconWithProps)(itemIcon, iconSize, iconColor);
173
- return (0, _jsxRuntime.jsx)("div", {
174
- css: styles?.icon,
175
- children: iconElement
176
- });
177
- }
178
- return undefined;
179
- }
180
- handleRef = el => {
181
- if (el && typeof this.props.containerRef === 'function') {
182
- this.props.containerRef(el.parentElement);
183
- }
184
- this.ref = el;
185
- };
186
- handleMouseEnter = () => {
187
- if (this.props.hoverable) {
188
- this.setState({
189
- isHovered: true
190
- });
191
- }
192
- };
193
- handleMouseLeave = () => {
194
- if (this.props.hoverable) {
195
- this.setState({
196
- isHovered: false
197
- });
198
- }
199
- };
200
- render() {
201
- const {
202
- styles,
203
- renderContent
204
- } = this.props;
205
- const buttonContent = renderContent ? renderContent(this.props) : this.defaultContentRenderer(this.props);
206
- // VoiceOver can't navigate without the buttons, even though they don't do anything
207
- return (0, _jsxRuntime.jsx)("button", {
208
- ref: this.handleRef,
209
- tabIndex: -1,
210
- type: "button",
211
- css: styles?.treeButton,
212
- "data-cid": "TreeButton",
213
- onMouseEnter: this.handleMouseEnter,
214
- onMouseLeave: this.handleMouseLeave,
215
- children: buttonContent
216
- });
217
- }
218
- }) || _class);
219
- 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', 'hoverable'];
@@ -1,314 +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, sharedTokens, state) => {
54
- const {
55
- size,
56
- variant,
57
- selected,
58
- level
59
- } = props;
60
- const isRootButton = level && level === 1;
61
- const sizeMap = {
62
- small: {
63
- folderTree: {
64
- before: {
65
- width: componentTheme.baseSpacingSmall
66
- },
67
- icon: {
68
- marginInlineEnd: componentTheme.iconsMarginRightSmall,
69
- marginInlineStart: '0'
70
- },
71
- thumbnail: {
72
- height: `calc(${componentTheme.baseSpacingSmall} * 2)`,
73
- width: `calc(${componentTheme.baseSpacingSmall}* 2)`,
74
- marginInlineEnd: componentTheme.iconsMarginRightSmall,
75
- marginInlineStart: '0'
76
- }
77
- },
78
- indent: {
79
- icon: {
80
- marginInlineEnd: componentTheme.iconsMarginRightSmall,
81
- marginInlineStart: '0'
82
- },
83
- thumbnail: {
84
- height: `calc(${componentTheme.baseSpacingSmall} * 2)`,
85
- width: `calc(${componentTheme.baseSpacingSmall} * 2)`,
86
- marginInlineEnd: componentTheme.iconsMarginRightSmall,
87
- marginInlineStart: '0'
88
- }
89
- },
90
- textName: {
91
- fontSize: componentTheme.nameFontSizeSmall
92
- },
93
- textDescriptor: {
94
- fontSize: componentTheme.descriptorFontSizeSmall
95
- }
96
- },
97
- medium: {
98
- folderTree: {
99
- before: {
100
- width: componentTheme.baseSpacingMedium
101
- },
102
- icon: {
103
- marginInlineEnd: componentTheme.iconsMarginRightMedium,
104
- marginInlineStart: '0'
105
- },
106
- thumbnail: {
107
- height: `calc(${componentTheme.baseSpacingMedium} * 2)`,
108
- width: `calc(${componentTheme.baseSpacingMedium} * 2)`,
109
- marginInlineEnd: componentTheme.iconsMarginRightMedium,
110
- marginInlineStart: '0'
111
- }
112
- },
113
- indent: {
114
- icon: {
115
- marginInlineEnd: componentTheme.iconsMarginRightMedium,
116
- marginInlineStart: '0'
117
- },
118
- thumbnail: {
119
- height: `calc(${componentTheme.baseSpacingMedium} * 2)`,
120
- width: `calc(${componentTheme.baseSpacingMedium} * 2)`,
121
- marginInlineEnd: componentTheme.iconsMarginRightMedium,
122
- marginInlineStart: '0'
123
- }
124
- },
125
- textName: {
126
- fontSize: componentTheme.nameFontSizeMedium
127
- },
128
- textDescriptor: {
129
- fontSize: componentTheme.descriptorFontSizeMedium
130
- }
131
- },
132
- large: {
133
- folderTree: {
134
- before: {
135
- width: componentTheme.baseSpacingLarge
136
- },
137
- icon: {
138
- marginInlineEnd: componentTheme.iconsMarginRightLarge,
139
- marginInlineStart: '0'
140
- },
141
- thumbnail: {
142
- height: `calc(${componentTheme.baseSpacingLarge} * 2)`,
143
- width: `calc(${componentTheme.baseSpacingLarge} * 2)`,
144
- marginInlineEnd: componentTheme.iconsMarginRightLarge,
145
- marginInlineStart: '0'
146
- }
147
- },
148
- indent: {
149
- icon: {
150
- marginInlineEnd: componentTheme.iconsMarginRightLarge,
151
- marginInlineStart: '0'
152
- },
153
- thumbnail: {
154
- height: `calc(${componentTheme.baseSpacingLarge} * 2)`,
155
- width: `calc(${componentTheme.baseSpacingLarge}* 2)`,
156
- marginInlineEnd: componentTheme.iconsMarginRightLarge,
157
- marginInlineStart: '0'
158
- }
159
- },
160
- textName: {
161
- fontSize: componentTheme.nameFontSizeLarge
162
- },
163
- textDescriptor: {
164
- fontSize: componentTheme.descriptorFontSizeLarge
165
- }
166
- }
167
- };
168
- const textStyle = {
169
- minWidth: '0.0625rem',
170
- lineHeight: componentTheme.textLineHeight,
171
- flex: 1
172
- };
173
- const textNameStyle = {
174
- display: 'block',
175
- overflow: 'hidden',
176
- whiteSpace: 'nowrap',
177
- textOverflow: 'ellipsis',
178
- ...sizeMap[size].textName
179
- };
180
- const layoutPadding = {
181
- small: {
182
- folderTree: {
183
- padding: `calc(${componentTheme.baseSpacingSmall} / 3) ${componentTheme.baseSpacingSmall}`
184
- },
185
- indent: {
186
- padding: `calc(${componentTheme.baseSpacingSmall} / 3) calc(${componentTheme.baseSpacingSmall} / 2)`
187
- }
188
- },
189
- medium: {
190
- folderTree: {
191
- padding: `calc(${componentTheme.baseSpacingMedium} / 3) ${componentTheme.baseSpacingMedium}`
192
- },
193
- indent: {
194
- padding: `calc(${componentTheme.baseSpacingMedium} / 3) calc(${componentTheme.baseSpacingMedium} / 2)`
195
- }
196
- },
197
- large: {
198
- folderTree: {
199
- padding: `calc(${componentTheme.baseSpacingLarge} / 3) ${componentTheme.baseSpacingLarge}`
200
- },
201
- indent: {
202
- padding: `calc(${componentTheme.baseSpacingLarge} / 3) calc(${componentTheme.baseSpacingLarge} / 2)`
203
- }
204
- }
205
- };
206
- return {
207
- treeButton: {
208
- label: 'treeButton',
209
- boxSizing: 'border-box',
210
- display: 'block',
211
- width: '100%',
212
- margin: '0',
213
- backgroundColor: 'transparent',
214
- textAlign: 'start',
215
- fontFamily: 'inherit',
216
- userSelect: 'none',
217
- cursor: 'pointer',
218
- border: 'none',
219
- borderRadius: componentTheme.borderRadius,
220
- position: 'relative',
221
- zIndex: 1,
222
- ...(state?.animation ? {
223
- transform: 'translate3d(-2%, 0, 0)',
224
- opacity: 0.01,
225
- transformOrigin: 'left center',
226
- animationName: transform,
227
- animationDuration: '0.2s',
228
- animationFillMode: 'forwards',
229
- animationTimingFunction: 'ease-out',
230
- animationDelay: '0.2s'
231
- } : {}),
232
- outline: '0',
233
- padding: '0',
234
- ...(sharedTokens?.focusOutline ? (0, _emotion.calcFocusOutlineStyles)(sharedTokens.focusOutline) : {}),
235
- ...(variant === 'folderTree' && !isRootButton && {
236
- '&::before': {
237
- content: '""',
238
- height: componentTheme.borderWidth,
239
- background: componentTheme.borderColor,
240
- // Tree horizontal lines
241
- position: 'absolute',
242
- insetInlineStart: '0',
243
- insetInlineEnd: 'auto',
244
- top: '50%',
245
- ...(selected && {
246
- visibility: 'hidden'
247
- }),
248
- ...sizeMap[size][variant].before
249
- },
250
- '&:hover::before': {
251
- visibility: state?.hoverable ? 'hidden' : 'visible'
252
- }
253
- }),
254
- ...(state?.hoverable !== false && {
255
- '&:hover': {
256
- backgroundColor: selected ? componentTheme.selectedBackgroundColor : componentTheme.hoverBackgroundColor,
257
- '[class$=-treeButton__textName], [class$=-treeButton__textDescriptor], [class$=-treeButton__node]': {
258
- color: selected ? componentTheme.selectedTextColor : componentTheme.hoverTextColor
259
- }
260
- }
261
- }),
262
- ...(selected && {
263
- backgroundColor: componentTheme.selectedBackgroundColor
264
- })
265
- },
266
- layout: {
267
- label: 'treeButton__layout',
268
- display: 'flex',
269
- alignItems: 'center',
270
- lineHeight: 1,
271
- minHeight: '2rem',
272
- ...layoutPadding[size][variant]
273
- },
274
- text: {
275
- label: 'treeButton__text',
276
- ...textStyle
277
- },
278
- textName: {
279
- label: 'treeButton__textName',
280
- ...textNameStyle,
281
- color: selected ? componentTheme.selectedTextColor : componentTheme.nameTextColor
282
- },
283
- textDescriptor: {
284
- label: 'treeButton__textDescriptor',
285
- display: 'block',
286
- overflow: 'hidden',
287
- whiteSpace: 'nowrap',
288
- textOverflow: 'ellipsis',
289
- marginTop: componentTheme.descriptorMarginTop,
290
- color: selected ? componentTheme.selectedTextColor : componentTheme.descriptorTextColor,
291
- ...sizeMap[size].textDescriptor
292
- },
293
- icon: {
294
- label: 'treeButton__icon',
295
- minWidth: '0.0625rem',
296
- position: 'relative',
297
- zIndex: 1,
298
- alignItems: 'center',
299
- justifyContent: 'center',
300
- ...sizeMap[size][variant].icon
301
- },
302
- thumbnail: {
303
- label: 'treeButton__thumbnail',
304
- ...sizeMap[size][variant].thumbnail
305
- },
306
- node: {
307
- label: 'treeButton__node',
308
- ...textStyle,
309
- ...textNameStyle,
310
- color: componentTheme.descriptorTextColor
311
- }
312
- };
313
- };
314
- var _default = exports.default = generateStyles;