@terreno/ui 0.13.0 → 0.14.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.
- package/dist/ActionSheet.d.ts +4 -4
- package/dist/ActionSheet.js.map +1 -1
- package/dist/Avatar.js +1 -1
- package/dist/Avatar.js.map +1 -1
- package/dist/Banner.js.map +1 -1
- package/dist/Box.js +2 -0
- package/dist/Box.js.map +1 -1
- package/dist/Button.d.ts +2 -2
- package/dist/Button.js +35 -23
- package/dist/Button.js.map +1 -1
- package/dist/Common.d.ts +8 -2
- package/dist/Common.js.map +1 -1
- package/dist/ConsentFormScreen.js +9 -8
- package/dist/ConsentFormScreen.js.map +1 -1
- package/dist/ConsentNavigator.d.ts +1 -1
- package/dist/ConsentNavigator.js +2 -1
- package/dist/ConsentNavigator.js.map +1 -1
- package/dist/CustomSelectField.js +3 -1
- package/dist/CustomSelectField.js.map +1 -1
- package/dist/DataTable.js +1 -1
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeActionSheet.js +2 -1
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/DateTimeField.js +3 -2
- package/dist/DateTimeField.js.map +1 -1
- package/dist/DateUtilities.js.map +1 -1
- package/dist/HeightField.js.map +1 -1
- package/dist/Hyperlink.js +19 -9
- package/dist/Hyperlink.js.map +1 -1
- package/dist/IconButton.js.map +1 -1
- package/dist/ImageBackground.d.ts +2 -5
- package/dist/ImageBackground.js +1 -1
- package/dist/ImageBackground.js.map +1 -1
- package/dist/ModalSheet.d.ts +3 -2
- package/dist/ModalSheet.js +1 -1
- package/dist/ModalSheet.js.map +1 -1
- package/dist/OfflineBanner.d.ts +21 -0
- package/dist/OfflineBanner.js +25 -0
- package/dist/OfflineBanner.js.map +1 -0
- package/dist/OpenAPIContext.js +1 -1
- package/dist/OpenAPIContext.js.map +1 -1
- package/dist/Page.js +1 -0
- package/dist/Page.js.map +1 -1
- package/dist/Pagination.js.map +1 -1
- package/dist/Permissions.js +3 -0
- package/dist/Permissions.js.map +1 -1
- package/dist/PickerSelect.d.ts +22 -10
- package/dist/PickerSelect.js +14 -9
- package/dist/PickerSelect.js.map +1 -1
- package/dist/SelectBadge.js +11 -1
- package/dist/SelectBadge.js.map +1 -1
- package/dist/SelectField.js +3 -3
- package/dist/SelectField.js.map +1 -1
- package/dist/SidebarNavigation.native.js.map +1 -1
- package/dist/Signature.js +4 -0
- package/dist/Signature.js.map +1 -1
- package/dist/Signature.native.js +4 -0
- package/dist/Signature.native.js.map +1 -1
- package/dist/SplitPage.js +7 -2
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +4 -1
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TapToEdit.js +10 -11
- package/dist/TapToEdit.js.map +1 -1
- package/dist/Theme.d.ts +1 -1
- package/dist/Theme.js.map +1 -1
- package/dist/Toast.js.map +1 -1
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Unifier.d.ts +2 -2
- package/dist/Unifier.js +1 -1
- package/dist/Unifier.js.map +1 -1
- package/dist/Utilities.d.ts +8 -4
- package/dist/Utilities.js +1 -1
- package/dist/Utilities.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/useConsentForms.d.ts +4 -3
- package/dist/useConsentForms.js +26 -4
- package/dist/useConsentForms.js.map +1 -1
- package/dist/useConsentHistory.d.ts +4 -3
- package/dist/useConsentHistory.js +26 -4
- package/dist/useConsentHistory.js.map +1 -1
- package/dist/useSubmitConsent.d.ts +7 -6
- package/dist/useSubmitConsent.js +25 -3
- package/dist/useSubmitConsent.js.map +1 -1
- package/package.json +2 -1
- package/src/ActionSheet.test.tsx +1 -0
- package/src/ActionSheet.tsx +6 -4
- package/src/Avatar.tsx +9 -2
- package/src/Badge.test.tsx +1 -0
- package/src/Banner.tsx +1 -1
- package/src/Box.test.tsx +1 -0
- package/src/Box.tsx +10 -6
- package/src/Button.test.tsx +35 -0
- package/src/Button.tsx +65 -34
- package/src/Common.ts +32 -15
- package/src/ConsentFormScreen.test.tsx +149 -0
- package/src/ConsentFormScreen.tsx +20 -3
- package/src/ConsentNavigator.test.tsx +1 -0
- package/src/ConsentNavigator.tsx +5 -3
- package/src/CustomSelectField.tsx +3 -1
- package/src/DataTable.test.tsx +1 -0
- package/src/DataTable.tsx +1 -1
- package/src/DateTimeActionSheet.tsx +7 -3
- package/src/DateTimeField.test.tsx +1 -0
- package/src/DateTimeField.tsx +3 -2
- package/src/DateUtilities.test.ts +111 -0
- package/src/DateUtilities.tsx +6 -6
- package/src/DecimalRangeActionSheet.test.tsx +28 -0
- package/src/ErrorBoundary.test.tsx +1 -0
- package/src/HeightField.test.tsx +68 -0
- package/src/HeightField.tsx +2 -1
- package/src/Hyperlink.tsx +83 -52
- package/src/IconButton.tsx +1 -1
- package/src/ImageBackground.tsx +5 -6
- package/src/Modal.tsx +2 -2
- package/src/ModalSheet.test.tsx +1 -5
- package/src/ModalSheet.tsx +15 -6
- package/src/NumberField.test.tsx +14 -0
- package/src/OfflineBanner.test.tsx +70 -0
- package/src/OfflineBanner.tsx +54 -0
- package/src/OpenAPIContext.tsx +3 -2
- package/src/Page.tsx +1 -0
- package/src/Pagination.tsx +1 -1
- package/src/Permissions.ts +3 -0
- package/src/PickerSelect.tsx +48 -31
- package/src/SelectBadge.test.tsx +1 -0
- package/src/SelectBadge.tsx +7 -3
- package/src/SelectField.tsx +3 -3
- package/src/SidebarNavigation.native.tsx +6 -2
- package/src/Signature.native.tsx +4 -0
- package/src/Signature.test.tsx +11 -0
- package/src/Signature.tsx +4 -0
- package/src/SplitPage.native.tsx +2 -0
- package/src/SplitPage.tsx +6 -1
- package/src/TapToEdit.test.tsx +17 -0
- package/src/TapToEdit.tsx +11 -11
- package/src/Theme.tsx +17 -14
- package/src/Toast.tsx +1 -1
- package/src/ToastNotifications.tsx +1 -4
- package/src/Tooltip.test.tsx +40 -28
- package/src/Unifier.ts +6 -5
- package/src/Utilities.tsx +9 -6
- package/src/__snapshots__/AddressField.test.tsx.snap +3 -2
- package/src/__snapshots__/Button.test.tsx.snap +92 -50
- package/src/__snapshots__/CustomSelectField.test.tsx.snap +21 -14
- package/src/__snapshots__/DecimalRangeActionSheet.test.tsx.snap +14 -8
- package/src/__snapshots__/ErrorPage.test.tsx.snap +7 -4
- package/src/__snapshots__/Field.test.tsx.snap +18 -12
- package/src/__snapshots__/HeightActionSheet.test.tsx.snap +14 -8
- package/src/__snapshots__/HeightField.test.tsx.snap +35 -20
- package/src/__snapshots__/InfoModalIcon.test.tsx.snap +28 -16
- package/src/__snapshots__/Modal.test.tsx.snap +19 -10
- package/src/__snapshots__/ModalSheet.test.tsx.snap +0 -1
- package/src/__snapshots__/NumberPickerActionSheet.test.tsx.snap +14 -8
- package/src/__snapshots__/Page.test.tsx.snap +7 -4
- package/src/__snapshots__/PickerSelect.test.tsx.snap +0 -7
- package/src/__snapshots__/SelectField.test.tsx.snap +18 -12
- package/src/__snapshots__/TerrenoProvider.test.tsx.snap +2 -18
- package/src/__snapshots__/TimezonePicker.test.tsx.snap +18 -12
- package/src/bunSetup.ts +45 -0
- package/src/index.tsx +1 -0
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +15 -6
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +10 -4
- package/src/table/__snapshots__/TableBadge.test.tsx.snap +3 -2
- package/src/types/react-native-swiper-flatlist.d.ts +1 -0
- package/src/useConsentForms.test.ts +25 -0
- package/src/useConsentForms.ts +32 -7
- package/src/useConsentHistory.test.ts +99 -0
- package/src/useConsentHistory.ts +31 -6
- package/src/useSubmitConsent.test.ts +24 -0
- package/src/useSubmitConsent.ts +35 -10
|
@@ -168,9 +168,12 @@ exports[`NumberPickerActionSheet renders correctly 1`] = `
|
|
|
168
168
|
],
|
|
169
169
|
"props": {
|
|
170
170
|
"accessibilityHint": "Press to perform action",
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
171
|
+
"accessibilityLabel": "Close",
|
|
172
|
+
"accessibilityRole": "button",
|
|
173
|
+
"accessibilityState": {
|
|
174
|
+
"disabled": false,
|
|
175
|
+
},
|
|
176
|
+
"disabled": false,
|
|
174
177
|
"onPress": [Function: debounced],
|
|
175
178
|
"style": {
|
|
176
179
|
"alignItems": "center",
|
|
@@ -187,7 +190,7 @@ exports[`NumberPickerActionSheet renders correctly 1`] = `
|
|
|
187
190
|
},
|
|
188
191
|
"testID": undefined,
|
|
189
192
|
},
|
|
190
|
-
"type": "
|
|
193
|
+
"type": "PressableScale",
|
|
191
194
|
},
|
|
192
195
|
],
|
|
193
196
|
"props": {
|
|
@@ -1497,9 +1500,12 @@ exports[`NumberPickerActionSheet renders with different range 1`] = `
|
|
|
1497
1500
|
],
|
|
1498
1501
|
"props": {
|
|
1499
1502
|
"accessibilityHint": "Press to perform action",
|
|
1500
|
-
"
|
|
1501
|
-
"
|
|
1502
|
-
"
|
|
1503
|
+
"accessibilityLabel": "Close",
|
|
1504
|
+
"accessibilityRole": "button",
|
|
1505
|
+
"accessibilityState": {
|
|
1506
|
+
"disabled": false,
|
|
1507
|
+
},
|
|
1508
|
+
"disabled": false,
|
|
1503
1509
|
"onPress": [Function: debounced],
|
|
1504
1510
|
"style": {
|
|
1505
1511
|
"alignItems": "center",
|
|
@@ -1516,7 +1522,7 @@ exports[`NumberPickerActionSheet renders with different range 1`] = `
|
|
|
1516
1522
|
},
|
|
1517
1523
|
"testID": undefined,
|
|
1518
1524
|
},
|
|
1519
|
-
"type": "
|
|
1525
|
+
"type": "PressableScale",
|
|
1520
1526
|
},
|
|
1521
1527
|
],
|
|
1522
1528
|
"props": {
|
|
@@ -812,9 +812,12 @@ exports[`Page renders with right button 1`] = `
|
|
|
812
812
|
],
|
|
813
813
|
"props": {
|
|
814
814
|
"accessibilityHint": "Press to perform action",
|
|
815
|
-
"
|
|
816
|
-
"
|
|
817
|
-
"
|
|
815
|
+
"accessibilityLabel": "Save",
|
|
816
|
+
"accessibilityRole": "button",
|
|
817
|
+
"accessibilityState": {
|
|
818
|
+
"disabled": false,
|
|
819
|
+
},
|
|
820
|
+
"disabled": false,
|
|
818
821
|
"onPress": [Function: debounced],
|
|
819
822
|
"style": {
|
|
820
823
|
"alignItems": "center",
|
|
@@ -831,7 +834,7 @@ exports[`Page renders with right button 1`] = `
|
|
|
831
834
|
},
|
|
832
835
|
"testID": undefined,
|
|
833
836
|
},
|
|
834
|
-
"type": "
|
|
837
|
+
"type": "PressableScale",
|
|
835
838
|
},
|
|
836
839
|
],
|
|
837
840
|
"props": {
|
|
@@ -48,7 +48,6 @@ exports[`PickerSelect renders correctly with default props 1`] = `
|
|
|
48
48
|
},
|
|
49
49
|
],
|
|
50
50
|
"props": {
|
|
51
|
-
"activeOpacity": 1,
|
|
52
51
|
"onPress": [Function],
|
|
53
52
|
"style": {
|
|
54
53
|
"alignItems": "center",
|
|
@@ -313,7 +312,6 @@ exports[`PickerSelect renders with selected value 1`] = `
|
|
|
313
312
|
},
|
|
314
313
|
],
|
|
315
314
|
"props": {
|
|
316
|
-
"activeOpacity": 1,
|
|
317
315
|
"onPress": [Function],
|
|
318
316
|
"style": {
|
|
319
317
|
"alignItems": "center",
|
|
@@ -578,7 +576,6 @@ exports[`PickerSelect renders disabled state 1`] = `
|
|
|
578
576
|
},
|
|
579
577
|
],
|
|
580
578
|
"props": {
|
|
581
|
-
"activeOpacity": 1,
|
|
582
579
|
"onPress": [Function],
|
|
583
580
|
"style": {
|
|
584
581
|
"alignItems": "center",
|
|
@@ -845,7 +842,6 @@ exports[`PickerSelect renders without placeholder when placeholder is empty obje
|
|
|
845
842
|
},
|
|
846
843
|
],
|
|
847
844
|
"props": {
|
|
848
|
-
"activeOpacity": 1,
|
|
849
845
|
"onPress": [Function],
|
|
850
846
|
"style": {
|
|
851
847
|
"alignItems": "center",
|
|
@@ -1100,7 +1096,6 @@ exports[`PickerSelect matches items by itemKey 1`] = `
|
|
|
1100
1096
|
},
|
|
1101
1097
|
],
|
|
1102
1098
|
"props": {
|
|
1103
|
-
"activeOpacity": 1,
|
|
1104
1099
|
"onPress": [Function],
|
|
1105
1100
|
"style": {
|
|
1106
1101
|
"alignItems": "center",
|
|
@@ -1355,7 +1350,6 @@ exports[`PickerSelect renders custom InputAccessoryView 1`] = `
|
|
|
1355
1350
|
},
|
|
1356
1351
|
],
|
|
1357
1352
|
"props": {
|
|
1358
|
-
"activeOpacity": 1,
|
|
1359
1353
|
"onPress": [Function],
|
|
1360
1354
|
"style": {
|
|
1361
1355
|
"alignItems": "center",
|
|
@@ -1541,7 +1535,6 @@ exports[`PickerSelect passes textInputProps to TextInput 1`] = `
|
|
|
1541
1535
|
},
|
|
1542
1536
|
],
|
|
1543
1537
|
"props": {
|
|
1544
|
-
"activeOpacity": 1,
|
|
1545
1538
|
"onPress": [Function],
|
|
1546
1539
|
"style": {
|
|
1547
1540
|
"alignItems": "center",
|
|
@@ -51,7 +51,6 @@ exports[`SelectField renders correctly with default props 1`] = `
|
|
|
51
51
|
},
|
|
52
52
|
],
|
|
53
53
|
"props": {
|
|
54
|
-
"activeOpacity": 1,
|
|
55
54
|
"onPress": [Function],
|
|
56
55
|
"style": {
|
|
57
56
|
"alignItems": "center",
|
|
@@ -268,7 +267,9 @@ exports[`SelectField renders correctly with default props 1`] = `
|
|
|
268
267
|
},
|
|
269
268
|
],
|
|
270
269
|
"props": {
|
|
271
|
-
"style":
|
|
270
|
+
"style": {
|
|
271
|
+
"width": "100%",
|
|
272
|
+
},
|
|
272
273
|
"testID": undefined,
|
|
273
274
|
},
|
|
274
275
|
"type": "View",
|
|
@@ -341,7 +342,6 @@ exports[`SelectField renders with title 1`] = `
|
|
|
341
342
|
},
|
|
342
343
|
],
|
|
343
344
|
"props": {
|
|
344
|
-
"activeOpacity": 1,
|
|
345
345
|
"onPress": [Function],
|
|
346
346
|
"style": {
|
|
347
347
|
"alignItems": "center",
|
|
@@ -558,7 +558,9 @@ exports[`SelectField renders with title 1`] = `
|
|
|
558
558
|
},
|
|
559
559
|
],
|
|
560
560
|
"props": {
|
|
561
|
-
"style":
|
|
561
|
+
"style": {
|
|
562
|
+
"width": "100%",
|
|
563
|
+
},
|
|
562
564
|
"testID": undefined,
|
|
563
565
|
},
|
|
564
566
|
"type": "View",
|
|
@@ -616,7 +618,6 @@ exports[`SelectField renders with selected value 1`] = `
|
|
|
616
618
|
},
|
|
617
619
|
],
|
|
618
620
|
"props": {
|
|
619
|
-
"activeOpacity": 1,
|
|
620
621
|
"onPress": [Function],
|
|
621
622
|
"style": {
|
|
622
623
|
"alignItems": "center",
|
|
@@ -833,7 +834,9 @@ exports[`SelectField renders with selected value 1`] = `
|
|
|
833
834
|
},
|
|
834
835
|
],
|
|
835
836
|
"props": {
|
|
836
|
-
"style":
|
|
837
|
+
"style": {
|
|
838
|
+
"width": "100%",
|
|
839
|
+
},
|
|
837
840
|
"testID": undefined,
|
|
838
841
|
},
|
|
839
842
|
"type": "View",
|
|
@@ -891,7 +894,6 @@ exports[`SelectField renders with custom placeholder 1`] = `
|
|
|
891
894
|
},
|
|
892
895
|
],
|
|
893
896
|
"props": {
|
|
894
|
-
"activeOpacity": 1,
|
|
895
897
|
"onPress": [Function],
|
|
896
898
|
"style": {
|
|
897
899
|
"alignItems": "center",
|
|
@@ -1108,7 +1110,9 @@ exports[`SelectField renders with custom placeholder 1`] = `
|
|
|
1108
1110
|
},
|
|
1109
1111
|
],
|
|
1110
1112
|
"props": {
|
|
1111
|
-
"style":
|
|
1113
|
+
"style": {
|
|
1114
|
+
"width": "100%",
|
|
1115
|
+
},
|
|
1112
1116
|
"testID": undefined,
|
|
1113
1117
|
},
|
|
1114
1118
|
"type": "View",
|
|
@@ -1166,7 +1170,6 @@ exports[`SelectField renders disabled state 1`] = `
|
|
|
1166
1170
|
},
|
|
1167
1171
|
],
|
|
1168
1172
|
"props": {
|
|
1169
|
-
"activeOpacity": 1,
|
|
1170
1173
|
"onPress": [Function],
|
|
1171
1174
|
"style": {
|
|
1172
1175
|
"alignItems": "center",
|
|
@@ -1385,7 +1388,9 @@ exports[`SelectField renders disabled state 1`] = `
|
|
|
1385
1388
|
},
|
|
1386
1389
|
],
|
|
1387
1390
|
"props": {
|
|
1388
|
-
"style":
|
|
1391
|
+
"style": {
|
|
1392
|
+
"width": "100%",
|
|
1393
|
+
},
|
|
1389
1394
|
"testID": undefined,
|
|
1390
1395
|
},
|
|
1391
1396
|
"type": "View",
|
|
@@ -1443,7 +1448,6 @@ exports[`SelectField renders with requireValue (no clear option) 1`] = `
|
|
|
1443
1448
|
},
|
|
1444
1449
|
],
|
|
1445
1450
|
"props": {
|
|
1446
|
-
"activeOpacity": 1,
|
|
1447
1451
|
"onPress": [Function],
|
|
1448
1452
|
"style": {
|
|
1449
1453
|
"alignItems": "center",
|
|
@@ -1650,7 +1654,9 @@ exports[`SelectField renders with requireValue (no clear option) 1`] = `
|
|
|
1650
1654
|
},
|
|
1651
1655
|
],
|
|
1652
1656
|
"props": {
|
|
1653
|
-
"style":
|
|
1657
|
+
"style": {
|
|
1658
|
+
"width": "100%",
|
|
1659
|
+
},
|
|
1654
1660
|
"testID": undefined,
|
|
1655
1661
|
},
|
|
1656
1662
|
"type": "View",
|
|
@@ -27,15 +27,7 @@ exports[`TerrenoProvider renders correctly with default props 1`] = `
|
|
|
27
27
|
},
|
|
28
28
|
],
|
|
29
29
|
"props": {
|
|
30
|
-
"
|
|
31
|
-
"pointerEvents": "box-none",
|
|
32
|
-
"style": [
|
|
33
|
-
{
|
|
34
|
-
"flex": 1,
|
|
35
|
-
},
|
|
36
|
-
undefined,
|
|
37
|
-
],
|
|
38
|
-
"testID": undefined,
|
|
30
|
+
"testID": "portal-host",
|
|
39
31
|
},
|
|
40
32
|
"type": "View",
|
|
41
33
|
},
|
|
@@ -123,15 +115,7 @@ exports[`TerrenoProvider renders with openAPISpecUrl 1`] = `
|
|
|
123
115
|
},
|
|
124
116
|
],
|
|
125
117
|
"props": {
|
|
126
|
-
"
|
|
127
|
-
"pointerEvents": "box-none",
|
|
128
|
-
"style": [
|
|
129
|
-
{
|
|
130
|
-
"flex": 1,
|
|
131
|
-
},
|
|
132
|
-
undefined,
|
|
133
|
-
],
|
|
134
|
-
"testID": undefined,
|
|
118
|
+
"testID": "portal-host",
|
|
135
119
|
},
|
|
136
120
|
"type": "View",
|
|
137
121
|
},
|
|
@@ -66,7 +66,6 @@ exports[`TimezonePicker renders correctly with default props 1`] = `
|
|
|
66
66
|
},
|
|
67
67
|
],
|
|
68
68
|
"props": {
|
|
69
|
-
"activeOpacity": 1,
|
|
70
69
|
"onPress": [Function],
|
|
71
70
|
"style": {
|
|
72
71
|
"alignItems": "center",
|
|
@@ -323,7 +322,9 @@ exports[`TimezonePicker renders correctly with default props 1`] = `
|
|
|
323
322
|
},
|
|
324
323
|
],
|
|
325
324
|
"props": {
|
|
326
|
-
"style":
|
|
325
|
+
"style": {
|
|
326
|
+
"width": "100%",
|
|
327
|
+
},
|
|
327
328
|
"testID": undefined,
|
|
328
329
|
},
|
|
329
330
|
"type": "View",
|
|
@@ -381,7 +382,6 @@ exports[`TimezonePicker hides title when hideTitle is true 1`] = `
|
|
|
381
382
|
},
|
|
382
383
|
],
|
|
383
384
|
"props": {
|
|
384
|
-
"activeOpacity": 1,
|
|
385
385
|
"onPress": [Function],
|
|
386
386
|
"style": {
|
|
387
387
|
"alignItems": "center",
|
|
@@ -638,7 +638,9 @@ exports[`TimezonePicker hides title when hideTitle is true 1`] = `
|
|
|
638
638
|
},
|
|
639
639
|
],
|
|
640
640
|
"props": {
|
|
641
|
-
"style":
|
|
641
|
+
"style": {
|
|
642
|
+
"width": "100%",
|
|
643
|
+
},
|
|
642
644
|
"testID": undefined,
|
|
643
645
|
},
|
|
644
646
|
"type": "View",
|
|
@@ -711,7 +713,6 @@ exports[`TimezonePicker renders with selected timezone 1`] = `
|
|
|
711
713
|
},
|
|
712
714
|
],
|
|
713
715
|
"props": {
|
|
714
|
-
"activeOpacity": 1,
|
|
715
716
|
"onPress": [Function],
|
|
716
717
|
"style": {
|
|
717
718
|
"alignItems": "center",
|
|
@@ -968,7 +969,9 @@ exports[`TimezonePicker renders with selected timezone 1`] = `
|
|
|
968
969
|
},
|
|
969
970
|
],
|
|
970
971
|
"props": {
|
|
971
|
-
"style":
|
|
972
|
+
"style": {
|
|
973
|
+
"width": "100%",
|
|
974
|
+
},
|
|
972
975
|
"testID": undefined,
|
|
973
976
|
},
|
|
974
977
|
"type": "View",
|
|
@@ -1041,7 +1044,6 @@ exports[`TimezonePicker renders USA timezones by default 1`] = `
|
|
|
1041
1044
|
},
|
|
1042
1045
|
],
|
|
1043
1046
|
"props": {
|
|
1044
|
-
"activeOpacity": 1,
|
|
1045
1047
|
"onPress": [Function],
|
|
1046
1048
|
"style": {
|
|
1047
1049
|
"alignItems": "center",
|
|
@@ -1298,7 +1300,9 @@ exports[`TimezonePicker renders USA timezones by default 1`] = `
|
|
|
1298
1300
|
},
|
|
1299
1301
|
],
|
|
1300
1302
|
"props": {
|
|
1301
|
-
"style":
|
|
1303
|
+
"style": {
|
|
1304
|
+
"width": "100%",
|
|
1305
|
+
},
|
|
1302
1306
|
"testID": undefined,
|
|
1303
1307
|
},
|
|
1304
1308
|
"type": "View",
|
|
@@ -1371,7 +1375,6 @@ exports[`TimezonePicker renders with short timezone labels 1`] = `
|
|
|
1371
1375
|
},
|
|
1372
1376
|
],
|
|
1373
1377
|
"props": {
|
|
1374
|
-
"activeOpacity": 1,
|
|
1375
1378
|
"onPress": [Function],
|
|
1376
1379
|
"style": {
|
|
1377
1380
|
"alignItems": "center",
|
|
@@ -1628,7 +1631,9 @@ exports[`TimezonePicker renders with short timezone labels 1`] = `
|
|
|
1628
1631
|
},
|
|
1629
1632
|
],
|
|
1630
1633
|
"props": {
|
|
1631
|
-
"style":
|
|
1634
|
+
"style": {
|
|
1635
|
+
"width": "100%",
|
|
1636
|
+
},
|
|
1632
1637
|
"testID": undefined,
|
|
1633
1638
|
},
|
|
1634
1639
|
"type": "View",
|
|
@@ -1701,7 +1706,6 @@ exports[`TimezonePicker calls onChange when timezone is selected 1`] = `
|
|
|
1701
1706
|
},
|
|
1702
1707
|
],
|
|
1703
1708
|
"props": {
|
|
1704
|
-
"activeOpacity": 1,
|
|
1705
1709
|
"onPress": [Function],
|
|
1706
1710
|
"style": {
|
|
1707
1711
|
"alignItems": "center",
|
|
@@ -1958,7 +1962,9 @@ exports[`TimezonePicker calls onChange when timezone is selected 1`] = `
|
|
|
1958
1962
|
},
|
|
1959
1963
|
],
|
|
1960
1964
|
"props": {
|
|
1961
|
-
"style":
|
|
1965
|
+
"style": {
|
|
1966
|
+
"width": "100%",
|
|
1967
|
+
},
|
|
1962
1968
|
"testID": undefined,
|
|
1963
1969
|
},
|
|
1964
1970
|
"type": "View",
|
package/src/bunSetup.ts
CHANGED
|
@@ -6,6 +6,10 @@ type MockComponentProps = Record<string, unknown> & {
|
|
|
6
6
|
style?: unknown;
|
|
7
7
|
testID?: string;
|
|
8
8
|
};
|
|
9
|
+
type MockPresstoPressableProps = MockComponentProps & {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
onPress?: (...args: unknown[]) => unknown;
|
|
12
|
+
};
|
|
9
13
|
type MockStyleValue = unknown;
|
|
10
14
|
type MockAnimation = {
|
|
11
15
|
start?: (callback?: (result: {finished: boolean}) => void) => void;
|
|
@@ -447,6 +451,25 @@ mock.module("react-native", () => {
|
|
|
447
451
|
};
|
|
448
452
|
});
|
|
449
453
|
|
|
454
|
+
const createMockPresstoPressable = (name: string): React.FC<MockPresstoPressableProps> => {
|
|
455
|
+
return ({children, enabled = true, onPress, ...props}) =>
|
|
456
|
+
React.createElement(
|
|
457
|
+
name,
|
|
458
|
+
{
|
|
459
|
+
...props,
|
|
460
|
+
disabled: !enabled,
|
|
461
|
+
onPress: enabled ? onPress : undefined,
|
|
462
|
+
},
|
|
463
|
+
children
|
|
464
|
+
);
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
mock.module("pressto", () => ({
|
|
468
|
+
PressableOpacity: createMockPresstoPressable("PressableOpacity"),
|
|
469
|
+
PressableScale: createMockPresstoPressable("PressableScale"),
|
|
470
|
+
PressableWithoutFeedback: createMockPresstoPressable("PressableWithoutFeedback"),
|
|
471
|
+
}));
|
|
472
|
+
|
|
450
473
|
// Initialize globalThis.expo early for expo-modules-core
|
|
451
474
|
if (typeof globalThis.expo === "undefined") {
|
|
452
475
|
const EventEmitterClass = class EventEmitter {
|
|
@@ -530,6 +553,28 @@ mock.module("react-native-signature-canvas", () => ({
|
|
|
530
553
|
Signature: mock(() => null),
|
|
531
554
|
}));
|
|
532
555
|
|
|
556
|
+
// Mock react-signature-canvas (web). The real module references `window` at
|
|
557
|
+
// import time, which doesn't exist under bun test.
|
|
558
|
+
mock.module("react-signature-canvas", () => {
|
|
559
|
+
const SignatureCanvasMock = React.forwardRef(
|
|
560
|
+
({backgroundColor}: {backgroundColor?: string}, _ref) =>
|
|
561
|
+
React.createElement("View", {style: {backgroundColor}, testID: "signature-canvas"})
|
|
562
|
+
);
|
|
563
|
+
return {__esModule: true, default: SignatureCanvasMock};
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
// Mock react-native-portalize. The real `Host` wraps children in an extra View
|
|
567
|
+
// whose presence makes snapshots brittle, and individual tests already mock
|
|
568
|
+
// this to render inline; hoisting the mock to setup keeps test ordering from
|
|
569
|
+
// leaking different shapes into other test files. Shape matches the per-file
|
|
570
|
+
// mock used by Tooltip.test.tsx so the two don't disagree.
|
|
571
|
+
mock.module("react-native-portalize", () => ({
|
|
572
|
+
Host: ({children}: MockComponentProps) =>
|
|
573
|
+
React.createElement("View", {testID: "portal-host"}, children),
|
|
574
|
+
Portal: ({children}: MockComponentProps) =>
|
|
575
|
+
React.createElement("View", {testID: "portal"}, children),
|
|
576
|
+
}));
|
|
577
|
+
|
|
533
578
|
// Mock IconButton component
|
|
534
579
|
mock.module("./IconButton", () => ({
|
|
535
580
|
IconButton: mock(() => null),
|
package/src/index.tsx
CHANGED
|
@@ -58,6 +58,7 @@ export * from "./ModalSheet";
|
|
|
58
58
|
export * from "./MultiselectField";
|
|
59
59
|
export * from "./NumberField";
|
|
60
60
|
export * from "./NumberPickerActionSheet";
|
|
61
|
+
export * from "./OfflineBanner";
|
|
61
62
|
export * from "./OpenAPIContext";
|
|
62
63
|
export * from "./Page";
|
|
63
64
|
export * from "./Pagination";
|
|
@@ -354,8 +354,11 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
354
354
|
],
|
|
355
355
|
"props": {
|
|
356
356
|
"accessibilityHint": "Press to perform action",
|
|
357
|
-
"
|
|
358
|
-
"
|
|
357
|
+
"accessibilityLabel": "Log In",
|
|
358
|
+
"accessibilityRole": "button",
|
|
359
|
+
"accessibilityState": {
|
|
360
|
+
"disabled": true,
|
|
361
|
+
},
|
|
359
362
|
"disabled": true,
|
|
360
363
|
"onPress": [Function: debounced],
|
|
361
364
|
"style": {
|
|
@@ -433,8 +436,11 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
433
436
|
],
|
|
434
437
|
"props": {
|
|
435
438
|
"accessibilityHint": "Press to perform action",
|
|
436
|
-
"
|
|
437
|
-
"
|
|
439
|
+
"accessibilityLabel": "Forgot password?",
|
|
440
|
+
"accessibilityRole": "button",
|
|
441
|
+
"accessibilityState": {
|
|
442
|
+
"disabled": true,
|
|
443
|
+
},
|
|
438
444
|
"disabled": true,
|
|
439
445
|
"onPress": [Function: debounced],
|
|
440
446
|
"style": {
|
|
@@ -513,8 +519,11 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
513
519
|
],
|
|
514
520
|
"props": {
|
|
515
521
|
"accessibilityHint": "Press to perform action",
|
|
516
|
-
"
|
|
517
|
-
"
|
|
522
|
+
"accessibilityLabel": "Need an account? Sign Up",
|
|
523
|
+
"accessibilityRole": "button",
|
|
524
|
+
"accessibilityState": {
|
|
525
|
+
"disabled": true,
|
|
526
|
+
},
|
|
518
527
|
"disabled": true,
|
|
519
528
|
"onPress": [Function: debounced],
|
|
520
529
|
"style": {
|
|
@@ -669,8 +669,11 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
669
669
|
],
|
|
670
670
|
"props": {
|
|
671
671
|
"accessibilityHint": "Press to perform action",
|
|
672
|
-
"
|
|
673
|
-
"
|
|
672
|
+
"accessibilityLabel": "Sign Up",
|
|
673
|
+
"accessibilityRole": "button",
|
|
674
|
+
"accessibilityState": {
|
|
675
|
+
"disabled": true,
|
|
676
|
+
},
|
|
674
677
|
"disabled": true,
|
|
675
678
|
"onPress": [Function: debounced],
|
|
676
679
|
"style": {
|
|
@@ -748,8 +751,11 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
748
751
|
],
|
|
749
752
|
"props": {
|
|
750
753
|
"accessibilityHint": "Press to perform action",
|
|
751
|
-
"
|
|
752
|
-
"
|
|
754
|
+
"accessibilityLabel": "Already have an account? Log in",
|
|
755
|
+
"accessibilityRole": "button",
|
|
756
|
+
"accessibilityState": {
|
|
757
|
+
"disabled": true,
|
|
758
|
+
},
|
|
753
759
|
"disabled": true,
|
|
754
760
|
"onPress": [Function: debounced],
|
|
755
761
|
"style": {
|
|
@@ -485,7 +485,6 @@ exports[`TableBadge renders select field when editing 1`] = `
|
|
|
485
485
|
},
|
|
486
486
|
],
|
|
487
487
|
"props": {
|
|
488
|
-
"activeOpacity": 1,
|
|
489
488
|
"onPress": [Function],
|
|
490
489
|
"style": {
|
|
491
490
|
"alignItems": "center",
|
|
@@ -692,7 +691,9 @@ exports[`TableBadge renders select field when editing 1`] = `
|
|
|
692
691
|
},
|
|
693
692
|
],
|
|
694
693
|
"props": {
|
|
695
|
-
"style":
|
|
694
|
+
"style": {
|
|
695
|
+
"width": "100%",
|
|
696
|
+
},
|
|
696
697
|
"testID": undefined,
|
|
697
698
|
},
|
|
698
699
|
"type": "View",
|
|
@@ -41,6 +41,7 @@ declare module "react-native-swiper-flatlist" {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export const SwiperFlatList: React.ForwardRefExoticComponent<
|
|
44
|
+
// biome-ignore lint/suspicious/noExplicitAny: declaration must use any for the generic to allow consumers to specify their data type without explicit type args
|
|
44
45
|
SwiperFlatListProps<any> & React.RefAttributes<SwiperFlatListRefProps>
|
|
45
46
|
>;
|
|
46
47
|
|
|
@@ -149,4 +149,29 @@ describe("useConsentForms", () => {
|
|
|
149
149
|
const {result} = renderHook(() => useConsentForms(api as unknown as ConsentFormsApi));
|
|
150
150
|
expect(result.current.error).toBe("error");
|
|
151
151
|
});
|
|
152
|
+
|
|
153
|
+
it("injects the pending-consents endpoint only once per (api, baseUrl)", () => {
|
|
154
|
+
let injectCallCount = 0;
|
|
155
|
+
const refetch = mock(() => {});
|
|
156
|
+
const useGetPendingConsentsQuery = mock(() => ({
|
|
157
|
+
data: undefined,
|
|
158
|
+
error: undefined,
|
|
159
|
+
isLoading: false,
|
|
160
|
+
refetch,
|
|
161
|
+
}));
|
|
162
|
+
const api = {
|
|
163
|
+
enhanceEndpoints: () => ({
|
|
164
|
+
injectEndpoints: () => {
|
|
165
|
+
injectCallCount += 1;
|
|
166
|
+
return {useGetPendingConsentsQuery};
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
};
|
|
170
|
+
const {rerender} = renderHook(() => useConsentForms(api as unknown as ConsentFormsApi));
|
|
171
|
+
rerender(undefined);
|
|
172
|
+
rerender(undefined);
|
|
173
|
+
// The hook reuses the cached enhanced api after the first render so the
|
|
174
|
+
// dev-mode RTK warning about re-injecting endpoints never fires.
|
|
175
|
+
expect(injectCallCount).toBe(1);
|
|
176
|
+
});
|
|
152
177
|
});
|
package/src/useConsentForms.ts
CHANGED
|
@@ -41,13 +41,15 @@ interface ConsentFormsHookState {
|
|
|
41
41
|
refetch: () => void | Promise<void>;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
interface ConsentFormsEnhancedApi {
|
|
45
|
+
useGetPendingConsentsQuery: () => ConsentFormsHookState;
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
interface ConsentFormsApiWithTags {
|
|
45
49
|
injectEndpoints: (options: {
|
|
46
50
|
endpoints: (build: ConsentFormsQueryBuilder) => {getPendingConsents: unknown};
|
|
47
51
|
overrideExisting: boolean;
|
|
48
|
-
}) =>
|
|
49
|
-
useGetPendingConsentsQuery: () => ConsentFormsHookState;
|
|
50
|
-
};
|
|
52
|
+
}) => ConsentFormsEnhancedApi;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
interface ConsentFormsApi {
|
|
@@ -73,11 +75,27 @@ export const detectLocale = (): string => {
|
|
|
73
75
|
return "en";
|
|
74
76
|
};
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Cache the enhanced api per (api, baseUrl). `injectEndpoints` logs a console
|
|
80
|
+
* error in development whenever an endpoint with the same name is re-injected
|
|
81
|
+
* (with `overrideExisting: false`), so calling it on every render of every
|
|
82
|
+
* consumer would flood the console. WeakMap-by-api lets the GC reclaim entries
|
|
83
|
+
* when the api object is unreachable.
|
|
84
|
+
*/
|
|
85
|
+
const enhancedApiCache = new WeakMap<ConsentFormsApi, Map<string, ConsentFormsEnhancedApi>>();
|
|
79
86
|
|
|
80
|
-
|
|
87
|
+
const getEnhancedApi = (api: ConsentFormsApi, base: string): ConsentFormsEnhancedApi => {
|
|
88
|
+
let byBase = enhancedApiCache.get(api);
|
|
89
|
+
if (!byBase) {
|
|
90
|
+
byBase = new Map();
|
|
91
|
+
enhancedApiCache.set(api, byBase);
|
|
92
|
+
}
|
|
93
|
+
const cached = byBase.get(base);
|
|
94
|
+
if (cached) {
|
|
95
|
+
return cached;
|
|
96
|
+
}
|
|
97
|
+
const apiWithConsentTags = api.enhanceEndpoints({addTagTypes: ["PendingConsents"]});
|
|
98
|
+
const enhanced = apiWithConsentTags.injectEndpoints({
|
|
81
99
|
endpoints: (build) => ({
|
|
82
100
|
getPendingConsents: build.query({
|
|
83
101
|
async onQueryStarted(_arg: unknown, {queryFulfilled}) {
|
|
@@ -97,6 +115,13 @@ export const useConsentForms = (api: ConsentFormsApi, baseUrl?: string) => {
|
|
|
97
115
|
}),
|
|
98
116
|
overrideExisting: false,
|
|
99
117
|
});
|
|
118
|
+
byBase.set(base, enhanced);
|
|
119
|
+
return enhanced;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export const useConsentForms = (api: ConsentFormsApi, baseUrl?: string) => {
|
|
123
|
+
const base = baseUrl || "";
|
|
124
|
+
const enhancedApi = getEnhancedApi(api, base);
|
|
100
125
|
|
|
101
126
|
const {data, isLoading, error, refetch} = enhancedApi.useGetPendingConsentsQuery();
|
|
102
127
|
const forms: ConsentFormPublic[] = Array.isArray(data) ? data : (data?.data ?? []);
|