@solexllc/usx-react 0.3.1 → 0.4.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.
Files changed (42) hide show
  1. package/README.md +132 -0
  2. package/dist/index.cjs +181 -182
  3. package/dist/index.js +181 -182
  4. package/package.json +6 -5
  5. package/src/assets.ts +16 -0
  6. package/src/components/alert/Alert.tsx +4 -3
  7. package/src/components/alert/alert.django.html +2 -3
  8. package/src/components/alert/config.json +15 -4
  9. package/src/components/banner/Banner.tsx +8 -6
  10. package/src/components/banner/banner.django.html +4 -5
  11. package/src/components/banner/config.json +5 -1
  12. package/src/components/button/Button.tsx +1 -1
  13. package/src/components/button/button.django.html +2 -2
  14. package/src/components/button/config.json +14 -6
  15. package/src/components/code/Code.tsx +4 -27
  16. package/src/components/code/code.django.html +3 -9
  17. package/src/components/code/config.json +4 -0
  18. package/src/components/copy-to-clipboard/CopyToClipboard.tsx +35 -24
  19. package/src/components/copy-to-clipboard/config.json +14 -7
  20. package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +14 -14
  21. package/src/components/footer/Footer.tsx +26 -6
  22. package/src/components/footer/config.json +4 -0
  23. package/src/components/footer/footer.django.html +10 -9
  24. package/src/components/header/Branding.tsx +9 -6
  25. package/src/components/header/Header.tsx +3 -1
  26. package/src/components/header/config.json +4 -0
  27. package/src/components/header/header.django.html +5 -26
  28. package/src/components/header/header.html +10 -10
  29. package/src/components/icon/Icon.tsx +6 -3
  30. package/src/components/icon/config.json +12 -6
  31. package/src/components/icon/icon.django.html +6 -4
  32. package/src/components/image/Image.tsx +8 -4
  33. package/src/components/image/config.json +10 -2
  34. package/src/components/image/image.django.html +8 -6
  35. package/src/components/layout/config.json +9 -9
  36. package/src/components/layout/layout.django.html +1 -1
  37. package/src/components/spinner/Spinner.tsx +18 -25
  38. package/src/components/spinner/config.json +4 -0
  39. package/src/components/spinner/spinner.django.html +4 -6
  40. package/src/components/tooltip/Tooltip.tsx +4 -2
  41. package/src/components/tooltip/config.json +7 -2
  42. package/src/components/tooltip/tooltip.django.html +1 -1
@@ -1,3 +1,4 @@
1
+ {% load components %}
1
2
  <div
2
3
  class="
3
4
  usa-alert
@@ -36,9 +37,7 @@
36
37
  {% endif %}
37
38
  {% if onDismiss %}
38
39
  <button class="usx-alert__dismiss" aria-label="Dismiss alert" onclick="{{ onDismiss }}">
39
- <svg class="usa-icon usa-icon--size-3" aria-hidden="true" focusable="false" role="img">
40
- <use href="./img/sprite.svg#close"></use>
41
- </svg>
40
+ {% icon name='close' size='3' staticBaseUrl=staticBaseUrl aria-hidden="true" focusable="false" role="img" %}{% endicon %}
42
41
  </button>
43
42
  {% endif %}
44
43
  </div>
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "alert",
3
3
  "template": "alert/alert.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
+ "staticBaseUrl": {
7
+ "type": "string",
8
+ "description": "Optional asset base for this component. A non-empty value overrides window.usxBaseUrl in React or STATIC_URL in Django; otherwise the global base or / is used. Asset filenames remain separate."
9
+ },
6
10
  "heading": {
7
11
  "type": "string",
8
12
  "description": "The heading of the alert, which provides a brief summary of the alert's content."
@@ -37,8 +41,15 @@
37
41
  "description": "Additional CSS classes to apply to the alert component."
38
42
  },
