@solexllc/usx 0.1.2 → 0.1.4

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