react-data-grid
Version:
Feature-rich and customizable data grid React component
80 lines (64 loc) • 2.25 kB
text/typescript
import { css } from 'ecij';
export const row = css`
@layer rdg.Row {
display: grid;
grid-column: 1/-1;
grid-template: subgrid / subgrid;
background-color: var(--rdg-background-color);
&:hover {
background-color: var(--rdg-row-hover-background-color);
}
&:focus {
outline: none;
}
&[tabindex='0'] {
/* we render the outline in a pseudo element as otherwise cells render above it */
&::after {
content: '';
grid-column: 1 / -1;
z-index: 1;
pointer-events: none;
border: var(--rdg-selection-width) solid var(--rdg-selection-color);
}
& > .rdg-cell-frozen-start:first-child::before,
& > .rdg-cell-frozen-end:last-child::after {
content: '';
display: inline-block;
position: absolute;
inset-block: 0;
}
& > .rdg-cell-frozen-start:first-child::before {
inset-inline-start: 0;
border-inline-start: var(--rdg-selection-width) solid var(--rdg-selection-color);
}
& > .rdg-cell-frozen-end:last-child::after {
inset-inline-end: 0;
border-inline-end: var(--rdg-selection-width) solid var(--rdg-selection-color);
}
}
&[aria-selected='true'] {
background-color: var(--rdg-row-selected-background-color);
&:hover {
background-color: var(--rdg-row-selected-hover-background-color);
}
@media (forced-colors: active) {
/* CanvasText is not guaranteed to contrast with SelectedItem */
--rdg-selection-color: SelectedItemText;
--rdg-checkbox-focus-color: SelectedItemText;
/*
* Set on the property rather than on the selected row tokens,
* so the selection stays visible when apps override the tokens.
* There is no text color, so text keeps its forced color, and Chromium draws a backplate behind it.
*/
&,
&:hover {
background-color: SelectedItem;
}
}
}
}
`;
export const rowClassname = `rdg-row ${row}`;
export const rowActiveClassname = 'rdg-row-active';
export const topSummaryRowClassname = 'rdg-top-summary-row';
export const bottomSummaryRowClassname = 'rdg-bottom-summary-row';