@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
|
@@ -1,27 +1,3 @@
|
|
|
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 { keyframes } from '@instructure/emotion';
|
|
26
2
|
const transform = keyframes`
|
|
27
3
|
50% {
|
|
@@ -33,300 +9,283 @@ const transform = keyframes`
|
|
|
33
9
|
opacity: 1;
|
|
34
10
|
transform: translate3d(0, 0, 0);
|
|
35
11
|
}`;
|
|
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
|
-
|
|
12
|
+
const generateStyles = (componentTheme, props, state)=>{
|
|
13
|
+
const { size, variant, selected, focused, level } = props;
|
|
14
|
+
const isRootButton = level && level === 1;
|
|
15
|
+
const sizeMap = {
|
|
16
|
+
small: {
|
|
17
|
+
folderTree: {
|
|
18
|
+
before: {
|
|
19
|
+
width: `calc(${componentTheme.baseSpacingSmall} - 0.0625rem)`
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
fontSize: `calc(${componentTheme.baseSpacingSmall} * 2)`,
|
|
23
|
+
marginInlineEnd: componentTheme.baseSpacingSmall,
|
|
24
|
+
marginInlineStart: '0'
|
|
25
|
+
},
|
|
26
|
+
thumbnail: {
|
|
27
|
+
height: `calc(${componentTheme.baseSpacingSmall} * 2)`,
|
|
28
|
+
width: `calc(${componentTheme.baseSpacingSmall}* 2)`,
|
|
29
|
+
marginInlineEnd: componentTheme.baseSpacingSmall,
|
|
30
|
+
marginInlineStart: '0'
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
indent: {
|
|
34
|
+
icon: {
|
|
35
|
+
fontSize: `calc(${componentTheme.baseSpacingSmall} * 2)`,
|
|
36
|
+
marginInlineEnd: `calc(${componentTheme.baseSpacingSmall} / 2)`,
|
|
37
|
+
marginInlineStart: '0'
|
|
38
|
+
},
|
|
39
|
+
thumbnail: {
|
|
40
|
+
height: `calc(${componentTheme.baseSpacingSmall} * 2)`,
|
|
41
|
+
width: `calc(${componentTheme.baseSpacingSmall} * 2)`,
|
|
42
|
+
marginInlineEnd: `calc(${componentTheme.baseSpacingSmall} / 2)`,
|
|
43
|
+
marginInlineStart: '0'
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
textName: {
|
|
47
|
+
fontSize: componentTheme.nameFontSizeSmall
|
|
48
|
+
},
|
|
49
|
+
textDescriptor: {
|
|
50
|
+
fontSize: componentTheme.descriptorFontSizeSmall
|
|
51
|
+
}
|
|
61
52
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
medium: {
|
|
54
|
+
folderTree: {
|
|
55
|
+
before: {
|
|
56
|
+
width: `calc(${componentTheme.baseSpacingMedium} - 0.0625rem)`
|
|
57
|
+
},
|
|
58
|
+
icon: {
|
|
59
|
+
fontSize: `calc(${componentTheme.baseSpacingMedium} * 2)`,
|
|
60
|
+
marginInlineEnd: componentTheme.baseSpacingMedium,
|
|
61
|
+
marginInlineStart: '0'
|
|
62
|
+
},
|
|
63
|
+
thumbnail: {
|
|
64
|
+
height: `calc(${componentTheme.baseSpacingMedium} * 2)`,
|
|
65
|
+
width: `calc(${componentTheme.baseSpacingMedium} * 2)`,
|
|
66
|
+
marginInlineEnd: componentTheme.baseSpacingMedium,
|
|
67
|
+
marginInlineStart: '0'
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
indent: {
|
|
71
|
+
icon: {
|
|
72
|
+
fontSize: `calc(${componentTheme.baseSpacingMedium} * 2)`,
|
|
73
|
+
marginInlineEnd: `calc(${componentTheme.baseSpacingMedium} / 2)`,
|
|
74
|
+
marginInlineStart: '0'
|
|
75
|
+
},
|
|
76
|
+
thumbnail: {
|
|
77
|
+
height: `calc(${componentTheme.baseSpacingMedium} * 2)`,
|
|
78
|
+
width: `calc(${componentTheme.baseSpacingMedium} * 2)`,
|
|
79
|
+
marginInlineEnd: `calc(${componentTheme.baseSpacingMedium} / 2)`,
|
|
80
|
+
marginInlineStart: '0'
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
textName: {
|
|
84
|
+
fontSize: componentTheme.nameFontSizeMedium
|
|
85
|
+
},
|
|
86
|
+
textDescriptor: {
|
|
87
|
+
fontSize: componentTheme.descriptorFontSizeMedium
|
|
88
|
+
}
|
|
66
89
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
90
|
+
large: {
|
|
91
|
+
folderTree: {
|
|
92
|
+
before: {
|
|
93
|
+
width: `calc(${componentTheme.baseSpacingLarge} - 0.0625rem)`
|
|
94
|
+
},
|
|
95
|
+
icon: {
|
|
96
|
+
fontSize: `calc(${componentTheme.baseSpacingLarge} * 2)`,
|
|
97
|
+
marginInlineEnd: componentTheme.baseSpacingLarge,
|
|
98
|
+
marginInlineStart: '0'
|
|
99
|
+
},
|
|
100
|
+
thumbnail: {
|
|
101
|
+
height: `calc(${componentTheme.baseSpacingLarge} * 2)`,
|
|
102
|
+
width: `calc(${componentTheme.baseSpacingLarge} * 2)`,
|
|
103
|
+
marginInlineEnd: componentTheme.baseSpacingLarge,
|
|
104
|
+
marginInlineStart: '0'
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
indent: {
|
|
108
|
+
icon: {
|
|
109
|
+
fontSize: `calc(${componentTheme.baseSpacingLarge} * 2)`,
|
|
110
|
+
marginInlineEnd: `calc(${componentTheme.baseSpacingLarge} / 2)`,
|
|
111
|
+
marginInlineStart: '0'
|
|
112
|
+
},
|
|
113
|
+
thumbnail: {
|
|
114
|
+
height: `calc(${componentTheme.baseSpacingLarge} * 2)`,
|
|
115
|
+
width: `calc(${componentTheme.baseSpacingLarge}* 2)`,
|
|
116
|
+
marginInlineEnd: `calc(${componentTheme.baseSpacingLarge} / 2)`,
|
|
117
|
+
marginInlineStart: '0'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
textName: {
|
|
121
|
+
fontSize: componentTheme.nameFontSizeLarge
|
|
122
|
+
},
|
|
123
|
+
textDescriptor: {
|
|
124
|
+
fontSize: componentTheme.descriptorFontSizeLarge
|
|
125
|
+
}
|
|
72
126
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
127
|
+
};
|
|
128
|
+
const textStyle = {
|
|
129
|
+
minWidth: '0.0625rem',
|
|
130
|
+
lineHeight: componentTheme.textLineHeight,
|
|
131
|
+
flex: 1
|
|
132
|
+
};
|
|
133
|
+
const textNameStyle = {
|
|
134
|
+
display: 'block',
|
|
135
|
+
overflow: 'hidden',
|
|
136
|
+
whiteSpace: 'nowrap',
|
|
137
|
+
textOverflow: 'ellipsis',
|
|
138
|
+
...sizeMap[size].textName
|
|
139
|
+
};
|
|
140
|
+
const layoutPadding = {
|
|
141
|
+
small: {
|
|
142
|
+
folderTree: {
|
|
143
|
+
padding: `calc(${componentTheme.baseSpacingSmall} / 3) ${componentTheme.baseSpacingSmall}`
|
|
144
|
+
},
|
|
145
|
+
indent: {
|
|
146
|
+
padding: `calc(${componentTheme.baseSpacingSmall} / 3) calc(${componentTheme.baseSpacingSmall} / 2)`
|
|
147
|
+
}
|
|
79
148
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
149
|
+
medium: {
|
|
150
|
+
folderTree: {
|
|
151
|
+
padding: `calc(${componentTheme.baseSpacingMedium} / 3) ${componentTheme.baseSpacingMedium}`
|
|
152
|
+
},
|
|
153
|
+
indent: {
|
|
154
|
+
padding: `calc(${componentTheme.baseSpacingMedium} / 3) calc(${componentTheme.baseSpacingMedium} / 2)`
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
large: {
|
|
158
|
+
folderTree: {
|
|
159
|
+
padding: `calc(${componentTheme.baseSpacingLarge} / 3) ${componentTheme.baseSpacingLarge}`
|
|
160
|
+
},
|
|
161
|
+
indent: {
|
|
162
|
+
padding: `calc(${componentTheme.baseSpacingLarge} / 3) calc(${componentTheme.baseSpacingLarge} / 2)`
|
|
163
|
+
}
|
|
85
164
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
treeButton: {
|
|
168
|
+
label: 'treeButton',
|
|
169
|
+
boxSizing: 'border-box',
|
|
170
|
+
display: 'block',
|
|
171
|
+
width: '100%',
|
|
172
|
+
margin: '0',
|
|
173
|
+
backgroundColor: 'transparent',
|
|
174
|
+
textAlign: 'start',
|
|
175
|
+
fontFamily: 'inherit',
|
|
176
|
+
userSelect: 'none',
|
|
177
|
+
cursor: 'pointer',
|
|
178
|
+
border: 'none',
|
|
179
|
+
borderRadius: componentTheme.borderRadius,
|
|
180
|
+
position: 'relative',
|
|
181
|
+
zIndex: 1,
|
|
182
|
+
...state.animation ? {
|
|
183
|
+
transform: 'translate3d(-2%, 0, 0)',
|
|
184
|
+
opacity: 0.01,
|
|
185
|
+
transformOrigin: 'left center',
|
|
186
|
+
animationName: transform,
|
|
187
|
+
animationDuration: '0.2s',
|
|
188
|
+
animationFillMode: 'forwards',
|
|
189
|
+
animationTimingFunction: 'ease-out',
|
|
190
|
+
animationDelay: '0.2s'
|
|
191
|
+
} : {},
|
|
192
|
+
outline: '0',
|
|
193
|
+
padding: '0',
|
|
194
|
+
...variant === 'folderTree' && !isRootButton && {
|
|
195
|
+
'&::before': {
|
|
196
|
+
content: '""',
|
|
197
|
+
height: componentTheme.borderWidth,
|
|
198
|
+
background: componentTheme.borderColor,
|
|
199
|
+
position: 'absolute',
|
|
200
|
+
insetInlineStart: '0',
|
|
201
|
+
insetInlineEnd: 'auto',
|
|
202
|
+
top: '50%',
|
|
203
|
+
...selected && {
|
|
204
|
+
visibility: 'hidden'
|
|
205
|
+
},
|
|
206
|
+
...sizeMap[size][variant].before
|
|
207
|
+
},
|
|
208
|
+
'&:hover::before': {
|
|
209
|
+
visibility: 'hidden'
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
'&::after': {
|
|
213
|
+
content: '""',
|
|
214
|
+
pointerEvents: 'none',
|
|
215
|
+
boxSizing: 'border-box',
|
|
216
|
+
display: 'block',
|
|
217
|
+
position: 'absolute',
|
|
218
|
+
top: '-0.25rem',
|
|
219
|
+
bottom: '-0.25rem',
|
|
220
|
+
left: '-0.25rem',
|
|
221
|
+
right: '-0.25rem',
|
|
222
|
+
border: `${componentTheme.focusOutlineWidth} ${componentTheme.focusOutlineStyle} ${componentTheme.focusOutlineColor}`,
|
|
223
|
+
borderRadius: `calc(${componentTheme.borderRadius} * 1.5)`,
|
|
224
|
+
transition: 'all 0.2s',
|
|
225
|
+
opacity: 0,
|
|
226
|
+
transform: 'scale(0.95)',
|
|
227
|
+
...focused && {
|
|
228
|
+
opacity: 1,
|
|
229
|
+
transform: 'scale(1)'
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
'&:hover': {
|
|
233
|
+
backgroundColor: selected ? componentTheme.selectedBackgroundColor : componentTheme.hoverBackgroundColor,
|
|
234
|
+
'[class$=-treeButton__textName], [class$=-treeButton__textDescriptor], [class$=-treeButton__icon], [class$=-treeButton__node]': {
|
|
235
|
+
color: componentTheme.hoverTextColor
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
...selected && {
|
|
239
|
+
backgroundColor: componentTheme.selectedBackgroundColor
|
|
240
|
+
}
|
|
98
241
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
242
|
+
layout: {
|
|
243
|
+
label: 'treeButton__layout',
|
|
244
|
+
display: 'flex',
|
|
245
|
+
alignItems: 'center',
|
|
246
|
+
lineHeight: 1,
|
|
247
|
+
minHeight: '2rem',
|
|
248
|
+
...layoutPadding[size][variant]
|
|
103
249
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
marginInlineEnd: componentTheme.baseSpacingMedium,
|
|
108
|
-
marginInlineStart: '0'
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
indent: {
|
|
112
|
-
icon: {
|
|
113
|
-
fontSize: `calc(${componentTheme.baseSpacingMedium} * 2)`,
|
|
114
|
-
marginInlineEnd: `calc(${componentTheme.baseSpacingMedium} / 2)`,
|
|
115
|
-
marginInlineStart: '0'
|
|
250
|
+
text: {
|
|
251
|
+
label: 'treeButton__text',
|
|
252
|
+
...textStyle
|
|
116
253
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
marginInlineStart: '0'
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
textName: {
|
|
125
|
-
fontSize: componentTheme.nameFontSizeMedium
|
|
126
|
-
},
|
|
127
|
-
textDescriptor: {
|
|
128
|
-
fontSize: componentTheme.descriptorFontSizeMedium
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
large: {
|
|
132
|
-
folderTree: {
|
|
133
|
-
before: {
|
|
134
|
-
width: `calc(${componentTheme.baseSpacingLarge} - 0.0625rem)`
|
|
254
|
+
textName: {
|
|
255
|
+
label: 'treeButton__textName',
|
|
256
|
+
...textNameStyle,
|
|
257
|
+
color: selected ? componentTheme.selectedTextColor : componentTheme.nameTextColor
|
|
135
258
|
},
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
259
|
+
textDescriptor: {
|
|
260
|
+
label: 'treeButton__textDescriptor',
|
|
261
|
+
display: 'block',
|
|
262
|
+
overflow: 'hidden',
|
|
263
|
+
whiteSpace: 'nowrap',
|
|
264
|
+
textOverflow: 'ellipsis',
|
|
265
|
+
marginTop: componentTheme.descriptorMarginTop,
|
|
266
|
+
color: selected ? componentTheme.selectedTextColor : componentTheme.descriptorTextColor,
|
|
267
|
+
...sizeMap[size].textDescriptor
|
|
140
268
|
},
|
|
141
|
-
thumbnail: {
|
|
142
|
-
height: `calc(${componentTheme.baseSpacingLarge} * 2)`,
|
|
143
|
-
width: `calc(${componentTheme.baseSpacingLarge} * 2)`,
|
|
144
|
-
marginInlineEnd: componentTheme.baseSpacingLarge,
|
|
145
|
-
marginInlineStart: '0'
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
indent: {
|
|
149
269
|
icon: {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
270
|
+
label: 'treeButton__icon',
|
|
271
|
+
minWidth: '0.0625rem',
|
|
272
|
+
position: 'relative',
|
|
273
|
+
zIndex: 1,
|
|
274
|
+
color: selected ? componentTheme.selectedTextColor : componentTheme.iconColor,
|
|
275
|
+
display: 'flex',
|
|
276
|
+
alignItems: 'center',
|
|
277
|
+
justifyContent: 'center',
|
|
278
|
+
...sizeMap[size][variant].icon
|
|
153
279
|
},
|
|
154
280
|
thumbnail: {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
marginInlineEnd: `calc(${componentTheme.baseSpacingLarge} / 2)`,
|
|
158
|
-
marginInlineStart: '0'
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
textName: {
|
|
162
|
-
fontSize: componentTheme.nameFontSizeLarge
|
|
163
|
-
},
|
|
164
|
-
textDescriptor: {
|
|
165
|
-
fontSize: componentTheme.descriptorFontSizeLarge
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const textStyle = {
|
|
170
|
-
minWidth: '0.0625rem',
|
|
171
|
-
lineHeight: componentTheme.textLineHeight,
|
|
172
|
-
flex: 1
|
|
173
|
-
};
|
|
174
|
-
const textNameStyle = {
|
|
175
|
-
display: 'block',
|
|
176
|
-
overflow: 'hidden',
|
|
177
|
-
whiteSpace: 'nowrap',
|
|
178
|
-
textOverflow: 'ellipsis',
|
|
179
|
-
...sizeMap[size].textName
|
|
180
|
-
};
|
|
181
|
-
const layoutPadding = {
|
|
182
|
-
small: {
|
|
183
|
-
folderTree: {
|
|
184
|
-
padding: `calc(${componentTheme.baseSpacingSmall} / 3) ${componentTheme.baseSpacingSmall}`
|
|
185
|
-
},
|
|
186
|
-
indent: {
|
|
187
|
-
padding: `calc(${componentTheme.baseSpacingSmall} / 3) calc(${componentTheme.baseSpacingSmall} / 2)`
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
medium: {
|
|
191
|
-
folderTree: {
|
|
192
|
-
padding: `calc(${componentTheme.baseSpacingMedium} / 3) ${componentTheme.baseSpacingMedium}`
|
|
193
|
-
},
|
|
194
|
-
indent: {
|
|
195
|
-
padding: `calc(${componentTheme.baseSpacingMedium} / 3) calc(${componentTheme.baseSpacingMedium} / 2)`
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
large: {
|
|
199
|
-
folderTree: {
|
|
200
|
-
padding: `calc(${componentTheme.baseSpacingLarge} / 3) ${componentTheme.baseSpacingLarge}`
|
|
201
|
-
},
|
|
202
|
-
indent: {
|
|
203
|
-
padding: `calc(${componentTheme.baseSpacingLarge} / 3) calc(${componentTheme.baseSpacingLarge} / 2)`
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
return {
|
|
208
|
-
treeButton: {
|
|
209
|
-
label: 'treeButton',
|
|
210
|
-
boxSizing: 'border-box',
|
|
211
|
-
display: 'block',
|
|
212
|
-
width: '100%',
|
|
213
|
-
margin: '0',
|
|
214
|
-
backgroundColor: 'transparent',
|
|
215
|
-
textAlign: 'start',
|
|
216
|
-
fontFamily: 'inherit',
|
|
217
|
-
userSelect: 'none',
|
|
218
|
-
cursor: 'pointer',
|
|
219
|
-
border: 'none',
|
|
220
|
-
borderRadius: componentTheme.borderRadius,
|
|
221
|
-
position: 'relative',
|
|
222
|
-
zIndex: 1,
|
|
223
|
-
...(state.animation ? {
|
|
224
|
-
transform: 'translate3d(-2%, 0, 0)',
|
|
225
|
-
opacity: 0.01,
|
|
226
|
-
transformOrigin: 'left center',
|
|
227
|
-
animationName: transform,
|
|
228
|
-
animationDuration: '0.2s',
|
|
229
|
-
animationFillMode: 'forwards',
|
|
230
|
-
animationTimingFunction: 'ease-out',
|
|
231
|
-
animationDelay: '0.2s'
|
|
232
|
-
} : {}),
|
|
233
|
-
outline: '0',
|
|
234
|
-
padding: '0',
|
|
235
|
-
...(variant === 'folderTree' && !isRootButton && {
|
|
236
|
-
'&::before': {
|
|
237
|
-
content: '""',
|
|
238
|
-
height: componentTheme.borderWidth,
|
|
239
|
-
background: componentTheme.borderColor,
|
|
240
|
-
position: 'absolute',
|
|
241
|
-
insetInlineStart: '0',
|
|
242
|
-
insetInlineEnd: 'auto',
|
|
243
|
-
top: '50%',
|
|
244
|
-
...(selected && {
|
|
245
|
-
visibility: 'hidden'
|
|
246
|
-
}),
|
|
247
|
-
...sizeMap[size][variant].before
|
|
281
|
+
label: 'treeButton__thumbnail',
|
|
282
|
+
...sizeMap[size][variant].thumbnail
|
|
248
283
|
},
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
'&::after': {
|
|
254
|
-
content: '""',
|
|
255
|
-
pointerEvents: 'none',
|
|
256
|
-
boxSizing: 'border-box',
|
|
257
|
-
display: 'block',
|
|
258
|
-
position: 'absolute',
|
|
259
|
-
top: '-0.25rem',
|
|
260
|
-
bottom: '-0.25rem',
|
|
261
|
-
left: '-0.25rem',
|
|
262
|
-
right: '-0.25rem',
|
|
263
|
-
border: `${componentTheme.focusOutlineWidth} ${componentTheme.focusOutlineStyle} ${componentTheme.focusOutlineColor}`,
|
|
264
|
-
borderRadius: `calc(${componentTheme.borderRadius} * 1.5)`,
|
|
265
|
-
transition: 'all 0.2s',
|
|
266
|
-
opacity: 0,
|
|
267
|
-
transform: 'scale(0.95)',
|
|
268
|
-
...(focused && {
|
|
269
|
-
opacity: 1,
|
|
270
|
-
transform: 'scale(1)'
|
|
271
|
-
})
|
|
272
|
-
},
|
|
273
|
-
'&:hover': {
|
|
274
|
-
backgroundColor: selected ? componentTheme.selectedBackgroundColor : componentTheme.hoverBackgroundColor,
|
|
275
|
-
'[class$=-treeButton__textName], [class$=-treeButton__textDescriptor], [class$=-treeButton__icon], [class$=-treeButton__node]': {
|
|
276
|
-
color: componentTheme.hoverTextColor
|
|
284
|
+
node: {
|
|
285
|
+
label: 'treeButton__node',
|
|
286
|
+
...textStyle,
|
|
287
|
+
...textNameStyle
|
|
277
288
|
}
|
|
278
|
-
|
|
279
|
-
...(selected && {
|
|
280
|
-
backgroundColor: componentTheme.selectedBackgroundColor
|
|
281
|
-
})
|
|
282
|
-
},
|
|
283
|
-
layout: {
|
|
284
|
-
label: 'treeButton__layout',
|
|
285
|
-
display: 'flex',
|
|
286
|
-
alignItems: 'center',
|
|
287
|
-
lineHeight: 1,
|
|
288
|
-
minHeight: '2rem',
|
|
289
|
-
...layoutPadding[size][variant]
|
|
290
|
-
},
|
|
291
|
-
text: {
|
|
292
|
-
label: 'treeButton__text',
|
|
293
|
-
...textStyle
|
|
294
|
-
},
|
|
295
|
-
textName: {
|
|
296
|
-
label: 'treeButton__textName',
|
|
297
|
-
...textNameStyle,
|
|
298
|
-
color: selected ? componentTheme.selectedTextColor : componentTheme.nameTextColor
|
|
299
|
-
},
|
|
300
|
-
textDescriptor: {
|
|
301
|
-
label: 'treeButton__textDescriptor',
|
|
302
|
-
display: 'block',
|
|
303
|
-
overflow: 'hidden',
|
|
304
|
-
whiteSpace: 'nowrap',
|
|
305
|
-
textOverflow: 'ellipsis',
|
|
306
|
-
marginTop: componentTheme.descriptorMarginTop,
|
|
307
|
-
color: selected ? componentTheme.selectedTextColor : componentTheme.descriptorTextColor,
|
|
308
|
-
...sizeMap[size].textDescriptor
|
|
309
|
-
},
|
|
310
|
-
icon: {
|
|
311
|
-
label: 'treeButton__icon',
|
|
312
|
-
minWidth: '0.0625rem',
|
|
313
|
-
position: 'relative',
|
|
314
|
-
zIndex: 1,
|
|
315
|
-
color: selected ? componentTheme.selectedTextColor : componentTheme.iconColor,
|
|
316
|
-
display: 'flex',
|
|
317
|
-
alignItems: 'center',
|
|
318
|
-
justifyContent: 'center',
|
|
319
|
-
...sizeMap[size][variant].icon
|
|
320
|
-
},
|
|
321
|
-
thumbnail: {
|
|
322
|
-
label: 'treeButton__thumbnail',
|
|
323
|
-
...sizeMap[size][variant].thumbnail
|
|
324
|
-
},
|
|
325
|
-
node: {
|
|
326
|
-
label: 'treeButton__node',
|
|
327
|
-
...textStyle,
|
|
328
|
-
...textNameStyle
|
|
329
|
-
}
|
|
330
|
-
};
|
|
289
|
+
};
|
|
331
290
|
};
|
|
332
|
-
export default generateStyles;
|
|
291
|
+
export default generateStyles;
|