Skip to content

Commit 7a1b4c7

Browse files
committed
wip
1 parent 2a3ce2a commit 7a1b4c7

File tree

1 file changed

+110
-151
lines changed

1 file changed

+110
-151
lines changed

packages/grid/src/styles/vaadin-grid-base-styles.js

Lines changed: 110 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ export const gridStyles = css`
2222
cursor: default;
2323
--_border-color: var(--vaadin-grid-border-color, var(--vaadin-border-color-secondary));
2424
--_border-width: 0;
25-
--_row-border-width: var(--vaadin-grid-row-border-width, 1px);
26-
--_column-border-width: var(--vaadin-grid-column-border-width, 0px);
25+
--_row-border-width: var(--vaadin-grid-row-border-width, 4px);
26+
--_column-border-width: var(--vaadin-grid-column-border-width, 4px);
2727
border-radius: var(--_border-radius);
2828
--_border-radius: 0;
2929
}
@@ -121,142 +121,19 @@ export const gridStyles = css`
121121
[part~='reorder-ghost'] {
122122
font-size: var(--vaadin-grid-header-font-size, 1em);
123123
font-weight: var(--vaadin-grid-header-font-weight, 500);
124-
color: var(--vaadin-grid-header-color, var(--vaadin-text-color));
124+
color: var(--vaadin-grid-text-header-color, var(--vaadin-text-color));
125125
}
126126
127127
[part~='row'] {
128-
display: inline-flex;
129-
min-width: 100%;
128+
display: flex;
129+
width: 100%;
130130
box-sizing: border-box;
131131
margin: 0;
132132
position: relative;
133-
background: var(--vaadin-cell-background, var(--vaadin-background-color));
134-
border-block: var(--_row-border-width) solid var(--_border-color);
135-
}
136-
137-
[part~='details-cell'] {
138-
border-block-start: var(--_row-border-width) solid var(--_border-color);
139-
}
140-
141-
#header {
142-
[part~='row'] {
143-
border-block-start-style: none;
144-
}
145-
146-
/* Focus outline */
147-
[part~='row']:first-child::after,
148-
[part~='row']:first-child [part~='cell']::after {
149-
inset-block-start: 0;
150-
}
151-
152-
[part~='row']:last-child {
153-
border-block-end-style: none;
154-
background: transparent;
155-
}
156-
157-
/* Header bottom border */
158-
[part~='row']:last-child::before {
159-
content: '';
160-
height: var(--_row-border-width);
161-
background: var(--_border-color);
162-
position: absolute;
163-
inset-block-end: calc(-1 * var(--_row-border-width));
164-
inset-inline: 0;
165-
}
166-
167-
:host([overflow~='top']) & {
168-
padding-block-end: var(--_row-border-width);
169-
}
170-
}
171-
172-
#items {
173-
[part~='row'] {
174-
border-block-start-style: none;
175-
}
176-
177-
[part~='row']:empty {
178-
height: 100%;
179-
}
180-
}
181-
182-
#footer {
183-
[part~='row'] {
184-
border-block-end-style: none;
185-
}
186-
187-
[part~='row']:first-child {
188-
border-block-start-style: none;
189-
}
190-
191-
/* Footer top border */
192-
#scroller[empty-state] &,
193-
:host([overflow~='top']) &,
194-
:host([overflow~='bottom']) & {
195-
[part~='row']:first-child::before {
196-
content: '';
197-
height: var(--_row-border-width);
198-
background: var(--_border-color);
199-
position: absolute;
200-
inset-block-start: calc(-1 * var(--_row-border-width));
201-
inset-inline: 0;
202-
}
203-
}
204-
205-
/* Focus outline */
206-
[part~='row']:last-child::after,
207-
[part~='row']:last-child [part~='cell']::after {
208-
inset-block-end: 0;
209-
}
210-
}
211-
212-
/* Grid with header */
213-
#table:has(#header > tr:not([hidden])) {
214-
#emptystatebody {
215-
margin-top: calc(var(--_row-border-width) * -1);
216-
}
217-
218-
#emptystatecell {
219-
border-block: var(--_row-border-width) solid transparent;
220-
}
221-
222-
[part~='first-row'] {
223-
border-block-start-color: transparent;
224-
border-block-start-style: solid;
225-
}
226-
}
227-
228-
/* Grid without header */
229-
#table:not(:has(#header > tr:not([hidden]))) {
230-
/* Focus outline */
231-
[part~='first-row']::after,
232-
[part~='first-row'] [part~='cell']::after {
233-
inset-block-start: 0;
234-
}
235-
}
236-
237-
/* Grid with footer */
238-
#table:has(#footer > tr:not([hidden])) {
239-
:host([overflow~='top']) &,
240-
:host([overflow~='bottom']) & {
241-
[part~='last-row'] {
242-
border-block-end-color: transparent;
243-
}
244-
}
245133
}
246134
247-
/* Grid without footer */
248-
#table:not(:has(#footer > tr:not([hidden]))) {
249-
:host([overflow~='top']) & {
250-
[part~='last-row'] {
251-
border-block-end-style: none;
252-
}
253-
254-
/* Focus outline */
255-
[part~='last-row']::after,
256-
[part~='last-row'] [part~='cell']::after {
257-
inset-block-end: 0;
258-
}
259-
}
135+
[part~='row']:empty {
136+
height: 100%;
260137
}
261138
262139
[part~='row']:not(:focus-within) {
@@ -272,12 +149,16 @@ export const gridStyles = css`
272149
}
273150
274151
[part~='cell'] {
152+
--vaadin-grid-cell-background-color: yellow;
275153
padding: 0;
276154
box-sizing: border-box;
277155
background: var(--vaadin-grid-cell-background, var(--vaadin-background-color));
156+
border-block: var(--_row-border-width) var(--_border-color);
278157
}
279158
280-
[part~='cell']:where(:not([part~='details-cell'])) {
159+
[part~='body-cell'],
160+
[part~='header-cell'],
161+
[part~='footer-cell'] {
281162
flex-shrink: 0;
282163
flex-grow: 1;
283164
display: flex;
@@ -286,30 +167,73 @@ export const gridStyles = css`
286167
align-items: center;
287168
white-space: nowrap;
288169
border-inline: var(--_column-border-width) var(--_border-color);
289-
border-inline-start-style: solid;
290170
}
291171
292-
[part~='first-column-cell'] {
293-
border-inline-start-style: none;
172+
/* Column borders */
173+
[part~='cell']:not([part~='first-column-cell']) {
174+
border-left-style: solid;
175+
}
176+
177+
[part~='last-frozen-cell']:not([part~='last-column-cell']) {
178+
border-right-style: solid;
179+
}
180+
181+
[part~='last-frozen-cell'] + [part~='cell'] {
182+
border-left-style: none;
183+
}
184+
185+
/* Row borders */
186+
#header {
187+
padding-bottom: var(--_row-border-width);
188+
margin-bottom: calc(var(--_row-border-width) * -1);
189+
}
190+
191+
[part~='header-cell']:not([part~='last-header-row-cell']),
192+
[part~='footer-cell']:not([part~='last-footer-row-cell']) {
193+
border-bottom-style: solid;
194+
}
195+
196+
[part~='body-cell']:not([part~='last-row-cell']),
197+
[part~='body-cell']:not([part~='last-row-cell']) + [part~='details-cell'] {
198+
border-bottom-style: solid;
199+
}
200+
201+
/* Grid with header */
202+
#table:has(#header > tr:not([hidden])) {
203+
[part~='first-row-cell'] {
204+
border-block-start-style: solid;
205+
}
294206
}
295207
296-
[part~='last-frozen-cell'] {
297-
border-inline-end-style: solid;
208+
/* Grid with footer */
209+
#table:has(#footer > tr:not([hidden])) {
210+
[part~='last-row-cell'] {
211+
border-block-end-style: solid;
212+
}
213+
}
214+
215+
/* Grid with header */
216+
#table:has(#header > tr:not([hidden])) {
217+
#emptystatebody {
218+
/* margin-top: calc(var(--_row-border-width) * -1); */
219+
}
298220
299-
& + [part~='cell'] {
300-
border-inline-start-style: none;
221+
#emptystatecell {
222+
border-block: var(--_row-border-width) solid transparent;
301223
}
302224
}
303225
304-
[part~='body-cell']:where(:not([part~='details-cell'])) {
226+
[part~='body-cell'] {
305227
--_highlight-background-color: var(--vaadin-grid-row-highlight-background-color, transparent);
306228
--_highlight-background-image: linear-gradient(
307229
var(--_highlight-background-color),
308230
var(--_highlight-background-color)
309231
);
310232
background:
311-
var(--_hover-background-image, none), var(--_selected-background-image, none), var(--_highlight-background-image),
312-
var(--vaadin-grid-cell-background-color, var(--vaadin-background-color));
233+
var(--_hover-background-image, none) padding-box,
234+
var(--_selected-background-image, none) border-box,
235+
var(--_highlight-background-image) padding-box,
236+
var(--vaadin-grid-cell-background-color) border-box;
313237
}
314238
315239
/* Variant: wrap cell contents */
@@ -332,27 +256,34 @@ export const gridStyles = css`
332256
333257
/* Raise highlighted rows above others */
334258
335-
[part~='row']:focus,
336-
[part~='row']:focus-within,
337-
[part~='body-row']:where([selected]) {
259+
[part~='selected-row'] {
338260
z-index: 3;
339261
}
340262
341-
@container style(--vaadin-grid-row-odd-background-color) {
263+
[part~='row']:focus,
264+
[part~='row']:focus-within {
265+
z-index: 4;
266+
267+
[part~='cell']:not([part~='selected-row-cell']) {
268+
border-top-color: transparent;
269+
}
270+
}
271+
272+
/* @container style(--vaadin-grid-row-odd-background-color) {
342273
[part~='odd-row'] {
343274
z-index: 1;
344275
}
345-
}
276+
} */
346277
347278
/* Row hover */
348279
@media (any-hover: hover) {
349-
@container style(--vaadin-grid-row-hover-background-color) {
280+
/* @container style(--vaadin-grid-row-hover-background-color) {
350281
[part~='body-row']:hover {
351282
z-index: 2;
352283
}
353-
}
284+
} */
354285
355-
[part~='body-row']:hover [part~='cell']:where(:not([part~='details-cell'])) {
286+
[part~='body-row']:hover [part~='body-cell'] {
356287
--_hover-background-color: var(--vaadin-grid-row-hover-background-color, transparent);
357288
--_hover-background-image: linear-gradient(var(--_hover-background-color), var(--_hover-background-color));
358289
}
@@ -381,14 +312,22 @@ export const gridStyles = css`
381312
}
382313
383314
/* Selected row */
384-
[part~='body-row'][selected] {
315+
[part~='selected-row'] {
385316
--_selected-background-color: var(
386317
--vaadin-grid-row-selected-background-color,
387318
color-mix(in srgb, currentColor 8%, transparent)
388319
);
389320
--_selected-background-image: linear-gradient(var(--_selected-background-color), var(--_selected-background-color));
390321
}
391322
323+
[part~='selected-row-cell'] {
324+
border-top-style: solid;
325+
}
326+
327+
[part~='selected-row-cell']:not([part~='first-row-cell']) {
328+
margin-top: calc(var(--_row-border-width) * -1);
329+
}
330+
392331
/* Empty state */
393332
#scroller:not([empty-state]) #emptystatebody,
394333
#scroller[empty-state] #items {
@@ -539,20 +478,40 @@ export const gridStyles = css`
539478
/* Focus outline element, also used for d'n'd indication */
540479
:is([part~='row'], [part~='cell'])::after {
541480
position: absolute;
542-
inset: calc(var(--_row-border-width) * -1) calc(var(--_column-border-width) * -1);
543481
z-index: 3;
544482
pointer-events: none;
545483
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
546484
outline-offset: calc(var(--vaadin-focus-ring-width) * -1);
547485
}
548486
487+
[part~='cell']::after {
488+
inset: calc(var(--_row-border-width) * -1) calc(var(--_column-border-width) * -1);
489+
}
490+
549491
[part~='first-column-cell']::after {
550492
inset-inline-start: 0;
551493
}
494+
552495
[part~='last-column-cell']::after {
553496
inset-inline-end: 0;
554497
}
555498
499+
[part~='row']::after {
500+
inset-block: calc(var(--_row-border-width) * -1) 0;
501+
inset-inline: 0;
502+
}
503+
504+
#header [part~='row']:first-child::after,
505+
#header [part~='row']:first-child [part~='cell']::after {
506+
inset-block-start: 0;
507+
}
508+
509+
#table:has(#header > tr:not([hidden])) {
510+
[part~='first-row']::after {
511+
inset-block-start: 0;
512+
}
513+
}
514+
556515
:host([navigating]) [part~='row']:focus,
557516
:host([navigating]) [part~='cell']:focus {
558517
outline: 0;

0 commit comments

Comments
 (0)