@solexllc/usx-react 0.11.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.
Files changed (181) hide show
  1. package/README.md +16 -0
  2. package/dist/Popover-BzDCTuQM.cjs +984 -0
  3. package/dist/Popover-LToVWsWc.js +985 -0
  4. package/dist/chat.cjs +1391 -0
  5. package/dist/chat.js +1391 -0
  6. package/dist/index.cjs +4428 -5290
  7. package/dist/index.js +58 -917
  8. package/package.json +7 -3
  9. package/src/chat.js +15 -0
  10. package/src/components/avatar/Avatar.tsx +54 -16
  11. package/src/components/avatar/avatar.django-snapshot.html +112 -0
  12. package/src/components/avatar/avatar.django.html +2 -2
  13. package/src/components/avatar/avatar.html +25 -0
  14. package/src/components/avatar/avatar.react-snapshot.html +104 -0
  15. package/src/components/avatar/config.json +13 -15
  16. package/src/components/avatar-group/AvatarGroup.tsx +17 -15
  17. package/src/components/avatar-group/avatar-group.django-snapshot.html +22 -0
  18. package/src/components/avatar-group/avatar-group.django.html +1 -1
  19. package/src/components/avatar-group/avatar-group.react-snapshot.html +20 -0
  20. package/src/components/avatar-group/config.json +2 -2
  21. package/src/components/back-to-top/BackToTop.tsx +21 -57
  22. package/src/components/back-to-top/back-to-top.django-snapshot.html +101 -202
  23. package/src/components/back-to-top/back-to-top.django.html +11 -38
  24. package/src/components/back-to-top/back-to-top.html +22 -106
  25. package/src/components/back-to-top/back-to-top.react-snapshot.html +94 -148
  26. package/src/components/back-to-top/config.json +41 -10
  27. package/src/components/button/Button.tsx +12 -3
  28. package/src/components/button/button.django-snapshot.html +18 -0
  29. package/src/components/button/button.django.html +3 -2
  30. package/src/components/button/button.react-snapshot.html +16 -0
  31. package/src/components/button/config.json +11 -2
  32. package/src/components/callout/callout.django.html +1 -1
  33. package/src/components/callout/config.json +7 -16
  34. package/src/components/character-count/CharacterCount.tsx +2 -0
  35. package/src/components/character-count/character-count.react-snapshot.html +7 -0
  36. package/src/components/chat/Chat.tsx +575 -0
  37. package/src/components/chat/README.md +174 -0
  38. package/src/components/chat/avatarProps.ts +32 -0
  39. package/src/components/chat/chat.django-snapshot.html +23515 -0
  40. package/src/components/chat/chat.django.html +75 -0
  41. package/src/components/chat/chat.html +116 -0
  42. package/src/components/chat/chat.react-snapshot.html +16895 -0
  43. package/src/components/chat/config.json +1241 -0
  44. package/src/components/chat-attachment/ChatAttachment.tsx +39 -0
  45. package/src/components/chat-attachment/chat-attachment.django.html +24 -0
  46. package/src/components/chat-attachment/chat-attachment.html +10 -0
  47. package/src/components/chat-attachment/config.json +27 -0
  48. package/src/components/chat-attachments/ChatAttachments.tsx +17 -0
  49. package/src/components/chat-attachments/chat-attachments.django-snapshot.html +58 -0
  50. package/src/components/chat-attachments/chat-attachments.django.html +10 -0
  51. package/src/components/chat-attachments/chat-attachments.html +14 -0
  52. package/src/components/chat-attachments/chat-attachments.react-snapshot.html +46 -0
  53. package/src/components/chat-attachments/config.json +25 -0
  54. package/src/components/chat-bubble/ChatBubble.tsx +39 -0
  55. package/src/components/chat-bubble/ChatFormattedText.tsx +138 -0
  56. package/src/components/chat-bubble/chat-bubble.django-snapshot.html +128 -0
  57. package/src/components/chat-bubble/chat-bubble.django.html +19 -0
  58. package/src/components/chat-bubble/chat-bubble.html +1 -0
  59. package/src/components/chat-bubble/chat-bubble.react-snapshot.html +118 -0
  60. package/src/components/chat-bubble/config.json +70 -0
  61. package/src/components/chat-composer/ChatComposer.tsx +210 -0
  62. package/src/components/chat-composer/README.md +15 -0
  63. package/src/components/chat-composer/chat-composer.django-snapshot.html +575 -0
  64. package/src/components/chat-composer/chat-composer.django.html +77 -0
  65. package/src/components/chat-composer/chat-composer.html +44 -0
  66. package/src/components/chat-composer/chat-composer.react-snapshot.html +519 -0
  67. package/src/components/chat-composer/chat-formatting.django.html +59 -0
  68. package/src/components/chat-composer/config.json +137 -0
  69. package/src/components/chat-context/ChatContext.tsx +46 -0
  70. package/src/components/chat-context/chat-context.django-snapshot.html +35 -0
  71. package/src/components/chat-context/chat-context.django.html +20 -0
  72. package/src/components/chat-context/chat-context.html +9 -0
  73. package/src/components/chat-context/chat-context.react-snapshot.html +30 -0
  74. package/src/components/chat-context/config.json +36 -0
  75. package/src/components/chat-controls/ChatControls.tsx +67 -0
  76. package/src/components/chat-controls/chat-controls.django-snapshot.html +114 -0
  77. package/src/components/chat-controls/chat-controls.django.html +36 -0
  78. package/src/components/chat-controls/chat-controls.html +11 -0
  79. package/src/components/chat-controls/chat-controls.react-snapshot.html +107 -0
  80. package/src/components/chat-controls/config.json +67 -0
  81. package/src/components/chat-directory/ChatDirectory.tsx +168 -0
  82. package/src/components/chat-directory/chat-directory.django-snapshot.html +546 -0
  83. package/src/components/chat-directory/chat-directory.django.html +14 -0
  84. package/src/components/chat-directory/chat-directory.html +4 -0
  85. package/src/components/chat-directory/chat-directory.react-snapshot.html +471 -0
  86. package/src/components/chat-directory/config.json +242 -0
  87. package/src/components/chat-directory-item/ChatDirectoryItem.tsx +150 -0
  88. package/src/components/chat-directory-item/chat-directory-item.django-snapshot.html +281 -0
  89. package/src/components/chat-directory-item/chat-directory-item.django.html +38 -0
  90. package/src/components/chat-directory-item/chat-directory-item.html +9 -0
  91. package/src/components/chat-directory-item/chat-directory-item.react-snapshot.html +249 -0
  92. package/src/components/chat-directory-item/config.json +103 -0
  93. package/src/components/chat-history/ChatHistory.tsx +30 -0
  94. package/src/components/chat-history/chat-history.django-snapshot.html +113 -0
  95. package/src/components/chat-history/chat-history.django.html +20 -0
  96. package/src/components/chat-history/chat-history.html +9 -0
  97. package/src/components/chat-history/chat-history.react-snapshot.html +111 -0
  98. package/src/components/chat-history/config.json +24 -0
  99. package/src/components/chat-message/ChatMessage.tsx +148 -0
  100. package/src/components/chat-message/chat-message.django-snapshot.html +758 -0
  101. package/src/components/chat-message/chat-message.django.html +56 -0
  102. package/src/components/chat-message/chat-message.html +12 -0
  103. package/src/components/chat-message/chat-message.react-snapshot.html +627 -0
  104. package/src/components/chat-message/config.json +278 -0
  105. package/src/components/chat-message-actions/ChatMessageActions.tsx +133 -0
  106. package/src/components/chat-message-actions/chat-message-actions.django-snapshot.html +345 -0
  107. package/src/components/chat-message-actions/chat-message-actions.django.html +29 -0
  108. package/src/components/chat-message-actions/chat-message-actions.html +53 -0
  109. package/src/components/chat-message-actions/chat-message-actions.react-snapshot.html +295 -0
  110. package/src/components/chat-message-actions/config.json +121 -0
  111. package/src/components/chat-window/ChatWindow.tsx +133 -0
  112. package/src/components/chat-window/chat-window.django-snapshot.html +448 -0
  113. package/src/components/chat-window/chat-window.django.html +39 -0
  114. package/src/components/chat-window/chat-window.html +26 -0
  115. package/src/components/chat-window/chat-window.react-snapshot.html +286 -0
  116. package/src/components/chat-window/config.json +123 -0
  117. package/src/components/clickable/Clickable.tsx +19 -5
  118. package/src/components/clickable/clickable.django-snapshot.html +11 -2
  119. package/src/components/clickable/clickable.django.html +2 -0
  120. package/src/components/clickable/clickable.react-snapshot.html +10 -2
  121. package/src/components/clickable/config.json +4 -0
  122. package/src/components/code/code.django-snapshot.html +25 -18
  123. package/src/components/code/code.react-snapshot.html +41 -4
  124. package/src/components/copy-to-clipboard/CopyToClipboard.tsx +2 -7
  125. package/src/components/copy-to-clipboard/copy-to-clipboard.django-snapshot.html +6 -4
  126. package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +3 -2
  127. package/src/components/copy-to-clipboard/copy-to-clipboard.react-snapshot.html +14 -2
  128. package/src/components/file-list/FileList.tsx +3 -2
  129. package/src/components/file-list/config.json +5 -0
  130. package/src/components/file-list/file-list.django-snapshot.html +63 -0
  131. package/src/components/file-list/file-list.django.html +1 -1
  132. package/src/components/file-list/file-list.react-snapshot.html +53 -0
  133. package/src/components/footer/footer.django-snapshot.html +0 -3
  134. package/src/components/header/header.django-snapshot.html +0 -160
  135. package/src/components/header/header.django.html +2 -2
  136. package/src/components/hero/hero.django-snapshot.html +0 -20
  137. package/src/components/hero/hero.django.html +3 -3
  138. package/src/components/image/image.django.html +4 -4
  139. package/src/components/input/Input.tsx +1 -1
  140. package/src/components/input/config.json +2 -3
  141. package/src/components/input/input.django-snapshot.html +4 -21
  142. package/src/components/input/input.django.html +2 -2
  143. package/src/components/link/Link.tsx +7 -4
  144. package/src/components/link/config.json +2 -3
  145. package/src/components/link/link.django-snapshot.html +8 -0
  146. package/src/components/link/link.django.html +2 -2
  147. package/src/components/link/link.html +4 -1
  148. package/src/components/link/link.react-snapshot.html +8 -0
  149. package/src/components/memorable-date/memorable-date.django-snapshot.html +0 -8
  150. package/src/components/memorable-date/memorable-date.django.html +2 -2
  151. package/src/components/misc-banner/misc-banner.django-snapshot.html +12 -12
  152. package/src/components/misc-banner/misc-banner.django.html +4 -2
  153. package/src/components/popover/Popover.tsx +60 -9
  154. package/src/components/popover/PopoverMenu.tsx +33 -15
  155. package/src/components/popover/config.json +88 -14
  156. package/src/components/popover/popover-menu.django.html +13 -2
  157. package/src/components/popover/popover.django-snapshot.html +229 -7
  158. package/src/components/popover/popover.django.html +3 -2
  159. package/src/components/popover/popover.react-snapshot.html +127 -4
  160. package/src/components/process-list/config.json +41 -3
  161. package/src/components/quote/Quote.tsx +9 -2
  162. package/src/components/search/Search.tsx +1 -1
  163. package/src/components/search/config.json +3 -4
  164. package/src/components/search/search.django-snapshot.html +262 -1684
  165. package/src/components/search/search.django.html +1 -20
  166. package/src/components/select/select.django-snapshot.html +7 -7
  167. package/src/components/select/select.react-snapshot.html +7 -7
  168. package/src/components/summary/Summary.tsx +4 -2
  169. package/src/components/summary/config.json +4 -0
  170. package/src/components/summary/summary.django.html +4 -4
  171. package/src/components/table/Table.tsx +58 -25
  172. package/src/components/table/config.json +61 -13
  173. package/src/components/tag/Tag.tsx +40 -7
  174. package/src/components/tag/config.json +18 -2
  175. package/src/components/tag/tag.django-snapshot.html +16 -1
  176. package/src/components/tag/tag.django.html +12 -6
  177. package/src/components/tag/tag.html +4 -0
  178. package/src/components/tag/tag.react-snapshot.html +16 -1
  179. package/src/components/tag-group/TagGroup.tsx +6 -9
  180. package/src/components/tag-group/config.json +4 -0
  181. package/src/components/tag-group/tag-group.django.html +1 -1
