@comicrelief/storybook 2.4.1 → 2.5.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comicrelief/storybook",
3
3
  "description": "React components to build the Comic Relief front-end experience",
4
- "version": "2.4.1",
4
+ "version": "2.5.2",
5
5
  "dependencies": {
6
6
  "@snyk/protect": "^1.1060.0",
7
7
  "@storybook/addon-info": "3",
@@ -30,6 +30,7 @@ export default {
30
30
  id: 'postConsent',
31
31
  text: 'Send me post',
32
32
  name: 'Post',
33
+ additionalFieldGroupInfo: '',
33
34
  options: [
34
35
  {
35
36
  label: 'Post',
@@ -37,6 +38,7 @@ export default {
37
38
  name: 'permissionPost',
38
39
  hideFields: false,
39
40
  extraInfo: 'Please confirm the address we will use to <b>post</b> to you:',
41
+ disabled: false,
40
42
  },
41
43
  ],
42
44
  field: [
@@ -159,15 +159,19 @@ class MarketingConsentCheckbox extends Component {
159
159
  const bgStyle = 'form__field--background';
160
160
  const customMessage = typeof item.customMessage !== 'undefined' ? item.customMessage : null;
161
161
  const subFieldShowing = !(this.state.checkboxValidation[checkbox].isFieldsHidden);
162
+ const additionalFieldGroupInfo = typeof item.additionalFieldGroupInfo !== 'undefined' ? item.additionalFieldGroupInfo : null;
162
163
 
163
164
  return (
164
165
  <div key={item.id} className={`form__field--wrapper form__field-wrapper--checkbox form__field-wrapper--background form__field-wrapper--${item.name} ${(subFieldShowing ? 'showing' : '')}`}>
165
166
  <p className="form__fieldset--label" aria-label={`Can we contact you by ${item.name}?`}>{item.text}</p>
167
+
168
+ { additionalFieldGroupInfo && <p className="form__fieldset--additional-info">{additionalFieldGroupInfo}</p> }
169
+
166
170
  { customMessage && <p>{customMessage}</p> }
167
171
  <div id={`field-wrapper--${item.name}`} className="form__field--wrapper" >
168
172
  {
169
173
  item.options.map(option => (
170
- <div key={option.value} className="form__field--wrapper form__checkbox form__checkbox--inline form__checkbox--inline-2-horizontal">
174
+ <div key={option.value} className={`form__field--wrapper form__checkbox form__checkbox--inline form__checkbox--inline-2-horizontal ${option.disabled && 'disabled'}`}>
171
175
  <label className="form__field-label required" htmlFor={`field-label--${option.label}--${item.name}`} aria-label={`Can we contact you by ${item.name}?`}>
172
176
  {option.label}
173
177
  </label>
@@ -175,7 +179,7 @@ class MarketingConsentCheckbox extends Component {
175
179
  <input
176
180
  type="checkbox"
177
181
  id={`field-label--${option.label}--${item.name}`}
178
- className="form__field form__field--checkbox"
182
+ className={'form__field form__field--checkbox'}
179
183
  name={option.name}
180
184
  value={option.value}
181
185
  onChange={e => this.handleCheckboxToggle(item, option, e)}
@@ -183,6 +187,7 @@ class MarketingConsentCheckbox extends Component {
183
187
  ariarole="checkbox"
184
188
  aria-label={`field-label--${option.label}--${item.name}`}
185
189
  aria-checked={this.state.checkboxValidation[checkbox].value === option.value}
190
+ disabled={option.disabled}
186
191
  />
187
192
  <span />
188
193
  </div>