@solexllc/usx-react 0.12.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.
Files changed (97) hide show
  1. package/README.md +15 -0
  2. package/dist/{Popover-BzDCTuQM.cjs → Popover-Bg4-2-cU.cjs} +3 -0
  3. package/dist/{Popover-LToVWsWc.js → Popover-CqHczzNE.js} +3 -0
  4. package/dist/chat.cjs +7 -2
  5. package/dist/chat.js +7 -2
  6. package/dist/index.cjs +83 -56
  7. package/dist/index.js +86 -59
  8. package/package.json +4 -4
  9. package/src/components/accordion/Accordion.tsx +9 -57
  10. package/src/components/accordion/accordion.django.html +10 -20
  11. package/src/components/accordion/config.json +8 -2
  12. package/src/components/accordion-item/AccordionItem.tsx +54 -0
  13. package/src/components/accordion-item/accordion-item.django.html +19 -0
  14. package/src/components/accordion-item/accordion-item.html +8 -0
  15. package/src/components/accordion-item/config.json +55 -0
  16. package/src/components/alert/alert.django-snapshot.html +4 -4
  17. package/src/components/avatar/avatar.django-snapshot.html +6 -2
  18. package/src/components/avatar/avatar.react-snapshot.html +6 -3
  19. package/src/components/avatar/config.json +4 -2
  20. package/src/components/avatar-group/avatar-group.django-snapshot.html +176 -176
  21. package/src/components/avatar-group/avatar-group.react-snapshot.html +198 -167
  22. package/src/components/avatar-group/config.json +12 -6
  23. package/src/components/banner/banner.django-snapshot.html +2 -2
  24. package/src/components/button/Button.tsx +3 -0
  25. package/src/components/button/button.django-snapshot.html +64 -0
  26. package/src/components/button/button.django.html +2 -0
  27. package/src/components/button/button.react-snapshot.html +64 -0
  28. package/src/components/button/config.json +6 -1
  29. package/src/components/card/card.django-snapshot.html +43 -0
  30. package/src/components/card/card.react-snapshot.html +36 -0
  31. package/src/components/chat/chat.django-snapshot.html +90 -26
  32. package/src/components/chat/chat.html +10 -10
  33. package/src/components/chat/chat.react-snapshot.html +49 -49
  34. package/src/components/chat-composer/ChatComposer.tsx +3 -0
  35. package/src/components/chat-composer/chat-composer.django-snapshot.html +10 -10
  36. package/src/components/chat-composer/chat-composer.django.html +2 -2
  37. package/src/components/chat-composer/chat-composer.html +10 -10
  38. package/src/components/chat-composer/chat-composer.react-snapshot.html +10 -10
  39. package/src/components/chat-composer/chat-formatting.django.html +8 -8
  40. package/src/components/chat-window/ChatWindow.tsx +3 -1
  41. package/src/components/chat-window/chat-window.django-snapshot.html +7 -5
  42. package/src/components/chat-window/chat-window.django.html +3 -3
  43. package/src/components/chat-window/chat-window.html +1 -1
  44. package/src/components/chat-window/chat-window.react-snapshot.html +7 -7
  45. package/src/components/checkbox/checkbox.django-snapshot.html +2 -2
  46. package/src/components/data-table/data-table.django-snapshot.html +4 -5
  47. package/src/components/data-table/data-table.react-snapshot.html +4 -4
  48. package/src/components/drawer/drawer.django-snapshot.html +53 -30
  49. package/src/components/error-page/error-page.django-snapshot.html +20 -7
  50. package/src/components/fieldset/fieldset.django-snapshot.html +1 -6
  51. package/src/components/form-group/form-group.django-snapshot.html +0 -2
  52. package/src/components/header/header.django-snapshot.html +3 -3
  53. package/src/components/header/header.html +1 -1
  54. package/src/components/header/header.react-snapshot.html +3 -3
  55. package/src/components/identifier/config.json +4 -2
  56. package/src/components/identifier/identifier.django-snapshot.html +13 -16
  57. package/src/components/identifier/identifier.react-snapshot.html +13 -15
  58. package/src/components/image/image.django-snapshot.html +6 -6
  59. package/src/components/layout/layout.django-snapshot.html +2 -0
  60. package/src/components/modal/Modal.tsx +4 -3
  61. package/src/components/modal/config.json +3 -2
  62. package/src/components/modal/modal.django-snapshot.html +70 -14
  63. package/src/components/modal/modal.django.html +7 -9
  64. package/src/components/modal/modal.html +4 -4
  65. package/src/components/modal/modal.react-snapshot.html +64 -4
  66. package/src/components/page/Page.tsx +10 -7
  67. package/src/components/page/page.django-snapshot.html +5 -8
  68. package/src/components/page/page.django.html +2 -2
  69. package/src/components/page/page.html +1 -2
  70. package/src/components/page/page.react-snapshot.html +5 -8
  71. package/src/components/pagination/navigation/PaginationNavigation.tsx +2 -0
  72. package/src/components/pagination/navigation/pagination-navigation.django.html +2 -0
  73. package/src/components/pagination/pagination.django-snapshot.html +62 -0
  74. package/src/components/pagination/pagination.django.html +3 -1
  75. package/src/components/pagination/pagination.html +46 -0
  76. package/src/components/pagination/pagination.react-snapshot.html +48 -0
  77. package/src/components/pagination/summary/PaginationSummary.tsx +1 -1
  78. package/src/components/pagination/summary/pagination-summary.django.html +1 -1
  79. package/src/components/popover/Popover.tsx +1 -0
  80. package/src/components/popover/popover.django-snapshot.html +37 -1
  81. package/src/components/popover/popover.django.html +1 -1
  82. package/src/components/popover/popover.react-snapshot.html +30 -3
  83. package/src/components/section/Section.tsx +3 -1
  84. package/src/components/site-alert/site-alert.django-snapshot.html +8 -8
  85. package/src/components/swap/Swap.tsx +35 -3
  86. package/src/components/swap/config.json +28 -1
  87. package/src/components/swap/swap.django-snapshot.html +29 -7
  88. package/src/components/swap/swap.django.html +15 -1
  89. package/src/components/swap/swap.react-snapshot.html +34 -4
  90. package/src/components/theme-picker/ThemePicker.tsx +48 -42
  91. package/src/components/theme-picker/config.json +27 -29
  92. package/src/components/theme-picker/theme-picker-select.django.html +1 -1
  93. package/src/components/theme-picker/theme-picker.django-snapshot.html +283 -78
  94. package/src/components/theme-picker/theme-picker.django.html +24 -11
  95. package/src/components/theme-picker/theme-picker.html +155 -54
  96. package/src/components/theme-picker/theme-picker.react-snapshot.html +265 -67
  97. package/src/index.js +1 -0
