@tactics/toddle-styleguide 1.2.3 → 1.2.4

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 (31) hide show
  1. package/App.tsx +195 -192
  2. package/package.json +1 -1
  3. package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +1821 -641
  4. package/src/components/molecules/avatar/__snapshots__/avatar.test.js.snap +70 -62
  5. package/src/components/molecules/avatar/avatar.component.d.ts +2 -1
  6. package/src/components/molecules/avatar/avatar.component.tsx +22 -11
  7. package/src/components/molecules/avatar/avatar.preview.tsx +58 -44
  8. package/src/components/molecules/avatar/avatar.styles.d.ts +54 -15
  9. package/src/components/molecules/avatar/avatar.styles.js +33 -5
  10. package/src/components/molecules/date-input/date-input.preview.tsx +25 -23
  11. package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +1868 -1776
  12. package/src/components/molecules/time-picker/time-picker.component.tsx +49 -23
  13. package/src/components/molecules/time-picker/time-picker.preview.tsx +5 -4
  14. package/src/components/molecules/time-picker/time-picker.styles.d.ts +16 -4
  15. package/src/components/molecules/time-picker/time-picker.styles.js +18 -6
  16. package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +174 -162
  17. package/src/components/organisms/contact-item/__snapshots__/contact-item.test.js.snap +70 -127
  18. package/src/components/organisms/contact-item/contact-item.component.tsx +10 -9
  19. package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +97 -89
  20. package/src/components/organisms/person-info-card/__snapshots__/person-info-card.test.js.snap +233 -209
  21. package/src/components/templates/popover/components/modal/modal.component.tsx +0 -1
  22. package/src/components/templates/popover/components/modal/modal.styles.d.ts +2 -1
  23. package/src/components/templates/popover/components/modal/modal.styles.js +2 -2
  24. package/src/components/templates/popover/popover.component.tsx +27 -14
  25. package/src/components/templates/popover/popover.preview.tsx +63 -97
  26. package/src/components/templates/popover/popover.styles.d.ts +1 -1
  27. package/src/components/templates/popover/popover.styles.js +3 -1
  28. package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +1 -0
  29. package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +7 -0
  30. package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +15 -1
  31. package/src/utilities/toddle-datetime/toddle-datetime.test.js +10 -0
@@ -11,47 +11,51 @@ exports[`Person info card tests renders a person info card with initials and lab
11
11
  }
12
12
  >
13
13
  <View
14
- style={
15
- [
16
- {
17
- "alignItems": "center",
18
- "backgroundColor": "#647ACB",
19
- "justifyContent": "center",
20
- "overflow": "hidden",
21
- },
22
- false,
23
- false,
24
- {
25
- "borderRadius": 60,
26
- "height": 120,
27
- "width": 120,
28
- },
29
- ]
30
- }
14
+ style={null}
31
15
  >
32
- <Text
16
+ <View
33
17
  style={
34
18
  [
35
- [
36
- {
37
- "fontFamily": "SourceSansProBold",
38
- "fontSize": 38,
39
- "lineHeight": 47.8,
40
- },
41
- ],
42
19
  {
43
- "color": "#FFFFFF",
44
- "textAlign": "center",
45
- "width": "100%",
20
+ "alignItems": "center",
21
+ "backgroundColor": "#647ACB",
22
+ "justifyContent": "center",
23
+ "overflow": "hidden",
46
24
  },
25
+ false,
26
+ false,
47
27
  {
48
- "textTransform": "uppercase",
28
+ "borderRadius": 60,
29
+ "height": 120,
30
+ "width": 120,
49
31
  },
50
32
  ]
51
33
  }
52
34
  >
53
- ZD
54
- </Text>
35
+ <Text
36
+ style={
37
+ [
38
+ [
39
+ {
40
+ "fontFamily": "SourceSansProBold",
41
+ "fontSize": 38,
42
+ "lineHeight": 47.8,
43
+ },
44
+ ],
45
+ {
46
+ "color": "#FFFFFF",
47
+ "textAlign": "center",
48
+ "width": "100%",
49
+ },
50
+ {
51
+ "textTransform": "uppercase",
52
+ },
53
+ ]
54
+ }
55
+ >
56
+ ZD
57
+ </Text>
58
+ </View>
55
59
  </View>
56
60
  </View>
57
61
  <View
@@ -121,47 +125,51 @@ exports[`Person info card tests renders a person info card with initials and lab
121
125
  }
