@solexllc/usx-react 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/README.md +6 -5
  2. package/dist/index.cjs +245 -162
  3. package/dist/index.js +246 -163
  4. package/package.json +4 -4
  5. package/src/components/accordion/Accordion.tsx +4 -1
  6. package/src/components/accordion/accordion.django.html +1 -1
  7. package/src/components/accordion/config.json +1 -0
  8. package/src/components/banner/Banner.tsx +3 -1
  9. package/src/components/banner/banner.django.html +1 -1
  10. package/src/components/banner/config.json +1 -0
  11. package/src/components/carousel/carousel.django-snapshot.html +0 -40
  12. package/src/components/carousel/carousel.react-snapshot.html +0 -38
  13. package/src/components/character-count/CharacterCount.tsx +3 -0
  14. package/src/components/character-count/character-count.django-snapshot.html +43 -0
  15. package/src/components/character-count/character-count.django.html +2 -2
  16. package/src/components/character-count/character-count.react-snapshot.html +37 -0
  17. package/src/components/character-count/config.json +9 -0
  18. package/src/components/checkbox/Checkbox.tsx +16 -17
  19. package/src/components/checkbox/checkbox.django-snapshot.html +18 -0
  20. package/src/components/checkbox/checkbox.django.html +6 -4
  21. package/src/components/checkbox/checkbox.react-snapshot.html +14 -0
  22. package/src/components/checkbox/config.json +4 -4
  23. package/src/components/checkbox-group/checkbox-group.django-snapshot.html +54 -0
  24. package/src/components/checkbox-group/checkbox-group.react-snapshot.html +45 -0
  25. package/src/components/code/code.django-snapshot.html +4 -6
  26. package/src/components/code/code.html +2 -2
  27. package/src/components/code/code.react-snapshot.html +2 -4
  28. package/src/components/combobox/Combobox.tsx +6 -1
  29. package/src/components/combobox/combobox.django-snapshot.html +141 -0
  30. package/src/components/combobox/combobox.django.html +2 -2
  31. package/src/components/combobox/combobox.react-snapshot.html +76 -0
  32. package/src/components/combobox/config.json +9 -0
  33. package/src/components/data-table/DataTable.tsx +4 -1
  34. package/src/components/data-table/config.json +4 -0
  35. package/src/components/data-table/data-table.django.html +1 -1
  36. package/src/components/date-picker/DatePicker.tsx +6 -1
  37. package/src/components/date-picker/config.json +9 -0
  38. package/src/components/date-picker/date-picker.django-snapshot.html +23 -0
  39. package/src/components/date-picker/date-picker.django.html +4 -4
  40. package/src/components/date-picker/date-picker.react-snapshot.html +19 -0
  41. package/src/components/date-range-picker/DateRangePicker.tsx +11 -2
  42. package/src/components/date-range-picker/config.json +14 -0
  43. package/src/components/date-range-picker/date-range-picker.django-snapshot.html +47 -0
  44. package/src/components/date-range-picker/date-range-picker.django.html +5 -5
  45. package/src/components/date-range-picker/date-range-picker.react-snapshot.html +38 -0
  46. package/src/components/drawer/Drawer.tsx +3 -1
  47. package/src/components/drawer/config.json +4 -0
  48. package/src/components/drawer/drawer.django.html +1 -1
  49. package/src/components/file-input/FileInput.tsx +7 -2
  50. package/src/components/file-input/_contents.django.html +2 -1
  51. package/src/components/file-input/config.json +4 -0
  52. package/src/components/header/Header.tsx +15 -9
  53. package/src/components/header/config.json +1 -0
  54. package/src/components/header/header.django-snapshot.html +29 -7
  55. package/src/components/header/header.django.html +8 -4
  56. package/src/components/header/header.html +21 -11
  57. package/src/components/header/header.react-snapshot.html +23 -6
  58. package/src/components/icon-list/IconList.tsx +10 -2
  59. package/src/components/icon-list/config.json +5 -1
  60. package/src/components/icon-list/icon-list.django-snapshot.html +39 -0
  61. package/src/components/icon-list/icon-list.django.html +2 -0
  62. package/src/components/icon-list/icon-list.react-snapshot.html +31 -0
  63. package/src/components/in-page-nav/InPageNav.tsx +3 -0
  64. package/src/components/in-page-nav/config.json +1 -0
  65. package/src/components/in-page-nav/in-page-nav.django.html +1 -1
  66. package/src/components/input/Input.tsx +3 -0
  67. package/src/components/input/config.json +10 -0
  68. package/src/components/input/input.django-snapshot.html +24 -0
  69. package/src/components/input/input.django.html +4 -4
  70. package/src/components/input/input.react-snapshot.html +22 -0
  71. package/src/components/language-selector/LanguageSelector.tsx +10 -5
  72. package/src/components/language-selector/config.json +1 -0
  73. package/src/components/language-selector/language-selector.django.html +2 -2
  74. package/src/components/layout/Layout.tsx +3 -1
  75. package/src/components/layout/config.json +4 -0
  76. package/src/components/layout/layout.django.html +1 -1
  77. package/src/components/list/List.tsx +10 -2
  78. package/src/components/list/config.json +5 -1
  79. package/src/components/list/list.django-snapshot.html +26 -0
  80. package/src/components/list/list.django.html +2 -0
  81. package/src/components/list/list.html +20 -0
  82. package/src/components/list/list.react-snapshot.html +20 -0
  83. package/src/components/memorable-date/MemorableDate.tsx +18 -3
  84. package/src/components/memorable-date/config.json +15 -0
  85. package/src/components/memorable-date/memorable-date.django-snapshot.html +82 -0
  86. package/src/components/memorable-date/memorable-date.django.html +14 -14
  87. package/src/components/memorable-date/memorable-date.react-snapshot.html +70 -0
  88. package/src/components/modal/Modal.tsx +3 -0
  89. package/src/components/modal/config.json +1 -0
  90. package/src/components/modal/modal.django.html +1 -1
  91. package/src/components/page/Page.tsx +16 -0
  92. package/src/components/page/config.json +18 -1
  93. package/src/components/page/page.django-snapshot.html +74 -0
  94. package/src/components/page/page.django.html +8 -0
  95. package/src/components/page/page.html +60 -0
  96. package/src/components/page/page.react-snapshot.html +60 -0
  97. package/src/components/popover/Popover.tsx +3 -0
  98. package/src/components/popover/config.json +4 -0
  99. package/src/components/popover/popover.django-snapshot.html +30 -0
  100. package/src/components/popover/popover.django.html +1 -0
  101. package/src/components/radio-buttons/RadioButtons.tsx +5 -1
  102. package/src/components/radio-buttons/radio-buttons.django-snapshot.html +65 -0
  103. package/src/components/radio-buttons/radio-buttons.django.html +1 -1
  104. package/src/components/radio-buttons/radio-buttons.react-snapshot.html +53 -0
  105. package/src/components/range-slider/RangeSlider.tsx +4 -2
  106. package/src/components/range-slider/config.json +1 -0
  107. package/src/components/range-slider/range-slider.django-snapshot.html +17 -0
  108. package/src/components/range-slider/range-slider.django.html +4 -4
  109. package/src/components/range-slider/range-slider.react-snapshot.html +16 -0
  110. package/src/components/search/Search.tsx +6 -1
  111. package/src/components/search/config.json +5 -0
  112. package/src/components/search/search.django-snapshot.html +683 -563
  113. package/src/components/search/search.django.html +1 -1
  114. package/src/components/search/search.react-snapshot.html +25 -0
  115. package/src/components/select/Select.tsx +3 -1
  116. package/src/components/select/config.json +5 -0
  117. package/src/components/select/select.django-snapshot.html +15 -0
  118. package/src/components/select/select.django.html +2 -2
  119. package/src/components/select/select.react-snapshot.html +11 -0
  120. package/src/components/switch/Switch.tsx +13 -70
  121. package/src/components/switch/config.json +60 -23
  122. package/src/components/switch/switch.django-snapshot.html +507 -56
  123. package/src/components/switch/switch.django.html +23 -26
  124. package/src/components/switch/switch.html +425 -33
  125. package/src/components/switch/switch.react-snapshot.html +447 -58
  126. package/src/components/table/Table.tsx +3 -1
  127. package/src/components/table/config.json +1 -0
  128. package/src/components/table/table.django.html +1 -1
  129. package/src/components/text-area/TextArea.tsx +3 -1
  130. package/src/components/text-area/config.json +5 -0
  131. package/src/components/text-area/text-area.django-snapshot.html +18 -0
  132. package/src/components/text-area/text-area.django.html +4 -4
  133. package/src/components/text-area/text-area.react-snapshot.html +16 -0
  134. package/src/components/theme-picker/ThemePicker.tsx +97 -52
  135. package/src/components/theme-picker/config.json +21 -5
  136. package/src/components/theme-picker/theme-picker-select.django.html +7 -0
  137. package/src/components/theme-picker/theme-picker.django-snapshot.html +158 -14
  138. package/src/components/theme-picker/theme-picker.django.html +22 -24
  139. package/src/components/theme-picker/theme-picker.html +86 -56
  140. package/src/components/theme-picker/theme-picker.react-snapshot.html +120 -12
  141. package/src/components/time-picker/TimePicker.tsx +6 -1
  142. package/src/components/time-picker/config.json +9 -0
  143. package/src/components/time-picker/time-picker.django-snapshot.html +26 -0
  144. package/src/components/time-picker/time-picker.django.html +4 -4
  145. package/src/components/time-picker/time-picker.react-snapshot.html +22 -0
