@solexllc/usx-react 0.4.0 → 0.6.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 (105) hide show
  1. package/README.md +99 -0
  2. package/dist/index.cjs +576 -442
  3. package/dist/index.js +576 -442
  4. package/package.json +5 -5
  5. package/src/components/attribution/config.json +5 -5
  6. package/src/components/banner/config.json +2 -2
  7. package/src/components/breadcrumb/Breadcrumb.tsx +5 -6
  8. package/src/components/breadcrumb/config.json +11 -1
  9. package/src/components/button/button.html +2 -2
  10. package/src/components/button-group/button-group.django.html +1 -1
  11. package/src/components/calendar-date/calendar-date.django.html +3 -3
  12. package/src/components/callout/Callout.tsx +53 -0
  13. package/src/components/callout/callout.django.html +5 -0
  14. package/src/components/callout/callout.html +76 -0
  15. package/src/components/callout/config.json +74 -0
  16. package/src/components/card/Card.tsx +18 -34
  17. package/src/components/card/card.django.html +12 -10
  18. package/src/components/card/config.json +15 -40
  19. package/src/components/card-group/card-group.django.html +1 -1
  20. package/src/components/carousel/Carousel.tsx +3 -2
  21. package/src/components/carousel/carousel.django.html +13 -2
  22. package/src/components/carousel/config.json +2 -2
  23. package/src/components/character-count/config.json +2 -2
  24. package/src/components/checkbox-group/CheckboxGroup.tsx +10 -20
  25. package/src/components/checkbox-group/checkbox-group.django.html +10 -4
  26. package/src/components/checkbox-group/config.json +10 -5
  27. package/src/components/clickable/clickable.html +21 -39
  28. package/src/components/clickable/config.json +2 -2
  29. package/src/components/collection/Collection.tsx +5 -5
  30. package/src/components/collection/collection.django.html +2 -4
  31. package/src/components/collection/config.json +7 -6
  32. package/src/components/combobox/config.json +4 -4
  33. package/src/components/container/Container.tsx +108 -0
  34. package/src/components/container/_layout-classes.django.html +12 -0
  35. package/src/components/container/config.json +288 -0
  36. package/src/components/container/container.django.html +13 -0
  37. package/src/components/container/container.html +125 -0
  38. package/src/components/date-picker/config.json +4 -4
  39. package/src/components/date-range-picker/config.json +7 -7
  40. package/src/components/error-message/config.json +2 -2
  41. package/src/components/eyebrow/Eyebrow.tsx +2 -1
  42. package/src/components/eyebrow/config.json +2 -2
  43. package/src/components/fieldset/config.json +5 -5
  44. package/src/components/file-input/FileInput.tsx +3 -2
  45. package/src/components/file-input/config.json +5 -5
  46. package/src/components/file-list/FileList.tsx +2 -1
  47. package/src/components/file-list/config.json +2 -2
  48. package/src/components/footer/Footer.tsx +5 -5
  49. package/src/components/form-group/config.json +2 -2
  50. package/src/components/hero/Hero.tsx +8 -14
  51. package/src/components/hero/config.json +36 -27
  52. package/src/components/hero/hero.django.html +2 -2
  53. package/src/components/hint/config.json +2 -2
  54. package/src/components/in-page-nav/config.json +11 -1
  55. package/src/components/indicator/config.json +2 -2
  56. package/src/components/input/config.json +2 -2
  57. package/src/components/label/config.json +2 -2
  58. package/src/components/language-selector/config.json +2 -2
  59. package/src/components/layout/Layout.tsx +1 -1
  60. package/src/components/legend/config.json +3 -3
  61. package/src/components/link/config.json +2 -2
  62. package/src/components/memorable-date/config.json +9 -9
  63. package/src/components/misc-banner/MiscBanner.tsx +2 -1
  64. package/src/components/misc-banner/config.json +2 -2
  65. package/src/components/modal/config.json +2 -2
  66. package/src/components/page/Page.tsx +2 -1
  67. package/src/components/page/config.json +7 -7
  68. package/src/components/page/page.django.html +1 -1
  69. package/src/components/pagination/Pagination.tsx +2 -1
  70. package/src/components/pagination/container/PaginationContainer.tsx +2 -1
  71. package/src/components/prose/config.json +5 -1
  72. package/src/components/quote/Quote.tsx +58 -0
  73. package/src/components/quote/config.json +51 -0
  74. package/src/components/quote/quote.django.html +15 -0
  75. package/src/components/quote/quote.html +66 -0
  76. package/src/components/radio-buttons/config.json +3 -3
  77. package/src/components/range-slider/RangeSlider.tsx +2 -1
  78. package/src/components/range-slider/config.json +4 -4
  79. package/src/components/required/config.json +2 -2
  80. package/src/components/section/Section.tsx +6 -2
  81. package/src/components/section/config.json +19 -6
  82. package/src/components/section/section.django.html +9 -2
  83. package/src/components/select/config.json +2 -2
  84. package/src/components/site-alert/SiteAlert.tsx +5 -6
  85. package/src/components/skipnav/config.json +2 -2
  86. package/src/components/summary-box/config.json +3 -3
  87. package/src/components/swap/Swap.tsx +4 -3
  88. package/src/components/swap/config.json +4 -4
  89. package/src/components/switch/config.json +2 -2
  90. package/src/components/table/config.json +13 -3
  91. package/src/components/tag/config.json +2 -2
  92. package/src/components/tag-group/config.json +2 -2
  93. package/src/components/text-area/config.json +2 -2
  94. package/src/components/time-picker/config.json +4 -4
  95. package/src/components/toggle/Toggle.tsx +69 -40
  96. package/src/components/toggle/config.json +42 -10
  97. package/src/components/toggle/toggle.django.html +25 -17
  98. package/src/components/toggle/toggle.html +319 -85
  99. package/src/components/tooltip/config.json +2 -2
  100. package/src/components/villain/Villain.tsx +2 -1
  101. package/src/index.js +3 -1
  102. package/src/components/block/Block.tsx +0 -78
  103. package/src/components/block/block.django.html +0 -26
  104. package/src/components/block/block.html +0 -162
  105. package/src/components/block/config.json +0 -88
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "file-list",
3
3
  "template": "file-list/file-list.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "files": [
