@solexllc/usx-react 0.1.8 → 0.2.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.
package/dist/index.cjs CHANGED
@@ -75,15 +75,16 @@
75
75
  id,
76
76
  content,
77
77
  expanded = false,
78
- className,
78
+ headingClassName,
79
+ contentClassName,
79
80
  headingLevel = "h3",
80
81
  handleToggle
81
82
  }) {
82
- const headingClasses = classNames("usa-accordion__heading", className);
83
+ const headingClasses = classNames("usa-accordion__heading", headingClassName);
83
84
  const contentClasses = classNames(
84
85
  "usa-accordion__content",
85
86
  "usa-prose",
86
- className
87
+ contentClassName
87
88
  );
88
89
  const Heading = headingLevel;
89
90
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -120,6 +121,8 @@
120
121
  headingLevel = "h3",
121
122
  iconPosition,
122
123
  className = "",
124
+ headingClassName = "",
125
+ contentClassName = "",
123
126
  ...props
124
127
  }) {
125
128
  const accordionClasses = classNames(
@@ -141,7 +144,8 @@
141
144
  {
142
145
  ...item,
143
146
  headingLevel,
144
- className
147
+ headingClassName,
148
+ contentClassName
145
149
  },
146
150
  item.id
147
151
  ))
@@ -564,23 +568,24 @@
564
568
  const Spinner = ({
565
569
  size = 3,
566
570
  color = null,
567
- label = "Loading...",
568
- omitLabel = false,
571
+ label = null,
572
+ screenReaderLabel = null,
569
573
  staticUrlPrefix = getDefaultStaticUrlPrefix(),
570
574
  className = "",
571
575
  ...props
572
576
  }) => {
573
- return /* @__PURE__ */ jsxRuntime.jsxs("span", { role: "status", "aria-live": "polite", className, ...props, children: [
577
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { role: "status", "aria-live": "polite", className: `usx-spinner ${className}`, ...props, children: [
574
578
  /* @__PURE__ */ jsxRuntime.jsx(
575
579
  "svg",
576
580
  {
577
- className: "usa-icon usx-spinner " + (size === 1 ? "usx-spinner--size-1" : "usa-icon--size-" + size) + (color ? " text-" + color : ""),
581
+ className: "usa-icon " + (size === 1 ? "usx-spinner--size-1" : "usa-icon--size-" + size) + (color ? " text-" + color : ""),
578
582
  "aria-hidden": "true",
579
583
  focusable: "false",
580
584
  children: /* @__PURE__ */ jsxRuntime.jsx("use", { href: staticUrlPrefix + "spinner" })
581
585
  }
582
586
  ),
583
- !omitLabel && label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-sr-only", children: label })
587
+ screenReaderLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-sr-only", children: screenReaderLabel }),
588
+ label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "usa-label usx-label", children: label })
584
589
  ] });
585
590
  };
586
591
  function Button({
@@ -620,7 +625,7 @@
620
625
  const classes = classNames(
621
626
  "usa-button",
622
627
  "usx-button",
623
- variant && variantClasses[variant],
628
+ variant ? variantClasses[variant] : variantClasses["primary"],
624
629
  big && "usa-button--big",
625
630
  inverse && "usa-button--inverse",
626
631
  ghost && "usx-button--ghost",
@@ -681,7 +686,7 @@
681
686
  segmented && "usa-button-group--segmented",
682
687
  className
683
688
  );
684
- return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: classes, ...props, children: buttonProps.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "usa-button-group__item", children: /* @__PURE__ */ jsxRuntime.jsx(Button, { ...item, children: item.children }) }, index)) });
689
+ return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: classes, ...props, children: buttonProps.map(({ itemClassName, ...item }, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: classNames("usa-button-group__item", itemClassName), children: /* @__PURE__ */ jsxRuntime.jsx(Button, { ...item, children: item.children }) }, index)) });
685
690
  }