122
126
  >
123
127
  <View
124
- style={
125
- [
126
- {
127
- "alignItems": "center",
128
- "backgroundColor": "#647ACB",
129
- "justifyContent": "center",
130
- "overflow": "hidden",
131
- },
132
- false,
133
- false,
134
- {
135
- "borderRadius": 60,
136
- "height": 120,
137
- "width": 120,
138
- },
139
- ]
140
- }
128
+ style={null}
141
129
  >
142
- <Text
130
+ <View
143
131
  style={
144
132
  [
145
- [
146
- {
147
- "fontFamily": "SourceSansProBold",
148
- "fontSize": 38,
149
- "lineHeight": 47.8,
150
- },
151
- ],
152
133
  {
153
- "color": "#FFFFFF",
154
- "textAlign": "center",
155
- "width": "100%",
134
+ "alignItems": "center",
135
+ "backgroundColor": "#647ACB",
136
+ "justifyContent": "center",
137
+ "overflow": "hidden",
156
138
  },
139
+ false,
140
+ false,
157
141
  {
158
- "textTransform": "uppercase",
142
+ "borderRadius": 60,
143
+ "height": 120,
144
+ "width": 120,
159
145
  },
160
146
  ]
161
147
  }
162
148
  >
163
- ZD
164
- </Text>
149
+ <Text
150
+ style={
151
+ [
152
+ [
153
+ {
154
+ "fontFamily": "SourceSansProBold",
155
+ "fontSize": 38,
156
+ "lineHeight": 47.8,
157
+ },
158
+ ],
159
+ {
160
+ "color": "#FFFFFF",
161
+ "textAlign": "center",
162
+ "width": "100%",
163
+ },
164
+ {
165
+ "textTransform": "uppercase",
166
+ },
167
+ ]
168
+ }
169
+ >
170
+ ZD
171
+ </Text>
172
+ </View>
165
173
  </View>
166
174
  </View>
167
175
  <View
@@ -231,47 +239,51 @@ exports[`Person info card tests renders a person info card with initials and no
231
239
  }
232
240
  >
233
241
  <View
234
- style={
235
- [
236
- {
237
- "alignItems": "center",
238
- "backgroundColor": "#647ACB",
239
- "justifyContent": "center",
240
- "overflow": "hidden",
241
- },
242
- false,
243
- false,
244
- {
245
- "borderRadius": 60,
246
- "height": 120,
247
- "width": 120,
248
- },
249
- ]
250
- }
242
+ style={null}
251
243
  >
252
- <Text
244
+ <View
253
245
  style={
254
246
  [
255
- [
256
- {
257
- "fontFamily": "SourceSansProBold",
258
- "fontSize": 38,
259
- "lineHeight": 47.8,
260
- },
261
- ],
262
247
  {
263
- "color": "#FFFFFF",
264
- "textAlign": "center",
265
- "width": "100%",
248
+ "alignItems": "center",
249
+ "backgroundColor": "#647ACB",
250
+ "justifyContent": "center",
251
+ "overflow": "hidden",
266
252
  },
253
+ false,
254
+ false,
267
255
  {
268
- "textTransform": "uppercase",
256
+ "borderRadius": 60,
257
+ "height": 120,
258
+ "width": 120,
269
259
  },
270
260
  ]
271
261
  }
272
262
  >
273
- ZD
274
- </Text>
263
+ <Text
264
+ style={
265
+ [
266
+ [
267
+ {
268
+ "fontFamily": "SourceSansProBold",
269
+ "fontSize": 38,
270
+ "lineHeight": 47.8,
271
+ },
272
+ ],
273
+ {
274
+ "color": "#FFFFFF",
275
+ "textAlign": "center",
276
+ "width": "100%",
277
+ },
278
+ {
279
+ "textTransform": "uppercase",
280
+ },
281
+ ]
282
+ }
283
+ >
284
+ ZD
285
+ </Text>
286
+ </View>
275
287
  </View>
276
288
  </View>
277
289
  <View
@@ -339,47 +351,51 @@ exports[`Person info card tests renders a person info card with initials, label
339
351
  }
