@comicrelief/component-library 8.19.0 → 8.20.0

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 (22) hide show
  1. package/README.md +2 -2
  2. package/dist/components/Atoms/Input/Input.js +42 -30
  3. package/dist/components/Atoms/Input/Input.md +14 -0
  4. package/dist/components/Atoms/Input/input.test.js +13 -1
  5. package/dist/components/Atoms/TextInputWithDropdown/__snapshots__/TextInputWithDropdown.test.js.snap +145 -73
  6. package/dist/components/Molecules/SchoolLookup/__snapshots__/SchoolLookup.test.js.snap +44 -20
  7. package/dist/components/Molecules/SearchInput/SearchInput.test.js +1 -1
  8. package/dist/components/Molecules/Typeahead/__snapshots__/Typeahead.test.js.snap +44 -20
  9. package/dist/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +290 -179
  10. package/dist/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +90 -56
  11. package/dist/components/Organisms/Membership/Membership.test.js +1 -1
  12. package/package.json +1 -1
  13. package/src/components/Atoms/Input/Input.js +51 -34
  14. package/src/components/Atoms/Input/Input.md +14 -0
  15. package/src/components/Atoms/Input/input.test.js +173 -13
  16. package/src/components/Atoms/TextInputWithDropdown/__snapshots__/TextInputWithDropdown.test.js.snap +145 -73
  17. package/src/components/Molecules/SchoolLookup/__snapshots__/SchoolLookup.test.js.snap +44 -20
  18. package/src/components/Molecules/SearchInput/SearchInput.test.js +44 -20
  19. package/src/components/Molecules/Typeahead/__snapshots__/Typeahead.test.js.snap +44 -20
  20. package/src/components/Organisms/Donate/__snapshots__/Donate.test.js.snap +290 -179
  21. package/src/components/Organisms/EmailSignUp/__snapshots__/EmailSignUp.test.js.snap +90 -56
  22. package/src/components/Organisms/Membership/Membership.test.js +120 -81