7
7
  {
@@ -22,7 +22,7 @@
22
22
  "description": "Files to render as rows. Each entry is { key, file?, name?, size?, url?, onRemove? } — key uniquely identifies the row; file is a browser File (name/size read from it); name/size describe entries with no File object (e.g. files already on the server); url renders the name as a download link; onRemove overrides the onRemove prop for just this row. React only."
23
23
  },
24
24
  "hint": {
25
- "type": "string",
25
+ "type": "slot",
26
26
  "default": "Selected files",
27
27
  "description": "Heading/hint text shown above the file list."
28
28
  },
@@ -39,7 +39,7 @@ export interface FooterNavColumnProps {
39
39
  }
40
40
  export function FooterNavColumn({ heading, links = [], className = '' }: FooterNavColumnProps) {
41
41
  return (
42
- <section className={['usa-footer__primary-content usa-footer__primary-content--collapsible usx-footer__nav-column', className].filter(Boolean).join(' ')}>
42
+ <section className={ClassNames('usa-footer__primary-content usa-footer__primary-content--collapsible usx-footer__nav-column', className)}>
43
43
  {heading && <h4 className="usa-footer__primary-link">{heading}</h4>}
44
44
  {links.length > 0 && (
45
45
  <ul className="usa-list usa-list--unstyled">
@@ -73,7 +73,7 @@ export function FooterSignUp({
73
73
  className = '',
74
74
  }: FooterSignUpProps) {
75
75
  return (
76
- <div className={['usa-sign-up usx-footer__sign-up', className].filter(Boolean).join(' ')}>
76
+ <div className={ClassNames('usa-sign-up usx-footer__sign-up', className)}>
77
77
  <h3 className="usa-sign-up__heading">{heading}</h3>
78
78
  <form className="usa-form" action={action || undefined} onSubmit={onSubmit || undefined}>
79
79
  <Input
@@ -102,7 +102,7 @@ export interface FooterSocialLinksProps {
102
102
  export function FooterSocialLinks({ links = [], staticBaseUrl, className = '' }: FooterSocialLinksProps) {
103
103
  if (!links.length) return null;
104
104
  return (
105
- <div className={['usa-footer__social-links grid-row grid-gap-1 usx-footer__social-links', className].filter(Boolean).join(' ')}>
105
+ <div className={ClassNames('usa-footer__social-links grid-row grid-gap-1 usx-footer__social-links', className)}>
106
106
  {links.map((link, i) => (
107
107
  <div key={i} className="grid-col-auto">
108
108
  <a className="usa-social-link" href={link.href} aria-label={link.alt}>
@@ -148,7 +148,7 @@ export function FooterContact({
148
148
 
149
149
  if (!heading && allLinks.length === 0) return null;
150
150
  return (
151
- <address className={['usa-footer__address usx-footer__contact', className].filter(Boolean).join(' ')}>
151
+ <address className={ClassNames('usa-footer__address usx-footer__contact', className)}>
152
152
  {heading && <p className="usa-footer__contact-heading">{heading}</p>}
153
153
  {allLinks.length > 0 && (
154
154
  <div className="usa-footer__contact-info grid-row grid-gap">
@@ -210,7 +210,7 @@ export default function Footer({
210
210
  const variantClass = variant === 'big' ? 'usa-footer--big'
211
211
  : variant === 'slim' ? 'usa-footer--slim'
212
212
  : '';
213
- const classes = ['usa-footer', variantClass, 'usx-footer', className].filter(Boolean).join(' ');
213
+ const classes = ClassNames('usa-footer', variantClass, 'usx-footer', className);
214
214
 
215
215
  const returnToTopEl = returnToTop ? (
216
216
  <FooterReturnToTop
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "form-group",
3
3
  "template": "form-group/form-group.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "children": {
7
- "type": "string",
7
+ "type": "slot",
8
8
  "default": null,
9
9
  "description": "Inner HTML content of the form group."
10
10
  },
@@ -1,12 +1,8 @@
1
1
  import React from 'react';
2
- import Button from '../button/Button';
2
+ import ClassNames from 'classnames';
3
+ import Button, { type ButtonProps } from '../button/Button';
3
4
  import Search, { SearchProps } from '../search/Search';
4
5
 
5
- export interface HeroButtonProps {
6
- href?: string;
7
- text: string;
8
- onClick?: React.MouseEventHandler<HTMLAnchorElement | HTMLButtonElement>;
9
- }
10
6
 
11
7
  export interface HeroSecondaryContent {
12
8
  title?: string;
@@ -18,7 +14,7 @@ export interface HeroProps extends React.HTMLAttributes<HTMLElement> {
18
14
  title?: string;
19
15
  callout?: string;
20
16
  paragraph?: string;
21
- button?: HeroButtonProps | null;
17
+ buttonProps?: ButtonProps | null;
22
18
  searchProps?: SearchProps | null;
23
19
  backgroundImage?: string;
24
20
  backgroundPosition?: React.CSSProperties['backgroundPosition'];
@@ -37,7 +33,7 @@ export default function Hero({
37
33
  title = '',
38
34
  callout = '',
39
35
  paragraph = '',
40
- button = null,
36
+ buttonProps = null,
41
37
  searchProps = null,
42
38
  backgroundImage = '',
43
39
  backgroundPosition,
@@ -56,7 +52,7 @@ export default function Hero({
56
52
  const Heading = headingLevel;
57
53
  const secondaryHeadings = { h1: 'h2', h2: 'h3', h3: 'h4', h4: 'h5', h5: 'h6' } as const;
58
54
  const SecondaryHeading = secondaryHeadings[headingLevel];
59
- const classes = [
55
+ const classes = ClassNames(
60
56
  'usx-hero',
61
57
  overlay && 'usx-hero--has-overlay',
62
58
  overlayOpacity !== undefined && 'usx-hero--custom-overlay',
@@ -64,7 +60,7 @@ export default function Hero({
64
60
  !boxed && 'usx-hero--unboxed',
65
61
  secondaryContent && 'usx-hero--split',
66
62
  className,
67
- ].filter(Boolean).join(' ');
63
+ );
68
64
 
69
65
  const heroStyle: React.CSSProperties & { '--hero-overlay-opacity'?: number } = {
70
66
  ...(backgroundImage ? { backgroundImage: `url('${backgroundImage}')` } : {}),
@@ -83,10 +79,8 @@ export default function Hero({
83
79
  </Heading>
84
80
  {paragraph && <p className="usx-hero__paragraph">{paragraph}</p>}
85
81
  {searchProps && <Search {...searchProps} />}
86
- {!searchProps && button && (
87
- <Button variant="primary" href={button.href} onClick={button.onClick}>
88
- {button.text}
89
- </Button>
82
+ {!searchProps && buttonProps && (
83
+ <Button {...buttonProps} />
90
84
  )}
91
85
  </div>
92
86
  {secondaryContent && (
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "hero",
3
3
  "template": "hero/hero.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "title": "The hero heading",
7
7
  "callout": "A callout heading",
8
8
  "paragraph": "A short description of the hero section that provides context for the call to action.",
9
- "button": {
9
+ "backgroundImage": "https://designsystem.digital.gov/img/introducing-uswds-2-0/built-to-grow--alt.jpg",
10
+ "overlay": true,
11
+ "buttonProps": {
10
12
  "href": "#",
11
13
  "text": "Call to action"
12
- },
13
- "backgroundImage": "https://designsystem.digital.gov/img/introducing-uswds-2-0/built-to-grow--alt.jpg",
14
- "overlay": true
14
+ }
15
15
  },
16
16
  "props": {
17
17
  "title": {
@@ -26,23 +26,10 @@
26
26
  "type": "string",
27
27
  "description": "Optional body paragraph text"
28
28
  },
29
- "button": {
29
+ "buttonProps": {
30
30
  "type": "object",
31
- "description": "Optional call-to-action button. Mutually exclusive with search.",
32
- "properties": {
33
- "href": {
34
- "type": "string",
35
- "description": "Button link URL"
36
- },
37
- "text": {
38
- "type": "string",
39
- "description": "Button label text"
40
- },
41
- "onClick": {
42
- "type": "function",
43
- "description": "Optional click handler for the button"
44
- }
45
- }
31
+ "component": "button",
32
+ "description": "Button props. Search takes precedence when searchProps is supplied."
46
33
  },
47
34
  "searchProps": {
48
35
  "type": "object",
@@ -55,7 +42,11 @@
55
42
  },
56
43
  "contentPosition": {
57
44
  "type": "select",
58
- "options": ["left", "center", "right"],
45
+ "options": [
46
+ "left",
47
+ "center",
48
+ "right"
49
+ ],
59
50
  "default": "left",
60
51
  "description": "Main content position. Secondary content sits opposite on desktop for left/right layouts, and below for centered or mobile layouts. Reading order always starts with the main content."
61
52
  },
@@ -74,7 +65,13 @@
74
65
  },
75
66
  "headingLevel": {
76
67
  "type": "select",
77
- "options": ["h1", "h2", "h3", "h4", "h5"],
68
+ "options": [
69
+ "h1",
70
+ "h2",
71
+ "h3",
72
+ "h4",
73
+ "h5"
74
+ ],
78
75
  "default": "h1",
79
76
  "description": "Main heading element, independent of visual size. Secondary content uses the next heading level."
80
77
  },
@@ -82,14 +79,26 @@
82
79
  "type": "object",
83
80
  "description": "Optional unboxed supporting content: title, paragraph, and link. Stacks after the main content on mobile; use overlay or a suitable background for readable contrast.",
84
81
  "properties": {
85
- "title": { "type": "string", "description": "Supporting heading" },
86
- "paragraph": { "type": "string", "description": "Supporting description" },
82
+ "title": {
83
+ "type": "string",
84
+ "description": "Supporting heading"
85
+ },
86
+ "paragraph": {
87
+ "type": "string",
88
+ "description": "Supporting description"
89
+ },
87
90
  "link": {
88
91
  "type": "object",
89
92
  "description": "Optional secondary text link",
90
93
  "properties": {
91
- "href": { "type": "string", "description": "Destination URL" },
92
- "text": { "type": "string", "description": "Link text" }
94
+ "href": {
95
+ "type": "string",
96
+ "description": "Destination URL"
97
+ },
98
+ "text": {
99
+ "type": "string",
100
+ "description": "Link text"
101
+ }
93
102
  }
94
103
  }
95
104
  }
@@ -14,8 +14,8 @@
14
14
  {% if paragraph %}<p class="usx-hero__paragraph">{{ paragraph }}</p>{% endif %}
15
15
  {% if searchProps %}
16
16
  {% search id=searchProps.id ariaLabel=searchProps.ariaLabel searchKey=searchProps.searchKey label=searchProps.label icon=searchProps.icon iconOnly=searchProps.iconOnly buttonVariant=searchProps.buttonVariant big=searchProps.big action=searchProps.action placeholder=searchProps.placeholder defaultValue=searchProps.defaultValue onSubmit=searchProps.onSubmit className=searchProps.className|default:'' %}{% endsearch %}
17
- {% elif button %}
18
- {% button variant="primary" href=button.href %}{{ button.text }}{% endbutton %}
17
+ {% elif buttonProps %}
18
+ {% button props=buttonProps %}{{ buttonProps.children|safe }}{% endbutton %}
19
19
  {% endif %}
20
20
  </div>
21
21
  {% if secondaryContent %}
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "hint",
3
3
  "template": "hint/hint.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "id": {
7
7
  "type": "string",
8
8
  "description": "Element id, referenced by the associated field's aria-describedby"
9
9
  },
10
10
  "children": {
11
- "type": "string",
11
+ "type": "slot",
12
12
  "description": "Inner HTML or text"
13
13
  },
14
14
  "className": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "in-page-nav",
3
3
  "template": "in-page-nav/in-page-nav.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "id": "in-page-nav-default",
7
7
  "content": "<h2>Introduction</h2><p>This page walks through setting up and using the example project.</p><p>It's also meant to demonstrate how the in-page navigation component tracks scroll position and highlights whichever section is currently in view. Scroll down through each section below to see the link list on the side update automatically.</p><p>None of the copy on this page is meant to be read closely — it exists purely to give the navigation something substantial enough to observe.</p><h2>Getting started</h2><p>Before you begin, make sure the prerequisites below are met.</p><p>Getting started with any new project usually means working through a short checklist before the real work begins. The sections below cover what you'll need and how to get everything installed.</p><h3>Prerequisites</h3><p>A recent browser and a working internet connection.</p><p>You'll also want a modern code editor and enough disk space for the dependencies. Nothing here is unusual — most standard front-end tooling already satisfies these requirements.</p><p>If you already have Node.js and a package manager installed, you can skip ahead to the installation section below.</p><h3>Installation</h3><p>Download the package and follow the setup instructions.</p><p>Installation typically takes just a few minutes. Run the installer, accept the default options, and confirm that the command-line tool reports a successful install before moving on.</p><p>If you run into trouble, double-check that your environment matches the prerequisites listed above before trying again.</p><h2>Advanced usage</h2><p>Once installed, explore the configuration options to fit your workflow.</p><p>Advanced users can customize almost every aspect of the setup, from heading detection to scroll offsets and intersection thresholds — all of which this component exposes as simple data attributes.</p><p>Most projects never need to touch these settings, but they're available for the cases that do.</p><h2>Conclusion</h2><p>You should now be ready to explore the rest of the documentation.</p><p>Thanks for reading through this example. Scroll back up and watch the navigation list highlight each section as it passes by — that's the entire behavior this component provides.</p>"
@@ -64,6 +64,16 @@
64
64
  "type": "string",
65
65
  "default": "",
66
66
  "description": "Additional classes for the observed content container."
67
+ },
68
+ "children": {
69
+ "type": "slot",
70
+ "description": "Composed content containing the observed headings; takes precedence over content (React only).",
71
+ "renderers": {
72
+ "django": {
73
+ "supported": false,
74
+ "description": "The Django template does not consume children."
75
+ }
76
+ }
67
77
  }
68
78
  }
69
79
  }
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "indicator",
3
3
  "template": "indicator/indicator.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "items": {
7
7
  "type": "object",
8
8
  "description": "Array of indicator badge objects. Each item supports: className (classes beyond usx-indicator-item), label (text content), and style (inline styles)."
9
9
  },
10
10
  "children": {
11
- "type": "string",
11
+ "type": "slot",
12
12
  "description": "The element being decorated by the indicator badges."
13
13
  },
14
14
  "className": {
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "input",
3
3
  "template": "input/input.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "label": {
7
- "type": "string",
7
+ "type": "slot",
8
8
  "default": null,
9
9
  "description": "The label for the input field. If provided, it will render a label element associated with the control."
10
10
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "label",
3
3
  "template": "label/label.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "htmlFor": {
7
7
  "type": "string",
@@ -28,7 +28,7 @@
28
28
  "description": "Label text content"
29
29
  },
30
30
  "children": {
31
- "type": "string",
31
+ "type": "slot",
32
32
  "description": "Inner HTML or text"
33
33
  },
34
34
  "className": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "language-selector",
3
3
  "template": "language-selector/language-selector.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "variant": "menu",
7
7
  "languages": [
@@ -85,7 +85,7 @@
85
85
  "description": "Compact sizing for the menu variant (usa-language--small), e.g. inside a header"
86
86
  },
87
87
  "label": {
88
- "type": "string",
88
+ "type": "slot",
89
89
  "default": "Languages",
90
90
  "description": "Menu variant trigger button text"
91
91
  },
@@ -12,7 +12,7 @@ export interface SingleColumnLayoutProps extends HTMLAttributes<HTMLDivElement>
12
12
  }
13
13
 
14
14
  export function SingleColumnLayout({ children, expandButton = null, className = '', ...props }: SingleColumnLayoutProps) {
15
- const classes = ['usx-layout__single-column', className].filter(Boolean).join(' ');
15
+ const classes = ClassNames('usx-layout__single-column', className);
16
16
  return (
17
17
  <div className={classes} {...props}>
18
18
  {expandButton}
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "legend",
3
3
  "template": "legend/legend.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "text": {
7
- "type": "string",
7
+ "type": "slot",
8
8
  "description": "Text for the legend"
9
9
  },
10
10
  "required": {
@@ -16,7 +16,7 @@
16
16
  "description": "Whether to use the larger legend style (adds class `usa-legend--large`)"
17
17
  },
18
18
  "children": {
19
- "type": "string",
19
+ "type": "slot",
20
20
  "description": "Inner HTML or text"
21
21
  },
22
22
  "className": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "link",
3
3
  "template": "link/link.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "required": [
6
6
  "href",
7
7
  "children"
@@ -12,7 +12,7 @@
12
12
  "description": "Link destination URL."
13
13
  },
14
14
  "children": {
15
- "type": "string",
15
+ "type": "slot",
16
16
  "description": "Inner link text or HTML."
17
17
  },
18
18
  "visited": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "memorable-date",
3
3
  "template": "memorable-date/memorable-date.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "id": "memorable-date",
7
7
  "legend": "Date of Birth"
@@ -13,42 +13,42 @@
13
13
  "description": "Base id for the component. Month/day/year field ids and hint ids are derived from this."
14
14
  },
15
15
  "legend": {
16
- "type": "string",
16
+ "type": "slot",
17
17
  "default": "Date of Birth",
18
18
  "description": "Legend text for the fieldset."
19
19
  },
20
20
  "groupHint": {
21
- "type": "string",
21
+ "type": "slot",
22
22
  "default": "Select a month. Enter 1 or 2 digits for the day and 4 digits for the year.",
23
23
  "description": "Visible hint shown once for the whole group. Hidden from screen readers (aria-hidden) since each field has its own hint."
24
24
  },
25
25
  "monthLabel": {
26
- "type": "string",
26
+ "type": "slot",
27
27
  "default": "Month",
28
28
  "description": "Label text for the month select."
29
29
  },
30
30
  "dayLabel": {
31
- "type": "string",
31
+ "type": "slot",
32
32
  "default": "Day",
33
33
  "description": "Label text for the day input."
34
34
  },
35
35
  "yearLabel": {
36
- "type": "string",
36
+ "type": "slot",
37
37
  "default": "Year",
38
38
  "description": "Label text for the year input."
39
39
  },
40
40
  "monthHint": {
41
- "type": "string",
41
+ "type": "slot",
42
42
  "default": "Select a month from the dropdown.",
43
43
  "description": "Screen-reader-only hint for the month field."
44
44
  },
45
45
  "dayHint": {
46
- "type": "string",
46
+ "type": "slot",
47
47
  "default": "Enter 1 or 2 digits for the day.",
48
48
  "description": "Screen-reader-only hint for the day field."
49
49
  },
50
50
  "yearHint": {
51
- "type": "string",
51
+ "type": "slot",
52
52
  "default": "Enter 4 digits for the year.",
53
53
  "description": "Screen-reader-only hint for the year field."
54
54
  },
@@ -1,4 +1,5 @@
1
1
  import React, { ReactNode, HTMLAttributes, useId } from 'react';
2
+ import ClassNames from 'classnames';
2
3
  import Icon from '../icon/Icon';
3
4
 
4
5
  export interface MiscBannerProps extends HTMLAttributes<HTMLDivElement> {
@@ -33,7 +34,7 @@ export default function MiscBanner({
33
34
  }: MiscBannerProps) {
34
35
  const menuId = useId();
35
36
  const toggleId = useId();
36
- const classes = ['usx-misc-banner', `bg-${tone}`, className].filter(Boolean).join(' ');
37
+ const classes = ClassNames('usx-misc-banner', `bg-${tone}`, className);
37
38
  const mobileLinks: { href: string; text: string }[] = [];
38
39
  const hasLearnMoreLink = showLearnMore && Boolean(casualLinkText);
39
40
  const hasReturnLink = showReturnLink && Boolean(importantLinkText);
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "misc-banner",
3
3
  "template": "misc-banner/misc-banner.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "children": {
7
- "type": "string",
7
+ "type": "slot",
8
8
  "description": "Advanced override for custom inner markup"
9
9
  },
10
10
  "className": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modal",
3
3
  "template": "modal/modal.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "id": {
7
7
  "type": "string",
@@ -44,7 +44,7 @@
44
44
  "description": "When true, prevents closing the modal via the overlay or Escape key, and hides the close button. Used for required-action flows."
45
45
  },
46
46
  "children": {
47
- "type": "string",
47
+ "type": "slot",
48
48
  "default": null,
49
49
  "description": "Inner HTML to render as the modal body, replacing the description text."
50
50
  },
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import ClassNames from 'classnames';
2
3
 
3
4
  export interface PageProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title' | 'content'> {
4
5
  title?: React.ReactNode;
@@ -17,7 +18,7 @@ export default function Page({
17
18
  className = '',
18
19
  ...props
19
20
  }: PageProps) {
20
- const classes = ['usx-page', className].filter(Boolean).join(' ');
21
+ const classes = ClassNames('usx-page', className);
21
22
  const pageContent = children || content;
22
23
 
23
24
  const Element = element;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "page",
3
3
  "template": "page/page.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "required": [
6
6
  "title"
7
7
  ],
@@ -11,20 +11,20 @@
11
11
  "description": "Optional id attribute applied to the root main element."
12
12
  },
13
13
  "title": {
14
- "type": "string",
14
+ "type": "slot",
15
15
  "description": "Required page title rendered as an h1."
16
16
  },
17
17
  "eyebrow": {
18
- "type": "string",
18
+ "type": "slot",
19
19
  "description": "Optional eyebrow text rendered above the page title inside the h1."
20
20
  },
21
21
  "content": {
22
- "type": "string",
23
- "description": "Body content rendered below the title. Supports HTML in Django stories."
22
+ "type": "slot",
23
+ "description": "Body content rendered below the title. Supports HTML in Django stories. Ignored if children is provided."
24
24
  },
25
25
  "children": {
26
- "type": "string",
27
- "description": "Body content for React usage."
26
+ "type": "slot",
27
+ "description": "Body content for React usage. Takes precedence over content if both are provided."
28
28
  },
29
29
  "className": {
30
30
  "type": "string",
@@ -1,5 +1,5 @@
1
1
  {# Django template for Page #}
2
2
  <main{% if id %} id="{{ id }}"{% endif %} class="usx-page{% if className %} {{ className }}{% endif %}">
3
3
  <h1 class="usx-page__title">{% if eyebrow %}<span class="usx-eyebrow">{{ eyebrow }}</span>{% endif %}{{ title|default:'Page title' }}</h1>
4
- <div class="usx-page__content">{{ content|default:''|safe }}</div>
4
+ <div class="usx-page__content">{% if children %}{{ children|safe }}{% elif content %}{{ content|safe }}{% endif %}</div>
5
5
  </main>
@@ -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
  }