340
352
  >
341
353
  <View
342
- style={
343
- [
344
- {
345
- "alignItems": "center",
346
- "backgroundColor": "#F16868",
347
- "justifyContent": "center",
348
- "overflow": "hidden",
349
- },
350
- false,
351
- false,
352
- {
353
- "borderRadius": 60,
354
- "height": 120,
355
- "width": 120,
356
- },
357
- ]
358
- }
354
+ style={null}
359
355
  >
360
- <Text
356
+ <View
361
357
  style={
362
358
  [
363
- [
364
- {
365
- "fontFamily": "SourceSansProBold",
366
- "fontSize": 38,
367
- "lineHeight": 47.8,
368
- },
369
- ],
370
359
  {
371
- "color": "#FFFFFF",
372
- "textAlign": "center",
373
- "width": "100%",
360
+ "alignItems": "center",
361
+ "backgroundColor": "#F16868",
362
+ "justifyContent": "center",
363
+ "overflow": "hidden",
374
364
  },
365
+ false,
366
+ false,
375
367
  {
376
- "textTransform": "uppercase",
368
+ "borderRadius": 60,
369
+ "height": 120,
370
+ "width": 120,
377
371
  },
378
372
  ]
379
373
  }
380
374
  >
381
- ZD
382
- </Text>
375
+ <Text
376
+ style={
377
+ [
378
+ [
379
+ {
380
+ "fontFamily": "SourceSansProBold",
381
+ "fontSize": 38,
382
+ "lineHeight": 47.8,
383
+ },
384
+ ],
385
+ {
386
+ "color": "#FFFFFF",
387
+ "textAlign": "center",
388
+ "width": "100%",
389
+ },
390
+ {
391
+ "textTransform": "uppercase",
392
+ },
393
+ ]
394
+ }
395
+ >
396
+ ZD
397
+ </Text>
398
+ </View>
383
399
  </View>
384
400
  </View>
385
401
  <View
@@ -449,47 +465,51 @@ exports[`Person info card tests renders a person info card with initials, label
449
465
  }
450
466
  >
451
467
  <View
452
- style={
453
- [
454
- {
455
- "alignItems": "center",
456
- "backgroundColor": "#E5E8EB",
457
- "justifyContent": "center",
458
- "overflow": "hidden",
459
- },
460
- false,
461
- false,
462
- {
463
- "borderRadius": 60,
464
- "height": 120,
465
- "width": 120,
466
- },
467
- ]
468
- }
468
+ style={null}
469
469
  >
470
- <Text
470
+ <View
471
471
  style={
472
472
  [
473
- [
474
- {
475
- "fontFamily": "SourceSansProBold",
476
- "fontSize": 38,
477
- "lineHeight": 47.8,
478
- },
479
- ],
480
473
  {
481
- "color": "#FFFFFF",
482
- "textAlign": "center",
483
- "width": "100%",
474
+ "alignItems": "center",
475
+ "backgroundColor": "#E5E8EB",
476
+ "justifyContent": "center",
477
+ "overflow": "hidden",
484
478
  },
479
+ false,
480
+ false,
485
481
  {
486
- "textTransform": "uppercase",
482
+ "borderRadius": 60,
483
+ "height": 120,
484
+ "width": 120,
487
485
  },
488
486
  ]
489
487
  }
490
488
  >
491
- ZD
492
- </Text>
489
+ <Text
490
+ style={
491
+ [
492
+ [
493
+ {
494
+ "fontFamily": "SourceSansProBold",
495
+ "fontSize": 38,
496
+ "lineHeight": 47.8,
497
+ },
498
+ ],
499
+ {
500
+ "color": "#FFFFFF",
501
+ "textAlign": "center",
502
+ "width": "100%",
503
+ },
504
+ {
505
+ "textTransform": "uppercase",
506
+ },
507
+ ]
508
+ }
509
+ >
510
+ ZD
511
+ </Text>
512
+ </View>
493
513
  </View>
494
514
  </View>
495
515
  <View
@@ -559,69 +579,73 @@ exports[`Person info card tests renders a person info card with picture and labe
559
579
  }