@@ -42,7 +42,29 @@ it('renders correctly', () => {
42
42
  font-weight: normal;
43
43
  }
44
44
 
45
+ .c3 {
46
+ position: relative;
47
+ font-size: 1.25rem;
48
+ }
49
+
45
50
  .c4 {
51
+ position: relative;
52
+ width: 100%;
53
+ display: -webkit-box;
54
+ display: -webkit-flex;
55
+ display: -ms-flexbox;
56
+ display: flex;
57
+ -webkit-box-pack: end;
58
+ -webkit-justify-content: flex-end;
59
+ -ms-flex-pack: end;
60
+ justify-content: flex-end;
61
+ -webkit-align-items: center;
62
+ -webkit-box-align: center;
63
+ -ms-flex-align: center;
64
+ align-items: center;
65
+ }
66
+
67
+ .c5 {
46
68
  position: relative;
47
69
  box-sizing: border-box;
48
70
  width: 100%;
@@ -62,31 +84,164 @@ it('renders correctly', () => {
62
84
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
63
85
  }
64
86
 
65
- .c4:focus {
87
+ .c5:focus {
66
88
  border: 1px solid #666;
67
89
  }
68
90
 
91
+ @media (min-width:740px) {
92
+
93
+ }
94
+
95
+ @media (min-width:1024px) {
96
+
97
+ }
98
+
99
+ <label
100
+ className="c0"
101
+ htmlFor="Accessibility info go here"
102
+ >
103
+ <span
104
+ className="c1 c2"
105
+ color="inherit"
106
+ dangerouslySetInnerHTML={
107
+ Object {
108
+ "__html": "Label",
109
+ }
110
+ }
111
+ size="s"
112
+ />
113
+ <div
114
+ className="c3"
115
+ >
116
+
117
+ <div
118
+ className="c4"
119
+ >
120
+ <input
121
+ aria-describedby="Accessibility info go here"
122
+ className="c5"
123
+ id="Accessibility info go here"
124
+ name="fullname"
125
+ placeholder="This is the hint text"
126
+ required={false}
127
+ type="text"
128
+ />
129
+
130
+ </div>
131
+ </div>
132
+
133
+ </label>
134
+ `);
135
+ });
136
+
137
+ it('renders with responsive max widths correctly', () => {
138
+ const tree = renderWithTheme(
139
+ <Input
140
+ name="responsive-width"
141
+ placeholder="This input has responsive max widths"
142
+ type="text"
143
+ label="Responsive Width Input"
144
+ id="input-example-7"
145
+ maxPxWidthMediumBreakpoint={150}
146
+ maxPxWidthLargeBreakpoint={250}
147
+ />
148
+ ).toJSON();
149
+
150
+ expect(tree).toMatchInlineSnapshot(`
151
+ .c1 {
152
+ font-size: 1rem;
153
+ line-height: 1rem;
154
+ text-transform: inherit;
155
+ line-height: normal;
156
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
157
+ }
158
+
159
+ .c0 {
160
+ width: 100%;
161
+ position: relative;
162
+ display: -webkit-box;
163
+ display: -webkit-flex;
164
+ display: -ms-flexbox;
165
+ display: flex;
166
+ -webkit-flex-direction: column;
167
+ -ms-flex-direction: column;
168
+ flex-direction: column;
169
+ color: #5C5C5E;
170
+ }
171
+
172
+ .c2 {
173
+ margin-bottom: 0.5rem;
174
+ font-weight: normal;
175
+ }
176
+
69
177
  .c3 {
70
178
  position: relative;
71
179
  font-size: 1.25rem;
72
180
  }
73
181
 
182
+ .c4 {
183
+ position: relative;
184
+ width: 100%;
185
+ display: -webkit-box;
186
+ display: -webkit-flex;
187
+ display: -ms-flexbox;
188
+ display: flex;
189
+ -webkit-box-pack: end;
190
+ -webkit-justify-content: flex-end;
191
+ -ms-flex-pack: end;
192
+ justify-content: flex-end;
193
+ -webkit-align-items: center;
194
+ -webkit-box-align: center;
195
+ -ms-flex-align: center;
196
+ align-items: center;
197
+ }
198
+
199
+ .c5 {
200
+ position: relative;
201
+ box-sizing: border-box;
202
+ width: 100%;
203
+ height: 48px;
204
+ padding: 1rem 2.4rem 1rem 1.5rem;
205
+ background-color: #F4F3F5;
206
+ border: 1px solid;
207
+ border-color: #E1E2E3;
208
+ box-shadow: none;
209
+ -webkit-appearance: none;
210
+ -moz-appearance: none;
211
+ appearance: none;
212
+ color: #000000;
213
+ border-radius: 0.5rem;
214
+ font-size: inherit;
215
+ z-index: 2;
216
+ font-family: 'Montserrat',Helvetica,Arial,sans-serif;
217
+ }
218
+
219
+ .c5:focus {
220
+ border: 1px solid #666;
221
+ }
222
+
74
223
  @media (min-width:740px) {
75
- .c3 {
76
- max-width: 290px;
224
+ .c4 {
225
+ max-width: 150px;
226
+ }
227
+ }
228
+
229
+ @media (min-width:1024px) {
230
+ .c4 {
231
+ max-width: 250px;
77
232
  }
78
233
  }
79
234
 
80
235
  <label
81
236
  className="c0"
82
- htmlFor="Accessibility info go here"
237
+ htmlFor="input-example-7"
83
238
  >
84
239
  <span
85
240
  className="c1 c2"
86
241
  color="inherit"
87
242
  dangerouslySetInnerHTML={
88
243
  Object {
89
- "__html": "Label",
244
+ "__html": "Responsive Width Input",
90
245
  }
91
246
  }
92
247
  size="s"
@@ -95,15 +250,20 @@ it('renders correctly', () => {
95
250
  className="c3"
96
251
  >
97
252
 
98
- <input
99
- aria-describedby="Accessibility info go here"
253
+ <div
100
254
  className="c4"
101
- id="Accessibility info go here"
102
- name="fullname"
103
- placeholder="This is the hint text"
104
- required={false}
105
- type="text"
106
- />
255
+ >
256
+ <input
257
+ aria-describedby="input-example-7"
258
+ className="c5"
259
+ id="input-example-7"
260
+ name="responsive-width"
261
+ placeholder="This input has responsive max widths"
262
+ required={false}
263
+ type="text"
264
+ />
265
+
266
+ </div>
107
267
  </div>
108
268
 
109
269
  </label>
@@ -27,7 +27,29 @@ exports[`renders correctly with no value and no options 1`] = `
27
27
  font-weight: normal;
28
28
  }
29
29
 
30
+ .c4 {
31
+ position: relative;
32
+ font-size: 1.25rem;
33
+ }
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%;
@@ -47,23 +69,20 @@ 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
  }
62
79
 
63
80
  @media (min-width:740px) {
64
- .c4 {
65
- max-width: 290px;
66
- }
81
+
82
+ }
83
+
84
+ @media (min-width:1024px) {
85
+
67
86
  }
68
87
 
69
88
  <div
@@ -88,18 +107,23 @@ exports[`renders correctly with no value and no options 1`] = `
88
107
  className="c4"
89
108
  >
90
109
 
91
- <input
92
- aria-describedby="text-input-with-dropdown"
93
- autoComplete="off"
110
+ <div
94
111
  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
- />
112
+ >
113
+ <input
114
+ aria-describedby="text-input-with-dropdown"
115
+ autoComplete="off"
116
+ className="c6"
117
+ id="text-input-with-dropdown"
118
+ name="query"
119
+ onChange={[Function]}
120
+ placeholder=""
121
+ required={false}
122
+ type="text"
123
+ value=""
124
+ />
125
+
126
+ </div>
103
127
  </div>
104
128
 
105
129
  </label>
@@ -133,7 +157,29 @@ exports[`renders correctly with value and no options 1`] = `
133
157
  font-weight: normal;
134
158
  }
135
159
 
160
+ .c4 {
161
+ position: relative;
162
+ font-size: 1.25rem;
163
+ }
164
+
136
165
  .c5 {
166
+ position: relative;
167
+ width: 100%;
168
+ display: -webkit-box;
169
+ display: -webkit-flex;
170
+ display: -ms-flexbox;
171
+ display: flex;
172
+ -webkit-box-pack: end;
173
+ -webkit-justify-content: flex-end;
174
+ -ms-flex-pack: end;
175
+ justify-content: flex-end;
176
+ -webkit-align-items: center;
177
+ -webkit-box-align: center;
178
+ -ms-flex-align: center;
179
+ align-items: center;
180
+ }
181
+
182
+ .c6 {
137
183
  position: relative;
138
184
  box-sizing: border-box;
139
185
  width: 100%;
@@ -153,23 +199,20 @@ exports[`renders correctly with value and no options 1`] = `
153
199
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
154
200
  }
155
201
 
156
- .c5:focus {
202
+ .c6:focus {
157
203
  border: 1px solid #666;
158
204
  }
159
205
 
160
- .c4 {
161
- position: relative;
162
- font-size: 1.25rem;
163
- }
164
-
165
206
  .c0 {
166
207
  position: relative;
167
208
  }
168
209
 
169
210
  @media (min-width:740px) {
170
- .c4 {
171
- max-width: 290px;
172
- }
211
+
212
+ }
213
+
214
+ @media (min-width:1024px) {
215
+
173
216
  }
174
217
 
175
218
  <div
@@ -194,18 +237,23 @@ exports[`renders correctly with value and no options 1`] = `
194
237
  className="c4"
195
238
  >
196
239
 
197
- <input
198
- aria-describedby="text-input-with-dropdown"
199
- autoComplete="off"
240
+ <div
200
241
  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
- />
242
+ >
243
+ <input
244
+ aria-describedby="text-input-with-dropdown"
245
+ autoComplete="off"
246
+ className="c6"
247
+ id="text-input-with-dropdown"
248
+ name="query"
249
+ onChange={[Function]}
250
+ placeholder=""
251
+ required={false}
252
+ type="text"
253
+ value="bikes"
254
+ />
255
+
256
+ </div>
209
257
  </div>
210
258
 
211
259
  </label>
@@ -239,7 +287,29 @@ exports[`renders correctly with value and options 1`] = `
239
287
  font-weight: normal;
240
288
  }
241
289
 
290
+ .c4 {
291
+ position: relative;
292
+ font-size: 1.25rem;
293
+ }
294
+
242
295
  .c5 {
296
+ position: relative;
297
+ width: 100%;
298
+ display: -webkit-box;
299
+ display: -webkit-flex;
300
+ display: -ms-flexbox;
301
+ display: flex;
302
+ -webkit-box-pack: end;
303
+ -webkit-justify-content: flex-end;
304
+ -ms-flex-pack: end;
305
+ justify-content: flex-end;
306
+ -webkit-align-items: center;
307
+ -webkit-box-align: center;
308
+ -ms-flex-align: center;
309
+ align-items: center;
310
+ }
311
+
312
+ .c6 {
243
313
  position: relative;
244
314
  box-sizing: border-box;
245
315
  width: 100%;
@@ -259,20 +329,15 @@ exports[`renders correctly with value and options 1`] = `
259
329
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
260
330
  }
261
331
 
262
- .c5:focus {
332
+ .c6:focus {
263
333
  border: 1px solid #666;
264
334
  }
265
335
 
266
- .c4 {
267
- position: relative;
268
- font-size: 1.25rem;
269
- }
270
-
271
336
  .c0 {
272
337
  position: relative;
273
338
  }
274
339
 
275
- .c6 {
340
+ .c7 {
276
341
  z-index: 3;
277
342
  font-family: 'Montserrat',Helvetica,Arial,sans-serif;
278
343
  position: absolute;
@@ -285,34 +350,36 @@ exports[`renders correctly with value and options 1`] = `
285
350
  width: 100%;
286
351
  }
287
352
 
288
- .c7 {
353
+ .c8 {
289
354
  list-style: none;
290
355
  padding: 0;
291
356
  margin: 0;
292
357
  }
293
358
 
294
- .c8 {
359
+ .c9 {
295
360
  padding: 0.5rem;
296
361
  }
297
362
 
298
- .c9 {
363
+ .c10 {
299
364
  cursor: pointer;
300
365
  border-top: 1px solid #F4F3F5;
301
366
  }
302
367
 
303
- .c9:hover,
304
- .c9:focus {
368
+ .c10:hover,
369
+ .c10:focus {
305
370
  background-color: #F4F3F5;
306
371
  }
307
372
 
308
373
  @media (min-width:740px) {
309
- .c4 {
310
- max-width: 290px;
311
- }
374
+
375
+ }
376
+
377
+ @media (min-width:1024px) {
378
+
312
379
  }
313
380
 
314
381
  @media (min-width:740px) {
315
- .c6 {
382
+ .c7 {
316
383
  max-width: 500px;
317
384
  }
318
385
  }
@@ -339,32 +406,37 @@ exports[`renders correctly with value and options 1`] = `
339
406
  className="c4"
340
407
  >
341
408
 
342
- <input
343
- aria-describedby="text-input-with-dropdown"
344
- autoComplete="off"
409
+ <div
345
410
  className="c5"
346
- id="text-input-with-dropdown"
347
- name="query"
348
- onChange={[Function]}
349
- placeholder=""
350
- required={false}
351
- type="text"
352
- value="c"
353
- />
411
+ >
412
+ <input
413
+ aria-describedby="text-input-with-dropdown"
414
+ autoComplete="off"
415
+ className="c6"
416
+ id="text-input-with-dropdown"
417
+ name="query"
418
+ onChange={[Function]}
419
+ placeholder=""
420
+ required={false}
421
+ type="text"
422
+ value="c"
423
+ />
424
+
425
+ </div>
354
426
  </div>
355
427
 
356
428
  </label>
357
429
  <div
358
- className="c6 TextInputWithDropdown__options"
430
+ className="c7 TextInputWithDropdown__options"
359
431
  >
360
432
  <ul
361
- className="c7"
433
+ className="c8"
362
434
  onBlur={[Function]}
363
435
  role="listbox"
364
436
  >
365
437
  <li
366
438
  aria-selected={false}
367
- className="c8 c9"
439
+ className="c9 c10"
368
440
  id="option-0"
369
441
  onClick={[Function]}
370
442
  onKeyPress={[Function]}
@@ -381,7 +453,7 @@ exports[`renders correctly with value and options 1`] = `
381
453
  </li>
382
454
  <li
383
455
  aria-selected={false}
384
- className="c8 c9"
456
+ className="c9 c10"
385
457
  id="option-1"
386
458
  onClick={[Function]}
387
459
  onKeyPress={[Function]}
@@ -398,7 +470,7 @@ exports[`renders correctly with value and options 1`] = `
398
470
  </li>
399
471
  <li
400
472
  aria-selected={false}
401
- className="c8 c9"
473
+ className="c9 c10"
402
474
  id="option-2"
403
475
  onClick={[Function]}
404
476
  onKeyPress={[Function]}
@@ -415,7 +487,7 @@ exports[`renders correctly with value and options 1`] = `
415
487
  </li>
416
488
  <li
417
489
  aria-selected={false}
418
- className="c8 c9"
490
+ className="c9 c10"
419
491
  id="option-3"
420
492
  onClick={[Function]}
421
493
  onKeyPress={[Function]}
@@ -27,7 +27,29 @@ exports[`renders correctly 1`] = `
27
27
  font-weight: normal;
28
28
  }
29
29
 
30
+ .c4 {
31
+ position: relative;
32
+ font-size: 1.25rem;
33
+ }
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%;
@@ -47,23 +69,20 @@ exports[`renders correctly 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
  }
62
79
 
63
80
  @media (min-width:740px) {
64
- .c4 {
65
- max-width: 290px;
66
- }
81
+
82
+ }
83
+
84
+ @media (min-width:1024px) {
85
+
67
86
  }
68
87
 
69
88
  <div
@@ -88,18 +107,23 @@ exports[`renders correctly 1`] = `
88
107
  className="c4"
89
108
  >
90
109
 
91
- <input
92
- aria-describedby="school-lookup"
93
- autoComplete="off"
110
+ <div
94
111
  className="c5"
95
- defaultValue=""
96
- id="school-lookup"
97
- name="school-lookup"
98
- onChange={[Function]}
99
- placeholder="Type to start search"
100
- required={false}
101
- type="text"
102
- />
112
+ >
113
+ <input
114
+ aria-describedby="school-lookup"
115
+ autoComplete="off"
116
+ className="c6"
117
+ defaultValue=""
118
+ id="school-lookup"
119
+ name="school-lookup"
120
+ onChange={[Function]}
121
+ placeholder="Type to start search"
122
+ required={false}
123
+ type="text"
124
+ />
125
+
126
+ </div>
103
127
  </div>
104
128
 
105
129
  </label>