@@ -17,11 +17,11 @@
17
17
  {% if source.sizes %}sizes="{{ source.sizes }}"{% endif %}
18
18
  />
19
19
  {% endfor %}
20
- <img src="{% asset_url src.fallback staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt %} alt="{{ alt }}"{% endif %}
20
+ <img src="{% asset_url src.fallback staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt != None %} alt="{{ alt }}"{% endif %}
21
21
  {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
22
22
  </picture>
23
23
  {% elif src %}
24
- <img src="{% asset_url src staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt %} alt="{{ alt }}"{% endif %}
24
+ <img src="{% asset_url src staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt != None %} alt="{{ alt }}"{% endif %}
25
25
  {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
26
26
  {% else %}
27
27
  Image
@@ -45,11 +45,11 @@
45
45
  {% if source.sizes %}sizes="{{ source.sizes }}"{% endif %}
46
46
  />
47
47
  {% endfor %}
48
- <img src="{% asset_url src.fallback staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt %} alt="{{ alt }}"{% endif %}
48
+ <img src="{% asset_url src.fallback staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt != None %} alt="{{ alt }}"{% endif %}
49
49
  {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
50
50
  </picture>
51
51
  {% elif src %}
52
- <img src="{% asset_url src staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt %} alt="{{ alt }}"{% endif %}
52
+ <img src="{% asset_url src staticBaseUrl %}"{% if imageSrcSet %} srcset="{{ imageSrcSet }}"{% endif %}{% if alt != None %} alt="{{ alt }}"{% endif %}
53
53
  {% if maxWidth or maxHeight %}style="{% if maxWidth %}max-width: {{ maxWidth }};{% if not maxHeight %} height: auto;{% endif %}{% endif %}{% if maxHeight %} max-height: {{ maxHeight }};{% if not maxWidth %} width: auto;{% endif %}{% endif %}"{% endif %} />
54
54
  {% else %}
55
55
  Image
@@ -63,7 +63,7 @@ export default function Input({
63
63
  required,
64
64
  'aria-describedby': describedByParts.length ? describedByParts.join(' ') : undefined,
65
65
  'aria-invalid': hasError ? true : undefined,
66
- ...(value !== undefined ? { value } : { defaultValue }),
66
+ ...(value != null ? { value } : { defaultValue }),
67
67
  ...props,
68
68
  };
69
69
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "input",
3
3
  "template": "input/input.django.html",
4
- "version": 3,
4
+ "version": 4,
5
5
  "default": {
6
6
  "id": "example-input-1",
7
7
  "label": "Text input label",
@@ -88,8 +88,7 @@
88
88
  },
89
89
  "defaultValue": {
90
90
  "type": "string",
91
- "default": null,
92
- "description": "Initial input value; editable by the user."
91
+ "description": "Initial input value when value is omitted or null. Empty strings remain explicit values."
93
92
  },
94
93
  "value": {
95
94
  "type": "string",
@@ -2,7 +2,7 @@
2
2
  <div class="usa-form-group usx-form-group">
3
3
  <label class="usa-label usx-label" for="django-example-input-1"> Text input label </label>
4
4
 
5
- <input class="usa-input usx-input" id="django-example-input-1" placeholder="Type here" value="" />
5
+ <input class="usa-input usx-input" id="django-example-input-1" placeholder="Type here" />
6
6
  </div>
7
7
 
8
8
  <h3 class="site-preview-heading">With Hint</h3>
@@ -17,7 +17,6 @@
17
17
  class="usa-input usx-input"
18
18
  id="django-example-input-2"
19
19
  placeholder="Type here"
20
- value=""
21
20
  aria-describedby="django-example-input-2-hint"
22
21
  />
23
22
  </div>
@@ -28,13 +27,7 @@
28
27
  <abbr title="Required" class="usx-required">*</abbr> Required input
29
28
  </label>
30
29
 
31
- <input
32
- class="usa-input usx-input"
33
- id="django-example-input-3"
34
- placeholder="Type here"
35
- value=""
36
- required
37
- />
30
+ <input class="usa-input usx-input" id="django-example-input-3" placeholder="Type here" required />
38
31
  </div>
39
32
 
40
33
  <h3 class="site-preview-heading">Screen Reader Only Label</h3>
@@ -43,7 +36,7 @@
43
36
  Visually hidden label
44
37
  </label>
45
38
 
46
- <input class="usa-input usx-input" id="django-example-input-4" placeholder="Search…" value="" />
39
+ <input class="usa-input usx-input" id="django-example-input-4" placeholder="Search…" />
47
40
  </div>
48
41
 
49
42
  <h3 class="site-preview-heading">Error State</h3>
@@ -60,7 +53,6 @@
60
53
  class="usa-input usx-input usa-input--error"
61
54
  id="django-example-input-5"
62
55
  placeholder="Type here"
63
- value=""
64
56
  aria-describedby="django-example-input-5-error"
65
57
  aria-invalid="true"
66
58
  />
@@ -76,7 +68,6 @@
76
68
  class="usa-input usx-input usa-input--error"
77
69
  id="django-example-input-6"
78
70
  placeholder="Type here"
79
- value=""
80
71
  aria-invalid="true"
81
72
  />
82
73
  </div>
@@ -89,7 +80,6 @@
89
80
  class="usa-input usx-input usa-input--success"
90
81
  id="django-example-input-7"
91
82
  placeholder="Type here"
92
- value=""
93
83
  />
94
84
  </div>
95
85
 
@@ -103,7 +93,6 @@
103
93
  class="usa-input usx-input usa-input--success"
104
94
  id="django-example-input-8"
105
95
  placeholder="Type here"
106
- value=""
107
96
  />
108
97
  </div>
109
98
 
@@ -111,13 +100,7 @@
111
100
  <div class="usa-form-group usx-form-group">
112
101
  <label class="usa-label usx-label" for="django-example-input-9"> Disabled input </label>
113
102
 
114
- <input
115
- class="usa-input usx-input"
116
- id="django-example-input-9"
117
- placeholder="Type here"
118
- value=""
119
- disabled
120
- />
103
+ <input class="usa-input usx-input" id="django-example-input-9" placeholder="Type here" disabled />
121
104
  </div>
122
105
 
123
106
  <h3 class="site-preview-heading">Value</h3>
@@ -21,7 +21,7 @@
21
21
  {% if type %}type="{{ type }}" {% endif %}
22
22
  {% if autoComplete %}autocomplete="{{ autoComplete }}" {% endif %}
23
23
  placeholder="{% if placeholder is None %}Type here{% else %}{{ placeholder }}{% endif %}"
24
- value="{% if value is not None %}{{ value }}{% else %}{{ defaultValue|default:'' }}{% endif %}"
24
+ {% if value != None %}value="{{ value }}"{% elif defaultValue != None %}value="{{ defaultValue }}"{% endif %}
25
25
  {% if maxlength %}maxlength="{{ maxlength }}" {% endif %}
26
26
  {% if hint or describedBy or error and error != "true" and error != True and error != "false" %}aria-describedby="{% if describedBy %}{{ describedBy }} {% endif %}{% if hint %}{{ field_id }}-hint {% endif %}{% if error and error != "true" and error != True and error != "false" %}{{ field_id }}-error {% endif %}"
27
27
  {% endif %}
@@ -48,7 +48,7 @@
48
48
  {% if type %}type="{{ type }}" {% endif %}
49
49
  {% if autoComplete %}autocomplete="{{ autoComplete }}" {% endif %}
50
50
  placeholder="{% if placeholder is None %}Type here{% else %}{{ placeholder }}{% endif %}"
51
- value="{% if value is not None %}{{ value }}{% else %}{{ defaultValue|default:'' }}{% endif %}"
51
+ {% if value != None %}value="{{ value }}"{% elif defaultValue != None %}value="{{ defaultValue }}"{% endif %}
52
52
  {% if maxlength %}maxlength="{{ maxlength }}" {% endif %}
53
53
  {% if hint or describedBy or error and error != "true" and error != True and error != "false" %}aria-describedby="{% if describedBy %}{{ describedBy }} {% endif %}{% if hint %}{{ field_id }}-hint {% endif %}{% if error and error != "true" and error != True and error != "false" %}{{ field_id }}-error {% endif %}"
54
54
  {% endif %}
@@ -1,8 +1,11 @@
1
1
  import React, { AnchorHTMLAttributes, ReactNode } from 'react';
2
2
  import classNames from 'classnames';
3
3
 
4
- export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
5
- href?: string;
4
+ export interface LinkProps extends Omit<
5
+ AnchorHTMLAttributes<HTMLAnchorElement>,
6
+ 'download' | 'type' | 'onClick'
7
+ > {
8
+ href: string;
6
9
  text?: string;
7
10
  children?: ReactNode;
8
11
  visited?: boolean;
@@ -14,7 +17,7 @@ export interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
14
17
  }
15
18
 
16
19
  export default function Link({
17
- href = 'javascript:void(0);',
20
+ href,
18
21
  text,
19
22
  children,
20
23
  visited = false,
@@ -30,7 +33,7 @@ export default function Link({
30
33
  visited && 'usx-link--visited',
31
34
  external && 'usa-link--external',
32
35
  alt && 'usa-link--alt',
33
- className,
36
+ className
34
37
  );
35
38
 
36
39
  return (
@@ -3,8 +3,7 @@
3
3
  "template": "link/link.django.html",
4
4
  "version": 2,
5
5
  "required": [
6
- "href",
7
- "children"
6
+ "href"
8
7
  ],
9
8
  "default": {
10
9
  "href": "https://google.com/",
@@ -13,7 +12,7 @@
13
12
  "props": {
14
13
  "href": {
15
14
  "type": "string",
16
- "description": "Link destination URL."
15
+ "description": "Link destination URL. Link always renders an anchor."
17
16
  },
18
17
  "text": {
19
18
  "type": "string",
@@ -1,6 +1,14 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
2
  <a href="https://google.com/" class="usa-link usx-link">Google</a>
3
3
 
4
+ <h3 class="site-preview-heading">Tag used as a link</h3>
5
+ <a
6
+ href="#related-topics"
7
+ class="usa-tag usx-tag usa-link usx-link usx-no-visited usx-tag--interactive usx-tag--outline"
8
+ >
9
+ Browse related topics
10
+ </a>
11
+
4
12
  <h3 class="site-preview-heading">Visited</h3>
5
13
  <a href="javascript:void(0);" class="usa-link usx-link usx-link--visited">a visited link</a>
6
14
 
@@ -2,7 +2,7 @@
2
2
  {% load usx_components %}
3
3
 
4
4
  <a
5
- href="{{ href|default:'javascript:void(0);' }}"
5
+ href="{{ href }}"
6
6
  class="usa-link usx-link{% if visited %} usx-link--visited{% endif %}{% if external %} usa-link--external{% endif %}{% if alt %} usa-link--alt{% endif %}{% if className %} {{ className }}{% endif %}"
7
- {% if newTab or external %}target="_blank" rel="noreferrer noopener"{% endif %}
7
+ {% if newTab or external %}target="_blank" rel="noreferrer noopener"{% elif rel %}rel="{{ rel }}"{% endif %}
8
8
  >{% if children %}{{ children|safe }}{% else %}{{ text|safe }}{% endif %}</a>
@@ -44,4 +44,7 @@
44
44
  >
45
45
  is an alternate external text link on a dark background.
46
46
  </p>
47
- </div>
47
+ </div>
48
+
49
+ <p><button type="button" class="usa-link usx-link">Show more details</button></p>
50
+ <p><a href="#related-topics" class="usa-link usx-link usx-no-visited usa-tag usx-tag usx-tag--outline usx-tag--interactive">Browse related topics</a></p>
@@ -1,6 +1,14 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
2
  <a href="https://google.com/" class="usa-link usx-link">Google</a>
3
3
 
4
+ <h3 class="site-preview-heading">Tag used as a link</h3>
5
+ <a
6
+ href="#related-topics"
7
+ class="usa-tag usx-tag usx-tag--outline usa-link usx-link usx-no-visited usx-tag--interactive"
8
+ >
9
+ Browse related topics</a
10
+ >
11
+
4
12
  <h3 class="site-preview-heading">Visited</h3>
5
13
  <a href="javascript:void(0);" class="usa-link usx-link usx-link--visited">a visited link</a>
6
14
 
@@ -43,7 +43,6 @@
43
43
  class="usa-input usx-input"
44
44
  id="django-memorable-date-day"
45
45
  name="memorable-date-day"
46
- value=""
47
46
  maxlength="2"
48
47
  pattern="[0-9]*"
49
48
  placeholder=""
@@ -63,7 +62,6 @@
63
62
  class="usa-input usx-input"
64
63
  id="django-memorable-date-year"
65
64
  name="memorable-date-year"
66
- value=""
67
65
  minlength="4"
68
66
  maxlength="4"
69
67
  pattern="[0-9]*"
@@ -128,7 +126,6 @@
128
126
  class="usa-input usx-input"
129
127
  id="django-memorable-date-disabled-day"
130
128
  name="memorable-date-disabled-day"
131
- value=""
132
129
  maxlength="2"
133
130
  pattern="[0-9]*"
134
131
  placeholder=""
@@ -149,7 +146,6 @@
149
146
  class="usa-input usx-input"
150
147
  id="django-memorable-date-disabled-year"
151
148
  name="memorable-date-disabled-year"
152
- value=""
153
149
  minlength="4"
154
150
  maxlength="4"
155
151
  pattern="[0-9]*"
@@ -217,7 +213,6 @@
217
213
  class="usa-input usx-input"
218
214
  id="django-memorable-date-aria-disabled-day"
219
215
  name="memorable-date-aria-disabled-day"
220
- value=""
221
216
  maxlength="2"
222
217
  pattern="[0-9]*"
223
218
  placeholder=""
@@ -240,7 +235,6 @@
240
235
  class="usa-input usx-input"
241
236
  id="django-memorable-date-aria-disabled-year"
242
237
  name="memorable-date-aria-disabled-year"
243
- value=""
244
238
  minlength="4"
245
239
  maxlength="4"
246
240
  pattern="[0-9]*"
@@ -310,7 +304,6 @@
310
304
  class="usa-input usx-input"
311
305
  id="django-memorable-date-required-day"
312
306
  name="memorable-date-required-day"
313
- value=""
314
307
  maxlength="2"
315
308
  pattern="[0-9]*"
316
309
  placeholder=""
@@ -333,7 +326,6 @@
333
326
  class="usa-input usx-input"
334
327
  id="django-memorable-date-required-year"
335
328
  name="memorable-date-required-year"
336
- value=""
337
329
  minlength="4"
338
330
  maxlength="4"
339
331
  pattern="[0-9]*"
@@ -44,7 +44,7 @@
44
44
  class="usa-input usx-input{% if error %} usa-input--error{% endif %}"
45
45
  id="{{ day_id }}"
46
46
  name="{{ dayName|default:day_id }}"
47
- value="{% if day is not None %}{{ day }}{% else %}{{ defaultDay|default:'' }}{% endif %}"
47
+ {% if day != None %}value="{{ day }}"{% elif defaultDay != None %}value="{{ defaultDay }}"{% endif %}
48
48
  maxlength="2"
49
49
  pattern="[0-9]*"
50
50
  placeholder=""
@@ -65,7 +65,7 @@
65
65
  class="usa-input usx-input{% if error %} usa-input--error{% endif %}"
66
66
  id="{{ year_id }}"
67
67
  name="{{ yearName|default:year_id }}"
68
- value="{% if year is not None %}{{ year }}{% else %}{{ defaultYear|default:'' }}{% endif %}"
68
+ {% if year != None %}value="{{ year }}"{% elif defaultYear != None %}value="{{ defaultYear }}"{% endif %}
69
69
  minlength="4"
70
70
  maxlength="4"
71
71
  pattern="[0-9]*"
@@ -16,7 +16,7 @@
16
16
  focusable="false"
17
17
  role="img"
18
18
  >
19
- <use href="./img/sprite.svg#arrow_forward"></use>
19
+ <use href="img/sprite.svg#arrow_forward"></use>
20
20
  </svg>
21
21
  Important Link
22
22
  </a>
@@ -40,7 +40,7 @@
40
40
  focusable="false"
41
41
  role="img"
42
42
  >
43
- <use href="./img/sprite.svg#expand_more"></use>
43
+ <use href="img/sprite.svg#expand_more"></use>
44
44
  </svg>
45
45
  </label>
46
46
  <div id="django-misc-banner-misc-dropdown" class="usx-misc-banner__dropdown-content">
@@ -80,7 +80,7 @@
80
80
  focusable="false"
81
81
  role="img"
82
82
  >
83
- <use href="./img/sprite.svg#arrow_forward"></use>
83
+ <use href="img/sprite.svg#arrow_forward"></use>
84
84
  </svg>
85
85
  Important Link
86
86
  </a>
@@ -104,7 +104,7 @@
104
104
  focusable="false"
105
105
  role="img"
106
106
  >
107
- <use href="./img/sprite.svg#expand_more"></use>
107
+ <use href="img/sprite.svg#expand_more"></use>
108
108
  </svg>
109
109
  </label>
110
110
  <div id="django-misc-banner-misc-dropdown" class="usx-misc-banner__dropdown-content">
@@ -144,7 +144,7 @@
144
144
  focusable="false"
145
145
  role="img"
146
146
  >
147
- <use href="./img/sprite.svg#undo"></use>
147
+ <use href="img/sprite.svg#undo"></use>
148
148
  </svg>
149
149
  Return to Classic Site
150
150
  </a>
@@ -168,7 +168,7 @@
168
168
  focusable="false"
169
169
  role="img"
170
170
  >
171
- <use href="./img/sprite.svg#expand_more"></use>
171
+ <use href="img/sprite.svg#expand_more"></use>
172
172
  </svg>
173
173
  </label>
174
174
  <div id="django-misc-banner-misc-dropdown" class="usx-misc-banner__dropdown-content">
@@ -204,7 +204,7 @@
204
204
  focusable="false"
205
205
  role="img"
206
206
  >
207
- <use href="./img/sprite.svg#trending_up"></use>
207
+ <use href="img/sprite.svg#trending_up"></use>
208
208
  </svg>
209
209
  Production Site
210
210
  </a>
@@ -228,7 +228,7 @@
228
228
  focusable="false"
229
229
  role="img"
230
230
  >
231
- <use href="./img/sprite.svg#expand_more"></use>
231
+ <use href="img/sprite.svg#expand_more"></use>
232
232
  </svg>
233
233
  </label>
234
234
  <div id="django-misc-banner-misc-dropdown" class="usx-misc-banner__dropdown-content">
@@ -258,7 +258,7 @@
258
258
  focusable="false"
259
259
  role="img"
260
260
  >
261
- <use href="./img/sprite.svg#trending_up"></use>
261
+ <use href="img/sprite.svg#trending_up"></use>
262
262
  </svg>
263
263
  Production Site
264
264
  </a>
@@ -282,7 +282,7 @@
282
282
  focusable="false"
283
283
  role="img"
284
284
  >
285
- <use href="./img/sprite.svg#expand_more"></use>
285
+ <use href="img/sprite.svg#expand_more"></use>
286
286
  </svg>
287
287
  </label>
288
288
  <div id="django-misc-banner-misc-dropdown" class="usx-misc-banner__dropdown-content">
@@ -323,7 +323,7 @@
323
323
  focusable="false"
324
324
  role="img"
325
325
  >
326
- <use href="./img/sprite.svg#arrow_forward"></use>
326
+ <use href="img/sprite.svg#arrow_forward"></use>
327
327
  </svg>
328
328
  Return to the main site
329
329
  </a>
@@ -347,7 +347,7 @@
347
347
  focusable="false"
348
348
  role="img"
349
349
  >
350
- <use href="./img/sprite.svg#expand_more"></use>
350
+ <use href="img/sprite.svg#expand_more"></use>
351
351
  </svg>
352
352
  </label>
353
353
  <div id="django-misc-banner-no-badge-dropdown" class="usx-misc-banner__dropdown-content">
@@ -1,4 +1,6 @@
1
1
  {# Django template for MiscBanner #}
2
+ {% load usx_components %}
3
+ {% asset_url 'img/sprite.svg' as spriteUrl %}
2
4
  <div {% if id %}id="{{ id }}" {% endif %}class="usx-misc-banner bg-{{ color|default:'beta' }}{% if className %} {{ className }}{% endif %}">
3
5
  <div class="usx-misc-banner__content grid-container">
4
6
  {% if content %}
@@ -17,7 +19,7 @@
17
19
  <span class="usx-misc-banner__return-text">
18
20
  <a class="usa-link usx-misc-banner__link" href="{{ importantLinkHref }}">
19
21
  <svg class="usa-icon usx-icon usx-icon--size-1" aria-hidden="true" focusable="false" role="img">
20
- <use href="./img/sprite.svg#{{ importantLinkIcon|default:'undo' }}"></use>
22
+ <use href="{{ spriteUrl }}#{{ importantLinkIcon|default:'undo' }}"></use>
21
23
  </svg>
22
24
  {{ importantLinkText }}
23
25
  </a>
@@ -38,7 +40,7 @@
38
40
  aria-label="Toggle banner links"
39
41
  >
40
42
  <svg class="usa-icon usx-icon usa-icon--size-4" aria-hidden="true" focusable="false" role="img">
41
- <use href="./img/sprite.svg#expand_more"></use>
43
+ <use href="{{ spriteUrl }}#expand_more"></use>
42
44
  </svg>
43
45
  </label>
44
46
  <div id="{{ dropdownBase }}-dropdown" class="usx-misc-banner__dropdown-content">
@@ -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 in the panel, before any children. */
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={initiallyOpen || undefined}
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('usx-popover__panel', {
89
- 'usx-popover__panel--square': panelShape === 'square',
90
- }, panelClassName)}
106
+ className={ClassNames(
107
+ 'usx-popover__panel',
108
+ {
109
+ 'usx-popover__panel--square': panelShape === 'square',
110
+ },
111
+ panelClassName
112
+ )}
91
113
  >
92
- {panelHeading && <Heading className="usx-popover__panel-heading">{panelHeading}</Heading>}
93
- {menuItems && <PopoverMenu items={menuItems} prefix={id} panelShape={panelShape} />}
94
- {children && (
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',