@solexllc/usx-react 0.11.0 → 1.0.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 +31 -0
- package/dist/Popover-Bg4-2-cU.cjs +987 -0
- package/dist/Popover-CqHczzNE.js +988 -0
- package/dist/chat.cjs +1396 -0
- package/dist/chat.js +1396 -0
- package/dist/index.cjs +4412 -5247
- package/dist/index.js +140 -972
- package/package.json +9 -5
- package/src/chat.js +15 -0
- package/src/components/accordion/Accordion.tsx +9 -57
- package/src/components/accordion/accordion.django.html +10 -20
- package/src/components/accordion/config.json +8 -2
- package/src/components/accordion-item/AccordionItem.tsx +54 -0
- package/src/components/accordion-item/accordion-item.django.html +19 -0
- package/src/components/accordion-item/accordion-item.html +8 -0
- package/src/components/accordion-item/config.json +55 -0
- package/src/components/alert/alert.django-snapshot.html +4 -4
- package/src/components/avatar/Avatar.tsx +54 -16
- package/src/components/avatar/avatar.django-snapshot.html +118 -2
- 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 +110 -3
- package/src/components/avatar/config.json +17 -17
- package/src/components/avatar-group/AvatarGroup.tsx +17 -15
- package/src/components/avatar-group/avatar-group.django-snapshot.html +196 -174
- package/src/components/avatar-group/avatar-group.django.html +1 -1
- package/src/components/avatar-group/avatar-group.react-snapshot.html +216 -165
- package/src/components/avatar-group/config.json +14 -8
- 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/banner/banner.django-snapshot.html +2 -2
- package/src/components/button/Button.tsx +15 -3
- package/src/components/button/button.django-snapshot.html +82 -0
- package/src/components/button/button.django.html +5 -2
- package/src/components/button/button.react-snapshot.html +80 -0
- package/src/components/button/config.json +17 -3
- package/src/components/callout/callout.django.html +1 -1
- package/src/components/callout/config.json +7 -16
- package/src/components/card/card.django-snapshot.html +43 -0
- package/src/components/card/card.react-snapshot.html +36 -0
- 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 +23579 -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 +213 -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 +135 -0
- package/src/components/chat-window/chat-window.django-snapshot.html +450 -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/checkbox/checkbox.django-snapshot.html +2 -2
- 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 +25 -18
- package/src/components/code/code.react-snapshot.html +41 -4
- 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/data-table/data-table.django-snapshot.html +4 -5
- package/src/components/data-table/data-table.react-snapshot.html +4 -4
- package/src/components/drawer/drawer.django-snapshot.html +53 -30
- package/src/components/error-page/error-page.django-snapshot.html +20 -7
- package/src/components/fieldset/fieldset.django-snapshot.html +1 -6
- 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/form-group/form-group.django-snapshot.html +0 -2
- package/src/components/header/header.django-snapshot.html +3 -163
- package/src/components/header/header.django.html +2 -2
- package/src/components/header/header.html +1 -1
- package/src/components/header/header.react-snapshot.html +3 -3
- package/src/components/hero/hero.django-snapshot.html +0 -20
- package/src/components/hero/hero.django.html +3 -3
- package/src/components/identifier/config.json +4 -2
- package/src/components/identifier/identifier.django-snapshot.html +13 -16
- package/src/components/identifier/identifier.react-snapshot.html +13 -15
- package/src/components/image/image.django-snapshot.html +6 -6
- 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/layout/layout.django-snapshot.html +2 -0
- 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/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/modal/Modal.tsx +4 -3
- package/src/components/modal/config.json +3 -2
- package/src/components/modal/modal.django-snapshot.html +70 -14
- package/src/components/modal/modal.django.html +7 -9
- package/src/components/modal/modal.html +4 -4
- package/src/components/modal/modal.react-snapshot.html +64 -4
- package/src/components/page/Page.tsx +10 -7
- package/src/components/page/page.django-snapshot.html +5 -8
- package/src/components/page/page.django.html +2 -2
- package/src/components/page/page.html +1 -2
- package/src/components/page/page.react-snapshot.html +5 -8
- package/src/components/pagination/navigation/PaginationNavigation.tsx +2 -0
- package/src/components/pagination/navigation/pagination-navigation.django.html +2 -0
- package/src/components/pagination/pagination.django-snapshot.html +62 -0
- package/src/components/pagination/pagination.django.html +3 -1
- package/src/components/pagination/pagination.html +46 -0
- package/src/components/pagination/pagination.react-snapshot.html +48 -0
- package/src/components/pagination/summary/PaginationSummary.tsx +1 -1
- package/src/components/pagination/summary/pagination-summary.django.html +1 -1
- package/src/components/popover/Popover.tsx +61 -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 +265 -7
- package/src/components/popover/popover.django.html +3 -2
- package/src/components/popover/popover.react-snapshot.html +154 -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/section/Section.tsx +3 -1
- package/src/components/select/select.django-snapshot.html +7 -7
- package/src/components/select/select.react-snapshot.html +7 -7
- package/src/components/site-alert/site-alert.django-snapshot.html +8 -8
- 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/swap/Swap.tsx +35 -3
- package/src/components/swap/config.json +28 -1
- package/src/components/swap/swap.django-snapshot.html +29 -7
- package/src/components/swap/swap.django.html +15 -1
- package/src/components/swap/swap.react-snapshot.html +34 -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 +48 -42
- package/src/components/theme-picker/config.json +27 -29
- package/src/components/theme-picker/theme-picker-select.django.html +1 -1
- package/src/components/theme-picker/theme-picker.django-snapshot.html +283 -78
- package/src/components/theme-picker/theme-picker.django.html +24 -11
- package/src/components/theme-picker/theme-picker.html +155 -54
- package/src/components/theme-picker/theme-picker.react-snapshot.html +265 -67
- package/src/index.js +1 -0
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
id="{{ id }}"
|
|
21
21
|
class="usa-input usx-input"
|
|
22
22
|
placeholder="{{ placeholder }}"
|
|
23
|
-
|
|
23
|
+
{% if value != None %}value="{{ value }}"{% elif defaultValue != None %}value="{{ defaultValue }}"{% endif %}
|
|
24
24
|
type="search"
|
|
25
25
|
name="{{ searchKey|default:'q' }}"
|
|
26
26
|
/>
|
|
@@ -37,24 +37,5 @@
|
|
|
37
37
|
{% endwith %}
|
|
38
38
|
{% endwith %}
|
|
39
39
|
</form>
|
|
40
|
-
<script data-id="{{ id }}" data-on-submit="{{ onSubmit }}" data-search-key="{{ searchKey|default:'q' }}">
|
|
41
|
-
const data = document.currentScript.dataset;
|
|
42
|
-
const onSubmit = data.onSubmit;
|
|
43
40
|
|
|
44
|
-
if (!!onSubmit) {
|
|
45
|
-
const id = data.id;
|
|
46
|
-
const searchKey = data.searchKey;
|
|
47
|
-
document.addEventListener("DOMContentLoaded", function() {
|
|
48
|
-
document.getElementById(`${id}-form`).onsubmit = function(e) {
|
|
49
|
-
e.preventDefault();
|
|
50
|
-
const formData = new FormData(e.target);
|
|
51
|
-
const query = formData.get(searchKey);
|
|
52
|
-
const func = eval(onSubmit);
|
|
53
|
-
func(query);
|
|
54
|
-
return false;
|
|
55
|
-
};
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
</script>
|
|
60
41
|
</section>
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ClassNames from 'classnames';
|
|
3
3
|
|
|
4
|
-
export interface SectionProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
export interface SectionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'content'> {
|
|
5
5
|
title?: string;
|
|
6
6
|
headingAs?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
content?: React.ReactNode;
|
|
9
9
|
className?: string;
|
|
10
|
+
id?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
const Section: React.FC<SectionProps> = ({
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
>
|
|
36
36
|
<option value="">Select an option</option>
|
|
37
37
|
|
|
38
|
-
<option value="option1">Option A
|
|
38
|
+
<option value="option1">Option A&nbsp;</option>
|
|
39
39
|
|
|
40
40
|
<option value="option2">Option B</option>
|
|
41
41
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
<select class="usa-select usx-select usa-input--success" id="django-select-success">
|
|
51
51
|
<option value="">Select an option</option>
|
|
52
52
|
|
|
53
|
-
<option value="option1">Option A
|
|
53
|
+
<option value="option1">Option A&nbsp;</option>
|
|
54
54
|
|
|
55
55
|
<option value="option2">Option B</option>
|
|
56
56
|
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
<select class="usa-select usx-select" id="django-select-disabled" disabled>
|
|
68
68
|
<option value="">Select an option</option>
|
|
69
69
|
|
|
70
|
-
<option value="option1">Option A
|
|
70
|
+
<option value="option1">Option A&nbsp;</option>
|
|
71
71
|
|
|
72
72
|
<option value="option2">Option B</option>
|
|
73
73
|
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
>
|
|
98
98
|
<option value="">Select an option</option>
|
|
99
99
|
|
|
100
|
-
<option value="option1">Option A
|
|
100
|
+
<option value="option1">Option A&nbsp;</option>
|
|
101
101
|
|
|
102
102
|
<option value="option2">Option B</option>
|
|
103
103
|
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
<select class="usa-select usx-select" id="django-select-default-value">
|
|
115
115
|
<option value="">Select an option</option>
|
|
116
116
|
|
|
117
|
-
<option value="option1">Option A
|
|
117
|
+
<option value="option1">Option A&nbsp;</option>
|
|
118
118
|
|
|
119
119
|
<option value="option2" selected>Option B</option>
|
|
120
120
|
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
>
|
|
138
138
|
<option value="">Select an option</option>
|
|
139
139
|
|
|
140
|
-
<option value="option1">Option A
|
|
140
|
+
<option value="option1">Option A&nbsp;</option>
|
|
141
141
|
|
|
142
142
|
<option value="option2">Option B</option>
|
|
143
143
|
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
<select class="usa-select usx-select" id="django-select-value">
|
|
153
153
|
<option value="">Select an option</option>
|
|
154
154
|
|
|
155
|
-
<option value="option1">Option A
|
|
155
|
+
<option value="option1">Option A&nbsp;</option>
|
|
156
156
|
|
|
157
157
|
<option value="option2">Option B</option>
|
|
158
158
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
aria-invalid="true"
|
|
24
24
|
>
|
|
25
25
|
<option value="">Select an option</option>
|
|
26
|
-
<option value="option1">Option A
|
|
26
|
+
<option value="option1">Option A&nbsp;</option>
|
|
27
27
|
<option value="option2">Option B</option>
|
|
28
28
|
<option value="option3">Option C</option>
|
|
29
29
|
</select>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
<label class="usa-label usx-label" for="react-select-success">Success state select</label
|
|
35
35
|
><select id="react-select-success" class="usa-select usx-select usa-input--success">
|
|
36
36
|
<option value="">Select an option</option>
|
|
37
|
-
<option value="option1">Option A
|
|
37
|
+
<option value="option1">Option A&nbsp;</option>
|
|
38
38
|
<option value="option2">Option B</option>
|
|
39
39
|
<option value="option3">Option C</option></select
|
|
40
40
|
><span class="usa-success-message">Success message goes here.</span>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<label class="usa-label usx-label" for="react-select-disabled">Disabled select</label
|
|
46
46
|
><select id="react-select-disabled" class="usa-select usx-select" disabled="">
|
|
47
47
|
<option value="">Select an option</option>
|
|
48
|
-
<option value="option1">Option A
|
|
48
|
+
<option value="option1">Option A&nbsp;</option>
|
|
49
49
|
<option value="option2">Option B</option>
|
|
50
50
|
<option value="option3">Option C</option>
|
|
51
51
|
</select>
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
aria-invalid="true"
|
|
69
69
|
>
|
|
70
70
|
<option value="">Select an option</option>
|
|
71
|
-
<option value="option1">Option A
|
|
71
|
+
<option value="option1">Option A&nbsp;</option>
|
|
72
72
|
<option value="option2">Option B</option>
|
|
73
73
|
<option value="option3">Option C</option>
|
|
74
74
|
</select>
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
>Select with default value</label
|
|
81
81
|
><select id="react-select-default-value" class="usa-select usx-select">
|
|
82
82
|
<option value="">Select an option</option>
|
|
83
|
-
<option value="option1">Option A
|
|
83
|
+
<option value="option1">Option A&nbsp;</option>
|
|
84
84
|
<option value="option2" selected="">Option B</option>
|
|
85
85
|
<option value="option3">Option C</option>
|
|
86
86
|
</select>
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
aria-describedby="react-select-with-hint-hint"
|
|
98
98
|
>
|
|
99
99
|
<option value="">Select an option</option>
|
|
100
|
-
<option value="option1">Option A
|
|
100
|
+
<option value="option1">Option A&nbsp;</option>
|
|
101
101
|
<option value="option2">Option B</option>
|
|
102
102
|
<option value="option3">Option C</option>
|
|
103
103
|
</select>
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
<label class="usa-label usx-label" for="react-select-value">Current selection</label
|
|
109
109
|
><select id="react-select-value" class="usa-select usx-select">
|
|
110
110
|
<option value="">Select an option</option>
|
|
111
|
-
<option value="option1">Option A
|
|
111
|
+
<option value="option1">Option A&nbsp;</option>
|
|
112
112
|
<option value="option2">Option B</option>
|
|
113
113
|
<option value="option3" selected="">Option C</option>
|
|
114
114
|
</select>
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
<button
|
|
146
146
|
class="usx-alert__dismiss"
|
|
147
147
|
aria-label="Dismiss alert"
|
|
148
|
-
onclick="this.closest(
|
|
148
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
149
149
|
>
|
|
150
150
|
<svg
|
|
151
151
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
<button
|
|
175
175
|
class="usx-alert__dismiss"
|
|
176
176
|
aria-label="Dismiss alert"
|
|
177
|
-
onclick="this.closest(
|
|
177
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
178
178
|
>
|
|
179
179
|
<svg
|
|
180
180
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
<button
|
|
204
204
|
class="usx-alert__dismiss"
|
|
205
205
|
aria-label="Dismiss alert"
|
|
206
|
-
onclick="this.closest(
|
|
206
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
207
207
|
>
|
|
208
208
|
<svg
|
|
209
209
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
<button
|
|
239
239
|
class="usx-alert__dismiss"
|
|
240
240
|
aria-label="Dismiss alert"
|
|
241
|
-
onclick="this.closest(
|
|
241
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
242
242
|
>
|
|
243
243
|
<svg
|
|
244
244
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
<button
|
|
268
268
|
class="usx-alert__dismiss"
|
|
269
269
|
aria-label="Dismiss alert"
|
|
270
|
-
onclick="this.closest(
|
|
270
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
271
271
|
>
|
|
272
272
|
<svg
|
|
273
273
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
<button
|
|
299
299
|
class="usx-alert__dismiss"
|
|
300
300
|
aria-label="Dismiss alert"
|
|
301
|
-
onclick="this.closest(
|
|
301
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
302
302
|
>
|
|
303
303
|
<svg
|
|
304
304
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
<button
|
|
342
342
|
class="usx-alert__dismiss"
|
|
343
343
|
aria-label="Dismiss alert"
|
|
344
|
-
onclick="this.closest(
|
|
344
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
345
345
|
>
|
|
346
346
|
<svg
|
|
347
347
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -384,7 +384,7 @@
|
|
|
384
384
|
<button
|
|
385
385
|
class="usx-alert__dismiss"
|
|
386
386
|
aria-label="Dismiss alert"
|
|
387
|
-
onclick="this.closest(
|
|
387
|
+
onclick="this.closest('.usa-site-alert').remove();"
|
|
388
388
|
>
|
|
389
389
|
<svg
|
|
390
390
|
class="usa-icon usx-icon usa-icon--size-3"
|
|
@@ -5,6 +5,7 @@ export interface SummaryProps {
|
|
|
5
5
|
label?: React.ReactNode;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
ariaLabel?: string;
|
|
8
|
+
title?: string;
|
|
8
9
|
className?: string;
|
|
9
10
|
textClassName?: string;
|
|
10
11
|
markerColor?: string;
|
|
@@ -18,6 +19,7 @@ export default function Summary({
|
|
|
18
19
|
label = 'Details',
|
|
19
20
|
children,
|
|
20
21
|
ariaLabel,
|
|
22
|
+
title,
|
|
21
23
|
className = '',
|
|
22
24
|
textClassName = '',
|
|
23
25
|
markerColor = undefined,
|
|
@@ -28,7 +30,7 @@ export default function Summary({
|
|
|
28
30
|
}: SummaryProps) {
|
|
29
31
|
if (unstyled) {
|
|
30
32
|
return (
|
|
31
|
-
<summary className={className || undefined} aria-label={ariaLabel}>
|
|
33
|
+
<summary className={className || undefined} aria-label={ariaLabel} title={title}>
|
|
32
34
|
{children ?? label}
|
|
33
35
|
</summary>
|
|
34
36
|
);
|
|
@@ -47,7 +49,7 @@ export default function Summary({
|
|
|
47
49
|
textClassName
|
|
48
50
|
);
|
|
49
51
|
return (
|
|
50
|
-
<summary className={summaryClassNames} aria-label={ariaLabel}>
|
|
52
|
+
<summary className={summaryClassNames} aria-label={ariaLabel} title={title}>
|
|
51
53
|
<span className={summaryTextClassNames}>{children ?? (label || 'Details')}</span>
|
|
52
54
|
</summary>
|
|
53
55
|
);
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"type": "string",
|
|
20
20
|
"description": "Accessible name for the summary control."
|
|
21
21
|
},
|
|
22
|
+
"title": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Optional native tooltip text for an icon-only summary."
|
|
25
|
+
},
|
|
22
26
|
"className": {
|
|
23
27
|
"type": "string",
|
|
24
28
|
"default": "",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{# Django template for Summary #}
|
|
2
2
|
{% load usx_components %}
|
|
3
|
-
{% spaceless %}
|
|
4
3
|
{% if unstyled %}
|
|
5
|
-
<summary{% if className %} class="{{ className|force_escape }}"{% endif %}{% if ariaLabel %} aria-label="{{ ariaLabel|force_escape }}"{% endif %}
|
|
4
|
+
<summary{% if className %} class="{{ className|force_escape }}"{% endif %}{% if ariaLabel != None %} aria-label="{{ ariaLabel|force_escape }}"{% endif %}{% if title != None %} title="{{ title|force_escape }}"{% endif %}>{% if children != None %}{% if children is not True and children is not False %}{{ children|safe }}{% endif %}{% else %}{{ label|force_escape }}{% endif %}</summary>
|
|
6
5
|
{% else %}
|
|
7
|
-
|
|
6
|
+
{% spaceless %}
|
|
7
|
+
<summary class="usx-summary{% if markerColor and not noMarker %} marker-{{ markerColor|force_escape }}{% endif %}{% if noMarker %} usx-summary--no-marker{% endif %}{% if noUnderline %} usx-summary--no-underline{% endif %}{% if className %} {{ className|force_escape }}{% endif %}"{% if ariaLabel != None %} aria-label="{{ ariaLabel|force_escape }}"{% endif %}{% if title != None %} title="{{ title|force_escape }}"{% endif %}>
|
|
8
8
|
<span class="usx-summary-text{% if underlineColor and not noUnderline %} underline-{{ underlineColor|force_escape }}{% endif %}{% if textClassName %} {{ textClassName|force_escape }}{% endif %}">{% if children != None %}{{ children|safe }}{% elif label %}{{ label|force_escape }}{% else %}Details{% endif %}</span>
|
|
9
9
|
</summary>
|
|
10
|
-
{% endif %}
|
|
11
10
|
{% endspaceless %}
|
|
11
|
+
{% endif %}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ClassNames from 'classnames';
|
|
3
3
|
|
|
4
|
-
export interface SwapProps extends React.
|
|
4
|
+
export interface SwapProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
className?: string;
|
|
7
7
|
variant?: 'default' | 'active' | 'rotate' | 'flip';
|
|
8
|
+
/** Button mode toggles aria-pressed and swaps content after JavaScript enhancement. */
|
|
9
|
+
as?: 'label' | 'button';
|
|
10
|
+
/** Initial state for button mode. */
|
|
11
|
+
defaultPressed?: boolean;
|
|
12
|
+
/** Stable accessible name for button mode. */
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
disabled?: boolean;
|
|
8
15
|
onContent?: React.ReactNode;
|
|
9
16
|
offContent?: React.ReactNode;
|
|
10
17
|
includeInput?: boolean;
|
|
@@ -17,6 +24,10 @@ const Swap: React.FC<SwapProps> = ({
|
|
|
17
24
|
children = null,
|
|
18
25
|
className = '',
|
|
19
26
|
variant = 'default',
|
|
27
|
+
as = 'label',
|
|
28
|
+
defaultPressed = false,
|
|
29
|
+
ariaLabel,
|
|
30
|
+
disabled = false,
|
|
20
31
|
onContent = 'ON',
|
|
21
32
|
offContent = 'OFF',
|
|
22
33
|
includeInput = true,
|
|
@@ -26,18 +37,39 @@ const Swap: React.FC<SwapProps> = ({
|
|
|
26
37
|
...props
|
|
27
38
|
}) => {
|
|
28
39
|
const variantClass = variant !== 'default' ? `usx-swap--${variant}` : '';
|
|
29
|
-
const classes = ClassNames(
|
|
40
|
+
const classes = ClassNames(
|
|
41
|
+
'usx-swap',
|
|
42
|
+
variantClass,
|
|
43
|
+
as === 'button' && 'usa-button usx-button usx-swap--button',
|
|
44
|
+
className
|
|
45
|
+
);
|
|
30
46
|
const onClasses = ClassNames('usx-swap-on', onClassName);
|
|
31
47
|
const offClasses = ClassNames('usx-swap-off', offClassName);
|
|
32
48
|
|
|
33
49
|
const content = children || (
|
|
34
50
|
<>
|
|
35
|
-
{
|
|
51
|
+
{as === 'label' && includeInput ? (
|
|
52
|
+
<input type="checkbox" autoComplete="off" {...inputProps} />
|
|
53
|
+
) : null}
|
|
36
54
|
<span className={onClasses}>{onContent}</span>
|
|
37
55
|
<span className={offClasses}>{offContent}</span>
|
|
38
56
|
</>
|
|
39
57
|
);
|
|
40
58
|
|
|
59
|
+
if (as === 'button') {
|
|
60
|
+
return (
|
|
61
|
+
<button
|
|
62
|
+
type="button"
|
|
63
|
+
className={classes}
|
|
64
|
+
aria-pressed={defaultPressed}
|
|
65
|
+
aria-label={ariaLabel}
|
|
66
|
+
disabled={disabled}
|
|
67
|
+
{...props}
|
|
68
|
+
>
|
|
69
|
+
{content}
|
|
70
|
+
</button>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
41
73
|
return (
|
|
42
74
|
<label className={classes} {...props}>
|
|
43
75
|
{content}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swap",
|
|
3
3
|
"template": "swap/swap.django.html",
|
|
4
|
-
"version":
|
|
4
|
+
"version": 3,
|
|
5
5
|
"default": {
|
|
6
6
|
"className": "",
|
|
7
7
|
"variant": "default",
|
|
@@ -25,6 +25,33 @@
|
|
|
25
25
|
"type": "boolean",
|
|
26
26
|
"description": "Render default checkbox input control"
|
|
27
27
|
},
|
|
28
|
+
"as": {
|
|
29
|
+
"type": "select",
|
|
30
|
+
"options": ["label", "button"],
|
|
31
|
+
"default": "label",
|
|
32
|
+
"description": "Render a checkbox label or an enhanced toggle button. Button mode swaps content on click and emits change after updating aria-pressed."
|
|
33
|
+
},
|
|
34
|
+
"defaultPressed": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"description": "Initial pressed state in button mode"
|
|
37
|
+
},
|
|
38
|
+
"onClick": {
|
|
39
|
+
"type": "function",
|
|
40
|
+
"description": "React button click handler. In Django or HTML, listen for the native click event on the button.",
|
|
41
|
+
"renderers": {
|
|
42
|
+
"django": {
|
|
43
|
+
"supported": false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"ariaLabel": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"description": "Stable accessible name for button mode"
|
|
50
|
+
},
|
|
51
|
+
"disabled": {
|
|
52
|
+
"type": "boolean",
|
|
53
|
+
"description": "Disable the button in button mode"
|
|
54
|
+
},
|
|
28
55
|
"inputId": {
|
|
29
56
|
"type": "string",
|
|
30
57
|
"description": "ID applied to the generated checkbox"
|
|
@@ -101,10 +101,32 @@
|
|
|
101
101
|
<span class="usx-swap-off">Custom OFF</span>
|
|
102
102
|
</label>
|
|
103
103
|
|
|
104
|
-
<h3 class="site-preview-heading">
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
<h3 class="site-preview-heading">Button Text</h3>
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
class="usx-swap usa-button usx-button usx-swap--button"
|
|
108
|
+
aria-pressed="false"
|
|
109
|
+
aria-label="Details"
|
|
110
|
+
>
|
|
111
|
+
<span class="usx-swap-on">Hide details</span>
|
|
112
|
+
<span class="usx-swap-off">Show details</span>
|
|
113
|
+
</button>
|
|
114
|
+
|
|
115
|
+
<h3 class="site-preview-heading">Button Icon</h3>
|
|
116
|
+
<button
|
|
117
|
+
type="button"
|
|
118
|
+
class="usx-swap usx-swap--rotate usa-button usx-button usx-swap--button"
|
|
119
|
+
aria-pressed="true"
|
|
120
|
+
aria-label="Notifications"
|
|
121
|
+
>
|
|
122
|
+
<span class="usx-swap-on">
|
|
123
|
+
<svg class="usa-icon usx-icon usa-icon--size-4" aria-hidden="true" focusable="false" role="img">
|
|
124
|
+
<use href="img/sprite.svg#notifications_active"></use>
|
|
125
|
+
</svg>
|
|
126
|
+
</span>
|
|
127
|
+
<span class="usx-swap-off">
|
|
128
|
+
<svg class="usa-icon usx-icon usa-icon--size-4" aria-hidden="true" focusable="false" role="img">
|
|
129
|
+
<use href="img/sprite.svg#notifications"></use>
|
|
130
|
+
</svg>
|
|
131
|
+
</span>
|
|
132
|
+
</button>
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
{# Django template for Swap #}
|
|
2
|
+
{% if as == 'button' %}
|
|
3
|
+
<button
|
|
4
|
+
type="button"
|
|
5
|
+
class="usx-swap{% if variant and variant != 'default' %} usx-swap--{{ variant }}{% endif %} usa-button usx-button usx-swap--button{% if className %} {{ className }}{% endif %}"
|
|
6
|
+
aria-pressed="{% if defaultPressed %}true{% else %}false{% endif %}"
|
|
7
|
+
{% if ariaLabel %}aria-label="{{ ariaLabel }}"{% endif %}
|
|
8
|
+
{% if disabled %}disabled=""{% endif %}
|
|
9
|
+
>
|
|
10
|
+
{% else %}
|
|
2
11
|
<label class="usx-swap{% if variant and variant != 'default' %} usx-swap--{{ variant }}{% endif %}{% if className %} {{ className }}{% endif %}">
|
|
12
|
+
{% endif %}
|
|
3
13
|
{% if content %}
|
|
4
14
|
{{ content|safe }}
|
|
5
15
|
{% elif children %}
|
|
6
16
|
{{ children|safe }}
|
|
7
17
|
{% else %}
|
|
8
|
-
{% if includeInput != False %}
|
|
18
|
+
{% if as != 'button' and includeInput != False %}
|
|
9
19
|
<input type="checkbox" autocomplete="off"{% if inputId %} id="{{ inputId }}"{% endif %}{% if inputClassName %} class="{{ inputClassName }}"{% endif %}{% if inputChecked %} checked{% endif %} {% for attr, value in inputProps.items %} {{ attr }}="{{ value }}"{% endfor %}/>
|
|
10
20
|
{% endif %}
|
|
11
21
|
<span class="usx-swap-on{% if onClassName %} {{ onClassName }}{% endif %}">{{ onContent|default:'ON'|safe }}</span>
|
|
12
22
|
<span class="usx-swap-off{% if offClassName %} {{ offClassName }}{% endif %}">{{ offContent|default:'OFF'|safe }}</span>
|
|
13
23
|
{% endif %}
|
|
24
|
+
{% if as == 'button' %}
|
|
25
|
+
</button>
|
|
26
|
+
{% else %}
|
|
14
27
|
</label>
|
|
28
|
+
{% endif %}
|
|
@@ -93,8 +93,38 @@
|
|
|
93
93
|
><span class="usx-swap-off">Custom OFF</span></label
|
|
94
94
|
>
|
|
95
95
|
|
|
96
|
-
<h3 class="site-preview-heading">
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
<h3 class="site-preview-heading">Button Text</h3>
|
|
97
|
+
<button
|
|
98
|
+
type="button"
|
|
99
|
+
class="usx-swap usa-button usx-button usx-swap--button"
|
|
100
|
+
aria-pressed="false"
|
|
101
|
+
aria-label="Details"
|
|
102
|
+
>
|
|
103
|
+
<span class="usx-swap-on">Hide details</span><span class="usx-swap-off">Show details</span>
|
|
104
|
+
</button>
|
|
105
|
+
|
|
106
|
+
<h3 class="site-preview-heading">Button Icon</h3>
|
|
107
|
+
<button
|
|
108
|
+
type="button"
|
|
109
|
+
class="usx-swap usx-swap--rotate usa-button usx-button usx-swap--button"
|
|
110
|
+
aria-pressed="true"
|
|
111
|
+
aria-label="Notifications"
|
|
100
112
|
>
|
|
113
|
+
<span class="usx-swap-on"
|
|
114
|
+
><svg
|
|
115
|
+
class="usa-icon usx-icon usa-icon--size-4"
|
|
116
|
+
aria-hidden="true"
|
|
117
|
+
focusable="false"
|
|
118
|
+
role="img"
|
|
119
|
+
>
|
|
120
|
+
<use href="/img/sprite.svg#notifications_active"></use></svg></span
|
|
121
|
+
><span class="usx-swap-off"
|
|
122
|
+
><svg
|
|
123
|
+
class="usa-icon usx-icon usa-icon--size-4"
|
|
124
|
+
aria-hidden="true"
|
|
125
|
+
focusable="false"
|
|
126
|
+
role="img"
|
|
127
|
+
>
|
|
128
|
+
<use href="/img/sprite.svg#notifications"></use></svg
|
|
129
|
+
></span>
|
|
130
|
+
</button>
|
|
@@ -29,9 +29,20 @@ export interface TableProps extends Omit<React.TableHTMLAttributes<HTMLTableElem
|
|
|
29
29
|
|
|
30
30
|
/** A themeable USWDS table. Sorting is supplied by USWDS's table script. */
|
|
31
31
|
export default function Table({
|
|
32
|
-
columns = [],
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
columns = [],
|
|
33
|
+
data = [],
|
|
34
|
+
caption,
|
|
35
|
+
striped = false,
|
|
36
|
+
borderless = false,
|
|
37
|
+
compact = false,
|
|
38
|
+
scrollable = false,
|
|
39
|
+
scrollHeight,
|
|
40
|
+
stickyHeader = false,
|
|
41
|
+
responsive = false,
|
|
42
|
+
className,
|
|
43
|
+
children,
|
|
44
|
+
extraAttributes,
|
|
45
|
+
...props
|
|
35
46
|
}: TableProps) {
|
|
36
47
|
const hasSorting = !children && columns.some((column) => column.sortable);
|
|
37
48
|
const table = (
|
|
@@ -40,7 +51,8 @@ export default function Table({
|
|
|
40
51
|
{...props}
|
|
41
52
|
{...extraAttributes}
|
|
42
53
|
className={classnames(
|
|
43
|
-
'usa-table',
|
|
54
|
+
'usa-table',
|
|
55
|
+
'usx-table',
|
|
44
56
|
striped && 'usa-table--striped',
|
|
45
57
|
borderless && 'usa-table--borderless',
|
|
46
58
|
compact && 'usa-table--compact',
|
|
@@ -53,30 +65,51 @@ export default function Table({
|
|
|
53
65
|
{children ?? (
|
|
54
66
|
<>
|
|
55
67
|
<caption className="usx-table__caption">{caption || 'Data table'}</caption>
|
|
56
|
-
<thead
|
|
57
|
-
<
|
|
58
|
-
{column
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
<thead>
|
|
69
|
+
<tr>
|
|
70
|
+
{columns.map((column) => (
|
|
71
|
+
<th key={column.key} scope="col" data-sortable={column.sortable ? '' : undefined}>
|
|
72
|
+
{column.header}
|
|
73
|
+
</th>
|
|
74
|
+
))}
|
|
75
|
+
</tr>
|
|
76
|
+
</thead>
|
|
77
|
+
<tbody>
|
|
78
|
+
{data.map((row, index) => (
|
|
79
|
+
<tr key={index}>
|
|
80
|
+
{columns.map((column) => {
|
|
81
|
+
const Cell = column.primary ? 'th' : 'td';
|
|
82
|
+
const value = row[column.key];
|
|
83
|
+
return (
|
|
84
|
+
<Cell
|
|
85
|
+
key={column.key}
|
|
86
|
+
scope={column.primary ? 'row' : undefined}
|
|
87
|
+
data-label={responsive ? String(column.header) : undefined}
|
|
88
|
+
>
|
|
89
|
+
{value ?? ''}
|
|
90
|
+
</Cell>
|
|
91
|
+
);
|
|
92
|
+
})}
|
|
93
|
+
</tr>
|
|
94
|
+
))}
|
|
95
|
+
</tbody>
|
|
72
96
|
</>
|
|
73
97
|
)}
|
|
74
98
|
</table>
|
|
75
|
-
{hasSorting &&
|
|
99
|
+
{hasSorting && (
|
|
100
|
+
<div className="usa-sr-only usa-table__announcement-region" aria-live="polite" />
|
|
101
|
+
)}
|
|
76
102
|
</>
|
|
77
103
|
);
|
|
78
|
-
return scrollable
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
104
|
+
return scrollable ? (
|
|
105
|
+
<div
|
|
106
|
+
className="usa-table-container--scrollable"
|
|
107
|
+
tabIndex={0}
|
|
108
|
+
style={scrollHeight ? { height: scrollHeight, overflow: 'auto' } : undefined}
|
|
109
|
+
>
|
|
110
|
+
{table}
|
|
111
|
+
</div>
|
|
112
|
+
) : (
|
|
113
|
+
table
|
|
114
|
+
);
|
|
82
115
|
}
|