560
580
  >
561
581
  <View
562
- style={
563
- [
564
- {
565
- "alignItems": "center",
566
- "backgroundColor": "#647ACB",
567
- "justifyContent": "center",
568
- "overflow": "hidden",
569
- },
570
- false,
571
- false,
572
- {
573
- "borderRadius": 60,
574
- "height": 120,
575
- "width": 120,
576
- },
577
- ]
578
- }
582
+ style={null}
579
583
  >
580
- <ViewManagerAdapter_ExpoLinearGradient
581
- proxiedProperties={
582
- {
583
- "colors": [
584
- 4281681564,
585
- 4284775115,
586
- 4292481661,
587
- ],
588
- "endPoint": [
589
- 0.9,
590
- 0.9,
591
- ],
592
- "locations": [
593
- 0,
594
- 0.55,
595
- 1,
596
- ],
597
- "startPoint": [
598
- 0.1,
599
- 0.1,
600
- ],
601
- }
602
- }
584
+ <View
603
585
  style={
604
586
  [
605
587
  {
606
- "height": "100%",
607
- "width": "100%",
588
+ "alignItems": "center",
589
+ "backgroundColor": "#647ACB",
590
+ "justifyContent": "center",
591
+ "overflow": "hidden",
608
592
  },
609
- ]
610
- }
611
- />
612
- <Image
613
- source={1}
614
- style={
615
- [
593
+ false,
594
+ false,
616
595
  {
617
- "borderRadius": 50,
618
- "height": "90%",
619
- "position": "absolute",
620
- "width": "90%",
596
+ "borderRadius": 60,
597
+ "height": 120,
598
+ "width": 120,
621
599
  },
622
600
  ]
623
601
  }
624
- />
602
+ >
603
+ <ViewManagerAdapter_ExpoLinearGradient
604
+ proxiedProperties={
605
+ {
606
+ "colors": [
607
+ 4281681564,
608
+ 4284775115,
609
+ 4292481661,
610
+ ],
611
+ "endPoint": [
612
+ 0.9,
613
+ 0.9,
614
+ ],
615
+ "locations": [
616
+ 0,
617
+ 0.55,
618
+ 1,
619
+ ],
620
+ "startPoint": [
621
+ 0.1,
622
+ 0.1,
623
+ ],
624
+ }
625
+ }
626
+ style={
627
+ [
628
+ {
629
+ "height": "100%",
630
+ "width": "100%",
631
+ },
632
+ ]
633
+ }
634
+ />
635
+ <Image
636
+ source={1}
637
+ style={
638
+ [
639
+ {
640
+ "borderRadius": 50,
641
+ "height": "90%",
642
+ "position": "absolute",
643
+ "width": "90%",
644
+ },
645
+ ]
646
+ }
647
+ />
648
+ </View>
625
649
  </View>
626
650
  </View>
627
651
  <View
@@ -1,6 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import {useContext, useMemo, useState} from 'react';
3
-
4
3
  import {Animated} from 'react-native';