39
43
  "style": {
40
- "type": "string",
41
- "description": "Inline styles to apply to the alert component."
44
+ "type": "object",
45
+ "description": "Inline styles as a React CSSProperties object.",
46
+ "renderers": {
47
+ "react": { "type": "object" },
48
+ "django": {
49
+ "supported": false,
50
+ "description": "The Django template does not render this prop."
51
+ }
52
+ }
42
53
  },
43
54
  "role": {
44
55
  "type": "select",
@@ -64,7 +75,7 @@
64
75
  },
65
76
  "children": {
66
77
  "type": "slot",
67
- "description": "Alert rich content (React node / HTML string). If provided, this content will be rendered instead of the `heading` and `text` props."
78
+ "description": "Alert content as text or composed content (React nodes or a Django template fragment). When truthy, replaces text; the heading remains visible unless slim is enabled."
68
79
  }
69
80
  }
70
81
  }
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
2
  import Icon from '../icon/Icon';
3
3
  import ClassNames from 'classnames';
4
+ import { getAssetUrl as assetUrl } from '../../assets';
4
5
 
5
6
  export interface BannerProps extends React.HTMLAttributes<HTMLElement> {
6
7
  id?: string;
7
8
  ariaLabel?: string;
8
9
  flagSrc?: string;
10
+ staticBaseUrl?: string;
9
11
  tld?: string;
10
12
  bannerText?: string;
11
13
  bannerActionText?: string;
@@ -19,7 +21,8 @@ export interface BannerProps extends React.HTMLAttributes<HTMLElement> {
19
21
  export default function Banner({
20
22
  id = 'gov-banner',
21
23
  ariaLabel = 'Official government website',
22
- flagSrc = ((typeof window !== 'undefined' && (window as { usxBaseUrl?: string }).usxBaseUrl) || '/') + 'img/us_flag_small.png',
24
+ flagSrc,
25
+ staticBaseUrl,
23
26
  tld = '.gov',
24
27
  bannerText = 'An official website of the United States government',
25
28
  bannerActionText = "Here's how you know",
@@ -28,14 +31,13 @@ export default function Banner({
28
31
  httpsHeading = `Secure ${tld} websites use HTTPS`,
29
32
  httpsText = (
30
33
  <>
31
- A <strong>lock</strong> (<Icon name="lock" size={1} />) or <strong>https://</strong> means
34
+ A <strong>lock</strong> (<Icon name="lock" size={1} staticBaseUrl={staticBaseUrl} />) or <strong>https://</strong> means
32
35
  you’ve safely connected to the {tld} website. Share sensitive information only on official, secure websites.
33
36
  </>
34
37
  ),
35
38
  className = '',
36
39
  ...props
37
40
  }: BannerProps) {
38
- const assetBaseUrl = (typeof window !== 'undefined' && (window as { usxBaseUrl?: string }).usxBaseUrl) || '/';
39
41
  const classes = ClassNames(
40
42
  'usa-banner',
41
43
  'usx-banner',
@@ -50,7 +52,7 @@ export default function Banner({
50
52
  <img
51
53
  aria-hidden="true"
52
54
  className="usa-banner__header-flag"
53
- src={flagSrc}
55
+ src={assetUrl(flagSrc ?? 'img/us_flag_small.png', staticBaseUrl)}
54
56
  alt=""
55
57
  />
56
58
  </div>
@@ -82,7 +84,7 @@ export default function Banner({
82
84
  <div className="usa-banner__guidance tablet:grid-col-6">
83
85
  <img
84
86
  className="usa-banner__icon usa-media-block__img"
85
- src={`${assetBaseUrl}img/icon-dot-gov.svg`}
87
+ src={assetUrl('img/icon-dot-gov.svg', staticBaseUrl)}
86
88
  role="img"
87
89
  alt=""
88
90
  aria-hidden="true"
@@ -98,7 +100,7 @@ export default function Banner({
98
100
  <div className="usa-banner__guidance tablet:grid-col-6">
99
101
  <img
100
102
  className="usa-banner__icon usa-media-block__img"
101
- src={`${assetBaseUrl}img/icon-https.svg`}
103
+ src={assetUrl('img/icon-https.svg', staticBaseUrl)}
102
104
  role="img"
103
105
  alt=""
104
106
  aria-hidden="true"
@@ -1,5 +1,4 @@
1
1
  {% load components %}
2
- {% load static %}
3
2
  {# Django template for Banner #}
4
3
  {% with effective_tld=tld|default:'.gov' %}
5
4
  <section
@@ -14,7 +13,7 @@
14
13
  <img
15
14
  aria-hidden="true"
16
15
  class="usa-banner__header-flag"
17
- src="{% if flagSrc %}{{ flagSrc }}{% else %}{% static 'img/us_flag_small.png' %}{% endif %}"
16
+ src="{% asset_url flagSrc|default:'img/us_flag_small.png' staticBaseUrl %}"
18
17
  alt=""
19
18
  />
20
19
  </div>
@@ -46,7 +45,7 @@
46
45
  <div class="usa-banner__guidance tablet:grid-col-6">
47
46
  <img
48
47
  class="usa-banner__icon usa-media-block__img"
49
- src="{% static 'img/icon-dot-gov.svg' %}"
48
+ src="{% asset_url 'img/icon-dot-gov.svg' staticBaseUrl %}"
50
49
  role="img"
51
50
  alt=""
52
51
  aria-hidden="true"
@@ -61,7 +60,7 @@
61
60
  <div class="usa-banner__guidance tablet:grid-col-6">
62
61
  <img
63
62
  class="usa-banner__icon usa-media-block__img"
64
- src="{% static 'img/icon-https.svg' %}"
63
+ src="{% asset_url 'img/icon-https.svg' staticBaseUrl %}"
65
64
  role="img"
66
65
  alt=""
67
66
  aria-hidden="true"
@@ -69,7 +68,7 @@
69
68
  <div class="usa-media-block__body">
70
69
  <p>
71
70
  <strong>{% if httpsHeading %}{{ httpsHeading }}{% else %}Secure {{ effective_tld }} websites use HTTPS{% endif %}</strong><br/>
72
- {% if httpsText %}{{ httpsText|safe }}{% else %}A <strong>lock</strong> ({% icon name="lock" size=1 ariaHidden=True focusable=False %}{% endicon %}) or <strong>https://</strong> means you've safely connected to the {{ effective_tld }} website. Share sensitive information only on official, secure websites.{% endif %}
71
+ {% if httpsText %}{{ httpsText|safe }}{% else %}A <strong>lock</strong> ({% icon name="lock" size=1 staticBaseUrl=staticBaseUrl ariaHidden=True focusable=False %}{% endicon %}) or <strong>https://</strong> means you've safely connected to the {{ effective_tld }} website. Share sensitive information only on official, secure websites.{% endif %}
73
72
  </p>
74
73
  </div>
75
74
  </div>
@@ -3,6 +3,10 @@
3
3
  "template": "banner/banner.django.html",
4
4
  "version": 1,
5
5
  "props": {
6
+ "staticBaseUrl": {
7
+ "type": "string",
8
+ "description": "Optional asset base for this component. A non-empty value overrides window.usxBaseUrl in React or STATIC_URL in Django; otherwise the global base or / is used. Asset filenames remain separate."
9
+ },
6
10
  "id": {
7
11
  "type": "string",
8
12
  "description": "The unique ID for the banner, used for aria-controls and element targeting."
@@ -13,7 +17,7 @@
13
17
  },
14
18
  "flagSrc": {
15
19
  "type": "string",
16
- "description": "URL for the decorative banner flag image. Defaults to img/us_flag_small.png under the configured asset base."
20
+ "description": "Asset path for the decorative flag, resolved under staticBaseUrl or the global asset base. Defaults to img/us_flag_small.png. Fully qualified URLs pass through unchanged."
17
21
  },
18
22
  "tld": {
19
23
  "type": "string",
@@ -70,7 +70,7 @@ export default function Button({
70
70
  const classes = ClassNames(
71
71
  'usa-button',
72
72
  'usx-button',
73
- variant ? variantClasses[variant] : variantClasses['primary'],
73
+ variant && variantClasses[variant],
74
74
  big && 'usa-button--big',
75
75
  inverse && 'usa-button--inverse',
76
76
  ghost && 'usx-button--ghost',
@@ -5,7 +5,7 @@
5
5
  href="{{ href }}"
6
6
  class="
7
7
  usa-button usx-button
8
- usa-button--{{ variant|default:'primary' }}
8
+ {% if variant %} usa-button--{{ variant }}{% endif %}
9
9
  {% if big == True %} usa-button--big{% endif %}
10
10
  {% if disabled == True %} usa-button--disabled{% endif %}
11
11
  {% if inverse == True %} usa-button--inverse{% endif %}
@@ -21,7 +21,7 @@
21
21
  type="{{ type|default:'button' }}"
22
22
  class="
23
23
  usa-button usx-button
24
- usa-button--{{ variant|default:'primary' }}
24
+ {% if variant %} usa-button--{{ variant }}{% endif %}
25
25
  {% if big == True %} usa-button--big{% endif %}
26
26
  {% if disabled == True %} usa-button--disabled{% endif %}
27
27
  {% if inverse == True %} usa-button--inverse{% endif %}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "button",
3
3
  "template": "button/button.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "label": {
7
7
  "type": "string",
@@ -15,7 +15,8 @@
15
15
  "accent-cool",
16
16
  "accent-warm",
17
17
  "base",
18
- "outline"
18
+ "outline",
19
+ "unstyled"
19
20
  ],
20
21
  "description": "The visual style of the button, which can be used to indicate the importance or type of action the button represents."
21
22
  },
@@ -88,12 +89,19 @@
88
89
  "description": "Additional CSS classes to apply to the button component."
89
90
  },
90
91
  "style": {
91
- "type": "string",
92
- "description": "Inline styles to apply to the button component."
92
+ "type": "object",
93
+ "description": "Inline styles as a React CSSProperties object.",
94
+ "renderers": {
95
+ "react": { "type": "object" },
96
+ "django": {
97
+ "supported": false,
98
+ "description": "The Django template does not render this prop."
99
+ }
100
+ }
93
101
  },
94
102
  "children": {
95
- "type": "string",
96
- "description": "Inner HTML or text to be displayed within the button, allowing for more complex content such as additional elements or formatting."
103
+ "type": "slot",
104
+ "description": "Button content as text or composed content (React nodes or a Django template fragment); takes precedence over label when truthy."
97
105
  },
98
106
  "extraAttributes": {
99
107
  "type": "object",
@@ -1,20 +1,6 @@
1
1
  import React from 'react';
2
2
  import ClassNames from 'classnames';
3
-
4
- function usxCopy(text: string) {
5
- if (navigator.clipboard) {
6
- navigator.clipboard.writeText(text);
7
- } else {
8
- const ta = document.createElement('textarea');
9
- ta.value = text;
10
- ta.style.cssText = 'position:fixed;opacity:0';
11
- document.body.appendChild(ta);
12
- ta.focus();
13
- ta.select();
14
- try { document.execCommand('copy'); } catch { /* ignore */ }
15
- document.body.removeChild(ta);
16
- }
17
- }
3
+ import CopyToClipboard from '../copy-to-clipboard/CopyToClipboard';
18
4
 
19
5
  export interface CodeLine {
20
6
  code: string;
@@ -26,10 +12,11 @@ export interface CodeProps {
26
12
  lines?: CodeLine[];
27
13
  allowHtml?: boolean;
28
14
  copyText?: string | null;
15
+ staticBaseUrl?: string;
29
16
  className?: string;
30
17
  }
31
18
 
32
- export default function Code({ lines = [], allowHtml = false, copyText = null, className = '' }: CodeProps) {
19
+ export default function Code({ lines = [], allowHtml = false, copyText = null, staticBaseUrl, className = '' }: CodeProps) {
33
20
  return (
34
21
  <div className={ClassNames('usx-mockup-code', className)}>
35
22
  <div className="usx-mockup-code__content">
@@ -44,17 +31,7 @@ export default function Code({ lines = [], allowHtml = false, copyText = null, c
44
31
  ))}
45
32
  </div>
46
33
  {copyText && (
47
- <button
48
- className="usa-button usx-button usx-button--ghost usx-copy"
49
- onClick={() => usxCopy(copyText)}
50
- >
51
- <svg className="usa-icon usx-copy__copy" aria-hidden="true" focusable="false" role="img">
52
- <use href="./img/sprite.svg#content_copy" />
53
- </svg>
54
- <svg className="usa-icon usx-copy__check" aria-hidden="true" focusable="false" role="img">
55
- <use href="./img/sprite.svg#check" />
56
- </svg>
57
- </button>
34
+ <CopyToClipboard copyText={copyText} staticBaseUrl={staticBaseUrl} tooltipProps={{ label: 'Copy', copiedTooltip: 'Copied', position: 'left' }}/>
58
35
  )}
59
36
  </div>
60
37
  );
@@ -1,4 +1,5 @@
1
1
  {# Django template for Code #}
2
+ {% load components %}
2
3
  <div class="usx-mockup-code{% if className %} {{ className }}{% endif %}">
3
4
  <div class="usx-mockup-code__content">
4
5
  {% for line in lines %}
@@ -8,14 +9,7 @@
8
9
  {% endfor %}
9
10
  </div>
10
11
  {% if copyText %}
11
- <button class="usa-button usx-button usx-button--ghost usx-copy"
12
- onclick="navigator.clipboard.writeText('{{ copyText|escapejs }}')">
13
- <svg class="usa-icon usx-copy__copy" aria-hidden="true" focusable="false" role="img">
14
- <use href="./img/sprite.svg#content_copy"></use>
15
- </svg>
16
- <svg class="usa-icon usx-copy__check" aria-hidden="true" focusable="false" role="img">
17
- <use href="./img/sprite.svg#check"></use>
18
- </svg>
19
- </button>
12
+ {% dict label="Copy" copiedTooltip="Copied" position="left" as tooltipProps %}
13
+ {% copy_to_clipboard copyText=copyText tooltipProps=tooltipProps staticBaseUrl=staticBaseUrl %}{% endcopy_to_clipboard %}
20
14
  {% endif %}
21
15
  </div>
@@ -6,6 +6,10 @@
6
6
  "lines"
7
7
  ],
8
8
  "props": {
9
+ "staticBaseUrl": {
10
+ "type": "string",
11
+ "description": "Optional asset base for this component. A non-empty value overrides window.usxBaseUrl in React or STATIC_URL in Django; otherwise the global base or / is used. Asset filenames remain separate."
12
+ },
9
13
  "lines": {
10
14
  "type": "array",
11
15
  "description": "Array of line objects. Each supports: code (string), prefix (string, omit for no data-prefix attribute), className (string).",
@@ -1,48 +1,59 @@
1
1
  import React from 'react';
2
2
  import ClassNames from 'classnames';
3
+ import Button from '../button/Button';
4
+ import Icon from '../icon/Icon';
5
+ import Tooltip from '../tooltip/Tooltip';
6
+ import type { TooltipProps } from '../tooltip/Tooltip';
7
+
8
+ function copyTextToClipboard(text: string) {
9
+ if (window.navigator.clipboard) {
10
+ return window.navigator.clipboard.writeText(text);
11
+ }
12
+ }
3
13
 
4
14
  export interface CopyToClipboardProps {
5
15
  copyText?: string;
6
16
  label?: string | null;
7
- tooltip?: string | null;
8
- copiedTooltip?: string;
17
+ tooltipProps?: TooltipProps & { copiedTooltip?: string };
18
+ staticBaseUrl?: string;
9
19
  className?: string;
10
20
  }
11
21
 
12
22
  export default function CopyToClipboard({
13
23
  copyText = '',
14
24
  label = null,
15
- tooltip = null,
16
- copiedTooltip = 'Copied',
25
+ tooltipProps,
26
+ staticBaseUrl,
17
27
  className = '',
18
28
  }: CopyToClipboardProps) {
19
29
  const button = (
20
- <button
21
- className={ClassNames(
22
- 'usa-button',
23
- 'usx-button',
24
- 'usx-button--ghost',
25
- 'usx-copy',
26
- className
27
- )}
28
- onClick={() => window.navigator.clipboard.writeText(copyText)}
30
+ <Button
31
+ ghost={true}
32
+ className={ClassNames('usx-copy', className)}
33
+ onClick={() => copyTextToClipboard(copyText)}
29
34
  type="button"
30
35
  >
31
- <svg className="usa-icon usx-copy__copy" aria-hidden="true" focusable="false" role="img">
32
- <use href="./img/sprite.svg#content_copy" />
33
- </svg>
34
- <svg className="usa-icon usx-copy__check" aria-hidden="true" focusable="false" role="img">
35
- <use href="./img/sprite.svg#check" />
36
- </svg>
36
+ <Icon name="content_copy" size={0} className="usx-copy__copy" staticBaseUrl={staticBaseUrl} />
37
+ <Icon name="check" size={0} className="usx-copy__check" staticBaseUrl={staticBaseUrl} />
37
38
  {label && <span className="margin-left-1">{label}</span>}
38
- </button>
39
+ </Button>
39
40
  );
40
41
 
42
+ if (!tooltipProps) return button;
43
+
44
+ const { label: tooltipLabel, copiedTooltip = 'Copied', ...tooltipOptions } = tooltipProps;
45
+
41
46
  return (
42
- <span className="usx-tooltip">
47
+ <Tooltip
48
+ {...tooltipOptions}
49
+ label={(
50
+ <>
51
+ <span className="usx-copy__tooltip--copy">{tooltipLabel}</span>
52
+ <span className="usx-copy__tooltip--copied">{copiedTooltip}</span>
53
+ </>
54
+ )}
55
+ >
43
56
  {button}
44
- {tooltip && <span className="usa-tooltip__body usa-tooltip__body--right usx-copy__tooltip--copy" role="tooltip">{tooltip}</span>}
45
- <span className="usa-tooltip__body usa-tooltip__body--right usx-copy__tooltip--copied" role="tooltip">{copiedTooltip}</span>
46
- </span>
57
+ </Tooltip>
47
58
  );
48
59
  }
@@ -6,6 +6,10 @@
6
6
  "copyText"
7
7
  ],
8
8
  "props": {
9
+ "staticBaseUrl": {
10
+ "type": "string",
11
+ "description": "Optional asset base for this component. A non-empty value overrides window.usxBaseUrl in React or STATIC_URL in Django; otherwise the global base or / is used. Asset filenames remain separate."
12
+ },
9
13
  "copyText": {
10
14
  "type": "string",
11
15
  "description": "Text to copy to clipboard"
@@ -14,13 +18,16 @@
14
18
  "type": "string",
15
19
  "description": "Visible text label on the button"
16
20
  },
17
- "tooltip": {
18
- "type": "string",
19
- "description": "Tooltip text; omit to hide the tooltip wrapper"
20
- },
21
- "copiedTooltip": {
22
- "type": "string",
23
- "description": "Tooltip text shown after copying (default: 'Copied')"
21
+ "tooltipProps": {
22
+ "type": "object",
23
+ "component": "tooltip",
24
+ "description": "Optional Tooltip props passed through unchanged, except label is composed into copy/copied spans. Omit to render only the button. The clipboard button supplies the trigger; Tooltip supplies its own defaults.",
25
+ "properties": {
26
+ "copiedTooltip": {
27
+ "type": "string",
28
+ "description": "Tooltip text shown after copying (default: 'Copied')"
29
+ }
30
+ }
24
31
  },
25
32
  "className": {
26
33
  "type": "string",
@@ -1,16 +1,16 @@
1
1
  {# Django template for CopyToClipboard #}
2
- {% if tooltip %}<span class="usx-tooltip">{% endif %}
3
- <button class="usa-button usx-button usx-button--ghost usx-copy{% if className %} {{ className }}{% endif %}"
4
- onclick="navigator.clipboard.writeText('{{ copyText|escapejs }}')">
5
- <svg class="usa-icon usx-copy__copy" aria-hidden="true" focusable="false" role="img">
6
- <use href="./img/sprite.svg#content_copy"></use>
7
- </svg>
8
- <svg class="usa-icon usx-copy__check" aria-hidden="true" focusable="false" role="img">
9
- <use href="./img/sprite.svg#check"></use>
10
- </svg>
2
+ {% load components %}
3
+ {% with buttonClass=className|default:''|add:' usx-copy' escapedCopyText=copyText|default:''|escapejs %}
4
+ {% dict onclick="navigator.clipboard.writeText('"|add:escapedCopyText|add:"')" as copyAttributes %}
5
+ {% button ghost=True className=buttonClass extraAttributes=copyAttributes as copyButton %}
6
+ {% icon name='content_copy' className="usx-copy__copy" staticBaseUrl=staticBaseUrl %}{% endicon %}
7
+ {% icon name='check' className="usx-copy__check" staticBaseUrl=staticBaseUrl %}{% endicon %}
11
8
  {% if label %}<span class="margin-left-1">{{ label }}</span>{% endif %}
12
- </button>
13
- {% if tooltip %}
14
- <span class="usa-tooltip__body usa-tooltip__body--right usx-copy__tooltip--copy" role="tooltip">{{ tooltip }}</span>
15
- <span class="usa-tooltip__body usa-tooltip__body--right usx-copy__tooltip--copied" role="tooltip">{{ copiedTooltip|default:'Copied' }}</span>
16
- </span>{% endif %}
9
+ {% endbutton %}
10
+ {% if tooltipProps != None %}
11
+ {% fragment as tooltipLabel %}<span class="usx-copy__tooltip--copy">{{ tooltipProps.label|default_if_none:'' }}</span><span class="usx-copy__tooltip--copied">{% if tooltipProps.copiedTooltip != None %}{{ tooltipProps.copiedTooltip }}{% else %}Copied{% endif %}</span>{% endfragment %}
12
+ {% tooltip props=tooltipProps label=tooltipLabel %}{{ copyButton }}{% endtooltip %}
13
+ {% else %}
14
+ {{ copyButton }}
15
+ {% endif %}
16
+ {% endwith %}
@@ -4,6 +4,7 @@ import Input from '../input/Input';
4
4
  import Button from '../button/Button';
5
5
  import Icon from '../icon/Icon';
6
6
  import ClassNames from 'classnames';
7
+ import { getAssetUrl } from '../../assets';
7
8
 
8
9
  // ── Sub-components ──────────────────────────────────────────────────────────
9
10
 
@@ -95,16 +96,17 @@ export interface FooterSocialLink {
95
96
  }
96
97
  export interface FooterSocialLinksProps {
97
98
  links?: FooterSocialLink[];
99
+ staticBaseUrl?: string;
98
100
  className?: string;
99
101
  }
100
- export function FooterSocialLinks({ links = [], className = '' }: FooterSocialLinksProps) {
102
+ export function FooterSocialLinks({ links = [], staticBaseUrl, className = '' }: FooterSocialLinksProps) {
101
103
  if (!links.length) return null;
102
104
  return (
103
105
  <div className={['usa-footer__social-links grid-row grid-gap-1 usx-footer__social-links', className].filter(Boolean).join(' ')}>
104
106
  {links.map((link, i) => (
105
107
  <div key={i} className="grid-col-auto">
106
108
  <a className="usa-social-link" href={link.href} aria-label={link.alt}>
107
- <img className="usa-social-link__icon" src={link.icon} alt={link.alt} />
109
+ <img className="usa-social-link__icon" src={getAssetUrl(link.icon, staticBaseUrl)} alt={link.alt} />
108
110
  </a>
109
111
  </div>
110
112
  ))}
@@ -172,6 +174,7 @@ export interface FooterProps extends React.HTMLAttributes<HTMLElement> {
172
174
  signUp?: FooterSignUpProps | null;
173
175
  branding?: BrandingProps | null;
174
176
  brandingUrl?: string;
177
+ staticBaseUrl?: string;
175
178
  socialLinks?: FooterSocialLink[];
176
179
  contactHeading?: string | null;
177
180
  contactPhone?: LinkShape | null;
@@ -193,6 +196,7 @@ export default function Footer({
193
196
  signUp = null,
194
197
  branding = null,
195
198
  brandingUrl = '/',
199
+ staticBaseUrl,
196
200
  socialLinks = [],
197
201
  contactHeading = null,
198
202
  contactPhone = null,
@@ -225,12 +229,12 @@ export default function Footer({
225
229
  />
226
230
  ) : null;
227
231
 
228
- const socialEl = socialLinks.length > 0 ? <FooterSocialLinks links={socialLinks} /> : null;
232
+ const socialEl = socialLinks.length > 0 ? <FooterSocialLinks links={socialLinks} staticBaseUrl={staticBaseUrl} /> : null;
229
233
  const logoClassName = variant === 'slim'
230
234
  ? 'usa-footer__logo grid-row grid-gap-2 usx-footer__logo'
231
235
  : 'usa-footer__logo grid-row mobile-lg:grid-col-6 mobile-lg:grid-gap-2 usx-footer__logo';
232
236
  const brandingEl = branding ? (
233
- <Branding branding={branding} projectUrl={brandingUrl} className={logoClassName} />
237
+ <Branding branding={branding} projectUrl={brandingUrl} staticBaseUrl={staticBaseUrl} className={logoClassName} />
234
238
  ) : null;
235
239
 
236
240
  const secondaryContactBlock = (socialEl || contactEl) ? (
@@ -287,6 +291,12 @@ export default function Footer({
287
291
 
288
292
  // ── Slim footer ───────────────────────────────────────────────────────────
289
293
  if (variant === 'slim') {
294
+ const slimContactLinks = [
295
+ normalizeContactLink(contactPhone, 'tel:'),
296
+ normalizeContactLink(contactEmail, 'mailto:'),
297
+ ...contactLinks,
298
+ ].filter(Boolean) as FooterContactLink[];
299
+
290
300
  return (
291
301
  <footer className={classes} {...props}>
292
302
  {returnToTopEl}
@@ -308,9 +318,19 @@ export default function Footer({
308
318
  </nav>
309
319
  </div>
310
320
  )}
311
- {contactEl && (
321
+ {slimContactLinks.length > 0 && (
312
322
  <div className="mobile-lg:grid-col-4">
313
- {contactEl}
323
+ <address className="usa-footer__address usx-footer__contact">
324
+ <div className="grid-row grid-gap">
325
+ {slimContactLinks.map((link, index) => (
326
+ <div key={index} className="grid-col-auto mobile-lg:grid-col-12 desktop:grid-col-auto">
327
+ <div className="usa-footer__contact-info">
328
+ <a href={link.href}>{link.text}</a>
329
+ </div>
330
+ </div>
331
+ ))}
332
+ </div>
333
+ </address>
314
334
  </div>
315
335
  )}
316
336
  </div>
@@ -3,6 +3,10 @@
3
3
  "template": "footer/footer.django.html",
4
4
  "version": 1,
5
5
  "props": {
6
+ "staticBaseUrl": {
7
+ "type": "string",
8
+ "description": "Optional branding and social-image asset base, overriding window.usxBaseUrl in React or STATIC_URL in Django. Defaults to the global base or /."
9
+ },
6
10
  "variant": {
7
11
  "type": "select",
8
12
  "options": [