@comicrelief/component-library 8.18.4 → 8.19.1

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.
Files changed (39) hide show
  1. package/dist/components/Atoms/ErrorText/ErrorText.js +3 -15
  2. package/dist/components/Atoms/ErrorText/__snapshots__/ErrorText.test.js.snap +1 -17
  3. package/dist/components/Atoms/Input/Input.js +39 -24
  4. package/dist/components/Atoms/Input/Input.md +1 -2
  5. package/dist/components/Atoms/Input/assets/error-alert-icon-red.svg +10 -0
  6. package/dist/components/Atoms/Input/input.test.js +1 -1
  7. package/dist/components/Atoms/Label/Label.js +16 -10
  8. package/dist/components/Atoms/Select/__snapshots__/Select.test.js.snap +2 -2
  9. package/dist/components/Atoms/TextArea/TextArea.test.js +1 -1
  10. package/dist/components/Atoms/TextInputWithDropdown/__snapshots__/TextInputWithDropdown.test.js.snap +160 -84
  11. package/dist/components/Molecules/SchoolLookup/__snapshots__/SchoolLookup.test.js.snap +48 -20
  12. package/dist/components/Molecules/SearchInput/SearchInput.test.js +1 -1
  13. package/dist/components/Molecules/Typeahead/__snapshots__/Typeahead.test.js.snap +48 -20
  14. package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +306 -179
  15. package/dist/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +89 -59
  16. package/dist/components/Organisms/Membership/Membership.test.js +2 -2
  17. package/package.json +1 -1
  18. package/src/components/Atoms/ErrorText/ErrorText.js +1 -19
  19. package/src/components/Atoms/ErrorText/__snapshots__/ErrorText.test.js.snap +1 -17
  20. package/src/components/Atoms/Input/Input.js +54 -20
  21. package/src/components/Atoms/Input/Input.md +1 -2
  22. package/src/components/Atoms/Input/assets/error-alert-icon-red.svg +10 -0
  23. package/src/components/Atoms/Input/input.test.js +44 -16
  24. package/src/components/Atoms/Label/Label.js +25 -9
  25. package/src/components/Atoms/Select/__snapshots__/Select.test.js.snap +2 -2
  26. package/src/components/Atoms/TextArea/TextArea.test.js +2 -2
  27. package/src/components/Atoms/TextInputWithDropdown/__snapshots__/TextInputWithDropdown.test.js.snap +160 -84
  28. package/src/components/Molecules/SchoolLookup/__snapshots__/SchoolLookup.test.js.snap +48 -20
  29. package/src/components/Molecules/SearchInput/SearchInput.test.js +47 -19
  30. package/src/components/Molecules/Typeahead/__snapshots__/Typeahead.test.js.snap +48 -20
  31. package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +306 -179
  32. package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +89 -59
  33. package/src/components/Organisms/Membership/Membership.test.js +121 -86
  34. package/dist/components/Atoms/Input/assets/CR_Error--red.svg +0 -1
  35. package/dist/components/Atoms/Input/assets/CR_Error.svg +0 -1
  36. package/dist/components/Atoms/Input/assets/error-alert-icon.png +0 -0
  37. package/src/components/Atoms/Input/assets/CR_Error--red.svg +0 -1
  38. package/src/components/Atoms/Input/assets/CR_Error.svg +0 -1
  39. package/src/components/Atoms/Input/assets/error-alert-icon.png +0 -0
@@ -7,12 +7,12 @@ import spacing from '../../../theme/shared/spacing';
7
7
  import hideVisually from '../../../theme/shared/hideVisually';
8
8
 
9
9
  const LabelElement = styled.label`
10
- position: relative;
10
+ width: 100%;
11
+ position: relative;
11
12
  display: flex;
12
13
  flex-direction: column;
13
- color: ${({ theme }) => theme.color('grey_label')};
14
- width: 100%;
15
-
14
+ color: ${({ theme, errorMsg }) => (errorMsg ? theme.color('red') : theme.color('grey_label'))};
15
+
16
16
  ${({ optional, theme }) => optional === true && `
17
17
  :after {
18
18
  position: absolute;
@@ -23,9 +23,12 @@ const LabelElement = styled.label`
23
23
  font-size: ${theme.fontSize('s')};
24
24
  }`}
25
25
  `;
26
- const VisibleText = styled(Text).attrs({ weight: 'bold' })`
26
+
27
+ const VisibleText = styled(Text)`
27
28
  margin-bottom: ${spacing('sm')};
29
+ font-weight: normal;
28
30
  `;
31
+
29
32
  const HiddenText = styled(Text)`${hideVisually}`;