686
691
  function CalendarDate({
687
692
  datetime,
@@ -920,7 +925,9 @@
920
925
  id: `${props.id || "card"}-carousel`,
921
926
  showDots: showCarouselDots,
922
927
  className: "usx-card__carousel",
923
- slides: images == null ? void 0 : images.map((img, index) => /* @__PURE__ */ jsxRuntime.jsx(Image, { ...img, hideCaption: true }, index))
928
+ slides: images == null ? void 0 : images.map((img, index) => ({
929
+ content: /* @__PURE__ */ jsxRuntime.jsx(Image, { ...img, hideCaption: true }, index)
930
+ }))
924
931
  }
925
932
  ) : hasImages ? /* @__PURE__ */ jsxRuntime.jsx(Image, { ...images[0], hideCaption: true, className: "usa-card__img" }) : null;
926
933
  return /* @__PURE__ */ jsxRuntime.jsx(RootTag, { className: cardClasses, ...props, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-card__container", children: shouldRenderStructured ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -930,7 +937,7 @@
930
937
  tags && tags.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usx-tag-group", children: tags.map((tag, index) => /* @__PURE__ */ jsxRuntime.jsx(Tag, { ...tag }, index)) }),
931
938
  description && (typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx("p", { children: description }) : description)
932
939
  ] }),
933
- actions && actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-card__footer", children: /* @__PURE__ */ jsxRuntime.jsx(ButtonGroup, { items: actions, className: "flex-wrap" }) })
940
+ actions && actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "usa-card__footer", children: /* @__PURE__ */ jsxRuntime.jsx(ButtonGroup, { buttonProps: actions, className: "flex-wrap" }) })
934
941
  ] }) : children || "Card" }) });
935
942
  }
936
943
  function CardGroup({ cardProps = [], className = "", ...props }) {
@@ -950,6 +957,7 @@
950
957
  const classes = classNames("usx-required", className);
951
958
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
952
959
  /* @__PURE__ */ jsxRuntime.jsx("abbr", { title, className: classes, ...props, children: "*" }),
960
+ " ",
953
961
  children ? children : ""
954
962
  ] });
955
963
  };
