@terreno/ui 0.30.0 → 56.0.0-beta.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 (118) hide show
  1. package/dist/ActionSheet.d.ts +1 -1
  2. package/dist/Avatar.js +1 -4
  3. package/dist/Avatar.js.map +1 -1
  4. package/dist/Box.js +45 -9
  5. package/dist/Box.js.map +1 -1
  6. package/dist/Common.d.ts +21 -0
  7. package/dist/Common.js.map +1 -1
  8. package/dist/ConflictSheet.d.ts +53 -0
  9. package/dist/ConflictSheet.js +132 -0
  10. package/dist/ConflictSheet.js.map +1 -0
  11. package/dist/DateTimeActionSheet.d.ts +2 -1
  12. package/dist/DecimalRangeActionSheet.d.ts +1 -1
  13. package/dist/EmojiSelector.d.ts +1 -1
  14. package/dist/ErrorPage.d.ts +1 -1
  15. package/dist/HeightActionSheet.d.ts +1 -1
  16. package/dist/Hyperlink.d.ts +2 -1
  17. package/dist/Hyperlink.js +2 -1
  18. package/dist/Hyperlink.js.map +1 -1
  19. package/dist/Image.d.ts +1 -1
  20. package/dist/ImageBackground.d.ts +1 -1
  21. package/dist/MobileAddressAutoComplete.d.ts +1 -1
  22. package/dist/NumberPickerActionSheet.d.ts +1 -1
  23. package/dist/Page.d.ts +3 -3
  24. package/dist/PickerSelect.d.ts +1 -1
  25. package/dist/SidebarNavigation.js +1 -1
  26. package/dist/SidebarNavigation.js.map +1 -1
  27. package/dist/SidebarNavigation.native.js +1 -1
  28. package/dist/SidebarNavigation.native.js.map +1 -1
  29. package/dist/SplitPage.d.ts +1 -1
  30. package/dist/SplitPage.js +1 -4
  31. package/dist/SplitPage.js.map +1 -1
  32. package/dist/SplitPage.native.d.ts +1 -1
  33. package/dist/SyncStatusBanner.d.ts +46 -0
  34. package/dist/SyncStatusBanner.js +29 -0
  35. package/dist/SyncStatusBanner.js.map +1 -0
  36. package/dist/Theme.d.ts +1 -1
  37. package/dist/Toast.d.ts +9 -1
  38. package/dist/Toast.js +20 -7
  39. package/dist/Toast.js.map +1 -1
  40. package/dist/ToastNotifications.js +23 -1
  41. package/dist/ToastNotifications.js.map +1 -1
  42. package/dist/UnifiedAddressAutoComplete.d.ts +1 -1
  43. package/dist/Unifier.js +1 -1
  44. package/dist/Unifier.js.map +1 -1
  45. package/dist/conflictFieldDiff.d.ts +14 -0
  46. package/dist/conflictFieldDiff.js +62 -0
  47. package/dist/conflictFieldDiff.js.map +1 -0
  48. package/dist/icons/OfflineIcon.d.ts +1 -1
  49. package/dist/icons/OnlineIcon.d.ts +1 -1
  50. package/dist/icons/OutOfficeIcon.d.ts +1 -1
  51. package/dist/index.d.ts +5 -2
  52. package/dist/index.js +5 -2
  53. package/dist/index.js.map +1 -1
  54. package/dist/pdfHtmlTemplate.d.ts +30 -0
  55. package/dist/pdfHtmlTemplate.js +170 -0
  56. package/dist/pdfHtmlTemplate.js.map +1 -0
  57. package/dist/table/TableTitle.js +1 -3
  58. package/dist/table/TableTitle.js.map +1 -1
  59. package/dist/useAppLaunchOrForeground.d.ts +9 -0
  60. package/dist/useAppLaunchOrForeground.js +27 -0
  61. package/dist/useAppLaunchOrForeground.js.map +1 -0
  62. package/package.json +44 -37
  63. package/src/Box.test.tsx +39 -9
  64. package/src/Box.tsx +46 -7
  65. package/src/Common.ts +21 -3
  66. package/src/ConflictSheet.test.tsx +461 -0
  67. package/src/ConflictSheet.tsx +399 -0
  68. package/src/DataTable.test.tsx +15 -21
  69. package/src/Hyperlink.tsx +1 -1
  70. package/src/SidebarNavigation.native.tsx +1 -1
  71. package/src/SidebarNavigation.tsx +1 -1
  72. package/src/SyncStatusBanner.test.tsx +204 -0
  73. package/src/SyncStatusBanner.tsx +148 -0
  74. package/src/TapToEdit.test.tsx +8 -14
  75. package/src/TerrenoProvider.test.tsx +3 -4
  76. package/src/Toast.test.tsx +60 -0
  77. package/src/Toast.tsx +46 -1
  78. package/src/ToastNotifications.test.tsx +82 -0
  79. package/src/ToastNotifications.tsx +25 -1
  80. package/src/Tooltip.test.tsx +1 -0
  81. package/src/Unifier.ts +1 -1
  82. package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +0 -3
  83. package/src/__snapshots__/Body.test.tsx.snap +0 -16
  84. package/src/__snapshots__/Box.test.tsx.snap +4 -13
  85. package/src/__snapshots__/Page.test.tsx.snap +0 -84
  86. package/src/__snapshots__/SplitPage.test.tsx.snap +24 -120
  87. package/src/__snapshots__/TapToEdit.test.tsx.snap +5 -16
  88. package/src/__snapshots__/Toast.test.tsx.snap +4 -2
  89. package/src/bunSetup.ts +19 -0
  90. package/src/conflictFieldDiff.test.ts +26 -0
  91. package/src/conflictFieldDiff.ts +78 -0
  92. package/src/index.tsx +5 -2
  93. package/src/login/__snapshots__/LoginScreen.test.tsx.snap +0 -9
  94. package/src/pdfHtmlTemplate.ts +219 -0
  95. package/src/signUp/__snapshots__/OAuthButtons.test.tsx.snap +0 -1
  96. package/src/signUp/__snapshots__/PasswordRequirements.test.tsx.snap +2 -16
  97. package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +1 -17
  98. package/src/signUp/__snapshots__/Swiper.test.tsx.snap +0 -1
  99. package/src/table/__snapshots__/Table.test.tsx.snap +22 -87
  100. package/src/table/__snapshots__/TableHeader.test.tsx.snap +10 -50
  101. package/src/table/__snapshots__/TableHeaderCell.test.tsx.snap +10 -84
  102. package/src/table/__snapshots__/TableRow.test.tsx.snap +12 -77
  103. package/src/useAppLaunchOrForeground.test.tsx +54 -0
  104. package/src/useAppLaunchOrForeground.ts +30 -0
  105. package/dist/ConsentHistory.d.ts +0 -9
  106. package/dist/ConsentHistory.js +0 -70
  107. package/dist/ConsentHistory.js.map +0 -1
  108. package/dist/generateConsentHistoryPdf.d.ts +0 -2
  109. package/dist/generateConsentHistoryPdf.js +0 -185
  110. package/dist/generateConsentHistoryPdf.js.map +0 -1
  111. package/dist/useConsentHistory.d.ts +0 -63
  112. package/dist/useConsentHistory.js +0 -40
  113. package/dist/useConsentHistory.js.map +0 -1
  114. package/src/ConsentHistory.test.tsx +0 -161
  115. package/src/ConsentHistory.tsx +0 -249
  116. package/src/generateConsentHistoryPdf.ts +0 -211
  117. package/src/useConsentHistory.test.ts +0 -106
  118. package/src/useConsentHistory.ts +0 -94
