@solexllc/usx-react 0.2.0 → 0.3.1

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
@@ -33,6 +33,118 @@ at the repo root for the full, up-to-date list of implemented components.
33
33
 
34
34
  ## Token usage
35
35
 
36
+ ### Responsive Layout
37
+
38
+ `.usx-layout` owns the responsive outer padding: 12px (1.5 units)
39
+ below desktop and 32px (4 units) at desktop. `SingleColumnLayout` and the grid's
40
+ main content have no padding. The left sidebar has 32px of right padding, and
41
+ the right sidebar has 32px of left padding, keeping the inner gap large at
42
+ every width where sidebars are visible. These gaps are included in the sidebar
43
+ widths. Expanded sidebars extend into the outer gutter without removing the
44
+ inner gap. CSS container queries show supplied sidebars when
45
+ their combined widths fit alongside the minimum main-column width, capped by
46
+ the normal content maximum. Both sidebars appear together when both are supplied.
47
+ This works for expandable and non-expandable layouts and does not change when
48
+ expansion is toggled. Each sidebar adds 16rem outside
49
+ the configured 64rem content maximum. The unpadded main-column cap subtracts
50
+ twice the current outer gutter from that maximum, preserving the previous
51
+ readable width. The same subtraction applies to the expanded maximum.
52
+ A grid without sidebars matches the
53
+ single-column layout at every width. Expansion changes the content maximum to
54
+ 100rem without changing gutters or sidebar visibility.
55
+
56
+ The main content, rather than the combined content-and-sidebar group, centers
57
+ when there is enough space on both sides. With default widths, all variants
58
+ align at 96rem of outer width (64rem configured content width plus room for a
59
+ 16rem sidebar on either side).
60
+ Before that point, visible columns fill the available width until they reach
61
+ their caps; absent sidebars do not reserve tracks. A one-sidebar layout may
62
+ remain off-center while there is insufficient space to center its capped main
63
+ column without overlapping the sidebar. Expanded content aligns at 132rem of
64
+ outer width.
65
+
66
+ With the themed stylesheet and generated theme CSS loaded, these runtime tokens
67
+ can be set on a layout or an ancestor:
68
+
69
+ | Token | Default |
70
+ | --- | --- |
71
+ | `--usx-layout-gutter-mobile` | `0.75rem` |
72
+ | `--usx-layout-gutter` | `2rem` |
73
+
74
+ The desktop gutter token also supplies the fixed inner sidebar gap. Widths and
75
+ their container-query thresholds are configured together at Sass compile time:
76
+
77
+ | Sass variable | Default |
78
+ | --- | --- |
79
+ | `$usx-layout-max-width` | `64rem` |
80
+ | `$usx-layout-expanded-max-width` | `100rem` |
81
+ | `$usx-layout-sidebar-width` | `16rem` |
82
+ | `$usx-layout-content-min-width` | `32rem` |
83
+
84
+ The minimum main-column width is unpadded content space. Set it to match
85
+ the reading or control space your content needs. Default sidebar thresholds
86
+ are 48rem with one sidebar and 64rem with both. A narrow theme with 12rem
87
+ sidebars needs 44rem with one and 56rem with both. Measurements use the parent
88
+ layout's content-box width after outer padding, not the viewport, so embedded
89
+ layouts behave the same way. With default 16px root text and gutter values,
90
+ sidebars appear at outer widths of 792px (one) and 1088px (both).
91
+ Use nonnegative length values; percentage widths are not supported for these
92
+ grid sizing tokens. Sidebar detection uses CSS `:has()` with direct children.
93
+ Hidden sidebar content is also unavailable to assistive technology: provide
94
+ essential navigation or actions elsewhere on small screens.
95
+
96
+ For a static Sass build, configure the matching `$usx-layout-*` variables before
97
+ loading component styles. Existing `$max-layout-width` and `$max-sidebar-width`
98
+ remain the static defaults when the new width settings are unset. Runtime gutter
99
+ hooks take precedence in the themed build. `$usx-layout-breakpoint` defaults to
100
+ `$breakpoint-desktop` (1024px) and accepts a CSS length such as `880px`.
101
+ It controls outer gutters and USX-owned desktop transitions, including Hero,
102
+ MiscBanner, Pagination, and `at-media('desktop')`, not sidebar visibility. Configure it at
103
+ compile time, since CSS custom properties cannot set media-query thresholds.
104
+
105
+ CSS container queries show the expand/contract button only when the two widths
106
+ differ by more than one pixel, accounting for visible sidebar tracks. React
107
+ only manages the expanded state; there are no JavaScript size measurements.
108
+ The expanded state is preserved when resizing temporarily removes the difference.
109
+ Django and static HTML use the same sizing and visibility rules.
110
+
111
+ The `layout.sizing()` mixin accepts `$gutter-mobile` and `$gutter` lengths
112
+ (defaults: `$usx-layout-gutter-mobile-default`, 12px, and
113
+ `$usx-layout-gutter-default`, 32px). It uses these for static padding and subtracts them
114
+ from the expansion thresholds at the corresponding viewport breakpoint.
115
+ For custom gutters, pass the same lengths used by your runtime gutter tokens
116
+ or static Sass overrides. CSS size queries cannot read custom properties, so
117
+ changing runtime gutters alone does not update the compiled button threshold.
118
+ The compact comparison uses `$gutter-mobile: 1rem` and `$gutter: 2.5rem`.
119
+
120
+ The custom grid does not require `grid-row`, `grid-col`, or `grid-gap`. Shared
121
+ `grid-container`, Banner, Header, Hero, MiscBanner, and Identifier containers use
122
+ the same maximum and responsive gutters. Hero's horizontal tablet padding now
123
+ matches Layout rather than adding a separate intermediate gutter. Do not add a
124
+ second padded `grid-container` around Layout unless nested gutters are intended.
125
+
126
+ Use `@include layout-container` for new page-shell containers, or
127
+ `@include layout-gutters` for padding alone. `at-media('desktop', 'max')` emits
128
+ an exclusive below-desktop query; `at-media('tablet')` reads
129
+ `$breakpoint-tablet`. The legacy `at-media('mobile')` means below tablet.
130
+ Legacy width and breakpoint variables remain default aliases, but new styles
131
+ should consume the `$usx-layout-*` settings and media helpers.
132
+
133
+ Load USWDS's precompiled CSS unchanged, then load USX as an overlay. No USWDS Sass
134
+ configuration or compilation is required. USX settings do not redefine upstream
135
+ `desktop:*` or `tablet:*` utilities. Header's mobile drawer and desktop structure
136
+ remain controlled by upstream CSS; use `at-media('uswds-header')` for appearance
137
+ overrides that must follow that transition. Its shared 64em compatibility value
138
+ is not a USWDS customization. Header container widths and gutters still use USX
139
+ layout settings. Use USX-owned selectors and media helpers when custom responsive
140
+ behavior is needed rather than changing the meaning of upstream utility classes.
141
+
142
+ Layout stories use fullscreen previews. `ResponsiveComparison` and
143
+ `ThemedComparison` cover no, left, right, and both sidebars. When checking
144
+ expansion, expand at desktop width and resize without reloading the story.
145
+
146
+ ### Component Tokens
147
+
36
148
  Component `.scss` files consume design token variables published by
