@vaadin/grid 25.0.0-beta3 → 25.0.0-beta5

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.
@@ -7,6 +7,7 @@ import '@vaadin/component-base/src/styles/style-props.js';
7
7
  import { css } from 'lit';
8
8
 
9
9
  export const gridStyles = css`
10
+ /* stylelint-disable no-duplicate-selectors */
10
11
  :host {
11
12
  display: flex;
12
13
  max-width: 100%;
@@ -16,16 +17,19 @@ export const gridStyles = css`
16
17
  align-self: stretch;
17
18
  position: relative;
18
19
  box-sizing: border-box;
20
+ overflow: hidden;
19
21
  -webkit-tap-highlight-color: transparent;
20
22
  background: var(--vaadin-grid-background, var(--vaadin-background-color));
21
- border: var(--_border-width) solid var(--_border-color);
23
+ border: var(--vaadin-grid-border-width, 1px) solid var(--_border-color);
22
24
  cursor: default;
23
25
  --_border-color: var(--vaadin-grid-border-color, var(--vaadin-border-color-secondary));
24
- --_border-width: 0;
25
26
  --_row-border-width: var(--vaadin-grid-row-border-width, 1px);
26
27
  --_column-border-width: var(--vaadin-grid-column-border-width, 0px);
27
- border-radius: var(--_border-radius);
28
- --_border-radius: 0;
28
+ --_cell-padding: var(
29
+ --vaadin-grid-cell-padding,
30
+ var(--vaadin-padding-block-container) var(--vaadin-padding-inline-container)
31
+ );
32
+ border-radius: var(--vaadin-grid-border-radius, var(--vaadin-radius-m));
29
33
  }
30
34
 
31
35
  :host([hidden]),
@@ -39,9 +43,9 @@ export const gridStyles = css`
39
43
  }
40
44
 
41
45
  /* Variant: No outer border */
42
- :host(:not([theme~='no-border'])) {
43
- --_border-width: var(--vaadin-grid-border-width, 1px);
44
- --_border-radius: var(--vaadin-grid-border-radius, var(--vaadin-radius-m));
46
+ :host([theme~='no-border']) {
47
+ border-width: 0;
48
+ border-radius: 0;
45
49
  }
46
50
 
47
51
  :host([all-rows-visible]) {
@@ -49,11 +53,11 @@ export const gridStyles = css`
49
53
  align-self: flex-start;
50
54
  min-height: auto;
51
55
  flex-grow: 0;
56
+ flex-shrink: 0;
52
57
  }
53
58
 
54
59
  #scroller {
55
60
  contain: layout;
56
- border-radius: calc(var(--_border-radius) - var(--_border-width));
57
61
  position: relative;
58
62
  display: flex;
59
63
  width: 100%;
@@ -95,13 +99,6 @@ export const gridStyles = css`
95
99
  position: sticky;
96
100
  left: 0;
97
101
  width: 100%;
98
- }
99
-
100
- :host([overflow~='top']) #header,
101
- :host([overflow~='bottom']) #footer,
102
- :host([navigating]) #header:has(tr:last-child:focus-within),
103
- :host([navigating]) #footer:has(tr:first-child:focus-within),
104
- [empty-state] #header {
105
102
  z-index: 2;
106
103
  }
107
104
 
@@ -124,13 +121,13 @@ export const gridStyles = css`
124
121
  }
125
122
 
126
123
  #header th,
