@solexllc/usx-react 0.3.1 → 0.5.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 (135) hide show
  1. package/README.md +132 -0
  2. package/dist/index.cjs +504 -450
  3. package/dist/index.js +504 -450
  4. package/package.json +6 -5
  5. package/src/assets.ts +16 -0
  6. package/src/components/alert/Alert.tsx +4 -3
  7. package/src/components/alert/alert.django.html +2 -3
  8. package/src/components/alert/config.json +15 -4
  9. package/src/components/attribution/config.json +5 -5
  10. package/src/components/banner/Banner.tsx +8 -6
  11. package/src/components/banner/banner.django.html +4 -5
  12. package/src/components/banner/config.json +7 -3
  13. package/src/components/breadcrumb/Breadcrumb.tsx +5 -6
  14. package/src/components/breadcrumb/config.json +11 -1
  15. package/src/components/button/Button.tsx +1 -1
  16. package/src/components/button/button.django.html +2 -2
  17. package/src/components/button/button.html +2 -2
  18. package/src/components/button/config.json +14 -6
  19. package/src/components/button-group/button-group.django.html +1 -1
  20. package/src/components/calendar-date/calendar-date.django.html +3 -3
  21. package/src/components/callout/Callout.tsx +53 -0
  22. package/src/components/callout/callout.django.html +5 -0
  23. package/src/components/callout/callout.html +76 -0
  24. package/src/components/callout/config.json +74 -0
  25. package/src/components/card/Card.tsx +18 -34
  26. package/src/components/card/card.django.html +12 -10
  27. package/src/components/card/config.json +15 -40
  28. package/src/components/card-group/card-group.django.html +1 -1
  29. package/src/components/carousel/Carousel.tsx +3 -2
  30. package/src/components/carousel/carousel.django.html +13 -2
  31. package/src/components/carousel/config.json +2 -2
  32. package/src/components/character-count/config.json +2 -2
  33. package/src/components/checkbox-group/CheckboxGroup.tsx +10 -20
  34. package/src/components/checkbox-group/checkbox-group.django.html +10 -4
  35. package/src/components/checkbox-group/config.json +10 -5
  36. package/src/components/clickable/clickable.html +21 -39
  37. package/src/components/clickable/config.json +2 -2
  38. package/src/components/code/Code.tsx +4 -27
  39. package/src/components/code/code.django.html +3 -9
  40. package/src/components/code/config.json +4 -0
  41. package/src/components/collection/Collection.tsx +5 -5
  42. package/src/components/collection/collection.django.html +2 -4
  43. package/src/components/collection/config.json +7 -6
  44. package/src/components/combobox/config.json +4 -4
  45. package/src/components/copy-to-clipboard/CopyToClipboard.tsx +35 -24
  46. package/src/components/copy-to-clipboard/config.json +14 -7
  47. package/src/components/copy-to-clipboard/copy-to-clipboard.django.html +14 -14
  48. package/src/components/date-picker/config.json +4 -4
  49. package/src/components/date-range-picker/config.json +7 -7
  50. package/src/components/error-message/config.json +2 -2
  51. package/src/components/eyebrow/Eyebrow.tsx +2 -1
  52. package/src/components/eyebrow/config.json +2 -2
  53. package/src/components/fieldset/config.json +5 -5
  54. package/src/components/file-input/FileInput.tsx +3 -2
  55. package/src/components/file-input/config.json +5 -5
  56. package/src/components/file-list/FileList.tsx +2 -1
  57. package/src/components/file-list/config.json +2 -2
  58. package/src/components/footer/Footer.tsx +31 -11
  59. package/src/components/footer/config.json +4 -0
  60. package/src/components/footer/footer.django.html +10 -9
  61. package/src/components/form-group/config.json +2 -2
  62. package/src/components/header/Branding.tsx +9 -6
  63. package/src/components/header/Header.tsx +3 -1
  64. package/src/components/header/config.json +4 -0
  65. package/src/components/header/header.django.html +5 -26
  66. package/src/components/header/header.html +10 -10
  67. package/src/components/hero/Hero.tsx +8 -14
  68. package/src/components/hero/config.json +36 -27
  69. package/src/components/hero/hero.django.html +2 -2
  70. package/src/components/hint/config.json +2 -2
  71. package/src/components/icon/Icon.tsx +6 -3
  72. package/src/components/icon/config.json +12 -6
  73. package/src/components/icon/icon.django.html +6 -4
  74. package/src/components/image/Image.tsx +8 -4
  75. package/src/components/image/config.json +10 -2
  76. package/src/components/image/image.django.html +8 -6
  77. package/src/components/in-page-nav/config.json +11 -1
  78. package/src/components/indicator/config.json +2 -2
  79. package/src/components/input/config.json +2 -2
  80. package/src/components/label/config.json +2 -2
  81. package/src/components/language-selector/config.json +2 -2
  82. package/src/components/layout/Layout.tsx +1 -1
  83. package/src/components/layout/config.json +9 -9
  84. package/src/components/layout/layout.django.html +1 -1
  85. package/src/components/legend/config.json +3 -3
  86. package/src/components/link/config.json +2 -2
  87. package/src/components/memorable-date/config.json +9 -9
  88. package/src/components/misc-banner/MiscBanner.tsx +2 -1
  89. package/src/components/misc-banner/config.json +2 -2
  90. package/src/components/modal/config.json +2 -2
  91. package/src/components/page/Page.tsx +2 -1
  92. package/src/components/page/config.json +7 -7
  93. package/src/components/page/page.django.html +1 -1
  94. package/src/components/pagination/Pagination.tsx +2 -1
  95. package/src/components/pagination/container/PaginationContainer.tsx +2 -1
  96. package/src/components/prose/config.json +5 -1
  97. package/src/components/quote/Quote.tsx +58 -0
  98. package/src/components/quote/config.json +51 -0
  99. package/src/components/quote/quote.django.html +15 -0
  100. package/src/components/quote/quote.html +66 -0
  101. package/src/components/radio-buttons/config.json +3 -3
  102. package/src/components/range-slider/RangeSlider.tsx +2 -1
  103. package/src/components/range-slider/config.json +4 -4
  104. package/src/components/required/config.json +2 -2
  105. package/src/components/section/Section.tsx +6 -2
  106. package/src/components/section/config.json +19 -6
  107. package/src/components/section/section.django.html +9 -2
  108. package/src/components/select/config.json +2 -2
  109. package/src/components/site-alert/SiteAlert.tsx +5 -6
  110. package/src/components/skipnav/config.json +2 -2
  111. package/src/components/spinner/Spinner.tsx +18 -25
  112. package/src/components/spinner/config.json +4 -0
  113. package/src/components/spinner/spinner.django.html +4 -6
  114. package/src/components/summary-box/config.json +3 -3
  115. package/src/components/swap/Swap.tsx +4 -3
  116. package/src/components/swap/config.json +4 -4
  117. package/src/components/switch/config.json +2 -2
  118. package/src/components/table/config.json +13 -3
  119. package/src/components/tag/config.json +2 -2
  120. package/src/components/tag-group/config.json +2 -2
  121. package/src/components/text-area/config.json +2 -2
  122. package/src/components/time-picker/config.json +4 -4
  123. package/src/components/toggle/Toggle.tsx +69 -40
  124. package/src/components/toggle/config.json +42 -10
  125. package/src/components/toggle/toggle.django.html +25 -17
  126. package/src/components/toggle/toggle.html +319 -85
  127. package/src/components/tooltip/Tooltip.tsx +4 -2
  128. package/src/components/tooltip/config.json +9 -4
  129. package/src/components/tooltip/tooltip.django.html +1 -1
  130. package/src/components/villain/Villain.tsx +2 -1
  131. package/src/index.js +2 -1
  132. package/src/components/block/Block.tsx +0 -78
  133. package/src/components/block/block.django.html +0 -26
  134. package/src/components/block/block.html +0 -162
  135. package/src/components/block/config.json +0 -88
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "prose",
3
3
  "template": "prose/prose.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "containerElement": {
