@solexllc/usx-react 0.6.0 → 0.7.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 (84) hide show
  1. package/dist/index.cjs +231 -98
  2. package/dist/index.js +231 -98
  3. package/package.json +5 -5
  4. package/src/components/accordion/accordion.html +596 -291
  5. package/src/components/alert/alert.html +112 -148
  6. package/src/components/attribution/attribution.html +50 -21
  7. package/src/components/avatar/avatar.html +86 -51
  8. package/src/components/breadcrumb/breadcrumb.html +45 -66
  9. package/src/components/button/button.html +363 -226
  10. package/src/components/callout/Callout.tsx +1 -2
  11. package/src/components/callout/callout.django.html +2 -2
  12. package/src/components/callout/callout.html +0 -5
  13. package/src/components/callout/config.json +1 -5
  14. package/src/components/card/Card.tsx +6 -3
  15. package/src/components/card/card.django.html +2 -2
  16. package/src/components/card/card.html +1032 -35
  17. package/src/components/card/config.json +6 -2
  18. package/src/components/card-group/card-group.html +388 -95
  19. package/src/components/carousel/Carousel.tsx +42 -71
  20. package/src/components/carousel/carousel.django.html +22 -46
  21. package/src/components/carousel/carousel.html +715 -32
  22. package/src/components/carousel/config.json +25 -12
  23. package/src/components/character-count/character-count.html +231 -26
  24. package/src/components/checkbox/checkbox.html +313 -241
  25. package/src/components/checkbox-group/checkbox-group.html +346 -26
  26. package/src/components/clickable/clickable.html +168 -83
  27. package/src/components/code/Code.tsx +4 -3
  28. package/src/components/code/code.django.html +1 -1
  29. package/src/components/code/config.json +4 -0
  30. package/src/components/collection/collection.html +203 -379
  31. package/src/components/combobox/combobox.html +21 -9
  32. package/src/components/container/container.html +2616 -80
  33. package/src/components/copy-to-clipboard/copy-to-clipboard.html +48 -20
  34. package/src/components/details/Details.tsx +69 -0
  35. package/src/components/details/config.json +73 -0
  36. package/src/components/details/details.django.html +7 -0
  37. package/src/components/details/details.html +186 -0
  38. package/src/components/error-message/error-message.html +15 -2
  39. package/src/components/error-page/ErrorPage.tsx +169 -0
  40. package/src/components/error-page/config.json +152 -0
  41. package/src/components/error-page/error-page.django.html +80 -0
  42. package/src/components/error-page/error-page.html +437 -0
  43. package/src/components/eyebrow/eyebrow.html +8 -4
  44. package/src/components/fieldset/fieldset.html +33 -7
  45. package/src/components/file-input/file-input.html +310 -31
  46. package/src/components/file-list/file-list.html +191 -7
  47. package/src/components/footer/footer.html +611 -232
  48. package/src/components/header/header.html +2553 -611
  49. package/src/components/hero/hero.html +300 -38
  50. package/src/components/hint/hint.html +7 -2
  51. package/src/components/identifier/identifier.html +483 -255
  52. package/src/components/image/Image.tsx +2 -2
  53. package/src/components/image/image.django.html +4 -10
  54. package/src/components/image/image.html +144 -29
  55. package/src/components/indicator/indicator.html +25 -23
  56. package/src/components/label/label.html +15 -16
  57. package/src/components/language-selector/language-selector.html +74 -25
  58. package/src/components/layout/layout.html +991 -21
  59. package/src/components/legend/legend.html +10 -9
  60. package/src/components/list/list.html +45 -25
  61. package/src/components/page/Page.tsx +15 -2
  62. package/src/components/page/config.json +13 -1
  63. package/src/components/page/page.django.html +2 -2
  64. package/src/components/page/page.html +29 -8
  65. package/src/components/pagination/pagination.html +907 -305
  66. package/src/components/prose/prose.html +244 -85
  67. package/src/components/quote/Quote.tsx +1 -1
  68. package/src/components/quote/config.json +1 -2
  69. package/src/components/quote/quote.html +2 -7
  70. package/src/components/radio-buttons/radio-buttons.html +623 -127
  71. package/src/components/required/required.html +3 -4
  72. package/src/components/search/search.html +336 -54
  73. package/src/components/section/section.html +73 -11
  74. package/src/components/select/select.html +112 -58
  75. package/src/components/skipnav/skipnav.html +40 -1
  76. package/src/components/spinner/spinner.html +143 -23
  77. package/src/components/step-indicator/step-indicator.html +26 -68
  78. package/src/components/swap/swap.html +99 -154
  79. package/src/components/table/table.html +2168 -988
  80. package/src/components/tag/tag.html +73 -17
  81. package/src/components/task-list/task-list.html +252 -15
  82. package/src/components/theme-picker/theme-picker.html +26 -8
  83. package/src/components/toggle/toggle.html +64 -5
  84. package/src/index.js +2 -0
