@usgb/forms 1.0.3 → 1.0.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.
@@ -2,6 +2,14 @@
2
2
  styles/variables.css. Hosts override semantic --usgb-* vars or classes
3
3
  on .usgb-form (see README). */
4
4
 
5
+ /* Custom elements default to `display: inline`; the <usgb-form> host must
6
+ be a full-width block so the form fills the space the page gives it. */
7
+ usgb-form {
8
+ display: block;
9
+ width: 100%;
10
+ min-width: 0;
11
+ }
12
+
5
13
  .usgb-form {
6
14
  --usgb-primary: #ffffff;
7
15
  --usgb-secondary: #000000;
@@ -21,9 +29,13 @@
21
29
  --usgb-hover: #5caad6;
22
30
  --usgb-sidebar-field-text: #333333;
23
31
  --usgb-sidebar-link: #275582;
24
- --usgb-font-primary: 'Montserrat', -apple-system, BlinkMacSystemFont,
25
- 'Helvetica Neue', Helvetica, sans-serif;
26
- --usgb-font-secondary: 'Kameron', Georgia, 'Times New Roman', serif;
32
+ /* Body copy inherits the host font (see font-family below), so it follows
33
+ WordPress ("Montserrat") and the PWA (next/font's hashed
34
+ "__Montserrat_…") alike. Set --usgb-font-primary to opt into an
35
+ explicit stack instead. The heading cannot inherit: it prefers the
36
+ PWA's next/font variable and falls back to the WordPress family name. */
37
+ --usgb-font-secondary: var(--font-kameron, 'Kameron'), Georgia,
38
+ 'Times New Roman', serif;
27
39
  --usgb-outline-focused: 2px solid var(--usgb-gold-1);
28
40
 
29
41
  --usgb-form-content: var(--usgb-text-base);
@@ -45,9 +57,10 @@
45
57
  --usgb-button-disabled-text: var(--usgb-primary);
46
58
  --usgb-newsletter-underline: var(--usgb-blue-1);
47
59
 
48
- --usgb-group-gap: 1.5rem;
49
- --usgb-grid-gap: 1rem;
50
- --usgb-grid-margin-bottom: 0;
60
+ --usgb-group-gap: 1.25rem;
61
+ /* Column gap in the name row. Variants inherit the field rhythm and
62
+ override this only when the columns should sit tighter. */
63
+ --usgb-grid-gap: var(--usgb-group-gap);
51
64
  --usgb-heading-font-size: 2rem;
52
65
  --usgb-heading-font-weight: 700;
53
66
  --usgb-heading-line-height: 2.75rem;
@@ -97,13 +110,11 @@
97
110
  --usgb-button-width: 100%;
98
111
 
99
112
  box-sizing: border-box;
100
- font-family: var(--usgb-font-primary);
113
+ font-family: var(--usgb-font-primary, inherit);
101
114
  color: var(--usgb-form-content);
102
115
  width: 100%;
103
-
104
- /* Hosts drop this form into sidebars and multi-column blocks, so its own
105
- width — not the viewport's — decides how many fields fit per row. */
106
- container: usgb-form / inline-size;
116
+ /* Lets the form shrink next to siblings when it is a flex/grid item. */
117
+ min-width: 0;
107
118
  }
108
119
 
109
120
  /* Landing-page heading steps up on desktop; sidebar and newsletter set
@@ -132,7 +143,7 @@
132
143
  display: grid;
133
144
  grid-template-columns: 1fr;
134
145
  gap: var(--usgb-grid-gap);
135
- margin-bottom: var(--usgb-grid-margin-bottom);
146
+ margin-bottom: var(--usgb-group-gap);
136
147
  }
137
148
 
138
149
  /* Name row only — do not stack form-group margin on top of grid gap. */
@@ -140,20 +151,15 @@
140
151
  margin-bottom: 0;
141
152
  }
142
153
 
