-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathcore.ts
More file actions
111 lines (93 loc) · 3.35 KB
/
core.ts
File metadata and controls
111 lines (93 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { css } from 'ecij';
import { cell } from './cell';
import { bottomSummaryRowClassname, row, topSummaryRowClassname } from './row';
const root = css`
@layer rdg.Defaults {
*,
*::before,
*::after {
box-sizing: inherit;
}
}
@layer rdg.Root {
--rdg-selection-width: 2px;
--rdg-selection-color: hsl(207, 75%, 66%);
--rdg-font-size: 14px;
--rdg-cell-frozen-box-shadow: 2px 0 5px -2px rgba(136, 136, 136, 0.3);
--rdg-border-width: 1px;
--rdg-summary-border-width: calc(var(--rdg-border-width) * 2);
--rdg-color: light-dark(#000, #ddd);
--rdg-border-color: light-dark(#ddd, #444);
--rdg-summary-border-color: light-dark(#aaa, #555);
--rdg-background-color: light-dark(hsl(0deg 0% 100%), hsl(0deg 0% 13%));
--rdg-header-background-color: light-dark(hsl(0deg 0% 97.5%), hsl(0deg 0% 10.5%));
--rdg-header-draggable-background-color: light-dark(hsl(0deg 0% 90.5%), hsl(0deg 0% 17.5%));
--rdg-row-hover-background-color: light-dark(hsl(0deg 0% 96%), hsl(0deg 0% 9%));
--rdg-row-selected-background-color: light-dark(hsl(207deg 76% 92%), hsl(207deg 76% 42%));
--rdg-row-selected-hover-background-color: light-dark(hsl(207deg 76% 88%), hsl(207deg 76% 38%));
--rdg-checkbox-focus-color: hsl(207deg 100% 69%);
&.rdg-dark {
color-scheme: dark;
}
&.rdg-light {
color-scheme: light;
}
&:dir(rtl) {
--rdg-cell-frozen-box-shadow: -2px 0 5px -2px rgba(136, 136, 136, 0.3);
}
display: grid;
accent-color: light-dark(hsl(207deg 100% 29%), hsl(207deg 100% 79%));
/* https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context */
/* We set a stacking context so internal elements don't render on top of external elements. */
/* size containment is not used as it could break "width: min-content" for example, and the grid would infinitely resize on Chromium browsers */
contain: content;
content-visibility: auto;
block-size: 350px;
border: 1px solid var(--rdg-border-color);
box-sizing: border-box;
overflow: auto;
background-color: var(--rdg-background-color);
color: var(--rdg-color);
font-size: var(--rdg-font-size);
/* needed on Firefox to fix scrollbars */
&::before {
content: '';
grid-column: 1/-1;
grid-row: 1/-1;
}
> :nth-last-child(1 of .${topSummaryRowClassname}) {
> .${cell} {
border-block-end: var(--rdg-summary-border-width) solid var(--rdg-summary-border-color);
}
}
> :nth-child(1 of .${bottomSummaryRowClassname}) {
> .${cell} {
border-block-start: var(--rdg-summary-border-width) solid var(--rdg-summary-border-color);
}
}
}
`;
export const rootClassname = `rdg ${root}`;
const viewportDragging = css`
@layer rdg.Root {
user-select: none;
& .${row} {
cursor: move;
}
}
`;
export const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;
export const focusSinkClassname = css`
@layer rdg.FocusSink {
grid-column: 1/-1;
pointer-events: none;
/* Should have a higher value than 1 to show up above regular frozen cells */
z-index: 1;
}
`;
export const focusSinkHeaderAndSummaryClassname = css`
@layer rdg.FocusSink {
/* Should have a higher value than 3 to show up above header and summary rows */
z-index: 3;
}
`;