@solexllc/usx-react 0.10.0 → 0.12.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/README.md +16 -0
- package/dist/Popover-BzDCTuQM.cjs +984 -0
- package/dist/Popover-LToVWsWc.js +985 -0
- package/dist/chat.cjs +1391 -0
- package/dist/chat.js +1391 -0
- package/dist/index.cjs +4426 -5231
- package/dist/index.js +168 -970
- package/package.json +9 -5
- package/src/chat.js +15 -0
- package/src/components/avatar/Avatar.tsx +54 -16
- package/src/components/avatar/avatar.django-snapshot.html +112 -0
- package/src/components/avatar/avatar.django.html +2 -2
- package/src/components/avatar/avatar.html +25 -0
- package/src/components/avatar/avatar.react-snapshot.html +104 -0
- package/src/components/avatar/config.json +13 -15
- package/src/components/avatar-group/AvatarGroup.tsx +17 -15
- package/src/components/avatar-group/avatar-group.django-snapshot.html +22 -0
- package/src/components/avatar-group/avatar-group.django.html +1 -1
- package/src/components/avatar-group/avatar-group.react-snapshot.html +20 -0
- package/src/components/avatar-group/config.json +2 -2
- package/src/components/back-to-top/BackToTop.tsx +21 -57
- package/src/components/back-to-top/back-to-top.django-snapshot.html +101 -202
- package/src/components/back-to-top/back-to-top.django.html +11 -38
- package/src/components/back-to-top/back-to-top.html +22 -106
- package/src/components/back-to-top/back-to-top.react-snapshot.html +94 -148
- package/src/components/back-to-top/config.json +41 -10
- package/src/components/button/Button.tsx +12 -3
- package/src/components/button/button.django-snapshot.html +18 -0
- package/src/components/button/button.django.html +3 -2
- package/src/components/button/button.react-snapshot.html +16 -0
- package/src/components/button/config.json +11 -2
- package/src/components/callout/callout.django.html +1 -1
- package/src/components/callout/config.json +7 -16
- package/src/components/character-count/CharacterCount.tsx +2 -0
- package/src/components/character-count/character-count.react-snapshot.html +7 -0
- package/src/components/chat/Chat.tsx +575 -0
- package/src/components/chat/README.md +174 -0
- package/src/components/chat/avatarProps.ts +32 -0
- package/src/components/chat/chat.django-snapshot.html +23515 -0
- package/src/components/chat/chat.django.html +75 -0
- package/src/components/chat/chat.html +116 -0
- package/src/components/chat/chat.react-snapshot.html +16895 -0
- package/src/components/chat/config.json +1241 -0
- package/src/components/chat-attachment/ChatAttachment.tsx +39 -0
- package/src/components/chat-attachment/chat-attachment.django.html +24 -0
- package/src/components/chat-attachment/chat-attachment.html +10 -0
- package/src/components/chat-attachment/config.json +27 -0
- package/src/components/chat-attachments/ChatAttachments.tsx +17 -0
- package/src/components/chat-attachments/chat-attachments.django-snapshot.html +58 -0
- package/src/components/chat-attachments/chat-attachments.django.html +10 -0
- package/src/components/chat-attachments/chat-attachments.html +14 -0
- package/src/components/chat-attachments/chat-attachments.react-snapshot.html +46 -0
- package/src/components/chat-attachments/config.json +25 -0
- package/src/components/chat-bubble/ChatBubble.tsx +39 -0
- package/src/components/chat-bubble/ChatFormattedText.tsx +138 -0
- package/src/components/chat-bubble/chat-bubble.django-snapshot.html +128 -0
- package/src/components/chat-bubble/chat-bubble.django.html +19 -0
- package/src/components/chat-bubble/chat-bubble.html +1 -0
- package/src/components/chat-bubble/chat-bubble.react-snapshot.html +118 -0
- package/src/components/chat-bubble/config.json +70 -0
- package/src/components/chat-composer/ChatComposer.tsx +210 -0
- package/src/components/chat-composer/README.md +15 -0
- package/src/components/chat-composer/chat-composer.django-snapshot.html +575 -0
- package/src/components/chat-composer/chat-composer.django.html +77 -0
- package/src/components/chat-composer/chat-composer.html +44 -0
- package/src/components/chat-composer/chat-composer.react-snapshot.html +519 -0
- package/src/components/chat-composer/chat-formatting.django.html +59 -0
- package/src/components/chat-composer/config.json +137 -0
- package/src/components/chat-context/ChatContext.tsx +46 -0
- package/src/components/chat-context/chat-context.django-snapshot.html +35 -0
- package/src/components/chat-context/chat-context.django.html +20 -0
- package/src/components/chat-context/chat-context.html +9 -0
- package/src/components/chat-context/chat-context.react-snapshot.html +30 -0
- package/src/components/chat-context/config.json +36 -0
- package/src/components/chat-controls/ChatControls.tsx +67 -0
- package/src/components/chat-controls/chat-controls.django-snapshot.html +114 -0
- package/src/components/chat-controls/chat-controls.django.html +36 -0
- package/src/components/chat-controls/chat-controls.html +11 -0
- package/src/components/chat-controls/chat-controls.react-snapshot.html +107 -0
- package/src/components/chat-controls/config.json +67 -0
- package/src/components/chat-directory/ChatDirectory.tsx +168 -0
- package/src/components/chat-directory/chat-directory.django-snapshot.html +546 -0
- package/src/components/chat-directory/chat-directory.django.html +14 -0
- package/src/components/chat-directory/chat-directory.html +4 -0
- package/src/components/chat-directory/chat-directory.react-snapshot.html +471 -0
- package/src/components/chat-directory/config.json +242 -0
- package/src/components/chat-directory-item/ChatDirectoryItem.tsx +150 -0
- package/src/components/chat-directory-item/chat-directory-item.django-snapshot.html +281 -0
- package/src/components/chat-directory-item/chat-directory-item.django.html +38 -0
- package/src/components/chat-directory-item/chat-directory-item.html +9 -0
- package/src/components/chat-directory-item/chat-directory-item.react-snapshot.html +249 -0
- package/src/components/chat-directory-item/config.json +103 -0
- package/src/components/chat-history/ChatHistory.tsx +30 -0
- package/src/components/chat-history/chat-history.django-snapshot.html +113 -0
- package/src/components/chat-history/chat-history.django.html +20 -0
- package/src/components/chat-history/chat-history.html +9 -0
- package/src/components/chat-history/chat-history.react-snapshot.html +111 -0
- package/src/components/chat-history/config.json +24 -0
- package/src/components/chat-message/ChatMessage.tsx +148 -0
- package/src/components/chat-message/chat-message.django-snapshot.html +758 -0
- package/src/components/chat-message/chat-message.django.html +56 -0
- package/src/components/chat-message/chat-message.html +12 -0
- package/src/components/chat-message/chat-message.react-snapshot.html +627 -0
- package/src/components/chat-message/config.json +278 -0
- package/src/components/chat-message-actions/ChatMessageActions.tsx +133 -0
- package/src/components/chat-message-actions/chat-message-actions.django-snapshot.html +345 -0
- package/src/components/chat-message-actions/chat-message-actions.django.html +29 -0
- package/src/components/chat-message-actions/chat-message-actions.html +53 -0
- package/src/components/chat-message-actions/chat-message-actions.react-snapshot.html +295 -0
- package/src/components/chat-message-actions/config.json +121 -0
- package/src/components/chat-window/ChatWindow.tsx +133 -0
- package/src/components/chat-window/chat-window.django-snapshot.html +448 -0
- package/src/components/chat-window/chat-window.django.html +39 -0
- package/src/components/chat-window/chat-window.html +26 -0
- package/src/components/chat-window/chat-window.react-snapshot.html +286 -0
- package/src/components/chat-window/config.json +123 -0
- package/src/components/clickable/Clickable.tsx +19 -5
- package/src/components/clickable/clickable.django-snapshot.html +11 -2
- package/src/components/clickable/clickable.django.html +2 -0
- package/src/components/clickable/clickable.react-snapshot.html +10 -2
- package/src/components/clickable/config.json +4 -0
- package/src/components/code/code.django-snapshot.html +27 -22
- package/src/components/code/code.html +2 -2
- package/src/components/code/code.react-snapshot.html +43 -8
- package/src/components/copy-to-clipboard/CopyToClipboard.tsx +2 -7
- package/src/components/copy-to-clipboard/copy-to-clipboard.django-snapshot.html +6 -4
- package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +3 -2
- package/src/components/copy-to-clipboard/copy-to-clipboard.react-snapshot.html +14 -2
- package/src/components/file-list/FileList.tsx +3 -2
- package/src/components/file-list/config.json +5 -0
- package/src/components/file-list/file-list.django-snapshot.html +63 -0
- package/src/components/file-list/file-list.django.html +1 -1
- package/src/components/file-list/file-list.react-snapshot.html +53 -0
- package/src/components/footer/footer.django-snapshot.html +0 -3
- package/src/components/header/header.django-snapshot.html +5 -167
- package/src/components/header/header.django.html +2 -2
- package/src/components/header/header.html +1 -11
- package/src/components/header/header.react-snapshot.html +3 -6
- package/src/components/hero/hero.django-snapshot.html +0 -20
- package/src/components/hero/hero.django.html +3 -3
- 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/image/image.django.html +4 -4
- package/src/components/input/Input.tsx +1 -1
- package/src/components/input/config.json +2 -3
- package/src/components/input/input.django-snapshot.html +4 -21
- package/src/components/input/input.django.html +2 -2
- package/src/components/link/Link.tsx +7 -4
- package/src/components/link/config.json +2 -3
- package/src/components/link/link.django-snapshot.html +8 -0
- package/src/components/link/link.django.html +2 -2
- package/src/components/link/link.html +4 -1
- package/src/components/link/link.react-snapshot.html +8 -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/memorable-date/memorable-date.django-snapshot.html +0 -8
- package/src/components/memorable-date/memorable-date.django.html +2 -2
- package/src/components/misc-banner/misc-banner.django-snapshot.html +12 -12
- package/src/components/misc-banner/misc-banner.django.html +4 -2
- 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/popover/Popover.tsx +60 -9
- package/src/components/popover/PopoverMenu.tsx +33 -15
- package/src/components/popover/config.json +88 -14
- package/src/components/popover/popover-menu.django.html +13 -2
- package/src/components/popover/popover.django-snapshot.html +229 -7
- package/src/components/popover/popover.django.html +3 -2
- package/src/components/popover/popover.react-snapshot.html +127 -4
- package/src/components/process-list/config.json +41 -3
- package/src/components/quote/Quote.tsx +9 -2
- package/src/components/search/Search.tsx +1 -1
- package/src/components/search/config.json +3 -4
- package/src/components/search/search.django-snapshot.html +262 -1684
- package/src/components/search/search.django.html +1 -20
- package/src/components/select/select.django-snapshot.html +7 -7
- package/src/components/select/select.react-snapshot.html +7 -7
- package/src/components/summary/Summary.tsx +4 -2
- package/src/components/summary/config.json +4 -0
- package/src/components/summary/summary.django.html +4 -4
- package/src/components/table/Table.tsx +58 -25
- package/src/components/table/config.json +61 -13
- package/src/components/tag/Tag.tsx +40 -7
- package/src/components/tag/config.json +18 -2
- package/src/components/tag/tag.django-snapshot.html +16 -1
- package/src/components/tag/tag.django.html +12 -6
- package/src/components/tag/tag.html +4 -0
- package/src/components/tag/tag.react-snapshot.html +16 -1
- package/src/components/tag-group/TagGroup.tsx +6 -9
- package/src/components/tag-group/config.json +4 -0
- package/src/components/tag-group/tag-group.django.html +1 -1
- 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
|
@@ -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>
|
|
@@ -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>
|
|
@@ -22,16 +22,27 @@ export interface PopoverProps extends Omit<
|
|
|
22
22
|
panelShape?: PopoverPanelShape;
|
|
23
23
|
/** Open on the initial render. Native details owns subsequent disclosure state. */
|
|
24
24
|
defaultOpen?: boolean;
|
|
25
|
+
/** Keep the panel open when focus or pointer moves outside it. Escape and close controls still close it. */
|
|
26
|
+
dismissOnOutside?: boolean;
|
|
25
27
|
/** Optional native details group. Use a different name at each nesting level. */
|
|
26
28
|
name?: string;
|
|
27
29
|
/** Arbitrary semantic content. Use native links, buttons, lists, or form controls. */
|
|
28
30
|
children?: React.ReactNode;
|
|
29
|
-
/** Renders a PopoverMenu of links and nested flyouts
|
|
31
|
+
/** Renders a PopoverMenu of links, actions, and nested flyouts before any children. */
|
|
30
32
|
menuItems?: PopoverMenuItem[];
|
|
31
33
|
showClose?: boolean;
|
|
32
34
|
closeLabel?: string;
|
|
35
|
+
/** Controls before the panel heading, such as a back button. */
|
|
36
|
+
headerLeftActions?: React.ReactNode;
|
|
37
|
+
/** Controls after the panel heading, before the close icon. */
|
|
38
|
+
headerRightActions?: React.ReactNode;
|
|
39
|
+
showCloseIcon?: boolean;
|
|
40
|
+
closeIconLabel?: string;
|
|
41
|
+
headerClassName?: string;
|
|
33
42
|
/** Optional visible heading for the panel. */
|
|
34
43
|
panelHeading?: string;
|
|
44
|
+
/** Optional ID for a heading that labels panel content and can receive programmatic focus. */
|
|
45
|
+
panelHeadingId?: string;
|
|
35
46
|
/** Heading element for panelHeading, chosen to fit the surrounding page outline. */
|
|
36
47
|
headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
37
48
|
|
|
@@ -55,10 +66,17 @@ export default function Popover({
|
|
|
55
66
|
align = 'start',
|
|
56
67
|
panelShape = 'rounded',
|
|
57
68
|
defaultOpen = false,
|
|
69
|
+
dismissOnOutside = true,
|
|
58
70
|
menuItems,
|
|
59
71
|
showClose = false,
|
|
60
72
|
closeLabel = 'Close',
|
|
73
|
+
headerLeftActions,
|
|
74
|
+
headerRightActions,
|
|
75
|
+
showCloseIcon = false,
|
|
76
|
+
closeIconLabel = 'Close',
|
|
77
|
+
headerClassName,
|
|
61
78
|
panelHeading,
|
|
79
|
+
panelHeadingId,
|
|
62
80
|
headingAs = 'h2',
|
|
63
81
|
scrollable = false,
|
|
64
82
|
className,
|
|
@@ -69,7 +87,6 @@ export default function Popover({
|
|
|
69
87
|
children,
|
|
70
88
|
...props
|
|
71
89
|
}: PopoverProps) {
|
|
72
|
-
const [initiallyOpen] = React.useState(defaultOpen);
|
|
73
90
|
const composedSummaryProps = { ...summaryProps, label: summaryProps?.label ?? 'Open panel' };
|
|
74
91
|
const Heading = headingAs;
|
|
75
92
|
|
|
@@ -77,21 +94,55 @@ export default function Popover({
|
|
|
77
94
|
<details
|
|
78
95
|
{...props}
|
|
79
96
|
className={ClassNames('usx-popover', className)}
|
|
80
|
-
open={
|
|
97
|
+
open={defaultOpen || undefined}
|
|
81
98
|
data-side={side}
|
|
82
99
|
data-align={align}
|
|
100
|
+
data-usx-popover-dismiss-on-outside={dismissOnOutside ? undefined : 'false'}
|
|
83
101
|
{...extraAttributes}
|
|
84
102
|
>
|
|
85
103
|
<Summary unstyled {...composedSummaryProps} />
|
|
86
104
|
<div
|
|
87
105
|
id={id}
|
|
88
|
-
className={ClassNames(
|
|
89
|
-
'usx-popover__panel
|
|
90
|
-
|
|
106
|
+
className={ClassNames(
|
|
107
|
+
'usx-popover__panel',
|
|
108
|
+
{
|
|
109
|
+
'usx-popover__panel--square': panelShape === 'square',
|
|
110
|
+
},
|
|
111
|
+
panelClassName
|
|
112
|
+
)}
|
|
91
113
|
>
|
|
92
|
-
{panelHeading &&
|
|
93
|
-
|
|
94
|
-
|
|
114
|
+
{(headerLeftActions || panelHeading || headerRightActions || showCloseIcon) && (
|
|
115
|
+
<header className={ClassNames('usx-popover__header', headerClassName)}>
|
|
116
|
+
{headerLeftActions && (
|
|
117
|
+
<div className="usx-popover__header-left-actions">{headerLeftActions}</div>
|
|
118
|
+
)}
|
|
119
|
+
<div className="usx-popover__header-content">
|
|
120
|
+
{panelHeading && (
|
|
121
|
+
<Heading id={panelHeadingId} className="usx-popover__panel-heading" tabIndex={-1}>
|
|
122
|
+
{panelHeading}
|
|
123
|
+
</Heading>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
{(headerRightActions || showCloseIcon) && (
|
|
127
|
+
<div className="usx-popover__header-right-actions">
|
|
128
|
+
{headerRightActions}
|
|
129
|
+
{showCloseIcon && (
|
|
130
|
+
<Button
|
|
131
|
+
variant="unstyled"
|
|
132
|
+
className="usx-popover__header-action usx-popover__header-close"
|
|
133
|
+
aria-label={closeIconLabel}
|
|
134
|
+
iconProps={[{ name: 'close' }]}
|
|
135
|
+
extraAttributes={{ 'data-usx-popover-close': id }}
|
|
136
|
+
/>
|
|
137
|
+
)}
|
|
138
|
+
</div>
|
|
139
|
+
)}
|
|
140
|
+
</header>
|
|
141
|
+
)}
|
|
142
|
+
{menuItems && menuItems.length > 0 && (
|
|
143
|
+
<PopoverMenu items={menuItems} prefix={id} panelShape={panelShape} />
|
|
144
|
+
)}
|
|
145
|
+
{Boolean(children) && (
|
|
95
146
|
<div
|
|
96
147
|
className={ClassNames(
|
|
97
148
|
'usx-popover__panel-content',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ClassNames from 'classnames';
|
|
3
3
|
import Link from '../link/Link';
|
|
4
|
+
import Icon, { type IconProps } from '../icon/Icon';
|
|
4
5
|
import type { SummaryProps } from '../summary/Summary';
|
|
5
6
|
import Popover, { type PopoverPanelShape } from './Popover';
|
|
6
7
|
|
|
@@ -9,10 +10,15 @@ interface PopoverMenuItemBase {
|
|
|
9
10
|
id?: string;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export interface
|
|
13
|
-
type
|
|
14
|
-
href: string;
|
|
13
|
+
export interface PopoverMenuRowItem extends PopoverMenuItemBase {
|
|
14
|
+
type?: 'button';
|
|
15
15
|
text: string;
|
|
16
|
+
href?: string;
|
|
17
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** Optional icon before the label of an action row. */
|
|
20
|
+
icon?: IconProps;
|
|
21
|
+
extraAttributes?: Record<string, unknown>;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
export interface PopoverMenuDetailsItem extends PopoverMenuItemBase {
|
|
@@ -22,15 +28,10 @@ export interface PopoverMenuDetailsItem extends PopoverMenuItemBase {
|
|
|
22
28
|
items: PopoverMenuItem[];
|
|
23
29
|
}
|
|
24
30
|
|
|
25
|
-
export
|
|
26
|
-
type: 'text';
|
|
27
|
-
text: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export type PopoverMenuItem = PopoverMenuLinkItem | PopoverMenuDetailsItem | PopoverMenuTextItem;
|
|
31
|
+
export type PopoverMenuItem = PopoverMenuDetailsItem | PopoverMenuRowItem;
|
|
31
32
|
|
|
32
33
|
export interface PopoverMenuProps extends Omit<React.HTMLAttributes<HTMLUListElement>, 'children'> {
|
|
33
|
-
/** Links, nested menus, or plain text. */
|
|
34
|
+
/** Links, actions, nested menus, or plain text. */
|
|
34
35
|
items: PopoverMenuItem[];
|
|
35
36
|
/** Prefix for generated panel IDs and the native details group name. Generated if omitted. */
|
|
36
37
|
prefix?: string;
|
|
@@ -40,7 +41,13 @@ export interface PopoverMenuProps extends Omit<React.HTMLAttributes<HTMLUListEle
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
/** A stacked list of rows; `details` items open nested PopoverMenus beside their row. */
|
|
43
|
-
export default function PopoverMenu({
|
|
44
|
+
export default function PopoverMenu({
|
|
45
|
+
items,
|
|
46
|
+
prefix,
|
|
47
|
+
panelShape,
|
|
48
|
+
className,
|
|
49
|
+
...props
|
|
50
|
+
}: PopoverMenuProps) {
|
|
44
51
|
const generatedPrefix = React.useId();
|
|
45
52
|
const base = prefix ?? generatedPrefix;
|
|
46
53
|
|
|
@@ -51,7 +58,7 @@ export default function PopoverMenu({ items, prefix, panelShape, className, ...p
|
|
|
51
58
|
|
|
52
59
|
return (
|
|
53
60
|
<li key={id}>
|
|
54
|
-
{item.type === 'details'
|
|
61
|
+
{item.type === 'details' ? (
|
|
55
62
|
<Popover
|
|
56
63
|
id={id}
|
|
57
64
|
summaryProps={{
|
|
@@ -63,15 +70,26 @@ export default function PopoverMenu({ items, prefix, panelShape, className, ...p
|
|
|
63
70
|
panelShape={panelShape}
|
|
64
71
|
menuItems={item.items}
|
|
65
72
|
/>
|
|
66
|
-
)
|
|
67
|
-
|
|
73
|
+
) : item.type === 'button' || item.onClick ? (
|
|
74
|
+
<button
|
|
75
|
+
{...item.extraAttributes}
|
|
76
|
+
type="button"
|
|
77
|
+
className="usx-popover__menu-item"
|
|
78
|
+
onClick={item.onClick}
|
|
79
|
+
disabled={item.disabled}
|
|
80
|
+
>
|
|
81
|
+
{item.icon && <Icon {...item.icon} />}
|
|
82
|
+
{item.text}
|
|
83
|
+
</button>
|
|
84
|
+
) : item.href ? (
|
|
68
85
|
<Link
|
|
69
86
|
href={item.href}
|
|
70
87
|
text={item.text}
|
|
71
88
|
className="usx-no-visited usx-popover__menu-item"
|
|
72
89
|
/>
|
|
90
|
+
) : (
|
|
91
|
+
<span className="usx-popover__menu-item">{item.text}</span>
|
|
73
92
|
)}
|
|
74
|
-
{item.type === 'text' && <span className="usx-popover__menu-item">{item.text}</span>}
|
|
75
93
|
</li>
|
|
76
94
|
);
|
|
77
95
|
})}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "popover",
|
|
3
3
|
"template": "popover/popover.django.html",
|
|
4
|
-
"version":
|
|
5
|
-
"required": [
|
|
4
|
+
"version": 7,
|
|
5
|
+
"required": [
|
|
6
|
+
"id"
|
|
7
|
+
],
|
|
6
8
|
"default": {
|
|
7
9
|
"id": "popover-default",
|
|
8
10
|
"summaryProps": {
|
|
@@ -27,15 +29,18 @@
|
|
|
27
29
|
},
|
|
28
30
|
"menuItems": {
|
|
29
31
|
"type": "array",
|
|
30
|
-
"description": "
|
|
32
|
+
"description": "Menu rows use onClick for a native button, href for a link, or neither for text. Button rows may include icon. Nested rows use type: \"details\" with summaryProps and items.",
|
|
31
33
|
"items": {
|
|
32
34
|
"type": "object",
|
|
33
|
-
"description": "A link,
|
|
35
|
+
"description": "A button, link, text, or nested details row.",
|
|
34
36
|
"properties": {
|
|
35
37
|
"type": {
|
|
36
38
|
"type": "select",
|
|
37
|
-
"options": [
|
|
38
|
-
|
|
39
|
+
"options": [
|
|
40
|
+
"details",
|
|
41
|
+
"button"
|
|
42
|
+
],
|
|
43
|
+
"description": "Use button for a native action row with delegated behavior, or details for a nested row."
|
|
39
44
|
},
|
|
40
45
|
"id": {
|
|
41
46
|
"type": "string",
|
|
@@ -43,40 +48,71 @@
|
|
|
43
48
|
},
|
|
44
49
|
"text": {
|
|
45
50
|
"type": "string",
|
|
46
|
-
"description": "Link or plain text."
|
|
51
|
+
"description": "Link, action, or plain text."
|
|
47
52
|
},
|
|
48
53
|
"href": {
|
|
49
54
|
"type": "string",
|
|
50
|
-
"description": "Link destination.
|
|
55
|
+
"description": "Link destination. Used when onClick is absent."
|
|
51
56
|
},
|
|
52
57
|
"summaryProps": {
|
|
53
58
|
"type": "object",
|
|
54
59
|
"component": "summary",
|
|
55
|
-
"omit": [
|
|
60
|
+
"omit": [
|
|
61
|
+
"unstyled"
|
|
62
|
+
],
|
|
56
63
|
"description": "Props passed to the details row summary. Only for type \"details\"."
|
|
57
64
|
},
|
|
58
65
|
"items": {
|
|
59
66
|
"type": "array",
|
|
60
67
|
"description": "Nested menu rows with the same shape. Only for type \"details\"."
|
|
68
|
+
},
|
|
69
|
+
"onClick": {
|
|
70
|
+
"type": "function",
|
|
71
|
+
"description": "Click handler for a native button row. Takes precedence over href. Django accepts an inline JavaScript string; use a truthy marker when behavior is delegated through data attributes."
|
|
72
|
+
},
|
|
73
|
+
"disabled": {
|
|
74
|
+
"type": "boolean",
|
|
75
|
+
"description": "Disable a button row."
|
|
76
|
+
},
|
|
77
|
+
"extraAttributes": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"description": "Additional attributes for a button row, including data attributes."
|
|
80
|
+
},
|
|
81
|
+
"icon": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"component": "icon",
|
|
84
|
+
"description": "Optional Icon props rendered before a button row label. Only for rows with onClick."
|
|
61
85
|
}
|
|
62
86
|
}
|
|
63
87
|
}
|
|
64
88
|
},
|
|
65
89
|
"side": {
|
|
66
90
|
"type": "select",
|
|
67
|
-
"options": [
|
|
91
|
+
"options": [
|
|
92
|
+
"top",
|
|
93
|
+
"right",
|
|
94
|
+
"bottom",
|
|
95
|
+
"left"
|
|
96
|
+
],
|
|
68
97
|
"default": "bottom",
|
|
69
98
|
"description": "Physical side of the trigger where CSS places the floating panel. Choose a side and alignment with enough space for the panel."
|
|
70
99
|
},
|
|
71
100
|
"align": {
|
|
72
101
|
"type": "select",
|
|
73
|
-
"options": [
|
|
102
|
+
"options": [
|
|
103
|
+
"start",
|
|
104
|
+
"center",
|
|
105
|
+
"end"
|
|
106
|
+
],
|
|
74
107
|
"default": "start",
|
|
75
108
|
"description": "Alignment along the chosen side. Start and end follow text direction for top and bottom."
|
|
76
109
|
},
|
|
77
110
|
"panelShape": {
|
|
78
111
|
"type": "select",
|
|
79
|
-
"options": [
|
|
112
|
+
"options": [
|
|
113
|
+
"rounded",
|
|
114
|
+
"square"
|
|
115
|
+
],
|
|
80
116
|
"default": "rounded",
|
|
81
117
|
"description": "Rounded keeps the original border radius and extra vertical padding; square removes the radius and uses equal outer padding on all sides. Nested menuItems flyouts inherit the shape."
|
|
82
118
|
},
|
|
@@ -85,6 +121,11 @@
|
|
|
85
121
|
"default": false,
|
|
86
122
|
"description": "Open initially. Native details owns subsequent disclosure state."
|
|
87
123
|
},
|
|
124
|
+
"dismissOnOutside": {
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
"default": true,
|
|
127
|
+
"description": "When false, keep the disclosure open as users interact with the rest of the page. Escape and close controls still close it."
|
|
128
|
+
},
|
|
88
129
|
"name": {
|
|
89
130
|
"type": "string",
|
|
90
131
|
"description": "Optional native details group: opening one closes another with the same name. Use unique group names for unrelated groups and each nesting level."
|
|
@@ -92,20 +133,53 @@
|
|
|
92
133
|
"showClose": {
|
|
93
134
|
"type": "boolean",
|
|
94
135
|
"default": false,
|
|
95
|
-
"description": "Add a visible close button after panel content. The shared enhancement enables it
|
|
136
|
+
"description": "Add a visible close button after panel content. The shared enhancement enables it and Escape with focus return. Outside dismissal is controlled by dismissOnOutside. The summary toggles natively without JavaScript."
|
|
96
137
|
},
|
|
97
138
|
"closeLabel": {
|
|
98
139
|
"type": "string",
|
|
99
140
|
"default": "Close",
|
|
100
141
|
"description": "Visible text for the optional close button."
|
|
101
142
|
},
|
|
143
|
+
"headerLeftActions": {
|
|
144
|
+
"type": "slot",
|
|
145
|
+
"description": "Optional controls before the panel heading, such as a back button."
|
|
146
|
+
},
|
|
147
|
+
"headerRightActions": {
|
|
148
|
+
"type": "slot",
|
|
149
|
+
"description": "Optional controls on the right side of the panel header, before the close icon. Can contain another Popover for an action menu."
|
|
150
|
+
},
|
|
151
|
+
"showCloseIcon": {
|
|
152
|
+
"type": "boolean",
|
|
153
|
+
"default": false,
|
|
154
|
+
"description": "Show a close icon in the panel header. React handles closing directly; HTML and Django require the Popover enhancement for dismissal and focus return."
|
|
155
|
+
},
|
|
156
|
+
"closeIconLabel": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"default": "Close",
|
|
159
|
+
"description": "Accessible name for the header close icon."
|
|
160
|
+
},
|
|
161
|
+
"headerClassName": {
|
|
162
|
+
"type": "string",
|
|
163
|
+
"description": "Additional class names for the panel header."
|
|
164
|
+
},
|
|
102
165
|
"panelHeading": {
|
|
103
166
|
"type": "string",
|
|
104
167
|
"description": "Optional visible heading for the panel."
|
|
105
168
|
},
|
|
169
|
+
"panelHeadingId": {
|
|
170
|
+
"type": "string",
|
|
171
|
+
"description": "Optional heading ID for labeling panel content and restoring focus after a view change. Makes the heading programmatically focusable."
|
|
172
|
+
},
|
|
106
173
|
"headingAs": {
|
|
107
174
|
"type": "select",
|
|
108
|
-
"options": [
|
|
175
|
+
"options": [
|
|
176
|
+
"h1",
|
|
177
|
+
"h2",
|
|
178
|
+
"h3",
|
|
179
|
+
"h4",
|
|
180
|
+
"h5",
|
|
181
|
+
"h6"
|
|
182
|
+
],
|
|
109
183
|
"default": "h2",
|
|
110
184
|
"description": "Heading element used for panelHeading. Choose the level that fits the surrounding page outline."
|
|
111
185
|
},
|