@solexllc/usx 0.1.7 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solexllc/usx",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
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.2.2"
35
+ "@solexllc/usx-theme": "0.3.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "sass": "^1.98.0"
@@ -56,29 +56,22 @@
56
56
  }
57
57
  }
58
58
 
59
- .usx-rounded-sm {
60
- border-radius: $usx-radius-sm;
61
- overflow: clip;
62
- }
63
-
64
- .usx-rounded-md {
65
- border-radius: $usx-radius-md;
66
- overflow: clip;
67
- }
68
-
69
- .usx-rounded-lg {
70
- border-radius: $usx-radius-lg;
71
- overflow: clip;
59
+ @each $radius-name, $radius-value in $border-radius {
60
+ .usx-rounded-#{$radius-name} {
61
+ border-radius: $radius-value !important;
62
+ overflow: clip;
63
+ }
72
64
  }
73
65
 
74
- .usx-rounded-xl {
75
- border-radius: $usx-radius-xl;
66
+ .usx-circle {
67
+ border-radius: $usx-radius-full !important;
76
68
  overflow: clip;
77
69
  }
78
70
 
79
- .usx-circle {
80
- border-radius: $usx-radius-full;
81
- overflow: clip;
71
+ @each $width-name, $width-value in $border-width {
72
+ .usx-border-#{$width-name} {
73
+ border-width: $width-value !important;
74
+ }
82
75
  }
83
76
 
84
77
  .usx-ping {
@@ -44,6 +44,8 @@
44
44
  .usx-avatar__img {
45
45
  height: auto;
46
46
  width: auto;
47
+ max-height: 100%;
48
+ max-width: 100%;
47
49
  }
48
50
 
49
51
  .usx-avatar__content {
@@ -0,0 +1,89 @@
1
+ @use 'pkg:@solexllc/usx-theme/variables' as *;
2
+
3
+ /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
4
+ .usa-card.usx-card {
5
+ > .usa-card__container {
6
+ background-color: usx-when($usx-card-bg);
7
+ color: usx-when($usx-card-text);
8
+ border-color: usx-when($usx-card-border-color);
9
+ border-width: usx-when($usx-card-border-width);
10
+ border-radius: usx-when($usx-card-radius);
11
+ }
12
+
13
+ .usa-card__heading {
14
+ color: usx-when($usx-card-heading-text);
15
+ }
16
+
17
+ .usa-card__img {
18
+ background-color: usx-when($usx-card-media-bg);
19
+ }
20
+
21
+ @if $usx-card-radius and $usx-card-border-width {
22
+ $inner-radius: max(0px, calc(#{$usx-card-radius} - #{$usx-card-border-width}));
23
+
24
+ .usa-card__img {
25
+ border-radius: $inner-radius $inner-radius 0 0;
26
+ }
27
+
28
+ .usa-card__media--exdent .usa-card__img {
29
+ border-radius: $usx-card-radius $usx-card-radius 0 0;
30
+ }
31
+
32
+ &.usa-card--header-first {
33
+ .usa-card__header {
34
+ border-radius: $inner-radius $inner-radius 0 0;
35
+ }
36
+
37
+ .usa-card__img {
38
+ border-radius: 0;
39
+ }
40
+ }
41
+
42
+ .usa-card__media--inset .usa-card__img {
43
+ border-radius: 0;
44
+ }
45
+
46
+ @media (min-width: $breakpoint-tablet) {
47
+ &.usa-card--flag {
48
+ .usa-card__img {
49
+ border-radius: $inner-radius 0 0 $inner-radius;
50
+ }
51
+
52
+ .usa-card__media--exdent .usa-card__img {
53
+ border-radius: $usx-card-radius 0 0 $usx-card-radius;
54
+ }
55
+
56
+ &.usa-card--media-right {
57
+ .usa-card__img {
58
+ border-radius: 0 $inner-radius $inner-radius 0;
59
+ }
60
+
61
+ .usa-card__media--exdent .usa-card__img {
62
+ border-radius: 0 $usx-card-radius $usx-card-radius 0;
63
+ }
64
+ }
65
+
66
+ .usa-card__media--inset .usa-card__img {
67
+ border-radius: 0;
68
+ }
69
+ }
70
+ }
71
+ }
72
+
73
+ @if $usx-card-border-width {
74
+ .usa-card__media--exdent {
75
+ margin-inline: calc(-1 * #{$usx-card-border-width});
76
+ margin-top: calc(-1 * #{$usx-card-border-width});
77
+ }
78
+
79
+ &.usa-card--header-first .usa-card__media--exdent {
80
+ margin-top: 0;
81
+ }
82
+
83
+ @media (min-width: $breakpoint-tablet) {
84
+ &.usa-card--flag .usa-card__media--exdent {
85
+ margin: calc(-1 * #{$usx-card-border-width});
86
+ }
87
+ }
88
+ }
89
+ }
@@ -86,9 +86,9 @@
86
86
  .usa-nav__inner {
87
87
  margin-left: auto;
88
88
  margin-right: auto;
89
- max-width: calc($max-layout-width + 4rem);
90
- padding-left: 2rem;
91
- padding-right: 2rem;
89
+ max-width: usx-when($max-layout-width, $max-layout-width, 64rem);
90
+ padding-left: units(4);
91
+ padding-right: units(4);
92
92
  position: relative;
93
93
 
94
94
  // .usa-nav__close (mobile-only) is hidden at this width, and
@@ -140,9 +140,9 @@
140
140
 
141
141
  .usa-nav__submenu.usa-megamenu {
142
142
  left: 0;
143
- padding-left: 2rem;
144
- padding-right: 2rem;
145
- max-width: calc($max-layout-width + 4rem);
143
+ padding-left: units(4);
144
+ padding-right: units(4);
145
+ max-width: usx-when($max-layout-width, $max-layout-width, 64rem);
146
146
  margin-left: auto;
147
147
  margin-right: auto;
148
148
  }
@@ -228,10 +228,7 @@
228
228
  }
229
229
 
230
230
  .usa-nav__inner {
231
- @if $max-layout-width {
232
- max-width: calc($max-layout-width + 4rem);
233
- }
234
-
231
+ max-width: usx-when($max-layout-width, $max-layout-width, 64rem);
235
232
  margin-left: auto;
236
233
  margin-right: auto;
237
234
  padding-left: 1rem;
@@ -36,14 +36,9 @@
36
36
  position: relative;
37
37
  z-index: 1;
38
38
  width: 100%;
39
- max-width: $max-layout-width;
39
+ max-width: usx-when($max-layout-width, $max-layout-width, 64rem);
40
40
  margin-inline: auto;
41
- padding-block: 4rem;
42
- padding-inline: 1.5rem;
43
-
44
- padding-block: usx-when($usx-hero-padding-block);
45
-
46
- padding-inline: usx-when($usx-hero-padding-inline);
41
+ padding: 0 units(4);
47
42
  }
48
43
 
49
44
  &--has-overlay.usx-hero--custom-overlay::before {
@@ -54,7 +49,7 @@
54
49
  min-width: 0;
55
50
  overflow-wrap: anywhere;
56
51
  max-width: 40rem;
57
- padding: 2rem;
52
+ padding: units(4);
58
53
  background-color: rgb(0 0 0 / 90%);
59
54
 
60
55
  // Radius follows the app-wide radius-box group (null/square by default,
@@ -85,7 +80,7 @@
85
80
 
86
81
  &__secondary {
87
82
  min-width: 0;
88
- margin-top: 2rem;
83
+ margin-top: units(4);
89
84
  overflow-wrap: anywhere;
90
85
  }
91
86
 
@@ -2,18 +2,79 @@
2
2
 
3
3
  /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
4
4
  .usx-layout {
5
- min-height: 100vh;
5
+ position: relative;
6
6
 
7
7
  background-color: usx-when($usx-surface-1);
8
8
 
9
+ &.usx-expanded {
10
+ .usx-layout__single-column,
11
+ .usx-layout__content {
12
+ max-width: 1600px;
13
+ }
14
+
15
+ .usx-layout__grid-container {
16
+ grid-template-columns:
17
+ [page-start] units(2) [left-sidebar-start] 0 [content-start] minmax(0, 1600px) [content-end] 0 [right-sidebar-end] units(2) [page-end];
18
+
19
+ @include at-media('tablet') {
20
+ grid-template-columns:
21
+ [page-start] units(4) [left-sidebar-start] 0 [content-start] minmax(0, 1600px) [content-end] 0 [right-sidebar-end] units(4) [page-end];
22
+ }
23
+
24
+ @include at-media('desktop') {
25
+ grid-template-columns:
26
+ [page-start] 1fr [left-sidebar-start] $max-sidebar-width [content-start] minmax(0, 1600px) [content-end] $max-sidebar-width [right-sidebar-end] 1fr [page-end];
27
+ }
28
+ }
29
+ }
30
+
31
+ &__expand-button {
32
+ display: none;
33
+ position: absolute;
34
+ right: calc(0px - units(4));
35
+ top: 0;
36
+ width: units(5);
37
+ height: units(5);
38
+ padding: 0;
39
+ border: none;
40
+ cursor: pointer;
41
+ align-items: center;
42
+ justify-content: center;
43
+ z-index: 1;
44
+ color: usx-when($usx-color-primary, #005ea2);
45
+
46
+ // Below this width there's no room to grow into, so hide the toggle.
47
+ @include at-media('desktop') {
48
+ display: flex;
49
+ }
50
+
51
+ &:hover,
52
+ &:focus {
53
+ opacity: 1;
54
+ }
55
+ }
56
+
57
+ &__expand-icon--contract {
58
+ display: none;
59
+ }
60
+
61
+ &.usx-expanded &__expand-icon--expand {
62
+ display: none;
63
+ }
64
+
65
+ &.usx-expanded &__expand-icon--contract {
66
+ display: block;
67
+ }
68
+
9
69
  // ── Single column layout ──────────────────────────────────────────────────
10
70
  // Centers content with max-width and responsive gutters
11
71
  // | gutter | content (max-width 960px) | gutter |
12
72
 
13
73
  &__single-column {
14
- max-width: calc($max-layout-width + units(4));
74
+ max-width: usx-when($max-layout-width, $max-layout-width, 64rem);
15
75
  margin: 0 auto;
16
- padding: 0 units(2);
76
+ padding: 0 units(4);
77
+ position: relative;
17
78
  }
18
79
 
19
80
  // ── Multi-column grid layout ──────────────────────────────────────────────
@@ -21,28 +82,35 @@
21
82
  // | gutter | left sidebar | content | right sidebar | gutter |
22
83
 
23
84
  &__grid-container {
85
+ position: relative;
24
86
  display: grid;
25
87
  grid-template-rows: auto;
26
88
  grid-template-columns:
27
- [page-start] units(2) [left-sidebar-start] 0 [content-start] minmax(0, $max-layout-width) [content-end] 0 [right-sidebar-end] units(2) [page-end];
89
+ [page-start] units(2) [left-sidebar-start] 0 [content-start] minmax(0, usx-when($max-layout-width, $max-layout-width, 64rem)) [content-end] 0 [right-sidebar-end] units(2) [page-end];
28
90
 
29
91
  @include at-media('tablet') {
30
92
  grid-template-columns:
31
- [page-start] units(4) [left-sidebar-start] 0 [content-start] minmax(0, $max-layout-width) [content-end] 0 [right-sidebar-end] units(4) [page-end];
93
+ [page-start] units(4) [left-sidebar-start] 0 [content-start] minmax(0, usx-when($max-layout-width, $max-layout-width, 64rem)) [content-end] 0 [right-sidebar-end] units(4) [page-end];
32
94
  }
33
95
 
34
96
  @include at-media('desktop') {
35
97
  grid-template-columns:
36
- [page-start] 1fr [left-sidebar-start] $max-sidebar-width [content-start] minmax(0, $max-layout-width) [content-end] $max-sidebar-width [right-sidebar-end] 1fr [page-end];
98
+ [page-start] 1fr [left-sidebar-start] $max-sidebar-width [content-start] minmax(0, usx-when($max-layout-width, $max-layout-width, 64rem)) [content-end] $max-sidebar-width [right-sidebar-end] 1fr [page-end];
37
99
  }
38
100
  }
39
101
 
40
102
  // ── Content areas ─────────────────────────────────────────────────────────
41
103
 
42
104
  &__content {
105
+ position: relative;
43
106
  grid-column: content-start / span content-end;
44
107
  grid-row: 1;
45
- max-width: calc($max-layout-width + units(4));
108
+ max-width: usx-when($max-layout-width, $max-layout-width, 64rem);
109
+ padding: 0 units(4);
110
+
111
+ .usx-layout__expand-button {
112
+ top: units(3);
113
+ }
46
114
 
47
115
 
48
116
  // Content that leaves space for a left sidebar
@@ -65,10 +133,17 @@
65
133
 
66
134
  @include at-media('desktop') {
67
135
  grid-column: left-sidebar-start / span content-end;
68
- justify-self: flex-end;
136
+ width: 100%;
137
+ justify-self: end;
69
138
  padding-left: units(4);
70
139
  }
71
140
  }
141
+
142
+ &:not(&--right) {
143
+ .usx-layout__expand-button {
144
+ right: units(4);
145
+ }
146
+ }
72
147
  }
73
148
 
74
149
  // ── Sidebar areas ─────────────────────────────────────────────────────────
@@ -77,19 +152,20 @@
77
152
  grid-column: left-sidebar-start / span content-start;
78
153
  grid-row: 1;
79
154
  height: 100%;
155
+ padding: 0 0 0 units(4);
80
156
  }
81
157
 
82
158
  &__sidebar--right {
83
159
  grid-column: content-end / span right-sidebar-end;
84
160
  grid-row: 1;
85
161
  height: 100%;
162
+ padding: 0 units(4) 0 0;
86
163
  }
87
164
 
88
165
  // Hide sidebars on mobile/tablet, show on desktop
89
166
  &__sidebar--right,
90
167
  &__sidebar--left {
91
168
  display: none;
92
- padding: 0 units(4);
93
169
 
94
170
  @include at-media('desktop') {
95
171
  display: block;
@@ -50,7 +50,7 @@
50
50
  .usx-misc-banner__return-text {
51
51
  margin: 0;
52
52
  position: relative;
53
- padding-left: 2rem;
53
+ padding-left: units(4);
54
54
  display: none;
55
55
  margin-left: auto;
56
56
 
@@ -26,7 +26,7 @@
26
26
  }
27
27
 
28
28
  .usa-modal__main {
29
- padding: 2rem;
29
+ padding: units(4);
30
30
  padding-top: 0;
31
31
  width: 100%;
32
32
  max-width: 100%;
@@ -2,8 +2,8 @@
2
2
 
3
3
  /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
4
4
  .usx-page {
5
- margin-top: 2rem;
6
- margin-bottom: 4rem;
5
+ margin-top: units(4);
6
+ margin-bottom: units(8);
7
7
 
8
8
  background-color: usx-when($usx-page-bg);
9
9
 
@@ -18,7 +18,7 @@
18
18
  display: block;
19
19
 
20
20
  p {
21
- max-width: 64ex;
21
+ max-width: usx-when($max-layout-width, $max-layout-width, 64rem);
22
22
  }
23
23
  }
24
24
  }
@@ -166,12 +166,12 @@
166
166
  display: flex;
167
167
 
168
168
  .usa-pagination__link {
169
- padding: .5rem;
169
+ padding: units(1);
170
170
  margin: 0;
171
171
 
172
172
  .usa-icon {
173
- height: 2rem;
174
- width: 2rem;
173
+ height: units(4);
174
+ width: units(4);
175
175
  }
176
176
  }
177
177
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
4
4
  .usx-section {
5
- margin: 2rem 0;
5
+ margin: units(4) 0;
6
6
 
7
7
  background-color: usx-when($usx-section-bg);
8
8
 
@@ -3,7 +3,7 @@
3
3
  /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
4
4
  .usx-layout {
5
5
  .usx-sidenav {
6
- margin-top: 2rem;
6
+ margin-top: units(4);
7
7
  }
8
8
  }
9
9
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  &.usx-sidenav--sticky {
16
16
  position: sticky;
17
- top: 2rem;
17
+ top: units(4);
18
18
  }
19
19
 
20
20
  .usa-sidenav__item {
@@ -1,3 +1,5 @@
1
+ @use 'pkg:@solexllc/usx-theme/variables' as *;
2
+
1
3
  @keyframes usx-spin {
2
4
  from {
3
5
  transform: rotate(0deg);
@@ -10,11 +12,24 @@
10
12
 
11
13
  /* stylelint-disable selector-class-pattern -- Public USX classes use BEM naming. */
12
14
  .usx-spinner {
13
- animation: usx-spin 800ms infinite linear;
14
- will-change: transform;
15
+ display: flex;
16
+ flex-direction: row;
17
+ justify-content: center;
18
+ align-items: center;
19
+ width: fit-content;
20
+
21
+ .usa-label.usx-label {
22
+ margin: 0 0 0 units(2);
23
+ font-style: italic;
24
+ }
25
+
26
+ svg {
27
+ animation: usx-spin 800ms infinite linear;
28
+ will-change: transform;
15
29
 
16
- @media (forced-colors: active) {
17
- forced-color-adjust: auto;
30
+ @media (forced-colors: active) {
31
+ forced-color-adjust: auto;
32
+ }
18
33
  }
19
34
  }
20
35
 
@@ -266,7 +266,7 @@
266
266
  // ── Placeholder ───────────────────────────────────────────────────────────────
267
267
  .usx-table__placeholder-cell {
268
268
  text-align: center;
269
- padding: 2rem 1rem;
269
+ padding: units(4) units(2);
270
270
  font-style: italic;
271
271
 
272
272
  color: usx-when($usx-table-placeholder-text);
@@ -116,6 +116,16 @@ textarea,
116
116
  font-family: $usx-font-family;
117
117
  }
118
118
 
119
+ .usx-card {
120
+ .usa-card__container {
121
+ font-family: $usx-font-family;
122
+ }
123
+
124
+ .usa-card__heading {
125
+ font-family: $usx-font-family-heading;
126
+ }
127
+ }
128
+
119
129
  .usx-step-indicator {
120
130
  font-family: $usx-font-family;
121
131
 
@@ -143,3 +153,19 @@ textarea,
143
153
  .usx-accordion {
144
154
  font-family: $usx-font-family;
145
155
  }
156
+
157
+ .usx-section {
158
+
159
+ h2.usx-section__title {
160
+ font-family: $usx-font-family-heading;
161
+ font-size: $usx-font-size-h2;
162
+ }
163
+ }
164
+
165
+ .usx-page {
166
+
167
+ h1.usx-page__title {
168
+ font-family: $usx-font-family-heading;
169
+ font-size: $usx-font-size-h1;
170
+ }
171
+ }
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="11.1664 10.5 24.0006 24.0039" width="24" height="24">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="currentColor" d="M20.9401 16.9421V10.5H17.6068V16.9421H11.1664V20.2754H20.9401V20.2716V16.9421ZM20.9401 28.0618V34.5039H17.6068V28.0618H11.1664V24.7285H20.9401V24.7323V28.0618ZM25.3933 10.5V16.9421V20.2716V20.2754H35.167V16.9421H28.7266V10.5H25.3933ZM25.3933 28.0618V34.5039H28.7266V28.0618H35.167V24.7285H25.3933V24.7323V28.0618Z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="10.5 10.5 24 24" width="24" height="24">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="currentColor" d="M10.5 13.8333V20.2754H13.8333L13.8333 13.8333H20.2738V10.5H10.5V10.5038V13.8333ZM10.5 31.1706V24.7285H13.8333L13.8333 31.1706H20.2738V34.5039H10.5V34.5002V31.1706ZM34.5 20.2754V13.8333V10.5038V10.5H24.7262V13.8333H31.1667L31.1667 20.2754H34.5ZM34.5 31.1706V24.7285H31.1667L31.1667 31.1706H24.7262V34.5039H34.5V34.5002V31.1706Z" />
3
+ </svg>
@@ -1,5 +1,7 @@
1
1
  {
2
2
  "items": [
3
- { "name": "spinner", "meta": "loading spin progress busy wait" }
3
+ { "name": "spinner", "meta": "loading spin progress busy wait" },
4
+ { "name": "expand", "meta": "expand enlarge widen maximize" },
5
+ { "name": "contract", "meta": "contract shrink narrow minimize collapse" }
4
6
  ]
5
7
  }
@@ -7,6 +7,12 @@
7
7
  search.
8
8
  Reference icons with: <use href="./img/usx-sprite.svg#icon-name" />
9
9
  -->
10
+ <symbol id="contract" viewBox="11.1664 10.5 24.0006 24.0039">
11
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="currentColor" d="M20.9401 16.9421V10.5H17.6068V16.9421H11.1664V20.2754H20.9401V20.2716V16.9421ZM20.9401 28.0618V34.5039H17.6068V28.0618H11.1664V24.7285H20.9401V24.7323V28.0618ZM25.3933 10.5V16.9421V20.2716V20.2754H35.167V16.9421H28.7266V10.5H25.3933ZM25.3933 28.0618V34.5039H28.7266V28.0618H35.167V24.7285H25.3933V24.7323V28.0618Z" />
12
+ </symbol>
13
+ <symbol id="expand" viewBox="10.5 10.5 24 24">
14
+ <path fill-rule="evenodd" clip-rule="evenodd" fill="currentColor" d="M10.5 13.8333V20.2754H13.8333L13.8333 13.8333H20.2738V10.5H10.5V10.5038V13.8333ZM10.5 31.1706V24.7285H13.8333L13.8333 31.1706H20.2738V34.5039H10.5V34.5002V31.1706ZM34.5 20.2754V13.8333V10.5038V10.5H24.7262V13.8333H31.1667L31.1667 20.2754H34.5ZM34.5 31.1706V24.7285H31.1667L31.1667 31.1706H24.7262V34.5039H34.5V34.5002V31.1706Z" />
15
+ </symbol>
10
16
  <symbol id="spinner" viewBox="0 0 24 24">
11
17
  <!-- Track: full circle at low opacity -->
12
18
  <circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2.5" opacity="0.2" />
package/src/index.scss CHANGED
@@ -37,6 +37,7 @@
37
37
  @forward './components/pagination';
38
38
  @forward './components/modal';
39
39
  @forward './components/summary-box';
40
+ @forward './components/card';
40
41
  @forward './components/sidenav';
41
42
  @forward './components/icon-list';
42
43
  @forward './components/step-indicator';