@@ -51,11 +51,11 @@ exports[`TableHeaderCell renders correctly with title 1`] = `
51
51
  },
52
52
  ],
53
53
  "props": {
54
+ "accessibilityHint": "changes sort alphabetical order",
55
+ "accessibilityLabel": "sort",
54
56
  "onPointerEnter": [Function: AsyncFunction],
55
57
  "onPointerLeave": [Function: AsyncFunction],
56
58
  "style": {
57
- "accessibilityHint": "changes sort alphabetical order",
58
- "accessibilityLabel": "sort",
59
59
  "alignItems": "center",
60
60
  "display": "flex",
61
61
  "flexDirection": "row",
@@ -106,11 +106,6 @@ exports[`TableHeaderCell renders correctly with title 1`] = `
106
106
  "style": {
107
107
  "backgroundColor": "#FFFFFF",
108
108
  "borderBottom": "2px solid #e0e0e0",
109
- "dangerouslySetInlineStyle": {
110
- "__style": {
111
- "borderBottom": "2px solid #e0e0e0",
112
- },
113
- },
114
109
  "width": "100%",
115
110
  },
116
111
  "testID": undefined,
@@ -192,11 +187,6 @@ exports[`TableHeaderCell renders correctly with title 1`] = `
192
187
  "style": {
193
188
  "backgroundColor": "#D9D9D9",
194
189
  "borderBottom": "1px solid #e0e0e0",
195
- "dangerouslySetInlineStyle": {
196
- "__style": {
197
- "borderBottom": "1px solid #e0e0e0",
198
- },
199
- },
200
190
  "width": "100%",
201
191
  },
202
192
  "testID": undefined,
@@ -299,11 +289,11 @@ exports[`TableHeaderCell renders correctly with children 1`] = `
299
289
  },
300
290
  ],
