@solexllc/usx-react 0.10.0 → 0.11.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.
- package/dist/index.cjs +123 -66
- package/dist/index.js +123 -66
- package/package.json +4 -4
- package/src/components/code/code.django-snapshot.html +4 -6
- package/src/components/code/code.html +2 -2
- package/src/components/code/code.react-snapshot.html +2 -4
- package/src/components/header/header.django-snapshot.html +5 -7
- package/src/components/header/header.html +1 -11
- package/src/components/header/header.react-snapshot.html +3 -6
- package/src/components/icon-list/IconList.tsx +10 -2
- package/src/components/icon-list/config.json +5 -1
- package/src/components/icon-list/icon-list.django-snapshot.html +39 -0
- package/src/components/icon-list/icon-list.django.html +2 -0
- package/src/components/icon-list/icon-list.react-snapshot.html +31 -0
- package/src/components/list/List.tsx +10 -2
- package/src/components/list/config.json +5 -1
- package/src/components/list/list.django-snapshot.html +26 -0
- package/src/components/list/list.django.html +2 -0
- package/src/components/list/list.html +20 -0
- package/src/components/list/list.react-snapshot.html +20 -0
- package/src/components/page/Page.tsx +16 -0
- package/src/components/page/config.json +18 -1
- package/src/components/page/page.django-snapshot.html +74 -0
- package/src/components/page/page.django.html +8 -0
- package/src/components/page/page.html +60 -0
- package/src/components/page/page.react-snapshot.html +60 -0
- package/src/components/theme-picker/ThemePicker.tsx +95 -52
- package/src/components/theme-picker/config.json +7 -4
- package/src/components/theme-picker/theme-picker-select.django.html +7 -0
- package/src/components/theme-picker/theme-picker.django-snapshot.html +101 -21
- package/src/components/theme-picker/theme-picker.django.html +22 -24
- package/src/components/theme-picker/theme-picker.html +86 -56
- package/src/components/theme-picker/theme-picker.react-snapshot.html +74 -18
|
@@ -3378,25 +3378,23 @@
|
|
|
3378
3378
|
aria-controls="django-theme-picker-panel"
|
|
3379
3379
|
>
|
|
3380
3380
|
<svg
|
|
3381
|
-
class="usa-icon usx-theme-picker__icon"
|
|
3381
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
3382
3382
|
aria-hidden="true"
|
|
3383
3383
|
focusable="false"
|
|
3384
|
-
|
|
3384
|
+
role="img"
|
|
3385
3385
|
>
|
|
3386
|
-
<
|
|
3387
|
-
fill="currentColor"
|
|
3388
|
-
d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"
|
|
3389
|
-
/>
|
|
3386
|
+
<use href="img/usx-sprite.svg#color_palette"></use>
|
|
3390
3387
|
</svg>
|
|
3391
3388
|
</button>
|
|
3392
3389
|
<div id="django-theme-picker-panel" class="usx-theme-picker__panel">
|
|
3393
3390
|
<label class="usa-label usx-label usa-sr-only" for="django-theme-picker"> Theme </label>
|
|
3394
3391
|
|
|
3395
|
-
<select class="usa-select usx-select"
|
|
3392
|
+
<select id="django-theme-picker" class="usa-select usx-select">
|
|
3396
3393
|
<option value="Aurora" selected>Light</option>
|
|
3397
3394
|
|
|
3398
3395
|
<option value="Borealis">Dark</option>
|
|
3399
3396
|
</select>
|
|
3397
|
+
|
|
3400
3398
|
<button
|
|
3401
3399
|
type="button"
|
|
3402
3400
|
class="usa-button usx-button usa-button--primary usx-theme-picker__toggle"
|
|
@@ -2767,17 +2767,7 @@
|
|
|
2767
2767
|
class="usa-button usx-button usx-button--ghost text-muted usx-theme-picker__trigger"
|
|
2768
2768
|
aria-label="Theme"
|
|
2769
2769
|
>
|
|
2770
|
-
<svg
|
|
2771
|
-
class="usa-icon usx-theme-picker__icon"
|
|
2772
|
-
aria-hidden="true"
|
|
2773
|
-
focusable="false"
|
|
2774
|
-
viewBox="0 0 24 24"
|
|
2775
|
-
>
|
|
2776
|
-
<path
|
|
2777
|
-
fill="currentColor"
|
|
2778
|
-
d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"
|
|
2779
|
-
></path>
|
|
2780
|
-
</svg>
|
|
2770
|
+
<svg class="usa-icon usx-icon usx-theme-picker__icon" aria-hidden="true" focusable="false" role="img"><use href="./img/usx-sprite.svg#color_palette"></use></svg>
|
|
2781
2771
|
</button>
|
|
2782
2772
|
</div>
|
|
2783
2773
|
</div>
|
|
@@ -2657,15 +2657,12 @@
|
|
|
2657
2657
|
aria-controls="react-theme-picker-panel"
|
|
2658
2658
|
>
|
|
2659
2659
|
<svg
|
|
2660
|
-
class="usa-icon usx-theme-picker__icon"
|
|
2660
|
+
class="usa-icon usx-icon usx-theme-picker__icon"
|
|
2661
2661
|
aria-hidden="true"
|
|
2662
2662
|
focusable="false"
|
|
2663
|
-
|
|
2663
|
+
role="img"
|
|
2664
2664
|
>
|
|
2665
|
-
<
|
|
2666
|
-
fill="currentColor"
|
|
2667
|
-
d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9c.83 0 1.5-.67 1.5-1.5 0-.39-.15-.74-.39-1.01-.23-.26-.38-.61-.38-.99 0-.83.67-1.5 1.5-1.5H16c2.76 0 5-2.24 5-5 0-4.42-4.03-8-9-8zm-5.5 9c-.83 0-1.5-.67-1.5-1.5S5.67 9 6.5 9 8 9.67 8 10.5 7.33 12 6.5 12zm3-4C8.67 8 8 7.33 8 6.5S8.67 5 9.5 5s1.5.67 1.5 1.5S10.33 8 9.5 8zm5 0c-.83 0-1.5-.67-1.5-1.5S13.67 5 14.5 5s1.5.67 1.5 1.5S15.33 8 14.5 8zm3 4c-.83 0-1.5-.67-1.5-1.5S16.67 9 17.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"
|
|
2668
|
-
></path>
|
|
2665
|
+
<use href="/img/usx-sprite.svg#color_palette"></use>
|
|
2669
2666
|
</svg>
|
|
2670
2667
|
</button>
|
|
2671
2668
|
<div id="react-theme-picker-panel" class="usx-theme-picker__panel">
|
|
@@ -15,6 +15,7 @@ export interface IconListItem {
|
|
|
15
15
|
|
|
16
16
|
export interface IconListProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
17
17
|
items?: IconListItem[];
|
|
18
|
+
caption?: string;
|
|
18
19
|
primary?: boolean;
|
|
19
20
|
size?: null | 'lg';
|
|
20
21
|
className?: string;
|
|
@@ -27,7 +28,7 @@ function renderContent(content: string | React.ReactNode) {
|
|
|
27
28
|
return content;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
export default function IconList({ items = [], primary = false, size = null, className = '', ...props }: IconListProps) {
|
|
31
|
+
export default function IconList({ items = [], caption, primary = false, size = null, className = '', ...props }: IconListProps) {
|
|
31
32
|
const classes = ClassNames(
|
|
32
33
|
'usa-icon-list',
|
|
33
34
|
'usx-icon-list',
|
|
@@ -36,7 +37,7 @@ export default function IconList({ items = [], primary = false, size = null, cla
|
|
|
36
37
|
className,
|
|
37
38
|
);
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
const list = (
|
|
40
41
|
<ul className={classes} {...props}>
|
|
41
42
|
{items.map((item, index) => (
|
|
42
43
|
<li key={index} className={ClassNames('usa-icon-list__item', item.itemClassName)}>
|
|
@@ -56,4 +57,11 @@ export default function IconList({ items = [], primary = false, size = null, cla
|
|
|
56
57
|
))}
|
|
57
58
|
</ul>
|
|
58
59
|
);
|
|
60
|
+
|
|
61
|
+
return caption ? (
|
|
62
|
+
<figure className="usx-list-figure">
|
|
63
|
+
<figcaption className="usx-list-figure__caption">{caption}</figcaption>
|
|
64
|
+
{list}
|
|
65
|
+
</figure>
|
|
66
|
+
) : list;
|
|
59
67
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "icon-list",
|
|
3
3
|
"template": "icon-list/icon-list.django.html",
|
|
4
|
-
"version":
|
|
4
|
+
"version": 2,
|
|
5
5
|
"default": {
|
|
6
6
|
"items": [
|
|
7
7
|
{
|
|
@@ -64,6 +64,10 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
+
"caption": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Optional label rendered in a figcaption before the icon list. Wraps the list in a figure when provided."
|
|
70
|
+
},
|
|
67
71
|
"primary": {
|
|
68
72
|
"type": "boolean",
|
|
69
73
|
"default": false,
|
|
@@ -81,6 +81,45 @@
|
|
|
81
81
|
</li>
|
|
82
82
|
</ul>
|
|
83
83
|
|
|
84
|
+
<h3 class="site-preview-heading">Captioned</h3>
|
|
85
|
+
<figure class="usx-list-figure">
|
|
86
|
+
<figcaption class="usx-list-figure__caption">Health and safety guidance</figcaption>
|
|
87
|
+
<ul class="usa-icon-list usx-icon-list">
|
|
88
|
+
<li class="usa-icon-list__item">
|
|
89
|
+
<div class="usa-icon-list__icon text-green">
|
|
90
|
+
<svg class="usa-icon usx-icon text-green" aria-hidden="true" focusable="false" role="img">
|
|
91
|
+
<use href="img/sprite.svg#check_circle"></use>
|
|
92
|
+
</svg>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="usa-icon-list__content">
|
|
95
|
+
<div>Wash your hands for 20 seconds with soap</div>
|
|
96
|
+
</div>
|
|
97
|
+
</li>
|
|
98
|
+
|
|
99
|
+
<li class="usa-icon-list__item">
|
|
100
|
+
<div class="usa-icon-list__icon text-green">
|
|
101
|
+
<svg class="usa-icon usx-icon text-green" aria-hidden="true" focusable="false" role="img">
|
|
102
|
+
<use href="img/sprite.svg#check_circle"></use>
|
|
103
|
+
</svg>
|
|
104
|
+
</div>
|
|
105
|
+
<div class="usa-icon-list__content">
|
|
106
|
+
<div>Stay six feet away from others</div>
|
|
107
|
+
</div>
|
|
108
|
+
</li>
|
|
109
|
+
|
|
110
|
+
<li class="usa-icon-list__item">
|
|
111
|
+
<div class="usa-icon-list__icon text-red">
|
|
112
|
+
<svg class="usa-icon usx-icon text-red" aria-hidden="true" focusable="false" role="img">
|
|
113
|
+
<use href="img/sprite.svg#cancel"></use>
|
|
114
|
+
</svg>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="usa-icon-list__content">
|
|
117
|
+
<div>Avoid large gatherings</div>
|
|
118
|
+
</div>
|
|
119
|
+
</li>
|
|
120
|
+
</ul>
|
|
121
|
+
</figure>
|
|
122
|
+
|
|
84
123
|
<h3 class="site-preview-heading">Rich Content</h3>
|
|
85
124
|
<ul class="usa-icon-list usx-icon-list">
|
|
86
125
|
<li class="usa-icon-list__item">
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{% load usx_components %}
|
|
2
2
|
|
|
3
|
+
{% if caption %}<figure class="usx-list-figure"><figcaption class="usx-list-figure__caption">{{ caption }}</figcaption>{% endif %}
|
|
3
4
|
<ul class="usa-icon-list usx-icon-list{% if primary %} usa-icon-list--primary{% endif %}{% if size == 'lg' %} usa-icon-list--size-lg{% endif %}{% if className %} {{ className }}{% endif %}">
|
|
4
5
|
{% for item in items %}
|
|
5
6
|
<li class="usa-icon-list__item{% if item.itemClassName %} {{ item.itemClassName }}{% endif %}">
|
|
@@ -15,3 +16,4 @@
|
|
|
15
16
|
</li>
|
|
16
17
|
{% endfor %}
|
|
17
18
|
</ul>
|
|
19
|
+
{% if caption %}</figure>{% endif %}
|
|
@@ -64,6 +64,37 @@
|
|
|
64
64
|
</li>
|
|
65
65
|
</ul>
|
|
66
66
|
|
|
67
|
+
<h3 class="site-preview-heading">Captioned</h3>
|
|
68
|
+
<figure class="usx-list-figure">
|
|
69
|
+
<figcaption class="usx-list-figure__caption">Health and safety guidance</figcaption>
|
|
70
|
+
<ul class="usa-icon-list usx-icon-list">
|
|
71
|
+
<li class="usa-icon-list__item">
|
|
72
|
+
<div class="usa-icon-list__icon text-green">
|
|
73
|
+
<svg class="usa-icon usx-icon text-green" aria-hidden="true" focusable="false" role="img">
|
|
74
|
+
<use href="/img/sprite.svg#check_circle"></use>
|
|
75
|
+
</svg>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="usa-icon-list__content"><div>Wash your hands for 20 seconds with soap</div></div>
|
|
78
|
+
</li>
|
|
79
|
+
<li class="usa-icon-list__item">
|
|
80
|
+
<div class="usa-icon-list__icon text-green">
|
|
81
|
+
<svg class="usa-icon usx-icon text-green" aria-hidden="true" focusable="false" role="img">
|
|
82
|
+
<use href="/img/sprite.svg#check_circle"></use>
|
|
83
|
+
</svg>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="usa-icon-list__content"><div>Stay six feet away from others</div></div>
|
|
86
|
+
</li>
|
|
87
|
+
<li class="usa-icon-list__item">
|
|
88
|
+
<div class="usa-icon-list__icon text-red">
|
|
89
|
+
<svg class="usa-icon usx-icon text-red" aria-hidden="true" focusable="false" role="img">
|
|
90
|
+
<use href="/img/sprite.svg#cancel"></use>
|
|
91
|
+
</svg>
|
|
92
|
+
</div>
|
|
93
|
+
<div class="usa-icon-list__content"><div>Avoid large gatherings</div></div>
|
|
94
|
+
</li>
|
|
95
|
+
</ul>
|
|
96
|
+
</figure>
|
|
97
|
+
|
|
67
98
|
<h3 class="site-preview-heading">Rich Content</h3>
|
|
68
99
|
<ul class="usa-icon-list usx-icon-list">
|
|
69
100
|
<li class="usa-icon-list__item">
|
|
@@ -60,12 +60,13 @@ function renderItems(items: ListItem[] = [], parentOptions: { ordered?: boolean;
|
|
|
60
60
|
|
|
61
61
|
export interface ListProps extends HTMLAttributes<HTMLUListElement | HTMLOListElement> {
|
|
62
62
|
items?: ListItem[];
|
|
63
|
+
caption?: string;
|
|
63
64
|
ordered?: boolean;
|
|
64
65
|
unstyled?: boolean;
|
|
65
66
|
className?: string;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
export default function List({ items = [], ordered = false, unstyled = false, className = '', ...props }: ListProps) {
|
|
69
|
+
export default function List({ items = [], caption, ordered = false, unstyled = false, className = '', ...props }: ListProps) {
|
|
69
70
|
const classes = ClassNames(
|
|
70
71
|
'usa-list',
|
|
71
72
|
'usx-list',
|
|
@@ -74,9 +75,16 @@ export default function List({ items = [], ordered = false, unstyled = false, cl
|
|
|
74
75
|
);
|
|
75
76
|
const Tag = ordered ? 'ol' : 'ul';
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
const list = (
|
|
78
79
|
<Tag className={classes} {...props}>
|
|
79
80
|
{renderItems(items, { ordered, unstyled })}
|
|
80
81
|
</Tag>
|
|
81
82
|
);
|
|
83
|
+
|
|
84
|
+
return caption ? (
|
|
85
|
+
<figure className="usx-list-figure">
|
|
86
|
+
<figcaption className="usx-list-figure__caption">{caption}</figcaption>
|
|
87
|
+
{list}
|
|
88
|
+
</figure>
|
|
89
|
+
) : list;
|
|
82
90
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "list",
|
|
3
3
|
"template": "list/list.django.html",
|
|
4
|
-
"version":
|
|
4
|
+
"version": 2,
|
|
5
5
|
"default": {
|
|
6
6
|
"items": [
|
|
7
7
|
"List item",
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
"type": "object",
|
|
15
15
|
"description": "Array of list items. A string renders a simple item. Objects can include content and children for nested lists of any depth; optional ordered/unstyled/className customize nested lists."
|
|
16
16
|
},
|
|
17
|
+
"caption": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Optional label rendered in a figcaption before the list. Wraps the list in a figure when provided."
|
|
20
|
+
},
|
|
17
21
|
"ordered": {
|
|
18
22
|
"type": "boolean",
|
|
19
23
|
"default": false,
|
|
@@ -25,6 +25,32 @@
|
|
|
25
25
|
<li>List item</li>
|
|
26
26
|
</ul>
|
|
27
27
|
|
|
28
|
+
<h3 class="site-preview-heading">Captioned</h3>
|
|
29
|
+
<figure class="usx-list-figure">
|
|
30
|
+
<figcaption class="usx-list-figure__caption">Fruit</figcaption>
|
|
31
|
+
|
|
32
|
+
<ul class="usa-list usx-list">
|
|
33
|
+
<li>Apple</li>
|
|
34
|
+
|
|
35
|
+
<li>Pear</li>
|
|
36
|
+
|
|
37
|
+
<li>Orange</li>
|
|
38
|
+
</ul>
|
|
39
|
+
</figure>
|
|
40
|
+
|
|
41
|
+
<h3 class="site-preview-heading">Captioned Ordered</h3>
|
|
42
|
+
<figure class="usx-list-figure">
|
|
43
|
+
<figcaption class="usx-list-figure__caption">Application steps</figcaption>
|
|
44
|
+
|
|
45
|
+
<ol class="usa-list usx-list">
|
|
46
|
+
<li>Create an account</li>
|
|
47
|
+
|
|
48
|
+
<li>Complete the form</li>
|
|
49
|
+
|
|
50
|
+
<li>Submit your application</li>
|
|
51
|
+
</ol>
|
|
52
|
+
</figure>
|
|
53
|
+
|
|
28
54
|
<h3 class="site-preview-heading">Nested</h3>
|
|
29
55
|
<ul class="usa-list usx-list">
|
|
30
56
|
<li>Main point</li>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{% load usx_components %}
|
|
2
2
|
|
|
3
|
+
{% if caption %}<figure class="usx-list-figure"><figcaption class="usx-list-figure__caption">{{ caption }}</figcaption>{% endif %}
|
|
3
4
|
{% if ordered %}
|
|
4
5
|
<ol class="usa-list usx-list{% if unstyled %} usa-list--unstyled{% endif %}{% if className %} {{ className }}{% endif %}">
|
|
5
6
|
{% include "list/_list-items.django.html" with items=items ordered=ordered unstyled=unstyled only %}
|
|
@@ -9,3 +10,4 @@
|
|
|
9
10
|
{% include "list/_list-items.django.html" with items=items ordered=ordered unstyled=unstyled only %}
|
|
10
11
|
</ul>
|
|
11
12
|
{% endif %}
|
|
13
|
+
{% if caption %}</figure>{% endif %}
|
|
@@ -19,6 +19,26 @@
|
|
|
19
19
|
<li>List item</li>
|
|
20
20
|
</ul>
|
|
21
21
|
|
|
22
|
+
<h3 class="site-preview-heading">Captioned</h3>
|
|
23
|
+
<figure class="usx-list-figure">
|
|
24
|
+
<figcaption class="usx-list-figure__caption">Fruit</figcaption>
|
|
25
|
+
<ul class="usa-list usx-list">
|
|
26
|
+
<li>Apple</li>
|
|
27
|
+
<li>Pear</li>
|
|
28
|
+
<li>Orange</li>
|
|
29
|
+
</ul>
|
|
30
|
+
</figure>
|
|
31
|
+
|
|
32
|
+
<h3 class="site-preview-heading">Captioned Ordered</h3>
|
|
33
|
+
<figure class="usx-list-figure">
|
|
34
|
+
<figcaption class="usx-list-figure__caption">Application steps</figcaption>
|
|
35
|
+
<ol class="usa-list usx-list">
|
|
36
|
+
<li>Create an account</li>
|
|
37
|
+
<li>Complete the form</li>
|
|
38
|
+
<li>Submit your application</li>
|
|
39
|
+
</ol>
|
|
40
|
+
</figure>
|
|
41
|
+
|
|
22
42
|
<h3 class="site-preview-heading">Nested</h3>
|
|
23
43
|
<ul class="usa-list usx-list">
|
|
24
44
|
<li>Main point</li>
|
|
@@ -19,6 +19,26 @@
|
|
|
19
19
|
<li>List item</li>
|
|
20
20
|
</ul>
|
|
21
21
|
|
|
22
|
+
<h3 class="site-preview-heading">Captioned</h3>
|
|
23
|
+
<figure class="usx-list-figure">
|
|
24
|
+
<figcaption class="usx-list-figure__caption">Fruit</figcaption>
|
|
25
|
+
<ul class="usa-list usx-list">
|
|
26
|
+
<li>Apple</li>
|
|
27
|
+
<li>Pear</li>
|
|
28
|
+
<li>Orange</li>
|
|
29
|
+
</ul>
|
|
30
|
+
</figure>
|
|
31
|
+
|
|
32
|
+
<h3 class="site-preview-heading">Captioned Ordered</h3>
|
|
33
|
+
<figure class="usx-list-figure">
|
|
34
|
+
<figcaption class="usx-list-figure__caption">Application steps</figcaption>
|
|
35
|
+
<ol class="usa-list usx-list">
|
|
36
|
+
<li>Create an account</li>
|
|
37
|
+
<li>Complete the form</li>
|
|
38
|
+
<li>Submit your application</li>
|
|
39
|
+
</ol>
|
|
40
|
+
</figure>
|
|
41
|
+
|
|
22
42
|
<h3 class="site-preview-heading">Nested</h3>
|
|
23
43
|
<ul class="usa-list usx-list">
|
|
24
44
|
<li>Main point</li>
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ClassNames from 'classnames';
|
|
3
|
+
import TagGroup from '../tag-group/TagGroup';
|
|
4
|
+
import type { TagProps } from '../tag/Tag';
|
|
3
5
|
|
|
4
6
|
export interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title' | 'content'> {
|
|
5
7
|
title?: React.ReactNode;
|
|
6
8
|
titleId?: string;
|
|
7
9
|
eyebrow?: React.ReactNode;
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
tagProps?: TagProps[];
|
|
8
13
|
as?: 'main' | 'div' | 'section' | 'article';
|
|
9
14
|
content?: React.ReactNode;
|
|
10
15
|
tabIndex?: number;
|
|
@@ -16,6 +21,9 @@ export default function Page({
|
|
|
16
21
|
title = 'Page title',
|
|
17
22
|
titleId = undefined,
|
|
18
23
|
eyebrow = null,
|
|
24
|
+
subtitle = undefined,
|
|
25
|
+
description = undefined,
|
|
26
|
+
tagProps = undefined,
|
|
19
27
|
as: Element = 'main',
|
|
20
28
|
children = null,
|
|
21
29
|
content = null,
|
|
@@ -24,6 +32,7 @@ export default function Page({
|
|
|
24
32
|
className = '',
|
|
25
33
|
...props
|
|
26
34
|
}: PageProps) {
|
|
35
|
+
const hasSummary = Boolean(subtitle || description || tagProps?.length);
|
|
27
36
|
const classes = ClassNames('usx-page', className);
|
|
28
37
|
const pageContent = children || content;
|
|
29
38
|
|
|
@@ -41,6 +50,13 @@ export default function Page({
|
|
|
41
50
|
{eyebrow ? <span className="usx-eyebrow">{eyebrow}</span> : null}
|
|
42
51
|
{title}
|
|
43
52
|
</h1>
|
|
53
|
+
{hasSummary && (
|
|
54
|
+
<div className="usx-page__summary">
|
|
55
|
+
{subtitle && <p className="usx-page__subtitle">{subtitle}</p>}
|
|
56
|
+
{tagProps?.length ? <TagGroup className="usx-page__tags" tagProps={tagProps} /> : null}
|
|
57
|
+
{description && <p className="usx-page__description">{description}</p>}
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
44
60
|
<div className="usx-page__content">{pageContent}</div>
|
|
45
61
|
</Element>
|
|
46
62
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "page",
|
|
3
3
|
"template": "page/page.django.html",
|
|
4
|
-
"version":
|
|
4
|
+
"version": 5,
|
|
5
5
|
"required": [
|
|
6
6
|
"title"
|
|
7
7
|
],
|
|
@@ -39,6 +39,23 @@
|
|
|
39
39
|
"type": "slot",
|
|
40
40
|
"description": "Optional eyebrow text rendered above the page title inside the h1."
|
|
41
41
|
},
|
|
42
|
+
"subtitle": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"description": "Short subtitle displayed beneath the page title."
|
|
45
|
+
},
|
|
46
|
+
"tagProps": {
|
|
47
|
+
"type": "array",
|
|
48
|
+
"description": "Props for tags displayed beneath the subtitle.",
|
|
49
|
+
"items": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"component": "tag",
|
|
52
|
+
"description": "Props passed to each tag."
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"description": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Brief page description displayed beneath the tags."
|
|
58
|
+
},
|
|
42
59
|
"content": {
|
|
43
60
|
"type": "slot",
|
|
44
61
|
"description": "Body content rendered below the title. Supports HTML in Django stories. Ignored if children is provided."
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<h3 class="site-preview-heading">Default</h3>
|
|
2
2
|
<main class="usx-page">
|
|
3
3
|
<h1 class="usx-page__title">Page title</h1>
|
|
4
|
+
|
|
4
5
|
<div class="usx-page__content">
|
|
5
6
|
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
6
7
|
<p>Use this region for page-specific content.</p>
|
|
@@ -10,6 +11,7 @@
|
|
|
10
11
|
<h3 class="site-preview-heading">With Long Content</h3>
|
|
11
12
|
<main class="usx-page">
|
|
12
13
|
<h1 class="usx-page__title">Program overview</h1>
|
|
14
|
+
|
|
13
15
|
<div class="usx-page__content">
|
|
14
16
|
<p>
|
|
15
17
|
This section demonstrates how the page component handles longer content while preserving top
|
|
@@ -29,6 +31,77 @@
|
|
|
29
31
|
<h3 class="site-preview-heading">With Eyebrow</h3>
|
|
30
32
|
<main class="usx-page">
|
|
31
33
|
<h1 class="usx-page__title"><span class="usx-eyebrow">Eyebrow Title</span>Page Title</h1>
|
|
34
|
+
|
|
35
|
+
<div class="usx-page__content">
|
|
36
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
37
|
+
<p>Use this region for page-specific content.</p>
|
|
38
|
+
</div>
|
|
39
|
+
</main>
|
|
40
|
+
|
|
41
|
+
<h3 class="site-preview-heading">With Subtitle</h3>
|
|
42
|
+
<main class="usx-page">
|
|
43
|
+
<h1 class="usx-page__title">Benefits and services</h1>
|
|
44
|
+
|
|
45
|
+
<div class="usx-page__summary">
|
|
46
|
+
<p class="usx-page__subtitle">Find support for every stage of life</p>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="usx-page__content">
|
|
50
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
51
|
+
<p>Use this region for page-specific content.</p>
|
|
52
|
+
</div>
|
|
53
|
+
</main>
|
|
54
|
+
|
|
55
|
+
<h3 class="site-preview-heading">With Description</h3>
|
|
56
|
+
<main class="usx-page">
|
|
57
|
+
<h1 class="usx-page__title">Program overview</h1>
|
|
58
|
+
|
|
59
|
+
<div class="usx-page__summary">
|
|
60
|
+
<p class="usx-page__description">
|
|
61
|
+
Explore available services, eligibility, and the steps to apply.
|
|
62
|
+
</p>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="usx-page__content">
|
|
66
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
67
|
+
<p>Use this region for page-specific content.</p>
|
|
68
|
+
</div>
|
|
69
|
+
</main>
|
|
70
|
+
|
|
71
|
+
<h3 class="site-preview-heading">With Tags</h3>
|
|
72
|
+
<main class="usx-page">
|
|
73
|
+
<h1 class="usx-page__title">Program updates</h1>
|
|
74
|
+
|
|
75
|
+
<div class="usx-page__summary">
|
|
76
|
+
<div class="usx-tag-group usx-page__tags">
|
|
77
|
+
<span class="usa-tag usx-tag"> New </span>
|
|
78
|
+
|
|
79
|
+
<span class="usa-tag usx-tag usx-tag--outline"> Public notice </span>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div class="usx-page__content">
|
|
84
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
85
|
+
<p>Use this region for page-specific content.</p>
|
|
86
|
+
</div>
|
|
87
|
+
</main>
|
|
88
|
+
|
|
89
|
+
<h3 class="site-preview-heading">With Summary</h3>
|
|
90
|
+
<main class="usx-page">
|
|
91
|
+
<h1 class="usx-page__title">
|
|
92
|
+
<span class="usx-eyebrow">Funding opportunities</span>Community grants
|
|
93
|
+
</h1>
|
|
94
|
+
|
|
95
|
+
<div class="usx-page__summary">
|
|
96
|
+
<p class="usx-page__subtitle">Support for local projects</p>
|
|
97
|
+
<div class="usx-tag-group usx-page__tags">
|
|
98
|
+
<span class="usa-tag usx-tag"> Open </span>
|
|
99
|
+
|
|
100
|
+
<span class="usa-tag usx-tag usx-tag--outline"> Applications close June 30 </span>
|
|
101
|
+
</div>
|
|
102
|
+
<p class="usx-page__description">Find grants that help communities plan, build, and grow.</p>
|
|
103
|
+
</div>
|
|
104
|
+
|
|
32
105
|
<div class="usx-page__content">
|
|
33
106
|
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
34
107
|
<p>Use this region for page-specific content.</p>
|
|
@@ -38,6 +111,7 @@
|
|
|
38
111
|
<h3 class="site-preview-heading">With Classes</h3>
|
|
39
112
|
<main class="usx-page bg-violet text-white padding-2">
|
|
40
113
|
<h1 class="usx-page__title">Page with extra classes</h1>
|
|
114
|
+
|
|
41
115
|
<div class="usx-page__content">
|
|
42
116
|
<p>This page has additional classes applied to the root element for testing purposes.</p>
|
|
43
117
|
</div>
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{# Django template for Page #}
|
|
2
|
+
{% load usx_components %}
|
|
2
3
|
{% with pageTag=as|default:'main' %}
|
|
3
4
|
<{% if pageTag == 'div' or pageTag == 'section' or pageTag == 'article' %}{{ pageTag }}{% else %}main{% endif %}{% if id %} id="{{ id }}"{% endif %} class="usx-page{% if className %} {{ className }}{% endif %}"{% if tabIndex or tabIndex == 0 %} tabindex="{{ tabIndex }}"{% endif %}{% if ariaLabelledby or titleId %} aria-labelledby="{% firstof ariaLabelledby titleId %}"{% endif %}>
|
|
4
5
|
<h1{% if titleId %} id="{{ titleId }}"{% endif %} class="usx-page__title">{% if eyebrow %}<span class="usx-eyebrow">{{ eyebrow }}</span>{% endif %}{{ title|default:'Page title' }}</h1>
|
|
6
|
+
{% if subtitle or description or tagProps %}
|
|
7
|
+
<div class="usx-page__summary">
|
|
8
|
+
{% if subtitle %}<p class="usx-page__subtitle">{{ subtitle }}</p>{% endif %}
|
|
9
|
+
{% if tagProps %}<div class="usx-tag-group usx-page__tags">{% for tag in tagProps %}{% tag props=tag %}{{ tag.children|safe }}{% endtag %}{% endfor %}</div>{% endif %}
|
|
10
|
+
{% if description %}<p class="usx-page__description">{{ description }}</p>{% endif %}
|
|
11
|
+
</div>
|
|
12
|
+
{% endif %}
|
|
5
13
|
<div class="usx-page__content">{% if children %}{{ children|safe }}{% elif content %}{{ content|safe }}{% endif %}</div>
|
|
6
14
|
</{% if pageTag == 'div' or pageTag == 'section' or pageTag == 'article' %}{{ pageTag }}{% else %}main{% endif %}>
|
|
7
15
|
{% endwith %}
|
|
@@ -35,6 +35,66 @@
|
|
|
35
35
|
</div>
|
|
36
36
|
</main>
|
|
37
37
|
|
|
38
|
+
<h3 class="site-preview-heading">With Subtitle</h3>
|
|
39
|
+
<main class="usx-page">
|
|
40
|
+
<h1 class="usx-page__title">Benefits and services</h1>
|
|
41
|
+
<div class="usx-page__summary">
|
|
42
|
+
<p class="usx-page__subtitle">Find support for every stage of life</p>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="usx-page__content">
|
|
45
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
46
|
+
<p>Use this region for page-specific content.</p>
|
|
47
|
+
</div>
|
|
48
|
+
</main>
|
|
49
|
+
|
|
50
|
+
<h3 class="site-preview-heading">With Description</h3>
|
|
51
|
+
<main class="usx-page">
|
|
52
|
+
<h1 class="usx-page__title">Program overview</h1>
|
|
53
|
+
<div class="usx-page__summary">
|
|
54
|
+
<p class="usx-page__description">
|
|
55
|
+
Explore available services, eligibility, and the steps to apply.
|
|
56
|
+
</p>
|
|
57
|
+
</div>
|
|
58
|
+
<div class="usx-page__content">
|
|
59
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
60
|
+
<p>Use this region for page-specific content.</p>
|
|
61
|
+
</div>
|
|
62
|
+
</main>
|
|
63
|
+
|
|
64
|
+
<h3 class="site-preview-heading">With Tags</h3>
|
|
65
|
+
<main class="usx-page">
|
|
66
|
+
<h1 class="usx-page__title">Program updates</h1>
|
|
67
|
+
<div class="usx-page__summary">
|
|
68
|
+
<div class="usx-tag-group usx-page__tags">
|
|
69
|
+
<span class="usa-tag usx-tag"> New</span
|
|
70
|
+
><span class="usa-tag usx-tag usx-tag--outline"> Public notice</span>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
<div class="usx-page__content">
|
|
74
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
75
|
+
<p>Use this region for page-specific content.</p>
|
|
76
|
+
</div>
|
|
77
|
+
</main>
|
|
78
|
+
|
|
79
|
+
<h3 class="site-preview-heading">With Summary</h3>
|
|
80
|
+
<main class="usx-page">
|
|
81
|
+
<h1 class="usx-page__title">
|
|
82
|
+
<span class="usx-eyebrow">Funding opportunities</span>Community grants
|
|
83
|
+
</h1>
|
|
84
|
+
<div class="usx-page__summary">
|
|
85
|
+
<p class="usx-page__subtitle">Support for local projects</p>
|
|
86
|
+
<div class="usx-tag-group usx-page__tags">
|
|
87
|
+
<span class="usa-tag usx-tag"> Open</span
|
|
88
|
+
><span class="usa-tag usx-tag usx-tag--outline"> Applications close June 30</span>
|
|
89
|
+
</div>
|
|
90
|
+
<p class="usx-page__description">Find grants that help communities plan, build, and grow.</p>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="usx-page__content">
|
|
93
|
+
<p>This page wrapper provides consistent spacing between a site header and footer.</p>
|
|
94
|
+
<p>Use this region for page-specific content.</p>
|
|
95
|
+
</div>
|
|
96
|
+
</main>
|
|
97
|
+
|
|
38
98
|
<h3 class="site-preview-heading">With Classes</h3>
|
|
39
99
|
<main class="usx-page bg-violet text-white padding-2">
|
|
40
100
|
<h1 class="usx-page__title">Page with extra classes</h1>
|