dce-reactkit 3.7.15 → 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.
@@ -9,6 +9,8 @@ type Props = {
9
9
  children: React.ReactNode;
10
10
  className?: string;
11
11
  wrapButtonsAndAddGaps?: boolean;
12
+ isAdminFeature?: boolean;
13
+ noMarginOnBottom?: boolean;
12
14
  };
13
15
  declare const ButtonInputGroup: React.FC<Props>;
14
16
  export default ButtonInputGroup;
@@ -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
@@ -249,6 +249,8 @@ type Props$f = {
249
249
  children: React$1.ReactNode;
250
250
  className?: string;
251
251
  wrapButtonsAndAddGaps?: boolean;
252
+ isAdminFeature?: boolean;
253
+ noMarginOnBottom?: boolean;
252
254
  };
253
255
  declare const ButtonInputGroup: React$1.FC<Props$f>;
254
256
 
@@ -615,6 +617,7 @@ type Props$2 = {
615
617
  */
616
618
  onToggle: (isOn: boolean) => void;
617
619
  id?: string;
620
+ className?: string;
618
621
  description: string;
619
622
  backgroundVariantWhenOn?: Variant;
620
623
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.7.15",
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",
@@ -22,6 +22,10 @@ type Props = {
22
22
  className?: string,
23
23
  // If true, wrap buttons and create gaps
24
24
  wrapButtonsAndAddGaps?: boolean,
25
+ // If true, is an admin feature
26
+ isAdminFeature?: boolean,
27
+ // If true, don't add a margin on the bottom
28
+ noMarginOnBottom?: boolean,
25
29
  };
26
30
 
27
31
  /*------------------------------------------------------------------------*/
@@ -42,6 +46,8 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
42
46
  children,
43
47
  className,
44
48
  wrapButtonsAndAddGaps,
49
+ isAdminFeature,
50
+ noMarginOnBottom,
45
51
  } = props;
46
52
 
47
53
  /*------------------------------------------------------------------------*/
@@ -53,11 +59,11 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
53
59
  /*----------------------------------------*/
54
60
 
55
61
  return (
56
- <div className={`input-group ${className ?? ''}`}>
62
+ <div className={`input-group ${className ?? ''} ${noMarginOnBottom ? '' : 'mb-2'}`}>
57
63
  <div className="input-group-prepend d-flex w-100">
58
64
  {/* Label */}
59
65
  <span
60
- className="input-group-text"
66
+ className={`input-group-text ${isAdminFeature ? 'border border-success progress-bar-striped bg-success text-white fw-bold' : ''}`}
61
67
  style={{
62
68
  minWidth: (
63
69
  minLabelWidth
@@ -72,7 +78,7 @@ const ButtonInputGroup: React.FC<Props> = (props) => {
72
78
 
73
79
  {/* Contents */}
74
80
  <span
75
- className="input-group-text flex-grow-1 rounded-right d-flex flex-wrap"
81
+ className={`input-group-text flex-grow-1 ${isAdminFeature ? 'border-success ' : ''}rounded-right d-flex flex-wrap`}
76
82
  style={{
77
83
  backgroundColor: 'white',
78
84
  borderTopLeftRadius: 0,
@@ -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
  }}