@@ -1263,7 +1271,7 @@
1263
1271
  const CheckboxGroup = ({
1264
1272
  tile = false,
1265
1273
  small = false,
1266
- legend = "Select one or more options",
1274
+ legend,
1267
1275
  required = false,
1268
1276
  hint = null,
1269
1277
  error = null,
package/dist/index.js CHANGED
@@ -73,15 +73,16 @@ function AccordionItem({
73
73
  id,
74
74
  content,
75
75
  expanded = false,
76
- className,
76
+ headingClassName,
77
+ contentClassName,
77
78
  headingLevel = "h3",
78
79
  handleToggle
79
80
  }) {
80
- const headingClasses = classNames("usa-accordion__heading", className);
81
+ const headingClasses = classNames("usa-accordion__heading", headingClassName);
81
82
  const contentClasses = classNames(
82
83
  "usa-accordion__content",
83
84
  "usa-prose",
84
- className
85
+ contentClassName
85
86
  );
86
87
  const Heading = headingLevel;
87
88
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -118,6 +119,8 @@ function Accordion({
118
119
  headingLevel = "h3",
119
120
  iconPosition,
120
121
  className = "",
122
+ headingClassName = "",
123
+ contentClassName = "",
121
124
  ...props
122
125
  }) {
123
126
  const accordionClasses = classNames(
@@ -139,7 +142,8 @@ function Accordion({
139
142
  {
140
143
  ...item,
141
144
  headingLevel,
142
- className
145
+ headingClassName,
146
+ contentClassName
143
147
  },
144
148
  item.id
145
149
  ))
@@ -562,23 +566,24 @@ const getDefaultStaticUrlPrefix = () => {
562
566
  const Spinner = ({
563
567
  size = 3,
564
568
  color = null,
565
- label = "Loading...",
566
- omitLabel = false,
569
+ label = null,
570
+ screenReaderLabel = null,
567
571
  staticUrlPrefix = getDefaultStaticUrlPrefix(),
568
572
  className = "",
569
573
  ...props
570
574
  }) => {
571
- return /* @__PURE__ */ jsxs("span", { role: "status", "aria-live": "polite", className, ...props, children: [
575
+ return /* @__PURE__ */ jsxs("span", { role: "status", "aria-live": "polite", className: `usx-spinner ${className}`, ...props, children: [
572
576
  /* @__PURE__ */ jsx(
573
577
  "svg",
574
578
  {
575
- className: "usa-icon usx-spinner " + (size === 1 ? "usx-spinner--size-1" : "usa-icon--size-" + size) + (color ? " text-" + color : ""),
579
+ className: "usa-icon " + (size === 1 ? "usx-spinner--size-1" : "usa-icon--size-" + size) + (color ? " text-" + color : ""),
576
580
  "aria-hidden": "true",
577
581
  focusable: "false",
578
582
  children: /* @__PURE__ */ jsx("use", { href: staticUrlPrefix + "spinner" })
579
583
  }
580
584
  ),
581
- !omitLabel && label && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: label })
585
+ screenReaderLabel && /* @__PURE__ */ jsx("span", { className: "usa-sr-only", children: screenReaderLabel }),
586
+ label && /* @__PURE__ */ jsx("span", { className: "usa-label usx-label", children: label })
582
587
  ] });
583
588
  };
584
589
  function Button({
@@ -618,7 +623,7 @@ function Button({
618
623
  const classes = classNames(
619
624
  "usa-button",
620
625
  "usx-button",
621
- variant && variantClasses[variant],
626
+ variant ? variantClasses[variant] : variantClasses["primary"],
622
627
  big && "usa-button--big",
623
628
  inverse && "usa-button--inverse",
624
629
  ghost && "usx-button--ghost",
@@ -679,7 +684,7 @@ function ButtonGroup({
679
684
  segmented && "usa-button-group--segmented",
680
685
  className
681
686
  );
682
- return /* @__PURE__ */ jsx("ul", { className: classes, ...props, children: buttonProps.map((item, index) => /* @__PURE__ */ jsx("li", { className: "usa-button-group__item", children: /* @__PURE__ */ jsx(Button, { ...item, children: item.children }) }, index)) });
687
+ return /* @__PURE__ */ jsx("ul", { className: classes, ...props, children: buttonProps.map(({ itemClassName, ...item }, index) => /* @__PURE__ */ jsx("li", { className: classNames("usa-button-group__item", itemClassName), children: /* @__PURE__ */ jsx(Button, { ...item, children: item.children }) }, index)) });
683
688
  }
684
689
  function CalendarDate({
685
690
  datetime,
@@ -918,7 +923,9 @@ function Card({
918
923
  id: `${props.id || "card"}-carousel`,
919
924
  showDots: showCarouselDots,
920
925
  className: "usx-card__carousel",
921
- slides: images == null ? void 0 : images.map((img, index) => /* @__PURE__ */ jsx(Image, { ...img, hideCaption: true }, index))
926
+ slides: images == null ? void 0 : images.map((img, index) => ({
927
+ content: /* @__PURE__ */ jsx(Image, { ...img, hideCaption: true }, index)
928
+ }))
922
929
  }
923
930
  ) : hasImages ? /* @__PURE__ */ jsx(Image, { ...images[0], hideCaption: true, className: "usa-card__img" }) : null;
924
931
  return /* @__PURE__ */ jsx(RootTag, { className: cardClasses, ...props, children: /* @__PURE__ */ jsx("div", { className: "usa-card__container", children: shouldRenderStructured ? /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -928,7 +935,7 @@ function Card({
928
935
  tags && tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "usx-tag-group", children: tags.map((tag, index) => /* @__PURE__ */ jsx(Tag, { ...tag }, index)) }),
929
936
  description && (typeof description === "string" ? /* @__PURE__ */ jsx("p", { children: description }) : description)
930
937
  ] }),
931
- actions && actions.length > 0 && /* @__PURE__ */ jsx("div", { className: "usa-card__footer", children: /* @__PURE__ */ jsx(ButtonGroup, { items: actions, className: "flex-wrap" }) })
938
+ actions && actions.length > 0 && /* @__PURE__ */ jsx("div", { className: "usa-card__footer", children: /* @__PURE__ */ jsx(ButtonGroup, { buttonProps: actions, className: "flex-wrap" }) })
932
939
  ] }) : children || "Card" }) });
933
940
  }
934
941
  function CardGroup({ cardProps = [], className = "", ...props }) {
@@ -948,6 +955,7 @@ const Required = ({
948
955
  const classes = classNames("usx-required", className);
949
956
  return /* @__PURE__ */ jsxs(Fragment, { children: [
950
957
  /* @__PURE__ */ jsx("abbr", { title, className: classes, ...props, children: "*" }),
958
+ " ",
951
959
  children ? children : ""
952
960
  ] });
953
961
  };
@@ -1261,7 +1269,7 @@ function Fieldset({
1261
1269
  const CheckboxGroup = ({
1262
1270
  tile = false,
1263
1271
  small = false,
1264
- legend = "Select one or more options",
1272
+ legend,
1265
1273
  required = false,
1266
1274
  hint = null,
1267
1275
  error = null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solexllc/usx-react",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "React component library for USX.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,9 +25,9 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@solexllc/usx": "0.1.8",
29
- "@solexllc/usx-theme": "0.2.3",
30
- "@solexllc/usx-uswds-fixes": "0.1.5",
28
+ "@solexllc/usx": "0.2.0",
29
+ "@solexllc/usx-theme": "0.3.0",
30
+ "@solexllc/usx-uswds-fixes": "0.1.6",
31
31
  "classnames": "^2.5.1",
32
32
  "prop-types": "^15.8.1"
33
33
  },
@@ -8,7 +8,8 @@ export interface AccordionItemProps {
8
8
  id: string;
9
9
  content: React.ReactNode;
10
10
  expanded?: boolean;
11
- className?: string;
11
+ headingClassName?: string;
12
+ contentClassName?: string;
12
13
  headingLevel?: AccordionHeadingLevel;
13
14
  handleToggle?: React.MouseEventHandler<HTMLButtonElement>;
14
15
  }
@@ -26,15 +27,16 @@ function AccordionItem({
26
27
  id,
27
28
  content,
28
29
  expanded = false,
29
- className,
30
+ headingClassName,
31
+ contentClassName,
30
32
  headingLevel = 'h3',
31
33
  handleToggle,
32
34
  }: AccordionItemProps) {
33
- const headingClasses = classnames('usa-accordion__heading', className)
35
+ const headingClasses = classnames('usa-accordion__heading', headingClassName)
34
36
  const contentClasses = classnames(
35
37
  'usa-accordion__content',
36
38
  'usa-prose',
37
- className
39
+ contentClassName
38
40
  )
39
41
 
40
42
  const Heading = headingLevel
@@ -72,6 +74,8 @@ export function Accordion({
72
74
  headingLevel = 'h3',
73
75
  iconPosition,
74
76
  className = '',
77
+ headingClassName = '',
78
+ contentClassName = '',
75
79
  ...props
76
80
  }: AccordionProps) {
77
81
  const accordionClasses = classnames(
@@ -95,7 +99,8 @@ export function Accordion({
95
99
  key={item.id}
96
100
  {...item}
97
101
  headingLevel={headingLevel}
98
- className={className}
102
+ headingClassName={headingClassName}
103
+ contentClassName={contentClassName}
99
104
  />
100
105
  ))}
101
106
  </div>
@@ -7,13 +7,13 @@
7
7
  >
8
8
  {% for item in items %}
9
9
  {% if headingLevel == 'h1' %}
10
- <h1 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ className }}">
10
+ <h1 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ headingClassName }}">
11
11
  {% elif headingLevel == 'h2' %}
12
- <h2 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ className }}">
12
+ <h2 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ headingClassName }}">
13
13
  {% elif headingLevel == 'h4' %}
14
- <h4 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ className }}">
14
+ <h4 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ headingClassName }}">
15
15
  {% else %}
16
- <h3 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ className }}">
16
+ <h3 id="{{ id }}-{{ forloop.counter0 }}-heading" class="usa-accordion__heading {{ headingClassName }}">
17
17
  {% endif %}