301
291
  "props": {
292
+ "accessibilityHint": "changes sort alphabetical order",
293
+ "accessibilityLabel": "sort",
302
294
  "onPointerEnter": [Function: AsyncFunction],
303
295
  "onPointerLeave": [Function: AsyncFunction],
304
296
  "style": {
305
- "accessibilityHint": "changes sort alphabetical order",
306
- "accessibilityLabel": "sort",
307
297
  "alignItems": "center",
308
298
  "display": "flex",
309
299
  "flexDirection": "row",
@@ -354,11 +344,6 @@ exports[`TableHeaderCell renders correctly with children 1`] = `
354
344
  "style": {
355
345
  "backgroundColor": "#FFFFFF",
356
346
  "borderBottom": "2px solid #e0e0e0",
357
- "dangerouslySetInlineStyle": {
358
- "__style": {
359
- "borderBottom": "2px solid #e0e0e0",
360
- },
361
- },
362
347
  "width": "100%",
363
348
  },
364
349
  "testID": undefined,
@@ -440,11 +425,6 @@ exports[`TableHeaderCell renders correctly with children 1`] = `
440
425
  "style": {
441
426
  "backgroundColor": "#D9D9D9",
442
427
  "borderBottom": "1px solid #e0e0e0",
443
- "dangerouslySetInlineStyle": {
444
- "__style": {
445
- "borderBottom": "1px solid #e0e0e0",
446
- },
447
- },
448
428
  "width": "100%",
449
429
  },
450
430
  "testID": undefined,
@@ -546,11 +526,11 @@ exports[`TableHeaderCell renders with left alignment (default) 1`] = `
546
526
  },
547
527
  ],
548
528
  "props": {
529
+ "accessibilityHint": "changes sort alphabetical order",
530
+ "accessibilityLabel": "sort",
549
531
  "onPointerEnter": [Function: AsyncFunction],
550
532
  "onPointerLeave": [Function: AsyncFunction],
551
533
  "style": {
552
- "accessibilityHint": "changes sort alphabetical order",
553
- "accessibilityLabel": "sort",
554
534
  "alignItems": "center",
555
535
  "display": "flex",
556
536
  "flexDirection": "row",
@@ -601,11 +581,6 @@ exports[`TableHeaderCell renders with left alignment (default) 1`] = `
601
581
  "style": {
602
582
  "backgroundColor": "#FFFFFF",
603
583
  "borderBottom": "2px solid #e0e0e0",
604
- "dangerouslySetInlineStyle": {
605
- "__style": {
606
- "borderBottom": "2px solid #e0e0e0",
607
- },
608
- },
609
584
  "width": "100%",
610
585
  },
611
586
  "testID": undefined,
@@ -687,11 +662,6 @@ exports[`TableHeaderCell renders with left alignment (default) 1`] = `
687
662
  "style": {
688
663
  "backgroundColor": "#D9D9D9",
689
664
  "borderBottom": "1px solid #e0e0e0",
690
- "dangerouslySetInlineStyle": {
691
- "__style": {
692
- "borderBottom": "1px solid #e0e0e0",
693
- },
694
- },
695
665
  "width": "100%",
696
666
  },
697
667
  "testID": undefined,
@@ -793,11 +763,11 @@ exports[`TableHeaderCell renders with center alignment 1`] = `
793
763
  },
794
764
  ],
