@solexllc/usx-react 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/dist/index.cjs CHANGED
@@ -1321,9 +1321,16 @@
1321
1321
  onClick = void 0,
1322
1322
  ...props
1323
1323
  }) {
1324
- const icon = /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "arrow_upward", size: iconSize });
1324
+ const icon = /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "arrow_upward", size: iconSize, className: classNames(
1325
+ iconPosition === "left" ? "margin-right-05" : "margin-left-05"
1326
+ ) });
1325
1327
  if (href) {
1326
- const linkClasses = classNames("usx-link", "usx-no-visited", className);
1328
+ const linkClasses = classNames(
1329
+ "usx-link",
1330
+ "usx-no-visited",
1331
+ "flex-align-center",
1332
+ className
1333
+ );
1327
1334
  return /* @__PURE__ */ jsxRuntime.jsxs("a", { className: linkClasses, href, ...props, children: [
1328
1335
  iconPosition === "left" && icon,
1329
1336
  label,
@@ -3145,19 +3152,35 @@
3145
3152
  }
3146
3153
  ) });
3147
3154
  }
3155
+ const externalIndicator = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3156
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-sr-only", children: "External." }),
3157
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "launch", size: 1, className: "margin-left-05" })
3158
+ ] });
3148
3159
  function PrimaryNav({
3149
3160
  navSections,
3150
3161
  megamenu,
3151
3162
  showSecondary = false,
3152
3163
  secondaryLinks = [],
3153
3164
  searchProps = null,
3165
+ utilityContent = null,
3154
3166
  headerId = "header",
3155
3167
  renderSearchDirectly = false
3156
3168
  }) {
3157
3169
  const navClasses = classNames("usa-nav__primary", "usa-accordion");
3158
3170
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3159
3171
  /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "usa-nav__close", children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "close" }) }),
3160
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: navClasses, children: navSections.map((section, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__primary-item", children: section.href ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: section.href, className: "usa-nav__link", "aria-label": section.ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: section.title }) }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3172
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: navClasses, children: navSections.map((section, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__primary-item", children: section.href ? /* @__PURE__ */ jsxRuntime.jsxs(
3173
+ "a",
3174
+ {
3175
+ href: section.href,
3176
+ className: "usa-nav__link",
3177
+ "aria-label": section.ariaLabel,
3178
+ children: [
3179
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: section.title }),
3180
+ section.external && externalIndicator
3181
+ ]
3182
+ }
3183
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3161
3184
  /* @__PURE__ */ jsxRuntime.jsx(
3162
3185
  "button",
3163
3186
  {
@@ -3176,12 +3199,45 @@
3176
3199
  const startIndex = colIndex * linksPerColumn;
3177
3200
  const endIndex = Math.min(startIndex + linksPerColumn, links.length);
3178
3201
  const columnLinks = links.slice(startIndex, endIndex);
3179
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-col", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-nav__submenu-list", children: columnLinks.map((link, linkIndex) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: link.text }) }, linkIndex)) }) }, colIndex);
3202
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-col", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-nav__submenu-list", children: columnLinks.map((link, linkIndex) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsxRuntime.jsxs(
3203
+ "a",
3204
+ {
3205
+ href: link.href,
3206
+ "aria-label": link.ariaLabel,
3207
+ children: [
3208
+ link.text,
3209
+ link.external && externalIndicator
3210
+ ]
3211
+ }
3212
+ ) }, linkIndex)) }) }, colIndex);
3180
3213
  });
3181
- })() }) }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { id: `${headerId}-nav-section-${index}`, className: "usa-nav__submenu", hidden: true, children: section.links.map((link, linkIndex) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: link.text }) }) }, linkIndex)) }))
3214
+ })() }) }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { id: `${headerId}-nav-section-${index}`, className: "usa-nav__submenu", hidden: true, children: section.links.map((link, linkIndex) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsxRuntime.jsxs(
3215
+ "a",
3216
+ {
3217
+ href: link.href,
3218
+ "aria-label": link.ariaLabel,
3219
+ children: [
3220
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: link.text }),
3221
+ link.external && externalIndicator
3222
+ ]
3223
+ }
3224
+ ) }, linkIndex)) }))
3182
3225
  ] }) }, index)) }),
3183
- showSecondary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-nav__secondary", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: link.text }) }) }, index)) }) }),
3184
- renderSearchDirectly && searchProps && /* @__PURE__ */ jsxRuntime.jsx(Search, { ...searchProps })
3226
+ showSecondary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-nav__secondary", children: /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsxRuntime.jsxs(
3227
+ "a",
3228
+ {
3229
+ href: link.href,
3230
+ "aria-label": link.ariaLabel,
3231
+ children: [
3232
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: link.text }),
3233
+ link.external && externalIndicator
3234
+ ]
3235
+ }
3236
+ ) }, index)) }) }),
3237
+ renderSearchDirectly && (utilityContent || searchProps) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usx-nav__utility", children: [
3238
+ utilityContent,
3239
+ searchProps && /* @__PURE__ */ jsxRuntime.jsx(Search, { ...searchProps })
3240
+ ] })
3185
3241
  ] });