5
4
  import {Stylesheet} from './modal.styles';
6
5
  import {Close} from './close/close.component';
@@ -1,4 +1,4 @@
1
- export function Stylesheet(Context: any): {
1
+ export function Stylesheet(context: any): {
2
2
  element: {
3
3
  position: 'relative';
4
4
  display: 'flex';
@@ -10,6 +10,7 @@ export function Stylesheet(Context: any): {
10
10
  borderTopLeftRadius: number;
11
11
  borderTopRightRadius: number;
12
12
  backgroundColor: any;
13
+ minHeight: string;
13
14
  };
14
15
  inner: {
15
16
  display: 'flex';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import {StyleSheet} from 'react-native';
3
3
  import {Scale} from '../../../../../theme/scale';
4
4
 
5
- export const Stylesheet = (Context) =>
5
+ export const Stylesheet = (context) =>
6
6
  StyleSheet.create({
7
7
  element: {
8
8
  position: 'relative',
@@ -14,7 +14,7 @@ export const Stylesheet = (Context) =>
14
14
  paddingRight: Scale.m,
15
15
  borderTopLeftRadius: Scale.l,
16
16
  borderTopRightRadius: Scale.l,
17
- backgroundColor: Context.colors.ui.white,
17
+ backgroundColor: context.colors.ui.white,
18
18
  minHeight: '40%',
19
19
  },
20
20
  inner: {
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
- import {useContext, useEffect, useState} from 'react';
3
-
4
- import {ThemeCtx} from '../../../context/theme.context';
5
- import {Dimensions, useWindowDimensions, View} from 'react-native';
2
+ import {useEffect, useState} from 'react';
3
+ import {Dimensions, Platform, StatusBar, View} from 'react-native';
6
4
  import {Stylesheet} from './popover.styles';
7
5
  import {Backdrop} from '../../atoms/backdrop/backdrop.component';
8
6
  import {Modal, Foreground} from './components';
@@ -15,8 +13,6 @@ type PopoverProps = {
15
13
  children?: React.ReactNode;
16
14
  };
17
15
 
18
- const window = Dimensions.get('window');
19
-
20
16
  const Popover = ({
21
17
  isVisible,
22
18
  title,
@@ -24,20 +20,37 @@ const Popover = ({
24
20
  onClose,
25
21
  children,
26
22
  }: PopoverProps) => {
27
- const {width, height} = useWindowDimensions();
23
+ const [windowHeight, setWindowHeight] = useState(
24
+ Dimensions.get('window').height
25
+ );
26
+
27
+ useEffect(() => {
28
+ const updateWindowHeight = () => {
29
+ let availableHeight = Dimensions.get('window').height;
30
+ if (Platform.OS === 'android') {
31
+ availableHeight += StatusBar.currentHeight ?? 0;
32
+ }
33
+ setWindowHeight(availableHeight);
34
+ };
35
+
36
+ updateWindowHeight();
37
+
38
+ const subscription = Dimensions.addEventListener(
39
+ 'change',
40
+ updateWindowHeight
41
+ );
42
+
43
+ return () => subscription?.remove();
44
+ }, []);
28
45
 
29
- const context = useContext(ThemeCtx);
30
- const styles = Stylesheet(context);
46
+ const styles = Stylesheet();
31
47
 
32
48
  return (
33
- <View
34
- style={[styles.element, {width: width, height: height}]}
35
- pointerEvents={isVisible ? 'auto' : 'none'}
36
- >
49
+ <View style={styles.element} pointerEvents={isVisible ? 'auto' : 'none'}>
37
50
  <Backdrop isVisible={isVisible} />
38
51
  <Foreground>
39
52
  <Modal
40
- windowHeight={height}
53
+ windowHeight={windowHeight}
41
54
  isVisible={isVisible}
42
55
  onClose={onClose}
43
56
  title={title}