@solexllc/usx-react 0.4.0 → 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 (99) hide show
  1. package/dist/index.cjs +329 -274
  2. package/dist/index.js +329 -274
  3. package/package.json +5 -5
  4. package/src/components/attribution/config.json +5 -5
  5. package/src/components/banner/config.json +2 -2
  6. package/src/components/breadcrumb/Breadcrumb.tsx +5 -6
  7. package/src/components/breadcrumb/config.json +11 -1
  8. package/src/components/button/button.html +2 -2
  9. package/src/components/button-group/button-group.django.html +1 -1
  10. package/src/components/calendar-date/calendar-date.django.html +3 -3
  11. package/src/components/callout/Callout.tsx +53 -0
  12. package/src/components/callout/callout.django.html +5 -0
  13. package/src/components/callout/callout.html +76 -0
  14. package/src/components/callout/config.json +74 -0
  15. package/src/components/card/Card.tsx +18 -34
  16. package/src/components/card/card.django.html +12 -10
  17. package/src/components/card/config.json +15 -40
  18. package/src/components/card-group/card-group.django.html +1 -1
  19. package/src/components/carousel/Carousel.tsx +3 -2
  20. package/src/components/carousel/carousel.django.html +13 -2
  21. package/src/components/carousel/config.json +2 -2
  22. package/src/components/character-count/config.json +2 -2
  23. package/src/components/checkbox-group/CheckboxGroup.tsx +10 -20
  24. package/src/components/checkbox-group/checkbox-group.django.html +10 -4
  25. package/src/components/checkbox-group/config.json +10 -5
  26. package/src/components/clickable/clickable.html +21 -39
  27. package/src/components/clickable/config.json +2 -2
  28. package/src/components/collection/Collection.tsx +5 -5
  29. package/src/components/collection/collection.django.html +2 -4
  30. package/src/components/collection/config.json +7 -6
  31. package/src/components/combobox/config.json +4 -4
  32. package/src/components/date-picker/config.json +4 -4
  33. package/src/components/date-range-picker/config.json +7 -7
  34. package/src/components/error-message/config.json +2 -2
  35. package/src/components/eyebrow/Eyebrow.tsx +2 -1
  36. package/src/components/eyebrow/config.json +2 -2
  37. package/src/components/fieldset/config.json +5 -5
  38. package/src/components/file-input/FileInput.tsx +3 -2
  39. package/src/components/file-input/config.json +5 -5
  40. package/src/components/file-list/FileList.tsx +2 -1
  41. package/src/components/file-list/config.json +2 -2
  42. package/src/components/footer/Footer.tsx +5 -5
  43. package/src/components/form-group/config.json +2 -2
  44. package/src/components/hero/Hero.tsx +8 -14
  45. package/src/components/hero/config.json +36 -27
  46. package/src/components/hero/hero.django.html +2 -2
  47. package/src/components/hint/config.json +2 -2
  48. package/src/components/in-page-nav/config.json +11 -1
  49. package/src/components/indicator/config.json +2 -2
  50. package/src/components/input/config.json +2 -2
  51. package/src/components/label/config.json +2 -2
  52. package/src/components/language-selector/config.json +2 -2
  53. package/src/components/layout/Layout.tsx +1 -1
  54. package/src/components/legend/config.json +3 -3
  55. package/src/components/link/config.json +2 -2
  56. package/src/components/memorable-date/config.json +9 -9
  57. package/src/components/misc-banner/MiscBanner.tsx +2 -1
  58. package/src/components/misc-banner/config.json +2 -2
  59. package/src/components/modal/config.json +2 -2
  60. package/src/components/page/Page.tsx +2 -1
  61. package/src/components/page/config.json +7 -7
  62. package/src/components/page/page.django.html +1 -1
  63. package/src/components/pagination/Pagination.tsx +2 -1
  64. package/src/components/pagination/container/PaginationContainer.tsx +2 -1
  65. package/src/components/prose/config.json +5 -1
  66. package/src/components/quote/Quote.tsx +58 -0
  67. package/src/components/quote/config.json +51 -0
  68. package/src/components/quote/quote.django.html +15 -0
  69. package/src/components/quote/quote.html +66 -0
  70. package/src/components/radio-buttons/config.json +3 -3
  71. package/src/components/range-slider/RangeSlider.tsx +2 -1
  72. package/src/components/range-slider/config.json +4 -4
  73. package/src/components/required/config.json +2 -2
  74. package/src/components/section/Section.tsx +6 -2
  75. package/src/components/section/config.json +19 -6
  76. package/src/components/section/section.django.html +9 -2
  77. package/src/components/select/config.json +2 -2
  78. package/src/components/site-alert/SiteAlert.tsx +5 -6
  79. package/src/components/skipnav/config.json +2 -2
  80. package/src/components/summary-box/config.json +3 -3
  81. package/src/components/swap/Swap.tsx +4 -3
  82. package/src/components/swap/config.json +4 -4
  83. package/src/components/switch/config.json +2 -2
  84. package/src/components/table/config.json +13 -3
  85. package/src/components/tag/config.json +2 -2
  86. package/src/components/tag-group/config.json +2 -2
  87. package/src/components/text-area/config.json +2 -2
  88. package/src/components/time-picker/config.json +4 -4
  89. package/src/components/toggle/Toggle.tsx +69 -40
  90. package/src/components/toggle/config.json +42 -10
  91. package/src/components/toggle/toggle.django.html +25 -17
  92. package/src/components/toggle/toggle.html +319 -85
  93. package/src/components/tooltip/config.json +2 -2
  94. package/src/components/villain/Villain.tsx +2 -1
  95. package/src/index.js +2 -1
  96. package/src/components/block/Block.tsx +0 -78
  97. package/src/components/block/block.django.html +0 -26
  98. package/src/components/block/block.html +0 -162
  99. package/src/components/block/config.json +0 -88