18
18
  <button
19
19
  class="usa-accordion__button"
@@ -35,7 +35,7 @@
35
35
 
36
36
  <div
37
37
  id="{{ id }}-{{ forloop.counter0 }}-content"
38
- class="usa-accordion__content"
38
+ class="usa-accordion__content usa-prose {{ contentClassName }}"
39
39
  aria-labelledby="{{ id }}-{{ forloop.counter0 }}-heading"
40
40
  hidden
41
41
  >
@@ -30,7 +30,17 @@
30
30
  "className": {
31
31
  "type": "string",
32
32
  "default": "",
33
- "description": "Additional CSS classes to apply to the accordion. Use iconPosition to set the icon position for this accordion. For live global theming, set --usx-accordion-icon-position to 1.25rem auto (start) or auto 1.25rem (end)."
33
+ "description": "Additional CSS classes to apply to the accordion."
34
+ },
35
+ "headingClassName": {
36
+ "type": "string",
37
+ "default": "",
38
+ "description": "Additional CSS classes to apply to the accordion heading."
39
+ },
40
+ "contentClassName": {
41
+ "type": "string",
42
+ "default": "",
43
+ "description": "Additional CSS classes to apply to the accordion content."
34
44
  }
35
45
  }
36
46
  }
@@ -70,7 +70,7 @@ export default function Button({
70
70
  const classes = ClassNames(
71
71
  'usa-button',
72
72
  'usx-button',
73
- variant && variantClasses[variant],
73
+ variant ? variantClasses[variant] : variantClasses['primary'],
74
74
  big && 'usa-button--big',
75
75
  inverse && 'usa-button--inverse',
76
76
  ghost && 'usx-button--ghost',
@@ -5,7 +5,7 @@
5
5
  href="{{ href }}"
6
6
  class="
7
7
  usa-button usx-button
8
- {% if variant and variant != '' %} usa-button--{{ variant }}{% endif %}
8
+ usa-button--{{ variant|default:'primary' }}
9
9
  {% if big == True %} usa-button--big{% endif %}
10
10
  {% if disabled == True %} usa-button--disabled{% endif %}
11
11
  {% if inverse == True %} usa-button--inverse{% endif %}
@@ -18,10 +18,10 @@
18
18
  {% else %}
19
19
 
20
20
  <button
21
- type="{{ type }}"
21
+ type="{{ type|default:'button' }}"
22
22
  class="
23
23
  usa-button usx-button
24
- {% if variant and variant != '' %} usa-button--{{ variant }}{% endif %}
24
+ usa-button--{{ variant|default:'primary' }}
25
25
  {% if big == True %} usa-button--big{% endif %}
26
26
  {% if disabled == True %} usa-button--disabled{% endif %}
27
27
  {% if inverse == True %} usa-button--inverse{% endif %}
@@ -2,8 +2,13 @@ import React from 'react';
2
2
  import ClassNames from 'classnames';
3
3
  import Button from '../button/Button';
4
4
  import type { ButtonProps } from '../button/Button';
5
+
6
+ export type ButtonGroupItemProps = ButtonProps & {
7
+ itemClassName?: string;
8
+ };
9
+
5
10
  export interface ButtonGroupProps extends React.HTMLAttributes<HTMLUListElement> {
6
- buttonProps?: ButtonProps[];
11
+ buttonProps?: ButtonGroupItemProps[];
7
12
  segmented?: boolean;
8
13
  className?: string;
9
14
  }
@@ -21,8 +26,8 @@ export default function ButtonGroup({
21
26
  );
22
27
  return (
23
28
  <ul className={classes} {...props}>
24
- {buttonProps.map((item, index) => (
25
- <li key={index} className="usa-button-group__item">
29
+ {buttonProps.map(({ itemClassName, ...item }, index) => (
30
+ <li key={index} className={ClassNames('usa-button-group__item', itemClassName)}>
26
31
  <Button {...item}>
27
32
  {item.children}
28
33
  </Button>
@@ -2,7 +2,7 @@
2
2
  {# Django template for ButtonGroup #}
3
3
  <ul class="usa-button-group usx-button-group {% if segmented %}usa-button-group--segmented{% endif %} {{ className }}">
4
4
  {% for item in buttonProps %}
5
- <li class="usa-button-group__item">
5
+ <li class="usa-button-group__item{% if item.itemClassName %} {{ item.itemClassName }}{% endif %}">
6
6
  {% button label=item.label variant=item.variant type=item.type disabled=item.disabled onClick=item.onClick href=item.href isExternal=item.isExternal big=item.big inverse=item.inverse loading=item.loading iconProps=item.iconProps className=item.className style=item.style extraAttributes=item.extraAttributes %}{{ item.children }}{% endbutton %}
7
7
  </li>
8
8
  {% endfor %}
@@ -9,7 +9,13 @@
9
9
  "items": {
10
10
  "type": "object",
11
11
  "description": "Button item.",
12
- "component": "button"
12
+ "component": "button",
13
+ "properties": {
14
+ "itemClassName": {
15
+ "type": "string",
16
+ "description": "Additional CSS classes on the list item wrapping the button."
17
+ }
18
+ }
13
19
  }
14
20
  },
15
21
  "segmented": {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import ClassNames from 'classnames';
3
3
  import ButtonGroup from '../button-group/ButtonGroup';
4
+ import type { ButtonGroupItemProps } from '../button-group/ButtonGroup';
4
5
  import Tag from '../tag/Tag';
5
6
  import Image from '../image/Image';
6
7
  import Carousel from '../carousel/Carousel';
@@ -12,7 +13,7 @@ export interface CardTag {
12
13
 
13
14
  export interface CardAction {
14
15
  children: string;
15
- variant?: string;
16
+ variant?: ButtonGroupItemProps['variant'];
16
17
  onClick?: () => void;
17
18
  }
18
19
 
@@ -84,9 +85,9 @@ export default function Card({
84
85
  id={`${props.id || 'card'}-carousel`}
85
86
  showDots={showCarouselDots}
86
87
  className="usx-card__carousel"
87
- slides={images?.map((img, index) => (
88
- <Image key={index} {...img} hideCaption={true} />
89
- ))}
88
+ slides={images?.map((img, index) => ({
89
+ content: <Image key={index} {...img} hideCaption={true} />,
90
+ }))}
90
91
  />
91
92
  ) : hasImages ? (
92
93
  <Image {...images[0]} hideCaption={true} className="usa-card__img" />
@@ -124,7 +125,7 @@ export default function Card({
124
125
 
125
126
  {actions && actions.length > 0 && (
126
127
  <div className="usa-card__footer">
127
- <ButtonGroup items={actions} className="flex-wrap" />
128
+ <ButtonGroup buttonProps={actions} className="flex-wrap" />
128
129
  </div>
129
130
  )}
130
131
  </>
@@ -1,7 +1,9 @@
1
1
  {% load components %}
2
- <{% if tag %}{{ tag }}{% else %}div{% endif %} class="usa-card{% if headerFirst %} usa-card--header-first{% endif %}{% if flag %} usa-card--flag{% endif %}{% if mediaRight %} usa-card--media-right{% endif %}{% if className %} {{ className }}{% endif %}">
2
+ <{% if tag %}{{ tag }}{% else %}div{% endif %}{% if id %} id="{{ id }}"{% endif %} class="usa-card usx-card{% if headerFirst %} usa-card--header-first{% endif %}{% if flag %} usa-card--flag{% endif %}{% if mediaRight %} usa-card--media-right{% endif %}{% if className %} {{ className }}{% endif %}">
3
3
  <div class="usa-card__container">
4
- {% if title or description or tags or actions or images %}
4
+ {% if children %}
5
+ {{ children }}
6
+ {% elif title or description or tags or actions or images %}
5
7
  {% if title %}
6
8
  <div class="usa-card__header">
7
9
  <h4 class="usa-card__heading">{{ title }}</h4>
@@ -9,11 +11,11 @@
9
11
  {% endif %}
10
12
  {% if images and images|length > 1 %}
11
13
  <div class="usa-card__media{% if mediaInset %} usa-card__media--inset{% endif %}{% if mediaExdent %} usa-card__media--exdent{% endif %}">
12
- {% carousel slides=images id=id|default:'card'|add:'-carousel' showDots=showCarouselDots|default:True className='' %}{% endcarousel %}
14
+ {% carousel slides=images id=id|default:'card'|add:'-carousel' showDots=showCarouselDots|default_bool:True className='usx-card__carousel' %}{% endcarousel %}
13
15
  </div>
14
16
  {% elif images and images.0 %}
15
17
  <div class="usa-card__media{% if mediaInset %} usa-card__media--inset{% endif %}{% if mediaExdent %} usa-card__media--exdent{% endif %}">
16
- {% image src=images.0.src alt=images.0.alt hideCaption=True className='usa-card__img' %}{% endimage %}
18
+ {% image src=images.0.src alt=images.0.alt caption=images.0.caption hideCaption=True href=images.0.href rounded=images.0.rounded circular=images.0.circular objectFit=images.0.objectFit maxWidth=images.0.maxWidth maxHeight=images.0.maxHeight className='usa-card__img' %}{% endimage %}
17
19
  </div>
18
20
  {% endif %}
19
21
  <div class="usa-card__body">
@@ -30,7 +32,7 @@
30
32
  </div>
31
33
  {% if actions %}
32
34
  <div class="usa-card__footer">
33
- {% button_group items=actions %}{% endbutton_group %}
35
+ {% button_group buttonProps=actions className='flex-wrap' %}{% endbutton_group %}
34
36
  </div>
35
37
  {% endif %}
36
38
  {% else %}
@@ -3,6 +3,10 @@
3
3
  "template": "card/card.django.html",
4
4
  "version": 1,
5
5
  "props": {
6
+ "id": {
7
+ "type": "string",
8
+ "description": "Card element ID, also used as the prefix for carousel slide IDs."
9
+ },
6
10
  "title": {
7
11
  "type": "string",
8
12
  "description": "The title text displayed in the card header"
@@ -53,7 +57,7 @@
53
57
  },
54
58
  "images": {
55
59
  "type": "array",
56
- "description": "Array of image objects (currently uses first image)",
60
+ "description": "Array of image objects; multiple images render as a carousel",
57
61
  "items": {
58
62
  "type": "object",
59
63
  "description": "Card image.",
@@ -1,8 +1,8 @@
1
1
  {% load components %}
2
2
 
3
3
  {# Django template for Carousel #}
4
- <div class="usx-carousel {{ className|default:'' }}">
5
- <div class="usx-carousel__viewport" tabindex="-1" role="region" aria-roledescription="carousel" aria-label="{{ ariaLabel|default:'Featured content' }}">
4
+ <div class="usx-carousel {{ className|default:'' }}" role="region" aria-roledescription="carousel" aria-label="{{ ariaLabel|default:'Featured content' }}">
5
+ <div class="usx-carousel__viewport" tabindex="-1">
6
6
  <div class="usx-carousel__track">
7
7
  {% if children %}
8
8
  {{ children|safe }}
@@ -12,7 +12,7 @@
12
12
  {% if slide.content %}
13
13
  {{ slide.content|safe }}
14
14
  {% elif slide.src %}
15
- {% image src=slide.src alt=slide.alt caption=slide.caption hideCaption=True objectFit=slide.objectFit className=slide.className %}{% endimage %}
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 %}
16
16
  {% else %}
17
17
  {# Fallback: render the slide object/string directly #}
18
18
  {{ slide|safe }}
@@ -28,7 +28,7 @@ export interface CheckboxGroupProps extends React.HTMLAttributes<HTMLFieldSetEle
28
28
  const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
29
29
  tile = false,
30
30
  small = false,
31
- legend = 'Select one or more options',
31
+ legend,
32
32
  required = false,
33
33
  hint = null,
34
34
  error = null,
@@ -31,7 +31,7 @@
31
31
  {% else %}
32
32
  Image
33
33
  {% endif %}
34
- <figcaption class="usx-image--caption{% if hideCaption %} usa-sr-only{% endif %}">{{ caption }}</figcaption>
34
+ <figcaption class="usx-image--caption{% if hideCaption %} usa-sr-only{% endif %}" aria-hidden="{{ hideCaption|yesno:'true,false' }}">{{ caption }}</figcaption>
35
35
  </figure>
36
36
  {% else %}
37
37
  {% if href %}<a href="{{ href }}"
@@ -16,7 +16,7 @@ const Required: React.FC<RequiredProps> = ({
16
16
  const classes = ClassNames('usx-required', className);
17
17
  return (
18
18
  <>
19
- <abbr title={title} className={classes} {...props}>*</abbr>
19
+ <abbr title={title} className={classes} {...props}>*</abbr>{" "}
20
20
  {children ? children : ''}
21
21
  </>
22
22
  );
@@ -1,2 +1,2 @@
1
1
  {# Django template for Required #}
2
- <abbr title="{{ title|default:'Required' }}" class="usx-required {{ className|default:'' }}">*</abbr>{{ children|default:'' }}
2
+ <abbr title="{{ title|default:'Required' }}" class="usx-required {{ className|default:'' }}">*</abbr> {{ children|default:'' }}
@@ -19,17 +19,17 @@ const getDefaultStaticUrlPrefix = () => {
19
19
  const Spinner: React.FC<SpinnerProps> = ({
20
20
  size = 3,
21
21
  color = null,
22
- label = 'Loading...',
23
- omitLabel = false,
22
+ label = null,
23
+ screenReaderLabel = null,
24
24
  staticUrlPrefix = getDefaultStaticUrlPrefix(),
25
25
  className = '',
26
26
  ...props
27
27
  }) => {
28
28
  return (
29
- <span role="status" aria-live="polite" className={className} {...props}>
29
+ <span role="status" aria-live="polite" className={`usx-spinner ${className}`} {...props}>
30
30
  <svg
31
31
  className={
32
- 'usa-icon usx-spinner ' +
32
+ 'usa-icon ' +
33
33
  (size === 1 ? 'usx-spinner--size-1' : 'usa-icon--size-' + size) +
34
34
  (color ? ' text-' + color : '')
35
35
  }
@@ -38,7 +38,8 @@ const Spinner: React.FC<SpinnerProps> = ({
38
38
  >
39
39
  <use href={staticUrlPrefix + 'spinner'} />
40
40
  </svg>
41
- {!omitLabel && label && <span className="usa-sr-only">{label}</span>}
41
+ {screenReaderLabel && <span className="usa-sr-only">{screenReaderLabel}</span>}
42
+ {label && <span className="usa-label usx-label">{label}</span>}
42
43
  </span>
43
44
  );
44
45
  };
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "label": {
29
29
  "type": "string",
30
- "default": "Loading...",
31
- "description": "Screen-reader-only label text."
30
+ "default": null,
31
+ "description": "Visible label text displayed beside the spinner."
32
32
  },
33
- "omitLabel": {
34
- "type": "boolean",
35
- "default": false,
36
- "description": "Set to true to omit the sr-only label, e.g. when wrapped in a Tooltip."
33
+ "screenReaderLabel": {
34
+ "type": "string",
35
+ "default": null,
36
+ "description": "Optional screen-reader-only label text."
37
37
  },
38
38
  "className": {
39
39
  "type": "string",
@@ -1,8 +1,9 @@
1
1
  {% load static %}
2
2
  {# Django template for Spinner #}
3
- <span role="status" aria-live="polite" tabindex="0"{% if className %} class="{{ className }}"{% endif %}>
4
- <svg class="usa-icon usx-spinner {% if size == 1 %}usx-spinner--size-1{% else %}usa-icon--size-{{ size|default:3 }}{% endif %}{% if color %} text-{{ color }}{% endif %}" aria-hidden="true" focusable="false">
3
+ <span role="status" aria-live="polite" class="usx-spinner{% if className %} {{ className }}{% endif %}">
4
+ <svg class="usa-icon {% if size == 1 %}usx-spinner--size-1{% else %}usa-icon--size-{{ size|default:3 }}{% endif %}{% if color %} text-{{ color }}{% endif %}" aria-hidden="true" focusable="false">
5
5
  <use href="{% static 'img/usx-sprite.svg' %}#spinner"></use>
6
6
  </svg>
7
- {% if label and not omitLabel %}<span class="usa-sr-only">{{ label }}</span>{% endif %}
7
+ {% if screenReaderLabel %}<span class="usa-sr-only">{{ screenReaderLabel }}</span>{% endif %}
8
+ {% if label %}<span class="usa-label usx-label">{{ label }}</span>{% endif %}
8
9
  </span>