@terreno/ui 0.31.0 → 56.0.0-beta.2
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 +1 -1
- package/dist/Avatar.js +1 -4
- package/dist/Avatar.js.map +1 -1
- package/dist/Box.js +45 -9
- package/dist/Box.js.map +1 -1
- package/dist/Common.d.ts +21 -0
- package/dist/Common.js.map +1 -1
- package/dist/ConflictSheet.d.ts +53 -0
- package/dist/ConflictSheet.js +132 -0
- package/dist/ConflictSheet.js.map +1 -0
- package/dist/DateTimeActionSheet.d.ts +2 -1
- package/dist/DateTimeField.js +5 -21
- package/dist/DateTimeField.js.map +1 -1
- package/dist/DecimalRangeActionSheet.d.ts +1 -1
- package/dist/EmojiSelector.d.ts +1 -1
- package/dist/ErrorPage.d.ts +1 -1
- package/dist/HeightActionSheet.d.ts +1 -1
- package/dist/Hyperlink.d.ts +2 -1
- package/dist/Hyperlink.js +2 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Image.d.ts +1 -1
- package/dist/ImageBackground.d.ts +1 -1
- package/dist/MobileAddressAutoComplete.d.ts +1 -1
- package/dist/NumberPickerActionSheet.d.ts +1 -1
- package/dist/Page.d.ts +5 -4
- package/dist/Page.js +0 -2
- package/dist/Page.js.map +1 -1
- package/dist/PickerSelect.d.ts +1 -1
- package/dist/SidebarNavigation.js +1 -1
- package/dist/SidebarNavigation.js.map +1 -1
- package/dist/SidebarNavigation.native.js +1 -1
- package/dist/SidebarNavigation.native.js.map +1 -1
- package/dist/SplitPage.d.ts +1 -1
- package/dist/SplitPage.js +1 -4
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.d.ts +1 -1
- package/dist/SyncStatusBanner.d.ts +46 -0
- package/dist/SyncStatusBanner.js +29 -0
- package/dist/SyncStatusBanner.js.map +1 -0
- package/dist/Theme.d.ts +1 -1
- package/dist/Toast.d.ts +9 -1
- package/dist/Toast.js +20 -7
- package/dist/Toast.js.map +1 -1
- package/dist/ToastNotifications.js +23 -1
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/UnifiedAddressAutoComplete.d.ts +1 -1
- package/dist/Unifier.js +1 -1
- package/dist/Unifier.js.map +1 -1
- package/dist/conflictFieldDiff.d.ts +14 -0
- package/dist/conflictFieldDiff.js +62 -0
- package/dist/conflictFieldDiff.js.map +1 -0
- package/dist/icons/OfflineIcon.d.ts +1 -1
- package/dist/icons/OnlineIcon.d.ts +1 -1
- package/dist/icons/OutOfficeIcon.d.ts +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/pdfHtmlTemplate.d.ts +30 -0
- package/dist/pdfHtmlTemplate.js +170 -0
- package/dist/pdfHtmlTemplate.js.map +1 -0
- package/dist/table/TableTitle.js +1 -3
- package/dist/table/TableTitle.js.map +1 -1
- package/dist/useAppLaunchOrForeground.d.ts +9 -0
- package/dist/useAppLaunchOrForeground.js +27 -0
- package/dist/useAppLaunchOrForeground.js.map +1 -0
- package/package.json +44 -37
- package/src/ActionSheet.test.tsx +123 -136
- package/src/Box.test.tsx +68 -30
- package/src/Box.tsx +46 -7
- package/src/Common.ts +21 -3
- package/src/ConflictSheet.test.tsx +461 -0
- package/src/ConflictSheet.tsx +399 -0
- package/src/ConsentFormScreen.test.tsx +22 -0
- package/src/DateTimeField.test.tsx +14 -0
- package/src/DateTimeField.tsx +5 -19
- package/src/Hyperlink.tsx +1 -1
- package/src/Page.tsx +2 -3
- package/src/SidebarNavigation.native.tsx +1 -1
- package/src/SidebarNavigation.tsx +1 -1
- package/src/SyncStatusBanner.test.tsx +204 -0
- package/src/SyncStatusBanner.tsx +148 -0
- package/src/TerrenoProvider.test.tsx +3 -4
- package/src/Toast.test.tsx +60 -0
- package/src/Toast.tsx +46 -1
- package/src/ToastNotifications.test.tsx +82 -0
- package/src/ToastNotifications.tsx +25 -1
- package/src/Unifier.ts +1 -1
- package/src/WebDropdownMenu.test.tsx +128 -0
- package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +0 -3
- package/src/__snapshots__/Body.test.tsx.snap +0 -16
- package/src/__snapshots__/Box.test.tsx.snap +4 -13
- package/src/__snapshots__/Page.test.tsx.snap +0 -84
- package/src/__snapshots__/SplitPage.test.tsx.snap +24 -120
- package/src/__snapshots__/TapToEdit.test.tsx.snap +5 -16
- package/src/__snapshots__/Toast.test.tsx.snap +4 -2
- package/src/bunSetup.ts +19 -0
- package/src/conflictFieldDiff.test.ts +26 -0
- package/src/conflictFieldDiff.ts +78 -0
- package/src/index.tsx +5 -2
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +0 -9
- package/src/pdfHtmlTemplate.ts +219 -0
- package/src/signUp/__snapshots__/OAuthButtons.test.tsx.snap +0 -1
- package/src/signUp/__snapshots__/PasswordRequirements.test.tsx.snap +2 -16
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +1 -17
- package/src/signUp/__snapshots__/Swiper.test.tsx.snap +0 -1
- package/src/table/__snapshots__/Table.test.tsx.snap +22 -87
- package/src/table/__snapshots__/TableHeader.test.tsx.snap +10 -50
- package/src/table/__snapshots__/TableHeaderCell.test.tsx.snap +10 -84
- package/src/table/__snapshots__/TableRow.test.tsx.snap +12 -77
- package/src/useAppLaunchOrForeground.test.tsx +54 -0
- package/src/useAppLaunchOrForeground.ts +30 -0
- package/dist/ConsentHistory.d.ts +0 -9
- package/dist/ConsentHistory.js +0 -70
- package/dist/ConsentHistory.js.map +0 -1
- package/dist/generateConsentHistoryPdf.d.ts +0 -2
- package/dist/generateConsentHistoryPdf.js +0 -185
- package/dist/generateConsentHistoryPdf.js.map +0 -1
- package/dist/useConsentHistory.d.ts +0 -63
- package/dist/useConsentHistory.js +0 -40
- package/dist/useConsentHistory.js.map +0 -1
- package/src/ConsentHistory.test.tsx +0 -224
- package/src/ConsentHistory.tsx +0 -249
- package/src/generateConsentHistoryPdf.test.ts +0 -253
- package/src/generateConsentHistoryPdf.ts +0 -211
- package/src/useConsentHistory.test.ts +0 -106
- package/src/useConsentHistory.ts +0 -94
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {describe, expect, it, mock} from "bun:test";
|
|
2
2
|
import {act, fireEvent, renderHook} from "@testing-library/react-native";
|
|
3
|
+
import {assert} from "chai";
|
|
3
4
|
import type {ComponentProps} from "react";
|
|
4
5
|
import {Dimensions} from "react-native";
|
|
5
6
|
|
|
@@ -714,6 +715,19 @@ describe("scheduleAfterPaint", () => {
|
|
|
714
715
|
});
|
|
715
716
|
|
|
716
717
|
describe("WebDropdownMenu layout callbacks", () => {
|
|
718
|
+
// scheduleAfterPaint defers to requestAnimationFrame; run callbacks synchronously so
|
|
719
|
+
// scrolling happens inside the act() block that fires the layout events.
|
|
720
|
+
const runAnimationFramesSynchronously = (): (() => void) => {
|
|
721
|
+
const globals = globalThis as {requestAnimationFrame?: typeof requestAnimationFrame};
|
|
722
|
+
const originalRaf = globals.requestAnimationFrame;
|
|
723
|
+
globals.requestAnimationFrame = ((callback: FrameRequestCallback) => {
|
|
724
|
+
callback(0);
|
|
725
|
+
return 1;
|
|
726
|
+
}) as unknown as typeof requestAnimationFrame;
|
|
727
|
+
return () => {
|
|
728
|
+
globals.requestAnimationFrame = originalRaf;
|
|
729
|
+
};
|
|
730
|
+
};
|
|
717
731
|
const anchor = {height: 40, width: 200, x: 16, y: 32};
|
|
718
732
|
const options = [
|
|
719
733
|
{label: "Option A", value: "a"},
|
|
@@ -767,6 +781,120 @@ describe("WebDropdownMenu layout callbacks", () => {
|
|
|
767
781
|
expect(getByTestId("web_dropdown_option_b")).toBeTruthy();
|
|
768
782
|
});
|
|
769
783
|
|
|
784
|
+
it("centers the selected option once its layout and the viewport height are known", () => {
|
|
785
|
+
const restoreRaf = runAnimationFramesSynchronously();
|
|
786
|
+
|
|
787
|
+
try {
|
|
788
|
+
const {getByTestId, root} = renderWithTheme(
|
|
789
|
+
<WebDropdownMenu
|
|
790
|
+
anchor={anchor}
|
|
791
|
+
disableSearch
|
|
792
|
+
onClose={() => {}}
|
|
793
|
+
onSelect={() => {}}
|
|
794
|
+
options={options}
|
|
795
|
+
selectedIndex={2}
|
|
796
|
+
visible
|
|
797
|
+
/>
|
|
798
|
+
);
|
|
799
|
+
|
|
800
|
+
const scrollView = root.findAll((node) => node.type === "ScrollView")[0];
|
|
801
|
+
const scrollCalls: Array<{animated?: boolean; y?: number}> = [];
|
|
802
|
+
const scrollRef = scrollView.props.ref as {current: unknown};
|
|
803
|
+
scrollRef.current = {
|
|
804
|
+
scrollTo: (options: {animated?: boolean; y?: number}) => {
|
|
805
|
+
scrollCalls.push(options);
|
|
806
|
+
},
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
act(() => {
|
|
810
|
+
fireEvent(getByTestId("web_dropdown_option_c"), "layout", {
|
|
811
|
+
nativeEvent: {layout: {height: 40, width: 200, x: 0, y: 80}},
|
|
812
|
+
});
|
|
813
|
+
fireEvent(scrollView, "layout", {nativeEvent: {layout: {height: 60, width: 200}}});
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
// offset 80 - viewport 60 / 2 + height 40 / 2 = 70
|
|
817
|
+
assert.deepEqual(scrollCalls, [{animated: false, y: 70}]);
|
|
818
|
+
} finally {
|
|
819
|
+
restoreRaf();
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
it("clamps the centered scroll offset at the top of the list", () => {
|
|
824
|
+
const restoreRaf = runAnimationFramesSynchronously();
|
|
825
|
+
|
|
826
|
+
try {
|
|
827
|
+
const {getByTestId, root} = renderWithTheme(
|
|
828
|
+
<WebDropdownMenu
|
|
829
|
+
anchor={anchor}
|
|
830
|
+
disableSearch
|
|
831
|
+
onClose={() => {}}
|
|
832
|
+
onSelect={() => {}}
|
|
833
|
+
options={options}
|
|
834
|
+
selectedIndex={0}
|
|
835
|
+
visible
|
|
836
|
+
/>
|
|
837
|
+
);
|
|
838
|
+
|
|
839
|
+
const scrollView = root.findAll((node) => node.type === "ScrollView")[0];
|
|
840
|
+
const scrollCalls: Array<{animated?: boolean; y?: number}> = [];
|
|
841
|
+
const scrollRef = scrollView.props.ref as {current: unknown};
|
|
842
|
+
scrollRef.current = {
|
|
843
|
+
scrollTo: (options: {animated?: boolean; y?: number}) => {
|
|
844
|
+
scrollCalls.push(options);
|
|
845
|
+
},
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
act(() => {
|
|
849
|
+
fireEvent(scrollView, "layout", {nativeEvent: {layout: {height: 200, width: 200}}});
|
|
850
|
+
fireEvent(getByTestId("web_dropdown_option_a"), "layout", {
|
|
851
|
+
nativeEvent: {layout: {height: 40, width: 200, x: 0, y: 0}},
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
|
|
855
|
+
assert.deepEqual(scrollCalls, [{animated: false, y: 0}]);
|
|
856
|
+
} finally {
|
|
857
|
+
restoreRaf();
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
|
|
861
|
+
it("does not scroll when the list viewport height has not been measured yet", () => {
|
|
862
|
+
const restoreRaf = runAnimationFramesSynchronously();
|
|
863
|
+
|
|
864
|
+
try {
|
|
865
|
+
const {getByTestId, root} = renderWithTheme(
|
|
866
|
+
<WebDropdownMenu
|
|
867
|
+
anchor={anchor}
|
|
868
|
+
disableSearch
|
|
869
|
+
onClose={() => {}}
|
|
870
|
+
onSelect={() => {}}
|
|
871
|
+
options={options}
|
|
872
|
+
selectedIndex={1}
|
|
873
|
+
visible
|
|
874
|
+
/>
|
|
875
|
+
);
|
|
876
|
+
|
|
877
|
+
const scrollView = root.findAll((node) => node.type === "ScrollView")[0];
|
|
878
|
+
const scrollCalls: Array<{animated?: boolean; y?: number}> = [];
|
|
879
|
+
const scrollRef = scrollView.props.ref as {current: unknown};
|
|
880
|
+
scrollRef.current = {
|
|
881
|
+
scrollTo: (options: {animated?: boolean; y?: number}) => {
|
|
882
|
+
scrollCalls.push(options);
|
|
883
|
+
},
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
act(() => {
|
|
887
|
+
fireEvent(getByTestId("web_dropdown_option_b"), "layout", {
|
|
888
|
+
nativeEvent: {layout: {height: 40, width: 200, x: 0, y: 40}},
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
assert.lengthOf(scrollCalls, 0);
|
|
893
|
+
} finally {
|
|
894
|
+
restoreRaf();
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
|
|
770
898
|
it("does not schedule a scroll for option layout when nothing is selected", () => {
|
|
771
899
|
const {getByTestId} = renderWithTheme(
|
|
772
900
|
<WebDropdownMenu
|
|
@@ -503,7 +503,6 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for ready s
|
|
|
503
503
|
"alignItems": "center",
|
|
504
504
|
"display": "flex",
|
|
505
505
|
"flexDirection": "row",
|
|
506
|
-
"testID": "test-ai-suggestion-feedback",
|
|
507
506
|
},
|
|
508
507
|
"testID": "test-ai-suggestion-feedback",
|
|
509
508
|
},
|
|
@@ -1024,7 +1023,6 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for hidden
|
|
|
1024
1023
|
"alignItems": "center",
|
|
1025
1024
|
"display": "flex",
|
|
1026
1025
|
"flexDirection": "row",
|
|
1027
|
-
"testID": "test-ai-suggestion-feedback",
|
|
1028
1026
|
},
|
|
1029
1027
|
"testID": "test-ai-suggestion-feedback",
|
|
1030
1028
|
},
|
|
@@ -1364,7 +1362,6 @@ exports[`AiSuggestionBox in TextArea snapshots should match snapshot for added s
|
|
|
1364
1362
|
"alignItems": "center",
|
|
1365
1363
|
"display": "flex",
|
|
1366
1364
|
"flexDirection": "row",
|
|
1367
|
-
"testID": "test-ai-suggestion-feedback",
|
|
1368
1365
|
},
|
|
1369
1366
|
"testID": "test-ai-suggestion-feedback",
|
|
1370
1367
|
},
|
|
@@ -58,9 +58,7 @@ exports[`Body renders correctly with default props 1`] = `
|
|
|
58
58
|
"onPointerEnter": [Function: AsyncFunction],
|
|
59
59
|
"onPointerLeave": [Function: AsyncFunction],
|
|
60
60
|
"style": {
|
|
61
|
-
"avoidKeyboard": true,
|
|
62
61
|
"height": "100%",
|
|
63
|
-
"scroll": undefined,
|
|
64
62
|
},
|
|
65
63
|
"testID": undefined,
|
|
66
64
|
},
|
|
@@ -155,9 +153,7 @@ exports[`Body renders with scroll enabled 1`] = `
|
|
|
155
153
|
"onPointerEnter": [Function: AsyncFunction],
|
|
156
154
|
"onPointerLeave": [Function: AsyncFunction],
|
|
157
155
|
"style": {
|
|
158
|
-
"avoidKeyboard": true,
|
|
159
156
|
"height": "100%",
|
|
160
|
-
"scroll": true,
|
|
161
157
|
},
|
|
162
158
|
"testID": undefined,
|
|
163
159
|
},
|
|
@@ -179,9 +175,7 @@ exports[`Body renders with scroll enabled 1`] = `
|
|
|
179
175
|
},
|
|
180
176
|
"scrollEventThrottle": 50,
|
|
181
177
|
"style": {
|
|
182
|
-
"avoidKeyboard": true,
|
|
183
178
|
"height": "100%",
|
|
184
|
-
"scroll": true,
|
|
185
179
|
},
|
|
186
180
|
},
|
|
187
181
|
"type": "ScrollView",
|
|
@@ -281,9 +275,7 @@ exports[`Body renders with loading state 1`] = `
|
|
|
281
275
|
"onPointerEnter": [Function: AsyncFunction],
|
|
282
276
|
"onPointerLeave": [Function: AsyncFunction],
|
|
283
277
|
"style": {
|
|
284
|
-
"avoidKeyboard": true,
|
|
285
278
|
"height": "100%",
|
|
286
|
-
"scroll": undefined,
|
|
287
279
|
},
|
|
288
280
|
"testID": undefined,
|
|
289
281
|
},
|
|
@@ -375,9 +367,7 @@ exports[`Body renders with custom padding 1`] = `
|
|
|
375
367
|
"onPointerEnter": [Function: AsyncFunction],
|
|
376
368
|
"onPointerLeave": [Function: AsyncFunction],
|
|
377
369
|
"style": {
|
|
378
|
-
"avoidKeyboard": true,
|
|
379
370
|
"height": "100%",
|
|
380
|
-
"scroll": undefined,
|
|
381
371
|
},
|
|
382
372
|
"testID": undefined,
|
|
383
373
|
},
|
|
@@ -469,9 +459,7 @@ exports[`Body renders with custom height 1`] = `
|
|
|
469
459
|
"onPointerEnter": [Function: AsyncFunction],
|
|
470
460
|
"onPointerLeave": [Function: AsyncFunction],
|
|
471
461
|
"style": {
|
|
472
|
-
"avoidKeyboard": true,
|
|
473
462
|
"height": "100%",
|
|
474
|
-
"scroll": undefined,
|
|
475
463
|
},
|
|
476
464
|
"testID": undefined,
|
|
477
465
|
},
|
|
@@ -560,9 +548,7 @@ exports[`Body renders without keyboard avoiding when avoidKeyboard is false 1`]
|
|
|
560
548
|
"onPointerEnter": [Function: AsyncFunction],
|
|
561
549
|
"onPointerLeave": [Function: AsyncFunction],
|
|
562
550
|
"style": {
|
|
563
|
-
"avoidKeyboard": true,
|
|
564
551
|
"height": "100%",
|
|
565
|
-
"scroll": undefined,
|
|
566
552
|
},
|
|
567
553
|
"testID": undefined,
|
|
568
554
|
},
|
|
@@ -648,9 +634,7 @@ exports[`Body renders with keyboard avoiding by default 1`] = `
|
|
|
648
634
|
"onPointerEnter": [Function: AsyncFunction],
|
|
649
635
|
"onPointerLeave": [Function: AsyncFunction],
|
|
650
636
|
"style": {
|
|
651
|
-
"avoidKeyboard": true,
|
|
652
637
|
"height": "100%",
|
|
653
|
-
"scroll": undefined,
|
|
654
638
|
},
|
|
655
639
|
"testID": undefined,
|
|
656
640
|
},
|
|
@@ -49,10 +49,7 @@ exports[`Box snapshots should match snapshot with clickable props 1`] = `
|
|
|
49
49
|
"onPointerEnter": [Function: AsyncFunction],
|
|
50
50
|
"onPointerLeave": [Function: AsyncFunction],
|
|
51
51
|
"onPress": [Function: AsyncFunction],
|
|
52
|
-
"style": {
|
|
53
|
-
"accessibilityHint": "Tap to trigger action",
|
|
54
|
-
"accessibilityLabel": "Click me",
|
|
55
|
-
},
|
|
52
|
+
"style": {},
|
|
56
53
|
"testID": undefined,
|
|
57
54
|
},
|
|
58
55
|
"type": "Pressable",
|
|
@@ -69,9 +66,7 @@ exports[`Box snapshots should match snapshot with scroll enabled 1`] = `
|
|
|
69
66
|
"props": {
|
|
70
67
|
"onPointerEnter": [Function: AsyncFunction],
|
|
71
68
|
"onPointerLeave": [Function: AsyncFunction],
|
|
72
|
-
"style": {
|
|
73
|
-
"scroll": true,
|
|
74
|
-
},
|
|
69
|
+
"style": {},
|
|
75
70
|
"testID": undefined,
|
|
76
71
|
},
|
|
77
72
|
"type": "View",
|
|
@@ -91,9 +86,7 @@ exports[`Box snapshots should match snapshot with scroll enabled 1`] = `
|
|
|
91
86
|
"current": null,
|
|
92
87
|
},
|
|
93
88
|
"scrollEventThrottle": 50,
|
|
94
|
-
"style": {
|
|
95
|
-
"scroll": true,
|
|
96
|
-
},
|
|
89
|
+
"style": {},
|
|
97
90
|
},
|
|
98
91
|
"type": "ScrollView",
|
|
99
92
|
}
|
|
@@ -112,9 +105,7 @@ exports[`Box snapshots should match snapshot with keyboard avoidance 1`] = `
|
|
|
112
105
|
"props": {
|
|
113
106
|
"onPointerEnter": [Function: AsyncFunction],
|
|
114
107
|
"onPointerLeave": [Function: AsyncFunction],
|
|
115
|
-
"style": {
|
|
116
|
-
"avoidKeyboard": true,
|
|
117
|
-
},
|
|
108
|
+
"style": {},
|
|
118
109
|
"testID": undefined,
|
|
119
110
|
},
|
|
120
111
|
"type": "View",
|