37
149
  `@solexllc/usx-theme` (for example `$usx-color-primary`, `$usx-spacing-md`,
38
150
  `$usx-radius-md`). These compile to `var(--usx-*, <default>)` by default, so
package/dist/index.cjs CHANGED
@@ -1349,14 +1349,14 @@
1349
1349
  document.body.removeChild(ta);
1350
1350
  }
1351
1351
  }
1352
- function Code({ lines = [], copyText = null, className = "" }) {
1352
+ function Code({ lines = [], allowHtml = false, copyText = null, className = "" }) {
1353
1353
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames("usx-mockup-code", className), children: [
1354
1354
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-mockup-code__content", children: lines.map((line, i) => /* @__PURE__ */ jsxRuntime.jsx(
1355
1355
  "pre",
1356
1356
  {
1357
1357
  ...line.prefix != null ? { "data-prefix": line.prefix } : {},
1358
1358
  className: line.className || void 0,
1359
- children: /* @__PURE__ */ jsxRuntime.jsx("code", { dangerouslySetInnerHTML: { __html: line.code } })
1359
+ children: allowHtml ? /* @__PURE__ */ jsxRuntime.jsx("code", { dangerouslySetInnerHTML: { __html: line.code } }) : /* @__PURE__ */ jsxRuntime.jsx("code", { children: line.code })
1360
1360
  },
1361
1361
  i
1362
1362
  )) }),
