dce-reactkit 3.7.16 → 3.7.17

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.
@@ -13,6 +13,7 @@ type Props = {
13
13
  */
14
14
  onToggle: (isOn: boolean) => void;
15
15
  id?: string;
16
+ className?: string;
16
17
  description: string;
17
18
  backgroundVariantWhenOn?: Variant;
18
19
  };
package/dist/index.d.ts CHANGED
@@ -617,6 +617,7 @@ type Props$2 = {
617
617
  */
618
618
  onToggle: (isOn: boolean) => void;
619
619
  id?: string;
620
+ className?: string;
620
621
  description: string;
621
622
  backgroundVariantWhenOn?: Variant;
622
623
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.7.16",
3
+ "version": "3.7.17",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -29,6 +29,8 @@ type Props = {
29
29
  onToggle: (isOn: boolean) => void,
30
30
  // Unique ID for the toggle switch
31
31
  id?: string,
32
+ // Custom className for the toggle switch
33
+ className?: string,
32
34
  // A description for what it means when the toggle switch is on
33
35
  // E.g. "airplane mode is active"
34
36
  // Description will be placed into a sentence with the structure:
@@ -54,6 +56,7 @@ const ToggleSwitch: React.FC<Props> = (props) => {
54
56
  isOn,
55
57
  onToggle,
56
58
  id,
59
+ className,
57
60
  description,
58
61
  backgroundVariantWhenOn = Variant.Info,
59
62
  } = props;
@@ -76,7 +79,7 @@ const ToggleSwitch: React.FC<Props> = (props) => {
76
79
  <button
77
80
  id={id}
78
81
  aria-label={`If on, ${description}. Currently ${isOn ? 'on' : 'off'}. Click to turn ${isOn ? 'off' : 'on'}.`}
79
- className={`alert alert-${backgroundVariant} bg-${backgroundVariant} mb-0 rounded-pill d-inline-block pt-0 pb-0 px-3`}
82
+ className={`alert alert-${backgroundVariant} bg-${backgroundVariant} mb-0 rounded-pill d-inline-block pt-0 pb-0 px-3 ${className ?? ''}`}
80
83
  onClick={() => {
81
84
  onToggle(!isOn);
82
85
  }}