3186
3242
  }
3187
3243
  function Header({
@@ -3196,6 +3252,8 @@
3196
3252
  useMenuIcon = false,
3197
3253
  stickyNav = false,
3198
3254
  className = "",
3255
+ utilityContent = null,
3256
+ navEndContent = null,
3199
3257
  ...props
3200
3258
  }) {
3201
3259
  const headerClasses = classNames(
@@ -3229,9 +3287,23 @@
3229
3287
  }
3230
3288
  ),
3231
3289
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usa-nav__secondary", children: [
3232
- /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: link.text }) }) }, index)) }),
3233
- searchProps && /* @__PURE__ */ jsxRuntime.jsx(Search, { ...searchProps })
3234
- ] })
3290
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsxRuntime.jsxs(
3291
+ "a",
3292
+ {
3293
+ href: link.href,
3294
+ "aria-label": link.ariaLabel,
3295
+ children: [
3296
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: link.text }),
3297
+ link.external && externalIndicator
3298
+ ]
3299
+ }
3300
+ ) }, index)) }),
3301
+ (utilityContent || searchProps) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "usx-nav__utility", children: [
3302
+ utilityContent,
3303
+ searchProps && /* @__PURE__ */ jsxRuntime.jsx(Search, { ...searchProps })
3304
+ ] })
3305
+ ] }),
3306
+ navEndContent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-nav__end-slot", children: navEndContent })
3235
3307
  ] }) })
3236
3308
  ] });
3237
3309
  }
@@ -3245,6 +3317,7 @@
3245
3317
  showSecondary: false,
3246
3318
  secondaryLinks,
3247
3319
  searchProps,
3320
+ utilityContent,
3248
3321
  headerId: id,
3249
3322
  renderSearchDirectly: true
3250
3323
  }
@@ -5764,7 +5837,7 @@
5764
5837
  "button",
5765
5838
  {
5766
5839
  type: "button",
5767
- className: "usa-button usx-button usx-button--ghost usx-theme-picker__trigger",
5840
+ className: "usa-button usx-button usx-button--ghost text-muted usx-theme-picker__trigger",
5768
5841
  "aria-label": label,
5769
5842
  onClick: () => setOpen(true),
5770
5843
  children: /* @__PURE__ */ jsxRuntime.jsx(PaletteIcon, {})
package/dist/index.js CHANGED
@@ -1319,9 +1319,16 @@ function BackToTop({
1319
1319
  onClick = void 0,
1320
1320
  ...props
1321
1321
  }) {
1322
- const icon = /* @__PURE__ */ jsx(Icon, { name: "arrow_upward", size: iconSize });
1322
+ const icon = /* @__PURE__ */ jsx(Icon, { name: "arrow_upward", size: iconSize, className: classNames(
1323
+ iconPosition === "left" ? "margin-right-05" : "margin-left-05"
1324
+ ) });
1323
1325
  if (href) {
1324
- const linkClasses = classNames("usx-link", "usx-no-visited", className);
1326
+ const linkClasses = classNames(
1327
+ "usx-link",
1328
+ "usx-no-visited",
1329
+ "flex-align-center",
1330
+ className
1331
+ );
1325
1332
  return /* @__PURE__ */ jsxs("a", { className: linkClasses, href, ...props, children: [
1326
1333
  iconPosition === "left" && icon,
1327
1334
  label,
@@ -3143,19 +3150,35 @@ function Search({
3143
3150
  }
3144
3151
  ) });
3145
3152
  }
3153
+ const externalIndicator = /* @__PURE__ */ jsxs(Fragment, { children: [
3154
+ /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: "External." }),
3155
+ /* @__PURE__ */ jsx(Icon, { name: "launch", size: 1, className: "margin-left-05" })
3156
+ ] });
3146
3157
  function PrimaryNav({
3147
3158
  navSections,
3148
3159
  megamenu,
3149
3160
  showSecondary = false,
3150
3161
  secondaryLinks = [],
3151
3162
  searchProps = null,
3163
+ utilityContent = null,
3152
3164
  headerId = "header",
3153
3165
  renderSearchDirectly = false
3154
3166
  }) {
3155
3167
  const navClasses = classNames("usa-nav__primary", "usa-accordion");
3156
3168
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3157
3169
  /* @__PURE__ */ jsx("button", { type: "button", className: "usa-nav__close", children: /* @__PURE__ */ jsx(Icon, { name: "close" }) }),
3158
- /* @__PURE__ */ jsx("ul", { className: navClasses, children: navSections.map((section, index) => /* @__PURE__ */ jsx("li", { className: "usa-nav__primary-item", children: section.href ? /* @__PURE__ */ jsx("a", { href: section.href, className: "usa-nav__link", "aria-label": section.ariaLabel, children: /* @__PURE__ */ jsx("span", { children: section.title }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3170
+ /* @__PURE__ */ jsx("ul", { className: navClasses, children: navSections.map((section, index) => /* @__PURE__ */ jsx("li", { className: "usa-nav__primary-item", children: section.href ? /* @__PURE__ */ jsxs(
3171
+ "a",
3172
+ {
3173
+ href: section.href,
3174
+ className: "usa-nav__link",
3175
+ "aria-label": section.ariaLabel,
3176
+ children: [
3177
+ /* @__PURE__ */ jsx("span", { children: section.title }),
3178
+ section.external && externalIndicator
3179
+ ]
3180
+ }
3181
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
3159
3182
  /* @__PURE__ */ jsx(
3160
3183
  "button",
3161
3184
  {
@@ -3174,12 +3197,45 @@ function PrimaryNav({
3174
3197
  const startIndex = colIndex * linksPerColumn;
3175
3198
  const endIndex = Math.min(startIndex + linksPerColumn, links.length);
3176
3199
  const columnLinks = links.slice(startIndex, endIndex);
3177
- return /* @__PURE__ */ jsx("div", { className: "usa-col", children: /* @__PURE__ */ jsx("ul", { className: "usa-nav__submenu-list", children: columnLinks.map((link, linkIndex) => /* @__PURE__ */ jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: link.text }) }, linkIndex)) }) }, colIndex);
3200
+ return /* @__PURE__ */ jsx("div", { className: "usa-col", children: /* @__PURE__ */ jsx("ul", { className: "usa-nav__submenu-list", children: columnLinks.map((link, linkIndex) => /* @__PURE__ */ jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsxs(
3201
+ "a",
3202
+ {
3203
+ href: link.href,
3204
+ "aria-label": link.ariaLabel,
3205
+ children: [
3206
+ link.text,
3207
+ link.external && externalIndicator
3208
+ ]
3209
+ }
3210
+ ) }, linkIndex)) }) }, colIndex);
3178
3211
  });
3179
- })() }) }) : /* @__PURE__ */ jsx("ul", { id: `${headerId}-nav-section-${index}`, className: "usa-nav__submenu", hidden: true, children: section.links.map((link, linkIndex) => /* @__PURE__ */ jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: /* @__PURE__ */ jsx("span", { children: link.text }) }) }, linkIndex)) }))
3212
+ })() }) }) : /* @__PURE__ */ jsx("ul", { id: `${headerId}-nav-section-${index}`, className: "usa-nav__submenu", hidden: true, children: section.links.map((link, linkIndex) => /* @__PURE__ */ jsx("li", { className: "usa-nav__submenu-item", children: /* @__PURE__ */ jsxs(
3213
+ "a",
3214
+ {
3215
+ href: link.href,
3216
+ "aria-label": link.ariaLabel,
3217
+ children: [
3218
+ /* @__PURE__ */ jsx("span", { children: link.text }),
3219
+ link.external && externalIndicator
3220
+ ]
3221
+ }
3222
+ ) }, linkIndex)) }))
3180
3223
  ] }) }, index)) }),
