You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support variable heights and self sizing collection views (#241)
* Support variable heights and self sizing collection views
* Fix tests
* awaitDomChange in v2 only
* Make description wrap
Co-authored-by: Danni <darobins@adobe.com>
@@ -165,8 +158,6 @@ governing permissions and limitations under the License.
165
158
}
166
159
167
160
.spectrum-Menu-itemGrid {
168
-
/* hard coded height to match row height in Menu.tsx */
169
-
height:32px;
170
161
display: grid;
171
162
grid-template-columns:calc(var(--spectrum-selectlist-option-padding) -var(--spectrum-selectlist-border-size-key-focus)) auto 1fr auto auto var(--spectrum-selectlist-option-padding);
172
163
grid-template-rows:var(--spectrum-selectlist-option-padding-y) 1fr auto var(--spectrum-selectlist-option-padding-y);
@@ -195,12 +186,6 @@ governing permissions and limitations under the License.
rowHeight: 32,// Feel like we should eventually calculate this number (based on the css)? It should probably get a multiplier in order to gracefully handle scaling
31
-
headingHeight: 31// Same as above
34
+
estimatedRowHeight: scale==='large' ? 48 : 32,
35
+
estimatedHeadingHeight: scale==='large' ? 31 : 25
32
36
})
33
-
,[]);
37
+
,[scale]);
34
38
35
39
letcontextProps=useContext(MenuContext);
36
40
letcompleteProps={
@@ -50,6 +54,7 @@ export function Menu<T>(props: SpectrumMenuProps<T>) {
50
54
{...styleProps}
51
55
{...menuProps}
52
56
focusedKey={state.selectionManager.focusedKey}
57
+
sizeToFit="height"
53
58
className={
54
59
classNames(
55
60
styles,
@@ -59,7 +64,7 @@ export function Menu<T>(props: SpectrumMenuProps<T>) {
59
64
}
60
65
layout={layout}
61
66
collection={state.tree}>
62
-
{(type,item: Node<T>)=>{
67
+
{(type,item)=>{
63
68
if(type==='section'){
64
69
// Only render the Divider if it isn't the first Heading (extra equality check to guard against rerenders)
0 commit comments