143
- @container usgb-form (min-width: 20rem) {
144
- .usgb-form[data-layout='two-column'] .usgb-form-grid {
145
- grid-template-columns: 1fr 1fr;
146
- }
147
- }
148
-
149
- /* Safari < 16 / Firefox < 110 have no container queries; fall back to the
150
- viewport so those browsers still get a two-up name row on desktop. */
151
- @supports not (container-type: inline-size) {
152
- @media (min-width: 768px) {
153
- .usgb-form[data-layout='two-column'] .usgb-form-grid {
154
- grid-template-columns: 1fr 1fr;
155
- }
156
- }
154
+ /* Two-up when the row has room for two ~10rem fields, one column otherwise.
155
+ Sized from the grid's own width, so it works in sidebars and flex rows
156
+ without a container query (and the inline-size containment it imposes,
157
+ which would zero the form's natural width inside content-sized parents). */
158
+ .usgb-form[data-layout='two-column'] .usgb-form-grid {
159
+ grid-template-columns: repeat(
160
+ auto-fit,
161
+ minmax(min(100%, var(--usgb-grid-column-min, 10rem)), 1fr)
162
+ );
157
163
  }
158
164
 
159
165
  /* Heading, subheading, status */
@@ -471,9 +477,7 @@
471
477
 
472
478
  /* Dense shares the landing-page type scale with large; spacing stays dense. */
473
479
  .usgb-form[data-variant~='dense'] {
474
- --usgb-group-gap: 1.25rem;
475
- --usgb-grid-gap: 1rem;
476
- --usgb-grid-margin-bottom: 1.25rem;
480
+ --usgb-group-gap: 1.125rem;
477
481
  --usgb-subheading-font-size: 1.125rem;
478
482
  --usgb-subheading-font-weight: 500;
479
483
  --usgb-subheading-line-height: 1.75rem;
@@ -481,10 +485,22 @@
481
485
  --usgb-consent-font-weight: 400;
482
486
  --usgb-consent-line-height: 1.4;
483
487
  --usgb-consent-transform: none;
488
+ /* The row's own margin would stack on the group margin. */
489
+ --usgb-consent-margin-bottom: 0;
484
490
  --usgb-button-font-size: 1.125rem;
485
491
  --usgb-button-line-height: 1.125rem;
486
492
  }
487
493
 
494
+ /* 6px between consents. A trailing notice has no field-group margin of its
495
+ own, so it keeps the field gap above the button. */
496
+ .usgb-form[data-variant~='dense'] .usgb-consent-notice {
497
+ margin-bottom: var(--usgb-group-gap);
498
+ }
499
+
500
+ .usgb-form[data-variant~='dense'] .usgb-consent:has(+ .usgb-consent) {
501
+ margin-bottom: 0.375rem;
502
+ }
503
+
488
504
  @media (min-width: 768px) {
489
505
  .usgb-form[data-variant~='dense'] {
490
506
  --usgb-subheading-line-height: 1.8125rem;
@@ -497,8 +513,6 @@
497
513
  .usgb-form[data-variant~='sidebar'] {
498
514
  --usgb-field-text: var(--usgb-sidebar-field-text);
499
515
  --usgb-group-gap: 0.625rem;
500
- --usgb-grid-gap: 0.625rem;
501
- --usgb-grid-margin-bottom: 0.625rem;
502
516
  --usgb-heading-font-size: 1.25rem;
503
517
  --usgb-heading-line-height: 1.25;
504
518
  --usgb-heading-margin: 0 0 0.5rem;
@@ -527,6 +541,7 @@
527
541
 
528
542
  .usgb-form[data-variant~='sidebar'][data-appearance='on-light'] {
529
543
  --usgb-field-border: var(--usgb-grey-4);
544
+ --usgb-checkbox-border: var(--usgb-grey-1);
530
545
  --usgb-link: var(--usgb-sidebar-link);
531
546
  }
532
547
 
@@ -547,8 +562,6 @@
547
562
  button. */
548
563
  .usgb-form[data-variant~='large'] {
549
564
  --usgb-group-gap: 1.25rem;
550
- --usgb-grid-gap: 1.25rem;
551
- --usgb-grid-margin-bottom: 1.25rem;
552
565
  --usgb-heading-font-size: 2rem;
553
566
  --usgb-heading-font-weight: 700;
554
567
  --usgb-heading-line-height: 2.75rem;