@@ -1,4 +1,5 @@
1
1
  import React, { useState } from 'react';
2
+ import ClassNames from 'classnames';
2
3
  import PaginationNavigation from './navigation/PaginationNavigation';
3
4
  import PaginationStepOptions from './step-options/PaginationStepOptions';
4
5
  import PaginationSummary from './summary/PaginationSummary';
@@ -70,7 +71,7 @@ export default function Pagination({
70
71
  onPageChange?.(newPage, size);
71
72
  };
72
73
 
73
- const classes = ['usx-pagination', className].filter(Boolean).join(' ');
74
+ const classes = ClassNames('usx-pagination', className);
74
75
 
75
76
  return (
76
77
  <div className={classes}>
@@ -1,4 +1,5 @@
1
1
  import React, { ReactNode, HTMLAttributes } from 'react';
2
+ import ClassNames from 'classnames';
2
3
 
3
4
  export interface PaginationContainerProps extends HTMLAttributes<HTMLDivElement> {
4
5
  summary?: ReactNode;
@@ -20,7 +21,7 @@ export default function PaginationContainer({
20
21
  className = '',
21
22
  ...props
22
23
  }: PaginationContainerProps) {
23
- const classes = ['usx-pagination__container', className].filter(Boolean).join(' ');
24
+ const classes = ClassNames('usx-pagination__container', className);
24
25
 
25
26
  return (
26
27
  <div className={classes} {...props}>
@@ -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,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": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "switch",
3
3
  "template": "switch/switch.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "id": {
7
7
  "type": "string",
@@ -35,7 +35,7 @@
35
35
  "description": "Color variant (primary, success, warning, etc.)"
36
36
  },
37
37
  "label": {
38
- "type": "string",
38
+ "type": "slot",
39
39
  "description": "Optional label text to display next to the switch"
40
40
  },
41
41
  "indeterminate": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "table",
3
3
  "template": "table/table.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "required": [
6
6
  "columns",
7
7
  "data"
@@ -93,7 +93,7 @@
93
93
  "description": "Property name used as the unique row identifier."
94
94
  },
95
95
  "caption": {
96
- "type": "string",
96
+ "type": "slot",
97
97
  "description": "Table caption rendered as <caption>."
98
98
  },
99
99
  "striped": {
@@ -220,7 +220,7 @@
220
220
  "description": "Show a loading state overlay. Does not affect interactivity."
221
221
  },
222
222
  "placeholder": {
223
- "type": "string",
223
+ "type": "slot",
224
224
  "description": "Content shown when the data array is empty."
225
225
  },
226
226
  "className": {
@@ -292,6 +292,16 @@
292
292
  "type": "object",
293
293
  "default": null,
294
294
  "description": "Django only. Pagination state dict from table_helper.paginate_table(): {current_page, total_pages, total, page_size}. Required when paginate is True."
295
+ },
296
+ "children": {
297
+ "type": "slot",
298
+ "description": "Composed table sections, replacing the generated table sections (React only).",
299
+ "renderers": {
300
+ "django": {
301
+ "supported": false,
302
+ "description": "The Django template does not consume children."
303
+ }
304
+ }
295
305
  }
296
306
  }
297
307
  }