@solexllc/usx-react 0.1.5 → 0.1.7
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 +116 -1292
- package/dist/index.js +118 -1294
- package/package.json +4 -4
- package/src/components/accordion/Accordion.tsx +105 -0
- package/src/components/accordion/accordion.django.html +1 -1
- package/src/components/accordion/config.json +6 -1
- package/src/components/banner/Banner.tsx +35 -27
- package/src/components/banner/banner.django.html +1 -1
- package/src/components/banner/config.json +4 -0
- package/src/components/date-picker/{DatePicker.jsx → DatePicker.tsx} +12 -17
- package/src/components/date-range-picker/{DateRangePicker.jsx → DateRangePicker.tsx} +21 -21
- package/src/components/fieldset/Fieldset.tsx +1 -1
- package/src/components/file-input/{FileInput.jsx → FileInput.tsx} +31 -34
- package/src/components/file-list/{FileList.jsx → FileList.tsx} +24 -24
- package/src/components/header/{HeaderBranding.jsx → HeaderBranding.tsx} +0 -1
- package/src/components/hero/Hero.tsx +49 -7
- package/src/components/hero/config.json +45 -0
- package/src/components/hero/hero.django.html +16 -5
- package/src/components/hero/hero.html +19 -0
- package/src/components/identifier/Identifier.tsx +26 -40
- package/src/components/identifier/config.json +6 -6
- package/src/components/identifier/identifier.django.html +9 -13
- package/src/components/identifier/identifier.html +10 -10
- package/src/components/in-page-nav/{InPageNav.jsx → InPageNav.tsx} +14 -18
- package/src/components/language-selector/{LanguageSelector.jsx → LanguageSelector.tsx} +40 -69
- package/src/components/legend/Legend.tsx +1 -1
- package/src/components/memorable-date/{MemorableDate.jsx → MemorableDate.tsx} +27 -27
- package/src/components/page/{Page.jsx → Page.tsx} +7 -11
- package/src/components/range-slider/{RangeSlider.jsx → RangeSlider.tsx} +13 -21
- package/src/components/select/Select.tsx +2 -2
- package/src/components/time-picker/{TimePicker.jsx → TimePicker.tsx} +14 -19
- package/src/index.js +11 -11
- package/src/components/accordion/Accordion.jsx +0 -170
|
@@ -8,6 +8,12 @@ export interface HeroButtonProps {
|
|
|
8
8
|
onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export interface HeroSecondaryContent {
|
|
12
|
+
title?: string;
|
|
13
|
+
paragraph?: string;
|
|
14
|
+
link?: { href: string; text: string } | null;
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
export interface HeroProps extends React.HTMLAttributes<HTMLElement> {
|
|
12
18
|
title?: string;
|
|
13
19
|
callout?: string;
|
|
@@ -15,7 +21,14 @@ export interface HeroProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
15
21
|
button?: HeroButtonProps | null;
|
|
16
22
|
searchProps?: SearchProps | null;
|
|
17
23
|
backgroundImage?: string;
|
|
24
|
+
backgroundPosition?: React.CSSProperties['backgroundPosition'];
|
|
25
|
+
contentPosition?: 'left' | 'center' | 'right';
|
|
26
|
+
boxed?: boolean;
|
|
27
|
+
calloutMaxWidth?: string;
|
|
28
|
+
headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
|
|
29
|
+
secondaryContent?: HeroSecondaryContent | null;
|
|
18
30
|
overlay?: boolean;
|
|
31
|
+
overlayOpacity?: number;
|
|
19
32
|
ariaLabel?: string;
|
|
20
33
|
className?: string;
|
|
21
34
|
}
|
|
@@ -27,29 +40,47 @@ export default function Hero({
|
|
|
27
40
|
button = null,
|
|
28
41
|
searchProps = null,
|
|
29
42
|
backgroundImage = '',
|
|
43
|
+
backgroundPosition,
|
|
44
|
+
contentPosition = 'left',
|
|
45
|
+
boxed = true,
|
|
46
|
+
calloutMaxWidth,
|
|
47
|
+
headingLevel = 'h1',
|
|
48
|
+
secondaryContent = null,
|
|
30
49
|
overlay = true,
|
|
50
|
+
overlayOpacity,
|
|
31
51
|
ariaLabel = 'Introduction',
|
|
32
52
|
className = '',
|
|
53
|
+
style,
|
|
33
54
|
...props
|
|
34
55
|
}: HeroProps) {
|
|
56
|
+
const Heading = headingLevel;
|
|
57
|
+
const secondaryHeadings = { h1: 'h2', h2: 'h3', h3: 'h4', h4: 'h5', h5: 'h6' } as const;
|
|
58
|
+
const SecondaryHeading = secondaryHeadings[headingLevel];
|
|
35
59
|
const classes = [
|
|
36
60
|
'usx-hero',
|
|
37
61
|
overlay && 'usx-hero--has-overlay',
|
|
62
|
+
overlayOpacity !== undefined && 'usx-hero--custom-overlay',
|
|
63
|
+
contentPosition !== 'left' && `usx-hero--content-${contentPosition}`,
|
|
64
|
+
!boxed && 'usx-hero--unboxed',
|
|
65
|
+
secondaryContent && 'usx-hero--split',
|
|
38
66
|
className,
|
|
39
67
|
].filter(Boolean).join(' ');
|
|
40
68
|
|
|
41
|
-
const
|
|
42
|
-
? { backgroundImage: `url('${backgroundImage}')` }
|
|
43
|
-
:
|
|
69
|
+
const heroStyle: React.CSSProperties & { '--hero-overlay-opacity'?: number } = {
|
|
70
|
+
...(backgroundImage ? { backgroundImage: `url('${backgroundImage}')` } : {}),
|
|
71
|
+
...(backgroundPosition ? { backgroundPosition } : {}),
|
|
72
|
+
...(overlayOpacity !== undefined ? { '--hero-overlay-opacity': Math.min(1, Math.max(0, overlayOpacity)) } : {}),
|
|
73
|
+
...style,
|
|
74
|
+
};
|
|
44
75
|
|
|
45
76
|
return (
|
|
46
|
-
<section className={classes} aria-label={ariaLabel} style={
|
|
77
|
+
<section className={classes} aria-label={ariaLabel} style={heroStyle} {...props}>
|
|
47
78
|
<div className="usx-hero__inner">
|
|
48
|
-
<div className="usx-hero__callout">
|
|
49
|
-
<
|
|
79
|
+
<div className="usx-hero__callout" style={calloutMaxWidth ? { maxWidth: calloutMaxWidth } : undefined}>
|
|
80
|
+
<Heading className="usx-hero__heading">
|
|
50
81
|
{callout && <span className="usx-hero__heading--alt">{callout}</span>}
|
|
51
82
|
{title}
|
|
52
|
-
</
|
|
83
|
+
</Heading>
|
|
53
84
|
{paragraph && <p className="usx-hero__paragraph">{paragraph}</p>}
|
|
54
85
|
{searchProps && <Search {...searchProps} />}
|
|
55
86
|
{!searchProps && button && (
|
|
@@ -58,6 +89,17 @@ export default function Hero({
|
|
|
58
89
|
</Button>
|
|
59
90
|
)}
|
|
60
91
|
</div>
|
|
92
|
+
{secondaryContent && (
|
|
93
|
+
<div className="usx-hero__secondary">
|
|
94
|
+
{secondaryContent.title && <SecondaryHeading className="usx-hero__secondary-heading">{secondaryContent.title}</SecondaryHeading>}
|
|
95
|
+
{secondaryContent.paragraph && <p className="usx-hero__paragraph">{secondaryContent.paragraph}</p>}
|
|
96
|
+
{secondaryContent.link && (
|
|
97
|
+
<a className="usx-hero__secondary-link" href={secondaryContent.link.href}>
|
|
98
|
+
{secondaryContent.link.text}
|
|
99
|
+
</a>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
61
103
|
</div>
|
|
62
104
|
</section>
|
|
63
105
|
);
|
|
@@ -53,11 +53,56 @@
|
|
|
53
53
|
"type": "string",
|
|
54
54
|
"description": "URL of the background image applied via inline style"
|
|
55
55
|
},
|
|
56
|
+
"contentPosition": {
|
|
57
|
+
"type": "select",
|
|
58
|
+
"options": ["left", "center", "right"],
|
|
59
|
+
"default": "left",
|
|
60
|
+
"description": "Main content position. Secondary content sits opposite on desktop for left/right layouts, and below for centered or mobile layouts. Reading order always starts with the main content."
|
|
61
|
+
},
|
|
62
|
+
"calloutMaxWidth": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"description": "Optional CSS maximum width for the main callout, such as 28rem or 50%. Overrides the theme width for this Hero only; omit to keep the theme default. Remains constrained by the available container width. Does not change split-layout column proportions."
|
|
65
|
+
},
|
|
66
|
+
"boxed": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"default": true,
|
|
69
|
+
"description": "Show the padded callout background. Disable for unboxed content directly over the hero background; ensure sufficient text contrast. Independent of overlay."
|
|
70
|
+
},
|
|
71
|
+
"backgroundPosition": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "CSS background position for the image focal point, such as center, right center, or 70% 40%. Defaults to the stylesheet setting."
|
|
74
|
+
},
|
|
75
|
+
"headingLevel": {
|
|
76
|
+
"type": "select",
|
|
77
|
+
"options": ["h1", "h2", "h3", "h4", "h5"],
|
|
78
|
+
"default": "h1",
|
|
79
|
+
"description": "Main heading element, independent of visual size. Secondary content uses the next heading level."
|
|
80
|
+
},
|
|
81
|
+
"secondaryContent": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"description": "Optional unboxed supporting content: title, paragraph, and link. Stacks after the main content on mobile; use overlay or a suitable background for readable contrast.",
|
|
84
|
+
"properties": {
|
|
85
|
+
"title": { "type": "string", "description": "Supporting heading" },
|
|
86
|
+
"paragraph": { "type": "string", "description": "Supporting description" },
|
|
87
|
+
"link": {
|
|
88
|
+
"type": "object",
|
|
89
|
+
"description": "Optional secondary text link",
|
|
90
|
+
"properties": {
|
|
91
|
+
"href": { "type": "string", "description": "Destination URL" },
|
|
92
|
+
"text": { "type": "string", "description": "Link text" }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
56
97
|
"overlay": {
|
|
57
98
|
"type": "boolean",
|
|
58
99
|
"default": true,
|
|
59
100
|
"description": "When true, adds a semi-transparent dark overlay over the background image to improve text legibility"
|
|
60
101
|
},
|
|
102
|
+
"overlayOpacity": {
|
|
103
|
+
"type": "number",
|
|
104
|
+
"description": "Optional black overlay opacity from 0 (transparent) to 1 (opaque), clamped to that range. Overrides the theme overlay color when set. Has no effect when overlay is false; omit to preserve the theme setting."
|
|
105
|
+
},
|
|
61
106
|
"ariaLabel": {
|
|
62
107
|
"type": "string",
|
|
63
108
|
"description": "Accessible label for the section element (defaults to 'Introduction')"
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{# Django template for Hero #}
|
|
2
2
|
{% load components %}
|
|
3
3
|
<section
|
|
4
|
-
class="usx-hero{% if overlay != False %} usx-hero--has-overlay{% endif %}{% if className %} {{ className }}{% endif %}"
|
|
4
|
+
class="usx-hero{% if overlay != False %} usx-hero--has-overlay{% endif %}{% if overlayOpacity or overlayOpacity == 0 %} usx-hero--custom-overlay{% endif %}{% if contentPosition == 'right' %} usx-hero--content-right{% elif contentPosition == 'center' %} usx-hero--content-center{% endif %}{% if boxed == False %} usx-hero--unboxed{% endif %}{% if secondaryContent %} usx-hero--split{% endif %}{% if className %} {{ className }}{% endif %}"
|
|
5
5
|
aria-label="{% if ariaLabel %}{{ ariaLabel }}{% else %}Introduction{% endif %}"
|
|
6
|
-
{% if backgroundImage %}style="background-image: url('{{ backgroundImage }}')"{% endif %}
|
|
6
|
+
{% if backgroundImage or backgroundPosition or overlayOpacity or overlayOpacity == 0 %}style="{% if backgroundImage %}background-image: url('{{ backgroundImage }}');{% endif %}{% if backgroundPosition %}background-position: {{ backgroundPosition }};{% endif %}{% if overlayOpacity or overlayOpacity == 0 %}--hero-overlay-opacity: {{ overlayOpacity }};{% endif %}"{% endif %}
|
|
7
7
|
>
|
|
8
8
|
<div class="usx-hero__inner">
|
|
9
|
-
<div class="usx-hero__callout">
|
|
10
|
-
<h1 class="usx-hero__heading">
|
|
9
|
+
<div class="usx-hero__callout"{% if calloutMaxWidth %} style="max-width: {{ calloutMaxWidth }};"{% endif %}>
|
|
10
|
+
{% if headingLevel == 'h2' %}<h2 class="usx-hero__heading">{% elif headingLevel == 'h3' %}<h3 class="usx-hero__heading">{% elif headingLevel == 'h4' %}<h4 class="usx-hero__heading">{% elif headingLevel == 'h5' %}<h5 class="usx-hero__heading">{% else %}<h1 class="usx-hero__heading">{% endif %}
|
|
11
11
|
{% if callout %}<span class="usx-hero__heading--alt">{{ callout }}</span>{% endif %}
|
|
12
12
|
{{ title }}
|
|
13
|
-
</h1>
|
|
13
|
+
{% if headingLevel == 'h2' %}</h2>{% elif headingLevel == 'h3' %}</h3>{% elif headingLevel == 'h4' %}</h4>{% elif headingLevel == 'h5' %}</h5>{% else %}</h1>{% endif %}
|
|
14
14
|
{% if paragraph %}<p class="usx-hero__paragraph">{{ paragraph }}</p>{% endif %}
|
|
15
15
|
{% if searchProps %}
|
|
16
16
|
{% 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 %}
|
|
@@ -18,5 +18,16 @@
|
|
|
18
18
|
{% button variant="primary" href=button.href %}{{ button.text }}{% endbutton %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
</div>
|
|
21
|
+
{% if secondaryContent %}
|
|
22
|
+
<div class="usx-hero__secondary">
|
|
23
|
+
{% if secondaryContent.title %}
|
|
24
|
+
{% if headingLevel == 'h2' %}<h3 class="usx-hero__secondary-heading">{% elif headingLevel == 'h3' %}<h4 class="usx-hero__secondary-heading">{% elif headingLevel == 'h4' %}<h5 class="usx-hero__secondary-heading">{% elif headingLevel == 'h5' %}<h6 class="usx-hero__secondary-heading">{% else %}<h2 class="usx-hero__secondary-heading">{% endif %}
|
|
25
|
+
{{ secondaryContent.title }}
|
|
26
|
+
{% if headingLevel == 'h2' %}</h3>{% elif headingLevel == 'h3' %}</h4>{% elif headingLevel == 'h4' %}</h5>{% elif headingLevel == 'h5' %}</h6>{% else %}</h2>{% endif %}
|
|
27
|
+
{% endif %}
|
|
28
|
+
{% if secondaryContent.paragraph %}<p class="usx-hero__paragraph">{{ secondaryContent.paragraph }}</p>{% endif %}
|
|
29
|
+
{% if secondaryContent.link %}<a class="usx-hero__secondary-link" href="{{ secondaryContent.link.href }}">{{ secondaryContent.link.text }}</a>{% endif %}
|
|
30
|
+
</div>
|
|
31
|
+
{% endif %}
|
|
21
32
|
</div>
|
|
22
33
|
</section>
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
<h3 class="site-preview-heading">Right-side content with supporting information</h3>
|
|
2
|
+
<section class="usx-hero usx-hero--has-overlay usx-hero--custom-overlay usx-hero--content-right usx-hero--unboxed usx-hero--split" aria-label="Public services" style="background-image: url('https://designsystem.digital.gov/img/introducing-uswds-2-0/built-to-grow--alt.jpg'); background-position: left center; --hero-overlay-opacity: 0.8;">
|
|
3
|
+
<div class="usx-hero__inner">
|
|
4
|
+
<div class="usx-hero__callout">
|
|
5
|
+
<h1 class="usx-hero__heading">
|
|
6
|
+
<span class="usx-hero__heading--alt">Your community</span>
|
|
7
|
+
Public services
|
|
8
|
+
</h1>
|
|
9
|
+
<p class="usx-hero__paragraph">Find the services and information you need, all in one place.</p>
|
|
10
|
+
<a class="usa-button usx-button usa-button--primary" href="#services">Explore services</a>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="usx-hero__secondary">
|
|
13
|
+
<h2 class="usx-hero__secondary-heading">Need a hand?</h2>
|
|
14
|
+
<p class="usx-hero__paragraph">Our team can help you find the right service or answer questions about your application.</p>
|
|
15
|
+
<a class="usx-hero__secondary-link" href="#contact">Contact our team</a>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</section>
|
|
19
|
+
|
|
1
20
|
<h3 class="site-preview-heading">With search</h3>
|
|
2
21
|
<section class="usx-hero usx-hero--has-overlay" aria-label="Introduction" style="background-image: url('https://designsystem.digital.gov/img/introducing-uswds-2-0/built-to-grow--alt.jpg')">
|
|
3
22
|
<div class="usx-hero__inner">
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
|
|
4
|
-
const shapeClassMap = {
|
|
5
|
-
circle: 'usx-circle',
|
|
6
|
-
'rounded-sm': 'usx-rounded-sm',
|
|
7
|
-
'rounded-md': 'usx-rounded-md',
|
|
8
|
-
'rounded-lg': 'usx-rounded-lg',
|
|
9
|
-
'rounded-xl': 'usx-rounded-xl',
|
|
10
|
-
};
|
|
3
|
+
import Avatar, { AvatarProps } from '../avatar/Avatar';
|
|
11
4
|
|
|
12
5
|
interface Agency {
|
|
13
6
|
name: string;
|
|
14
7
|
href?: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
interface Logo {
|
|
18
|
-
href?: string;
|
|
19
|
-
src: string;
|
|
20
|
-
alt: string;
|
|
21
|
-
shape?: null | 'circle' | 'rounded-sm' | 'rounded-md' | 'rounded-lg' | 'rounded-xl';
|
|
22
|
-
imageClassName?: string;
|
|
8
|
+
/** Whether "the" precedes the name in the English disclaimer, e.g. "the Department of...". Default true. */
|
|
9
|
+
useThe?: boolean;
|
|
23
10
|
}
|
|
24
11
|
|
|
25
12
|
interface RequiredLink {
|
|
@@ -33,8 +20,8 @@ export interface IdentifierProps {
|
|
|
33
20
|
domain?: string;
|
|
34
21
|
language?: 'en' | 'es';
|
|
35
22
|
parentAgencies?: Agency[];
|
|
36
|
-
|
|
37
|
-
logoShape?:
|
|
23
|
+
avatarProps?: AvatarProps[];
|
|
24
|
+
logoShape?: AvatarProps['shape'];
|
|
38
25
|
requiredLinks?: RequiredLinks;
|
|
39
26
|
taxpayerDisclaimer?: boolean;
|
|
40
27
|
overlapAvatars?: boolean;
|
|
@@ -95,13 +82,17 @@ function renderDisclaimer({ language, parentAgencies, taxpayerDisclaimer }: { la
|
|
|
95
82
|
}
|
|
96
83
|
return (
|
|
97
84
|
<>
|
|
98
|
-
<span aria-hidden="true">An </span>official website of
|
|
99
|
-
{parentAgencies.map((agency, index) =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
85
|
+
<span aria-hidden="true">An </span>official website of{' '}
|
|
86
|
+
{parentAgencies.map((agency, index) => {
|
|
87
|
+
const isLast = index === parentAgencies.length - 1;
|
|
88
|
+
const prefix = index === 0 ? '' : isLast ? ' and ' : ', ';
|
|
89
|
+
const article = agency.useThe === false ? '' : 'the ';
|
|
90
|
+
return (
|
|
91
|
+
<React.Fragment key={`${agency.name}-${index}`}>
|
|
92
|
+
{prefix}{article}<a href={agency.href || ''}>{agency.name}</a>
|
|
93
|
+
</React.Fragment>
|
|
94
|
+
);
|
|
95
|
+
})}
|
|
105
96
|
{taxpayerDisclaimer ? '. Produced and published at taxpayer expense.' : ''}
|
|
106
97
|
</>
|
|
107
98
|
);
|
|
@@ -111,7 +102,7 @@ export default function Identifier({
|
|
|
111
102
|
domain = 'domain.gov',
|
|
112
103
|
language = 'en',
|
|
113
104
|
parentAgencies = [],
|
|
114
|
-
|
|
105
|
+
avatarProps = [],
|
|
115
106
|
logoShape = null,
|
|
116
107
|
requiredLinks,
|
|
117
108
|
taxpayerDisclaimer = false,
|
|
@@ -133,7 +124,7 @@ export default function Identifier({
|
|
|
133
124
|
<div className={classes}>
|
|
134
125
|
<section className="usa-identifier__section usa-identifier__section--masthead" aria-label={labels.masthead}>
|
|
135
126
|
<div className="usa-identifier__container">
|
|
136
|
-
{
|
|
127
|
+
{avatarProps.length > 0 ? (
|
|
137
128
|
<div
|
|
138
129
|
className={classNames(
|
|
139
130
|
'usa-identifier__logos',
|
|
@@ -141,19 +132,14 @@ export default function Identifier({
|
|
|
141
132
|
overlapAvatars && 'usa-avatar-group--overlap',
|
|
142
133
|
)}
|
|
143
134
|
>
|
|
144
|
-
{
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
src={logo.src}
|
|
153
|
-
alt={logo.alt}
|
|
154
|
-
role="img"
|
|
155
|
-
/>
|
|
156
|
-
</a>
|
|
135
|
+
{avatarProps.map((avatar, index) => (
|
|
136
|
+
<Avatar
|
|
137
|
+
{...avatar}
|
|
138
|
+
key={`${avatar.alt}-${index}`}
|
|
139
|
+
shape={avatar.shape || logoShape}
|
|
140
|
+
className={classNames('usa-identifier__logo', avatar.className)}
|
|
141
|
+
imageClassName={classNames('usa-identifier__logo-img', avatar.imageClassName)}
|
|
142
|
+
/>
|
|
157
143
|
))}
|
|
158
144
|
</div>
|
|
159
145
|
) : null}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"href": ""
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"
|
|
14
|
+
"avatarProps": [
|
|
15
15
|
{
|
|
16
16
|
"href": "",
|
|
17
17
|
"src": "./lady_liberty.png",
|
|
@@ -72,18 +72,18 @@
|
|
|
72
72
|
"description": "Parent agency.",
|
|
73
73
|
"properties": {
|
|
74
74
|
"name": { "type": "string", "description": "Agency name." },
|
|
75
|
-
"href": { "type": "string", "description": "Link to the agency's site." }
|
|
75
|
+
"href": { "type": "string", "description": "Link to the agency's site." },
|
|
76
|
+
"useThe": { "type": "boolean", "description": "Whether \"the\" precedes the name in the English disclaimer, e.g. \"the Department of...\". Default true. Has no effect on the Spanish disclaimer." }
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
},
|
|
79
|
-
"
|
|
80
|
+
"avatarProps": {
|
|
80
81
|
"type": "array",
|
|
81
|
-
"description": "
|
|
82
|
+
"description": "Props for Avatar components rendered in the identifier masthead.",
|
|
82
83
|
"items": {
|
|
83
84
|
"type": "object",
|
|
84
|
-
"description": "
|
|
85
|
+
"description": "Avatar props, including image, initials, and icon variants.",
|
|
85
86
|
"component": "avatar",
|
|
86
|
-
"omit": ["variant", "value", "tooltip", "className", "contentClassName"],
|
|
87
87
|
"properties": {
|
|
88
88
|
"shape": {
|
|
89
89
|
"type": "select",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{# Django template for Identifier #}
|
|
2
|
+
{% load components %}
|
|
2
3
|
|
|
3
4
|
<div class="usa-identifier usx-identifier{% if className %} {{ className }}{% endif %}">
|
|
4
5
|
<section
|
|
@@ -6,17 +7,12 @@
|
|
|
6
7
|
aria-label="{% if language == 'es' %}Identificador de la agencia,{% else %}Agency identifier,{% endif %}"
|
|
7
8
|
>
|
|
8
9
|
<div class="usa-identifier__container">
|
|
9
|
-
{% if
|
|
10
|
+
{% if avatarProps %}
|
|
10
11
|
<div class="usa-identifier__logos usx-avatar-group{% if overlapAvatars %} usa-avatar-group--overlap{% endif %}">
|
|
11
|
-
{% for
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
src="{{ logo.src }}"
|
|
16
|
-
alt="{{ logo.alt }}"
|
|
17
|
-
role="img"
|
|
18
|
-
/>
|
|
19
|
-
</a>
|
|
12
|
+
{% for item in avatarProps %}
|
|
13
|
+
{% with avatarClass=item.className|default:'' imageClass=item.imageClassName|default:'' defaultShape=logoShape|default:'' %}
|
|
14
|
+
{% avatar href=item.href src=item.src alt=item.alt variant=item.variant|default:'image' value=item.value shape=item.shape|default:defaultShape tooltip=item.tooltip className='usa-identifier__logo '|add:avatarClass imageClassName='usa-identifier__logo-img '|add:imageClass contentClassName=item.contentClassName %}{% endavatar %}
|
|
15
|
+
{% endwith %}
|
|
20
16
|
{% endfor %}
|
|
21
17
|
</div>
|
|
22
18
|
{% endif %}
|
|
@@ -35,10 +31,10 @@
|
|
|
35
31
|
{% endfor %}
|
|
36
32
|
{% if taxpayerDisclaimer %} . Producido y publicado con dinero de los contribuyentes de impuestos.{% endif %}
|
|
37
33
|
{% else %}
|
|
38
|
-
<span aria-hidden="true">An </span>official website of
|
|
34
|
+
<span aria-hidden="true">An </span>official website of
|
|
39
35
|
{% for agency in parentAgencies %}
|
|
40
|
-
{% if not forloop.first %}{% if forloop.last %} and
|
|
41
|
-
<a href="{{ agency.href|default:'' }}">{{ agency.name }}</a>
|
|
36
|
+
{% if not forloop.first %}{% if forloop.last %} and{% else %},{% endif %}{% endif %}
|
|
37
|
+
{% if agency.useThe|default_bool:True %} the{% endif %} <a href="{{ agency.href|default:'' }}">{{ agency.name }}</a>
|
|
42
38
|
{% endfor %}
|
|
43
39
|
{% if taxpayerDisclaimer %} . Produced and published at taxpayer expense.{% endif %}
|
|
44
40
|
{% endif %}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<div class="usa-identifier__logos usx-avatar-group">
|
|
10
10
|
<a href="" class="usa-identifier__logo usx-avatar"
|
|
11
11
|
><img
|
|
12
|
-
class="usa-identifier__logo-img"
|
|
12
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
13
13
|
src="./lady_liberty.png"
|
|
14
14
|
alt="Statue of Liberty"
|
|
15
15
|
role="img"
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
<div class="usa-identifier__logos usx-avatar-group">
|
|
100
100
|
<a href="javascript:void(0)" class="usa-identifier__logo usx-avatar"
|
|
101
101
|
><img
|
|
102
|
-
class="usa-identifier__logo-img"
|
|
102
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
103
103
|
src="./lady_liberty.png"
|
|
104
104
|
alt="Statue of Liberty"
|
|
105
105
|
role="img"
|
|
@@ -190,14 +190,14 @@
|
|
|
190
190
|
<div class="usa-identifier__logos usx-avatar-group">
|
|
191
191
|
<a href="javascript:void(0)" class="usa-identifier__logo usx-avatar"
|
|
192
192
|
><img
|
|
193
|
-
class="usa-identifier__logo-img"
|
|
193
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
194
194
|
src="./george_washington.png"
|
|
195
195
|
alt="George Washington"
|
|
196
196
|
role="img"
|
|
197
197
|
/> </a
|
|
198
198
|
><a href="javascript:void(0);" class="usa-identifier__logo usx-avatar"
|
|
199
199
|
><img
|
|
200
|
-
class="usa-identifier__logo-img"
|
|
200
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
201
201
|
src="./thomas_jefferson.png"
|
|
202
202
|
alt="Thomas Jefferson"
|
|
203
203
|
role="img"
|
|
@@ -288,14 +288,14 @@
|
|
|
288
288
|
<div class="usa-identifier__logos usx-avatar-group">
|
|
289
289
|
<a href="javascript:void(0)" class="usa-identifier__logo usx-avatar"
|
|
290
290
|
><img
|
|
291
|
-
class="usa-identifier__logo-img"
|
|
291
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
292
292
|
src="./george_washington.png"
|
|
293
293
|
alt="George Washington"
|
|
294
294
|
role="img"
|
|
295
295
|
/> </a
|
|
296
296
|
><a href="javascript:void(0);" class="usa-identifier__logo usx-avatar"
|
|
297
297
|
><img
|
|
298
|
-
class="usa-identifier__logo-img"
|
|
298
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
299
299
|
src="./thomas_jefferson.png"
|
|
300
300
|
alt="Thomas Jefferson"
|
|
301
301
|
role="img"
|
|
@@ -387,14 +387,14 @@
|
|
|
387
387
|
<div class="usa-identifier__logos usx-avatar-group usa-avatar-group--overlap">
|
|
388
388
|
<a href="javascript:void(0)" class="usa-identifier__logo usx-avatar"
|
|
389
389
|
><img
|
|
390
|
-
class="usa-identifier__logo-img usx-circle"
|
|
390
|
+
class="usx-avatar__img usa-identifier__logo-img usx-circle"
|
|
391
391
|
src="./george_washington.png"
|
|
392
392
|
alt="George Washington"
|
|
393
393
|
role="img"
|
|
394
394
|
/> </a
|
|
395
395
|
><a href="javascript:void(0);" class="usa-identifier__logo usx-avatar"
|
|
396
396
|
><img
|
|
397
|
-
class="usa-identifier__logo-img usx-circle"
|
|
397
|
+
class="usx-avatar__img usa-identifier__logo-img usx-circle"
|
|
398
398
|
src="./thomas_jefferson.png"
|
|
399
399
|
alt="Thomas Jefferson"
|
|
400
400
|
role="img"
|
|
@@ -566,7 +566,7 @@
|
|
|
566
566
|
<div class="usa-identifier__logos usx-avatar-group">
|
|
567
567
|
<a href="javascript:void(0)" class="usa-identifier__logo usx-avatar"
|
|
568
568
|
><img
|
|
569
|
-
class="usa-identifier__logo-img"
|
|
569
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
570
570
|
src="./lady_liberty.png"
|
|
571
571
|
alt="Statue of Liberty"
|
|
572
572
|
role="img"
|
|
@@ -657,7 +657,7 @@
|
|
|
657
657
|
<div class="usa-identifier__logos usx-avatar-group">
|
|
658
658
|
<a href="javascript:void(0)" class="usa-identifier__logo usx-avatar"
|
|
659
659
|
><img
|
|
660
|
-
class="usa-identifier__logo-img"
|
|
660
|
+
class="usx-avatar__img usa-identifier__logo-img"
|
|
661
661
|
src="./lady_liberty.png"
|
|
662
662
|
alt="Statue of Liberty"
|
|
663
663
|
role="img"
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
+
export interface InPageNavProps extends React.HTMLAttributes<HTMLElement> {
|
|
6
|
+
headingElements?: string;
|
|
7
|
+
mainContentSelector?: string | null;
|
|
8
|
+
titleHeadingLevel?: string;
|
|
9
|
+
titleText?: string;
|
|
10
|
+
scrollOffset?: string | number;
|
|
11
|
+
rootMargin?: string;
|
|
12
|
+
threshold?: string | number;
|
|
13
|
+
minimumHeadingCount?: string | number;
|
|
14
|
+
contentClassName?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
5
17
|
// USWDS's own JS (usa-in-page-navigation) builds the <nav>/<ul> list into
|
|
6
18
|
// the empty <aside> below by reading headings out of the element matched by
|
|
7
19
|
// data-main-content-selector — it does not render anything itself. Call ONLY
|
|
@@ -23,7 +35,7 @@ export default function InPageNav({
|
|
|
23
35
|
className = '',
|
|
24
36
|
contentClassName = '',
|
|
25
37
|
...props
|
|
26
|
-
}) {
|
|
38
|
+
}: InPageNavProps) {
|
|
27
39
|
const contentId = `${id}-content`;
|
|
28
40
|
// Real USWDS points data-main-content-selector at a real <main> landmark,
|
|
29
41
|
// but that only works for a single instance per page — Storybook (and any
|
|
@@ -58,19 +70,3 @@ export default function InPageNav({
|
|
|
58
70
|
</div>
|
|
59
71
|
);
|
|
60
72
|
}
|
|
61
|
-
|
|
62
|
-
InPageNav.propTypes = {
|
|
63
|
-
id: PropTypes.string,
|
|
64
|
-
headingElements: PropTypes.string,
|
|
65
|
-
mainContentSelector: PropTypes.string,
|
|
66
|
-
titleHeadingLevel: PropTypes.string,
|
|
67
|
-
titleText: PropTypes.string,
|
|
68
|
-
scrollOffset: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
69
|
-
rootMargin: PropTypes.string,
|
|
70
|
-
threshold: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
71
|
-
minimumHeadingCount: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
72
|
-
content: PropTypes.string,
|
|
73
|
-
children: PropTypes.node,
|
|
74
|
-
className: PropTypes.string,
|
|
75
|
-
contentClassName: PropTypes.string,
|
|
76
|
-
};
|