@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
@@ -21,7 +21,7 @@ export function Slide({
21
21
  children = null,
22
22
  ...rest
23
23
  }: SlideProps) {
24
- const cls = ['usx-carousel__slide', className].filter(Boolean).join(' ');
24
+ const cls = ClassNames('usx-carousel__slide', className);
25
25
  return (
26
26
  <section
27
27
  id={id}
@@ -63,6 +63,7 @@ export default function Carousel({
63
63
  }: CarouselProps) {
64
64
  const classes = ClassNames('usx-carousel', className);
65
65
  const childArray = React.Children.toArray(children).filter(Boolean);
66
+
66
67
  return (
67
68
  <div className={classes} {...props} role="region" aria-roledescription="carousel" aria-label={ariaLabel}>
68
69
  <div className="usx-carousel__viewport" tabIndex={-1}>
@@ -88,7 +89,7 @@ export default function Carousel({
88
89
  </div>
89
90
  {showDots && (
90
91
  <div className="usx-carousel__dots" aria-label="Slide navigation">
91
- {slides?.map((_, i) => (
92
+ {(childArray.length > 0 ? childArray : slides)?.map((_, i) => (
92
93
  <a key={i} href={`#${id}-slide-${i + 1}`} aria-label={`Go to slide ${i + 1}`} tabIndex={-1} />
93
94
  ))}
94
95
  {childArray.length > 0 && slideIds.length === childArray.length && slideIds.map((slideId, i) => (
@@ -5,14 +5,20 @@
5
5
  <div class="usx-carousel__viewport" tabindex="-1">
6
6
  <div class="usx-carousel__track">
7
7
  {% if children %}
8
- {{ children|safe }}
8
+ {% if children.length > 0 %}
9
+ {% for child in children %}
10
+ {{ child|safe }}
11
+ {% endfor %}
12
+ {% else %}
13
+ {{ children|safe }}
14
+ {% endif %}
9
15
  {% elif slides %}
10
16
  {% for slide in slides %}
11
17
  <section id="{{ id }}-slide-{{ forloop.counter }}" class="usx-carousel__slide" role="group" aria-roledescription="slide" aria-label="{{ forloop.counter }} of {{ slides|length }}" tabindex="0">
12
18
  {% if slide.content %}
13
19
  {{ slide.content|safe }}
14
20
  {% elif slide.src %}
15
- {% image src=slide.src alt=slide.alt caption=slide.caption hideCaption=True href=slide.href rounded=slide.rounded circular=slide.circular objectFit=slide.objectFit maxWidth=slide.maxWidth maxHeight=slide.maxHeight className=slide.className %}{% endimage %}
21
+ {% image props=slide hideCaption=slide.hideCaption|default_bool:True %}{{ slide.children|safe }}{% endimage %}
16
22
  {% else %}
17
23
  {# Fallback: render the slide object/string directly #}
18
24
  {{ slide|safe }}
@@ -27,6 +33,11 @@
27
33
 
28
34
  {% if showDots %}
29
35
  <div class="usx-carousel__dots" aria-label="Slide navigation">
36
+ {% if children and children.length > 0 %}
37
+ {% for child in children %}
38
+ <a href="#{{ id }}-slide-{{ forloop.counter }}" aria-label="Go to slide {{ forloop.counter }}" tabindex="-1"></a>
39
+ {% endfor %}
40
+ {% endif %}
30
41
  {% if slides %}
31
42
  {% for slide in slides %}
32
43
  <a href="#{{ id }}-slide-{{ forloop.counter }}" aria-label="Go to slide {{ forloop.counter }}" tabindex="-1"></a>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "carousel",
3
3
  "template": "carousel/carousel.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "id": {
7
7
  "type": "string",
@@ -13,7 +13,7 @@
13
13
  "description": "Array of slide objects {content: string|node}"
14
14
  },
15
15
  "children": {
16
- "type": "string",
16
+ "type": "slot",
17
17
  "description": "Optional raw slide markup rendered directly inside the track."
18
18
  },
19
19
  "slideIds": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "character-count",
3
3
  "template": "character-count/character-count.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "id": {
7
7
  "type": "string",
@@ -9,7 +9,7 @@
9
9
  "description": "ID for the input/textarea field. Used to wire label, hint, message, and error/success spans."
10
10
  },
11
11
  "label": {
12
- "type": "string",
12
+ "type": "slot",
13
13
  "default": null,
14
14
  "description": "Label text for the field."
15
15
  },
@@ -2,16 +2,9 @@ import React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import Fieldset from '../fieldset/Fieldset';
4
4
  import FormGroup from '../form-group/FormGroup';
5
- import Checkbox from '../checkbox/Checkbox';
5
+ import Checkbox, { type CheckboxProps } from '../checkbox/Checkbox';
6
6
 
7
- export interface CheckboxOption {
8
- id?: string;
9
- value: string;
10
- label: React.ReactNode;
11
- description?: string;
12
- checked?: boolean;
13
- disabled?: boolean;
14
- }
7
+ export type CheckboxGroupItemProps = Omit<CheckboxProps, 'id'> & { id?: string };
15
8
 
16
9
  export interface CheckboxGroupProps extends React.HTMLAttributes<HTMLFieldSetElement> {
17
10
  tile?: boolean;
@@ -21,7 +14,7 @@ export interface CheckboxGroupProps extends React.HTMLAttributes<HTMLFieldSetEle
21
14
  hint?: React.ReactNode;
22
15
  error?: React.ReactNode;
23
16
  name?: string;
24
- options: CheckboxOption[];
17
+ checkboxProps: CheckboxGroupItemProps[];
25
18
  className?: string;
26
19
  }
27
20
 
@@ -33,7 +26,8 @@ const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
33
26
  hint = null,
34
27
  error = null,
35
28
  name = 'checkbox-group',
36
- options = [],
29
+ id: groupId,
30
+ checkboxProps = [],
37
31
  className = '',
38
32
  ...props
39
33
  }) => {
@@ -41,21 +35,17 @@ const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
41
35
 
42
36
  return (
43
37
  <FormGroup error={!!error}>
44
- <Fieldset legend={legend} required={required} hint={hint} error={error} className={classes} {...props}>
45
- {options.map((opt, idx) => {
46
- const id = opt.id || `${name}-${idx}`;
38
+ <Fieldset id={groupId} legend={legend} required={required} hint={hint} error={error} className={classes} {...props}>
39
+ {checkboxProps.map((opt, idx) => {
40
+ const id = opt.id || `${groupId || name}-${idx}`;
47
41
  return (
48
42
  <Checkbox
49
43
  key={id}
50
- id={id}
51
44
  name={name}
52
- value={opt.value}
53
- label={opt.label as string}
54
- description={opt.description}
55
- checked={!!opt.checked}
56
- disabled={!!opt.disabled}
57
45
  tile={tile}
58
46
  small={small}
47
+ {...opt}
48
+ id={id}
59
49
  />
60
50
  );
61
51
  })}
@@ -1,12 +1,18 @@
1
1
  {# Django template for CheckboxGroup #}
2
2
  {% load components %}
3
3
 
4
+ {% with groupName=name|default:"checkbox-group" groupClass=className|default:"" %}
4
5
  {% form_group error=error %}
5
- {% fieldset legend=legend required=required hint=hint error=error className="usa-checkbox-group usx-checkbox-group" %}
6
- {% for opt in options %}
7
- {% with optionId=id|add:"-"|add:opt.value %}
8
- {% checkbox id=optionId name=name|default:"checkbox-group" value=opt.value label=opt.label description=opt.description checked=opt.checked disabled=opt.disabled tile=tile small=small %}{% endcheckbox %}
6
+ {% fieldset legend=legend required=required hint=hint error=error id=id className="usa-checkbox-group usx-checkbox-group "|add:groupClass %}
7
+ {% for opt in checkboxProps %}
8
+ {% with index=forloop.counter0|stringformat:"s" %}
9
+ {% with baseId=id|default:groupName %}
10
+ {% with optionId=baseId|add:"-"|add:index %}
11
+ {% checkbox props=opt id=opt.id|default:optionId name=opt.name|default:groupName tile=opt.tile|default_bool:tile small=opt.small|default_bool:small %}{% endcheckbox %}
12
+ {% endwith %}
13
+ {% endwith %}
9
14
  {% endwith %}
10
15
  {% endfor %}
11
16
  {% endfieldset %}
12
17
  {% endform_group %}
18
+ {% endwith %}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "checkbox-group",
3
3
  "template": "checkbox-group/checkbox-group.django.html",
4
- "version": 1,
4
+ "version": 3,
5
5
  "props": {
6
6
  "id": {
7
7
  "type": "string",
@@ -27,20 +27,25 @@
27
27
  "default": false
28
28
  },
29
29
  "hint": {
30
- "type": "string",
30
+ "type": "slot",
31
31
  "description": "Group-level hint text, rendered after the legend"
32
32
  },
33
33
  "error": {
34
- "type": "string",
34
+ "type": "slot",
35
35
  "description": "Group-level error message, rendered after the hint"
36
36
  },
37
37
  "name": {
38
38
  "type": "string",
39
39
  "description": "Name attribute shared by the checkbox inputs"
40
40
  },
41
- "options": {
41
+ "checkboxProps": {
42
42
  "type": "array",
43
- "description": "Array of option objects: {id, value, label, description, checked, disabled}"
43
+ "description": "Checkbox props. Item values override group name, tile, and small defaults; omitted IDs use the group id or name plus the item index.",
44
+ "items": {
45
+ "type": "object",
46
+ "component": "checkbox",
47
+ "description": "Props passed to the checkbox component."
48
+ }
44
49
  },
45
50
  "className": {
46
51
  "type": "string",
@@ -63,22 +63,6 @@
63
63
 
64
64
 
65
65
  <h3 class="site-preview-heading margin-top-5">Read John's Story</h3>
66
- <div class="usx-block usx-block--callout usx-border-primary">
67
- <div class="usx-block__content usx-border-info maxw-tablet margin-0">
68
- <p class="font-serif-lg maxw-tablet margin-0">
69
- ❝We found this wand shop that had the best wands, and we were
70
- like, "We have to go here!" So we went there.❞
71
- </p>
72
- <div class="usx-block__attribution">
73
- <div class="usx-attribution">
74
- <span class="usx-attribution__content">
75
- <span class="usx-attribution__primary">John Doe</span>
76
- <span class="usx-attribution__secondary">Under Secretary for the Department of Magic and Mystical Affairs</span>
77
- </span>
78
- </div>
79
- </div>
80
- </div>
81
- </div>
82
66
  <a class="usx-clickable display-flex flex-align-center margin-1 usx-width-fit" href="https://google.com">
83
67
  <span class="usx-circle bg-black text-white usx-clickable__bg-color-on-hover display-flex flex-align-center flex-justify-center width-4 height-4">
84
68
  <svg class="usa-icon usa-icon--size-3" aria-hidden="true" focusable="false" role="img">
@@ -88,31 +72,29 @@
88
72
  <span class="margin-left-1 usx-clickable__link">Read John's Story</span>
89
73
  </a>
90
74
 
91
- <h3 class="site-preview-heading margin-top-5">Read John's Story inside blockquote</h3>
92
- <a class="usx-clickable display-flex usx-block usx-block--callout usx-border-primary" href="https://google.com">
93
- <div class="usx-block__content usx-border-info maxw-tablet margin-0">
94
- <p class="font-serif-lg maxw-tablet margin-0">
95
- ❝We found this wand shop that had the best wands, and we were
96
- like, "We have to go here!" So we went there.❞
97
- </p>
98
- <div class="usx-block__attribution">
99
- <div class="usx-attribution">
100
- <span class="usx-attribution__content">
101
- <span class="usx-attribution__primary">John Doe</span>
102
- <span class="usx-attribution__secondary">Under Secretary for the Department of Magic and Mystical Affairs</span>
103
- </span>
104
- </div>
105
- </div>
106
-
107
- <div class="display-flex flex-align-center margin-top-2">
108
- <span class="usx-circle bg-black text-white usx-clickable__bg-color-on-hover display-flex flex-align-center flex-justify-center width-4 height-4">
109
- <svg class="usa-icon usa-icon--size-3" aria-hidden="true" focusable="false" role="img">
110
- <use href="./img/sprite.svg#arrow_forward"></use>
111
- </svg>
112
- </span>
113
- <span class="margin-left-1 usx-clickable__link">Read John's Story</span>
75
+ <h3 class="site-preview-heading margin-top-5">Clickable Quote</h3>
76
+ <a class="usx-clickable display-block maxw-tablet" href="https://google.com">
77
+ <div class="usx-quote usx-quote--vertical">
78
+ <div class="usx-callout usx-callout--vertical usx-border-primary">
79
+ <figure class="usx-quote__body">
80
+ <blockquote class="usx-quote__content font-serif-lg">❝We found this wand shop that had the best wands, and we were like, "We have to go here!" So we went there.❞</blockquote>
81
+ <figcaption class="usx-quote__attribution">
82
+ <div class="usx-attribution">
83
+ <span class="usx-attribution__content">
84
+ <span class="usx-attribution__primary">John Doe</span>
85
+ <span class="usx-attribution__secondary">Under Secretary for the Department of Magic and Mystical Affairs</span>
86
+ </span>
87
+ </div>
88
+ </figcaption>
89
+ </figure>
114
90
  </div>
115
91
  </div>
92
+ <span class="display-flex flex-align-center margin-top-2">
93
+ <span class="usx-circle bg-black text-white usx-clickable__bg-color-on-hover display-flex flex-align-center flex-justify-center width-4 height-4">
94
+ <svg class="usa-icon usa-icon--size-3" aria-hidden="true" focusable="false" role="img"><use href="./img/sprite.svg#arrow_forward"></use></svg>
95
+ </span>
96
+ <span class="margin-left-1 usx-clickable__link">Read John's Story</span>
97
+ </span>
116
98
  </a>
117
99
 
118
100
  <h2 class="site-preview-heading margin-top-5">Basic Class demonstrations</h2>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "clickable",
3
3
  "template": "clickable/clickable.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "required": [
6
6
  "href"
7
7
  ],
@@ -19,7 +19,7 @@
19
19
  "description": "Optional id attribute for the anchor element."
20
20
  },
21
21
  "children": {
22
- "type": "string",
22
+ "type": "slot",
23
23
  "description": "Safe inner HTML. Apply usx-clickable__link, usx-clickable__color-on-hover, and/or usx-clickable__bg-color-on-hover to any child elements as needed."
24
24
  }
25
25
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import ClassNames from 'classnames';
3
- import CalendarDate from '../calendar-date/CalendarDate';
3
+ import CalendarDate, { type CalendarDateProps } from '../calendar-date/CalendarDate';
4
4
 
5
5
  export interface CollectionMetaItem {
6
6
  text: string;
@@ -18,19 +18,19 @@ export interface CollectionItemProps {
18
18
  description?: string;
19
19
  imgSrc?: string;
20
20
  imgAlt?: string;
21
- calendarDate?: string | { datetime: string; month: string; day: string };
21
+ calendarDateProps?: CalendarDateProps;
22
22
  meta?: (string | CollectionMetaItem)[];
23
23
  tags?: (string | CollectionTag)[];
24
24
  }
25
25
 
26
- function CollectionItem({ href, heading, description, imgSrc, imgAlt = '', calendarDate, meta, tags }: CollectionItemProps) {
26
+ function CollectionItem({ href, heading, description, imgSrc, imgAlt = '', calendarDateProps, meta, tags }: CollectionItemProps) {
27
27
  return (
28
28
  <li className="usa-collection__item">
29
29
  {imgSrc && (
30
30
  <img className="usa-collection__img" src={imgSrc} alt={imgAlt} />
31
31
  )}
32
- {calendarDate && (
33
- <CalendarDate datetime={typeof calendarDate === 'string' ? calendarDate : calendarDate.datetime} underCollection={true} />
32
+ {calendarDateProps && (
33
+ <CalendarDate underCollection={true} {...calendarDateProps} />
34
34
  )}
35
35
  <div className="usa-collection__body">
36
36
  <h4 className="usa-collection__heading">
@@ -6,10 +6,8 @@
6
6
  {% if item.imgSrc %}
7
7
  <img class="usa-collection__img" src="{{ item.imgSrc }}" alt="{{ item.imgAlt }}" />
8
8
  {% endif %}
9
- {% if item.calendarDate %}
10
- {% with datetime=item.calendarDate %}
11
- {% calendar_date datetime=datetime under_collection=True %}{% endcalendar_date %}
12
- {% endwith %}
9
+ {% if item.calendarDateProps %}
10
+ {% calendar_date props=item.calendarDateProps underCollection=item.calendarDateProps.underCollection|default_bool:True %}{% endcalendar_date %}
13
11
  {% endif %}
14
12
  <div class="usa-collection__body">
15
13
  <h4 class="usa-collection__heading">
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "collection",
3
3
  "template": "collection/collection.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "items": {
7
7
  "type": "array",
8
8
  "default": [],
9
- "description": "Array of collection item objects. Each item: { href, heading, description?, imgSrc?, imgAlt?, calendarDate?: { datetime, month, day }, meta?: [{ text, datetime? }], tags?: [{ label, isNew? }] }",
9
+ "description": "Collection items with optional calendarDateProps, meta, and tags.",
10
10
  "items": {
11
11
  "type": "object",
12
12
  "description": "Collection item.",
@@ -31,10 +31,6 @@
31
31
  "type": "string",
32
32
  "description": "Alt text for the thumbnail image."
33
33
  },
34
- "calendarDate": {
35
- "type": "object",
36
- "description": "Optional { datetime, month, day } calendar date badge."
37
- },
38
34
  "meta": {
39
35
  "type": "array",
40
36
  "description": "Optional meta list: [{ text, datetime? }]."
@@ -42,6 +38,11 @@
42
38
  "tags": {
43
39
  "type": "array",
44
40
  "description": "Optional tag list: [{ label, isNew? }]."
41
+ },
42
+ "calendarDateProps": {
43
+ "type": "object",
44
+ "component": "calendar-date",
45
+ "description": "Props passed to the calendar-date component."
45
46
  }
46
47
  }
47
48
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "combobox",
3
3
  "template": "combobox/combobox.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "id": {
7
7
  "type": "string",
@@ -12,7 +12,7 @@
12
12
  "description": "name attribute for the select"
13
13
  },
14
14
  "label": {
15
- "type": "string",
15
+ "type": "slot",
16
16
  "description": "Label text for the combobox"
17
17
  },
18
18
  "disabled": {
@@ -26,7 +26,7 @@
26
26
  "default": false
27
27
  },
28
28
  "hint": {
29
- "type": "string",
29
+ "type": "slot",
30
30
  "description": "Hint text (renders aria-describedby)"
31
31
  },
32
32
  "placeholder": {
@@ -38,7 +38,7 @@
38
38
  "description": "Default selected value"
39
39
  },
40
40
  "error": {
41
- "type": "string",
41
+ "type": "slot",
42
42
  "description": "Error message (renders aria-describedby and error class)"
43
43
  },
44
44
  "options": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "date-picker",
3
3
  "template": "date-picker/date-picker.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "id": "appointment-date",
7
7
  "name": "appointment-date",
@@ -19,16 +19,16 @@
19
19
  "description": "name attribute for the input. Defaults to id."
20
20
  },
21
21
  "label": {
22
- "type": "string",
22
+ "type": "slot",
23
23
  "description": "Label text for the field."
24
24
  },
25
25
  "hint": {
26
- "type": "string",
26
+ "type": "slot",
27
27
  "default": "mm/dd/yyyy",
28
28
  "description": "Hint text displayed below the label."
29
29
  },
30
30
  "error": {
31
- "type": "string",
31
+ "type": "slot",
32
32
  "description": "Error message. Renders aria-describedby and error styling."
33
33
  },
34
34
  "disabled": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "date-range-picker",
3
3
  "template": "date-range-picker/date-range-picker.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "default": {
6
6
  "startId": "event-date-start",
7
7
  "endId": "event-date-end",
@@ -30,31 +30,31 @@
30
30
  "description": "name attribute for the end date input. Defaults to endId."
31
31
  },
32
32
  "startLabel": {
33
- "type": "string",
33
+ "type": "slot",
34
34
  "default": "Event start date",
35
35
  "description": "Label text for the start date field."
36
36
  },
37
37
  "endLabel": {
38
- "type": "string",
38
+ "type": "slot",
39
39
  "default": "Event end date",
40
40
  "description": "Label text for the end date field."
41
41
  },
42
42
  "startHint": {
43
- "type": "string",
43
+ "type": "slot",
44
44
  "default": "mm/dd/yyyy",
45
45
  "description": "Hint text displayed below the start date label."
46
46
  },
47
47
  "endHint": {
48
- "type": "string",
48
+ "type": "slot",
49
49
  "default": "mm/dd/yyyy",
50
50
  "description": "Hint text displayed below the end date label."
51
51
  },
52
52
  "startError": {
53
- "type": "string",
53
+ "type": "slot",
54
54
  "description": "Error message for the start date field."
55
55
  },
56
56
  "endError": {
57
- "type": "string",
57
+ "type": "slot",
58
58
  "description": "Error message for the end date field."
59
59
  },
60
60
  "disabled": {
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "error-message",
3
3
  "template": "error-message/error-message.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,4 +1,5 @@
1
1
  import React from 'react';
2
+ import ClassNames from 'classnames';
2
3
 
3
4
  export interface EyebrowProps extends React.HTMLAttributes<HTMLSpanElement> {
4
5
  children?: React.ReactNode;
@@ -6,7 +7,7 @@ export interface EyebrowProps extends React.HTMLAttributes<HTMLSpanElement> {
6
7
  }
7
8
 
8
9
  export default function Eyebrow({ children = null, className = '', ...props }: EyebrowProps) {
9
- const classes = ['usx-eyebrow', className].filter(Boolean).join(' ');
10
+ const classes = ClassNames('usx-eyebrow', className);
10
11
  return (
11
12
  <span className={classes} {...props}>
12
13
  {children}
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "eyebrow",
3
3
  "template": "eyebrow/eyebrow.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "children": {
7
- "type": "string",
7
+ "type": "slot",
8
8
  "description": "Eyebrow text content"
9
9
  },
10
10
  "className": {
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "fieldset",
3
3
  "template": "fieldset/fieldset.django.html",
4
- "version": 1,
4
+ "version": 2,
5
5
  "props": {
6
6
  "legend": {
7
- "type": "string",
7
+ "type": "slot",
8
8
  "description": "Text for the fieldset legend"
9
9
  },
10
10
  "largeLegend": {
@@ -20,11 +20,11 @@
20
20
  "description": "Whether to disable all form controls within the fieldset"
21
21
  },
22
22
  "hint": {
23
- "type": "string",
23
+ "type": "slot",
24
24
  "description": "Group-level hint text, rendered after the legend"
25
25
  },
26
26
  "error": {
27
- "type": "string",
27
+ "type": "slot",
28
28
  "description": "Group-level error message, rendered after the hint"
29
29
  },
30
30
  "hintId": {
@@ -36,7 +36,7 @@
36
36
  "description": "Element id for the error message span"
37
37
  },
38
38
  "children": {
39
- "type": "string",
39
+ "type": "slot",
40
40
  "description": "Inner HTML or text"
41
41
  },
42
42
  "className": {
@@ -1,4 +1,5 @@
1
1
  import React, { useRef, useState } from 'react';
2
+ import ClassNames from 'classnames';
2
3
 
3
4
  import Label from '../label/Label';
4
5
  import Hint from '../hint/Hint';
@@ -125,7 +126,7 @@ export default function FileInput({
125
126
  {commonHint}
126
127
  {commonError}
127
128
  <input
128
- className={['usa-file-input', 'usx-file-input', className].filter(Boolean).join(' ')}
129
+ className={ClassNames('usa-file-input', 'usx-file-input', className)}
129
130
  id={id}
130
131
  type="file"
131
132
  name={name || id}
@@ -149,7 +150,7 @@ export default function FileInput({
149
150
  {commonError}
150
151
  <div className="usx-file-input__add-only">
151
152
  <input
152
- className={['usa-file-input', 'usx-file-input', className].filter(Boolean).join(' ')}
153
+ className={ClassNames('usa-file-input', 'usx-file-input', className)}
153
154
  id={id}
154
155
  type="file"
155
156
  name={name || id}