Skip to content

Commit c838181

Browse files
authored
Fix ListView css specificity (#2738)
* improve ListView css specificity * revert density selector change * replace dir selectors with start/end properties
1 parent 4e3b234 commit c838181

File tree

1 file changed

+64
-75
lines changed

1 file changed

+64
-75
lines changed

packages/@react-spectrum/list/src/listview.css

Lines changed: 64 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,70 @@
9797
padding-top: 0px;
9898
padding-bottom: 0px;
9999
}
100+
101+
.react-spectrum-ListViewItem-grid {
102+
display: grid;
103+
grid-template-columns: auto auto auto 1fr auto auto;
104+
grid-template-rows: 1fr auto;
105+
grid-template-areas:
106+
"checkbox icon image content actions actionmenu chevron"
107+
"checkbox icon image description actions actionmenu chevron"
108+
;
109+
align-items: center;
110+
}
111+
112+
.react-spectrum-ListViewItem-checkbox {
113+
grid-area: checkbox;
114+
align-items: center;
115+
justify-items: center;
116+
min-height: 0;
117+
height: 100%;
118+
> span {
119+
margin: 0;
120+
}
121+
}
122+
123+
.react-spectrum-ListViewItem-icon,
124+
.react-spectrum-ListViewItem-image {
125+
grid-area: image;
126+
align-items: center;
127+
justify-items: center;
128+
padding-inline-end: var(--spectrum-global-dimension-size-100);
129+
}
130+
131+
.react-spectrum-ListViewItem-image {
132+
border-radius: var(--spectrum-global-dimension-size-25);
133+
width: var(--spectrum-global-dimension-size-400);
134+
height: var(--spectrum-global-dimension-size-400);
135+
}
136+
137+
.react-spectrum-ListViewItem-content,
138+
.react-spectrum-ListViewItem-description {
139+
flex-grow: 1;
140+
}
141+
142+
.react-spectrum-ListViewItem-content {
143+
grid-area: content;
144+
}
145+
146+
.react-spectrum-ListViewItem-description {
147+
grid-area: description;
148+
}
149+
150+
.react-spectrum-ListViewItem-actions {
151+
grid-area: actions;
152+
flex-grow: 0;
153+
flex-shrink: 0;
154+
}
155+
156+
.react-spectrum-ListViewItem-actionmenu {
157+
grid-area: actionmenu;
158+
}
159+
160+
.react-spectrum-ListViewItem-parentIndicator {
161+
grid-area: chevron;
162+
padding-inline-start: var(--spectrum-global-dimension-size-75);
163+
}
100164

101165
/* give first and last items border-radius to match listview container */
102166
div:first-child > div[role="row"] > & {
@@ -121,71 +185,6 @@
121185
min-height: var(--spectrum-global-dimension-size-600);
122186
}
123187

124-
.react-spectrum-ListViewItem-grid {
125-
display: grid;
126-
grid-template-columns: auto auto auto 1fr auto auto;
127-
grid-template-rows: 1fr auto;
128-
grid-template-areas:
129-
"checkbox icon image content actions actionmenu chevron"
130-
"checkbox icon image description actions actionmenu chevron"
131-
;
132-
align-items: center;
133-
}
134-
135-
.react-spectrum-ListViewItem-checkbox {
136-
grid-area: checkbox;
137-
align-items: center;
138-
justify-items: center;
139-
min-height: 0;
140-
height: 100%;
141-
> span {
142-
margin: 0;
143-
}
144-
}
145-
146-
.react-spectrum-ListViewItem-icon,
147-
.react-spectrum-ListViewItem-image {
148-
grid-area: image;
149-
align-items: center;
150-
justify-items: center;
151-
152-
[dir="ltr"] & {
153-
padding-right: var(--spectrum-global-dimension-size-100);
154-
}
155-
[dir="rtl"] & {
156-
padding-left: var(--spectrum-global-dimension-size-100);
157-
}
158-
}
159-
160-
.react-spectrum-ListViewItem-image {
161-
border-radius: var(--spectrum-global-dimension-size-25);
162-
width: var(--spectrum-global-dimension-size-400);
163-
height: var(--spectrum-global-dimension-size-400);
164-
}
165-
166-
.react-spectrum-ListViewItem-content,
167-
.react-spectrum-ListViewItem-description {
168-
flex-grow: 1;
169-
}
170-
171-
.react-spectrum-ListViewItem-content {
172-
grid-area: content;
173-
}
174-
175-
.react-spectrum-ListViewItem-description {
176-
grid-area: description;
177-
}
178-
179-
.react-spectrum-ListViewItem-actions {
180-
grid-area: actions;
181-
flex-grow: 0;
182-
flex-shrink: 0;
183-
}
184-
185-
.react-spectrum-ListViewItem-actionmenu {
186-
grid-area: actionmenu;
187-
}
188-
189188
.react-spectrum-ListView-centeredWrapper {
190189
display: flex;
191190
align-items: center;
@@ -194,13 +193,3 @@
194193
height: 100%;
195194
}
196195

197-
.react-spectrum-ListViewItem-parentIndicator {
198-
grid-area: chevron;
199-
200-
[dir="ltr"] & {
201-
padding-left: var(--spectrum-global-dimension-size-75);
202-
}
203-
[dir="rtl"] & {
204-
padding-right: var(--spectrum-global-dimension-size-75);
205-
}
206-
}

0 commit comments

Comments
 (0)