@wovenui/components 0.0.0-stage → 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +284 -2
- package/dist/components.json +4204 -0
- package/dist/llms-full.txt +2839 -0
- package/dist/wovenui-kit.css +5002 -0
- package/dist/wovenui-kit.css.map +1 -0
- package/dist/wovenui-kit.iife.js +532 -0
- package/dist/wovenui-kit.js +529 -0
- package/dist/wovenui-kit.min.css +2 -0
- package/dist/wovenui-kit.min.css.map +1 -0
- package/package.json +268 -4
- package/src/_close.scss +45 -0
- package/src/_helpers.scss +11 -0
- package/src/_kit.scss +124 -0
- package/src/_shared.scss +10 -0
- package/src/components/_accordion.scss +132 -0
- package/src/components/_alert.scss +161 -0
- package/src/components/_autocomplete.scss +129 -0
- package/src/components/_avatar-group.scss +80 -0
- package/src/components/_avatar.scss +134 -0
- package/src/components/_badge.scss +91 -0
- package/src/components/_breadcrumb.scss +115 -0
- package/src/components/_btn-group.scss +113 -0
- package/src/components/_button.scss +301 -0
- package/src/components/_card.scss +120 -0
- package/src/components/_checkbox.scss +168 -0
- package/src/components/_code-block.scss +78 -0
- package/src/components/_confirm-modal.scss +75 -0
- package/src/components/_data-table.scss +79 -0
- package/src/components/_desc-list.scss +180 -0
- package/src/components/_divider.scss +66 -0
- package/src/components/_dot.scss +115 -0
- package/src/components/_drawer.scss +200 -0
- package/src/components/_dropdown.scss +182 -0
- package/src/components/_empty-state.scss +146 -0
- package/src/components/_field-group.scss +68 -0
- package/src/components/_field-message.scss +75 -0
- package/src/components/_field.scss +127 -0
- package/src/components/_form-actions.scss +58 -0
- package/src/components/_info-row.scss +69 -0
- package/src/components/_input-group.scss +87 -0
- package/src/components/_input.scss +278 -0
- package/src/components/_list.scss +76 -0
- package/src/components/_modal.scss +168 -0
- package/src/components/_page-header.scss +85 -0
- package/src/components/_pagination.scss +138 -0
- package/src/components/_panel.scss +69 -0
- package/src/components/_popover.scss +154 -0
- package/src/components/_progress-circle.scss +123 -0
- package/src/components/_progress.scss +122 -0
- package/src/components/_radio.scss +162 -0
- package/src/components/_segmented.scss +183 -0
- package/src/components/_select.scss +154 -0
- package/src/components/_sidebar.scss +300 -0
- package/src/components/_skeleton.scss +90 -0
- package/src/components/_spinner.scss +84 -0
- package/src/components/_stat.scss +92 -0
- package/src/components/_table.scss +460 -0
- package/src/components/_tabs.scss +327 -0
- package/src/components/_tag.scss +143 -0
- package/src/components/_text.scss +42 -0
- package/src/components/_textarea.scss +57 -0
- package/src/components/_timeline.scss +196 -0
- package/src/components/_title.scss +41 -0
- package/src/components/_toast.scss +221 -0
- package/src/components/_toggle.scss +171 -0
- package/src/components/_toolbar.scss +74 -0
- package/src/components/_topbar.scss +204 -0
- package/src/entries/accordion.scss +4 -0
- package/src/entries/alert.scss +4 -0
- package/src/entries/autocomplete.scss +4 -0
- package/src/entries/avatar-group.scss +4 -0
- package/src/entries/avatar.scss +4 -0
- package/src/entries/badge.scss +4 -0
- package/src/entries/breadcrumb.scss +4 -0
- package/src/entries/btn-group.scss +4 -0
- package/src/entries/button.scss +4 -0
- package/src/entries/card.scss +4 -0
- package/src/entries/checkbox.scss +4 -0
- package/src/entries/code-block.scss +4 -0
- package/src/entries/confirm-modal.scss +4 -0
- package/src/entries/data-table.scss +4 -0
- package/src/entries/desc-list.scss +4 -0
- package/src/entries/divider.scss +4 -0
- package/src/entries/dot.scss +4 -0
- package/src/entries/drawer.scss +4 -0
- package/src/entries/dropdown.scss +4 -0
- package/src/entries/empty-state.scss +4 -0
- package/src/entries/field-group.scss +4 -0
- package/src/entries/field-message.scss +4 -0
- package/src/entries/field.scss +4 -0
- package/src/entries/form-actions.scss +4 -0
- package/src/entries/info-row.scss +4 -0
- package/src/entries/input-group.scss +4 -0
- package/src/entries/input.scss +4 -0
- package/src/entries/list.scss +4 -0
- package/src/entries/modal.scss +4 -0
- package/src/entries/page-header.scss +4 -0
- package/src/entries/pagination.scss +4 -0
- package/src/entries/panel.scss +4 -0
- package/src/entries/popover.scss +4 -0
- package/src/entries/progress-circle.scss +4 -0
- package/src/entries/progress.scss +4 -0
- package/src/entries/radio.scss +4 -0
- package/src/entries/segmented.scss +4 -0
- package/src/entries/select.scss +4 -0
- package/src/entries/sidebar.scss +4 -0
- package/src/entries/skeleton.scss +4 -0
- package/src/entries/spinner.scss +4 -0
- package/src/entries/stat.scss +4 -0
- package/src/entries/table.scss +4 -0
- package/src/entries/tabs.scss +4 -0
- package/src/entries/tag.scss +4 -0
- package/src/entries/text.scss +4 -0
- package/src/entries/textarea.scss +4 -0
- package/src/entries/timeline.scss +4 -0
- package/src/entries/title.scss +4 -0
- package/src/entries/toast.scss +4 -0
- package/src/entries/toggle.scss +4 -0
- package/src/entries/toolbar.scss +4 -0
- package/src/entries/topbar.scss +4 -0
- package/src/index.scss +7 -0
- package/src/js/autocomplete.js +86 -0
- package/src/js/data-table.js +141 -0
- package/src/js/index.js +34 -0
- package/src/js/input-clear.js +25 -0
- package/src/js/package.json +3 -0
- package/src/js/tabs.js +73 -0
- package/src/js/toast.js +161 -0
- package/src/js/util.js +21 -0
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
////
|
|
2
|
+
//// @component wu-table
|
|
3
|
+
//// Data table with sticky header and columns, selection, expandable rows, truncated cells, a summary row and striped styles.
|
|
4
|
+
////
|
|
5
|
+
//// Put a wide table in a `wu-table-scroll` region with `tabindex="0"`, `role="region"` and an `aria-label`; it shows scroll shadows on the sides with more content. Sticky columns need that region.
|
|
6
|
+
////
|
|
7
|
+
//// The select-all checkbox and expandable rows need the kit script; everything else is CSS. Sorting the rows and updating `aria-sort` is up to your script.
|
|
8
|
+
////
|
|
9
|
+
//// A truncated cell takes the full text in core's `data-tooltip` and `tabindex="0"`. `aria-selected` on a row is valid only in a `role="grid"` table.
|
|
10
|
+
////
|
|
11
|
+
//// @since 1.0.0
|
|
12
|
+
//// @needs none
|
|
13
|
+
//// @js optional initTable
|
|
14
|
+
//// @example html
|
|
15
|
+
//// <div class="wu-table-scroll" tabindex="0" role="region" aria-label="Invoices">
|
|
16
|
+
//// <table class="wu-table striped hover">
|
|
17
|
+
//// <caption>Open invoices</caption>
|
|
18
|
+
//// <thead>
|
|
19
|
+
//// <tr>
|
|
20
|
+
//// <th scope="col">Invoice</th>
|
|
21
|
+
//// <th scope="col" class="wu-table-num">Amount</th>
|
|
22
|
+
//// </tr>
|
|
23
|
+
//// </thead>
|
|
24
|
+
//// <tbody>
|
|
25
|
+
//// <tr><th scope="row">INV-1042</th><td class="wu-table-num">$1,200.00</td></tr>
|
|
26
|
+
//// <tr><th scope="row">INV-1043</th><td class="wu-table-num">$340.00</td></tr>
|
|
27
|
+
//// </tbody>
|
|
28
|
+
//// <tfoot><tr><th scope="row">Total</th><td class="wu-table-num">$1,540.00</td></tr></tfoot>
|
|
29
|
+
//// </table>
|
|
30
|
+
//// </div>
|
|
31
|
+
//// @example html
|
|
32
|
+
//// <table class="wu-table">
|
|
33
|
+
//// <thead>
|
|
34
|
+
//// <tr>
|
|
35
|
+
//// <th scope="col" class="wu-table-select"><input type="checkbox" class="wu-checkbox-input" aria-label="Select all rows"></th>
|
|
36
|
+
//// <th scope="col" aria-sort="ascending"><button class="wu-table-sort" type="button">Name</button></th>
|
|
37
|
+
//// </tr>
|
|
38
|
+
//// </thead>
|
|
39
|
+
//// <tbody>
|
|
40
|
+
//// <tr>
|
|
41
|
+
//// <td class="wu-table-select"><input type="checkbox" class="wu-checkbox-input" aria-label="Select Ana Lopez"></td>
|
|
42
|
+
//// <th scope="row"><button class="wu-table-expand" type="button" aria-expanded="false" aria-label="Details for Ana Lopez"></button> Ana Lopez</th>
|
|
43
|
+
//// </tr>
|
|
44
|
+
//// <tr class="wu-table-detail" hidden><td colspan="2">Owner since 2021</td></tr>
|
|
45
|
+
//// </tbody>
|
|
46
|
+
//// </table>
|
|
47
|
+
//// @example html
|
|
48
|
+
//// <table class="wu-table">
|
|
49
|
+
//// <tbody>
|
|
50
|
+
//// <tr><td class="wu-table-truncate" tabindex="0" data-tooltip="Typo on the billing page"><span>Typo on the billing page</span></td></tr>
|
|
51
|
+
//// </tbody>
|
|
52
|
+
//// </table>
|
|
53
|
+
//// @modifier sm - Tighter cell padding @since 1.0.0
|
|
54
|
+
//// @modifier striped - Tint on every second body row @since 1.0.0
|
|
55
|
+
//// @modifier hover - Tint on the row under the pointer @since 1.0.0
|
|
56
|
+
//// @modifier bordered - Outer border with rounded corners and borders between cells @since 1.0.0
|
|
57
|
+
//// @modifier sticky-header - Header cells stick to the top of the page, or of the scroll region when `--wu-table--MaxHeight` is set @since 1.0.0
|
|
58
|
+
//// @modifier sticky-start | sticky-end - First or last column sticks inside a `wu-table-scroll` region, with an edge shadow on the scrolling side @since 1.0.0
|
|
59
|
+
//// @modifier animated - Spring turn of the expand chevron when the user allows motion; `wu-animated` on an ancestor does the same @since 1.0.0
|
|
60
|
+
//// @part wu-table-scroll - Scroll region for a wide table, with scroll shadows @since 1.0.0
|
|
61
|
+
//// @part wu-table-num - Cell with end-aligned numbers in tabular figures @since 1.0.0
|
|
62
|
+
//// @part wu-table-select - Cell of a checkbox column, as narrow as its checkbox @since 1.0.0
|
|
63
|
+
//// @part wu-table-truncate - Cell whose text child stays on one line with an ellipsis @since 1.0.0
|
|
64
|
+
//// @part wu-table-sort - Button in a header cell that shows sort arrows @since 1.0.0
|
|
65
|
+
//// @part wu-table-expand - Button with `aria-expanded` that shows or hides the detail row @since 1.0.0
|
|
66
|
+
//// @part wu-table-detail - Row after an expandable row, with the alternate background @since 1.0.0
|
|
67
|
+
//// @variable --wu-table--Background [var(--wu-bg-surface)] - Background that scroll shadows and sticky cells blend into @since 1.0.0
|
|
68
|
+
//// @variable --wu-table--MaxHeight [none] - Maximum height of the scroll region, so the header can stick inside it @since 1.0.0
|
|
69
|
+
//// @variable --wu-table--TruncateWidth [16rem] - Maximum width of a truncated cell text @since 1.0.0
|
|
70
|
+
//// @state aria-sort="ascending" | aria-sort="descending" - On a header cell: one arrow on the sort button and regular text color @since 1.0.0
|
|
71
|
+
//// @state aria-expanded="true" - On an expand button: the chevron points down @since 1.0.0
|
|
72
|
+
//// @state aria-selected="true" - On a row: selected tint and a bar at the start of the first cell; a checked `wu-table-select` box does the same @since 1.0.0
|
|
73
|
+
////
|
|
74
|
+
|
|
75
|
+
@use "@wovenui/core/mixins" as woven;
|
|
76
|
+
|
|
77
|
+
$bg: var(--wu-table--Background, #{woven.token(bg-surface)});
|
|
78
|
+
$shadow: color-mix(in srgb, #{woven.token(text-regular)} 15%, transparent);
|
|
79
|
+
$tint: color-mix(in srgb, #{woven.token(text-regular)} 4%, transparent);
|
|
80
|
+
$tint-hover: color-mix(in srgb, #{woven.token(text-regular)} 7%, transparent);
|
|
81
|
+
|
|
82
|
+
// Row tint of a cell, read again by sticky cells so they stay opaque
|
|
83
|
+
$row-tint: var(--wu-kit-table-tint, transparent);
|
|
84
|
+
|
|
85
|
+
// Wide tables: <div class="wu-table-scroll" tabindex="0" role="region" aria-label>.
|
|
86
|
+
// Scroll shadows show on the sides with more content; translucent row tints keep them visible.
|
|
87
|
+
.wu-table-scroll {
|
|
88
|
+
max-block-size: var(--wu-table--MaxHeight, none);
|
|
89
|
+
overflow: auto;
|
|
90
|
+
background:
|
|
91
|
+
linear-gradient(to right, #{$bg} 50%, transparent) left / #{woven.token(space-8)} 100% no-repeat local,
|
|
92
|
+
linear-gradient(to left, #{$bg} 50%, transparent) right / #{woven.token(space-8)} 100% no-repeat local,
|
|
93
|
+
linear-gradient(to right, #{$shadow}, transparent) left / #{woven.token(space-3)} 100% no-repeat scroll,
|
|
94
|
+
linear-gradient(to left, #{$shadow}, transparent) right / #{woven.token(space-3)} 100% no-repeat scroll,
|
|
95
|
+
#{$bg};
|
|
96
|
+
|
|
97
|
+
&:focus-visible {
|
|
98
|
+
outline: woven.token(border-focus-width) solid woven.token(border-focus);
|
|
99
|
+
outline-offset: woven.token(border-focus-offset);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Separate borders, so a sticky header keeps its edge and bordered can round its corners
|
|
104
|
+
.wu-table {
|
|
105
|
+
width: 100%;
|
|
106
|
+
border-collapse: separate;
|
|
107
|
+
border-spacing: 0;
|
|
108
|
+
color: woven.token(text-regular);
|
|
109
|
+
font-size: woven.token(font-size-sm);
|
|
110
|
+
line-height: woven.token(line-height-normal);
|
|
111
|
+
|
|
112
|
+
> caption {
|
|
113
|
+
padding-block-end: woven.token(space-2);
|
|
114
|
+
color: woven.token(text-muted);
|
|
115
|
+
text-align: start;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:is(th, td) {
|
|
119
|
+
padding-block: woven.token(space-3);
|
|
120
|
+
padding-inline: woven.token(space-4);
|
|
121
|
+
border-block-end: woven.token(border-width-1) solid woven.token(border-regular);
|
|
122
|
+
text-align: start;
|
|
123
|
+
vertical-align: middle;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
> thead th {
|
|
127
|
+
border-block-end-color: woven.token(border-strong);
|
|
128
|
+
color: woven.token(text-muted);
|
|
129
|
+
font-weight: woven.token(font-weight-semibold);
|
|
130
|
+
white-space: nowrap;
|
|
131
|
+
vertical-align: bottom;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
> tbody th {
|
|
135
|
+
font-weight: woven.token(font-weight-medium);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Summary row: semibold, with a strong line above it
|
|
139
|
+
> tfoot :is(th, td) {
|
|
140
|
+
color: woven.token(text-regular);
|
|
141
|
+
font-weight: woven.token(font-weight-semibold);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
> tbody:has(+ tfoot) > tr:nth-last-child(1 of :not([hidden])) > * {
|
|
145
|
+
border-block-end-color: woven.token(border-strong);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
> :is(tbody, tfoot):last-child > tr:last-child > * {
|
|
149
|
+
border-block-end: 0;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Numbers: end-aligned, same digit widths
|
|
154
|
+
.wu-table .wu-table-num {
|
|
155
|
+
font-variant-numeric: tabular-nums;
|
|
156
|
+
text-align: end;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Selection column: as narrow as its checkbox
|
|
160
|
+
.wu-table .wu-table-select {
|
|
161
|
+
inline-size: 1px;
|
|
162
|
+
|
|
163
|
+
> input {
|
|
164
|
+
margin: 0;
|
|
165
|
+
vertical-align: middle;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Truncated text with an ellipsis at the inline end; core's data-tooltip on the cell shows the full text
|
|
170
|
+
.wu-table .wu-table-truncate {
|
|
171
|
+
> * {
|
|
172
|
+
display: block;
|
|
173
|
+
max-inline-size: var(--wu-table--TruncateWidth, 16rem);
|
|
174
|
+
overflow: hidden;
|
|
175
|
+
text-overflow: ellipsis;
|
|
176
|
+
white-space: nowrap;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&:focus-visible {
|
|
180
|
+
outline: woven.token(border-focus-width) solid woven.token(border-focus);
|
|
181
|
+
outline-offset: calc(-1 * #{woven.token(border-focus-width)});
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Sort control: <th aria-sort="ascending"><button class="wu-table-sort">Name</button></th>.
|
|
186
|
+
// Arrows drawn with clip-path: both dim when unsorted, one when sorted.
|
|
187
|
+
.wu-table-sort {
|
|
188
|
+
display: inline-flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
gap: woven.token(space-1);
|
|
191
|
+
min-height: 0;
|
|
192
|
+
margin: 0;
|
|
193
|
+
padding: 0;
|
|
194
|
+
border: 0;
|
|
195
|
+
border-radius: woven.token(radius-xs);
|
|
196
|
+
background: none;
|
|
197
|
+
color: inherit;
|
|
198
|
+
font: inherit;
|
|
199
|
+
text-align: inherit;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
|
|
202
|
+
&::after {
|
|
203
|
+
content: "";
|
|
204
|
+
flex: none;
|
|
205
|
+
width: 8px;
|
|
206
|
+
height: 12px;
|
|
207
|
+
background: woven.token(text-subtle);
|
|
208
|
+
clip-path: path("M4 0L8 5H0Z M0 7H8L4 12Z");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&:hover {
|
|
212
|
+
color: woven.token(text-regular);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
&:focus-visible {
|
|
216
|
+
outline: woven.token(border-focus-width) solid woven.token(border-focus);
|
|
217
|
+
outline-offset: woven.token(border-focus-offset);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.wu-table th:is([aria-sort="ascending"], [aria-sort="descending"]) {
|
|
222
|
+
color: woven.token(text-regular);
|
|
223
|
+
|
|
224
|
+
> .wu-table-sort::after {
|
|
225
|
+
background: currentcolor;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.wu-table th[aria-sort="ascending"] > .wu-table-sort::after {
|
|
230
|
+
clip-path: path("M4 3.5L8 8.5H0Z");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.wu-table th[aria-sort="descending"] > .wu-table-sort::after {
|
|
234
|
+
clip-path: path("M0 3.5H8L4 8.5Z");
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Expand toggle: <button class="wu-table-expand" aria-expanded="false" aria-label>; the kit script shows the
|
|
238
|
+
// wu-table-detail row after it. The closed chevron points to the inline end, the open one down.
|
|
239
|
+
.wu-table-expand {
|
|
240
|
+
display: inline-grid;
|
|
241
|
+
place-content: center;
|
|
242
|
+
width: woven.token(space-6);
|
|
243
|
+
height: woven.token(space-6);
|
|
244
|
+
min-height: 0;
|
|
245
|
+
margin: 0;
|
|
246
|
+
margin-inline-end: woven.token(space-1);
|
|
247
|
+
padding: 0;
|
|
248
|
+
border: 0;
|
|
249
|
+
border-radius: woven.token(radius-xs);
|
|
250
|
+
background: none;
|
|
251
|
+
color: woven.token(text-muted);
|
|
252
|
+
vertical-align: middle;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
|
|
255
|
+
&::before {
|
|
256
|
+
content: "";
|
|
257
|
+
width: 6px;
|
|
258
|
+
height: 10px;
|
|
259
|
+
background: currentcolor;
|
|
260
|
+
clip-path: path("M0 0L6 5L0 10Z");
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
&:dir(rtl)::before {
|
|
264
|
+
rotate: 180deg;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
&[aria-expanded="true"]::before {
|
|
268
|
+
rotate: 90deg;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&:hover {
|
|
272
|
+
background: woven.token(bg-hover);
|
|
273
|
+
color: woven.token(text-regular);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
&:focus-visible {
|
|
277
|
+
outline: woven.token(border-focus-width) solid woven.token(border-focus);
|
|
278
|
+
outline-offset: woven.token(border-focus-offset);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
283
|
+
.wu-table.animated .wu-table-expand::before,
|
|
284
|
+
.wu-animated .wu-table .wu-table-expand::before {
|
|
285
|
+
transition: rotate woven.token(duration-150) woven.token(ease-out);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.wu-table.sm :is(th, td) {
|
|
290
|
+
padding-block: woven.token(space-2);
|
|
291
|
+
padding-inline: woven.token(space-3);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Row tints set --wu-kit-table-tint too, so sticky cells can lay the same tint over an opaque background
|
|
295
|
+
.wu-table.striped > tbody > tr:where(:nth-child(even of :not(.wu-table-detail))) > * {
|
|
296
|
+
--wu-kit-table-tint: #{$tint};
|
|
297
|
+
|
|
298
|
+
background: $row-tint;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.wu-table.hover > tbody > tr:where(:hover) > * {
|
|
302
|
+
--wu-kit-table-tint: #{$tint-hover};
|
|
303
|
+
|
|
304
|
+
background: $row-tint;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Selected row: a checked wu-table-select checkbox, or aria-selected="true" in a role="grid" table.
|
|
308
|
+
// Same weight as striped and hover (their pseudo-classes sit in :where), and later, so it wins.
|
|
309
|
+
// A start bar on the first cell is the cue that is not color.
|
|
310
|
+
.wu-table > tbody > tr:is([aria-selected="true"], :has(> :where(.wu-table-select) :checked)) {
|
|
311
|
+
> * {
|
|
312
|
+
--wu-kit-table-tint: #{woven.token(bg-selected)};
|
|
313
|
+
|
|
314
|
+
background: $row-tint;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
> :first-child {
|
|
318
|
+
box-shadow: inset woven.token(border-width-2) 0 0 woven.token(brand);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
> :first-child:dir(rtl) {
|
|
322
|
+
box-shadow: inset calc(-1 * #{woven.token(border-width-2)}) 0 0 woven.token(brand);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// Detail row of an expandable row, after the row it belongs to
|
|
327
|
+
.wu-table > tbody > tr.wu-table-detail > * {
|
|
328
|
+
background: woven.token(bg-alternate);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.wu-table.bordered {
|
|
332
|
+
border: woven.token(border-width-1) solid woven.token(border-regular);
|
|
333
|
+
border-radius: woven.token(radius-md);
|
|
334
|
+
|
|
335
|
+
:is(th, td) + :is(th, td) {
|
|
336
|
+
border-inline-start: woven.token(border-width-1) solid woven.token(border-regular);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Sticks to the top of the page, or of .wu-table-scroll when --wu-table--MaxHeight is set
|
|
341
|
+
.wu-table.sticky-header > thead th {
|
|
342
|
+
position: sticky;
|
|
343
|
+
inset-block-start: 0;
|
|
344
|
+
z-index: woven.token(z-hover);
|
|
345
|
+
background: $bg;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// Shadow under the header only once it is stuck; the header border is the fallback
|
|
349
|
+
@supports (container-type: scroll-state) {
|
|
350
|
+
.wu-table.sticky-header > thead th {
|
|
351
|
+
container-type: scroll-state;
|
|
352
|
+
|
|
353
|
+
&::after {
|
|
354
|
+
content: "";
|
|
355
|
+
position: absolute;
|
|
356
|
+
inset-inline: 0;
|
|
357
|
+
inset-block-start: 100%;
|
|
358
|
+
height: woven.token(space-2);
|
|
359
|
+
background: linear-gradient(#{$shadow}, transparent);
|
|
360
|
+
opacity: 0;
|
|
361
|
+
pointer-events: none;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@container scroll-state(stuck: top) {
|
|
366
|
+
.wu-table.sticky-header > thead th::after {
|
|
367
|
+
opacity: 1;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Sticky first and last columns, inside a wu-table-scroll region. The edge shadow falls on the scrolling side.
|
|
373
|
+
$sticky-start: ".wu-table.sticky-start > * > tr:where(:not(.wu-table-detail)) > :first-child";
|
|
374
|
+
$sticky-end: ".wu-table.sticky-end > * > tr:where(:not(.wu-table-detail)) > :last-child";
|
|
375
|
+
|
|
376
|
+
#{$sticky-start},
|
|
377
|
+
#{$sticky-end} {
|
|
378
|
+
position: sticky;
|
|
379
|
+
z-index: woven.token(z-base);
|
|
380
|
+
background:
|
|
381
|
+
linear-gradient(#{$row-tint}, #{$row-tint}),
|
|
382
|
+
#{$bg};
|
|
383
|
+
|
|
384
|
+
&::before {
|
|
385
|
+
content: "";
|
|
386
|
+
position: absolute;
|
|
387
|
+
inset-block: 0;
|
|
388
|
+
width: woven.token(space-2);
|
|
389
|
+
pointer-events: none;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
#{$sticky-start} {
|
|
394
|
+
inset-inline-start: 0;
|
|
395
|
+
|
|
396
|
+
&::before {
|
|
397
|
+
inset-inline-start: 100%;
|
|
398
|
+
background: linear-gradient(to right, #{$shadow}, transparent);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
&:dir(rtl)::before {
|
|
402
|
+
background: linear-gradient(to left, #{$shadow}, transparent);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
#{$sticky-end} {
|
|
407
|
+
inset-inline-end: 0;
|
|
408
|
+
|
|
409
|
+
&::before {
|
|
410
|
+
inset-inline-end: 100%;
|
|
411
|
+
background: linear-gradient(to left, #{$shadow}, transparent);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
&:dir(rtl)::before {
|
|
415
|
+
background: linear-gradient(to right, #{$shadow}, transparent);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Header cells of sticky columns stay above the sticky header and the body
|
|
420
|
+
.wu-table.sticky-start > thead > tr > :first-child,
|
|
421
|
+
.wu-table.sticky-end > thead > tr > :last-child {
|
|
422
|
+
z-index: calc(#{woven.token(z-hover)} + 1);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Longhands on purpose: minifiers fold them with animation-timeline into a shorthand some browsers drop.
|
|
426
|
+
// Shadow fades in over the first space-8 of scroll and out over the last, linked to the region's inline scroll.
|
|
427
|
+
// No scroll, or no region: no shadow. Without scroll timelines the shadow stays static.
|
|
428
|
+
@supports (animation-timeline: scroll()) {
|
|
429
|
+
.wu-table-scroll {
|
|
430
|
+
scroll-timeline: --wu-table-scroll inline;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
#{$sticky-start}::before,
|
|
434
|
+
#{$sticky-end}::before {
|
|
435
|
+
opacity: 0;
|
|
436
|
+
animation-name: wu-table-edge;
|
|
437
|
+
animation-timing-function: linear;
|
|
438
|
+
animation-fill-mode: both;
|
|
439
|
+
animation-timeline: --wu-table-scroll;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
#{$sticky-start}::before {
|
|
443
|
+
animation-range: 0 #{woven.token(space-8)};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
#{$sticky-end}::before {
|
|
447
|
+
animation-direction: reverse;
|
|
448
|
+
animation-range: calc(100% - #{woven.token(space-8)}) 100%;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
@keyframes wu-table-edge {
|
|
453
|
+
from {
|
|
454
|
+
opacity: 0;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
to {
|
|
458
|
+
opacity: 1;
|
|
459
|
+
}
|
|
460
|
+
}
|