3181
- showSecondary && /* @__PURE__ */ jsx("div", { className: "usa-nav__secondary", children: /* @__PURE__ */ jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: /* @__PURE__ */ jsx("span", { children: link.text }) }) }, index)) }) }),
3182
- renderSearchDirectly && searchProps && /* @__PURE__ */ jsx(Search, { ...searchProps })
3224
+ showSecondary && /* @__PURE__ */ jsx("div", { className: "usa-nav__secondary", children: /* @__PURE__ */ jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsxs(
3225
+ "a",
3226
+ {
3227
+ href: link.href,
3228
+ "aria-label": link.ariaLabel,
3229
+ children: [
3230
+ /* @__PURE__ */ jsx("span", { children: link.text }),
3231
+ link.external && externalIndicator
3232
+ ]
3233
+ }
3234
+ ) }, index)) }) }),
3235
+ renderSearchDirectly && (utilityContent || searchProps) && /* @__PURE__ */ jsxs("div", { className: "usx-nav__utility", children: [
3236
+ utilityContent,
3237
+ searchProps && /* @__PURE__ */ jsx(Search, { ...searchProps })
3238
+ ] })
3183
3239
  ] });
3184
3240
  }
3185
3241
  function Header({
@@ -3194,6 +3250,8 @@ function Header({
3194
3250
  useMenuIcon = false,
3195
3251
  stickyNav = false,
3196
3252
  className = "",
3253
+ utilityContent = null,
3254
+ navEndContent = null,
3197
3255
  ...props
3198
3256
  }) {
3199
3257
  const headerClasses = classNames(
@@ -3227,9 +3285,23 @@ function Header({
3227
3285
  }
3228
3286
  ),
3229
3287
  /* @__PURE__ */ jsxs("div", { className: "usa-nav__secondary", children: [
3230
- /* @__PURE__ */ jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsx("a", { href: link.href, "aria-label": link.ariaLabel, children: /* @__PURE__ */ jsx("span", { children: link.text }) }) }, index)) }),
3231
- searchProps && /* @__PURE__ */ jsx(Search, { ...searchProps })
3232
- ] })
3288
+ /* @__PURE__ */ jsx("ul", { className: "usa-nav__secondary-links", children: secondaryLinks.map((link, index) => /* @__PURE__ */ jsx("li", { className: "usa-nav__secondary-item", children: /* @__PURE__ */ jsxs(
3289
+ "a",
3290
+ {
3291
+ href: link.href,
3292
+ "aria-label": link.ariaLabel,
3293
+ children: [
3294
+ /* @__PURE__ */ jsx("span", { children: link.text }),
3295
+ link.external && externalIndicator
3296
+ ]
3297
+ }
3298
+ ) }, index)) }),
3299
+ (utilityContent || searchProps) && /* @__PURE__ */ jsxs("div", { className: "usx-nav__utility", children: [
3300
+ utilityContent,
3301
+ searchProps && /* @__PURE__ */ jsx(Search, { ...searchProps })
3302
+ ] })
3303
+ ] }),
3304
+ navEndContent && /* @__PURE__ */ jsx("div", { className: "usx-nav__end-slot", children: navEndContent })
3233
3305
  ] }) })