@@ -1,12 +1,13 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
- <legend class="usa-legend usx-legend">Legend</legend>
2
+ <legend class="usa-legend usx-legend">Legend Text</legend>
3
3
 
4
- <h3 class="site-preview-heading">With additional class</h3>
5
- <legend class="usa-legend usx-legend text-primary">Legend with extra class</legend>
4
+ <h3 class="site-preview-heading">With Additional Classes</h3>
5
+ <legend class="usa-legend usx-legend text-primary">Legend with Additional Classes</legend>
6
6
 
7
- <h3 class ="site-preview-heading">Legend for required fieldset</h3>
8
- <fieldset class="usa-fieldset">
9
- <legend class="usa-legend usx-legend">
10
- <abbr title="Required" class="usx-required">*</abbr>Legend for required fieldset
11
- </legend>
12
- </fieldset>
7
+ <h3 class="site-preview-heading">With Required</h3>
8
+ <legend class="usa-legend usx-legend">
9
+ <abbr title="Required" class="usx-required">*</abbr> Legend Text
10
+ </legend>
11
+
12
+ <h3 class="site-preview-heading">Large</h3>
13
+ <legend class="usa-legend usx-legend usa-legend--large">Large Legend Text</legend>
@@ -1,26 +1,46 @@
1
- <div class="grid-row grid-gap">
2
- <div class="mobile-lg:grid-col-4">
3
- <h3 class="site-preview-heading margin-0">Unordered list</h3>
4
- <ul class="usa-list">
5
- <li>Unordered list item</li>
6
- <li>Unordered list item</li>
7
- <li>Unordered list item</li>
1
+ <h3 class="site-preview-heading">Default</h3>
2
+ <ul class="usa-list usx-list">
3
+ <li>List item</li>
4
+ <li>List item</li>
5
+ <li>List item</li>
6
+ </ul>
7
+
8
+ <h3 class="site-preview-heading">Ordered</h3>
9
+ <ol class="usa-list usx-list">
10
+ <li>List item</li>
11
+ <li>List item</li>
12
+ <li>List item</li>
13
+ </ol>
14
+
15
+ <h3 class="site-preview-heading">Unstyled</h3>
16
+ <ul class="usa-list usx-list usa-list--unstyled">
17
+ <li>List item</li>
18
+ <li>List item</li>
19
+ <li>List item</li>
20
+ </ul>
21
+
22
+ <h3 class="site-preview-heading">Nested</h3>
23
+ <ul class="usa-list usx-list">
24
+ <li>Main point</li>
25
+ <li>
26
+ Program requirements
27
+ <ul class="usa-list usx-list">
28
+ <li>Submit application</li>
29
+ <li>
30
+ Provide supporting documents
31
+ <ul class="usa-list usx-list">
32
+ <li>Photo identification</li>
33
+ <li>Proof of address</li>
34
+ <li>
35
+ Income documents
36
+ <ol class="usa-list usx-list">
37
+ <li>Recent pay stubs</li>
38
+ <li>Most recent tax return</li>
39
+ </ol>
40
+ </li>
41
+ </ul>
42
+ </li>
8
43
  </ul>
9
- </div>
10
- <div class="mobile-lg:grid-col-4 margin-top-4 mobile-lg:margin-top-0">
11
- <h3 class="site-preview-heading margin-0">Ordered list</h3>
12
- <ol class="usa-list">
13
- <li>Ordered list item</li>
14
- <li>Ordered list item</li>
15
- <li>Ordered list item</li>
16
- </ol>
17
- </div>
18
- <div class="mobile-lg:grid-col-4 margin-top-4 mobile-lg:margin-top-0">
19
- <h3 class="site-preview-heading margin-0">Unstyled list</h3>
20
- <ul class="usa-list usa-list--unstyled">
21
- <li>Unstyled list item</li>
22
- <li>Unstyled list item</li>
23
- <li>Unstyled list item</li>
24
- </ul>
25
- </div>
26
- </div>
44
+ </li>
45
+ <li>Final confirmation</li>
46
+ </ul>
@@ -3,18 +3,24 @@ import ClassNames from 'classnames';
3
3
 
4
4
  export interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title' | 'content'> {
5
5
  title?: React.ReactNode;
6
+ titleId?: string;
6
7
  eyebrow?: React.ReactNode;
7
8
  element?: React.ElementType;
8
9
  content?: React.ReactNode;
10
+ tabIndex?: number;
11
+ ariaLabelledby?: string;
9
12
  }
10
13
 