@@ -67,14 +67,29 @@
67
67
  "type": "string",
68
68
  "description": "Initial selected month value (\"1\"-\"12\")."
69
69
  },
70
+ "month": {
71
+ "type": "string",
72
+ "default": null,
73
+ "description": "Current month selection. Takes precedence over defaultMonth."
74
+ },
70
75
  "defaultDay": {
71
76
  "type": "string",
72
77
  "description": "Initial day value."
73
78
  },
79
+ "day": {
80
+ "type": "string",
81
+ "default": null,
82
+ "description": "Current day value. Takes precedence over defaultDay."
83
+ },
74
84
  "defaultYear": {
75
85
  "type": "string",
76
86
  "description": "Initial year value."
77
87
  },
88
+ "year": {
89
+ "type": "string",
90
+ "default": null,
91
+ "description": "Current year value. Takes precedence over defaultYear."
92
+ },
78
93
  "disabled": {
79
94
  "type": "boolean",
80
95
  "default": false,
@@ -534,3 +534,85 @@
534
534
  </div>
535
535
  </fieldset>
536
536
  </div>
537
+
538
+ <h3 class="site-preview-heading">With Values</h3>
539
+ <div class="usa-form-group usx-form-group">
540
+ <fieldset class="usa-fieldset usx-fieldset">
541
+ <legend class="usa-legend usx-legend">Date of Birth</legend>
542
+
543
+ <span class="usa-hint usx-hint" aria-hidden="true" id="django-memorable-date-values-hint"
544
+ >Select a month. Enter 1 or 2 digits for the day and 4 digits for the year.</span
545
+ >
546
+ <div class="usa-memorable-date usx-memorable-date">
547
+ <div class="usa-form-group usx-form-group usa-form-group--month usa-form-group--select">
548
+ <label class="usa-label usx-label" for="django-memorable-date-values-month"> Month </label>
549
+
550
+ <select
551
+ class="usa-select usx-select"
552
+ id="django-memorable-date-values-month"
553
+ name="memorable-date-values-month"
554
+ aria-describedby="django-memorable-date-values-month-hint"
555
+ >
556
+ <option value="">- Select -</option>
557
+ <option value="1">January</option>
558
+ <option value="2">February</option>
559
+ <option value="3">March</option>
560
+ <option value="4">April</option>
561
+ <option value="5">May</option>
562
+ <option value="6" selected>June</option>
563
+ <option value="7">July</option>
564
+ <option value="8">August</option>
565
+ <option value="9">September</option>
566
+ <option value="10">October</option>
567
+ <option value="11">November</option>
568
+ <option value="12">December</option>
569
+ </select>
570
+
571
+ <span class="usa-hint usa-sr-only" id="django-memorable-date-values-month-hint"
572
+ >Select a month from the dropdown.</span
573
+ >
574
+ </div>
575
+
576
+ <div class="usa-form-group usx-form-group usa-form-group--day">
577
+ <label class="usa-label usx-label" for="django-memorable-date-values-day"> Day </label>
578
+
579
+ <input
580
+ class="usa-input usx-input"
581
+ id="django-memorable-date-values-day"
582
+ name="memorable-date-values-day"
583
+ value="20"
584
+ maxlength="2"
585
+ pattern="[0-9]*"
586
+ placeholder=""
587
+ inputmode="numeric"
588
+ aria-describedby="django-memorable-date-values-day-hint"
589
+ />
590
+
591
+ <span class="usa-hint usa-sr-only" id="django-memorable-date-values-day-hint"
592
+ >Enter 1 or 2 digits for the day.</span
593
+ >
594
+ </div>
595
+
596
+ <div class="usa-form-group usx-form-group usa-form-group--year">
597
+ <label class="usa-label usx-label" for="django-memorable-date-values-year"> Year </label>
598
+
599
+ <input
600
+ class="usa-input usx-input"
601
+ id="django-memorable-date-values-year"
602
+ name="memorable-date-values-year"
603
+ value="1990"
604
+ minlength="4"
605
+ maxlength="4"
606
+ pattern="[0-9]*"
607
+ placeholder=""
608
+ inputmode="numeric"
609
+ aria-describedby="django-memorable-date-values-year-hint"
610
+ />
611
+
612
+ <span class="usa-hint usa-sr-only" id="django-memorable-date-values-year-hint"
613
+ >Enter 4 digits for the year.</span
614
+ >
615
+ </div>
616
+ </div>
617
+ </fieldset>
618
+ </div>
@@ -20,18 +20,18 @@
20
20
  {% if required %}required{% endif %}
21
21
  >
22
22
  <option value="">- Select -</option>
23
- <option value="1" {% if defaultMonth == "1" %}selected{% endif %}>January</option>
24
- <option value="2" {% if defaultMonth == "2" %}selected{% endif %}>February</option>
25
- <option value="3" {% if defaultMonth == "3" %}selected{% endif %}>March</option>
26
- <option value="4" {% if defaultMonth == "4" %}selected{% endif %}>April</option>
27
- <option value="5" {% if defaultMonth == "5" %}selected{% endif %}>May</option>
28
- <option value="6" {% if defaultMonth == "6" %}selected{% endif %}>June</option>
29
- <option value="7" {% if defaultMonth == "7" %}selected{% endif %}>July</option>
30
- <option value="8" {% if defaultMonth == "8" %}selected{% endif %}>August</option>
31
- <option value="9" {% if defaultMonth == "9" %}selected{% endif %}>September</option>
32
- <option value="10" {% if defaultMonth == "10" %}selected{% endif %}>October</option>
33
- <option value="11" {% if defaultMonth == "11" %}selected{% endif %}>November</option>
34
- <option value="12" {% if defaultMonth == "12" %}selected{% endif %}>December</option>
23
+ <option value="1" {% if month is not None and month == "1" or month is None and defaultMonth == "1" %}selected{% endif %}>January</option>
24
+ <option value="2" {% if month is not None and month == "2" or month is None and defaultMonth == "2" %}selected{% endif %}>February</option>
25
+ <option value="3" {% if month is not None and month == "3" or month is None and defaultMonth == "3" %}selected{% endif %}>March</option>
26
+ <option value="4" {% if month is not None and month == "4" or month is None and defaultMonth == "4" %}selected{% endif %}>April</option>
27
+ <option value="5" {% if month is not None and month == "5" or month is None and defaultMonth == "5" %}selected{% endif %}>May</option>
28
+ <option value="6" {% if month is not None and month == "6" or month is None and defaultMonth == "6" %}selected{% endif %}>June</option>
29
+ <option value="7" {% if month is not None and month == "7" or month is None and defaultMonth == "7" %}selected{% endif %}>July</option>
30
+ <option value="8" {% if month is not None and month == "8" or month is None and defaultMonth == "8" %}selected{% endif %}>August</option>
31
+ <option value="9" {% if month is not None and month == "9" or month is None and defaultMonth == "9" %}selected{% endif %}>September</option>
32
+ <option value="10" {% if month is not None and month == "10" or month is None and defaultMonth == "10" %}selected{% endif %}>October</option>
33
+ <option value="11" {% if month is not None and month == "11" or month is None and defaultMonth == "11" %}selected{% endif %}>November</option>
34
+ <option value="12" {% if month is not None and month == "12" or month is None and defaultMonth == "12" %}selected{% endif %}>December</option>
35
35
  </select>
36
36
  {% if monthHint %}
37
37
  <span class="usa-hint usa-sr-only" id="{{ month_hint_id }}">{{ monthHint|default:"Select a month from the dropdown." }}</span>
@@ -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="{{ defaultDay|default:'' }}"
47
+ value="{% if day is not None %}{{ day }}{% else %}{{ defaultDay|default:'' }}{% 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="{{ defaultYear|default:'' }}"
68
+ value="{% if year is not None %}{{ year }}{% else %}{{ defaultYear|default:'' }}{% endif %}"
69
69
  minlength="4"
70
70
  maxlength="4"
71
71
  pattern="[0-9]*"
@@ -435,3 +435,73 @@
435
435
  </div>
436
436
  </fieldset>
437
437
  </div>
438
+
439
+ <h3 class="site-preview-heading">With Values</h3>
440
+ <div class="usa-form-group usx-form-group">
441
+ <fieldset class="usa-fieldset usx-fieldset">
442
+ <legend class="usa-legend usx-legend">Date of Birth</legend>
443
+ <span class="usa-hint usx-hint" id="react-memorable-date-values-hint" aria-hidden="true"
444
+ >Select a month. Enter 1 or 2 digits for the day and 4 digits for the year.</span
445
+ >
446
+ <div class="usa-memorable-date usx-memorable-date">
447
+ <div class="usa-form-group usx-form-group usa-form-group--month usa-form-group--select">
448
+ <label class="usa-label usx-label" for="react-memorable-date-values-month">Month</label
449
+ ><select
450
+ id="react-memorable-date-values-month"
451
+ name="memorable-date-values-month"
452
+ class="usa-select usx-select"
453
+ aria-describedby="react-memorable-date-values-month-hint"
454
+ >
455
+ <option value="">- Select -</option>
456
+ <option value="1">January</option>
457
+ <option value="2">February</option>
458
+ <option value="3">March</option>
459
+ <option value="4">April</option>
460
+ <option value="5">May</option>
461
+ <option value="6" selected="">June</option>
462
+ <option value="7">July</option>
463
+ <option value="8">August</option>
464
+ <option value="9">September</option>
465
+ <option value="10">October</option>
466
+ <option value="11">November</option>
467
+ <option value="12">December</option></select
468
+ ><span class="usa-hint usa-sr-only" id="react-memorable-date-values-month-hint"
469
+ >Select a month from the dropdown.</span
470
+ >
471
+ </div>
472
+ <div class="usa-form-group usx-form-group usa-form-group--day">
473
+ <label class="usa-label usx-label" for="react-memorable-date-values-day">Day</label
474
+ ><input
475
+ id="react-memorable-date-values-day"
476
+ class="usa-input usx-input"
477
+ placeholder=""
478
+ aria-describedby="react-memorable-date-values-day-hint"
479
+ name="memorable-date-values-day"
480
+ maxlength="2"
481
+ pattern="[0-9]*"
482
+ inputmode="numeric"
483
+ value="20"
484
+ /><span class="usa-hint usa-sr-only" id="react-memorable-date-values-day-hint"
485
+ >Enter 1 or 2 digits for the day.</span
486
+ >
487
+ </div>
488
+ <div class="usa-form-group usx-form-group usa-form-group--year">
489
+ <label class="usa-label usx-label" for="react-memorable-date-values-year">Year</label
490
+ ><input
491
+ id="react-memorable-date-values-year"
492
+ class="usa-input usx-input"
493
+ placeholder=""
494
+ aria-describedby="react-memorable-date-values-year-hint"
495
+ name="memorable-date-values-year"
496
+ minlength="4"
497
+ maxlength="4"
498
+ pattern="[0-9]*"
499
+ inputmode="numeric"
500
+ value="1990"
501
+ /><span class="usa-hint usa-sr-only" id="react-memorable-date-values-year-hint"
502
+ >Enter 4 digits for the year.</span
503
+ >
504
+ </div>
505
+ </div>
506
+ </fieldset>
507
+ </div>
@@ -5,6 +5,7 @@ import Prose from '../prose/Prose';
5
5
  import ButtonGroup, { ButtonGroupProps } from '../button-group/ButtonGroup';
6
6
 
7
7
  export interface ModalProps extends HTMLAttributes<HTMLDivElement> {
8
+ extraAttributes?: Record<string, unknown>;
8
9
  id?: string;
9
10
  heading?: string;
10
11
  description?: string;
@@ -27,6 +28,7 @@ export default function Modal({
27
28
  forceAction = false,
28
29
  className = '',
29
30
  children,
31
+ extraAttributes,
30
32
  ...props
31
33
  }: ModalProps) {
32
34
  const classes = classNames('usa-modal', 'usx-modal', {
@@ -42,6 +44,7 @@ export default function Modal({
42
44
  aria-describedby={`${id}-description`}
43
45
  {...(forceAction ? { 'data-force-action': true } : {})}
44
46
  {...props}
47
+ {...extraAttributes}
45
48
  >
46
49
  <div className="usa-modal__content">
47
50
  <div className="usa-modal__main">
@@ -25,6 +25,7 @@
25
25
  ]
26
26
  },
27
27
  "props": {
28
+ "extraAttributes": { "type": "object", "description": "Additional attributes on the USWDS enhancement target." },
28
29
  "id": {
29
30
  "type": "string",
30
31
  "default": "example-modal",
@@ -1,7 +1,7 @@
1
1
  {# Django template for Modal #}
2
2
  {% load usx_components %}
3
3
  <div
4
- class="usa-modal usx-modal{% if size == 'lg' %} usa-modal--lg{% elif size == 'lg-collapsed' %} usx-modal--lg-collapsed{% endif %}{% if className %} {{ className }}{% endif %}"
4
+ class="usa-modal usx-modal{% if size == 'lg' %} usa-modal--lg{% elif size == 'lg-collapsed' %} usx-modal--lg-collapsed{% endif %}{% if className %} {{ className }}{% endif %}" {% if extraAttributes %}{% for attr, value in extraAttributes.items %} {{ attr }}="{% if value is True %}true{% elif value is False %}false{% else %}{{ value }}{% endif %}"{% endfor %}{% endif %}
5
5
  id="{{ id }}"
6
6
  aria-labelledby="{{ id }}-heading"
7
7
  aria-describedby="{{ id }}-description"
@@ -1,10 +1,15 @@
1
1
  import React from 'react';
2
2
  import ClassNames from 'classnames';
3
+ import TagGroup from '../tag-group/TagGroup';
4
+ import type { TagProps } from '../tag/Tag';
3
5
 
4
6
  export interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title' | 'content'> {
5
7
  title?: React.ReactNode;
6
8
  titleId?: string;
7
9
  eyebrow?: React.ReactNode;
10
+ subtitle?: string;
11
+ description?: string;
12
+ tagProps?: TagProps[];
8
13
  as?: 'main' | 'div' | 'section' | 'article';
9
14
  content?: React.ReactNode;
10
15
  tabIndex?: number;
@@ -16,6 +21,9 @@ export default function Page({
16
21
  title = 'Page title',
17
22
  titleId = undefined,
18
23
  eyebrow = null,
24
+ subtitle = undefined,
25
+ description = undefined,
26
+ tagProps = undefined,
19
27
  as: Element = 'main',
20
28
  children = null,
21
29
  content = null,
@@ -24,6 +32,7 @@ export default function Page({
24
32
  className = '',
25
33
  ...props
26
34
  }: PageProps) {
35
+ const hasSummary = Boolean(subtitle || description || tagProps?.length);
27
36
  const classes = ClassNames('usx-page', className);
28
37
  const pageContent = children || content;
29
38
 
@@ -41,6 +50,13 @@ export default function Page({
41
50
  {eyebrow ? <span className="usx-eyebrow">{eyebrow}</span> : null}
42
51
  {title}
43
52
  </h1>
53
+ {hasSummary && (
54
+ <div className="usx-page__summary">
55
+ {subtitle && <p className="usx-page__subtitle">{subtitle}</p>}
56
+ {tagProps?.length ? <TagGroup className="usx-page__tags" tagProps={tagProps} /> : null}
57
+ {description && <p className="usx-page__description">{description}</p>}
58
+ </div>
59
+ )}
44
60
  <div className="usx-page__content">{pageContent}</div>
45
61
  </Element>
46
62
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "page",
3
3
  "template": "page/page.django.html",
4
- "version": 4,
4
+ "version": 5,
5
5
  "required": [
6
6
  "title"
7
7
  ],
@@ -39,6 +39,23 @@
39
39
  "type": "slot",
40
40
  "description": "Optional eyebrow text rendered above the page title inside the h1."
41
41
  },
42
+ "subtitle": {
43
+ "type": "string",
44
+ "description": "Short subtitle displayed beneath the page title."
45
+ },
46
+ "tagProps": {
47
+ "type": "array",
48
+ "description": "Props for tags displayed beneath the subtitle.",
49
+ "items": {
50
+ "type": "object",
51
+ "component": "tag",
52
+ "description": "Props passed to each tag."
53
+ }
54
+ },
55
+ "description": {
56
+ "type": "string",
57
+ "description": "Brief page description displayed beneath the tags."
58
+ },
42
59
  "content": {
43
60
  "type": "slot",
44
61
  "description": "Body content rendered below the title. Supports HTML in Django stories. Ignored if children is provided."
@@ -1,6 +1,7 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
2
  <main class="usx-page">
3
3
  <h1 class="usx-page__title">Page title</h1>
4
+
4
5
  <div class="usx-page__content">
5
6
  <p>This page wrapper provides consistent spacing between a site header and footer.</p>
6
7
  <p>Use this region for page-specific content.</p>
@@ -10,6 +11,7 @@
10
11
  <h3 class="site-preview-heading">With Long Content</h3>
11
12
  <main class="usx-page">
12
13
  <h1 class="usx-page__title">Program overview</h1>
14
+
13
15
  <div class="usx-page__content">
14
16
  <p>
15
17
  This section demonstrates how the page component handles longer content while preserving top
@@ -29,6 +31,77 @@
29
31
  <h3 class="site-preview-heading">With Eyebrow</h3>
30
32
  <main class="usx-page">
31
33
  <h1 class="usx-page__title"><span class="usx-eyebrow">Eyebrow Title</span>Page Title</h1>
34
+
35
+ <div class="usx-page__content">
36
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
37
+ <p>Use this region for page-specific content.</p>
38
+ </div>
39
+ </main>
40
+
41
+ <h3 class="site-preview-heading">With Subtitle</h3>
42
+ <main class="usx-page">
43
+ <h1 class="usx-page__title">Benefits and services</h1>
44
+
45
+ <div class="usx-page__summary">
46
+ <p class="usx-page__subtitle">Find support for every stage of life</p>
47
+ </div>
48
+
49
+ <div class="usx-page__content">
50
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
51
+ <p>Use this region for page-specific content.</p>
52
+ </div>
53
+ </main>
54
+
55
+ <h3 class="site-preview-heading">With Description</h3>
56
+ <main class="usx-page">
57
+ <h1 class="usx-page__title">Program overview</h1>
58
+
59
+ <div class="usx-page__summary">
60
+ <p class="usx-page__description">
61
+ Explore available services, eligibility, and the steps to apply.
62
+ </p>
63
+ </div>
64
+
65
+ <div class="usx-page__content">
66
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
67
+ <p>Use this region for page-specific content.</p>
68
+ </div>
69
+ </main>
70
+
71
+ <h3 class="site-preview-heading">With Tags</h3>
72
+ <main class="usx-page">
73
+ <h1 class="usx-page__title">Program updates</h1>
74
+
75
+ <div class="usx-page__summary">
76
+ <div class="usx-tag-group usx-page__tags">
77
+ <span class="usa-tag usx-tag"> New </span>
78
+
79
+ <span class="usa-tag usx-tag usx-tag--outline"> Public notice </span>
80
+ </div>
81
+ </div>
82
+
83
+ <div class="usx-page__content">
84
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
85
+ <p>Use this region for page-specific content.</p>
86
+ </div>
87
+ </main>
88
+
89
+ <h3 class="site-preview-heading">With Summary</h3>
90
+ <main class="usx-page">
91
+ <h1 class="usx-page__title">
92
+ <span class="usx-eyebrow">Funding opportunities</span>Community grants
93
+ </h1>
94
+
95
+ <div class="usx-page__summary">
96
+ <p class="usx-page__subtitle">Support for local projects</p>
97
+ <div class="usx-tag-group usx-page__tags">
98
+ <span class="usa-tag usx-tag"> Open </span>
99
+
100
+ <span class="usa-tag usx-tag usx-tag--outline"> Applications close June 30 </span>
101
+ </div>
102
+ <p class="usx-page__description">Find grants that help communities plan, build, and grow.</p>
103
+ </div>
104
+
32
105
  <div class="usx-page__content">
33
106
  <p>This page wrapper provides consistent spacing between a site header and footer.</p>
34
107
  <p>Use this region for page-specific content.</p>
@@ -38,6 +111,7 @@
38
111
  <h3 class="site-preview-heading">With Classes</h3>
39
112
  <main class="usx-page bg-violet text-white padding-2">
40
113
  <h1 class="usx-page__title">Page with extra classes</h1>
114
+
41
115
  <div class="usx-page__content">
42
116
  <p>This page has additional classes applied to the root element for testing purposes.</p>
43
117
  </div>
@@ -1,7 +1,15 @@
1
1
  {# Django template for Page #}
2
+ {% load usx_components %}
2
3
  {% with pageTag=as|default:'main' %}
3
4
  <{% if pageTag == 'div' or pageTag == 'section' or pageTag == 'article' %}{{ pageTag }}{% else %}main{% endif %}{% if id %} id="{{ id }}"{% endif %} class="usx-page{% if className %} {{ className }}{% endif %}"{% if tabIndex or tabIndex == 0 %} tabindex="{{ tabIndex }}"{% endif %}{% if ariaLabelledby or titleId %} aria-labelledby="{% firstof ariaLabelledby titleId %}"{% endif %}>
4
5
  <h1{% if titleId %} id="{{ titleId }}"{% endif %} class="usx-page__title">{% if eyebrow %}<span class="usx-eyebrow">{{ eyebrow }}</span>{% endif %}{{ title|default:'Page title' }}</h1>
6
+ {% if subtitle or description or tagProps %}
7
+ <div class="usx-page__summary">
8
+ {% if subtitle %}<p class="usx-page__subtitle">{{ subtitle }}</p>{% endif %}
9
+ {% if tagProps %}<div class="usx-tag-group usx-page__tags">{% for tag in tagProps %}{% tag props=tag %}{{ tag.children|safe }}{% endtag %}{% endfor %}</div>{% endif %}
10
+ {% if description %}<p class="usx-page__description">{{ description }}</p>{% endif %}
11
+ </div>
12
+ {% endif %}
5
13
  <div class="usx-page__content">{% if children %}{{ children|safe }}{% elif content %}{{ content|safe }}{% endif %}</div>
6
14
  </{% if pageTag == 'div' or pageTag == 'section' or pageTag == 'article' %}{{ pageTag }}{% else %}main{% endif %}>
7
15
  {% endwith %}
@@ -35,6 +35,66 @@
35
35
  </div>
36
36
  </main>
37
37
 
38
+ <h3 class="site-preview-heading">With Subtitle</h3>
39
+ <main class="usx-page">
40
+ <h1 class="usx-page__title">Benefits and services</h1>
41
+ <div class="usx-page__summary">
42
+ <p class="usx-page__subtitle">Find support for every stage of life</p>
43
+ </div>
44
+ <div class="usx-page__content">
45
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
46
+ <p>Use this region for page-specific content.</p>
47
+ </div>
48
+ </main>
49
+
50
+ <h3 class="site-preview-heading">With Description</h3>
51
+ <main class="usx-page">
52
+ <h1 class="usx-page__title">Program overview</h1>
53
+ <div class="usx-page__summary">
54
+ <p class="usx-page__description">
55
+ Explore available services, eligibility, and the steps to apply.
56
+ </p>
57
+ </div>
58
+ <div class="usx-page__content">
59
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
60
+ <p>Use this region for page-specific content.</p>
61
+ </div>
62
+ </main>
63
+
64
+ <h3 class="site-preview-heading">With Tags</h3>
65
+ <main class="usx-page">
66
+ <h1 class="usx-page__title">Program updates</h1>
67
+ <div class="usx-page__summary">
68
+ <div class="usx-tag-group usx-page__tags">
69
+ <span class="usa-tag usx-tag"> New</span
70
+ ><span class="usa-tag usx-tag usx-tag--outline"> Public notice</span>
71
+ </div>
72
+ </div>
73
+ <div class="usx-page__content">
74
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
75
+ <p>Use this region for page-specific content.</p>
76
+ </div>
77
+ </main>
78
+
79
+ <h3 class="site-preview-heading">With Summary</h3>
80
+ <main class="usx-page">
81
+ <h1 class="usx-page__title">
82
+ <span class="usx-eyebrow">Funding opportunities</span>Community grants
83
+ </h1>
84
+ <div class="usx-page__summary">
85
+ <p class="usx-page__subtitle">Support for local projects</p>
86
+ <div class="usx-tag-group usx-page__tags">
87
+ <span class="usa-tag usx-tag"> Open</span
88
+ ><span class="usa-tag usx-tag usx-tag--outline"> Applications close June 30</span>
89
+ </div>
90
+ <p class="usx-page__description">Find grants that help communities plan, build, and grow.</p>
91
+ </div>
92
+ <div class="usx-page__content">
93
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
94
+ <p>Use this region for page-specific content.</p>
95
+ </div>
96
+ </main>
97
+
38
98
  <h3 class="site-preview-heading">With Classes</h3>
39
99
  <main class="usx-page bg-violet text-white padding-2">
40
100
  <h1 class="usx-page__title">Page with extra classes</h1>
@@ -35,6 +35,66 @@
35
35
  </div>
36
36
  </main>
37
37
 
38
+ <h3 class="site-preview-heading">With Subtitle</h3>
39
+ <main class="usx-page">
40
+ <h1 class="usx-page__title">Benefits and services</h1>
41
+ <div class="usx-page__summary">
42
+ <p class="usx-page__subtitle">Find support for every stage of life</p>
43
+ </div>
44
+ <div class="usx-page__content">
45
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
46
+ <p>Use this region for page-specific content.</p>
47
+ </div>
48
+ </main>
49
+
50
+ <h3 class="site-preview-heading">With Description</h3>
51
+ <main class="usx-page">
52
+ <h1 class="usx-page__title">Program overview</h1>
53
+ <div class="usx-page__summary">
54
+ <p class="usx-page__description">
55
+ Explore available services, eligibility, and the steps to apply.
56
+ </p>
57
+ </div>
58
+ <div class="usx-page__content">
59
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
60
+ <p>Use this region for page-specific content.</p>
61
+ </div>
62
+ </main>
63
+
64
+ <h3 class="site-preview-heading">With Tags</h3>
65
+ <main class="usx-page">
66
+ <h1 class="usx-page__title">Program updates</h1>
67
+ <div class="usx-page__summary">
68
+ <div class="usx-tag-group usx-page__tags">
69
+ <span class="usa-tag usx-tag"> New</span
70
+ ><span class="usa-tag usx-tag usx-tag--outline"> Public notice</span>
71
+ </div>
72
+ </div>
73
+ <div class="usx-page__content">
74
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
75
+ <p>Use this region for page-specific content.</p>
76
+ </div>
77
+ </main>
78
+
79
+ <h3 class="site-preview-heading">With Summary</h3>
80
+ <main class="usx-page">
81
+ <h1 class="usx-page__title">
82
+ <span class="usx-eyebrow">Funding opportunities</span>Community grants
83
+ </h1>
84
+ <div class="usx-page__summary">
85
+ <p class="usx-page__subtitle">Support for local projects</p>
86
+ <div class="usx-tag-group usx-page__tags">
87
+ <span class="usa-tag usx-tag"> Open</span
88
+ ><span class="usa-tag usx-tag usx-tag--outline"> Applications close June 30</span>
89
+ </div>
90
+ <p class="usx-page__description">Find grants that help communities plan, build, and grow.</p>
91
+ </div>
92
+ <div class="usx-page__content">
93
+ <p>This page wrapper provides consistent spacing between a site header and footer.</p>
94
+ <p>Use this region for page-specific content.</p>
95
+ </div>
96
+ </main>
97
+
38
98
  <h3 class="site-preview-heading">With Classes</h3>
39
99
  <main class="usx-page bg-violet text-white padding-2">
40
100
  <h1 class="usx-page__title">Page with extra classes</h1>
@@ -42,6 +42,7 @@ export interface PopoverProps extends Omit<
42
42
  panelClassName?: string;
43
43
  /** Optional class name for the inner content container. */
44
44
  contentClassName?: string;
45
+ extraAttributes?: Record<string, unknown>;
45
46
  }
46
47
 
47
48
  /**
@@ -64,6 +65,7 @@ export default function Popover({
64
65
  summaryProps,
65
66
  panelClassName,
66
67
  contentClassName,
68
+ extraAttributes,
67
69
  children,
68
70
  ...props
69
71
  }: PopoverProps) {
@@ -78,6 +80,7 @@ export default function Popover({
78
80
  open={initiallyOpen || undefined}
79
81
  data-side={side}
80
82
  data-align={align}
83
+ {...extraAttributes}
81
84
  >
82
85
  <Summary unstyled {...composedSummaryProps} />
83
86
  <div
@@ -125,6 +125,10 @@
125
125
  "contentClassName": {
126
126
  "type": "string",
127
127
  "description": "Optional class name for the inner content container."
128
+ },
129
+ "extraAttributes": {
130
+ "type": "object",
131
+ "description": "Additional HTML attributes on the popover root."
128
132
  }
129
133
  }
130
134
  }