@voidable/theme 0.7.0 → 0.8.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/README.md +133 -8
- package/package.json +66 -8
- package/src/app-shell/detail.css +7 -5
- package/src/app-shell/subtable.css +7 -6
- package/src/base.css +28 -0
- package/src/components/accordion.css +96 -19
- package/src/components/action-input.css +51 -61
- package/src/components/alert.css +63 -23
- package/src/components/avatar.css +0 -2
- package/src/components/badge.css +35 -25
- package/src/components/banner.css +60 -19
- package/src/components/bar-chart.css +10 -3
- package/src/components/breadcrumbs.css +20 -16
- package/src/components/button.css +130 -55
- package/src/components/calendar.css +40 -17
- package/src/components/card.css +122 -23
- package/src/components/carousel.css +85 -118
- package/src/components/checkbox-group.css +3 -1
- package/src/components/checkbox.css +18 -23
- package/src/components/collapsible.css +95 -29
- package/src/components/color-picker.css +10 -10
- package/src/components/combobox.css +47 -29
- package/src/components/compose-input.css +3 -3
- package/src/components/dialog.css +115 -41
- package/src/components/divider.css +7 -4
- package/src/components/donut-chart.css +25 -15
- package/src/components/drawer.css +135 -68
- package/src/components/dropdown-menu.css +21 -43
- package/src/components/editable.css +7 -7
- package/src/components/error-fallback.css +48 -27
- package/src/components/field.css +12 -5
- package/src/components/file-upload.css +2 -1
- package/src/components/gauge.css +35 -23
- package/src/components/hamburger.css +10 -10
- package/src/components/hover-card.css +13 -113
- package/src/components/indicator.css +22 -18
- package/src/components/input.css +15 -12
- package/src/components/line-chart.css +10 -10
- package/src/components/list.css +28 -7
- package/src/components/menu.css +48 -33
- package/src/components/multiselect.css +57 -40
- package/src/components/nav-bar.css +23 -14
- package/src/components/nav-menu.css +31 -22
- package/src/components/number-input.css +56 -79
- package/src/components/overlay.css +215 -0
- package/src/components/pagination.css +42 -31
- package/src/components/panel.css +37 -11
- package/src/components/pin-input.css +23 -22
- package/src/components/popover.css +19 -35
- package/src/components/progress.css +19 -10
- package/src/components/radio-group.css +2 -1
- package/src/components/radio.css +15 -20
- package/src/components/scroll-area.css +3 -3
- package/src/components/segmented-control.css +46 -29
- package/src/components/select.css +99 -31
- package/src/components/sidebar.css +8 -4
- package/src/components/skeleton.css +8 -3
- package/src/components/slider.css +4 -2
- package/src/components/spinner.css +5 -4
- package/src/components/stat.css +59 -52
- package/src/components/status-dot.css +0 -1
- package/src/components/switch.css +18 -26
- package/src/components/table.css +443 -16
- package/src/components/tabs.css +92 -29
- package/src/components/tag.css +44 -20
- package/src/components/tags-input.css +43 -55
- package/src/components/textarea.css +15 -12
- package/src/components/toast.css +84 -22
- package/src/components/toggle.css +35 -42
- package/src/components/tooltip.css +19 -38
- package/src/core.css +98 -0
- package/src/forced-colors.css +134 -0
- package/src/index.css +4 -77
- package/src/knobs.css +101 -0
- package/src/layers.css +38 -0
- package/src/media/media.css +258 -0
- package/src/media/surface.css +143 -0
- package/src/patterns/data.css +461 -0
- package/src/patterns/page.css +348 -0
- package/src/patterns/shell.css +371 -0
- package/src/pre-upgrade.css +202 -0
- package/src/primitives.css +19 -97
- package/src/reset.css +45 -21
- package/src/skins/loft.css +114 -0
- package/src/skins/slab.css +107 -0
- package/src/themes/aurora.css +16 -0
- package/src/themes/capsule.css +16 -0
- package/src/themes/console.css +16 -0
- package/src/themes/dune.css +16 -0
- package/src/themes/iris.css +16 -0
- package/src/themes/orbit.css +16 -0
- package/src/themes/paper.css +18 -0
- package/src/themes/void.css +16 -0
- package/src/tokens.css +552 -98
- package/src/type.css +103 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/* ============================================================
|
|
2
|
+
Patterns — the recurring pieces of an application screen.
|
|
3
|
+
Every element in this directory is CSS only: an unregistered
|
|
4
|
+
void-* tag that the theme styles. Nothing to import, nothing to
|
|
5
|
+
upgrade, nothing a server morph can break. Semantics come from the
|
|
6
|
+
native elements you put inside (main, h1, h2, dl, a).
|
|
7
|
+
============================================================ */
|
|
8
|
+
|
|
9
|
+
/* @tokens void-nav-links
|
|
10
|
+
--void-nav-links-item-surface-selected Fill of the link to the current page.
|
|
11
|
+
--void-nav-links-item-ink-selected Text colour of the link to the current page. Set it with the surface: lint:contrast checks the pair. */
|
|
12
|
+
|
|
13
|
+
/* ── void-shell: the frame of an application ──
|
|
14
|
+
<void-shell> top bar, then the page
|
|
15
|
+
<void-nav-bar>…</void-nav-bar>
|
|
16
|
+
<main>…</main>
|
|
17
|
+
</void-shell>
|
|
18
|
+
|
|
19
|
+
<void-shell nav="side"> sidebar beside the page
|
|
20
|
+
<void-shell nav="overlay"> bar laid over the top of the page
|
|
21
|
+
(for a page that opens on a
|
|
22
|
+
media surface) */
|
|
23
|
+
void-shell {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
min-height: 100svh;
|
|
27
|
+
background: var(--void-color-bg);
|
|
28
|
+
color: var(--void-color-text);
|
|
29
|
+
font-family: var(--void-font-sans);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void-shell > main {
|
|
33
|
+
flex: 1 1 auto;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* The bar's content lines up with the page column below it. */
|
|
38
|
+
void-shell > void-nav-bar {
|
|
39
|
+
padding-inline: var(--void-page-inset);
|
|
40
|
+
flex-wrap: wrap;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ── Side navigation ── */
|
|
44
|
+
void-shell[nav="side"] {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
align-items: flex-start;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
void-shell[nav="side"] > void-sidebar {
|
|
50
|
+
position: sticky;
|
|
51
|
+
top: 0;
|
|
52
|
+
height: 100svh;
|
|
53
|
+
gap: var(--void-gap-stack);
|
|
54
|
+
padding: var(--void-gap-stack) var(--void-gap-inside);
|
|
55
|
+
overflow-y: auto;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void-shell[nav="side"] > main {
|
|
59
|
+
align-self: stretch;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* The brand and anything else in the sidebar line up with the text of
|
|
63
|
+
the links, which sit inside their own padding. */
|
|
64
|
+
void-shell[nav="side"] > void-sidebar > :not(void-nav-links) {
|
|
65
|
+
padding-inline: var(--void-control-padding);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ── Overlay navigation ──
|
|
69
|
+
The bar and the page share one grid cell, so the bar lies over the
|
|
70
|
+
top of the page. It carries the on-media surface (off-white text,
|
|
71
|
+
its own scrim) because the first thing under it is an image. */
|
|
72
|
+
void-shell[nav="overlay"] {
|
|
73
|
+
display: grid;
|
|
74
|
+
grid-template: "shell" minmax(0, 1fr) / minmax(0, 1fr);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
void-shell[nav="overlay"] > * {
|
|
78
|
+
grid-area: shell;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
void-shell[nav="overlay"] > void-nav-bar {
|
|
82
|
+
align-self: start;
|
|
83
|
+
z-index: var(--void-z-sticky);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* A media surface that opens the page keeps its content clear of
|
|
87
|
+
the bar lying over it. */
|
|
88
|
+
void-shell[nav="overlay"] {
|
|
89
|
+
--_void-shell-bar-height: calc(var(--void-control-height) + var(--void-space-5));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void-shell[nav="overlay"] > main > void-media:first-child > void-media-content {
|
|
93
|
+
padding-top: calc(var(--_void-shell-bar-height) + var(--void-gap-group));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media (max-width: 48rem) {
|
|
97
|
+
void-shell[nav="overlay"] {
|
|
98
|
+
--_void-shell-bar-height: calc(var(--void-control-height) + var(--void-control-height-sm) + var(--void-space-6));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* Stacked, the content is under the image, not under the bar. */
|
|
102
|
+
void-shell[nav="overlay"] > main > void-media[stack]:first-child > void-media-content {
|
|
103
|
+
padding-top: 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Where the browser can tie an animation to scrolling, the bar stays
|
|
108
|
+
with you and becomes a blurred bar once the image has scrolled by.
|
|
109
|
+
Elsewhere it stays at the top of the page and scrolls away. */
|
|
110
|
+
/* The timeline is written through var() on purpose, here and wherever
|
|
111
|
+
else the theme uses a scroll timeline: the build's minifier otherwise
|
|
112
|
+
folds animation-timeline into the animation shorthand, which no browser
|
|
113
|
+
reads, and the animation silently never runs (lint:theme checks the
|
|
114
|
+
built file for this). --_void-timeline is never set. */
|
|
115
|
+
@supports (animation-timeline: scroll()) {
|
|
116
|
+
void-shell[nav="overlay"] > void-nav-bar {
|
|
117
|
+
position: sticky;
|
|
118
|
+
top: 0;
|
|
119
|
+
animation: void-shell-bar-settle linear both;
|
|
120
|
+
animation-timeline: var(--_void-timeline, scroll(root block));
|
|
121
|
+
animation-range: 2rem 12rem;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
void-shell[nav="overlay"] > void-nav-bar::before {
|
|
125
|
+
animation: void-shell-bar-scrim linear both;
|
|
126
|
+
animation-timeline: var(--_void-timeline, scroll(root block));
|
|
127
|
+
animation-range: 2rem 12rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@keyframes void-shell-bar-settle {
|
|
131
|
+
to {
|
|
132
|
+
background: var(--void-color-control-fill);
|
|
133
|
+
-webkit-backdrop-filter: blur(var(--void-glass-blur));
|
|
134
|
+
backdrop-filter: blur(var(--void-glass-blur));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@keyframes void-shell-bar-scrim {
|
|
139
|
+
to { opacity: 0; }
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/* How much of the near edge of a scrolling row of links fades: 0 until the
|
|
144
|
+
row has been scrolled (see the narrow-width rules below). */
|
|
145
|
+
@property --_void-nav-links-fade-start {
|
|
146
|
+
syntax: "<length>";
|
|
147
|
+
inherits: false;
|
|
148
|
+
initial-value: 0px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* ── void-nav-links: the links of a bar or a sidebar ──
|
|
152
|
+
<void-nav-links>
|
|
153
|
+
<a href="/" aria-current="page">Overview</a>
|
|
154
|
+
<a href="/stations">Stations</a>
|
|
155
|
+
</void-nav-links>
|
|
156
|
+
In a bar it is a row that scrolls sideways when it runs out of
|
|
157
|
+
room; in a sidebar it is a column. */
|
|
158
|
+
void-nav-links {
|
|
159
|
+
display: flex;
|
|
160
|
+
align-items: center;
|
|
161
|
+
gap: var(--void-space-1);
|
|
162
|
+
min-width: 0;
|
|
163
|
+
font-family: var(--void-font-sans);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
void-nav-links > a {
|
|
167
|
+
display: inline-flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
gap: var(--void-gap-tight);
|
|
170
|
+
flex: none;
|
|
171
|
+
min-height: var(--void-control-height-sm);
|
|
172
|
+
padding: 0 var(--void-control-padding);
|
|
173
|
+
border-radius: var(--void-control-radius);
|
|
174
|
+
color: var(--void-color-text-secondary);
|
|
175
|
+
font-size: var(--void-type-body-size);
|
|
176
|
+
line-height: var(--void-leading-tight);
|
|
177
|
+
text-decoration: none;
|
|
178
|
+
white-space: nowrap;
|
|
179
|
+
transition: color var(--void-duration-fast) var(--void-ease-in-out),
|
|
180
|
+
background var(--void-duration-fast) var(--void-ease-in-out);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
void-nav-links > a:hover {
|
|
184
|
+
color: var(--void-color-text);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
void-nav-links > a[aria-current="page"] {
|
|
188
|
+
background: var(--void-nav-links-item-surface-selected, var(--void-item-surface-selected));
|
|
189
|
+
color: var(--void-nav-links-item-ink-selected, var(--void-item-ink-selected));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
void-nav-links > a:focus-visible {
|
|
193
|
+
outline: var(--void-focus-ring-width) solid var(--void-focus-ring-color);
|
|
194
|
+
outline-offset: calc(var(--void-focus-ring-offset) * -1);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
void-nav-links[orientation="vertical"],
|
|
198
|
+
void-sidebar void-nav-links {
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
align-items: stretch;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
void-nav-links[orientation="vertical"] > a,
|
|
204
|
+
void-sidebar void-nav-links > a {
|
|
205
|
+
min-height: var(--void-control-height);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* A label above a group of links in a sidebar. */
|
|
209
|
+
void-nav-links > [data-void-type="label"] {
|
|
210
|
+
padding: var(--void-gap-tight) var(--void-control-padding) var(--void-space-1);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/* Pushes what follows it to the far end of a bar or a toolbar. */
|
|
214
|
+
void-spacer {
|
|
215
|
+
flex: 1 1 0;
|
|
216
|
+
min-width: 0;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@media (max-width: 48rem) {
|
|
220
|
+
/* Narrow-width navigation (#49). In a bar the links drop to a row of
|
|
221
|
+
their own that scrolls sideways: every destination stays one tap
|
|
222
|
+
away and the application writes no JavaScript, which a menu behind
|
|
223
|
+
void-hamburger would need.
|
|
224
|
+
|
|
225
|
+
The row used to end a few pixels short of the screen and cut the last
|
|
226
|
+
link off mid-word ("Li") with nothing to say there was more. It now
|
|
227
|
+
runs to both edges of the screen, the links snap to its start, and
|
|
228
|
+
the far edge fades out. The fade lies over padding the row adds after
|
|
229
|
+
its last link (--_void-nav-links-fade), so a link is only ever faded
|
|
230
|
+
while there is more to scroll to, and never at the end of the row.
|
|
231
|
+
|
|
232
|
+
--_void-nav-links-bleed is how far the row has to reach to get to the
|
|
233
|
+
edge of the screen: the inline padding of what it sits in. It is the
|
|
234
|
+
one value here that depends on the bar's own padding; keep the two in
|
|
235
|
+
step if that padding changes. */
|
|
236
|
+
void-nav-bar,
|
|
237
|
+
void-sidebar {
|
|
238
|
+
--_void-nav-links-bleed: var(--void-space-4);
|
|
239
|
+
--_void-nav-links-fade: var(--void-space-8);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
void-shell > void-nav-bar,
|
|
243
|
+
void-shell[nav="side"] > void-sidebar {
|
|
244
|
+
--_void-nav-links-bleed: var(--void-gutter);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
void-nav-bar void-nav-links,
|
|
248
|
+
void-shell[nav="side"] > void-sidebar void-nav-links {
|
|
249
|
+
order: 1;
|
|
250
|
+
flex: 0 0 calc(100% + 2 * var(--_void-nav-links-bleed));
|
|
251
|
+
margin-inline: calc(var(--_void-nav-links-bleed) * -1);
|
|
252
|
+
/* The first link's text, not its box, lines up with the page column. */
|
|
253
|
+
padding-inline: max(0px, calc(var(--_void-nav-links-bleed) - var(--void-control-padding))) var(--_void-nav-links-fade);
|
|
254
|
+
overflow-x: auto;
|
|
255
|
+
scrollbar-width: none;
|
|
256
|
+
overscroll-behavior-x: contain;
|
|
257
|
+
scroll-snap-type: inline proximity;
|
|
258
|
+
scroll-padding-inline: max(0px, calc(var(--_void-nav-links-bleed) - var(--void-control-padding))) var(--_void-nav-links-fade);
|
|
259
|
+
-webkit-mask-image: linear-gradient(to right, transparent, black var(--_void-nav-links-fade-start), black calc(100% - var(--_void-nav-links-fade)), transparent);
|
|
260
|
+
mask-image: linear-gradient(to right, transparent, black var(--_void-nav-links-fade-start), black calc(100% - var(--_void-nav-links-fade)), transparent);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
:is(void-nav-bar, void-shell[nav="side"] > void-sidebar) void-nav-links:dir(rtl) {
|
|
264
|
+
-webkit-mask-image: linear-gradient(to left, transparent, black var(--_void-nav-links-fade-start), black calc(100% - var(--_void-nav-links-fade)), transparent);
|
|
265
|
+
mask-image: linear-gradient(to left, transparent, black var(--_void-nav-links-fade-start), black calc(100% - var(--_void-nav-links-fade)), transparent);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/* The near edge has no padding to fade over (the first link lines up
|
|
269
|
+
with the page), so it fades only once the row has been scrolled, where
|
|
270
|
+
the browser can tie an animation to the row's scroll position.
|
|
271
|
+
Elsewhere links leave by the edge of the screen unfaded. */
|
|
272
|
+
@supports (animation-timeline: scroll()) {
|
|
273
|
+
void-nav-bar void-nav-links,
|
|
274
|
+
void-shell[nav="side"] > void-sidebar void-nav-links {
|
|
275
|
+
animation: void-nav-links-fade linear both;
|
|
276
|
+
animation-timeline: var(--_void-timeline, scroll(self inline));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
@keyframes void-nav-links-fade {
|
|
280
|
+
0% { --_void-nav-links-fade-start: 0px; }
|
|
281
|
+
25%, 100% { --_void-nav-links-fade-start: var(--_void-nav-links-fade); }
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
:is(void-nav-bar, void-shell[nav="side"] > void-sidebar) void-nav-links > a {
|
|
286
|
+
scroll-snap-align: start;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* Where the browser supports it, the row opens scrolled to the link of
|
|
290
|
+
the current page, so that link is never the one off screen. */
|
|
291
|
+
:is(void-nav-bar, void-shell[nav="side"] > void-sidebar) void-nav-links > a[aria-current="page"] {
|
|
292
|
+
scroll-initial-target: nearest;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
void-nav-bar void-nav-links::-webkit-scrollbar,
|
|
296
|
+
void-shell[nav="side"] > void-sidebar void-nav-links::-webkit-scrollbar {
|
|
297
|
+
display: none;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* The sidebar becomes a bar across the top; its links scroll
|
|
301
|
+
sideways the same way. */
|
|
302
|
+
void-shell[nav="side"] {
|
|
303
|
+
flex-direction: column;
|
|
304
|
+
align-items: stretch;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
void-shell[nav="side"] > void-sidebar {
|
|
308
|
+
position: static;
|
|
309
|
+
flex-direction: row;
|
|
310
|
+
flex-wrap: wrap;
|
|
311
|
+
align-items: center;
|
|
312
|
+
width: auto;
|
|
313
|
+
height: auto;
|
|
314
|
+
gap: var(--void-gap-tight) var(--void-gap-inside);
|
|
315
|
+
padding: var(--void-gap-tight) var(--void-gutter);
|
|
316
|
+
border-inline: 0;
|
|
317
|
+
border-bottom: var(--void-sidebar-rule, var(--void-rule));
|
|
318
|
+
overflow: visible;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
void-shell[nav="side"] > void-sidebar void-nav-links {
|
|
322
|
+
flex-direction: row;
|
|
323
|
+
align-items: center;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
void-shell[nav="side"] > void-sidebar void-nav-links > a {
|
|
327
|
+
min-height: var(--void-control-height-sm);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
void-shell[nav="side"] > void-sidebar void-nav-links > [data-void-type="label"] {
|
|
331
|
+
display: none;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/* ── void-brand: the product's name (and mark) in a bar ──
|
|
336
|
+
<void-brand><a href="/">Meridian</a></void-brand> */
|
|
337
|
+
void-brand {
|
|
338
|
+
display: inline-flex;
|
|
339
|
+
align-items: center;
|
|
340
|
+
gap: var(--void-gap-tight);
|
|
341
|
+
flex: none;
|
|
342
|
+
font-family: var(--void-type-heading-family);
|
|
343
|
+
font-size: var(--void-type-body-size);
|
|
344
|
+
font-weight: var(--void-type-heading-weight);
|
|
345
|
+
letter-spacing: var(--void-type-heading-tracking);
|
|
346
|
+
color: var(--void-color-text);
|
|
347
|
+
white-space: nowrap;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
void-brand > a {
|
|
351
|
+
display: inherit;
|
|
352
|
+
align-items: inherit;
|
|
353
|
+
gap: inherit;
|
|
354
|
+
color: inherit;
|
|
355
|
+
text-decoration: none;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* ── Responsive visibility ──
|
|
359
|
+
data-void-hide="narrow" removes an element below 48rem (a table
|
|
360
|
+
column, a secondary action); "wide" removes it above. */
|
|
361
|
+
@media (max-width: 48rem) {
|
|
362
|
+
[data-void-hide="narrow"] {
|
|
363
|
+
display: none !important;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
@media (min-width: 48.0625rem) {
|
|
368
|
+
[data-void-hide="wide"] {
|
|
369
|
+
display: none !important;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Pre-upgrade state (`:not(:defined)`).
|
|
3
|
+
*
|
|
4
|
+
* Until a component's script has loaded and defined its tag, the browser treats
|
|
5
|
+
* `<void-*>` as an unknown element: it renders the server-sent children as plain
|
|
6
|
+
* inline content and none of what the component would render itself (tab list,
|
|
7
|
+
* input box, field label). When the script arrives the element upgrades and the
|
|
8
|
+
* page reflows. These rules make the page look and measure the same before and
|
|
9
|
+
* after:
|
|
10
|
+
*
|
|
11
|
+
* - hide what must not show yet: closed overlays, panels of tabs that are not
|
|
12
|
+
* active, closed collapsible bodies, option lists, carousel slides after the
|
|
13
|
+
* first;
|
|
14
|
+
* - reserve the space of what the component will render, using the same
|
|
15
|
+
* tokens its own rules use;
|
|
16
|
+
* - never hide content that means something before upgrade: the text of
|
|
17
|
+
* buttons, badges, tags, cards, alerts, banners and panels stays visible.
|
|
18
|
+
*
|
|
19
|
+
* `:not(:defined)` stops matching the moment `customElements.define()` runs for
|
|
20
|
+
* the tag, so these rules switch themselves off with no JavaScript, no class and
|
|
21
|
+
* no timer. They apply equally to the full bundle, per-component imports and the
|
|
22
|
+
* autoloader (`@voidable/ui/autoloader`).
|
|
23
|
+
*
|
|
24
|
+
* Imported by index.css after the component files, so where a rule here has the
|
|
25
|
+
* same specificity as a component rule (for example `void-dialog[open]`) this
|
|
26
|
+
* one wins. Only tokens that already exist are used.
|
|
27
|
+
*
|
|
28
|
+
* Components with explicit parts (#52: dialog, drawer, popover, hover card,
|
|
29
|
+
* dropdown menu, tooltip, tabs, card, alert, accordion, collapsible, panel,
|
|
30
|
+
* banner, toast, error fallback, combobox, multiselect) need little here: their
|
|
31
|
+
* regions are elements the author wrote, styled the same before and after
|
|
32
|
+
* upgrade, so only what the script reveals (overlay content, an option list)
|
|
33
|
+
* is hidden. `void-select` needs nothing: the author's native `<select>` is the
|
|
34
|
+
* control, styled and working before upgrade.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/* ── Closed overlays ───────────────────────────────────────────────────────
|
|
38
|
+
A server may render `open`; the backdrop, panel and focus handling only exist
|
|
39
|
+
after upgrade, so the bare children would flash. Show nothing until then. */
|
|
40
|
+
void-dialog:not(:defined),
|
|
41
|
+
void-drawer:not(:defined),
|
|
42
|
+
void-menu:not(:defined) {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* Anchored content and the option lists of pickers: the component positions
|
|
47
|
+
and reveals them, so before upgrade they are not content. */
|
|
48
|
+
void-popover:not(:defined) > void-popover-content,
|
|
49
|
+
void-hover-card:not(:defined) > void-hover-card-content,
|
|
50
|
+
void-dropdown-menu:not(:defined) > void-dropdown-menu-content,
|
|
51
|
+
void-tooltip:not(:defined) > void-tooltip-content,
|
|
52
|
+
void-multiselect:not(:defined) > void-multiselect-content,
|
|
53
|
+
void-combobox:not(:defined) > void-combobox-content {
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* ── Tabs ──────────────────────────────────────────────────────────────────
|
|
58
|
+
The tab list is the author's <void-tabs-list>, so it is already laid out.
|
|
59
|
+
Show one panel: the one the server marked [active], or the first when none
|
|
60
|
+
is marked (render `active` on the selected trigger and panel when the initial
|
|
61
|
+
tab is not the first). Every other panel is already display:none (tabs.css). */
|
|
62
|
+
void-tabs:not(:defined):not(:has(> void-tabs-content[active])) > void-tabs-content:first-of-type {
|
|
63
|
+
display: block;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void-tabs:not(:defined):not(:has(void-tabs-trigger[active])) > void-tabs-list > void-tabs-trigger:first-child {
|
|
67
|
+
color: var(--void-color-text);
|
|
68
|
+
border-bottom-color: var(--void-color-accent);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ── Error fallback ────────────────────────────────────────────────────────
|
|
72
|
+
Written with no parts, it writes its default (heading, message, retry button)
|
|
73
|
+
itself. Show the heading where that title will be, so the box has its height. */
|
|
74
|
+
void-error-fallback:not(:defined):empty::after {
|
|
75
|
+
content: attr(heading);
|
|
76
|
+
display: block;
|
|
77
|
+
font-family: var(--void-type-heading-family);
|
|
78
|
+
font-size: var(--void-type-heading-size);
|
|
79
|
+
line-height: var(--void-type-heading-leading);
|
|
80
|
+
font-weight: var(--void-type-heading-weight);
|
|
81
|
+
letter-spacing: var(--void-type-heading-tracking);
|
|
82
|
+
color: var(--void-type-heading-color);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void-error-fallback:not(:defined):empty:not([heading])::after {
|
|
86
|
+
content: 'Something went wrong';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* ── Carousel ──────────────────────────────────────────────────────────────
|
|
90
|
+
The content part is a clipped row and the items are 100% wide (carousel.css),
|
|
91
|
+
the arrows are absolutely placed and the indicators part reserves the height
|
|
92
|
+
of a dot, so the carousel is laid out before upgrade as it is after. */
|
|
93
|
+
|
|
94
|
+
/* ── Field ─────────────────────────────────────────────────────────────────
|
|
95
|
+
Label, helper and error are attributes: show them where the component will
|
|
96
|
+
render them. */
|
|
97
|
+
void-field:not(:defined)[label]::before {
|
|
98
|
+
content: attr(label);
|
|
99
|
+
font-size: var(--void-text-sm);
|
|
100
|
+
font-weight: var(--void-weight-medium);
|
|
101
|
+
color: var(--void-color-text);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
void-field:not(:defined)[helper]:not([error]:not([error=""]))::after {
|
|
105
|
+
content: attr(helper);
|
|
106
|
+
font-size: var(--void-text-xs);
|
|
107
|
+
color: var(--void-color-text-muted);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
void-field:not(:defined)[error]:not([error=""])::after {
|
|
111
|
+
content: attr(error);
|
|
112
|
+
font-size: var(--void-text-xs);
|
|
113
|
+
color: var(--void-color-error);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* ── Controls that render their own box ────────────────────────────────────
|
|
117
|
+
One line of text-sm at leading-normal, vertical padding space-2 and a 1px
|
|
118
|
+
border: the height of the native control the component renders. */
|
|
119
|
+
void-input:not(:defined),
|
|
120
|
+
void-number-input:not(:defined),
|
|
121
|
+
void-date-picker:not(:defined),
|
|
122
|
+
void-action-input:not(:defined),
|
|
123
|
+
void-tags-input:not(:defined) {
|
|
124
|
+
display: block;
|
|
125
|
+
box-sizing: border-box;
|
|
126
|
+
background: var(--void-color-bg-secondary);
|
|
127
|
+
border: 1px solid var(--void-color-border-control);
|
|
128
|
+
border-radius: var(--void-radius-md);
|
|
129
|
+
min-height: calc(var(--void-space-2) * 2 + var(--void-text-sm) * var(--void-leading-normal) + 2px); /* token-ok: total height with the 1px border on each side (border-box) */
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
:is(void-input, void-number-input, void-date-picker, void-action-input, void-tags-input)[size="sm"]:not(:defined) {
|
|
133
|
+
min-height: calc(var(--void-space-1) * 2 + var(--void-text-xs) * var(--void-leading-normal) + 2px); /* token-ok: total height with the 1px border on each side (border-box) */
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:is(void-input, void-number-input, void-date-picker, void-action-input, void-tags-input)[size="lg"]:not(:defined) {
|
|
137
|
+
min-height: calc(var(--void-space-3) * 2 + var(--void-text-base) * var(--void-leading-normal) + 2px); /* token-ok: total height with the 1px border on each side (border-box) */
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* The pickers render their field before the content part they hold: the box
|
|
141
|
+
of that field, at the control height the field uses. */
|
|
142
|
+
void-multiselect:not(:defined),
|
|
143
|
+
void-combobox:not(:defined) {
|
|
144
|
+
display: block;
|
|
145
|
+
box-sizing: border-box;
|
|
146
|
+
background: var(--void-field-surface);
|
|
147
|
+
border: var(--void-control-border-width) solid var(--void-field-border);
|
|
148
|
+
border-radius: var(--void-control-radius);
|
|
149
|
+
min-height: var(--void-control-height);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:is(void-multiselect, void-combobox)[size="sm"]:not(:defined) { min-height: var(--void-control-height-sm); }
|
|
153
|
+
:is(void-multiselect, void-combobox)[size="lg"]:not(:defined) { min-height: var(--void-control-height-lg); }
|
|
154
|
+
|
|
155
|
+
/* Three rows unless `rows` says otherwise (typed attr() where supported). */
|
|
156
|
+
void-textarea:not(:defined) {
|
|
157
|
+
display: block;
|
|
158
|
+
box-sizing: border-box;
|
|
159
|
+
background: var(--void-color-bg-secondary);
|
|
160
|
+
border: 1px solid var(--void-color-border-control);
|
|
161
|
+
border-radius: var(--void-radius-md);
|
|
162
|
+
min-height: calc(3 * var(--void-text-sm) * var(--void-leading-normal) + var(--void-space-2) * 2 + 2px); /* token-ok: total height with the 1px border on each side (border-box) */
|
|
163
|
+
min-height: calc(attr(rows type(<number>), 3) * var(--void-text-sm) * var(--void-leading-normal) + var(--void-space-2) * 2 + 2px); /* token-ok: total height with the 1px border on each side (border-box) */
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
void-file-upload:not(:defined) {
|
|
167
|
+
display: block;
|
|
168
|
+
box-sizing: border-box;
|
|
169
|
+
border: 2px dashed var(--void-color-border);
|
|
170
|
+
border-radius: var(--void-radius-lg);
|
|
171
|
+
min-height: calc(var(--void-space-6) * 2 + var(--void-text-sm) * var(--void-leading-normal) + 4px); /* token-ok: total height with the 2px dashed border on each side (border-box) */
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* One row of boxes, 2.5rem tall at the default size. */
|
|
175
|
+
void-pin-input:not(:defined) {
|
|
176
|
+
display: block;
|
|
177
|
+
min-height: 2.5rem; /* token-ok: one pin box, as pin-input.css */
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* ── Meters and placeholders ───────────────────────────────────────────── */
|
|
181
|
+
void-progress:not(:defined)::before {
|
|
182
|
+
content: '';
|
|
183
|
+
display: block;
|
|
184
|
+
height: 0.5rem; /* token-ok: track height, as progress.css */
|
|
185
|
+
background: var(--void-color-bg-hover);
|
|
186
|
+
border-radius: var(--void-radius-full);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
void-progress[size="sm"]:not(:defined)::before { height: 0.25rem; /* token-ok: as progress.css */ }
|
|
190
|
+
void-progress[size="lg"]:not(:defined)::before { height: 0.75rem; /* token-ok: as progress.css */ }
|
|
191
|
+
|
|
192
|
+
/* Skeleton defaults to the text variant once upgraded. */
|
|
193
|
+
void-skeleton:not(:defined):not([variant]) {
|
|
194
|
+
height: 1em;
|
|
195
|
+
width: 100%;
|
|
196
|
+
border-radius: var(--void-radius-xs);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
void-calendar:not(:defined) {
|
|
200
|
+
box-sizing: border-box;
|
|
201
|
+
min-height: 16.5rem; /* token-ok: one month grid of the default size */
|
|
202
|
+
}
|