3234
3306
  ] });
3235
3307
  }
@@ -3243,6 +3315,7 @@ function Header({
3243
3315
  showSecondary: false,
3244
3316
  secondaryLinks,
3245
3317
  searchProps,
3318
+ utilityContent,
3246
3319
  headerId: id,
3247
3320
  renderSearchDirectly: true
3248
3321
  }
@@ -5762,7 +5835,7 @@ function ThemePicker({
5762
5835
  "button",
5763
5836
  {
5764
5837
  type: "button",
5765
- className: "usa-button usx-button usx-button--ghost usx-theme-picker__trigger",
5838
+ className: "usa-button usx-button usx-button--ghost text-muted usx-theme-picker__trigger",
5766
5839
  "aria-label": label,
5767
5840
  onClick: () => setOpen(true),
5768
5841
  children: /* @__PURE__ */ jsx(PaletteIcon, {})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solexllc/usx-react",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
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.1.1",
29
- "@solexllc/usx-theme": "0.1.1",
30
- "@solexllc/usx-uswds-fixes": "0.1.1",
28
+ "@solexllc/usx": "0.1.3",
29
+ "@solexllc/usx-theme": "0.2.0",
30
+ "@solexllc/usx-uswds-fixes": "0.1.2",
31
31
  "classnames": "^2.5.1",
32
32
  "prop-types": "^15.8.1"
33
33
  },
@@ -23,11 +23,20 @@ export default function BackToTop({
23
23
  ...props
24
24
  }: BackToTopProps) {
25
25
  const icon = (
26
- <Icon name="arrow_upward" size={iconSize} />
26
+ <Icon name="arrow_upward" size={iconSize} className={
27
+ ClassNames(
28
+ iconPosition === 'left' ? 'margin-right-05' : 'margin-left-05'
29
+ )
30
+ } />
27
31
  );
28
32
 
29
33
  if (href) {
30
- const linkClasses = ClassNames('usx-link', 'usx-no-visited', className);
34
+ const linkClasses = ClassNames(
35
+ 'usx-link',
36
+ 'usx-no-visited',
37
+ 'flex-align-center',
38
+ className
39
+ );
31
40
  return (
32
41
  <a className={linkClasses} href={href} {...props}>
33
42
  {iconPosition === 'left' && icon}
@@ -1,18 +1,18 @@
1
1
  {# Django template for BackToTop #}
2
2
  {% if href %}
3
3
  <a
4
- class="usx-link usx-no-visited{% if className %} {{ className }}{% endif %}"
4
+ class="usx-link usx-no-visited flex-align-center{% if className %} {{ className }}{% endif %}"
5
5
  href="{{ href }}"
6
6
  {% if tabindex %}tabindex="{{ tabindex }}"{% endif %}
7
7
  >
8
8
  {% if iconPosition == 'left' or not iconPosition %}
9
- <svg class="usa-icon usa-icon--size-{{ iconSize|default:'2' }}" aria-hidden="true" focusable="false" role="img">
9
+ <svg class="margin-right-05usa-icon usa-icon--size-{{ iconSize|default:'2' }}" aria-hidden="true" focusable="false" role="img">
10
10
  <use href="./img/sprite.svg#arrow_upward"></use>
11
11
  </svg>
12
12
  {% endif %}
13
13
  {% if label %}{{ label }}{% endif %}
14
14
  {% if iconPosition == 'right' %}
15
- <svg class="usa-icon usa-icon--size-{{ iconSize|default:'2' }}" aria-hidden="true" focusable="false" role="img">
15
+ <svg class="margin-left-05 usa-icon usa-icon--size-{{ iconSize|default:'2' }}" aria-hidden="true" focusable="false" role="img">
16
16
  <use href="./img/sprite.svg#arrow_upward"></use>
17
17
  </svg>
18
18
  {% endif %}
@@ -4,10 +4,18 @@ import Icon from '../icon/Icon';
4
4
  import Search, { SearchProps } from '../search/Search';
5
5
  import Branding, { BrandingProps } from './Branding';
6
6
 
7
+ const externalIndicator = (
8
+ <>
9
+ <span className="usa-sr-only">External.</span>
10
+ <Icon name="launch" size={1} className="margin-left-05" />
11
+ </>
12
+ );
13
+
7
14
  export interface HeaderNavLink {
8
15
  text: string;
9
16
  href: string;
10
17
  ariaLabel?: string;
18
+ external?: boolean;
11
19
  }
12
20
 
13
21
  export interface HeaderNavSection {
@@ -15,6 +23,7 @@ export interface HeaderNavSection {
15
23
  links?: HeaderNavLink[];
16
24
  href?: string;
17
25
  ariaLabel?: string;
26
+ external?: boolean;
18
27
  }
19
28
 
20
29
  interface PrimaryNavProps {
@@ -23,6 +32,7 @@ interface PrimaryNavProps {
23
32
  showSecondary?: boolean;
24
33
  secondaryLinks?: HeaderNavLink[];
25
34
  searchProps?: SearchProps | null;
35
+ utilityContent?: React.ReactNode;
26
36
  headerId?: string;
27
37
  renderSearchDirectly?: boolean;
28
38
  }
@@ -33,6 +43,7 @@ function PrimaryNav({
33
43
  showSecondary = false,
34
44
  secondaryLinks = [],
35
45
  searchProps = null,
46
+ utilityContent = null,
36
47
  headerId = 'header',
37
48
  renderSearchDirectly = false,
38
49
  }: PrimaryNavProps) {
@@ -47,8 +58,13 @@ function PrimaryNav({
47
58
  {navSections.map((section, index) => (
48
59
  <li key={index} className="usa-nav__primary-item">
49
60
  {section.href ? (
50
- <a href={section.href} className="usa-nav__link" aria-label={section.ariaLabel}>
61
+ <a
62
+ href={section.href}
63
+ className="usa-nav__link"
64
+ aria-label={section.ariaLabel}
65
+ >
51
66
  <span>{section.title}</span>
67
+ {section.external && externalIndicator}
52
68
  </a>
53
69
  ) : (
54
70
  <>
@@ -77,8 +93,12 @@ function PrimaryNav({
77
93
  <ul className="usa-nav__submenu-list">
78
94
  {columnLinks.map((link, linkIndex) => (
79
95
  <li key={linkIndex} className="usa-nav__submenu-item">
80
- <a href={link.href} aria-label={link.ariaLabel}>
96
+ <a
97
+ href={link.href}
98
+ aria-label={link.ariaLabel}
99
+ >
81
100
  {link.text}
101
+ {link.external && externalIndicator}
82
102
  </a>
83
103
  </li>
84
104
  ))}
@@ -93,8 +113,12 @@ function PrimaryNav({
93
113
  <ul id={`${headerId}-nav-section-${index}`} className="usa-nav__submenu" hidden={true}>
94
114
  {section.links!.map((link, linkIndex) => (
95
115
  <li key={linkIndex} className="usa-nav__submenu-item">
96
- <a href={link.href} aria-label={link.ariaLabel}>
116
+ <a
117
+ href={link.href}
118
+ aria-label={link.ariaLabel}
119
+ >
97
120
  <span>{link.text}</span>
121
+ {link.external && externalIndicator}
98
122
  </a>
99
123
  </li>
100
124
  ))}
@@ -111,15 +135,24 @@ function PrimaryNav({
111
135
  <ul className="usa-nav__secondary-links">
112
136
  {secondaryLinks.map((link, index) => (
113
137
  <li key={index} className="usa-nav__secondary-item">
114
- <a href={link.href} aria-label={link.ariaLabel}>
138
+ <a
139
+ href={link.href}
140
+ aria-label={link.ariaLabel}
141
+ >
115
142
  <span>{link.text}</span>
143
+ {link.external && externalIndicator}
116
144
  </a>
117
145
  </li>
118
146
  ))}
119
147
  </ul>
120
148
  </div>
121
149
  )}
122
- {renderSearchDirectly && searchProps && <Search {...searchProps} />}
150
+ {renderSearchDirectly && (utilityContent || searchProps) && (
151
+ <div className="usx-nav__utility">
152
+ {utilityContent}
153
+ {searchProps && <Search {...searchProps} />}
154
+ </div>
155
+ )}
123
156
  </>
124
157
  );
125
158
  }
@@ -136,6 +169,10 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
136
169
  useMenuIcon?: boolean;
137
170
  stickyNav?: boolean;
138
171
  className?: string;
172
+ /** Rendered inline, to the left of the search box (in both header variants). */
173
+ utilityContent?: React.ReactNode;
174
+ /** Rendered right-justified, in line with the primary nav links (extended header only). */
175
+ navEndContent?: React.ReactNode;
139
176
  }
140
177
 
141
178
  export default function Header({
@@ -150,6 +187,8 @@ export default function Header({
150
187
  useMenuIcon = false,
151
188
  stickyNav = false,
152
189
  className = '',
190
+ utilityContent = null,
191
+ navEndContent = null,
153
192
  ...props
154
193
  }: HeaderProps) {
155
194
  const headerClasses = ClassNames(
@@ -194,14 +233,24 @@ export default function Header({
194
233
  <ul className="usa-nav__secondary-links">
195
234
  {secondaryLinks.map((link, index) => (
196
235
  <li key={index} className="usa-nav__secondary-item">
197
- <a href={link.href} aria-label={link.ariaLabel}>
236
+ <a
237
+ href={link.href}
238
+ aria-label={link.ariaLabel}
239
+ >
198
240
  <span>{link.text}</span>
241
+ {link.external && externalIndicator}
199
242
  </a>
200
243
  </li>
201
244
  ))}
202
245
  </ul>
203
- {searchProps && <Search {...searchProps} />}
246
+ {(utilityContent || searchProps) && (
247
+ <div className="usx-nav__utility">
248
+ {utilityContent}
249
+ {searchProps && <Search {...searchProps} />}
250
+ </div>
251
+ )}
204
252
  </div>
253
+ {navEndContent && <div className="usx-nav__end-slot">{navEndContent}</div>}
205
254
  </div>
206
255
  </nav>
207
256
  </>
@@ -219,6 +268,7 @@ export default function Header({
219
268
  showSecondary={false}
220
269
  secondaryLinks={secondaryLinks}
221
270
  searchProps={searchProps}
271
+ utilityContent={utilityContent}
222
272
  headerId={id}
223
273
  renderSearchDirectly={true}
224
274
  />
@@ -53,6 +53,14 @@
53
53
  "className": {
54
54
  "type": "string",
55
55
  "description": "Additional classes"
56
+ },
57
+ "utilityContent": {
58
+ "type": "slot",
59
+ "description": "Rendered inline, to the left of the search box (in both header variants)."
60
+ },
61
+ "navEndContent": {
62
+ "type": "slot",
63
+ "description": "Rendered right-justified, in line with the primary nav links (extended header only)."
56
64
  }
57
65
  }
58
66
  }
@@ -56,7 +56,7 @@
56
56
  </em>
57
57
  {% endif %}
58
58
  </div>
59
- <button type="button" class="usa-menu-btn">
59
+ <button type="button" class="usa-menu-btn align-center">
60
60
  {% if useMenuIcon %}
61
61
  {% icon name='menu' size=3 %}{% endicon %}
62
62
  {% else %}
@@ -65,130 +65,144 @@
65
65
  </button>
66
66
  </div>
67
67
 
68
- {% if extended %}
69
- <nav aria-label="Primary navigation" class="usa-nav usx-nav">
70
- <div class="usa-nav__inner">
71
- <button type="button" class="usa-nav__close">
72
- {% icon name='close' %}{% endicon %}
73
- </button>
74
- <ul class="usa-nav__primary usa-accordion">
75
- {% for section in navSections %}
76
- <li class="usa-nav__primary-item">
77
- {% if section.href %}
78
- <a href="{{ section.href }}" class="usa-nav__link" {% if section.ariaLabel %}aria-label="{{ section.ariaLabel }}"{% endif %}>
79
- <span>{{ section.title }}</span>
80
- </a>
81
- {% else %}
82
- <button type="button" class="usa-accordion__button usa-nav__link" aria-expanded="false" aria-controls="{{ id }}-nav-section-{{ forloop.counter0 }}">
83
- <span>{{ section.title }}</span>
84
- </button>
85
- {% if section.links %}
86
- {% if megamenu %}
87
- <div id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu usa-megamenu" hidden="hidden">
88
- <div class="grid-row grid-gap-4">
89
- <div class="usa-col">
90
- <ul class="usa-nav__submenu-list">
91
- {% for link in section.links %}
92
- <li class="usa-nav__submenu-item">
93
- <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
94
- {{ link.text }}
95
- </a>
96
- </li>
97
- {% endfor %}
98
- </ul>
99
- </div>
68
+ {% if not extended %}
69
+ <nav aria-label="Primary navigation" class="usa-nav usx-nav{% if stickyNav %} usx-nav--sticky{% endif %}">
70
+ <button type="button" class="usa-nav__close">
71
+ {% icon name='close' %}{% endicon %}
72
+ </button>
73
+ <ul class="usa-nav__primary usa-accordion">
74
+ {% for section in navSections %}
75
+ <li class="usa-nav__primary-item">
76
+ {% if section.href %}
77
+ <a href="{{ section.href }}" class="usa-nav__link" {% if section.ariaLabel %}aria-label="{{ section.ariaLabel }}"{% endif %}>
78
+ <span>{{ section.title }}</span>
79
+ {% if section.external %}<span class="usa-sr-only">External.</span>{% icon name='launch' size=1 className='margin-left-05' %}{% endicon %}{% endif %}
80
+ </a>
81
+ {% else %}
82
+ <button type="button" class="usa-accordion__button usa-nav__link" aria-expanded="false" aria-controls="{{ id }}-nav-section-{{ forloop.counter0 }}">
83
+ <span>{{ section.title }}</span>
84
+ </button>
85
+ {% if section.links %}
86
+ {% if megamenu %}
87
+ <div id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu usa-megamenu" hidden="hidden">
88
+ <div class="grid-row grid-gap-4">
89
+ <div class="usa-col">
90
+ <ul class="usa-nav__submenu-list">
91
+ {% for link in section.links %}
92
+ <li class="usa-nav__submenu-item">
93
+ <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
94
+ {{ link.text }}
95
+ {% if link.external %}<span class="usa-sr-only">External.</span>{% icon name='launch' size=1 className='margin-left-05' %}{% endicon %}{% endif %}
96
+ </a>
97
+ </li>
98
+ {% endfor %}
99
+ </ul>
100
100
  </div>
101
101
  </div>
102
- {% else %}
103
- <ul id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu" hidden="hidden">
104
- {% for link in section.links %}
105
- <li class="usa-nav__submenu-item">
106
- <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
107
- <span>{{ link.text }}</span>
108
- </a>
109
- </li>
110
- {% endfor %}
111
- </ul>
112
- {% endif %}
102
+ </div>
103
+ {% else %}
104
+ <ul id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu" hidden="hidden">
105
+ {% for link in section.links %}
106
+ <li class="usa-nav__submenu-item">
107
+ <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
108
+ <span>{{ link.text }}</span>
109
+ {% if link.external %}<span class="usa-sr-only">External.</span>{% icon name='launch' size=1 className='margin-left-05' %}{% endicon %}{% endif %}
110
+ </a>
111
+ </li>
112
+ {% endfor %}
113
+ </ul>
113
114
  {% endif %}
114
115
  {% endif %}
115
- </li>
116
- {% endfor %}
117
- </ul>
118
- <div class="usa-nav__secondary">
119
- <ul class="usa-nav__secondary-links">
120
- {% for link in secondaryLinks %}
121
- <li class="usa-nav__secondary-item">
122
- <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
123
- <span>{{ link.text }}</span>
124
- </a>
125
- </li>
126
- {% endfor %}
127
- </ul>
116
+ {% endif %}
117
+ </li>
118
+ {% endfor %}
119
+ </ul>
120
+ {% if utilityContent or searchProps %}
121
+ <div class="usx-nav__utility">
122
+ {% if utilityContent %}{{ utilityContent|safe }}{% endif %}
128
123
  {% if searchProps %}
129
124
  {% search id=searchProps.id ariaLabel=searchProps.ariaLabel searchKey=searchProps.searchKey label=searchProps.label icon=searchProps.icon iconOnly=searchProps.iconOnly buttonVariant=searchProps.buttonVariant big=searchProps.big action=searchProps.action placeholder=searchProps.placeholder defaultValue=searchProps.defaultValue onSubmit=searchProps.onSubmit className=searchProps.className|default:'' %}{% endsearch %}
130
125
  {% endif %}
131
126
  </div>
132
- </div>
127
+ {% endif %}
133
128
  </nav>
134
- {% else %}
135
-
136
- <nav aria-label="Primary navigation" class="usa-nav usx-nav">
137
- <button type="button" class="usa-nav__close">
138
- {% icon name='close' %}{% endicon %}
139
- </button>
140
- <ul class="usa-nav__primary usa-accordion">
141
- {% for section in navSections %}
142
- <li class="usa-nav__primary-item">
143
- {% if section.href %}
144
- <a href="{{ section.href }}" class="usa-nav__link" {% if section.ariaLabel %}aria-label="{{ section.ariaLabel }}"{% endif %}>
145
- <span>{{ section.title }}</span>
146
- </a>
147
- {% else %}
148
- <button type="button" class="usa-accordion__button usa-nav__link" aria-expanded="false" aria-controls="{{ id }}-nav-section-{{ forloop.counter0 }}">
149
- <span>{{ section.title }}</span>
150
- </button>
151
- {% if section.links %}
152
- {% if megamenu %}
153
- <div id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu usa-megamenu" hidden="hidden">
154
- <div class="grid-row grid-gap-4">
155
- <div class="usa-col">
156
- <ul class="usa-nav__submenu-list">
157
- {% for link in section.links %}
158
- <li class="usa-nav__submenu-item">
159
- <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
160
- {{ link.text }}
161
- </a>
162
- </li>
163
- {% endfor %}
164
- </ul>
165
- </div>
129
+ {% endif %}
130
+ {% if not extended %}</div>{% endif %}
131
+ </header>
132
+ {% if extended %}
133
+ <nav aria-label="Primary navigation" class="usa-nav usx-nav{% if stickyNav %} usx-nav--sticky{% endif %}">
134
+ <div class="usa-nav__inner">
135
+ <button type="button" class="usa-nav__close">
136
+ {% icon name='close' %}{% endicon %}
137
+ </button>
138
+ <ul class="usa-nav__primary usa-accordion">
139
+ {% for section in navSections %}
140
+ <li class="usa-nav__primary-item">
141
+ {% if section.href %}
142
+ <a href="{{ section.href }}" class="usa-nav__link" {% if section.ariaLabel %}aria-label="{{ section.ariaLabel }}"{% endif %}>
143
+ <span>{{ section.title }}</span>
144
+ {% if section.external %}<span class="usa-sr-only">External.</span>{% icon name='launch' size=1 className='margin-left-05' %}{% endicon %}{% endif %}
145
+ </a>
146
+ {% else %}
147
+ <button type="button" class="usa-accordion__button usa-nav__link" aria-expanded="false" aria-controls="{{ id }}-nav-section-{{ forloop.counter0 }}">
148
+ <span>{{ section.title }}</span>
149
+ </button>
150
+ {% if section.links %}
151
+ {% if megamenu %}
152
+ <div id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu usa-megamenu" hidden="hidden">
153
+ <div class="grid-row grid-gap-4">
154
+ <div class="usa-col">
155
+ <ul class="usa-nav__submenu-list">
156
+ {% for link in section.links %}
157
+ <li class="usa-nav__submenu-item">
158
+ <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
159
+ {{ link.text }}
160
+ {% if link.external %}<span class="usa-sr-only">External.</span>{% icon name='launch' size=1 className='margin-left-05' %}{% endicon %}{% endif %}
161
+ </a>
162
+ </li>
163
+ {% endfor %}
164
+ </ul>
166
165
  </div>
167
166
  </div>
168
- {% else %}
169
- <ul id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu" hidden="hidden">
170
- {% for link in section.links %}
171
- <li class="usa-nav__submenu-item">
172
- <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
173
- <span>{{ link.text }}</span>
174
- </a>
175
- </li>
176
- {% endfor %}
177
- </ul>
178
- {% endif %}
167
+ </div>
168
+ {% else %}
169
+ <ul id="{{ id }}-nav-section-{{ forloop.counter0 }}" class="usa-nav__submenu" hidden="hidden">
170
+ {% for link in section.links %}
171
+ <li class="usa-nav__submenu-item">
172
+ <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
173
+ <span>{{ link.text }}</span>
174
+ {% if link.external %}<span class="usa-sr-only">External.</span>{% icon name='launch' size=1 className='margin-left-05' %}{% endicon %}{% endif %}
175
+ </a>
176
+ </li>
177
+ {% endfor %}
178
+ </ul>
179
179
  {% endif %}
180
180
  {% endif %}
181
+ {% endif %}
182
+ </li>
183
+ {% endfor %}
184
+ </ul>
185
+ <div class="usa-nav__secondary">
186
+ <ul class="usa-nav__secondary-links">
187
+ {% for link in secondaryLinks %}
188
+ <li class="usa-nav__secondary-item">
189
+ <a href="{{ link.href }}" {% if link.ariaLabel %}aria-label="{{ link.ariaLabel }}"{% endif %}>
190
+ <span>{{ link.text }}</span>
191
+ {% if link.external %}<span class="usa-sr-only">External.</span>{% icon name='launch' size=1 className='margin-left-05' %}{% endicon %}{% endif %}
192
+ </a>
181
193
  </li>
182
194
  {% endfor %}
183
195
  </ul>
184
- {% if searchProps %}
185
- {% search id=searchProps.id ariaLabel=searchProps.ariaLabel searchKey=searchProps.searchKey label=searchProps.label icon=searchProps.icon iconOnly=searchProps.iconOnly buttonVariant=searchProps.buttonVariant big=searchProps.big action=searchProps.action placeholder=searchProps.placeholder defaultValue=searchProps.defaultValue onSubmit=searchProps.onSubmit className=searchProps.className|default:'' %}{% endsearch %}
196
+ {% if utilityContent or searchProps %}
197
+ <div class="usx-nav__utility">
198
+ {% if utilityContent %}{{ utilityContent|safe }}{% endif %}
199
+ {% if searchProps %}
200
+ {% search id=searchProps.id ariaLabel=searchProps.ariaLabel searchKey=searchProps.searchKey label=searchProps.label icon=searchProps.icon iconOnly=searchProps.iconOnly buttonVariant=searchProps.buttonVariant big=searchProps.big action=searchProps.action placeholder=searchProps.placeholder defaultValue=searchProps.defaultValue onSubmit=searchProps.onSubmit className=searchProps.className|default:'' %}{% endsearch %}
201
+ {% endif %}
202
+ </div>
186
203
  {% endif %}
187
- </nav>
204
+ </div>
205
+ {% if navEndContent %}<div class="usx-nav__end-slot">{{ navEndContent|safe }}</div>{% endif %}
188
206
  </div>
189
- {% endif %}
190
-
191
- {% if not extended %}
192
- </div>
193
- {% endif %}
194
- </header>
207
+ </nav>
208
+ {% endif %}
@@ -86,7 +86,7 @@ export default function ThemePicker({
86
86
  ) : (
87
87
  <button
88
88
  type="button"
89
- className="usa-button usx-button usx-button--ghost usx-theme-picker__trigger"
89
+ className="usa-button usx-button usx-button--ghost text-muted usx-theme-picker__trigger"
90
90
  aria-label={label}
91
91
  onClick={() => setOpen(true)}
92
92
  >
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "onChange": {
31
31
  "type": "string",
32
- "description": "JavaScript function to call when the selected theme changes — applying the theme (CSS variables, stylesheets, persistence, etc.) is the caller's responsibility"
32
+ "description": "JavaScript function to call when the selected theme changes — applying the theme is the caller's responsibility. With @solexllc/usx-theme/themes, that's typically `document.documentElement.dataset.theme = value` (plus any persistence)."
33
33
  },
34
34
  "className": {
35
35
  "type": "string",