795
765
  "props": {
766
+ "accessibilityHint": "changes sort alphabetical order",
767
+ "accessibilityLabel": "sort",
796
768
  "onPointerEnter": [Function: AsyncFunction],
797
769
  "onPointerLeave": [Function: AsyncFunction],
798
770
  "style": {
799
- "accessibilityHint": "changes sort alphabetical order",
800
- "accessibilityLabel": "sort",
801
771
  "alignItems": "center",
802
772
  "display": "flex",
803
773
  "flexDirection": "row",
@@ -848,11 +818,6 @@ exports[`TableHeaderCell renders with center alignment 1`] = `
848
818
  "style": {
849
819
  "backgroundColor": "#FFFFFF",
850
820
  "borderBottom": "2px solid #e0e0e0",
851
- "dangerouslySetInlineStyle": {
852
- "__style": {
853
- "borderBottom": "2px solid #e0e0e0",
854
- },
855
- },
856
821
  "width": "100%",
857
822
  },
858
823
  "testID": undefined,
@@ -934,11 +899,6 @@ exports[`TableHeaderCell renders with center alignment 1`] = `
934
899
  "style": {
935
900
  "backgroundColor": "#D9D9D9",
936
901
  "borderBottom": "1px solid #e0e0e0",
937
- "dangerouslySetInlineStyle": {
938
- "__style": {
939
- "borderBottom": "1px solid #e0e0e0",
940
- },
941
- },
942
902
  "width": "100%",
943
903
  },
944
904
  "testID": undefined,
@@ -1040,11 +1000,11 @@ exports[`TableHeaderCell renders with right alignment 1`] = `
1040
1000
  },
1041
1001
  ],
1042
1002
  "props": {
1003
+ "accessibilityHint": "changes sort alphabetical order",
1004
+ "accessibilityLabel": "sort",
1043
1005
  "onPointerEnter": [Function: AsyncFunction],
1044
1006
  "onPointerLeave": [Function: AsyncFunction],
1045
1007
  "style": {
1046
- "accessibilityHint": "changes sort alphabetical order",
1047
- "accessibilityLabel": "sort",
1048
1008
  "alignItems": "center",
1049
1009
  "display": "flex",
1050
1010
  "flexDirection": "row",
@@ -1095,11 +1055,6 @@ exports[`TableHeaderCell renders with right alignment 1`] = `
1095
1055
  "style": {
1096
1056
  "backgroundColor": "#FFFFFF",
1097
1057
  "borderBottom": "2px solid #e0e0e0",
1098
- "dangerouslySetInlineStyle": {
1099
- "__style": {
1100
- "borderBottom": "2px solid #e0e0e0",
1101
- },
1102
- },
1103
1058
  "width": "100%",
1104
1059
  },
1105
1060
  "testID": undefined,
@@ -1181,11 +1136,6 @@ exports[`TableHeaderCell renders with right alignment 1`] = `
1181
1136
  "style": {
1182
1137
  "backgroundColor": "#D9D9D9",
1183
1138
  "borderBottom": "1px solid #e0e0e0",
1184
- "dangerouslySetInlineStyle": {
1185
- "__style": {
1186
- "borderBottom": "1px solid #e0e0e0",
1187
- },
1188
- },
1189
1139
  "width": "100%",
1190
1140
  },
1191
1141
  "testID": undefined,
@@ -1295,8 +1245,6 @@ exports[`TableHeaderCell renders sortable header 1`] = `
1295
1245
  "onPointerLeave": [Function: AsyncFunction],
1296
1246
  "onPress": [Function: AsyncFunction],
1297
1247
  "style": {
1298
- "accessibilityHint": "changes sort alphabetical order",
1299
- "accessibilityLabel": "sort",
1300
1248
  "alignItems": "center",
1301
1249
  "display": "flex",
1302
1250
  "flexDirection": "row",
@@ -1347,11 +1295,6 @@ exports[`TableHeaderCell renders sortable header 1`] = `
1347
1295
  "style": {
1348
1296
  "backgroundColor": "#FFFFFF",
1349
1297
  "borderBottom": "2px solid #e0e0e0",
1350
- "dangerouslySetInlineStyle": {
1351
- "__style": {
1352
- "borderBottom": "2px solid #e0e0e0",
1353
- },
1354
- },
1355
1298
  "width": "100%",
1356
1299
  },
1357
1300
  "testID": undefined,
@@ -1433,11 +1376,6 @@ exports[`TableHeaderCell renders sortable header 1`] = `
1433
1376
  "style": {
1434
1377
  "backgroundColor": "#D9D9D9",
1435
1378
  "borderBottom": "1px solid #e0e0e0",
1436
- "dangerouslySetInlineStyle": {
1437
- "__style": {
1438
- "borderBottom": "1px solid #e0e0e0",
1439
- },
1440
- },
1441
1379
  "width": "100%",
1442
1380
  },
1443
1381
  "testID": undefined,
@@ -1581,8 +1519,6 @@ exports[`TableHeaderCell renders sortable header with sort indicator when sorted
1581
1519
  "onPointerLeave": [Function: AsyncFunction],
1582
1520
  "onPress": [Function: AsyncFunction],
1583
1521
  "style": {
1584
- "accessibilityHint": "changes sort alphabetical order",
1585
- "accessibilityLabel": "sort",
1586
1522
  "alignItems": "center",
1587
1523
  "display": "flex",
1588
1524
  "flexDirection": "row",
@@ -1633,11 +1569,6 @@ exports[`TableHeaderCell renders sortable header with sort indicator when sorted
1633
1569
  "style": {
1634
1570
  "backgroundColor": "#FFFFFF",
1635
1571
  "borderBottom": "2px solid #e0e0e0",
1636
- "dangerouslySetInlineStyle": {
1637
- "__style": {
1638
- "borderBottom": "2px solid #e0e0e0",
1639
- },
1640
- },
1641
1572
  "width": "100%",
1642
1573
  },
1643
1574
  "testID": undefined,
@@ -1719,11 +1650,6 @@ exports[`TableHeaderCell renders sortable header with sort indicator when sorted
1719
1650
  "style": {
1720
1651
  "backgroundColor": "#D9D9D9",
1721
1652
  "borderBottom": "1px solid #e0e0e0",
1722
- "dangerouslySetInlineStyle": {
1723
- "__style": {
1724
- "borderBottom": "1px solid #e0e0e0",
1725
- },
1726
- },
1727
1653
  "width": "100%",
1728
1654
  },
1729
1655
  "testID": undefined,
@@ -51,11 +51,11 @@ exports[`TableRow renders correctly with children 1`] = `
51
51
  },
52
52
  ],
53
53
  "props": {
54
+ "accessibilityHint": "changes sort alphabetical order",
55
+ "accessibilityLabel": "sort",
54
56
  "onPointerEnter": [Function: AsyncFunction],
55
57
  "onPointerLeave": [Function: AsyncFunction],
56
58
  "style": {
57
- "accessibilityHint": "changes sort alphabetical order",
58
- "accessibilityLabel": "sort",
59
59
  "alignItems": "center",
60
60
  "display": "flex",
61
61
  "flexDirection": "row",
@@ -116,11 +116,11 @@ exports[`TableRow renders correctly with children 1`] = `
116
116
  },
117
117
  ],
118
118
  "props": {
119
+ "accessibilityHint": "changes sort alphabetical order",
120
+ "accessibilityLabel": "sort",
119
121
  "onPointerEnter": [Function: AsyncFunction],
120
122
  "onPointerLeave": [Function: AsyncFunction],
121
123
  "style": {
122
- "accessibilityHint": "changes sort alphabetical order",
123
- "accessibilityLabel": "sort",
124
124
  "alignItems": "center",
125
125
  "display": "flex",
126
126
  "flexDirection": "row",
@@ -171,11 +171,6 @@ exports[`TableRow renders correctly with children 1`] = `
171
171
  "style": {
172
172
  "backgroundColor": "#FFFFFF",
173
173
  "borderBottom": "2px solid #e0e0e0",
174
- "dangerouslySetInlineStyle": {
175
- "__style": {
176
- "borderBottom": "2px solid #e0e0e0",
177
- },
178
- },
179
174
  "width": "100%",
180
175
  },
181
176
  "testID": undefined,
@@ -292,11 +287,6 @@ exports[`TableRow renders correctly with children 1`] = `
292
287
  "style": {
293
288
  "backgroundColor": "#D9D9D9",
294
289
  "borderBottom": "1px solid #e0e0e0",
295
- "dangerouslySetInlineStyle": {
296
- "__style": {
297
- "borderBottom": "1px solid #e0e0e0",
298
- },
299
- },
300
290
  "width": "100%",
301
291
  },
302
292
  "testID": undefined,
@@ -420,11 +410,6 @@ exports[`TableRow renders header row with thicker border 1`] = `
420
410
  "style": {
421
411
  "backgroundColor": "#FFFFFF",
422
412
  "borderBottom": "2px solid #e0e0e0",
423
- "dangerouslySetInlineStyle": {
424
- "__style": {
425
- "borderBottom": "2px solid #e0e0e0",
426
- },
427
- },
428
413
  "width": "100%",
429
414
  },
430
415
  "testID": undefined,
@@ -494,11 +479,6 @@ exports[`TableRow renders header row with thicker border 1`] = `
494
479
  "style": {
495
480
  "backgroundColor": "#D9D9D9",
496
481
  "borderBottom": "1px solid #e0e0e0",
497
- "dangerouslySetInlineStyle": {
498
- "__style": {
499
- "borderBottom": "1px solid #e0e0e0",
500
- },
501
- },
502
482
  "width": "100%",
503
483
  },
504
484
  "testID": undefined,
@@ -632,11 +612,11 @@ exports[`TableRow renders with drawer contents 1`] = `
632
612
  },
633
613
  ],
634
614
  "props": {
615
+ "accessibilityHint": "changes sort alphabetical order",
616
+ "accessibilityLabel": "sort",
635
617
  "onPointerEnter": [Function: AsyncFunction],
636
618
  "onPointerLeave": [Function: AsyncFunction],
637
619
  "style": {
638
- "accessibilityHint": "changes sort alphabetical order",
639
- "accessibilityLabel": "sort",
640
620
  "alignItems": "center",
641
621
  "display": "flex",
642
622
  "flexDirection": "row",
@@ -687,11 +667,6 @@ exports[`TableRow renders with drawer contents 1`] = `
687
667
  "style": {
688
668
  "backgroundColor": "#FFFFFF",
689
669
  "borderBottom": "2px solid #e0e0e0",
690
- "dangerouslySetInlineStyle": {
691
- "__style": {
692
- "borderBottom": "2px solid #e0e0e0",
693
- },
694
- },
695
670
  "width": "100%",
696
671
  },
697
672
  "testID": undefined,
@@ -791,11 +766,6 @@ exports[`TableRow renders with drawer contents 1`] = `
791
766
  "style": {
792
767
  "backgroundColor": "#D9D9D9",
793
768
  "borderBottom": "1px solid #e0e0e0",
794
- "dangerouslySetInlineStyle": {
795
- "__style": {
796
- "borderBottom": "1px solid #e0e0e0",
797
- },
798
- },
799
769
  "width": "100%",
800
770
  },
801
771
  "testID": undefined,
@@ -929,11 +899,11 @@ exports[`TableRow renders drawer with expand button 1`] = `
929
899
  },
930
900
  ],
931
901
  "props": {
902
+ "accessibilityHint": "changes sort alphabetical order",
903
+ "accessibilityLabel": "sort",
932
904
  "onPointerEnter": [Function: AsyncFunction],
933
905
  "onPointerLeave": [Function: AsyncFunction],
934
906
  "style": {
935
- "accessibilityHint": "changes sort alphabetical order",
936
- "accessibilityLabel": "sort",
937
907
  "alignItems": "center",
938
908
  "display": "flex",
939
909
  "flexDirection": "row",
@@ -984,11 +954,6 @@ exports[`TableRow renders drawer with expand button 1`] = `
984
954
  "style": {
985
955
  "backgroundColor": "#FFFFFF",
986
956
  "borderBottom": "2px solid #e0e0e0",
987
- "dangerouslySetInlineStyle": {
988
- "__style": {
989
- "borderBottom": "2px solid #e0e0e0",
990
- },
991
- },
992
957
  "width": "100%",
993
958
  },
994
959
  "testID": undefined,
@@ -1088,11 +1053,6 @@ exports[`TableRow renders drawer with expand button 1`] = `
1088
1053
  "style": {
1089
1054
  "backgroundColor": "#D9D9D9",
1090
1055
  "borderBottom": "1px solid #e0e0e0",
1091
- "dangerouslySetInlineStyle": {
1092
- "__style": {
1093
- "borderBottom": "1px solid #e0e0e0",
1094
- },
1095
- },
1096
1056
  "width": "100%",
1097
1057
  },
1098
1058
  "testID": undefined,
@@ -1194,11 +1154,11 @@ exports[`TableRow renders with custom color 1`] = `
1194
1154
  },
1195
1155
  ],
1196
1156
  "props": {
1157
+ "accessibilityHint": "changes sort alphabetical order",
1158
+ "accessibilityLabel": "sort",
1197
1159
  "onPointerEnter": [Function: AsyncFunction],
1198
1160
  "onPointerLeave": [Function: AsyncFunction],
1199
1161
  "style": {
1200
- "accessibilityHint": "changes sort alphabetical order",
1201
- "accessibilityLabel": "sort",
1202
1162
  "alignItems": "center",
1203
1163
  "display": "flex",
1204
1164
  "flexDirection": "row",
@@ -1249,11 +1209,6 @@ exports[`TableRow renders with custom color 1`] = `
1249
1209
  "style": {
1250
1210
  "backgroundColor": "#FFFFFF",
1251
1211
  "borderBottom": "2px solid #e0e0e0",
1252
- "dangerouslySetInlineStyle": {
1253
- "__style": {
1254
- "borderBottom": "2px solid #e0e0e0",
1255
- },
1256
- },
1257
1212
  "width": "100%",
1258
1213
  },
1259
1214
  "testID": undefined,
@@ -1335,11 +1290,6 @@ exports[`TableRow renders with custom color 1`] = `
1335
1290
  "style": {
1336
1291
  "backgroundColor": "#D9D9D9",
1337
1292
  "borderBottom": "1px solid #e0e0e0",
1338
- "dangerouslySetInlineStyle": {
1339
- "__style": {
1340
- "borderBottom": "1px solid #e0e0e0",
1341
- },
1342
- },
1343
1293
  "width": "100%",
1344
1294
  },
1345
1295
  "testID": undefined,
@@ -1473,11 +1423,11 @@ exports[`TableRow renders a placeholder cell when sibling row has drawer content
1473
1423
  },
1474
1424
  ],
1475
1425
  "props": {
1426
+ "accessibilityHint": "changes sort alphabetical order",
1427
+ "accessibilityLabel": "sort",
1476
1428
  "onPointerEnter": [Function: AsyncFunction],
1477
1429
  "onPointerLeave": [Function: AsyncFunction],
1478
1430
  "style": {
1479
- "accessibilityHint": "changes sort alphabetical order",
1480
- "accessibilityLabel": "sort",
1481
1431
  "alignItems": "center",
1482
1432
  "display": "flex",
1483
1433
  "flexDirection": "row",
@@ -1528,11 +1478,6 @@ exports[`TableRow renders a placeholder cell when sibling row has drawer content
1528
1478
  "style": {
1529
1479
  "backgroundColor": "#FFFFFF",
1530
1480
  "borderBottom": "2px solid #e0e0e0",
1531
- "dangerouslySetInlineStyle": {
1532
- "__style": {
1533
- "borderBottom": "2px solid #e0e0e0",
1534
- },
1535
- },
1536
1481
  "width": "100%",
1537
1482
  },
1538
1483
  "testID": undefined,
@@ -1632,11 +1577,6 @@ exports[`TableRow renders a placeholder cell when sibling row has drawer content
1632
1577
  "style": {
1633
1578
  "backgroundColor": "#D9D9D9",
1634
1579
  "borderBottom": "1px solid #e0e0e0",
1635
- "dangerouslySetInlineStyle": {
1636
- "__style": {
1637
- "borderBottom": "1px solid #e0e0e0",
1638
- },
1639
- },
1640
1580
  "width": "100%",
1641
1581
  },
1642
1582
  "testID": undefined,
@@ -1738,11 +1678,6 @@ exports[`TableRow renders a placeholder cell when sibling row has drawer content
1738
1678
  "style": {
1739
1679
  "backgroundColor": "#FFFFFF",
1740
1680
  "borderBottom": "1px solid #e0e0e0",
1741
- "dangerouslySetInlineStyle": {
1742
- "__style": {
1743
- "borderBottom": "1px solid #e0e0e0",
1744
- },
1745
- },
1746
1681
  "width": "100%",
1747
1682
  },
1748
1683
  "testID": undefined,
@@ -0,0 +1,54 @@
1
+ import {beforeEach, describe, expect, it, mock} from "bun:test";
2
+ import {renderHook} from "@testing-library/react-native";
3
+ import {AppState, type AppStateStatus} from "react-native";
4
+
5
+ import {useAppLaunchOrForeground} from "./useAppLaunchOrForeground";
6
+
7
+ describe("useAppLaunchOrForeground", () => {
8
+ let changeListener: ((state: AppStateStatus) => void) | undefined;
9
+ let removeMock: ReturnType<typeof mock>;
10
+
11
+ beforeEach(() => {
12
+ changeListener = undefined;
13
+ removeMock = mock(() => {});
14
+ // Capture the registered listener so we can simulate foreground transitions.
15
+ AppState.addEventListener = mock(
16
+ (_event: string, listener: (state: AppStateStatus) => void) => {
17
+ changeListener = listener;
18
+ return {remove: removeMock} as unknown as ReturnType<typeof AppState.addEventListener>;
19
+ }
20
+ ) as unknown as typeof AppState.addEventListener;
21
+ });
22
+
23
+ it("invokes the callback once on mount (app launch)", () => {
24
+ const onForeground = mock(() => {});
25
+ renderHook(() => useAppLaunchOrForeground(onForeground));
26
+
27
+ expect(onForeground).toHaveBeenCalledTimes(1);
28
+ });
29
+
30
+ it("invokes the callback again when the app returns to the foreground", () => {
31
+ const onForeground = mock(() => {});
32
+ renderHook(() => useAppLaunchOrForeground(onForeground));
33
+
34
+ changeListener?.("active");
35
+ expect(onForeground).toHaveBeenCalledTimes(2);
36
+ });
37
+
38
+ it("does not invoke the callback for non-active state changes", () => {
39
+ const onForeground = mock(() => {});
40
+ renderHook(() => useAppLaunchOrForeground(onForeground));
41
+
42
+ changeListener?.("background");
43
+ changeListener?.("inactive");
44
+ expect(onForeground).toHaveBeenCalledTimes(1);
45
+ });
46
+
47
+ it("removes the AppState subscription on unmount", () => {
48
+ const onForeground = mock(() => {});
49
+ const {unmount} = renderHook(() => useAppLaunchOrForeground(onForeground));
50
+
51
+ unmount();
52
+ expect(removeMock).toHaveBeenCalledTimes(1);
53
+ });
54
+ });
@@ -0,0 +1,30 @@
1
+ import {useEffect} from "react";
2
+ import {AppState, type AppStateStatus} from "react-native";
3
+
4
+ /**
5
+ * Runs `onAppForeground` once on mount (app launch) and again every time the app returns to the
6
+ * foreground (AppState transitions to "active"). Useful for refetching data, revalidating auth, or
7
+ * kicking off a sync when the user comes back to the app.
8
+ *
9
+ * The callback is a dependency of the effect, so wrap it in `useCallback` in the caller to avoid
10
+ * re-subscribing on every render.
11
+ */
12
+ export const useAppLaunchOrForeground = (onAppForeground: () => void): void => {
13
+ // Run on app launch or whenever the app returns to the foreground.
14
+ useEffect(() => {
15
+ // Runs on app launch (mount).
16
+ onAppForeground();
17
+
18
+ const handleAppStateChange = (nextAppState: AppStateStatus): void => {
19
+ if (nextAppState === "active") {
20
+ onAppForeground();
21
+ }
22
+ };
23
+
24
+ const subscription = AppState.addEventListener("change", handleAppStateChange);
25
+
26
+ return (): void => {
27
+ subscription.remove();
28
+ };
29
+ }, [onAppForeground]);
30
+ };
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import { useConsentHistory } from "./useConsentHistory";
3
- interface ConsentHistoryProps {
4
- api: Parameters<typeof useConsentHistory>[0];
5
- baseUrl?: string;
6
- title?: string;
7
- }
8
- export declare const ConsentHistory: React.FC<ConsentHistoryProps>;
9
- export {};
@@ -1,70 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { DateTime } from "luxon";
3
- import { useCallback, useState } from "react";
4
- import { Image, Pressable } from "react-native";
5
- import { Badge } from "./Badge";
6
- import { Box } from "./Box";
7
- import { Button } from "./Button";
8
- import { Card } from "./Card";
9
- import { generateConsentHistoryPdf } from "./generateConsentHistoryPdf";
10
- import { Icon } from "./Icon";
11
- import { IconButton } from "./IconButton";
12
- import { MarkdownView } from "./MarkdownView";
13
- import { Page } from "./Page";
14
- import { Spinner } from "./Spinner";
15
- import { Text } from "./Text";
16
- import { useConsentHistory } from "./useConsentHistory";
17
- const formatDate = (value) => {
18
- if (!value) {
19
- return "";
20
- }
21
- const dt = DateTime.fromISO(String(value));
22
- if (!dt.isValid) {
23
- return String(value);
24
- }
25
- return dt.toLocaleString(DateTime.DATETIME_MED);
26
- };
27
- const ConsentHistoryItem = ({ entry }) => {
28
- var _a, _b, _c, _d, _e;
29
- const [expanded, setExpanded] = useState(false);
30
- const [isDownloading, setIsDownloading] = useState(false);
31
- const toggle = useCallback(() => {
32
- setExpanded((prev) => !prev);
33
- }, []);
34
- const handleDownload = useCallback(async () => {
35
- setIsDownloading(true);
36
- try {
37
- await generateConsentHistoryPdf(entry);
38
- }
39
- catch (err) {
40
- console.error("Failed to generate PDF", err);
41
- }
42
- finally {
43
- setIsDownloading(false);
44
- }
45
- }, [entry]);
46
- const formTitle = (_b = (_a = entry.form) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : "Unknown Form";
47
- const formType = (_d = (_c = entry.form) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : "";
48
- const checkboxEntries = entry.checkboxValues && typeof entry.checkboxValues === "object"
49
- ? Object.entries(entry.checkboxValues)
50
- : [];
51
- return (_jsxs(Card, { padding: 0, testID: `consent-history-item-${entry._id}`, children: [_jsx(Pressable, { onPress: toggle, testID: `consent-history-item-toggle-${entry._id}`, children: _jsxs(Box, { direction: "row", gap: 3, padding: 4, children: [_jsxs(Box, { flex: "grow", gap: 1, children: [_jsxs(Box, { alignItems: "center", direction: "row", gap: 2, children: [_jsx(Text, { bold: true, size: "md", children: formTitle }), formType ? _jsx(Badge, { status: "neutral", value: formType }) : null] }), _jsxs(Box, { alignItems: "center", direction: "row", gap: 2, children: [_jsx(Badge, { status: entry.agreed ? "success" : "error", value: entry.agreed ? "Agreed" : "Declined" }), _jsx(Text, { color: "secondaryDark", size: "sm", children: formatDate(entry.agreedAt) })] })] }), _jsx(Box, { alignItems: "center", justifyContent: "center", children: _jsx(Icon, { color: "secondaryDark", iconName: expanded ? "chevron-up" : "chevron-down", size: "sm" }) })] }) }), expanded && (_jsxs(Box, { gap: 3, padding: 4, testID: `consent-history-item-details-${entry._id}`, children: [_jsxs(Box, { alignItems: "center", direction: "row", justifyContent: "between", children: [_jsx(Box, { color: "disabled", flex: "grow", height: 1 }), _jsx(Box, { marginLeft: 2, children: _jsx(IconButton, { accessibilityLabel: "Download PDF", iconName: "download", loading: isDownloading, onClick: handleDownload, testID: `consent-history-download-${entry._id}`, tooltipText: "Download PDF" }) })] }), ((_e = entry.form) === null || _e === void 0 ? void 0 : _e.version) !== undefined && (_jsxs(Box, { alignItems: "center", direction: "row", gap: 2, children: [_jsx(Text, { color: "secondaryDark", size: "sm", children: "Version:" }), _jsx(Text, { size: "sm", children: entry.form.version })] })), entry.locale && (_jsxs(Box, { alignItems: "center", direction: "row", gap: 2, children: [_jsx(Text, { color: "secondaryDark", size: "sm", children: "Locale:" }), _jsx(Text, { size: "sm", children: entry.locale })] })), entry.signedAt && (_jsxs(Box, { alignItems: "center", direction: "row", gap: 2, children: [_jsx(Text, { color: "secondaryDark", size: "sm", children: "Signed:" }), _jsx(Text, { size: "sm", children: formatDate(entry.signedAt) })] })), entry.ipAddress && (_jsxs(Box, { alignItems: "center", direction: "row", gap: 2, children: [_jsx(Text, { color: "secondaryDark", size: "sm", children: "IP Address:" }), _jsx(Text, { size: "sm", children: entry.ipAddress })] })), checkboxEntries.length > 0 && (_jsxs(Box, { gap: 2, children: [_jsx(Text, { bold: true, color: "secondaryDark", size: "sm", children: "Checkboxes" }), checkboxEntries.map(([index, checked]) => {
52
- var _a, _b, _c;
53
- const label = (_c = (_b = (_a = entry.form) === null || _a === void 0 ? void 0 : _a.checkboxes) === null || _b === void 0 ? void 0 : _b[Number(index)]) === null || _c === void 0 ? void 0 : _c.label;
54
- return (_jsxs(Box, { alignItems: "center", direction: "row", gap: 2, children: [_jsx(Badge, { status: checked ? "success" : "neutral", value: checked ? "Yes" : "No" }), _jsx(Text, { size: "sm", children: label !== null && label !== void 0 ? label : `Checkbox ${index}` })] }, index));
55
- })] })), entry.signature && (_jsxs(Box, { gap: 2, children: [_jsx(Text, { bold: true, color: "secondaryDark", size: "sm", children: "Signature" }), _jsx(Box, { border: "default", padding: 2, rounding: "sm", children: _jsx(Image, { accessibilityLabel: "Your signature", accessible: true, resizeMode: "contain", source: { uri: entry.signature }, style: { height: 80, width: "100%" }, testID: `consent-history-signature-${entry._id}` }) })] })), entry.contentSnapshot && (_jsxs(Box, { gap: 2, children: [_jsx(Text, { bold: true, color: "secondaryDark", size: "sm", children: "Form Content" }), _jsx(Box, { border: "default", padding: 3, rounding: "sm", children: _jsx(MarkdownView, { children: entry.contentSnapshot }) })] }))] }))] }));
56
- };
57
- export const ConsentHistory = ({ api, baseUrl, title = "My Consents", }) => {
58
- const { entries, isLoading, error, refetch } = useConsentHistory(api, baseUrl);
59
- if (isLoading) {
60
- return (_jsx(Page, { maxWidth: 800, title: title, children: _jsx(Box, { alignItems: "center", justifyContent: "center", padding: 6, children: _jsx(Spinner, {}) }) }));
61
- }
62
- if (error) {
63
- return (_jsx(Page, { maxWidth: 800, title: title, children: _jsxs(Box, { alignItems: "center", direction: "column", gap: 3, padding: 6, children: [_jsx(Text, { color: "error", size: "lg", children: "Failed to load consent history" }), _jsx(Button, { onClick: refetch, text: "Retry" })] }) }));
64
- }
65
- if (entries.length === 0) {
66
- return (_jsx(Page, { maxWidth: 800, title: title, children: _jsx(Box, { alignItems: "center", padding: 6, children: _jsx(Text, { color: "secondaryDark", children: "No consent records found." }) }) }));
67
- }
68
- return (_jsx(Page, { maxWidth: 800, scroll: true, title: title, children: _jsx(Box, { gap: 3, padding: 4, testID: "consent-history-list", children: entries.map((entry) => (_jsx(ConsentHistoryItem, { entry: entry }, entry._id))) }) }));
69
- };
70
- //# sourceMappingURL=ConsentHistory.js.map