@solexllc/usx 0.1.1 → 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 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.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.1.1"
35
+ "@solexllc/usx-theme": "0.2.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "sass": "^1.98.0"
@@ -1,6 +1,7 @@
1
1
  @use 'pkg:@solexllc/usx-theme/variables' as *;
2
2
 
3
3
  /* stylelint-disable selector-class-pattern, no-descending-specificity -- Public USX classes use BEM naming; intentional cascade order. */
4
+
4
5
  .usx-header {
5
6
  @if $usx-header-bg {
6
7
  background-color: $usx-header-bg;
@@ -39,19 +40,10 @@
39
40
  }
40
41
  }
41
42
 
42
- }
43
-
44
- :has(> .usx-nav--sticky) {
45
- overflow: unset;
46
- }
43
+ :has(> .usx-nav--sticky) {
44
+ overflow: unset;
45
+ }
47
46
 
48
- :has(> .usa-header--extended) {
49
- // Background is themeable at every width — unlike vendor (which paints no
50
- // background at desktop and a hardcoded opaque white at mobile), USX lets a
51
- // theme's configured nav color show through the mobile drawer too, so a
52
- // dark theme's drawer doesn't revert to an unstyled white panel. Desktop
53
- // and mobile can be themed independently since the drawer and the nav bar
54
- // are visually distinct surfaces.
55
47
  .usx-nav {
56
48
  @media (width < 64em) {
57
49
  @if $usx-header-nav-bg-mobile {
@@ -59,20 +51,40 @@
59
51
  }
60
52
  }
61
53
 
62
- @media (width >= 64em) {
54
+ @media (width >=64em) {
63
55
  @if $usx-header-nav-bg {
64
56
  background-color: $usx-header-nav-bg;
65
57
  }
66
58
  }
67
59
  }
68
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
+
69
81
  // USWDS scopes all of its own .usa-header--extended .usa-nav(__inner) and
70
82
  // hover/current-bar rules to this same desktop breakpoint (the nav is an
71
83
  // off-canvas mobile drawer below it, styled by vendor's plain .usa-nav
72
84
  // mobile rules instead) — mirror that scoping here, or this desktop-only
73
85
  // border/spacing leaks into the mobile drawer (extra 2rem padding on top
74
86
  // of the drawer's own).
75
- @media (width >= 64em) {
87
+ @media (width >=64em) {
76
88
  .usx-nav {
77
89
  @if $usx-header-nav-border-bottom {
78
90
  border-bottom: $usx-header-nav-border-bottom;
@@ -80,17 +92,32 @@
80
92
 
81
93
  @if $usx-header-nav-border-top {
82
94
  border-top: $usx-header-nav-border-top;
83
- } @else {
95
+ }
96
+
97
+ @else {
84
98
  border-top: 1px solid #dfe1e2;
85
99
  }
86
100
 
87
101
  .usa-nav__inner {
88
- margin-left: auto;
89
- margin-right: auto;
90
- max-width: calc($max-layout-width + 4rem);
91
- padding-left: 2rem;
92
- padding-right: 2rem;
93
- position: relative;
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;
108
+
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;
116
+ }
117
+
118
+ .usx-nav__end-slot {
119
+ flex-shrink: 0;
120
+ margin-left: auto;
94
121
  }
95
122
 
96
123
  // USWDS's own .usa-header--extended .usa-nav__primary-item > .usa-nav__link:hover::after
@@ -100,7 +127,8 @@
100
127
  // extended only differs from the basic default (below) by hover being
101
128
  // restricted to top-level items and the bar sitting flush at bottom: 0
102
129
  // instead of bottom: -0.25rem.
103
- .usa-nav__primary-item > .usa-nav__link {
130
+ .usa-nav__primary-item>.usa-nav__link {
131
+
104
132
  &:hover,
105
133
  &.usa-current {
106
134
  position: relative;
@@ -140,6 +168,7 @@
140
168
  float: right;
141
169
 
142
170
  @if $usx-header-nav-link-text-hover {
171
+
143
172
  // Vendor's dark-background/white-text expanded look is desktop-only (see
144
173
  // the aria-expanded background rule further below), so at mobile a hover
145
174
  // on an already-open toggle should still track the theme like any other
@@ -154,7 +183,7 @@
154
183
  background-color: $usx-header-nav-link-bg-hover;
155
184
  }
156
185
 
157
- &> span::after {
186
+ &>span::after {
158
187
  @if $usx-header-nav-link-text-hover-mobile {
159
188
  background-color: $usx-header-nav-link-text-hover-mobile;
160
189
  }
@@ -162,11 +191,11 @@
162
191
  }
163
192
  }
164
193
 
165
- @media (width >= 64em) {
194
+ @media (width >=64em) {
166
195
  .usa-nav__primary button:not([aria-expanded="true"]):hover {
167
196
  color: $usx-header-nav-link-text-hover;
168
197
 
169
- &> span::after {
198
+ &>span::after {
170
199
  @if $usx-header-nav-link-text-hover {
171
200
  background-color: $usx-header-nav-link-text-hover;
172
201
  }
@@ -174,7 +203,7 @@
174
203
  }
175
204
  }
176
205
 
177
- .usa-nav__primary > .usa-nav__primary-item > a:hover {
206
+ .usa-nav__primary>.usa-nav__primary-item>a:hover {
178
207
  @media (width < 64em) {
179
208
  color: $usx-header-nav-link-text-hover-mobile;
180
209
 
@@ -185,7 +214,7 @@
185
214
  }
186
215
  }
187
216
 
188
- @media (width >= 64em) {
217
+ @media (width >=64em) {
189
218
  color: $usx-header-nav-link-text-hover;
190
219
  }
191
220
  }
@@ -198,6 +227,7 @@
198
227
  }
199
228
 
200
229
  .usa-nav__close {
230
+
201
231
  // Only rendered inside the mobile off-canvas drawer, so it tracks the
202
232
  // drawer link tokens, not the desktop primary-nav ones.
203
233
  // .usa-icon fills via `currentColor`, so tint it with `color`, not
@@ -213,7 +243,7 @@
213
243
  }
214
244
  }
215
245
 
216
- @media (width >= 64em) {
246
+ @media (width >=64em) {
217
247
  width: 100%;
218
248
  float: none;
219
249
 
@@ -235,34 +265,37 @@
235
265
  padding-right: 1rem;
236
266
  }
237
267
 
238
- .usa-nav__secondary-item + .usa-nav__secondary-item {
268
+ .usa-nav__secondary-item+.usa-nav__secondary-item {
269
+
239
270
  // USWDS's own separator is a border color (#dfe1e2), not the link's
240
271
  // text color — $usx-header-secondary-link-text was the wrong token.
241
272
  @if $usx-header-nav-border-top {
242
273
  border-left: $usx-header-nav-border-top;
243
- } @else {
274
+ }
275
+
276
+ @else {
244
277
  border-left: 1px solid #dfe1e2;
245
278
  }
246
279
  }
247
280
  }
248
281
 
249
282
  .usa-nav__link {
283
+
250
284
  // Vendor only swaps the expanded toggle to white text at desktop (paired
251
285
  // with the dark expanded background); at mobile it gets no special
252
286
  // color at all, so it should still track the theme like every other
253
287
  // link — excluding it unconditionally left it on the unthemed browser
254
288
  // default whenever the drawer was open.
255
289
  @media (width < 64em) {
256
- &:not(
257
- .usa-nav__primary button:hover,
290
+
291
+ &:not(.usa-nav__primary button:hover,
258
292
  .usa-nav__primary > .usa-nav__primary-item > a:hover,
259
- .usa-current
260
- ) {
293
+ .usa-current) {
261
294
  @if $usx-header-nav-link-text-mobile {
262
295
  color: $usx-header-nav-link-text-mobile;
263
296
  }
264
297
 
265
- &> span::after {
298
+ &>span::after {
266
299
  @if $usx-header-nav-link-text-mobile {
267
300
  background-color: $usx-header-nav-link-text-mobile;
268
301
  }
@@ -270,18 +303,17 @@
270
303
  }
271
304
  }
272
305
 
273
- @media (width >= 64em) {
274
- &:not(
275
- .usa-nav__primary button[aria-expanded="true"],
306
+ @media (width >=64em) {
307
+
308
+ &:not(.usa-nav__primary button[aria-expanded="true"],
276
309
  .usa-nav__primary button:hover,
277
310
  .usa-nav__primary > .usa-nav__primary-item > a:hover,
278
- .usa-current
279
- ) {
311
+ .usa-current) {
280
312
  @if $usx-header-nav-link-text {
281
313
  color: $usx-header-nav-link-text;
282
314
  }
283
315
 
284
- &> span::after {
316
+ &>span::after {
285
317
  @if $usx-header-nav-link-text {
286
318
  background-color: $usx-header-nav-link-text;
287
319
  }
@@ -292,7 +324,7 @@
292
324
  // Desktop: current text stays the plain link color — only the bottom bar
293
325
  // (above) marks state, matching vendor (no .usa-current color override
294
326
  // exists in vendor's desktop rules).
295
- @media (width >= 64em) {
327
+ @media (width >=64em) {
296
328
  &.usa-current {
297
329
  @if $usx-header-nav-link-text {
298
330
  color: $usx-header-nav-link-text;
@@ -336,7 +368,8 @@
336
368
  // (left-side) current-page indicator instead, and never shows one on
337
369
  // hover at all — showing this bar unconditionally put it on every mobile
338
370
  // nav item (including dropdown toggles) on hover, which vendor never does.
339
- @media (width >= 64em) {
371
+ @media (width >=64em) {
372
+
340
373
  &:hover,
341
374
  &.usa-current {
342
375
  position: relative;
@@ -366,18 +399,19 @@
366
399
  // white background and border-top separators are the only styling, so
367
400
  // applying this unconditionally painted a dark box (with the still-gray,
368
401
  // unthemed link text from above) over the mobile accordion toggle/panel.
369
- @media (width >= 64em) {
402
+ @media (width >=64em) {
370
403
  &[aria-expanded="true"] {
371
404
  @if $usx-header-nav-link-bg {
372
405
  background-color: $usx-header-nav-link-bg !important;
373
406
  }
374
407
 
375
- & + .usa-nav__submenu {
408
+ &+.usa-nav__submenu {
376
409
  @if $usx-header-nav-submenu-bg {
377
410
  background-color: $usx-header-nav-submenu-bg;
378
411
  }
379
412
 
380
- &::before, &::after {
413
+ &::before,
414
+ &::after {
381
415
  @if $usx-header-nav-submenu-bg {
382
416
  background-color: $usx-header-nav-submenu-bg;
383
417
  }
@@ -387,7 +421,7 @@
387
421
  }
388
422
  }
389
423
 
390
- .usa-nav__secondary-item > a {
424
+ .usa-nav__secondary-item>a {
391
425
  @if $usx-header-secondary-link-text {
392
426
  color: $usx-header-secondary-link-text;
393
427
  }
@@ -400,12 +434,17 @@
400
434
  }
401
435
 
402
436
  @media (width < 64em) {
403
- .usa-nav__primary-item, .usa-nav__submenu-item {
437
+
438
+ .usa-nav__primary-item,
439
+ .usa-nav__submenu-item {
440
+
404
441
  // USWDS's own default is a border color (#dfe1e2), not a text color —
405
442
  // $usx-header-nav-link-text was the wrong token here.
406
443
  @if $usx-header-nav-border-top {
407
444
  border-top: $usx-header-nav-border-top;
408
- } @else {
445
+ }
446
+
447
+ @else {
409
448
  border-top: 1px solid #dfe1e2;
410
449
  }
411
450
  }
@@ -413,7 +452,7 @@
413
452
  // Submenu links are plain <a> tags with no .usa-nav__link class (see
414
453
  // Header.tsx), so the rule above never reaches them — left alone they
415
454
  // fall back to vendor's hardcoded gray/blue instead of the active theme.
416
- .usa-nav__submenu-item > a {
455
+ .usa-nav__submenu-item>a {
417
456
  @if $usx-header-nav-link-text {
418
457
  color: $usx-header-nav-link-text;
419
458
  }
@@ -438,4 +477,4 @@
438
477
  }
439
478
  }
440
479
 
441
- }
480
+ }
@@ -32,7 +32,7 @@
32
32
  content: '';
33
33
  position: absolute;
34
34
  inset: 0;
35
- background-color: rgb(0 0 0 / 55%);
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 / 60%);
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).
@@ -10,12 +10,27 @@
10
10
  // instead of leaving the compiled defaults frozen.
11
11
 
12
12
  .usa-in-page-nav-container {
13
+ // Lets the sticky <aside> inside stick across its ancestor's full height
14
+ // (e.g. Layout's right sidebar, which stretches via CSS grid) instead of
15
+ // being bounded by this container's own (much shorter) content height.
16
+ height: 100%;
17
+
13
18
  main,
14
19
  .usx-in-page-nav__content {
15
20
  max-width: 100%;
16
21
  }
17
22
  }
18
23
 
24
+ .usx-layout__sidebar--right {
25
+
26
+ .usa-in-page-nav-container {
27
+
28
+ .usa-in-page-nav.usx-in-page-nav {
29
+ margin: 0;
30
+ }
31
+ }
32
+ }
33
+
19
34
  .usa-in-page-nav__nav {
20
35
  @if $usx-in-page-nav-bg {
21
36
  background-color: $usx-in-page-nav-bg;
@@ -13,17 +13,9 @@
13
13
  // | gutter | content (max-width 960px) | gutter |
14
14
 
15
15
  &__single-column {
16
- max-width: $max-layout-width;
16
+ max-width: calc($max-layout-width + units(4));
17
17
  margin: 0 auto;
18
- padding: 0 units(2.5);
19
-
20
- @include at-media('tablet') {
21
- padding: 0 units(4);
22
- }
23
-
24
- @include at-media('desktop') {
25
- padding: 0;
26
- }
18
+ padding: 0 units(2);
27
19
  }
28
20
 
29
21
  // ── Multi-column grid layout ──────────────────────────────────────────────
@@ -52,6 +44,7 @@
52
44
  &__content {
53
45
  grid-column: content-start / span content-end;
54
46
  grid-row: 1;
47
+ max-width: calc($max-layout-width + units(4));
55
48
 
56
49
 
57
50
  // Content that leaves space for a left sidebar
@@ -62,8 +55,7 @@
62
55
 
63
56
  @include at-media('desktop') {
64
57
  grid-column: content-start / span right-sidebar-end;
65
- width: $dynamic-content-width;
66
- margin: 0 units(4) 0 0;
58
+ padding-right: units(4);
67
59
  }
68
60
  }
69
61
 
@@ -75,9 +67,8 @@
75
67
 
76
68
  @include at-media('desktop') {
77
69
  grid-column: left-sidebar-start / span content-end;
78
- width: $dynamic-content-width;
79
- margin: 0 0 0 units(4);
80
70
  justify-self: flex-end;
71
+ padding-left: units(4);
81
72
  }
82
73
  }
83
74
  }
@@ -87,11 +78,13 @@
87
78
  &__sidebar--left {
88
79
  grid-column: left-sidebar-start / span content-start;
89
80
  grid-row: 1;
81
+ height: 100%;
90
82
  }
91
83
 
92
84
  &__sidebar--right {
93
85
  grid-column: content-end / span right-sidebar-end;
94
86
  grid-row: 1;
87
+ height: 100%;
95
88
  }
96
89
 
97
90
  // Hide sidebars on mobile/tablet, show on desktop
@@ -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 {