|
2 | 2 | # DATA TABLE
|
3 | 3 | \*------------------------------------*/
|
4 | 4 |
|
5 |
| -/** |
6 |
| - * DataTable |
7 |
| - */ |
8 |
| - |
9 | 5 | /* Visible table caption */
|
| 6 | + /* TODO-AH: make it so that we have the search bar and actions wrap together instead of separately */ |
10 | 7 | .data-table__caption-container {
|
11 | 8 | display: flex;
|
12 | 9 | align-items: flex-end;
|
|
15 | 12 | gap: calc(var(--eds-size-3) / 16 * 1rem) calc(var(--eds-size-6) / 16 * 1rem);
|
16 | 13 |
|
17 | 14 | text-align: start;
|
18 |
| - margin: 0 calc(var(--eds-size-3) / 16 * 1rem) calc(var(--eds-size-4) / 16 * 1rem); |
| 15 | + margin: 0 calc(var(--eds-size-3) / 16 * 1rem) calc(var(--eds-size-4) / 16 * 1rem); |
19 | 16 | }
|
20 | 17 |
|
21 | 18 | .data-table__caption-text {
|
|
37 | 34 | }
|
38 | 35 |
|
39 | 36 | .data-table__table {
|
40 |
| - border: 1px solid; |
| 37 | + table-layout: fixed; |
41 | 38 | width: 100%;
|
42 | 39 |
|
| 40 | + /* add class instead of tag for styles? */ |
| 41 | + th, td { |
| 42 | + padding: 0; |
| 43 | + vertical-align: top; |
| 44 | + } |
| 45 | + |
43 | 46 | .data-table__caption + &,
|
44 | 47 | .data-table__subcaption + & {
|
45 | 48 | margin-top: calc(var(--eds-size-4) / 16 * 1rem);
|
|
50 | 53 | width: calc(var(--eds-size-34) / 16 * 1rem);
|
51 | 54 | }
|
52 | 55 |
|
| 56 | +.data-table--tableStyle-border { |
| 57 | + border: calc(var(--eds-border-width-sm) * 1px) solid; |
| 58 | +} |
| 59 | + |
| 60 | +.data-table__cell-text { |
| 61 | + text-align: start; |
| 62 | + |
| 63 | + .data-table__cell--alignment-leading & { |
| 64 | + text-align: start; |
| 65 | + } |
| 66 | + |
| 67 | + .data-table__cell--alignment-trailing & { |
| 68 | + text-align: end; |
| 69 | + } |
| 70 | +} |
| 71 | + |
| 72 | +.data-table__cell--alignment-leading { |
| 73 | + justify-content: flex-start; |
| 74 | +} |
| 75 | + |
| 76 | +.data-table__cell--alignment-trailing { |
| 77 | + justify-content: flex-end; |
| 78 | +} |
| 79 | + |
| 80 | +.data-table__cell-sublabel { |
| 81 | + display: block; |
| 82 | + font: var(--eds-theme-typography-body-sm); |
| 83 | +} |
| 84 | + |
| 85 | +.data-table__header-cell { |
| 86 | + display: flex; |
| 87 | + gap: calc(var(--eds-size-1) / 16 * 1rem); |
| 88 | + align-items: flex-start; |
| 89 | + font: var(--eds-theme-typography-title-md); |
| 90 | + |
| 91 | + .data-table--size-sm & { |
| 92 | + font: var(--eds-theme-typography-title-sm); |
| 93 | + /* TODO(bug): we want to use top-/bottom-padding of 5px (instead of 4px) to give overall height divisible by 8 (32px) */ |
| 94 | + padding: calc(var(--eds-size-half) / 16 * 1rem) calc(var(--eds-size-1) / 16 * 1rem); |
| 95 | + } |
| 96 | + |
| 97 | + .data-table--size-md & { |
| 98 | + padding: calc(var(--eds-size-2) / 16 * 1rem) calc(var(--eds-size-3) / 16 * 1rem); |
| 99 | + } |
| 100 | + |
| 101 | + .data-cell__cell--icon { |
| 102 | + margin-top: calc(var(--eds-size-1) / 16 * 1rem); |
| 103 | + flex-shrink: 0; |
| 104 | + |
| 105 | + .data-table--size-sm & { |
| 106 | + margin-top: calc(var(--eds-size-half) / 16 * 1rem); |
| 107 | + } |
| 108 | + } |
| 109 | +} |
| 110 | + |
| 111 | +.data-table__cell { |
| 112 | + display: flex; |
| 113 | + gap: calc(var(--eds-size-1) / 16 * 1rem); |
| 114 | + align-items: flex-start; |
| 115 | + font: var(--eds-theme-typography-body-md); |
| 116 | + |
| 117 | + .data-table--size-sm & { |
| 118 | + font: var(--eds-theme-typography-body-sm); |
| 119 | + padding: calc(var(--eds-size-half) / 16 * 1rem) calc(var(--eds-size-1) / 16 * 1rem); |
| 120 | + } |
| 121 | + |
| 122 | + .data-table--size-md & { |
| 123 | + padding: calc(var(--eds-size-2) / 16 * 1rem) calc(var(--eds-size-3) / 16 * 1rem); |
| 124 | + } |
| 125 | + |
| 126 | + .data-cell__cell--icon { |
| 127 | + margin-top: calc(var(--eds-size-half) / 16 * 1rem); |
| 128 | + flex-shrink: 0; |
| 129 | + } |
| 130 | +} |
| 131 | + |
| 132 | +.data-table__row { |
| 133 | + .data-table--rowStyle-lined & { |
| 134 | + border-bottom: calc(var(--eds-border-width-sm) * 1px) solid; |
| 135 | + } |
| 136 | + |
| 137 | + .data-table--rowStyle-striped &:nth-child(even) { |
| 138 | + background-color: var(--eds-theme-color-background-table-row-stripe-2); |
| 139 | + } |
| 140 | + |
| 141 | + .data-table--rowStyle-striped &:nth-child(odd) { |
| 142 | + background-color: var(--eds-theme-color-background-table-row-stripe-1); |
| 143 | + } |
| 144 | +} |
| 145 | + |
| 146 | +.data-table__header-row { |
| 147 | + border-bottom: calc(var(--eds-border-width-sm) * 1px) solid; |
| 148 | + position: sticky; |
| 149 | + top: 0; |
| 150 | +} |
| 151 | + |
53 | 152 | /**
|
54 | 153 | * Color Tokens
|
55 | 154 | */
|
56 | 155 | .data-table {
|
57 | 156 | display: block;
|
| 157 | + position: relative; |
| 158 | + |
| 159 | + .data-table__table { |
| 160 | + background-color: var(--eds-theme-color-background-utility-base-1); |
| 161 | + |
| 162 | + th { |
| 163 | + background-color: var(--eds-theme-color-background-utility-base-1); |
| 164 | + } |
| 165 | + } |
58 | 166 |
|
59 | 167 | .data-table__caption {
|
60 | 168 | color: var(--eds-theme-color-text-utility-default-primary);
|
|
63 | 171 | .data-table__subcaption {
|
64 | 172 | color: var(--eds-theme-color-text-utility-default-secondary);
|
65 | 173 | }
|
| 174 | + |
| 175 | + .data-table--tableStyle-border, .data-table__header-row { |
| 176 | + border-color: var(--eds-theme-color-border-utility-default-low-emphasis); |
| 177 | + } |
| 178 | + |
| 179 | + .data-table__header-cell { |
| 180 | + color: var(--eds-theme-color-text-utility-default-primary); |
| 181 | + } |
| 182 | + |
| 183 | + .data-table__cell { |
| 184 | + color: var(--eds-theme-color-text-utility-default-primary); |
| 185 | + } |
| 186 | + |
| 187 | + .data-table--rowStyle-lined { |
| 188 | + color: var(--eds-theme-color-border-utility-default-low-emphasis); |
| 189 | + } |
| 190 | + |
| 191 | + .data-table__cell-sublabel, .data-table__header-cell-sublabel { |
| 192 | + color: var(--eds-theme-color-text-utility-default-secondary); |
| 193 | + } |
66 | 194 | }
|
0 commit comments