11
14
  export default function Page({
12
15
  id = undefined,
13
16
  title = 'Page title',
17
+ titleId = undefined,
14
18
  eyebrow = null,
15
19
  element = 'main',
16
20
  children = null,
17
21
  content = null,
22
+ tabIndex = undefined,
23
+ ariaLabelledby = undefined,
18
24
  className = '',
19
25
  ...props
20
26
  }: PageProps) {
@@ -22,10 +28,17 @@ export default function Page({
22
28
  const pageContent = children || content;
23
29
 
24
30
  const Element = element;
31
+ const labelledBy = ariaLabelledby || titleId || undefined;
25
32
 
26
33
  return (
27
- <Element id={id} className={classes} {...props}>
28
- <h1 className="usx-page__title">
34
+ <Element
35
+ id={id}
36
+ className={classes}
37
+ tabIndex={tabIndex}
38
+ aria-labelledby={labelledBy}
39
+ {...props}
40
+ >
41
+ <h1 id={titleId} className="usx-page__title">
29
42
  {eyebrow ? <span className="usx-eyebrow">{eyebrow}</span> : null}
30
43
  {title}
31
44
  </h1>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "page",
3
3
  "template": "page/page.django.html",
4
- "version": 2,
4
+ "version": 3,
5
5
  "required": [
6
6
  "title"
7
7
  ],
@@ -10,6 +10,18 @@
10
10
  "type": "string",
11
11
  "description": "Optional id attribute applied to the root main element."
12
12
  },
13
+ "titleId": {
14
+ "type": "string",
15
+ "description": "Optional id for the h1. Also labels the root element unless ariaLabelledby is provided."
16
+ },
17
+ "tabIndex": {
18
+ "type": "number",
19
+ "description": "Optional tabindex for the root element. Use -1 when the page needs to receive programmatic focus."
20
+ },
21
+ "ariaLabelledby": {
22
+ "type": "string",
23
+ "description": "Optional id reference that labels the root element. Takes precedence over titleId."
24
+ },
13
25
  "title": {
14
26
  "type": "slot",
15
27
  "description": "Required page title rendered as an h1."
@@ -1,5 +1,5 @@
1
1
  {# Django template for Page #}
2
- <main{% if id %} id="{{ id }}"{% endif %} class="usx-page{% if className %} {{ className }}{% endif %}">
3
- <h1 class="usx-page__title">{% if eyebrow %}<span class="usx-eyebrow">{{ eyebrow }}</span>{% endif %}{{ title|default:'Page title' }}</h1>
2
+ <main{% 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 %}>
3
+ <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
4
  <div class="usx-page__content">{% if children %}{{ children|safe }}{% elif content %}{{ content|safe }}{% endif %}</div>
5
5
  </main>
@@ -1,23 +1,44 @@
1
1
  <h3 class="site-preview-heading">Default</h3>
2
- <hr>
3
2
  <main class="usx-page">
4
- <h1 class="usx-page__title">Page Title</h1>
3
+ <h1 class="usx-page__title">Page title</h1>
5
4
  <div class="usx-page__content">
6
5
  <p>This page wrapper provides consistent spacing between a site header and footer.</p>
7
6
  <p>Use this region for page-specific content.</p>
8
7
  </div>
9
8
  </main>
10
9
 
10
+ <h3 class="site-preview-heading">With Long Content</h3>
11
+ <main class="usx-page">
12
+ <h1 class="usx-page__title">Program overview</h1>
13
+ <div class="usx-page__content">
14
+ <p>
15
+ This section demonstrates how the page component handles longer content while preserving top
16
+ and bottom spacing.
17
+ </p>
18
+ <p>
19
+ Teams can compose this with Header and Footer components to keep page layout and heading
20
+ semantics consistent.
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>
26
+ </div>
27
+ </main>
11
28
 
12
29
  <h3 class="site-preview-heading">With Eyebrow</h3>
13
- <hr>
14
30
  <main class="usx-page">
15
- <h1 class="usx-page__title">
16
- <span class="usx-eyebrow">Eyebrow Title</span>
17
- Page Title
18
- </h1>
31
+ <h1 class="usx-page__title"><span class="usx-eyebrow">Eyebrow Title</span>Page Title</h1>
19
32
  <div class="usx-page__content">
20
33
  <p>This page wrapper provides consistent spacing between a site header and footer.</p>
21
34
  <p>Use this region for page-specific content.</p>
22
35
  </div>
23
- </main>
36
+ </main>
37
+
38
+ <h3 class="site-preview-heading">With Classes</h3>
39
+ <main class="usx-page bg-violet text-white padding-2">
40
+ <h1 class="usx-page__title">Page with extra classes</h1>
41
+ <div class="usx-page__content">
42
+ <p>This page has additional classes applied to the root element for testing purposes.</p>
43
+ </div>
44
+ </main>