30
33
 
31
34
  // eslint-disable-next-line react/prop-types
@@ -51,13 +54,20 @@ const Label = ({
51
54
  label,
52
55
  hideLabel = false,
53
56
  optional = null,
57
+ errorMsg = '',
54
58
  ...rest
55
59
  }) => (
56
- <LabelElement {...rest} optional={optional}>
57
- <LabelText label={label} hideLabel={hideLabel} />
60
+ <LabelElement
61
+ optional={optional}
62
+ errorMsg={errorMsg}
63
+ {...rest}
64
+ >
65
+ <LabelText
66
+ label={label}
67
+ hideLabel={hideLabel}
68
+ />
58
69
  {children}
59
70
  </LabelElement>
60
-
61
71
  );
62
72
 
63
73
  Label.propTypes = {
@@ -67,7 +77,13 @@ Label.propTypes = {
67
77
  ]).isRequired,
68
78
  hideLabel: PropTypes.bool,
69
79
  children: PropTypes.node,
70
- optional: PropTypes.bool
80
+ optional: PropTypes.bool,
81
+ errorMsg: PropTypes.string
82
+ };
83
+
84
+ LabelElement.propTypes = {
85
+ optional: PropTypes.bool,
86
+ errorMsg: PropTypes.string
71
87
  };
72
88
 
73
89
  LabelText.propTypes = {
@@ -5,12 +5,12 @@ exports[`renders correctly 1`] = `
5
5
  font-size: 1rem;
6
6
  line-height: 1rem;
7
7
  text-transform: inherit;
8
- font-weight: bold;
9
8
  line-height: normal;
10
9
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
11
10
  }
12
11
 
13
12
  .c0 {
13
+ width: 100%;
14
14
  position: relative;
15
15
  display: -webkit-box;
16
16
  display: -webkit-flex;
@@ -20,11 +20,11 @@ exports[`renders correctly 1`] = `
20
20
  -ms-flex-direction: column;
21
21
  flex-direction: column;
22
22
  color: #5C5C5E;
23
- width: 100%;
24
23
  }
25
24
 
26
25
  .c2 {
27
26
  margin-bottom: 0.5rem;
27
+ font-weight: normal;
28
28
  }
29
29
 