@@ -521,6 +521,7 @@
521
521
 
522
522
  <section class="usx-page bg-surface-1">
523
523
  <h1 class="usx-page__title">H1 Page heading</h1>
524
+
524
525
  <div class="usx-page__content">
525
526
  <div class="usa-prose">
526
527
  <h2>H2 Section heading</h2>
@@ -561,6 +562,7 @@
561
562
 
562
563
  <section class="usx-page bg-surface-1">
563
564
  <h1 class="usx-page__title">H1 Page heading</h1>
565
+
564
566
  <div class="usx-page__content">
565
567
  <div class="usa-prose">
566
568
  <h2>H2 Section heading</h2>
@@ -22,7 +22,7 @@ export default function Modal({
22
22
  description,
23
23
  actionProps = [
24
24
  { children: 'Continue', variant: 'primary', extraAttributes: { 'data-close-modal': true } },
25
- { children: 'Go back', variant: 'unstyled', className: 'padding-105 text-center', extraAttributes: { 'data-close-modal': true } },
25
+ { children: 'Go back', variant: 'unstyled', tighten: true, className: 'text-center', extraAttributes: { 'data-close-modal': true } },
26
26
  ],
27
27
  size = 'default',
28
28
  forceAction = false,
@@ -35,6 +35,7 @@ export default function Modal({
35
35
  'usa-modal--lg': size === 'lg',
36
36
  'usx-modal--lg-collapsed': size === 'lg-collapsed',
37
37
  }, className);
38
+ const hasChildren = children != null;
38
39
 
39
40
  return (
40
41
  <div
@@ -51,8 +52,8 @@ export default function Modal({
51
52
  <h2 className="usa-modal__heading" id={`${id}-heading`}>
52
53
  {heading}
53
54
  </h2>
54
- <Prose>
55
- <p id={`${id}-description`}>{children ?? description}</p>
55
+ <Prose id={hasChildren ? `${id}-description` : undefined}>
56
+ {hasChildren ? <>{children}</> : <p id={`${id}-description`}>{description}</p>}
56
57
  </Prose>
57
58
  <div className="usa-modal__footer">
58
59
  <ButtonGroup buttonProps={actionProps} />
@@ -17,7 +17,8 @@
17
17
  {
18
18
  "children": "Go back",
19
19
  "variant": "unstyled",
20
- "className": "padding-105 text-center",
20
+ "tighten": true,
21
+ "className": "text-center",
21
22
  "extraAttributes": {
22
23
  "data-close-modal": true
23
24
  }
@@ -69,7 +70,7 @@
69
70
  "children": {
70
71
  "type": "slot",
71
72
  "default": null,
72
- "description": "Inner HTML to render as the modal body, replacing the description text."
73
+ "description": "Content rendered directly inside the prose container, replacing the description paragraph. Include paragraphs or other block elements as needed; assistive technology may announce the body as a single description."
73
74
  },
74
75
  "className": {
75
76
  "type": "string",
@@ -19,13 +19,11 @@
19
19
  <h2 class="usa-modal__heading" id="django-example-modal-default-heading">
20
20
  Are you sure you want to continue?
21
21
  </h2>
22
-
23
22
  <div class="usa-prose usx-prose">
24
23
  <p id="django-example-modal-default-description">
25
24
  You have unsaved changes that will be lost.
26
25
  </p>
27
26
  </div>
28
-
29
27
  <div class="usa-modal__footer">
30
28
  <ul class="usa-button-group usx-button-group">
31
29
  <li class="usa-button-group__item">
@@ -41,7 +39,7 @@
41
39
  <li class="usa-button-group__item">
42
40
  <button
43
41
  type="button"
44
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
42
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
45
43
  data-close-modal="true"
46
44
  >
47
45
  Go back
@@ -85,11 +83,9 @@
85
83
  <h2 class="usa-modal__heading" id="django-example-modal-lg-heading">
86
84
  Are you sure you want to continue?
87
85
  </h2>
88
-
89
86
  <div class="usa-prose usx-prose">
90
87
  <p id="django-example-modal-lg-description">You have unsaved changes that will be lost.</p>
91
88
  </div>
92
-
93
89
  <div class="usa-modal__footer">
94
90
  <ul class="usa-button-group usx-button-group">
95
91
  <li class="usa-button-group__item">
@@ -105,7 +101,7 @@
105
101
  <li class="usa-button-group__item">
106
102
  <button
107
103
  type="button"
108
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
104
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
109
105
  data-close-modal="true"
110
106
  >
111
107
  Go back
@@ -149,13 +145,11 @@
149
145
  <h2 class="usa-modal__heading" id="django-example-modal-lg-collapsed-heading">
150
146
  Are you sure you want to continue?
151
147
  </h2>
152
-
153
148
  <div class="usa-prose usx-prose">
154
149
  <p id="django-example-modal-lg-collapsed-description">
155
150
  You have unsaved changes that will be lost.
156
151
  </p>
157
152
  </div>
158
-
159
153
  <div class="usa-modal__footer">
160
154
  <ul class="usa-button-group usx-button-group">
161
155
  <li class="usa-button-group__item">
@@ -171,7 +165,7 @@
171
165
  <li class="usa-button-group__item">
172
166
  <button
173
167
  type="button"
174
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
168
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
175
169
  data-close-modal="true"
176
170
  >
177
171
  Go back
@@ -216,14 +210,12 @@
216
210
  <h2 class="usa-modal__heading" id="django-example-modal-force-heading">
217
211
  Your session will end soon.
218
212
  </h2>
219
-
220
213
  <div class="usa-prose usx-prose">
221
214
  <p id="django-example-modal-force-description">
222
- You've been inactive for too long. Please choose to stay signed in or sign out. Otherwise,
223
- you'll be signed out automatically in 5 minutes.
215
+ You&#x27;ve been inactive for too long. Please choose to stay signed in or sign out.
216
+ Otherwise, you&#x27;ll be signed out automatically in 5 minutes.
224
217
  </p>
225
218
  </div>
226
-
227
219
  <div class="usa-modal__footer">
228
220
  <ul class="usa-button-group usx-button-group">
229
221
  <li class="usa-button-group__item">
@@ -239,7 +231,7 @@
239
231
  <li class="usa-button-group__item">
240
232
  <button
241
233
  type="button"
242
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
234
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
243
235
  data-close-modal="true"
244
236
  >
245
237
  Sign out
@@ -250,3 +242,67 @@
250
242
  </div>
251
243
  </div>
252
244
  </div>
245
+
246
+ <h3 class="site-preview-heading">Rich Content</h3>
247
+ <a
248
+ href="#django-example-modal-rich"
249
+ class="usa-button usx-button usa-button--outline"
250
+ aria-controls="django-example-modal-rich"
251
+ data-open-modal="true"
252
+ >
253
+ Open modal with rich content
254
+ </a>
255
+
256
+ <div
257
+ class="usa-modal usx-modal"
258
+ id="django-example-modal-rich"
259
+ aria-labelledby="django-example-modal-rich-heading"
260
+ aria-describedby="django-example-modal-rich-description"
261
+ >
262
+ <div class="usa-modal__content">
263
+ <div class="usa-modal__main">
264
+ <h2 class="usa-modal__heading" id="django-example-modal-rich-heading">Review your request</h2>
265
+ <div class="usa-prose usx-prose" id="django-example-modal-rich-description">
266
+ <p>Check the following items before continuing.</p>
267
+ <ul>
268
+ <li>Contact information</li>
269
+ <li>Supporting documents</li>
270
+ </ul>
271
+ </div>
272
+ <div class="usa-modal__footer">
273
+ <ul class="usa-button-group usx-button-group">
274
+ <li class="usa-button-group__item">
275
+ <button
276
+ type="button"
277
+ class="usa-button usx-button usa-button--primary"
278
+ data-close-modal="true"
279
+ >
280
+ Continue without saving
281
+ </button>
282
+ </li>
283
+
284
+ <li class="usa-button-group__item">
285
+ <button
286
+ type="button"
287
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
288
+ data-close-modal="true"
289
+ >
290
+ Go back
291
+ </button>
292
+ </li>
293
+ </ul>
294
+ </div>
295
+ </div>
296
+
297
+ <button
298
+ type="button"
299
+ class="usa-button usa-modal__close"
300
+ aria-label="Close this window"
301
+ data-close-modal="true"
302
+ >
303
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
304
+ <use href="img/sprite.svg#close"></use>
305
+ </svg>
306
+ </button>
307
+ </div>
308
+ </div>
@@ -12,15 +12,13 @@
12
12
  <h2 class="usa-modal__heading" id="{{ id }}-heading">
13
13
  {{ heading|default:"Are you sure you want to continue?" }}
14
14
  </h2>
15
- {% prose %}
16
- <p id="{{ id }}-description">
17
- {% if children %}
18
- {{ children|safe }}
19
- {% else %}
20
- {{ description|default:"You have unsaved changes that will be lost." }}
21
- {% endif %}
22
- </p>
23
- {% endprose %}
15
+ <div class="usa-prose usx-prose"{% if children is not None %} id="{{ id }}-description"{% endif %}>
16
+ {% if children is not None %}
17
+ {% if children and children is not True or children == 0 and children is not False %}{{ children|safe }}{% endif %}
18
+ {% else %}
19
+ <p id="{{ id }}-description">{{ description|default:"You have unsaved changes that will be lost." }}</p>
20
+ {% endif %}
21
+ </div>
24
22
  <div class="usa-modal__footer">
25
23
  {% button_group buttonProps=actionProps %}{% endbutton_group %}
26
24
  </div>
@@ -32,7 +32,7 @@
32
32
  <li class="usa-button-group__item">
33
33
  <button
34
34
  type="button"
35
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
35
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
36
36
  data-close-modal
37
37
  >
38
38
  Go back
@@ -90,7 +90,7 @@
90
90
  <li class="usa-button-group__item">
91
91
  <button
92
92
  type="button"
93
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
93
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
94
94
  data-close-modal
95
95
  >
96
96
  Go back
@@ -148,7 +148,7 @@
148
148
  <li class="usa-button-group__item">
149
149
  <button
150
150
  type="button"
151
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
151
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
152
152
  data-close-modal
153
153
  >
154
154
  Go back
@@ -208,7 +208,7 @@
208
208
  <li class="usa-button-group__item">
209
209
  <button
210
210
  type="button"
211
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
211
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
212
212
  data-close-modal
213
213
  >
214
214
  Sign out
@@ -36,7 +36,7 @@
36
36
  <li class="usa-button-group__item">
37
37
  <button
38
38
  type="button"
39
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
39
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
40
40
  data-close-modal="true"
41
41
  >
42
42
  Go back
@@ -94,7 +94,7 @@
94
94
  <li class="usa-button-group__item">
95
95
  <button
96
96
  type="button"
97
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
97
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
98
98
  data-close-modal="true"
99
99
  >
100
100
  Go back
@@ -154,7 +154,7 @@
154
154
  <li class="usa-button-group__item">
155
155
  <button
156
156
  type="button"
157
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
157
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
158
158
  data-close-modal="true"
159
159
  >
160
160
  Go back
@@ -216,7 +216,7 @@
216
216
  <li class="usa-button-group__item">
217
217
  <button
218
218
  type="button"
219
- class="usa-button usx-button usa-button--unstyled padding-105 text-center"
219
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
220
220
  data-close-modal="true"
221
221
  >
222
222
  Sign out
@@ -227,3 +227,63 @@
227
227
  </div>
228
228
  </div>
229
229
  </div>
230
+
231
+ <h3 class="site-preview-heading">Rich Content</h3>
232
+ <a
233
+ class="usa-button usx-button usa-button--outline"
234
+ href="#react-example-modal-rich"
235
+ aria-controls="react-example-modal-rich"
236
+ data-open-modal="true"
237
+ >Open modal with rich content</a
238
+ >
239
+ <div
240
+ class="usa-modal usx-modal"
241
+ id="react-example-modal-rich"
242
+ aria-labelledby="react-example-modal-rich-heading"
243
+ aria-describedby="react-example-modal-rich-description"
244
+ >
245
+ <div class="usa-modal__content">
246
+ <div class="usa-modal__main">
247
+ <h2 class="usa-modal__heading" id="react-example-modal-rich-heading">Review your request</h2>
248
+ <div class="usa-prose usx-prose" id="react-example-modal-rich-description">
249
+ <p>Check the following items before continuing.</p>
250
+ <ul>
251
+ <li>Contact information</li>
252
+ <li>Supporting documents</li>
253
+ </ul>
254
+ </div>
255
+ <div class="usa-modal__footer">
256
+ <ul class="usa-button-group usx-button-group">
257
+ <li class="usa-button-group__item">
258
+ <button
259
+ type="button"
260
+ class="usa-button usx-button usa-button--primary"
261
+ data-close-modal="true"
262
+ >
263
+ Continue without saving
264
+ </button>
265
+ </li>
266
+ <li class="usa-button-group__item">
267
+ <button
268
+ type="button"
269
+ class="usa-button usx-button usa-button--unstyled usx-button--tight text-center"
270
+ data-close-modal="true"
271
+ >
272
+ Go back
273
+ </button>
274
+ </li>
275
+ </ul>
276
+ </div>
277
+ </div>
278
+ <button
279
+ type="button"
280
+ class="usa-button usa-modal__close"
281
+ aria-label="Close this window"
282
+ data-close-modal="true"
283
+ >
284
+ <svg class="usa-icon usx-icon" aria-hidden="true" focusable="false" role="img">
285
+ <use href="/img/sprite.svg#close"></use>
286
+ </svg>
287
+ </button>
288
+ </div>
289
+ </div>
@@ -4,7 +4,7 @@ import TagGroup from '../tag-group/TagGroup';
4
4
  import type { TagProps } from '../tag/Tag';
5
5
 
6
6
  export interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title' | 'content'> {
7
- title?: React.ReactNode;
7
+ title: Exclude<React.ReactNode, null | undefined | boolean>;
8
8
  titleId?: string;
9
9
  eyebrow?: React.ReactNode;
10
10
  subtitle?: string;
@@ -18,7 +18,7 @@ export interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, 'titl
18
18
 
19
19
  export default function Page({
20
20
  id = undefined,
21
- title = 'Page title',
21
+ title,
22
22
  titleId = undefined,
23
23
  eyebrow = null,
24
24
  subtitle = undefined,
@@ -35,8 +35,9 @@ export default function Page({
35
35
  const hasSummary = Boolean(subtitle || description || tagProps?.length);
36
36
  const classes = ClassNames('usx-page', className);
37
37
  const pageContent = children || content;
38
+ const hasTitle = (Boolean(title) && typeof title !== 'boolean') || title === 0;
38
39
 
39
- const labelledBy = ariaLabelledby || titleId || undefined;
40
+ const labelledBy = ariaLabelledby || (hasTitle ? titleId : undefined);
40
41
 
41
42
  return (
42
43
  <Element
@@ -46,10 +47,12 @@ export default function Page({
46
47
  aria-labelledby={labelledBy}
47
48
  {...props}
48
49
  >
49
- <h1 id={titleId} className="usx-page__title">
50
- {eyebrow ? <span className="usx-eyebrow">{eyebrow}</span> : null}
51
- {title}
52
- </h1>
50
+ {hasTitle && (
51
+ <h1 id={titleId} className="usx-page__title">
52
+ {eyebrow && typeof eyebrow !== 'boolean' ? <span className="usx-eyebrow">{eyebrow}</span> : null}
53
+ {title}
54
+ </h1>
55
+ )}
53
56
  {hasSummary && (
54
57
  <div className="usx-page__summary">
55
58
  {subtitle && <p className="usx-page__subtitle">{subtitle}</p>}
@@ -21,10 +21,7 @@
21
21
  Teams can compose this with Header and Footer components to keep page layout and heading
22
22
  semantics consistent.
23
23
  </p>
24
- <p>
25
- Because the title is always rendered as an h1, each page has a clear top-level heading by
26
- default.
27
- </p>
24
+ <p>Provide a descriptive title to give the page a clear top-level heading.</p>
28
25
  </div>
29
26
  </main>
30
27
 
@@ -74,9 +71,9 @@
74
71
 
75
72
  <div class="usx-page__summary">
76
73
  <div class="usx-tag-group usx-page__tags">
77
- <span class="usa-tag usx-tag"> New </span>
74
+ <span class="usa-tag usx-tag bg-accent-cool"> New </span>
78
75
 
79
- <span class="usa-tag usx-tag usx-tag--outline"> Public notice </span>
76
+ <span class="usa-tag usx-tag bg-accent-warm"> Public notice </span>
80
77
  </div>
81
78
  </div>
82
79
 
@@ -95,9 +92,9 @@
95
92
  <div class="usx-page__summary">
96
93
  <p class="usx-page__subtitle">Support for local projects</p>
97
94
  <div class="usx-tag-group usx-page__tags">
98
- <span class="usa-tag usx-tag"> Open </span>
95
+ <span class="usa-tag usx-tag bg-success"> Open </span>
99
96
 
100
- <span class="usa-tag usx-tag usx-tag--outline"> Applications close June 30 </span>
97
+ <span class="usa-tag usx-tag bg-cyan"> Applications close June 30 </span>
101
98
  </div>
102
99
  <p class="usx-page__description">Find grants that help communities plan, build, and grow.</p>
103
100
  </div>
@@ -1,8 +1,8 @@
1
1
  {# Django template for Page #}
2
2
  {% load usx_components %}
3
3
  {% with pageTag=as|default:'main' %}
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 %}>
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>
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 %} aria-labelledby="{{ ariaLabelledby }}"{% elif titleId and title and title is not True or titleId and title == 0 and title is not False %} aria-labelledby="{{ titleId }}"{% endif %}>
5
+ {% if title and title is not True or title == 0 and title is not False %}<h1{% if titleId %} id="{{ titleId }}"{% endif %} class="usx-page__title">{% if eyebrow and eyebrow is not True %}<span class="usx-eyebrow">{{ eyebrow }}</span>{% endif %}{{ title }}</h1>{% endif %}
6
6
  {% if subtitle or description or tagProps %}
7
7
  <div class="usx-page__summary">
8
8
  {% if subtitle %}<p class="usx-page__subtitle">{{ subtitle }}</p>{% endif %}
@@ -20,8 +20,7 @@
20
20
  semantics consistent.
21
21
  </p>
22
22
  <p>
23
- Because the title is always rendered as an h1, each page has a clear top-level heading by
24
- default.
23
+ Provide a descriptive title to give the page a clear top-level heading.
25
24
  </p>
26
25
  </div>
27
26
  </main>
@@ -19,10 +19,7 @@
19
19
  Teams can compose this with Header and Footer components to keep page layout and heading
20
20
  semantics consistent.
21
21
  </p>
22
- <p>
23
- Because the title is always rendered as an h1, each page has a clear top-level heading by
24
- default.
25
- </p>
22
+ <p>Provide a descriptive title to give the page a clear top-level heading.</p>
26
23
  </div>
27
24
  </main>
28
25
 
@@ -66,8 +63,8 @@
66
63
  <h1 class="usx-page__title">Program updates</h1>
67
64
  <div class="usx-page__summary">
68
65
  <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>
66
+ <span class="usa-tag usx-tag bg-accent-cool"> New</span
67
+ ><span class="usa-tag usx-tag bg-accent-warm"> Public notice</span>
71
68
  </div>
72
69
  </div>
73
70
  <div class="usx-page__content">
@@ -84,8 +81,8 @@
84
81
  <div class="usx-page__summary">
85
82
  <p class="usx-page__subtitle">Support for local projects</p>
86
83
  <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>
84
+ <span class="usa-tag usx-tag bg-success"> Open</span
85
+ ><span class="usa-tag usx-tag bg-cyan"> Applications close June 30</span>
89
86
  </div>
90
87
  <p class="usx-page__description">Find grants that help communities plan, build, and grow.</p>
91
88
  </div>
@@ -21,6 +21,7 @@ export function getPageItems(currentPage: number, totalPages: number) {
21
21
  const page = (p: number) => ({ type: 'page' as const, page: p });
22
22
  const ellipsis = (key: string) => ({ type: 'ellipsis' as const, key });
23
23
 
24
+ if (totalPages <= 1) return [];
24
25
  if (totalPages <= 7) {
25
26
  return Array.from({ length: totalPages }, (_, i) => page(i + 1));
26
27
  }
@@ -80,6 +81,7 @@ export default function PaginationNavigation({
80
81
  onPageChange,
81
82
  }: PaginationNavigationProps) {
82
83
  const unbounded = totalPages === undefined || totalPages === null;
84
+ if (!unbounded && totalPages <= 1) return null;
83
85
  const items = unbounded
84
86
  ? getUnboundedPageItems(currentPage)
85
87
  : getPageItems(currentPage, totalPages!);
@@ -2,6 +2,7 @@
2
2
  {% load usx_components %}
3
3
  {# Props: currentPage, totalPages, pages, unbounded, arrowsOnly, #}
4
4
  {# prevLabel, nextLabel, hideLinkText, ariaLabel, pageUrlPrefix #}
5
+ {% if unbounded or totalPages > 1 %}
5
6
  <nav aria-label="{{ ariaLabel }}" class="usa-pagination usx-pagination__nav{% if arrowsOnly %} usx-pagination__arrows-only{% endif %}" data-usx-pagination-current-page="{{ currentPage }}" data-usx-pagination-page-size="{{ pageSize|default:10 }}" data-usx-pagination-total-items="{{ totalItems|default_if_none:'' }}">
6
7
  <ul class="usa-pagination__list">
7
8
 
@@ -55,3 +56,4 @@
55
56
 
56
57
  </ul>
57
58
  </nav>
59
+ {% endif %}
@@ -1079,6 +1079,68 @@
1079
1079
  </div>
1080
1080
  </div>
1081
1081
 
1082
+ <h3 class="site-preview-heading">Single Page</h3>
1083
+ <div class="usx-pagination">
1084
+ <div class="usx-pagination__container">
1085
+ <div class="usx-pagination__container-summary">
1086
+ <p class="usa-label usx-label usx-pagination__summary" aria-live="polite" aria-atomic="true">
1087
+ Showing <strong>1–8</strong> of <strong>8</strong> items
1088
+ </p>
1089
+ </div>
1090
+
1091
+ <div class="usx-pagination__container-end">
1092
+ <div class="usx-pagination__step-options">
1093
+ <label class="usa-label usx-label" for="django-pagination-single-page-step-options">
1094
+ Items per page
1095
+ </label>
1096
+
1097
+ <select class="usa-select usx-select" id="django-pagination-single-page-step-options">
1098
+ <option value="">Select an option</option>
1099
+
1100
+ <option value="10" selected>10</option>
1101
+
1102
+ <option value="25">25</option>
1103
+
1104
+ <option value="50">50</option>
1105
+
1106
+ <option value="100">100</option>
1107
+ </select>
1108
+ </div>
1109
+ </div>
1110
+ </div>
1111
+ </div>
1112
+
1113
+ <h3 class="site-preview-heading">No Results</h3>
1114
+ <div class="usx-pagination">
1115
+ <div class="usx-pagination__container">
1116
+ <div class="usx-pagination__container-summary">
1117
+ <p class="usa-label usx-label usx-pagination__summary" aria-live="polite" aria-atomic="true">
1118
+ Showing <strong>0–0</strong> of <strong>0</strong> items
1119
+ </p>
1120
+ </div>
1121
+
1122
+ <div class="usx-pagination__container-end">
1123
+ <div class="usx-pagination__step-options">
1124
+ <label class="usa-label usx-label" for="django-pagination-no-results-step-options">
1125
+ Items per page
1126
+ </label>
1127
+
1128
+ <select class="usa-select usx-select" id="django-pagination-no-results-step-options">
1129
+ <option value="">Select an option</option>
1130
+
1131
+ <option value="10" selected>10</option>
1132
+
1133
+ <option value="25">25</option>
1134
+
1135
+ <option value="50">50</option>
1136
+
1137
+ <option value="100">100</option>
1138
+ </select>
1139
+ </div>
1140
+ </div>
1141
+ </div>
1142
+ </div>
1143
+
1082
1144
  <h3 class="site-preview-heading">First Page</h3>
1083
1145
  <div class="usx-pagination">
1084
1146
  <div class="usx-pagination__container">
@@ -33,7 +33,7 @@
33
33
  <div class="usx-pagination__container">
34
34
 
35
35
  {# ── Summary (left slot) ───────────────────────────────── #}
36
- {% if totalItems %}
36
+ {% if totalItems is not None %}
37
37
  {% if showSummary != False and showSummary != "false" %}
38
38
  <div class="usx-pagination__container-summary">
39
39
  {% pagination_summary firstItem=firstItem lastItem=lastItem currentPage=resolvedPage pageSize=resolvedPageSize totalItems=totalItems itemLabel=itemLabel|default:"items" %}{% endpagination_summary %}
@@ -42,6 +42,7 @@
42
42
  {% endif %}
43
43
 
44
44
  {# ── Nav + step options (right slot) ─────────────────── #}
45
+ {% if showStepOptions != False or unbounded or totalPages > 1 %}
45
46
  <div class="usx-pagination__container-end">
46
47
 
47
48
  {% if showStepOptions != False %}
@@ -51,6 +52,7 @@
51
52
  {% pagination_navigation currentPage=resolvedPage totalPages=totalPages pages=pages unbounded=unbounded arrowsOnly=arrowsOnly prevLabel=prevLabel|default:"Previous" nextLabel=nextLabel|default:"Next" hideLinkText=hideLinkText|default_if_none:True ariaLabel=ariaLabel|default:"Pagination" pageUrlPrefix=pageUrlPrefix pageSize=resolvedPageSize totalItems=totalItems %}{% endpagination_navigation %}
52
53
 
53
54
  </div>
55
+ {% endif %}
54
56
 
55
57
  </div>
56
58
  </div>