dce-reactkit 5.0.5 → 5.0.6

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.
@@ -18,6 +18,7 @@ type Props = {
18
18
  small?: boolean;
19
19
  dashed?: boolean;
20
20
  useComplexFormatting?: boolean;
21
+ minSizeToShowLabel?: 'sm' | 'md' | 'lg' | 'xl';
21
22
  };
22
23
  declare const CheckboxButton: React.FC<Props>;
23
24
  export default CheckboxButton;
package/dist/index.d.ts CHANGED
@@ -278,6 +278,7 @@ type Props$l = {
278
278
  small?: boolean;
279
279
  dashed?: boolean;
280
280
  useComplexFormatting?: boolean;
281
+ minSizeToShowLabel?: 'sm' | 'md' | 'lg' | 'xl';
281
282
  };
282
283
  declare const CheckboxButton: React$1.FC<Props$l>;
283
284
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -48,6 +48,8 @@ type Props = {
48
48
  dashed?: boolean,
49
49
  // If true, use complex formatting (tabs, newlines) in the text
50
50
  useComplexFormatting?: boolean,
51
+ // Min bootstrap size to show the label
52
+ minSizeToShowLabel?: 'sm' | 'md' | 'lg' | 'xl',
51
53
  };
52
54
 
53
55
  /*------------------------------------------------------------------------*/
@@ -83,6 +85,7 @@ const CheckboxButton: React.FC<Props> = (props) => {
83
85
  small,
84
86
  dashed,
85
87
  useComplexFormatting,
88
+ minSizeToShowLabel,
86
89
  } = props;
87
90
 
88
91
  /*------------------------------------------------------------------------*/
@@ -118,30 +121,32 @@ const CheckboxButton: React.FC<Props> = (props) => {
118
121
  }}
119
122
  >
120
123
  <div className="d-flex align-items-center">
121
- <div className="me-1">
124
+ <div>
122
125
  <FontAwesomeIcon
123
126
  icon={icon}
124
127
  />
125
128
  </div>
126
- {
127
- useComplexFormatting
128
- ? (
129
- <pre
130
- className="ps-1 text-start text-break m-0"
131
- style={{
132
- whiteSpace: 'pre-wrap',
133
- tabSize: 2,
134
- }}
135
- >
136
- {text}
137
- </pre>
138
- )
139
- : (
140
- <div className="flex-grow-1 text-start text-break">
141
- {text}
142
- </div>
143
- )
144
- }
129
+ <div className={`text-start flex-grow-1 ms-1 ${minSizeToShowLabel ? `d-none d-${minSizeToShowLabel}-block` : ''}`}>
130
+ {
131
+ useComplexFormatting
132
+ ? (
133
+ <pre
134
+ className="ps-1 text-break m-0"
135
+ style={{
136
+ whiteSpace: 'pre-wrap',
137
+ tabSize: 2,
138
+ }}
139
+ >
140
+ {text}
141
+ </pre>
142
+ )
143
+ : (
144
+ <div className="text-break">
145
+ {text}
146
+ </div>
147
+ )
148
+ }
149
+ </div>
145
150
  </div>
146
151
  </button>
147
152
  );