dce-reactkit 3.9.5 → 3.9.7

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.
@@ -17,6 +17,7 @@ type Props = {
17
17
  uncheckedVariant?: Variant;
18
18
  small?: boolean;
19
19
  dashed?: boolean;
20
+ useComplexFormatting?: boolean;
20
21
  };
21
22
  declare const CheckboxButton: React.FC<Props>;
22
23
  export default CheckboxButton;
package/dist/index.d.ts CHANGED
@@ -269,6 +269,7 @@ type Props$h = {
269
269
  uncheckedVariant?: Variant;
270
270
  small?: boolean;
271
271
  dashed?: boolean;
272
+ useComplexFormatting?: boolean;
272
273
  };
273
274
  declare const CheckboxButton: React$1.FC<Props$h>;
274
275
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.9.5",
3
+ "version": "3.9.7",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,6 +46,8 @@ type Props = {
46
46
  small?: boolean,
47
47
  // If true, show a dash in the checkbox (only relevant if unchecked)
48
48
  dashed?: boolean,
49
+ // If true, use complex formatting (tabs, newlines) in the text
50
+ useComplexFormatting?: boolean,
49
51
  };
50
52
 
51
53
  /*------------------------------------------------------------------------*/
@@ -80,6 +82,7 @@ const CheckboxButton: React.FC<Props> = (props) => {
80
82
  ),
81
83
  small,
82
84
  dashed,
85
+ useComplexFormatting,
83
86
  } = props;
84
87
 
85
88
  /*------------------------------------------------------------------------*/
@@ -121,9 +124,24 @@ const CheckboxButton: React.FC<Props> = (props) => {
121
124
  className="me-1"
122
125
  />
123
126
  </div>
124
- <div className="flex-grow-1">
125
- {text}
126
- </div>
127
+ {
128
+ useComplexFormatting
129
+ ? (
130
+ <pre
131
+ className="ps-2 text-start text-break"
132
+ style={{
133
+ whiteSpace: 'pre-wrap',
134
+ }}
135
+ >
136
+ {text}
137
+ </pre>
138
+ )
139
+ : (
140
+ <div className="flex-grow-1 text-start text-break ps-2">
141
+ {text}
142
+ </div>
143
+ )
144
+ }
127
145
  </div>
128
146
  </button>
129
147
  );