30
30
  .c3 {
@@ -20,12 +20,12 @@ it('renders correctly', () => {
20
20
  font-size: 1rem;
21
21
  line-height: 1rem;
22
22
  text-transform: inherit;
23
- font-weight: bold;
24
23
  line-height: normal;
25
24
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
26
25
  }
27
26
 
28
27
  .c0 {
28
+ width: 100%;
29
29
  position: relative;
30
30
  display: -webkit-box;
31
31
  display: -webkit-flex;
@@ -35,11 +35,11 @@ it('renders correctly', () => {
35
35
  -ms-flex-direction: column;
36
36
  flex-direction: column;
37
37
  color: #5C5C5E;
38
- width: 100%;
39
38
  }
40
39
 
41
40
  .c2 {
42
41
  margin-bottom: 0.5rem;
42
+ font-weight: normal;
43
43
  }
44
44
 
45
45
  .c3 {
@@ -5,12 +5,12 @@ exports[`renders correctly with no value and no options 1`] = `
5
5
  font-size: 1rem;
6
6
  line-height: 1rem;
7
7
  text-transform: inherit;
8
- font-weight: bold;
9
8
  line-height: normal;
10
9
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
11
10
  }
12
11
 
13
12
  .c1 {
13
+ width: 100%;
14
14
  position: relative;
15
15
  display: -webkit-box;
16
16
  display: -webkit-flex;
@@ -20,19 +20,41 @@ exports[`renders correctly with no value and no options 1`] = `
20
20
  -ms-flex-direction: column;
21
21
  flex-direction: column;
22
22
  color: #5C5C5E;
23
- width: 100%;
24
23
  }
25
24
 
26
25
  .c3 {
27
26
  margin-bottom: 0.5rem;
27
+ font-weight: normal;
28
+ }
29
+
30
+ .c4 {
31
+ position: relative;
32
+ font-size: 1.25rem;
28
33
  }
29
34
 
30
35
  .c5 {
36
+ position: relative;
37
+ width: 100%;
38
+ display: -webkit-box;
39
+ display: -webkit-flex;
40
+ display: -ms-flexbox;
41
+ display: flex;
42
+ -webkit-box-pack: end;
43
+ -webkit-justify-content: flex-end;
44
+ -ms-flex-pack: end;
45
+ justify-content: flex-end;
46
+ -webkit-align-items: center;
47
+ -webkit-box-align: center;
48
+ -ms-flex-align: center;
49
+ align-items: center;
50
+ }
51
+
52
+ .c6 {
31
53
  position: relative;
32
54
  box-sizing: border-box;
33
55
  width: 100%;
34
56
  height: 48px;
35
- padding: 1rem 1.5rem;
57
+ padding: 1rem 2.4rem 1rem 1.5rem;
36
58
  background-color: #F4F3F5;
37
59
  border: 1px solid;
38
60
  border-color: #E1E2E3;
@@ -47,15 +69,10 @@ exports[`renders correctly with no value and no options 1`] = `
47
69
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
48
70
  }
49
71
 
50
- .c5:focus {
72
+ .c6:focus {
51
73
  border: 1px solid #666;
52
74
  }
53
75
 
54
- .c4 {
55
- position: relative;
56
- font-size: 1.25rem;
57
- }
58
-
59
76
  .c0 {
60
77
  position: relative;
61
78
  }
@@ -66,6 +83,12 @@ exports[`renders correctly with no value and no options 1`] = `
66
83
  }
67
84
  }
68
85
 
86
+ @media (min-width:740px) {
87
+ .c6 {
88
+ max-width: 290px;
89
+ }
90
+ }
91
+
69
92
  <div
70
93
  className="c0 TextInputWithDropdown"
71
94
  onKeyDown={[Function]}
@@ -88,18 +111,23 @@ exports[`renders correctly with no value and no options 1`] = `
88
111
  className="c4"
89
112
  >
90
113
 
91
- <input
92
- aria-describedby="text-input-with-dropdown"
93
- autoComplete="off"
114
+ <div
94
115
  className="c5"
95
- id="text-input-with-dropdown"
96
- name="query"
97
- onChange={[Function]}
98
- placeholder=""
99
- required={false}
100
- type="text"
101
- value=""
102
- />
116
+ >
117
+ <input
118
+ aria-describedby="text-input-with-dropdown"
119
+ autoComplete="off"
120
+ className="c6"
121
+ id="text-input-with-dropdown"
122
+ name="query"
123
+ onChange={[Function]}
124
+ placeholder=""
125
+ required={false}
126
+ type="text"
127
+ value=""
128
+ />
129
+
130
+ </div>
103
131
  </div>
104
132
 
105
133
  </label>
@@ -111,12 +139,12 @@ exports[`renders correctly with value and no options 1`] = `
111
139
  font-size: 1rem;
112
140
  line-height: 1rem;
113
141
  text-transform: inherit;
114
- font-weight: bold;
115
142
  line-height: normal;
116
143
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
117
144
  }
118
145
 
119
146
  .c1 {
147
+ width: 100%;
120
148
  position: relative;
121
149
  display: -webkit-box;
122
150
  display: -webkit-flex;
@@ -126,19 +154,41 @@ exports[`renders correctly with value and no options 1`] = `
126
154
  -ms-flex-direction: column;
127
155
  flex-direction: column;
128
156
  color: #5C5C5E;
129
- width: 100%;
130
157
  }
131
158
 
132
159
  .c3 {
133
160
  margin-bottom: 0.5rem;
161
+ font-weight: normal;
162
+ }
163
+
164
+ .c4 {
165
+ position: relative;
166
+ font-size: 1.25rem;
134
167
  }
135
168
 
136
169
  .c5 {
170
+ position: relative;
171
+ width: 100%;
172
+ display: -webkit-box;
173
+ display: -webkit-flex;
174
+ display: -ms-flexbox;
175
+ display: flex;
176
+ -webkit-box-pack: end;
177
+ -webkit-justify-content: flex-end;
178
+ -ms-flex-pack: end;
179
+ justify-content: flex-end;
180
+ -webkit-align-items: center;
181
+ -webkit-box-align: center;
182
+ -ms-flex-align: center;
183
+ align-items: center;
184
+ }
185
+
186
+ .c6 {
137
187
  position: relative;
138
188
  box-sizing: border-box;
139
189
  width: 100%;
140
190
  height: 48px;
141
- padding: 1rem 1.5rem;
191
+ padding: 1rem 2.4rem 1rem 1.5rem;
142
192
  background-color: #F4F3F5;
143
193
  border: 1px solid;
144
194
  border-color: #E1E2E3;
@@ -153,15 +203,10 @@ exports[`renders correctly with value and no options 1`] = `
153
203
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
154
204
  }
155
205
 
156
- .c5:focus {
206
+ .c6:focus {
157
207
  border: 1px solid #666;
158
208
  }
159
209
 
160
- .c4 {
161
- position: relative;
162
- font-size: 1.25rem;
163
- }
164
-
165
210
  .c0 {
166
211
  position: relative;
167
212
  }
@@ -172,6 +217,12 @@ exports[`renders correctly with value and no options 1`] = `
172
217
  }
173
218
  }
174
219
 
220
+ @media (min-width:740px) {
221
+ .c6 {
222
+ max-width: 290px;
223
+ }
224
+ }
225
+
175
226
  <div
176
227
  className="c0 TextInputWithDropdown"
177
228
  onKeyDown={[Function]}
@@ -194,18 +245,23 @@ exports[`renders correctly with value and no options 1`] = `
194
245
  className="c4"
195
246
  >
196
247
 
197
- <input
198
- aria-describedby="text-input-with-dropdown"
199
- autoComplete="off"
248
+ <div
200
249
  className="c5"
201
- id="text-input-with-dropdown"
202
- name="query"
203
- onChange={[Function]}
204
- placeholder=""
205
- required={false}
206
- type="text"
207
- value="bikes"
208
- />
250
+ >
251
+ <input
252
+ aria-describedby="text-input-with-dropdown"
253
+ autoComplete="off"
254
+ className="c6"
255
+ id="text-input-with-dropdown"
256
+ name="query"
257
+ onChange={[Function]}
258
+ placeholder=""
259
+ required={false}
260
+ type="text"
261
+ value="bikes"
262
+ />
263
+
264
+ </div>
209
265
  </div>
210
266
 
211
267
  </label>
@@ -214,15 +270,6 @@ exports[`renders correctly with value and no options 1`] = `
214
270
 
215
271
  exports[`renders correctly with value and options 1`] = `
216
272
  .c2 {
217
- font-size: 1rem;
218
- line-height: 1rem;
219
- text-transform: inherit;
220
- font-weight: bold;
221
- line-height: normal;
222
- font-family: 'Montserrat',Helvetica,Arial,sans-serif;
223
- }
224
-
225
- .c10 {
226
273
  font-size: 1rem;
227
274
  line-height: 1rem;
228
275
  text-transform: inherit;
@@ -231,6 +278,7 @@ exports[`renders correctly with value and options 1`] = `
231
278
  }
232
279
 
233
280
  .c1 {
281
+ width: 100%;
234
282
  position: relative;
235
283
  display: -webkit-box;
236
284
  display: -webkit-flex;
@@ -240,19 +288,41 @@ exports[`renders correctly with value and options 1`] = `
240
288
  -ms-flex-direction: column;
241
289
  flex-direction: column;
242
290
  color: #5C5C5E;
243
- width: 100%;
244
291
  }
245
292
 
246
293
  .c3 {
247
294
  margin-bottom: 0.5rem;
295
+ font-weight: normal;
296
+ }
297
+
298
+ .c4 {
299
+ position: relative;
300
+ font-size: 1.25rem;
248
301
  }
249
302
 
250
303
  .c5 {
304
+ position: relative;
305
+ width: 100%;
306
+ display: -webkit-box;
307
+ display: -webkit-flex;
308
+ display: -ms-flexbox;
309
+ display: flex;
310
+ -webkit-box-pack: end;
311
+ -webkit-justify-content: flex-end;
312
+ -ms-flex-pack: end;
313
+ justify-content: flex-end;
314
+ -webkit-align-items: center;
315
+ -webkit-box-align: center;
316
+ -ms-flex-align: center;
317
+ align-items: center;
318
+ }
319
+
320
+ .c6 {
251
321
  position: relative;
252
322
  box-sizing: border-box;
253
323
  width: 100%;
254
324
  height: 48px;
255
- padding: 1rem 1.5rem;
325
+ padding: 1rem 2.4rem 1rem 1.5rem;
256
326
  background-color: #F4F3F5;
257
327
  border: 1px solid;
258
328
  border-color: #E1E2E3;
@@ -267,20 +337,15 @@ exports[`renders correctly with value and options 1`] = `
267
337
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
268
338
  }
269
339
 
270
- .c5:focus {
340
+ .c6:focus {
271
341
  border: 1px solid #666;
272
342
  }
273
343
 
274
- .c4 {
275
- position: relative;
276
- font-size: 1.25rem;
277
- }
278
-
279
344
  .c0 {
280
345
  position: relative;
281
346
  }
282
347
 
283
- .c6 {
348
+ .c7 {
284
349
  z-index: 3;
285
350
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
286
351
  position: absolute;
@@ -293,23 +358,23 @@ exports[`renders correctly with value and options 1`] = `
293
358
  width: 100%;
294
359
  }
295
360
 
296
- .c7 {
361
+ .c8 {
297
362
  list-style: none;
298
363
  padding: 0;
299
364
  margin: 0;
300
365
  }
301
366
 
302
- .c8 {
367
+ .c9 {
303
368
  padding: 0.5rem;
304
369
  }
305
370
 
306
- .c9 {
371
+ .c10 {
307
372
  cursor: pointer;
308
373
  border-top: 1px solid #F4F3F5;
309
374
  }
310
375
 
311
- .c9:hover,
312
- .c9:focus {
376
+ .c10:hover,
377
+ .c10:focus {
313
378
  background-color: #F4F3F5;
314
379
  }
315
380
 
@@ -321,6 +386,12 @@ exports[`renders correctly with value and options 1`] = `
321
386
 
322
387
  @media (min-width:740px) {
323
388
  .c6 {
389
+ max-width: 290px;
390
+ }
391
+ }
392
+
393
+ @media (min-width:740px) {
394
+ .c7 {
324
395
  max-width: 500px;
325
396
  }
326
397
  }
@@ -347,32 +418,37 @@ exports[`renders correctly with value and options 1`] = `
347
418
  className="c4"
348
419
  >
349
420
 
350
- <input
351
- aria-describedby="text-input-with-dropdown"
352
- autoComplete="off"
421
+ <div
353
422
  className="c5"
354
- id="text-input-with-dropdown"
355
- name="query"
356
- onChange={[Function]}
357
- placeholder=""
358
- required={false}
359
- type="text"
360
- value="c"
361
- />
423
+ >
424
+ <input
425
+ aria-describedby="text-input-with-dropdown"
426
+ autoComplete="off"
427
+ className="c6"
428
+ id="text-input-with-dropdown"
429
+ name="query"
430
+ onChange={[Function]}
431
+ placeholder=""
432
+ required={false}
433
+ type="text"
434
+ value="c"
435
+ />
436
+
437
+ </div>
362
438
  </div>
363
439
 
364
440
  </label>
365
441
  <div
366
- className="c6 TextInputWithDropdown__options"
442
+ className="c7 TextInputWithDropdown__options"
367
443
  >
368
444
  <ul
369
- className="c7"
445
+ className="c8"
370
446
  onBlur={[Function]}
371
447
  role="listbox"
372
448
  >
373
449
  <li
374
450
  aria-selected={false}
375
- className="c8 c9"
451
+ className="c9 c10"
376
452
  id="option-0"
377
453
  onClick={[Function]}
378
454
  onKeyPress={[Function]}
@@ -380,7 +456,7 @@ exports[`renders correctly with value and options 1`] = `
380
456
  tabIndex="-1"
381
457
  >
382
458
  <span
383
- className="c10"
459
+ className="c2"
384
460
  color="inherit"
385
461
  size="s"
386
462
  >
@@ -389,7 +465,7 @@ exports[`renders correctly with value and options 1`] = `
389
465
  </li>
390
466
  <li
391
467
  aria-selected={false}
392
- className="c8 c9"
468
+ className="c9 c10"
393
469
  id="option-1"
394
470
  onClick={[Function]}
395
471
  onKeyPress={[Function]}
@@ -397,7 +473,7 @@ exports[`renders correctly with value and options 1`] = `
397
473
  tabIndex="-1"
398
474
  >
399
475
  <span
400
- className="c10"
476
+ className="c2"
401
477
  color="inherit"
402
478
  size="s"
403
479
  >
@@ -406,7 +482,7 @@ exports[`renders correctly with value and options 1`] = `
406
482
  </li>
407
483
  <li
408
484
  aria-selected={false}
409
- className="c8 c9"
485
+ className="c9 c10"
410
486
  id="option-2"
411
487
  onClick={[Function]}
412
488
  onKeyPress={[Function]}
@@ -414,7 +490,7 @@ exports[`renders correctly with value and options 1`] = `
414
490
  tabIndex="-1"
415
491
  >
416
492
  <span
417
- className="c10"
493
+ className="c2"
418
494
  color="inherit"
419
495
  size="s"
420
496
  >
@@ -423,7 +499,7 @@ exports[`renders correctly with value and options 1`] = `
423
499
  </li>
424
500
  <li
425
501
  aria-selected={false}
426
- className="c8 c9"
502
+ className="c9 c10"
427
503
  id="option-3"
428
504
  onClick={[Function]}
429
505
  onKeyPress={[Function]}
@@ -431,7 +507,7 @@ exports[`renders correctly with value and options 1`] = `
431
507
  tabIndex="-1"
432
508
  >
433
509
  <span
434
- className="c10"
510
+ className="c2"
435
511
  color="inherit"
436
512
  size="s"
437
513
  >