7
7
  "type": "select",
@@ -23,6 +23,10 @@
23
23
  "type": "string",
24
24
  "default": "",
25
25
  "description": "Additional CSS classes to apply to the prose component"
26
+ },
27
+ "children": {
28
+ "type": "slot",
29
+ "description": "Composed body content. Omit content when supplying children in React."
26
30
  }
27
31
  }
28
32
  }
@@ -0,0 +1,58 @@
1
+ import React from 'react';
2
+ import ClassNames from 'classnames';
3
+ import Callout, { type CalloutProps } from '../callout/Callout';
4
+ import Attribution, { type AttributionProps } from '../attribution/Attribution';
5
+ import Icon from '../icon/Icon';
6
+ import Link, { type LinkProps } from '../link/Link';
7
+
8
+ export interface QuoteProps extends Omit<React.HTMLAttributes<HTMLElement>, 'content'> {
9
+ className?: string;
10
+ calloutProps?: Omit<CalloutProps, 'element' | 'children' | 'content' | 'cite'>;
11
+ attributionProps?: AttributionProps;
12
+ children?: React.ReactNode;
13
+ content?: React.ReactNode;
14
+ sourceLinkProps?: Omit<LinkProps, 'children'>;
15
+ sourceTitle?: React.ReactNode;
16
+ blockquoteClassName?: string;
17
+ }
18
+
19
+ export default function Quote({
20
+ calloutProps,
21
+ attributionProps,
22
+ children,
23
+ content,
24
+ sourceLinkProps,
25
+ sourceTitle,
26
+ className,
27
+ blockquoteClassName,
28
+ ...props
29
+ }: QuoteProps) {
30
+ const isVertical = calloutProps?.orientation === 'vertical';
31
+ return (
32
+ <div className={ClassNames('usx-quote', isVertical && 'usx-quote--vertical', className)} {...props}>
33
+ {!isVertical && <Icon name="format_quote" size={4} className="usx-quote__icon" />}
34
+ <Callout {...calloutProps} element="div">
35
+ <figure className="usx-quote__body">
36
+ <blockquote
37
+ className={ClassNames('usx-quote__content', blockquoteClassName)}
38
+ cite={sourceLinkProps?.href}
39
+ >
40
+ {isVertical && '❝'}
41
+ {children ?? content}
42
+ {isVertical && '❞'}
43
+ </blockquote>
44
+ {(attributionProps || sourceTitle) && (
45
+ <figcaption className="usx-quote__attribution">
46
+ {attributionProps && <Attribution {...attributionProps} />}
47
+ {sourceTitle && (
48
+ <cite>
49
+ {sourceLinkProps ? <Link {...sourceLinkProps}>{sourceTitle}</Link> : sourceTitle}
50
+ </cite>
51
+ )}
52
+ </figcaption>
53
+ )}
54
+ </figure>
55
+ </Callout>
56
+ </div>
57
+ );
58
+ }
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "quote",
3
+ "template": "quote/quote.django.html",
4
+ "version": 3,
5
+ "props": {
6
+ "className": {
7
+ "type": "string",
8
+ "description": "Additional classes on the outer quote wrapper."
9
+ },
10
+ "calloutProps": {
11
+ "type": "object",
12
+ "description": "Props passed to the Callout containing the quotation and attribution.",
13
+ "component": "callout",
14
+ "omit": [
15
+ "element",
16
+ "children",
17
+ "content",
18
+ "cite"
19
+ ]
20
+ },
21
+ "attributionProps": {
22
+ "type": "object",
23
+ "description": "Props passed directly to Attribution in the figcaption.",
24
+ "component": "attribution"
25
+ },
26
+ "children": {
27
+ "type": "slot",
28
+ "description": "Quotation content. Takes precedence over content when supplied."
29
+ },
30
+ "content": {
31
+ "type": "slot",
32
+ "description": "Fallback quotation content."
33
+ },
34
+ "sourceLinkProps": {
35
+ "type": "object",
36
+ "component": "link",
37
+ "omit": [
38
+ "children"
39
+ ],
40
+ "description": "Props passed directly to the source Link. sourceTitle supplies its children; href also supplies the blockquote cite URL. Omit for an unlinked source title."
41
+ },
42
+ "sourceTitle": {
43
+ "type": "slot",
44
+ "description": "Title of the cited work, rendered in cite; use Attribution for the author."
45
+ },
46
+ "blockquoteClassName": {
47
+ "type": "string",
48
+ "description": "Additional classes applied only to the blockquote, excluding attribution and the outer wrapper."
49
+ }
50
+ }
51
+ }
@@ -0,0 +1,15 @@
1
+ {% load components %}
2
+ <div class="usx-quote{% if calloutProps.orientation == 'vertical' %} usx-quote--vertical{% endif %}{% if className %} {{ className }}{% endif %}">
3
+ {% if calloutProps.orientation != 'vertical' %}{% icon name="format_quote" size=4 className="usx-quote__icon" %}{% endicon %}{% endif %}
4
+ {% callout props=calloutProps element="div" %}
5
+ <figure class="usx-quote__body">
6
+ <blockquote class="usx-quote__content{% if blockquoteClassName %} {{ blockquoteClassName }}{% endif %}"{% if sourceLinkProps.href %} cite="{{ sourceLinkProps.href }}"{% endif %}>{% if calloutProps.orientation == 'vertical' %}❝{% endif %}{% if children != None %}{{ children|safe }}{% elif content != None %}{{ content|safe }}{% endif %}{% if calloutProps.orientation == 'vertical' %}❞{% endif %}</blockquote>
7
+ {% if attributionProps or sourceTitle %}
8
+ <figcaption class="usx-quote__attribution">
9
+ {% if attributionProps %}{% attribution props=attributionProps %}{{ attributionProps.children|safe }}{% endattribution %}{% endif %}
10
+ {% if sourceTitle %}<cite>{% if sourceLinkProps != None %}{% link props=sourceLinkProps %}{{ sourceTitle|safe }}{% endlink %}{% else %}{{ sourceTitle|safe }}{% endif %}</cite>{% endif %}
11
+ </figcaption>
12
+ {% endif %}
13
+ </figure>
14
+ {% endcallout %}
15
+ </div>
@@ -0,0 +1,66 @@
1
+ <div class="padding-3">
2
+ <section class="margin-bottom-4">
3
+ <h2>Default</h2>
4
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content">Good services start with understanding the people who use them.</blockquote></figure></div></div>
5
+ </section>
6
+
7
+ <section class="margin-bottom-4">
8
+ <h2>With Attribution</h2>
9
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content">Good services start with understanding the people who use them.</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div></figcaption></figure></div></div>
10
+ </section>
11
+
12
+ <section class="margin-bottom-4">
13
+ <h2>With Avatar</h2>
14
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-border-info usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content">Good services start with understanding the people who use them.</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span class="usx-attribution__media"><a href="#" class="usx-avatar"><img class="usx-avatar__img usx-circle" src="./george_washington.png" alt="George Washington" role="img"/></a></span><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div></figcaption></figure></div></div>
15
+ </section>
16
+
17
+ <section class="margin-bottom-4">
18
+ <h2>Vertical</h2>
19
+ <div class="usx-quote usx-quote--vertical"><div class="usx-callout usx-callout--vertical usx-border-info"><figure class="usx-quote__body"><blockquote class="usx-quote__content font-serif-lg">❝Good services start with understanding the people who use them.❞</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span class="usx-attribution__media"><a href="#" class="usx-avatar"><img class="usx-avatar__img usx-circle" src="./george_washington.png" alt="George Washington" role="img"/></a></span><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div></figcaption></figure></div></div>
20
+ </section>
21
+
22
+ <section class="margin-bottom-4">
23
+ <h2>With Callout Props</h2>
24
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-border-primary usx-callout--indent-sm bg-base-lightest text-primary padding-y-2 padding-right-2"><figure class="usx-quote__body"><blockquote class="usx-quote__content">Good services start with understanding the people who use them.</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div></figcaption></figure></div></div>
25
+ </section>
26
+
27
+ <section class="margin-bottom-4">
28
+ <h2>Typography</h2>
29
+ <div class="usx-quote maxw-tablet margin-y-2"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content font-serif-lg text-italic">Good services start with understanding the people who use them.</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution font-sans-sm"><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div></figcaption></figure></div></div>
30
+ </section>
31
+
32
+ <section class="margin-bottom-4">
33
+ <h2>With Source</h2>
34
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content" cite="https://example.com/report">Good services start with understanding the people who use them.</blockquote><figcaption class="usx-quote__attribution"><cite><a href="https://example.com/report" class="usa-link usx-link usa-link--external font-sans-sm" target="_blank" rel="noreferrer noopener">Service research report</a></cite></figcaption></figure></div></div>
35
+ </section>
36
+
37
+ <section class="margin-bottom-4">
38
+ <h2>With Avatar And Source</h2>
39
+ <div class="usx-quote usx-quote--vertical"><div class="usx-callout usx-callout--vertical usx-border-info usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content font-serif-lg" cite="https://example.com/report">❝Good services start with understanding the people who use them.❞</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span class="usx-attribution__media"><a href="#" class="usx-avatar"><img class="usx-avatar__img usx-circle" src="./george_washington.png" alt="George Washington" role="img"/></a></span><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div><cite><a href="https://example.com/report" class="usa-link usx-link usa-link--external font-sans-sm" target="_blank" rel="noreferrer noopener">Service research report</a></cite></figcaption></figure></div></div>
40
+ </section>
41
+
42
+ <section class="margin-bottom-4">
43
+ <h2>Source Title Only</h2>
44
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content">Good services start with understanding the people who use them.</blockquote><figcaption class="usx-quote__attribution"><cite>Service research report</cite></figcaption></figure></div></div>
45
+ </section>
46
+
47
+ <section class="margin-bottom-4">
48
+ <h2>Source Link Only</h2>
49
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content" cite="https://example.com/report">Good services start with understanding the people who use them.</blockquote></figure></div></div>
50
+ </section>
51
+
52
+ <section class="margin-bottom-4">
53
+ <h2>Children Override</h2>
54
+ <div class="usx-quote usx-quote--vertical"><div class="usx-callout usx-callout--vertical"><figure class="usx-quote__body"><blockquote class="usx-quote__content">❝<p><strong>Listen first.</strong> Then design around what people need.</p>❞</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div></figcaption></figure></div></div>
55
+ </section>
56
+
57
+ <section class="margin-bottom-4">
58
+ <h2>Empty Children</h2>
59
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content"></blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span class="usx-attribution__content"><span class="usx-attribution__primary">Jane Doe</span><span class="usx-attribution__secondary">Research director</span></span></div></figcaption></figure></div></div>
60
+ </section>
61
+
62
+ <section class="margin-bottom-4">
63
+ <h2>Custom Attribution</h2>
64
+ <div class="usx-quote"><svg class="usa-icon usa-icon--size-4 usx-quote__icon" aria-hidden="true" aria-label="format_quote icon" focusable="false" role="img"><use href="/img/sprite.svg#format_quote"></use></svg><div class="usx-callout usx-callout--big"><figure class="usx-quote__body"><blockquote class="usx-quote__content">Good services start with understanding the people who use them.</blockquote><figcaption class="usx-quote__attribution"><div class="usx-attribution"><span>Prepared by the <strong>Service research team</strong></span></div></figcaption></figure></div></div>
65
+ </section>
66
+ </div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "radio-buttons",
3
3
  "template": "radio-buttons/radio-buttons.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "required": [