127
- [part~='reorder-ghost'] {
124
+ .reorder-ghost {
128
125
  font-size: var(--vaadin-grid-header-font-size, 1em);
129
126
  font-weight: var(--vaadin-grid-header-font-weight, 500);
130
127
  color: var(--vaadin-grid-header-text-color, var(--vaadin-text-color));
131
128
  }
132
129
 
133
- [part~='row'] {
130
+ .row {
134
131
  display: flex;
135
132
  width: 100%;
136
133
  box-sizing: border-box;
@@ -138,51 +135,28 @@ export const gridStyles = css`
138
135
  position: relative;
139
136
  }
140
137
 
141
- [part~='row']:not(:focus-within) {
138
+ .row:not(:focus-within) {
142
139
  --_non-focused-row-none: none;
143
140
  }
144
141
 
145
- [part~='row'][loading] [part~='body-cell'] ::slotted(vaadin-grid-cell-content) {
142
+ .body-row[loading] .body-cell ::slotted(vaadin-grid-cell-content) {
146
143
  visibility: hidden;
147
144
  }
148
145
 
149
- [column-rendering='lazy'] [part~='body-cell']:not([frozen]):not([frozen-to-end]) {
146
+ [column-rendering='lazy'] .body-cell:not([frozen]):not([frozen-to-end]) {
150
147
  transform: translateX(var(--_grid-lazy-columns-start));
151
148
  }
152
149
 
153
- #items [part~='row']:empty {
150
+ #items .row:empty {
154
151
  height: 100%;
155
152
  }
156
153
 
157
- [part~='cell'] {
154
+ .cell {
158
155
  padding: 0;
159
156
  box-sizing: border-box;
160
- background: var(--vaadin-grid-cell-background, var(--vaadin-background-color));
161
- border-block: var(--_row-border-width) solid var(--_border-color);
162
- margin-top: calc(var(--_row-border-width) * -1);
163
-
164
- /*
165
- Box-shadows are used to create a "fake" border at the end of the cell/row, which is visible when a row/cell ends
166
- before the edge of the grid viewport, as well as frozen columns and rows (header and footer).
167
- If there are frozen columns, we'll make the "fake box-shadow border" on the header and footer opaque by rendering
168
- both the border color and cell background color, so that a semi-transparent border color doesn't "stack" when
169
- scrolling horizontally.
170
- */
171
- --_fake-border:
172
- 0 calc(var(--_top, 0) * var(--_row-border-width) * -1) 0 0 var(--_border-color),
173
- 0 calc(var(--_top-opaque, 0) * var(--_row-border-width) * -1) 0 0
174
- var(--vaadin-grid-cell-background-color, var(--vaadin-background-color)),
175
- 0 calc(var(--_bottom, 0) * var(--_row-border-width)) 0 0 var(--_border-color),
176
- 0 calc(var(--_bottom-opaque, 0) * var(--_row-border-width)) 0 0
177
- var(--vaadin-grid-cell-background-color, var(--vaadin-background-color)),
178
- calc(var(--_start, 0) * var(--_column-border-width) * -1) 0 0 0 var(--_border-color),
179
- calc(var(--_end, 0) * var(--_column-border-width)) 0 0 0 var(--_border-color),
180
- calc(var(--_end-opaque, 0) * var(--_column-border-width)) 0 0 0
181
- var(--vaadin-grid-cell-background-color, var(--vaadin-background-color));
182
- box-shadow: var(--_fake-border);
183
- }
184
-
185
- [part~='cell']:where(:not([part~='details-cell'])) {
157
+ }
158
+
159
+ .cell:where(:not(.details-cell)) {
186
160
  flex-shrink: 0;
187
161
  flex-grow: 1;
188
162
  display: flex;
@@ -190,152 +164,230 @@ export const gridStyles = css`
190
164
  position: relative;
191
165
  align-items: center;
192
166
  white-space: nowrap;
193
- border-inline-start: var(--_column-border-width) solid var(--_border-color);
194
167
  }
195
168
 
196
- [part~='first-column-cell'] {
197
- border-inline-start: 0;
169
+ /*
170
+ Block borders
171
+
172
+ ::after - row and cell focus outline
173
+ ::before - header bottom and footer top borders that only appear when scrolling
174
+ */
175
+
176
+ .row::after {
177
+ top: 0;
178
+ bottom: calc(var(--_row-border-width) * -1);
179
+ }
180
+
181
+ .body-row {
182
+ scroll-margin-bottom: var(--_row-border-width);
198
183
  }
199
184
 
200
- [part~='first-header-row-cell'],
201
- [part~='first-footer-row-cell'],
202
- [part~='first-row-cell'] {
203
- margin-top: 0;
204
- border-top: 0;
185
+ .cell {
186
+ border-block: var(--_row-border-width) var(--_border-color);
187
+ border-top-style: solid;
205
188
  }
206
189
 
207
- table:has(#header > tr:not([hidden])) [part~='first-row-cell'] {
208
- border-top: var(--_row-border-width) solid var(--_border-color);
190
+ .cell::after {
191
+ top: calc(var(--_row-border-width) * -1);
192
+ bottom: calc(var(--_row-border-width) * -1);
209
193
  }
210
194
 
211
- [part~='last-column-cell'] {
212
- --_end: 1;
195
+ /* Block borders / Last header row and first footer row */
196
+
197
+ .last-header-row::before,
198
+ .first-footer-row::before {
199
+ position: absolute;
200
+ inset-inline: 0;
201
+ border-block: var(--_row-border-width) var(--_border-color);
202
+ transform: translateX(var(--_grid-horizontal-scroll-position));
213
203
  }
214
204
 
215
- [part~='last-column-cell']:is([part~='header-cell'], [part~='footer-cell']) {
216
- --_end-opaque: 1;
205
+ /* Block borders / First header row */
206
+
207
+ .first-header-row-cell {
208
+ border-top-style: none;
209
+ }
210
+
211
+ .first-header-row-cell::after {
212
+ top: 0;
213
+ }
214
+
215
+ /* Block borders / Last header row */
216
+
217
+ :host([overflow~='top']) .last-header-row::before {
218
+ content: '';
219
+ bottom: calc(var(--_row-border-width) * -1);
220
+ border-bottom-style: solid;
217
221
  }
218
222
 
219
- [part~='last-row-cell']:where(:not([part~='details-opened-row-cell'])),
220
- [part~='last-footer-row-cell'] {
221
- border-bottom: 0;
222
- --_bottom: 1;
223
+ /* Block borders / First body row */
224
+
225
+ #table:not([has-header]) .first-row-cell {
226
+ border-top-style: none;
223
227
  }
224
228
 
225
- [part~='last-frozen-cell'] {
226
- --_end: 1;
229
+ #table:not([has-header]) .first-row-cell::after {
230
+ top: 0;
227
231
  }
228
232
 
229
- [part~='last-frozen-cell'] + [part~='cell'] {
230
- border-inline-start-color: transparent;
233
+ /* Block borders / Last body row */
234
+
235
+ .last-row::after {
236
+ bottom: 0;
231
237
  }
232
238
 
233
- [part~='first-frozen-to-end-cell'] {
234
- border-inline-start: 0;
235
- --_start: 1;
239
+ .last-row .details-cell,
240
+ .last-row-cell:not(.details-opened-row-cell) {
241
+ border-bottom-style: solid;
236
242
  }
237
243
 
238
- [part~='last-header-row-cell'] {
239
- border-bottom: 0;
244
+ /* Block borders / Last body row without footer */
245
+
246
+ :host([all-rows-visible]),
247
+ :host([overflow~='top']),
248
+ :host([overflow~='bottom']) {
249
+ #table:not([has-footer]) .last-row .details-cell,
250
+ #table:not([has-footer]) .last-row-cell:not(.details-opened-row-cell) {
251
+ border-bottom-style: none;
252
+
253
+ &::after {
254
+ bottom: 0;
255
+ }
256
+ }
240
257
  }
241
258
 
242
- :host([overflow~='top']) [part~='last-header-row-cell'],
243
- [empty-state] [part~='last-header-row-cell'] {
244
- --_bottom: 1;
259
+ /* Block borders / First footer row */
260
+
261
+ .first-footer-row::after {
262
+ top: calc(var(--_row-border-width) * -1);
245
263
  }
246
264
 
247
- #header:has(:is([frozen], [frozen-to-end])) [part~='last-header-row-cell'] {
248
- --_bottom-opaque: 1;
265
+ .first-footer-row-cell {
266
+ border-top-style: none;
249
267
  }
250
268
 
251
- :host([overflow~='bottom']) [part~='first-footer-row-cell'],
252
- [empty-state] [part~='first-footer-row-cell'] {
253
- --_top: 1;
269
+ :host([overflow~='bottom']),
270
+ :host(:not([overflow~='top']):not([all-rows-visible])) #scroller:not([empty-state]) {
271
+ .first-footer-row::before {
272
+ content: '';
273
+ top: calc(var(--_row-border-width) * -1);
274
+ border-top-style: solid;
275
+ }
254
276
  }
255
277
 
256
- #footer:has(:is([frozen], [frozen-to-end])) [part~='first-footer-row-cell'] {
257
- --_top-opaque: 1;
278
+ /* Block borders / Last footer row */
279
+
280
+ .last-footer-row::after,
281
+ .last-footer-row-cell::after {
282
+ bottom: 0;
258
283
  }
259
284
 
260
- table:has(#footer > tr:not([hidden])) [part~='last-row-cell']:not([part~='details-opened-row-cell']) {
261
- border-bottom: var(--_row-border-width) solid var(--_border-color);
262
- --_bottom: 0;
285
+ /* Inline borders */
286
+
287
+ .cell {
288
+ border-inline: var(--_column-border-width) var(--_border-color);
263
289
  }
264
290
 
265
- [part~='body-cell']:where(:not([part~='details-cell'])) {
266
- --_highlight-background-color: var(--vaadin-grid-row-highlight-background-color, transparent);
267
- --_highlight-background-image: linear-gradient(
268
- var(--_highlight-background-color),
269
- var(--_highlight-background-color)
270
- );
271
- background:
272
- var(--_hover-background-image, none), var(--_selected-background-image, none), var(--_highlight-background-image),
273
- var(--vaadin-grid-cell-background-color, var(--vaadin-background-color));
291
+ .header-cell:not(.first-column-cell),
292
+ .footer-cell:not(.first-column-cell),
293
+ .body-cell:not(.first-column-cell) {
294
+ border-inline-start-style: solid;
274
295
  }
275
296
 
276
- /* Variant: wrap cell contents */
297
+ .last-frozen-cell:not(.last-column-cell) {
298
+ border-inline-end-style: solid;
277
299
 
278
- :host([theme~='wrap-cell-content']) [part~='cell']:not([part~='details-cell']) {
279
- white-space: normal;
300
+ & + .cell {
301
+ border-inline-start-style: none;
302
+ }
280
303
  }
281
304
 
282
- /* Variant: row stripes */
283
- [part~='odd-row'] {
284
- --vaadin-grid-cell-background-color: var(--vaadin-grid-row-odd-background-color, var(--vaadin-background-color));
305
+ /* Row and cell background */
306
+
307
+ .row {
308
+ background-color: var(--vaadin-grid-row-background-color, var(--vaadin-background-color));
285
309
  }
286
310
 
287
- :host([theme~='row-stripes']) [part~='odd-row'] {
288
- --vaadin-grid-cell-background-color: var(
289
- --vaadin-grid-row-odd-background-color,
290
- color-mix(in srgb, var(--vaadin-text-color) 4%, var(--vaadin-background-color))
311
+ .cell {
312
+ --_cell-background-image: linear-gradient(
313
+ var(--vaadin-grid-cell-background-color, transparent),
314
+ var(--vaadin-grid-cell-background-color, transparent)
291
315
  );
316
+
317
+ background-color: inherit;
318
+ background-repeat: no-repeat;
319
+ background-origin: padding-box;
320
+ background-image: var(--_cell-background-image);
292
321
  }
293
322
 
294
- /* Raise highlighted rows above others */
323
+ .body-cell {
324
+ --_cell-highlight-background-image: linear-gradient(
325
+ var(--vaadin-grid-row-highlight-background-color, transparent),
326
+ var(--vaadin-grid-row-highlight-background-color, transparent)
327
+ );
295
328
 
296
- [part~='row']:focus,
297
- [part~='row']:focus-within,
298
- [part~='body-row']:where([selected]) {
299
- z-index: 3;
329
+ background-image:
330
+ var(--_row-hover-background-image, none), var(--_row-selected-background-image, none),
331
+ var(--_cell-highlight-background-image, none), var(--_row-odd-background-image, none),
332
+ var(--_cell-background-image, none);
300
333
  }
301
334
 
302
- @container style(--vaadin-grid-row-odd-background-color) {
303
- [part~='odd-row'] {
304
- z-index: 1;
305
- }
335
+ .selected-row {
336
+ --_row-selected-background-color: var(
337
+ --vaadin-grid-row-selected-background-color,
338
+ color-mix(in srgb, currentColor 8%, transparent)
339
+ );
340
+ --_row-selected-background-image: linear-gradient(
341
+ var(--_row-selected-background-color),
342
+ var(--_row-selected-background-color)
343
+ );
306
344
  }
307
345
 
308
- /* Row hover */
309
346
  @media (any-hover: hover) {
310
- @container style(--vaadin-grid-row-hover-background-color) {
311
- [part~='body-row']:hover {
312
- z-index: 2;
313
- }
347
+ .body-row:hover {
348
+ --_row-hover-background-color: var(--vaadin-grid-row-hover-background-color, transparent);
349
+ --_row-hover-background-image: linear-gradient(
350
+ var(--_row-hover-background-color),
351
+ var(--_row-hover-background-color)
352
+ );
314
353
  }
354
+ }
355
+
356
+ :host([theme~='row-stripes']) .odd-row {
357
+ --_row-odd-background-color: var(
358
+ --vaadin-grid-row-odd-background-color,
359
+ color-mix(in srgb, var(--vaadin-text-color) 4%, transparent)
360
+ );
361
+ --_row-odd-background-image: linear-gradient(var(--_row-odd-background-color), var(--_row-odd-background-color));
362
+ }
363
+
364
+ /* Variant: wrap cell contents */
315
365
 
316
- [part~='body-row']:hover [part~='cell']:where(:not([part~='details-cell'])) {
317
- --_hover-background-color: var(--vaadin-grid-row-hover-background-color, transparent);
318
- --_hover-background-image: linear-gradient(var(--_hover-background-color), var(--_hover-background-color));
366
+ :host([theme~='wrap-cell-content']) .cell:not(.details-cell) {
367
+ white-space: normal;
368
+ }
369
+
370
+ /* Raise highlighted rows above others */
371
+ .row,
372
+ .frozen-cell,
373
+ .frozen-to-end-cell {
374
+ &:focus,
375
+ &:focus-within {
376
+ z-index: 3;
319
377
  }
320
378
  }
321
379
 
322
- [part~='details-cell'] {
380
+ .details-cell {
323
381
  position: absolute;
324
382
  bottom: 0;
325
383
  width: 100%;
326
- margin-top: 0;
327
- border-top: 0;
328
384
  }
329
385
 
330
- [part~='last-row-cell'] + [part~='details-cell'] {
331
- border-bottom: 0;
332
- }
333
-
334
- [part~='cell'] ::slotted(vaadin-grid-cell-content) {
386
+ .cell ::slotted(vaadin-grid-cell-content) {
335
387
  display: block;
336
388
  overflow: hidden;
337
389
  text-overflow: ellipsis;
338
- padding: var(--vaadin-grid-cell-padding, var(--vaadin-padding-container));
390
+ padding: var(--_cell-padding);
339
391
  flex: 1;
340
392
  min-height: 1lh;
341
393
  min-width: 0;
@@ -347,15 +399,6 @@ export const gridStyles = css`
347
399
  will-change: transform;
348
400
  }
349
401
 
350
- /* Selected row */
351
- [part~='body-row'][selected] {
352
- --_selected-background-color: var(
353
- --vaadin-grid-row-selected-background-color,
354
- color-mix(in srgb, currentColor 8%, transparent)
355
- );
356
- --_selected-background-image: linear-gradient(var(--_selected-background-color), var(--_selected-background-color));
357
- }
358
-
359
402
  /* Empty state */
360
403
  #scroller:not([empty-state]) #emptystatebody,
361
404
  #scroller[empty-state] #items {
@@ -368,7 +411,6 @@ export const gridStyles = css`
368
411
  inset: 0;
369
412
  flex: 1;
370
413
  overflow: hidden;
371
- margin-top: calc(var(--_row-border-width) * -1);
372
414
  }
373
415
 
374
416
  #emptystaterow {
@@ -380,9 +422,17 @@ export const gridStyles = css`
380
422
  display: block;
381
423
  flex: 1;
382
424
  overflow: auto;
383
- padding: var(--vaadin-grid-cell-padding, var(--vaadin-padding-container));
384
- border-top: var(--_row-border-width) solid transparent;
425
+ padding: var(--_cell-padding);
385
426
  outline: none;
427
+ border-block: var(--_row-border-width) var(--_border-color);
428
+ }
429
+
430
+ #table[has-header] #emptystatecell {
431
+ border-top-style: solid;
432
+ }
433
+
434
+ #table[has-footer] #emptystatecell {
435
+ border-bottom-style: solid;
386
436
  }
387
437
 
388
438
  #emptystatecell:focus-visible {
@@ -391,20 +441,20 @@ export const gridStyles = css`
391
441
  }
392
442
 
393
443
  /* Reordering styles */
394
- :host([reordering]) [part~='cell'] ::slotted(vaadin-grid-cell-content),
395
- :host([reordering]) [part~='resize-handle'],
396
- #scroller[no-content-pointer-events] [part~='cell'] ::slotted(vaadin-grid-cell-content) {
444
+ :host([reordering]) .cell ::slotted(vaadin-grid-cell-content),
445
+ :host([reordering]) .resize-handle,
446
+ #scroller[no-content-pointer-events] .cell ::slotted(vaadin-grid-cell-content) {
397
447
  pointer-events: none;
398
448
  }
399
449
 
400
- [part~='reorder-ghost'] {
450
+ .reorder-ghost {
401
451
  visibility: hidden;
402
452
  position: fixed;
403
453
  pointer-events: none;
404
454
  box-shadow:
405
455
  0 0 0 1px hsla(0deg, 0%, 0%, 0.2),
406
456
  0 8px 24px -2px hsla(0deg, 0%, 0%, 0.2);
407
- padding: var(--vaadin-grid-cell-padding, var(--vaadin-padding-container)) !important;
457
+ padding: var(--_cell-padding) !important;
408
458
  border-radius: 3px;
409
459
 
410
460
  /* Prevent overflowing the grid in Firefox */
@@ -417,12 +467,12 @@ export const gridStyles = css`
417
467
  user-select: none;
418
468
  }
419
469
 
420
- :host([reordering]) [part~='cell'] {
470
+ :host([reordering]) .cell {
421
471
  /* TODO expose a custom property to control this */
422
472
  --_reorder-curtain-filter: brightness(0.9) contrast(1.1);
423
473
  }
424
474
 
425
- :host([reordering]) [part~='cell']::after {
475
+ :host([reordering]) .cell::after {
426
476
  content: '';
427
477
  position: absolute;
428
478
  inset: 0;
@@ -432,17 +482,17 @@ export const gridStyles = css`
432
482
  outline: 0;
433
483
  }
434
484
 
435
- :host([reordering]) [part~='cell'][reorder-status='allowed'] {
485
+ :host([reordering]) .cell[reorder-status='allowed'] {
436
486
  /* TODO expose a custom property to control this */
437
487
  --_reorder-curtain-filter: brightness(0.94) contrast(1.07);
438
488
  }
439
489
 
440
- :host([reordering]) [part~='cell'][reorder-status='dragging'] {
490
+ :host([reordering]) .cell[reorder-status='dragging'] {
441
491
  --_reorder-curtain-filter: none;
442
492
  }
443
493
 
444
494
  /* Resizing styles */
445
- [part~='resize-handle'] {
495
+ .resize-handle {
446
496
  position: absolute;
447
497
  top: 0;
448
498
  inset-inline-end: 0;
@@ -456,17 +506,17 @@ export const gridStyles = css`
456
506
  translate: var(--_column-border-width);
457
507
  }
458
508
 
459
- [part~='last-column-cell'] [part~='resize-handle'] {
509
+ .last-column-cell .resize-handle {
460
510
  translate: 0;
461
511
  }
462
512
 
463
- :host(:not([reordering])) *:not([column-resizing]) [part='resize-handle']:hover,
464
- [part='resize-handle']:active {
513
+ :host(:not([reordering])) *:not([column-resizing]) .resize-handle:hover,
514
+ .resize-handle:active {
465
515
  opacity: 1;
466
516
  transition-delay: 0.15s;
467
517
  }
468
518
 
469
- [part~='resize-handle']::before {
519
+ .resize-handle::before {
470
520
  position: absolute;
471
521
  content: '';
472
522
  height: 100%;
@@ -474,25 +524,25 @@ export const gridStyles = css`
474
524
  translate: calc(-50% + var(--vaadin-focus-ring-width) / 2);
475
525
  }
476
526
 
477
- :host([dir='rtl']) [part~='resize-handle']::before {
527
+ :host([dir='rtl']) .resize-handle::before {
478
528
  translate: calc(50% - var(--vaadin-focus-ring-width) / 2);
479
529
  }
480
530
 
481
- [first-frozen-to-end] [part~='resize-handle']::before,
482
- :is([last-column], [last-frozen]) [part~='resize-handle']::before {
531
+ [first-frozen-to-end] .resize-handle::before,
532
+ :is([last-column], [last-frozen]) .resize-handle::before {
483
533
  width: 8px;
484
534
  translate: 0;
485
535
  }
486
536
 
487
- :is([last-column], [last-frozen]) [part~='resize-handle']::before {
537
+ :is([last-column], [last-frozen]) .resize-handle::before {
488
538
  inset-inline-end: 0;
489
539
  }
490
540
 
491
- [frozen-to-end] :is([part~='resize-handle'], [part~='resize-handle']::before) {
541
+ [frozen-to-end] :is(.resize-handle, .resize-handle::before) {
492
542
  inset-inline: 0 auto;
493
543
  }
494
544
 
495
- [frozen-to-end] [part~='resize-handle'] {
545
+ [frozen-to-end] .resize-handle {
496
546
  translate: calc(var(--_column-border-width) * -1);
497
547
  }
498
548
 
@@ -506,118 +556,96 @@ export const gridStyles = css`
506
556
  }
507
557
 
508
558
  /* Focus outline element, also used for d'n'd indication */
509
- :is([part~='row'], [part~='cell'])::after {
559
+ :is(.row, .cell)::after {
510
560
  position: absolute;
511
- inset: calc(var(--_row-border-width) * -1) calc(var(--_column-border-width) * -1);
512
561
  z-index: 3;
562
+ inset-inline: 0;
513
563
  pointer-events: none;
514
564
  outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
515
565
  outline-offset: calc(var(--vaadin-focus-ring-width) * -1);
516
566
  }
517
567
 
518
- [part~='first-column-cell']::after {
519
- inset-inline-start: 0;
520
- }
521
-
522
- [part~='last-column-cell']::after {
523
- inset-inline-end: 0;
524
- }
525
-
526
- #header [part~='row']:first-child::after,
527
- [part~='first-header-row-cell']::after,
528
- [part*='first-row']::after {
529
- top: 0;
568
+ .row::after {
569
+ transform: translateX(var(--_grid-horizontal-scroll-position));
530
570
  }
531
571
 
532
- table:has(#header > tr:not([hidden])) [part~='first-row-cell']::after {
533
- top: calc(var(--_row-border-width) * -1);
572
+ .cell:where(:not(.details-cell))::after {
573
+ inset-inline: calc(var(--_column-border-width) * -1);
534
574
  }
535
575
 
536
- #footer [part~='row']:last-child::after,
537
- [part~='last-footer-row-cell']::after,
538
- [part~='last-row']::after,
539
- [part~='last-row-cell']::after {
540
- bottom: 0;
576
+ .first-column-cell::after {
577
+ inset-inline-start: 0;
541
578
  }
542
579
 
543
- #header [part~='row']:last-child::after,
544
- table:has(#footer > tr:not([hidden])) [part*='last-row']::after {
545
- bottom: calc(var(--_row-border-width) * -1);
580
+ .last-column-cell::after {
581
+ inset-inline-end: 0;
546
582
  }
547
583
 
548
- :host([navigating]) [part~='row']:focus,
549
- :host([navigating]) [part~='cell']:focus {
584
+ :host([navigating]) .row:focus,
585
+ :host([navigating]) .cell:focus {
550
586
  outline: 0;
551
587
  }
552
588
 
553
- [part~='row']::after {
554
- transform: translateX(var(--_grid-horizontal-scroll-position));
555
- inset-inline: 0;
556
- bottom: 0;
557
- }
558
-
559
- [part~='row']:focus-visible,
560
- [part~='cell']:focus-visible {
589
+ .row:focus-visible,
590
+ .cell:focus-visible {
561
591
  outline: 0;
562
592
  }
563
593
 
564
- [part~='row']:focus-visible::after,
565
- [part~='cell']:focus-visible::after,
566
- :host([navigating]) [part~='row']:focus::after,
567
- :host([navigating]) [part~='cell']:focus::after {
594
+ .row:focus-visible::after,
595
+ .cell:focus-visible::after,
596
+ :host([navigating]) .row:focus::after,
597
+ :host([navigating]) .cell:focus::after {
568
598
  content: '';
569
599
  }
570
600
 
571
601
  /* Drag'n'drop styles */
572
602
  :host([dragover]) {
573
603
  outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
574
- outline-offset: calc(var(--_border-width) * -1);
604
+ outline-offset: calc(var(--vaadin-grid-border-width, 1px) * -1);
575
605
  }
576
606
 
577
- [part~='row'][dragover] {
607
+ .row[dragover] {
578
608
  z-index: 100 !important;
579
609
  }
580
610
 
581
- [part~='row'][dragover]::after {
611
+ .row[dragover]::after {
582
612
  content: '';
583
613
  }
584
614
 
585
- [part~='row'][dragover='above']::after {
615
+ .row[dragover='above']::after {
586
616
  outline: 0;
587
617
  border-top: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
588
618
  }
589
619
 
590
- [part~='row']:not([part*='first-row'])[dragover='above']::after,
591
- table:has(#header > tr:not([hidden])) [part*='first-row'][dragover='above']::after {
620
+ .row:not(.first-row)[dragover='above']::after {
592
621
  top: calc(var(--vaadin-focus-ring-width) / -2);
593
622
  }
594
623
 
595
- [part~='row'][dragover='below']::after {
624
+ .row[dragover='below']::after {
596
625
  outline: 0;
597
626
  border-bottom: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
598
627
  }
599
628
 
600
- [part~='row']:not([part*='last-row'])[dragover='below']::after,
601
- table:has(#footer > tr:not([hidden])) [part*='last-row'][dragover='below']::after {
629
+ .row:not(.last-row)[dragover='below']::after {
602
630
  bottom: calc(var(--vaadin-focus-ring-width) / -2);
603
631
  }
604
632
 
605
- [part~='row'][dragstart] [part~='cell'] {
606
- border-block-color: transparent !important;
607
- box-shadow: none;
633
+ .row[dragstart] .cell {
634
+ border-block: none !important;
635
+ padding-block: var(--_row-border-width) !important;
608
636
  }
609
637
 
610
- [part~='row'][dragstart] [part~='cell'][last-column] {
638
+ .row[dragstart] .cell[last-column] {
611
639
  border-radius: 0 3px 3px 0;
612
640
  }
613
641
 
614
- [part~='row'][dragstart] [part~='cell'][first-column] {
642
+ .row[dragstart] .cell[first-column] {
615
643
  border-radius: 3px 0 0 3px;
616
644
  }
617
645
 
618
646
  /* Indicates the number of dragged rows */
619
647
  /* TODO export custom properties to control styles */
620
- #scroller [part~='row'][dragstart]:not([dragstart=''])::before {
648
+ #scroller .row[dragstart]:not([dragstart=''])::before {
621
649
  position: absolute;
622
650
  left: var(--_grid-drag-start-x);
623
651
  top: var(--_grid-drag-start-y);
@@ -641,12 +669,12 @@ export const gridStyles = css`
641
669
  visibility: hidden;
642
670
  }
643
671
 
644
- #sizer [part~='details-cell'],
645
- #sizer [part~='cell'] ::slotted(vaadin-grid-cell-content) {
672
+ #sizer .details-cell,
673
+ #sizer .cell ::slotted(vaadin-grid-cell-content) {
646
674
  display: none !important;
647
675
  }
648
676
 
649
- #sizer [part~='cell'] {
677
+ #sizer .cell {
650
678
  display: block;
651
679
  flex-shrink: 0;
652
680
  line-height: 0;
@@ -657,19 +685,7 @@ export const gridStyles = css`
657
685
  border: none !important;
658
686
  }
659
687
 
660
- #sizer [part~='cell']::before {
688
+ #sizer .cell::before {
661
689
  content: '-';
662
690
  }
663
-
664
- @media (forced-colors: active) {
665
- :host([overflow~='top']) [part~='last-header-row-cell'] {
666
- border-bottom: var(--_row-border-width) solid;
667
- margin-bottom: calc(var(--_row-border-width) * -1);
668
- }
669
-
670
- :host([overflow~='bottom']) [part~='first-footer-row-cell'] {
671
- border-top: var(--_row-border-width) solid;
672
- margin-top: calc(var(--_row-border-width) * -1);
673
- }
674
- }
675
691
  `;