@@ -2712,6 +2712,9 @@
2712
2712
  {
2713
2713
  variant: "primary",
2714
2714
  ghost: true,
2715
+ type: "button",
2716
+ "aria-label": expanded ? "Contract" : "Expand",
2717
+ "aria-expanded": expanded,
2715
2718
  className: "usx-layout__expand-button",
2716
2719
  onClick: () => setExpanded((value) => !value),
2717
2720
  children: [
package/dist/index.js CHANGED
@@ -1347,14 +1347,14 @@ function usxCopy(text) {
1347
1347
  document.body.removeChild(ta);
1348
1348
  }
1349
1349
  }
1350
- function Code({ lines = [], copyText = null, className = "" }) {
1350
+ function Code({ lines = [], allowHtml = false, copyText = null, className = "" }) {
1351
1351
  return /* @__PURE__ */ jsxs("div", { className: classNames("usx-mockup-code", className), children: [
1352
1352
  /* @__PURE__ */ jsx("div", { className: "usx-mockup-code__content", children: lines.map((line, i) => /* @__PURE__ */ jsx(
1353
1353
  "pre",
1354
1354
  {
1355
1355
  ...line.prefix != null ? { "data-prefix": line.prefix } : {},
1356
1356
  className: line.className || void 0,
1357
- children: /* @__PURE__ */ jsx("code", { dangerouslySetInnerHTML: { __html: line.code } })
1357
+ children: allowHtml ? /* @__PURE__ */ jsx("code", { dangerouslySetInnerHTML: { __html: line.code } }) : /* @__PURE__ */ jsx("code", { children: line.code })
1358
1358
  },
1359
1359
  i
1360
1360
  )) }),
@@ -2710,6 +2710,9 @@ function Layout({
2710
2710
  {
2711
2711
  variant: "primary",
2712
2712
  ghost: true,
2713
+ type: "button",
2714
+ "aria-label": expanded ? "Contract" : "Expand",
2715
+ "aria-expanded": expanded,
2713
2716
  className: "usx-layout__expand-button",
2714
2717
  onClick: () => setExpanded((value) => !value),
2715
2718
  children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solexllc/usx-react",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "React component library for USX.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,9 +25,9 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@solexllc/usx": "0.2.0",
29
- "@solexllc/usx-theme": "0.3.0",
30
- "@solexllc/usx-uswds-fixes": "0.1.6",
28
+ "@solexllc/usx": "0.4.0",
29
+ "@solexllc/usx-theme": "0.5.0",
30
+ "@solexllc/usx-uswds-fixes": "0.1.9",
31
31
  "classnames": "^2.5.1",
32
32
  "prop-types": "^15.8.1"
33
33
  },
@@ -24,11 +24,12 @@ export interface CodeLine {
24
24
 
25
25
  export interface CodeProps {
26
26
  lines?: CodeLine[];
27
+ allowHtml?: boolean;
27
28
  copyText?: string | null;
28
29
  className?: string;
29
30
  }
30
31
 
31
- export default function Code({ lines = [], copyText = null, className = '' }: CodeProps) {
32
+ export default function Code({ lines = [], allowHtml = false, copyText = null, className = '' }: CodeProps) {
32
33
  return (
33
34
  <div className={ClassNames('usx-mockup-code', className)}>
34
35
  <div className="usx-mockup-code__content">
@@ -38,7 +39,7 @@ export default function Code({ lines = [], copyText = null, className = '' }: Co
38
39
  {...(line.prefix != null ? { 'data-prefix': line.prefix } : {})}
39
40
  className={line.className || undefined}
40
41
  >
41
- <code dangerouslySetInnerHTML={{ __html: line.code }} />
42
+ {allowHtml ? <code dangerouslySetInnerHTML={{ __html: line.code }} /> : <code>{line.code}</code>}
42
43
  </pre>
43
44
  ))}
44
45
  </div>
@@ -4,7 +4,7 @@
4
4
  {% for line in lines %}
5
5
  <pre
6
6
  {% if line.prefix %} data-prefix="{{ line.prefix }}"{% endif %}{% if line.className %} class="{{ line.className }}"{% endif %}
7
- ><code>{{ line.code|safe }}</code></pre>
7
+ ><code>{% if allowHtml %}{{ line.code|safe }}{% else %}{{ line.code|force_escape }}{% endif %}</code></pre>
8
8
  {% endfor %}
9
9
  </div>
10
10
  {% if copyText %}
@@ -32,6 +32,49 @@
32
32
  </div>
33
33
  </div>
34
34
 
35
+ <h3 class="site-preview-heading">HTML Markup as Literal Text</h3>
36
+ <div class="usx-mockup-code">
37
+ <div class="usx-mockup-code__content">
38
+ <pre data-prefix="1"><code>&lt;section aria-label="Account &amp; settings"&gt;</code></pre>
39
+ <pre data-prefix="2"><code> &lt;h2&gt;Contact information&lt;/h2&gt;</code></pre>
40
+ <pre data-prefix="3"><code> &lt;p&gt;Use &amp;lt;Page&amp;gt; to define the page.&lt;/p&gt;</code></pre>
41
+ <pre data-prefix="4"><code>&lt;/section&gt;</code></pre>
42
+ </div>
43
+ </div>
44
+
45
+ <h3 class="site-preview-heading">React Markup as Literal Text</h3>
46
+ <div class="usx-mockup-code">
47
+ <div class="usx-mockup-code__content">
48
+ <pre data-prefix="1"><code>&lt;Layout&gt;</code></pre>
49
+ <pre data-prefix="2"><code> &lt;Page title="Account" tabIndex={-1}&gt;</code></pre>
50
+ <pre data-prefix="3"><code> &lt;Section title="Contact information"&gt;</code></pre>
51
+ <pre data-prefix="4"><code> &lt;ContactDetails user={currentUser} /&gt;</code></pre>
52
+ <pre data-prefix="5"><code> &lt;/Section&gt;</code></pre>
53
+ <pre data-prefix="6"><code> &lt;/Page&gt;</code></pre>
54
+ <pre data-prefix="7"><code>&lt;/Layout&gt;</code></pre>
55
+ </div>
56
+ </div>
57
+
58
+ <h3 class="site-preview-heading">React Markup with an HTML Fragment</h3>
59
+ <div class="usx-mockup-code">
60
+ <div class="usx-mockup-code__content">
61
+ <pre data-prefix="1"><code>&lt;Layout&gt;</code></pre>
62
+ <pre data-prefix="2"><code> &lt;Page title="<strong>Account</strong>" tabIndex={-1}&gt;</code></pre>
63
+ <pre data-prefix="3"><code> &lt;Section title="Contact information"&gt;</code></pre>
64
+ <pre data-prefix="4"><code> &lt;ContactDetails user={currentUser} /&gt;</code></pre>
65
+ <pre data-prefix="5"><code> &lt;/Section&gt;</code></pre>
66
+ <pre data-prefix="6"><code> &lt;/Page&gt;</code></pre>
67
+ <pre data-prefix="7"><code>&lt;/Layout&gt;</code></pre>
68
+ </div>
69
+ </div>
70
+
71
+ <h3 class="site-preview-heading">Rendered HTML Fragment</h3>
72
+ <div class="usx-mockup-code">
73
+ <div class="usx-mockup-code__content">
74
+ <pre data-prefix=">"><code>This <em>line</em> has <strong>HTML fragments</strong></code></pre>
75
+ </div>
76
+ </div>
77
+
35
78
  <h3 class="site-preview-heading">Without Prefix</h3>
36
79
  <div class="usx-mockup-code">
37
80
  <div class="usx-mockup-code__content">
@@ -15,7 +15,7 @@
15
15
  "properties": {
16
16
  "code": {
17
17
  "type": "string",
18
- "description": "Line content."
18
+ "description": "Literal line content, including HTML or JSX source. Interpreted as trusted HTML only when allowHtml is true."
19
19
  },
20
20
  "prefix": {
21
21
  "type": "string",
@@ -28,6 +28,11 @@
28
28
  }
29
29
  }
30
30
  },
31
+ "allowHtml": {
32
+ "type": "boolean",
33
+ "default": false,
34
+ "description": "Render line content as HTML instead of literal text. Only enable for trusted HTML; content is not sanitized. Leave false when documenting HTML or React markup."
35
+ },
31
36
  "copyText": {
32
37
  "type": "string",
33
38
  "description": "Text to copy when the copy button is clicked. If provided, shows the copy button."
@@ -154,10 +154,10 @@
154
154
  {% if branding %}
155
155
  <div class="usa-logo usx-logo usa-footer__logo grid-row grid-gap-2 usx-footer__logo">
156
156
  {% if branding.logo %}
157
- {% if brandingUrl %}<a href="{{ brandingUrl }}" class="usx-logo__image">{% endif %}
158
- <img src="{{ branding.logo }}" alt="{{ branding.alt|default:branding.title|default:'' }}" class="usx-logo__variant" />
159
- {% if branding.logoInverse %}<img src="{{ branding.logoInverse }}" alt="{{ branding.alt|default:branding.title|default:'' }}" class="usx-logo__variant usx-logo__variant--inverse" />{% endif %}
160
- {% if brandingUrl %}</a>{% endif %}
157
+ {% if brandingUrl %}<a href="{{ brandingUrl }}" class="usx-image usx-logo__image">{% else %}<div class="usx-image usx-logo__image">{% endif %}
158
+ {% image src=branding.logo alt=branding.alt|default:branding.title|default:'' className='usx-logo__variant' %}{% endimage %}
159
+ {% if branding.logoInverse %}{% image src=branding.logoInverse alt=branding.alt|default:branding.title|default:'' className='usx-logo__variant usx-logo__variant--inverse' %}{% endimage %}{% endif %}
160
+ {% if brandingUrl %}</a>{% else %}</div>{% endif %}
161
161
  {% else %}
162
162
  <em class="usa-logo__text">
163
163
  {% if branding.symbol %}
@@ -181,10 +181,10 @@
181
181
  {% if branding %}
182
182
  <div class="usa-logo usx-logo usa-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2 usx-footer__logo">
183
183
  {% if branding.logo %}
184
- {% if brandingUrl %}<a href="{{ brandingUrl }}" class="usx-logo__image">{% endif %}
185
- <img src="{{ branding.logo }}" alt="{{ branding.alt|default:branding.title|default:'' }}" class="usx-logo__variant" />
186
- {% if branding.logoInverse %}<img src="{{ branding.logoInverse }}" alt="{{ branding.alt|default:branding.title|default:'' }}" class="usx-logo__variant usx-logo__variant--inverse" />{% endif %}
187
- {% if brandingUrl %}</a>{% endif %}
184
+ {% if brandingUrl %}<a href="{{ brandingUrl }}" class="usx-image usx-logo__image">{% else %}<div class="usx-image usx-logo__image">{% endif %}
185
+ {% image src=branding.logo alt=branding.alt|default:branding.title|default:'' className='usx-logo__variant' %}{% endimage %}
186
+ {% if branding.logoInverse %}{% image src=branding.logoInverse alt=branding.alt|default:branding.title|default:'' className='usx-logo__variant usx-logo__variant--inverse' %}{% endimage %}{% endif %}
187
+ {% if brandingUrl %}</a>{% else %}</div>{% endif %}
188
188
  {% else %}
189
189
  <em class="usa-logo__text">
190
190
  {% if branding.symbol %}
@@ -127,14 +127,22 @@
127
127
  <div class="grid-container">
128
128
  <div class="grid-row grid-gap">
129
129
  <div
130
- class="usa-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2"
130
+ class="usa-logo usx-logo usa-footer__logo usx-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2"
131
131
  >
132
- <div class="mobile-lg:grid-col-auto">
133
- <img class="usa-footer__logo-img" src="/assets/img/logo-img.png" alt="" />
134
- </div>
135
- <div class="mobile-lg:grid-col-auto">
136
- <p class="usa-footer__logo-heading">&lt;Name of Agency&gt;</p>
137
- </div>
132
+ <a href="/" class="usx-image usx-logo__image">
133
+ <div class="usx-image usx-logo__variant">
134
+ <picture>
135
+ <source media="(min-width: 40em)" srcset="linear-w-symbol_left.svg" />
136
+ <img src="symbol-only.svg" alt="Agency Name" />
137
+ </picture>
138
+ </div>
139
+ <div class="usx-image usx-logo__variant usx-logo__variant--inverse">
140
+ <picture>
141
+ <source media="(min-width: 40em)" srcset="white_linear-w-symbol_left.png" />
142
+ <img src="white_symbol-only.png" alt="Agency Name" />
143
+ </picture>
144
+ </div>
145
+ </a>
138
146
  </div>
139
147
  <div class="usa-footer__contact-links mobile-lg:grid-col-6">
140
148
  <div class="usa-footer__social-links grid-row grid-gap-1">
@@ -242,14 +250,22 @@
242
250
  <div class="grid-container">
243
251
  <div class="grid-row grid-gap">
244
252
  <div
245
- class="usa-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2"
253
+ class="usa-logo usx-logo usa-footer__logo usx-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2"
246
254
  >
247
- <div class="mobile-lg:grid-col-auto">
248
- <img class="usa-footer__logo-img" src="/assets/img/logo-img.png" alt="" />
249
- </div>
250
- <div class="mobile-lg:grid-col-auto">
251
- <p class="usa-footer__logo-heading">&lt;Name of Agency&gt;</p>
252
- </div>
255
+ <a href="/" class="usx-image usx-logo__image">
256
+ <div class="usx-image usx-logo__variant">
257
+ <picture>
258
+ <source media="(min-width: 40em)" srcset="linear-w-symbol_left.svg" />
259
+ <img src="symbol-only.svg" alt="Agency Name" />
260
+ </picture>
261
+ </div>
262
+ <div class="usx-image usx-logo__variant usx-logo__variant--inverse">
263
+ <picture>
264
+ <source media="(min-width: 40em)" srcset="white_linear-w-symbol_left.png" />
265
+ <img src="white_symbol-only.png" alt="Agency Name" />
266
+ </picture>
267
+ </div>
268
+ </a>
253
269
  </div>
254
270
  <div class="usa-footer__contact-links mobile-lg:grid-col-6">
255
271
  <div class="usa-footer__social-links grid-row grid-gap-1">
@@ -379,13 +395,21 @@
379
395
  </div>
380
396
  <div class="usa-footer__secondary-section">
381
397
  <div class="grid-container">
382
- <div class="usa-footer__logo grid-row grid-gap-2">
383
- <div class="grid-col-auto">
384
- <img class="usa-footer__logo-img" src="/assets/img/logo-img.png" alt="" />
385
- </div>
386
- <div class="grid-col-auto">
387
- <p class="usa-footer__logo-heading">&lt;Agency Contact Center&gt;</p>
388
- </div>
398
+ <div class="usa-logo usx-logo usa-footer__logo usx-footer__logo grid-row grid-gap-2">
399
+ <a href="/" class="usx-image usx-logo__image">
400
+ <div class="usx-image usx-logo__variant">
401
+ <picture>
402
+ <source media="(min-width: 40em)" srcset="linear-w-symbol_left.svg" />
403
+ <img src="symbol-only.svg" alt="Agency Name" />
404
+ </picture>
405
+ </div>
406
+ <div class="usx-image usx-logo__variant usx-logo__variant--inverse">
407
+ <picture>
408
+ <source media="(min-width: 40em)" srcset="white_linear-w-symbol_left.png" />
409
+ <img src="white_symbol-only.png" alt="Agency Name" />
410
+ </picture>
411
+ </div>
412
+ </a>
389
413
  </div>
390
414
  </div>
391
415
  </div>
@@ -2,7 +2,6 @@ import React, { useState, ReactNode, HTMLAttributes } from 'react';
2
2
  import ClassNames from 'classnames';
3
3
  import Icon from '../icon/Icon';
4
4
  import Button from '../button/Button';
5
- import Tooltip from '../tooltip/Tooltip';
6
5
 
7
6
  // ── Sub-components ──────────────────────────────────────────────────────────
8
7
 
@@ -117,6 +116,7 @@ export default function Layout({
117
116
  ...props
118
117
  }: LayoutProps) {
119
118
  const [expanded, setExpanded] = useState(false);
119
+
120
120
  const classes = ClassNames(
121
121
  'usx-layout',
122
122
  { 'usx-expanded': expandable && expanded },
@@ -124,17 +124,18 @@ export default function Layout({
124
124
  );
125
125
 
126
126
  const expandButton = expandable ? (
127
-
128
- <Button
129
- variant="primary"
130
- ghost={true}
131
- className="usx-layout__expand-button"
132
- onClick={() => setExpanded((value) => !value)}
133
- >
127
+ <Button
128
+ variant="primary"
129
+ ghost={true}
130
+ type="button"
131
+ aria-label={expanded ? 'Contract' : 'Expand'}
132
+ aria-expanded={expanded}
133
+ className="usx-layout__expand-button"
134
+ onClick={() => setExpanded((value) => !value)}
135
+ >
134
136
  <Icon source="usx" name="expand" size={3} className="usx-layout__expand-icon usx-layout__expand-icon--expand" />
135
137
  <Icon source="usx" name="contract" size={3} className="usx-layout__expand-icon usx-layout__expand-icon--contract" />
136
138
  </Button>
137
-
138
139
  ) : null;
139
140
 
140
141
  return (
@@ -28,6 +28,16 @@
28
28
  "type": "string",
29
29
  "description": "Right sidebar content (grid variant only)"
30
30
  },
31
+ "expandLeftSidebar": {
32
+ "type": "boolean",
33
+ "default": false,
34
+ "description": "Removes the outer padding from the left sidebar on desktop."
35
+ },
36
+ "expandRightSidebar": {
37
+ "type": "boolean",
38
+ "default": false,
39
+ "description": "Removes the outer padding from the right sidebar on desktop."
40
+ },
31
41
  "expandable": {
32
42
  "type": "boolean",
33
43
  "description": "Adds a toggle button that grows the layout to a wider max-width via the usx-expanded class."
@@ -20,7 +20,7 @@
20
20
  {% elif variant == 'grid' %}
21
21
  <div class="usx-layout__grid-container">
22
22
  {% if leftSidebar %}
23
- <aside class="usx-layout__sidebar--left">
23
+ <aside class="usx-layout__sidebar--left{% if expandLeftSidebar %} usx-layout__sidebar--expanded{% endif %}">
24
24
  {{ leftSidebar|safe }}
25
25
  </aside>
26
26
  {% endif %}
@@ -29,7 +29,7 @@
29
29
  {% if children %}{{ children|safe }}{% else %}{{ content|safe }}{% endif %}
30
30
  </main>
31
31
  {% if rightSidebar %}
32
- <aside class="usx-layout__sidebar--right">
32
+ <aside class="usx-layout__sidebar--right{% if expandRightSidebar %} usx-layout__sidebar--expanded{% endif %}">
33
33
  {{ rightSidebar|safe }}
34
34
  </aside>
35
35
  {% endif %}
@@ -30,7 +30,8 @@
30
30
 
31
31
  <!-- Expandable Layout Example -->
32
32
  <div class="usx-layout">
33
- <button type="button" class="usx-layout__expand-button" aria-expanded="false" aria-label="Expand">
33
+ <div class="usx-layout__single-column">
34
+ <button type="button" class="usx-layout__expand-button" aria-expanded="false" aria-label="Expand" onclick="const expanded = this.closest('.usx-layout').classList.toggle('usx-expanded'); this.setAttribute('aria-expanded', expanded); this.setAttribute('aria-label', expanded ? 'Contract' : 'Expand');">
34
35
  <svg class="usa-icon usx-layout__expand-icon usx-layout__expand-icon--expand" aria-hidden="true" focusable="false" role="img">
35
36
  <use href="./img/usx-sprite.svg#expand"></use>
36
37
  </svg>
@@ -38,7 +39,6 @@
38
39
  <use href="./img/usx-sprite.svg#contract"></use>
39
40
  </svg>
40
41
  </button>
41
- <div class="usx-layout__single-column">
42
42
  <h1>Page Title</h1>
43
43
  <p>Use the expand button in the top-right corner to grow the layout to a wider max-width.</p>
44
44
  </div>
@@ -1,6 +1,5 @@
1
- // Sass entry for the core package: theme variables, the themed USX component
1
+ // Sass entry for the core package: the themed USX component
2
2
  // styles and the USWDS fix-ups. Component styles live in packages/usx.
3
- @use 'pkg:@solexllc/usx-theme/variables' as *;
4
3
 
5
4
  // Themed entry = runtime theming opt-in (loads usx-theme's hooks before the
6
5
  // component styles). Swap to 'pkg:@solexllc/usx' for a fully static build.