@solexllc/usx 0.1.2 → 0.1.3
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 +2 -1
- package/package.json +2 -2
- package/src/components/_header.scss +83 -67
- package/src/components/_hero.scss +2 -2
- package/src/components/_link.scss +1 -3
package/README.md
CHANGED
|
@@ -9,7 +9,8 @@ The only build step is regenerating the icon sprite (see **Icons** below).
|
|
|
9
9
|
|
|
10
10
|
All design tokens come from `@solexllc/usx-theme` and are runtime-themeable via
|
|
11
11
|
`--usx-*` CSS custom properties. Compile `src/index.scss` for a fully static
|
|
12
|
-
build (no `var()` references), or `src/themed.scss` to enable every hook
|
|
12
|
+
build (no `var()` references), or `src/themed.scss` to enable every hook and
|
|
13
|
+
pair it with `pkg:@solexllc/usx-theme/themes` for opt-in prebuilt themes.
|
|
13
14
|
See `packages/usx-theme/README.md` for the full theming guide, and the Storybook
|
|
14
15
|
**Documentation → Theme → Playground** to generate a theme visually.
|
|
15
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solexllc/usx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Compiled USWDS-based component styles for USX.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"src"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@solexllc/usx-theme": "0.
|
|
35
|
+
"@solexllc/usx-theme": "0.2.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"sass": "^1.98.0"
|
|
@@ -2,15 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
/* stylelint-disable selector-class-pattern, no-descending-specificity -- Public USX classes use BEM naming; intentional cascade order. */
|
|
4
4
|
|
|
5
|
-
// Keeps utilityContent and the search box on one row regardless of the
|
|
6
|
-
// parent's own flex-direction (USWDS's .usa-nav__secondary stacks its
|
|
7
|
-
// children in a column at desktop).
|
|
8
|
-
.usx-nav__utility {
|
|
9
|
-
align-items: center;
|
|
10
|
-
display: flex;
|
|
11
|
-
gap: 0.5rem;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
5
|
.usx-header {
|
|
15
6
|
@if $usx-header-bg {
|
|
16
7
|
background-color: $usx-header-bg;
|
|
@@ -49,19 +40,10 @@
|
|
|
49
40
|
}
|
|
50
41
|
}
|
|
51
42
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
overflow: unset;
|
|
56
|
-
}
|
|
43
|
+
:has(> .usx-nav--sticky) {
|
|
44
|
+
overflow: unset;
|
|
45
|
+
}
|
|
57
46
|
|
|
58
|
-
:has(> .usa-header--extended) {
|
|
59
|
-
// Background is themeable at every width — unlike vendor (which paints no
|
|
60
|
-
// background at desktop and a hardcoded opaque white at mobile), USX lets a
|
|
61
|
-
// theme's configured nav color show through the mobile drawer too, so a
|
|
62
|
-
// dark theme's drawer doesn't revert to an unstyled white panel. Desktop
|
|
63
|
-
// and mobile can be themed independently since the drawer and the nav bar
|
|
64
|
-
// are visually distinct surfaces.
|
|
65
47
|
.usx-nav {
|
|
66
48
|
@media (width < 64em) {
|
|
67
49
|
@if $usx-header-nav-bg-mobile {
|
|
@@ -69,20 +51,40 @@
|
|
|
69
51
|
}
|
|
70
52
|
}
|
|
71
53
|
|
|
72
|
-
@media (width >=
|
|
54
|
+
@media (width >=64em) {
|
|
73
55
|
@if $usx-header-nav-bg {
|
|
74
56
|
background-color: $usx-header-nav-bg;
|
|
75
57
|
}
|
|
76
58
|
}
|
|
77
59
|
}
|
|
78
60
|
|
|
61
|
+
// Keeps utilityContent and the search box on one row regardless of the
|
|
62
|
+
// parent's own flex-direction (USWDS's .usa-nav__secondary stacks its
|
|
63
|
+
// children in a column at desktop).
|
|
64
|
+
.usx-nav__utility {
|
|
65
|
+
align-items: center;
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: 0.5rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:has(> .usa-header--extended) {
|
|
73
|
+
// Background is themeable at every width — unlike vendor (which paints no
|
|
74
|
+
// background at desktop and a hardcoded opaque white at mobile), USX lets a
|
|
75
|
+
// theme's configured nav color show through the mobile drawer too, so a
|
|
76
|
+
// dark theme's drawer doesn't revert to an unstyled white panel. Desktop
|
|
77
|
+
// and mobile can be themed independently since the drawer and the nav bar
|
|
78
|
+
// are visually distinct surfaces.
|
|
79
|
+
|
|
80
|
+
|
|
79
81
|
// USWDS scopes all of its own .usa-header--extended .usa-nav(__inner) and
|
|
80
82
|
// hover/current-bar rules to this same desktop breakpoint (the nav is an
|
|
81
83
|
// off-canvas mobile drawer below it, styled by vendor's plain .usa-nav
|
|
82
84
|
// mobile rules instead) — mirror that scoping here, or this desktop-only
|
|
83
85
|
// border/spacing leaks into the mobile drawer (extra 2rem padding on top
|
|
84
86
|
// of the drawer's own).
|
|
85
|
-
@media (width >=
|
|
87
|
+
@media (width >=64em) {
|
|
86
88
|
.usx-nav {
|
|
87
89
|
@if $usx-header-nav-border-bottom {
|
|
88
90
|
border-bottom: $usx-header-nav-border-bottom;
|
|
@@ -90,25 +92,27 @@
|
|
|
90
92
|
|
|
91
93
|
@if $usx-header-nav-border-top {
|
|
92
94
|
border-top: $usx-header-nav-border-top;
|
|
93
|
-
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@else {
|
|
94
98
|
border-top: 1px solid #dfe1e2;
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
.usa-nav__inner {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
margin-left: auto;
|
|
103
|
+
margin-right: auto;
|
|
104
|
+
max-width: calc($max-layout-width + 4rem);
|
|
105
|
+
padding-left: 2rem;
|
|
106
|
+
padding-right: 2rem;
|
|
107
|
+
position: relative;
|
|
104
108
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
// .usa-nav__close (mobile-only) is hidden at this width, and
|
|
110
|
+
// .usa-nav__secondary is taken out of flow via its own absolute
|
|
111
|
+
// positioning — so .usa-nav__primary and .usx-nav__end-slot are the
|
|
112
|
+
// only two participants in this row, letting margin-left: auto push
|
|
113
|
+
// the slot flush right, vertically centered with the nav links.
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
.usx-nav__end-slot {
|
|
@@ -123,7 +127,8 @@
|
|
|
123
127
|
// extended only differs from the basic default (below) by hover being
|
|
124
128
|
// restricted to top-level items and the bar sitting flush at bottom: 0
|
|
125
129
|
// instead of bottom: -0.25rem.
|
|
126
|
-
.usa-nav__primary-item
|
|
130
|
+
.usa-nav__primary-item>.usa-nav__link {
|
|
131
|
+
|
|
127
132
|
&:hover,
|
|
128
133
|
&.usa-current {
|
|
129
134
|
position: relative;
|
|
@@ -163,6 +168,7 @@
|
|
|
163
168
|
float: right;
|
|
164
169
|
|
|
165
170
|
@if $usx-header-nav-link-text-hover {
|
|
171
|
+
|
|
166
172
|
// Vendor's dark-background/white-text expanded look is desktop-only (see
|
|
167
173
|
// the aria-expanded background rule further below), so at mobile a hover
|
|
168
174
|
// on an already-open toggle should still track the theme like any other
|
|
@@ -177,7 +183,7 @@
|
|
|
177
183
|
background-color: $usx-header-nav-link-bg-hover;
|
|
178
184
|
}
|
|
179
185
|
|
|
180
|
-
&>
|
|
186
|
+
&>span::after {
|
|
181
187
|
@if $usx-header-nav-link-text-hover-mobile {
|
|
182
188
|
background-color: $usx-header-nav-link-text-hover-mobile;
|
|
183
189
|
}
|
|
@@ -185,11 +191,11 @@
|
|
|
185
191
|
}
|
|
186
192
|
}
|
|
187
193
|
|
|
188
|
-
@media (width >=
|
|
194
|
+
@media (width >=64em) {
|
|
189
195
|
.usa-nav__primary button:not([aria-expanded="true"]):hover {
|
|
190
196
|
color: $usx-header-nav-link-text-hover;
|
|
191
197
|
|
|
192
|
-
&>
|
|
198
|
+
&>span::after {
|
|
193
199
|
@if $usx-header-nav-link-text-hover {
|
|
194
200
|
background-color: $usx-header-nav-link-text-hover;
|
|
195
201
|
}
|
|
@@ -197,7 +203,7 @@
|
|
|
197
203
|
}
|
|
198
204
|
}
|
|
199
205
|
|
|
200
|
-
.usa-nav__primary
|
|
206
|
+
.usa-nav__primary>.usa-nav__primary-item>a:hover {
|
|
201
207
|
@media (width < 64em) {
|
|
202
208
|
color: $usx-header-nav-link-text-hover-mobile;
|
|
203
209
|
|
|
@@ -208,7 +214,7 @@
|
|
|
208
214
|
}
|
|
209
215
|
}
|
|
210
216
|
|
|
211
|
-
@media (width >=
|
|
217
|
+
@media (width >=64em) {
|
|
212
218
|
color: $usx-header-nav-link-text-hover;
|
|
213
219
|
}
|
|
214
220
|
}
|
|
@@ -221,6 +227,7 @@
|
|
|
221
227
|
}
|
|
222
228
|
|
|
223
229
|
.usa-nav__close {
|
|
230
|
+
|
|
224
231
|
// Only rendered inside the mobile off-canvas drawer, so it tracks the
|
|
225
232
|
// drawer link tokens, not the desktop primary-nav ones.
|
|
226
233
|
// .usa-icon fills via `currentColor`, so tint it with `color`, not
|
|
@@ -236,7 +243,7 @@
|
|
|
236
243
|
}
|
|
237
244
|
}
|
|
238
245
|
|
|
239
|
-
@media (width >=
|
|
246
|
+
@media (width >=64em) {
|
|
240
247
|
width: 100%;
|
|
241
248
|
float: none;
|
|
242
249
|
|
|
@@ -258,34 +265,37 @@
|
|
|
258
265
|
padding-right: 1rem;
|
|
259
266
|
}
|
|
260
267
|
|
|
261
|
-
.usa-nav__secondary-item
|
|
268
|
+
.usa-nav__secondary-item+.usa-nav__secondary-item {
|
|
269
|
+
|
|
262
270
|
// USWDS's own separator is a border color (#dfe1e2), not the link's
|
|
263
271
|
// text color — $usx-header-secondary-link-text was the wrong token.
|
|
264
272
|
@if $usx-header-nav-border-top {
|
|
265
273
|
border-left: $usx-header-nav-border-top;
|
|
266
|
-
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@else {
|
|
267
277
|
border-left: 1px solid #dfe1e2;
|
|
268
278
|
}
|
|
269
279
|
}
|
|
270
280
|
}
|
|
271
281
|
|
|
272
282
|
.usa-nav__link {
|
|
283
|
+
|
|
273
284
|
// Vendor only swaps the expanded toggle to white text at desktop (paired
|
|
274
285
|
// with the dark expanded background); at mobile it gets no special
|
|
275
286
|
// color at all, so it should still track the theme like every other
|
|
276
287
|
// link — excluding it unconditionally left it on the unthemed browser
|
|
277
288
|
// default whenever the drawer was open.
|
|
278
289
|
@media (width < 64em) {
|
|
279
|
-
|
|
280
|
-
|
|
290
|
+
|
|
291
|
+
&:not(.usa-nav__primary button:hover,
|
|
281
292
|
.usa-nav__primary > .usa-nav__primary-item > a:hover,
|
|
282
|
-
.usa-current
|
|
283
|
-
) {
|
|
293
|
+
.usa-current) {
|
|
284
294
|
@if $usx-header-nav-link-text-mobile {
|
|
285
295
|
color: $usx-header-nav-link-text-mobile;
|
|
286
296
|
}
|
|
287
297
|
|
|
288
|
-
&>
|
|
298
|
+
&>span::after {
|
|
289
299
|
@if $usx-header-nav-link-text-mobile {
|
|
290
300
|
background-color: $usx-header-nav-link-text-mobile;
|
|
291
301
|
}
|
|
@@ -293,18 +303,17 @@
|
|
|
293
303
|
}
|
|
294
304
|
}
|
|
295
305
|
|
|
296
|
-
@media (width >=
|
|
297
|
-
|
|
298
|
-
|
|
306
|
+
@media (width >=64em) {
|
|
307
|
+
|
|
308
|
+
&:not(.usa-nav__primary button[aria-expanded="true"],
|
|
299
309
|
.usa-nav__primary button:hover,
|
|
300
310
|
.usa-nav__primary > .usa-nav__primary-item > a:hover,
|
|
301
|
-
.usa-current
|
|
302
|
-
) {
|
|
311
|
+
.usa-current) {
|
|
303
312
|
@if $usx-header-nav-link-text {
|
|
304
313
|
color: $usx-header-nav-link-text;
|
|
305
314
|
}
|
|
306
315
|
|
|
307
|
-
&>
|
|
316
|
+
&>span::after {
|
|
308
317
|
@if $usx-header-nav-link-text {
|
|
309
318
|
background-color: $usx-header-nav-link-text;
|
|
310
319
|
}
|
|
@@ -315,7 +324,7 @@
|
|
|
315
324
|
// Desktop: current text stays the plain link color — only the bottom bar
|
|
316
325
|
// (above) marks state, matching vendor (no .usa-current color override
|
|
317
326
|
// exists in vendor's desktop rules).
|
|
318
|
-
@media (width >=
|
|
327
|
+
@media (width >=64em) {
|
|
319
328
|
&.usa-current {
|
|
320
329
|
@if $usx-header-nav-link-text {
|
|
321
330
|
color: $usx-header-nav-link-text;
|
|
@@ -359,7 +368,8 @@
|
|
|
359
368
|
// (left-side) current-page indicator instead, and never shows one on
|
|
360
369
|
// hover at all — showing this bar unconditionally put it on every mobile
|
|
361
370
|
// nav item (including dropdown toggles) on hover, which vendor never does.
|
|
362
|
-
@media (width >=
|
|
371
|
+
@media (width >=64em) {
|
|
372
|
+
|
|
363
373
|
&:hover,
|
|
364
374
|
&.usa-current {
|
|
365
375
|
position: relative;
|
|
@@ -389,18 +399,19 @@
|
|
|
389
399
|
// white background and border-top separators are the only styling, so
|
|
390
400
|
// applying this unconditionally painted a dark box (with the still-gray,
|
|
391
401
|
// unthemed link text from above) over the mobile accordion toggle/panel.
|
|
392
|
-
@media (width >=
|
|
402
|
+
@media (width >=64em) {
|
|
393
403
|
&[aria-expanded="true"] {
|
|
394
404
|
@if $usx-header-nav-link-bg {
|
|
395
405
|
background-color: $usx-header-nav-link-bg !important;
|
|
396
406
|
}
|
|
397
407
|
|
|
398
|
-
|
|
408
|
+
&+.usa-nav__submenu {
|
|
399
409
|
@if $usx-header-nav-submenu-bg {
|
|
400
410
|
background-color: $usx-header-nav-submenu-bg;
|
|
401
411
|
}
|
|
402
412
|
|
|
403
|
-
&::before,
|
|
413
|
+
&::before,
|
|
414
|
+
&::after {
|
|
404
415
|
@if $usx-header-nav-submenu-bg {
|
|
405
416
|
background-color: $usx-header-nav-submenu-bg;
|
|
406
417
|
}
|
|
@@ -410,7 +421,7 @@
|
|
|
410
421
|
}
|
|
411
422
|
}
|
|
412
423
|
|
|
413
|
-
.usa-nav__secondary-item
|
|
424
|
+
.usa-nav__secondary-item>a {
|
|
414
425
|
@if $usx-header-secondary-link-text {
|
|
415
426
|
color: $usx-header-secondary-link-text;
|
|
416
427
|
}
|
|
@@ -423,12 +434,17 @@
|
|
|
423
434
|
}
|
|
424
435
|
|
|
425
436
|
@media (width < 64em) {
|
|
426
|
-
|
|
437
|
+
|
|
438
|
+
.usa-nav__primary-item,
|
|
439
|
+
.usa-nav__submenu-item {
|
|
440
|
+
|
|
427
441
|
// USWDS's own default is a border color (#dfe1e2), not a text color —
|
|
428
442
|
// $usx-header-nav-link-text was the wrong token here.
|
|
429
443
|
@if $usx-header-nav-border-top {
|
|
430
444
|
border-top: $usx-header-nav-border-top;
|
|
431
|
-
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
@else {
|
|
432
448
|
border-top: 1px solid #dfe1e2;
|
|
433
449
|
}
|
|
434
450
|
}
|
|
@@ -436,7 +452,7 @@
|
|
|
436
452
|
// Submenu links are plain <a> tags with no .usa-nav__link class (see
|
|
437
453
|
// Header.tsx), so the rule above never reaches them — left alone they
|
|
438
454
|
// fall back to vendor's hardcoded gray/blue instead of the active theme.
|
|
439
|
-
.usa-nav__submenu-item
|
|
455
|
+
.usa-nav__submenu-item>a {
|
|
440
456
|
@if $usx-header-nav-link-text {
|
|
441
457
|
color: $usx-header-nav-link-text;
|
|
442
458
|
}
|
|
@@ -461,4 +477,4 @@
|
|
|
461
477
|
}
|
|
462
478
|
}
|
|
463
479
|
|
|
464
|
-
}
|
|
480
|
+
}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
content: '';
|
|
33
33
|
position: absolute;
|
|
34
34
|
inset: 0;
|
|
35
|
-
background-color: rgb(0 0 0 /
|
|
35
|
+
background-color: rgb(0 0 0 / 35%);
|
|
36
36
|
pointer-events: none;
|
|
37
37
|
|
|
38
38
|
@if $usx-hero-overlay-bg {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
&__callout {
|
|
62
62
|
max-width: 40rem;
|
|
63
63
|
padding: 2rem;
|
|
64
|
-
background-color: rgb(0 0 0 /
|
|
64
|
+
background-color: rgb(0 0 0 / 90%);
|
|
65
65
|
|
|
66
66
|
// Radius follows the app-wide radius-box group (null/square by default,
|
|
67
67
|
// like every other radius-box consumer: image, code, summary-box).
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
/* stylelint-disable selector-class-pattern, selector-not-notation, no-descending-specificity -- Public USX classes use BEM naming; preserve original :not() specificity and cascade order. */
|
|
4
4
|
.usx-link,
|
|
5
|
-
.usx-prose a {
|
|
5
|
+
.usx-prose a:not(.usa-button) {
|
|
6
6
|
display: inline-flex;
|
|
7
|
-
align-items: center;
|
|
8
7
|
width: max-content;
|
|
9
|
-
gap: 0.25rem;
|
|
10
8
|
|
|
11
9
|
&:not([class^="text-"]):not([class*=" text-"]) {
|
|
12
10
|
@if $usx-link-text {
|