6
6
  "options"
7
7
  ],
@@ -30,11 +30,11 @@
30
30
  "default": false
31
31
  },
32
32
  "hint": {
33
- "type": "string",
33
+ "type": "slot",
34
34
  "description": "Group-level hint text, rendered after the legend"
35
35
  },
36
36
  "error": {
37
- "type": "string",
37
+ "type": "slot",
38
38
  "description": "Group-level error message, rendered after the hint"
39
39
  },
40
40
  "name": {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import ClassNames from 'classnames';
2
3
 
3
4
  import Label from '../label/Label';
4
5
  import FormGroup from '../form-group/FormGroup';
@@ -53,7 +54,7 @@ export default function RangeSlider({
53
54
  {hint && <Hint id={hintId}>{hint}</Hint>}
54
55
  {error && <ErrorMessage id={errorId}>{error}</ErrorMessage>}
55
56
  <input
56
- className={['usa-range', 'usx-range-slider', className].filter(Boolean).join(' ')}
57
+ className={ClassNames('usa-range', 'usx-range-slider', className)}
57
58
  id={id}
58
59
  type="range"
59
60
  name={name || id}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "range-slider",
3
3
  "template": "range-slider/range-slider.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "id": "range-slider-default",
7
7
  "label": "Range slider",
@@ -22,15 +22,15 @@
22
22
  "description": "name attribute for the input. Defaults to id."
23
23
  },
24
24
  "label": {
25
- "type": "string",
25
+ "type": "slot",
26
26
  "description": "Label text for the field."
27
27
  },
28
28
  "hint": {
29
- "type": "string",
29
+ "type": "slot",
30
30
  "description": "Hint text displayed below the label."
31
31
  },
32
32
  "error": {
33
- "type": "string",
33
+ "type": "slot",
34
34
  "description": "Error message. Renders aria-describedby and error styling."
35
35
  },
36
36
  "disabled": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "required",
3
3
  "template": "required/required.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "title": {
7
7
  "type": "string",
@@ -9,7 +9,7 @@
9
9
  "description": "Title attribute for the required indicator (default: 'required')"
10
10
  },
11
11
  "children": {
12
- "type": "string",
12
+ "type": "slot",
13
13
  "description": "Inner HTML or text"
14
14
  },
15
15
  "className": {
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import ClassNames from 'classnames';
2
3
 
3
4
  export interface SectionProps extends React.HTMLAttributes<HTMLElement> {
4
5
  title?: string;
6
+ headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
5
7
  children?: React.ReactNode;
6
8
  content?: React.ReactNode;
7
9
  className?: string;
@@ -9,17 +11,19 @@ export interface SectionProps extends React.HTMLAttributes<HTMLElement> {
9
11
 
10
12
  const Section: React.FC<SectionProps> = ({
11
13
  title = '',
14
+ headingLevel = 'h2',
12
15
  children = null,
13
16
  content = null,
14
17
  className = '',
15
18
  ...props
16
19
  }) => {
17
- const classes = ['usx-section', className].filter(Boolean).join(' ');
20
+ const classes = ClassNames('usx-section', className);
18
21
  const sectionContent = children || content;
22
+ const Heading = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(headingLevel) ? headingLevel : 'h2';
19
23
 
20
24
  return (
21
25
  <section className={classes} {...props}>
22
- {title ? <h2 className="usx-section__title">{title}</h2> : null}
26
+ {title ? <Heading className="usx-section__title">{title}</Heading> : null}
23
27
  <div className="usx-section__content">{sectionContent}</div>
24
28
  </section>
25
29
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "section",
3
3
  "template": "section/section.django.html",
4
- "version": 1,
4
+ "version": 3,
5
5
  "default": {
6
6
  "title": "",
7
7
  "content": "Use section to group related page content with consistent spacing."
@@ -9,15 +9,28 @@
9
9
  "props": {
10
10
  "title": {
11
11
  "type": "string",
12
- "description": "Optional section heading rendered as an h2."
12
+ "description": "Optional section heading."
13
+ },
14
+ "headingLevel": {
15
+ "type": "select",
16
+ "options": [
17
+ "h1",
18
+ "h2",
19
+ "h3",
20
+ "h4",
21
+ "h5",
22
+ "h6"
23
+ ],
24
+ "default": "h2",
25
+ "description": "Heading element used when title is provided. Defaults to h2."
13
26
  },
14
27
  "content": {
15
- "type": "string",
16
- "description": "Section body content. Supports HTML in Django stories."
28
+ "type": "slot",
29
+ "description": "Section body content. Supports HTML in Django stories. Ignored if children is provided."
17
30
  },
18
31
  "children": {
19
- "type": "string",
20
- "description": "Section body content for React usage."
32
+ "type": "slot",
33
+ "description": "Section body content for React usage. Takes precedence over content if both are provided."
21
34
  },
22
35
  "className": {
23
36
  "type": "string",
@@ -1,5 +1,12 @@
1
1
  {# Django template for Section #}
2
2
  <section class="usx-section{% if className %} {{ className }}{% endif %}">
3
- {% if title %}<h2 class="usx-section__title">{{ title }}</h2>{% endif %}
4
- <div class="usx-section__content">{% if content %}{{ content|safe }}{% elif children %}{{ children|safe }}{% endif %}</div>
3
+ {% if title %}
4
+ {% if headingLevel == 'h1' %}<h1 class="usx-section__title">{{ title }}</h1>
5
+ {% elif headingLevel == 'h3' %}<h3 class="usx-section__title">{{ title }}</h3>
6
+ {% elif headingLevel == 'h4' %}<h4 class="usx-section__title">{{ title }}</h4>
7
+ {% elif headingLevel == 'h5' %}<h5 class="usx-section__title">{{ title }}</h5>
8
+ {% elif headingLevel == 'h6' %}<h6 class="usx-section__title">{{ title }}</h6>
9
+ {% else %}<h2 class="usx-section__title">{{ title }}</h2>{% endif %}
10
+ {% endif %}
11
+ <div class="usx-section__content">{% if children %}{{ children|safe }}{% elif content %}{{ content|safe }}{% endif %}</div>
5
12
  </section>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "select",
3
3
  "template": "select/select.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "required": [
6
6
  "options"
7
7
  ],
@@ -15,7 +15,7 @@
15
15
  "description": "Name of the select input, used for form submission"
16
16
  },
17
17
  "label": {
18
- "type": "string",
18
+ "type": "slot",
19
19
  "description": "Label for the select input"
20
20
  },
21
21
  "options": {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import ClassNames from 'classnames';
2
3
  import Alert, { AlertProps } from '../alert/Alert';
3
4
  import Icon from '../icon/Icon';
4
5
 
@@ -36,7 +37,7 @@ const SiteAlert: React.FC<SiteAlertProps> = ({
36
37
  ? 'warning'
37
38
  : normalizedVariant;
38
39
 
39
- const classes = [
40
+ const classes = ClassNames(
40
41
  'usa-site-alert',
41
42
  'usx-site-alert',
42
43
  (normalizedVariant === 'info' || normalizedVariant === 'emergency') && `usa-site-alert--${normalizedVariant}`,
@@ -45,11 +46,9 @@ const SiteAlert: React.FC<SiteAlertProps> = ({
45
46
  noIcon && 'usa-site-alert--no-icon',
46
47
  onDismiss && 'usa-site-alert--dismissible',
47
48
  className
48
- ]
49
- .filter(Boolean)
50
- .join(' ');
49
+ );
51
50
 
52
- const alertClasses = [
51
+ const alertClasses = ClassNames(
53
52
  'usa-alert',
54
53
  `usa-alert--${alertVariant}`,
55
54
  'usx-alert',
@@ -58,7 +57,7 @@ const SiteAlert: React.FC<SiteAlertProps> = ({
58
57
  slim && 'usx-alert--slim',
59
58
  noIcon && 'usa-alert--no-icon',
60
59
  noIcon && 'usx-alert--no-icon',
61
- ].filter(Boolean).join(' ');
60
+ );
62
61
 
63
62
  return (
64
63
  <section
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "skipnav",
3
3
  "template": "skipnav/skipnav.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "target": {
7
7
  "type": "string",
@@ -13,7 +13,7 @@
13
13
  "description": "Full href for the skip link (overrides `target`/`skipTo`). Useful if you need to link to a different page or a non-anchor URL."
14
14
  },
15
15
  "content": {
16
- "type": "string",
16
+ "type": "slot",
17
17
  "default": "Skip to main content",
18
18
  "description": "Text content for the skipnav link"
19
19
  },
@@ -1,45 +1,38 @@
1
1
  import React from 'react';
2
+ import Icon from '../icon/Icon';
3
+ import Label from '../label/Label';
2
4
 
3
5
  export interface SpinnerProps extends React.HTMLAttributes<HTMLSpanElement> {
4
- size?: 1 | 2 | 3 | 4 | 5;
5
- color?: string | null;
6
+ size?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
7
+ color?: string;
6
8
  label?: string;
7
- omitLabel?: boolean;
9
+ screenReaderLabel?: string;
8
10
  staticUrlPrefix?: string;
11
+ staticBaseUrl?: string;
9
12
  className?: string;
10
13
  }
11
14
 
12
- const getDefaultStaticUrlPrefix = () => {
13
- if (typeof window !== 'undefined' && (window as unknown as { usxBaseUrl?: string }).usxBaseUrl) {
14
- return (window as unknown as { usxBaseUrl?: string }).usxBaseUrl + 'img/usx-sprite.svg#';
15
- }
16
- return '/img/usx-sprite.svg#';
17
- };
18
-
19
15
  const Spinner: React.FC<SpinnerProps> = ({
20
16
  size = 3,
21
- color = null,
17
+ color,
22
18
  label = null,
23
19
  screenReaderLabel = null,
24
- staticUrlPrefix = getDefaultStaticUrlPrefix(),
20
+ staticUrlPrefix,
21
+ staticBaseUrl,
25
22
  className = '',
26
23
  ...props
27
24
  }) => {
28
25
  return (
29
26
  <span role="status" aria-live="polite" className={`usx-spinner ${className}`} {...props}>
30
- <svg
31
- className={
32
- 'usa-icon ' +
33
- (size === 1 ? 'usx-spinner--size-1' : 'usa-icon--size-' + size) +
34
- (color ? ' text-' + color : '')
35
- }
36
- aria-hidden="true"
37
- focusable="false"
38
- >
39
- <use href={staticUrlPrefix + 'spinner'} />
40
- </svg>
41
- {screenReaderLabel && <span className="usa-sr-only">{screenReaderLabel}</span>}
42
- {label && <span className="usa-label usx-label">{label}</span>}
27
+ <Icon
28
+ name="spinner"
29
+ source="usx"
30
+ size={size}
31
+ color={color}
32
+ staticBaseUrl={staticBaseUrl}
33
+ />
34
+ {screenReaderLabel && <Label screenReaderOnly={true}>{screenReaderLabel}</Label>}
35
+ {label && <Label>{label}</Label>}
43
36
  </span>
44
37
  );
45
38
  };
@@ -3,6 +3,10 @@
3
3
  "template": "spinner/spinner.django.html",
4
4
  "version": 1,
5
5
  "props": {
6
+ "staticBaseUrl": {
7
+ "type": "string",
8
+ "description": "Optional asset base for this component. A non-empty value overrides window.usxBaseUrl in React or STATIC_URL in Django; otherwise the global base or / is used. Asset filenames remain separate."
9
+ },
6
10
  "size": {
7
11
  "type": "select",
8
12
  "options": [
@@ -1,9 +1,7 @@
1
- {% load static %}
1
+ {% load components %}
2
2
  {# Django template for Spinner #}
3
3
  <span role="status" aria-live="polite" class="usx-spinner{% if className %} {{ className }}{% endif %}">
4
- <svg class="usa-icon {% if size == 1 %}usx-spinner--size-1{% else %}usa-icon--size-{{ size|default:3 }}{% endif %}{% if color %} text-{{ color }}{% endif %}" aria-hidden="true" focusable="false">
5
- <use href="{% static 'img/usx-sprite.svg' %}#spinner"></use>
6
- </svg>
7
- {% if screenReaderLabel %}<span class="usa-sr-only">{{ screenReaderLabel }}</span>{% endif %}
8
- {% if label %}<span class="usa-label usx-label">{{ label }}</span>{% endif %}
4
+ {% icon name="spinner" source="usx" size=size|default:3 color=color staticBaseUrl=staticBaseUrl staticUrlPrefix=staticUrlPrefix %}{% endicon %}
5
+ {% if screenReaderLabel %}{% label screenReaderOnly=True %}{{ screenReaderLabel }}{% endlabel %}{% endif %}
6
+ {% if label %}{% label %}{{ label }}{% endlabel %}{% endif %}
9
7
  </span>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "summary-box",
3
3
  "template": "summary-box/summary-box.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "required": [
6
6
  "heading"
7
7
  ],
@@ -15,11 +15,11 @@
15
15
  "description": "Required summary heading"
16
16
  },
17
17
  "content": {
18
- "type": "string",
18
+ "type": "slot",
19
19
  "description": "HTML/text summary content"
20
20
  },
21
21
  "children": {
22
- "type": "string",
22
+ "type": "slot",
23
23
  "description": "Inner HTML or text (takes priority over content)"
24
24
  },
25
25
  "className": {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import ClassNames from 'classnames';
2
3
 
3
4
  export interface SwapProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
4
5
  children?: React.ReactNode;
@@ -25,9 +26,9 @@ const Swap: React.FC<SwapProps> = ({
25
26
  ...props
26
27
  }) => {
27
28
  const variantClass = variant !== 'default' ? `usx-swap--${variant}` : '';
28
- const classes = ['usx-swap', variantClass, className].filter(Boolean).join(' ');
29
- const onClasses = ['usx-swap-on', onClassName].filter(Boolean).join(' ');
30
- const offClasses = ['usx-swap-off', offClassName].filter(Boolean).join(' ');
29
+ const classes = ClassNames('usx-swap', variantClass, className);
30
+ const onClasses = ClassNames('usx-swap-on', onClassName);
31
+ const offClasses = ClassNames('usx-swap-off', offClassName);
31
32
 
32
33
  const content = children || (
33
34
  <>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "swap",
3
3
  "template": "swap/swap.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "onContent": "ON",
7
7
  "offContent": "OFF",
@@ -10,15 +10,15 @@
10
10
  },
11
11
  "props": {
12
12
  "children": {
13
- "type": "string",
13
+ "type": "slot",
14
14
  "description": "Advanced override for full inner HTML"
15
15
  },
16
16
  "onContent": {
17
- "type": "string",
17
+ "type": "slot",
18
18
  "description": "Markup or text shown when swap is on"
19
19
  },
20
20
  "offContent": {
21
- "type": "string",
21
+ "type": "slot",
22
22
  "description": "Markup or text shown when swap is off"
23
23
  },
24
24
  "includeInput": {