@terreno/ui 0.26.0 → 0.27.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.js.map +1 -1
- package/dist/Box.js +2 -0
- package/dist/Box.js.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/ConsentNavigator.js.map +1 -1
- package/dist/DateTimeField.js +1 -0
- package/dist/DateTimeField.js.map +1 -1
- package/dist/EmailField.js +1 -1
- package/dist/EmailField.js.map +1 -1
- package/dist/Modal.js +7 -2
- package/dist/Modal.js.map +1 -1
- package/dist/Page.js +1 -0
- package/dist/Page.js.map +1 -1
- package/dist/SplitPage.js +3 -0
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.js +2 -0
- package/dist/SplitPage.native.js.map +1 -1
- package/dist/TapToEdit.js +1 -0
- package/dist/TapToEdit.js.map +1 -1
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Unifier.js.map +1 -1
- package/dist/useSubmitConsent.d.ts +1 -1
- package/dist/useSubmitConsent.js +1 -1
- package/dist/useSubmitConsent.js.map +1 -1
- package/package.json +2 -2
- package/src/ActionSheet.test.tsx +1 -0
- package/src/ActionSheet.tsx +2 -0
- package/src/Box.test.tsx +56 -0
- package/src/Box.tsx +4 -0
- package/src/Button.test.tsx +34 -0
- package/src/Common.ts +23 -0
- package/src/ConsentNavigator.test.tsx +1 -0
- package/src/ConsentNavigator.tsx +1 -0
- package/src/DataTable.test.tsx +1 -0
- package/src/DateTimeField.test.tsx +1 -0
- package/src/DateTimeField.tsx +1 -0
- package/src/EmailField.tsx +1 -1
- package/src/Modal.test.tsx +261 -66
- package/src/Modal.tsx +7 -2
- package/src/ModalSheet.test.tsx +7 -6
- package/src/Page.tsx +1 -0
- package/src/PickerSelect.test.tsx +1 -0
- package/src/SelectBadge.test.tsx +1 -2
- package/src/SplitPage.native.tsx +2 -0
- package/src/SplitPage.test.tsx +6 -4
- package/src/SplitPage.tsx +3 -0
- package/src/TapToEdit.test.tsx +1 -0
- package/src/TapToEdit.tsx +2 -0
- package/src/Text.test.tsx +29 -0
- package/src/TextField.test.tsx +57 -1
- package/src/ToastNotifications.test.tsx +1 -0
- package/src/ToastNotifications.tsx +1 -0
- package/src/Tooltip.test.tsx +1 -1
- package/src/Unifier.ts +1 -0
- package/src/UpgradeRequiredScreen.test.tsx +40 -0
- package/src/UserInactivity.test.tsx +44 -1
- package/src/__snapshots__/DataTable.test.tsx.snap +0 -148
- package/src/__snapshots__/InfoModalIcon.test.tsx.snap +255 -1088
- package/src/__snapshots__/Modal.test.tsx.snap +950 -1108
- package/src/bunSetup.ts +24 -0
- package/src/types/react-native-swiper-flatlist.d.ts +1 -0
- package/src/useSubmitConsent.test.ts +2 -1
- package/src/useSubmitConsent.ts +2 -2
|
@@ -1200,6 +1200,7 @@ describe("ToastNotifications", () => {
|
|
|
1200
1200
|
});
|
|
1201
1201
|
|
|
1202
1202
|
describe("Toast with swipe and pan responder interaction", () => {
|
|
1203
|
+
// noExplicitAny: capturing PanResponder internals for test
|
|
1203
1204
|
// biome-ignore lint/suspicious/noExplicitAny: capturing PanResponder internals for test
|
|
1204
1205
|
type PanConfig = any;
|
|
1205
1206
|
let capturedPanConfigs: PanConfig[] = [];
|
|
@@ -177,6 +177,7 @@ export interface ToastOptions {
|
|
|
177
177
|
/**
|
|
178
178
|
* Payload data for custom toasts. You can pass whatever you want
|
|
179
179
|
*/
|
|
180
|
+
// noExplicitAny: This is the public API of a vendored 3rd-party library (react-native-toast-notifications); the data field is an opaque user-provided payload. Tightening to unknown breaks downstream consumers that spread data into Toast (e.g. TerrenoProvider) without refactor.
|
|
180
181
|
// biome-ignore lint/suspicious/noExplicitAny: This is the public API of a vendored 3rd-party library (react-native-toast-notifications); the data field is an opaque user-provided payload. Tightening to unknown breaks downstream consumers that spread data into Toast (e.g. TerrenoProvider) without refactor.
|
|
181
182
|
data?: any;
|
|
182
183
|
|
package/src/Tooltip.test.tsx
CHANGED
|
@@ -776,7 +776,7 @@ describe("Tooltip", () => {
|
|
|
776
776
|
(c: TestNode) => c.props && (c.props as {hitSlop?: object}).hitSlop !== undefined
|
|
777
777
|
) as TestNode | undefined;
|
|
778
778
|
await act(async () => {
|
|
779
|
-
(wrapper?.props as {onPress?: () => void})
|
|
779
|
+
(wrapper?.props as {onPress?: () => void} | undefined)?.onPress?.();
|
|
780
780
|
});
|
|
781
781
|
expect(queryByTestId("tooltip-container")).toBeNull();
|
|
782
782
|
});
|
package/src/Unifier.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {requestPermissions} from "./Permissions";
|
|
|
8
8
|
|
|
9
9
|
declare global {
|
|
10
10
|
interface Window {
|
|
11
|
+
// noExplicitAny: Google Maps JS SDK global type is loaded dynamically and not bundled as a typed dependency
|
|
11
12
|
// biome-ignore lint/suspicious/noExplicitAny: Google Maps JS SDK global type is loaded dynamically and not bundled as a typed dependency
|
|
12
13
|
google: any;
|
|
13
14
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {describe, expect, it, mock} from "bun:test";
|
|
2
|
+
import {fireEvent, waitFor} from "@testing-library/react-native";
|
|
3
|
+
|
|
4
|
+
import {renderWithTheme} from "./test-utils";
|
|
5
|
+
import {UpgradeRequiredScreen} from "./UpgradeRequiredScreen";
|
|
6
|
+
|
|
7
|
+
describe("UpgradeRequiredScreen", () => {
|
|
8
|
+
it("renders the heading, message, and update button by default", () => {
|
|
9
|
+
const {getByText} = renderWithTheme(
|
|
10
|
+
<UpgradeRequiredScreen message="A new version is available" onUpdate={() => {}} />
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
expect(getByText("Update Required")).toBeTruthy();
|
|
14
|
+
expect(getByText("A new version is available")).toBeTruthy();
|
|
15
|
+
expect(getByText("Update")).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("invokes onUpdate when the update button is pressed", async () => {
|
|
19
|
+
const onUpdate = mock(() => {});
|
|
20
|
+
const {getByText} = renderWithTheme(
|
|
21
|
+
<UpgradeRequiredScreen canUpdate message="Please update now" onUpdate={onUpdate} />
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
fireEvent.press(getByText("Update"));
|
|
25
|
+
|
|
26
|
+
await waitFor(() => {
|
|
27
|
+
expect(onUpdate).toHaveBeenCalledTimes(1);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("shows contact-support text instead of the button when canUpdate is false", () => {
|
|
32
|
+
const {getByText, queryByText} = renderWithTheme(
|
|
33
|
+
<UpgradeRequiredScreen canUpdate={false} message="No update path" onUpdate={() => {}} />
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
expect(getByText("No update path")).toBeTruthy();
|
|
37
|
+
expect(getByText("Please contact support or check your app store for an update.")).toBeTruthy();
|
|
38
|
+
expect(queryByText("Update")).toBeNull();
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import {describe, expect, it, mock, spyOn} from "bun:test";
|
|
2
2
|
import {act} from "@testing-library/react-native";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type EmitterSubscription,
|
|
5
|
+
type GestureResponderEvent,
|
|
6
|
+
Keyboard,
|
|
7
|
+
PanResponder,
|
|
8
|
+
type PanResponderCallbacks,
|
|
9
|
+
type PanResponderGestureState,
|
|
10
|
+
type PanResponderInstance,
|
|
11
|
+
} from "react-native";
|
|
4
12
|
|
|
5
13
|
import {Text} from "./Text";
|
|
6
14
|
import {renderWithTheme} from "./test-utils";
|
|
@@ -165,4 +173,39 @@ describe("UserInactivity", () => {
|
|
|
165
173
|
expect(onAction).toHaveBeenCalledWith(true);
|
|
166
174
|
addListenerSpy.mockRestore();
|
|
167
175
|
});
|
|
176
|
+
|
|
177
|
+
it("resets the inactivity timer when a pan responder capture handler fires", () => {
|
|
178
|
+
const onAction = mock((_active: boolean) => {});
|
|
179
|
+
let capturedConfig: PanResponderCallbacks | undefined;
|
|
180
|
+
const originalCreate = PanResponder.create;
|
|
181
|
+
PanResponder.create = (config: PanResponderCallbacks): PanResponderInstance => {
|
|
182
|
+
capturedConfig = config;
|
|
183
|
+
return originalCreate(config);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
try {
|
|
187
|
+
const {unmount} = renderWithTheme(
|
|
188
|
+
<UserInactivity onAction={onAction} skipKeyboard={true}>
|
|
189
|
+
<Text>Test Content</Text>
|
|
190
|
+
</UserInactivity>
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
expect(capturedConfig).toBeDefined();
|
|
194
|
+
|
|
195
|
+
let shouldSet: boolean | undefined;
|
|
196
|
+
act(() => {
|
|
197
|
+
shouldSet = capturedConfig?.onStartShouldSetPanResponderCapture?.(
|
|
198
|
+
{} as unknown as GestureResponderEvent,
|
|
199
|
+
{} as unknown as PanResponderGestureState
|
|
200
|
+
);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
expect(shouldSet).toBe(false);
|
|
204
|
+
act(() => {
|
|
205
|
+
unmount();
|
|
206
|
+
});
|
|
207
|
+
} finally {
|
|
208
|
+
PanResponder.create = originalCreate;
|
|
209
|
+
}
|
|
210
|
+
});
|
|
168
211
|
});
|
|
@@ -8726,154 +8726,6 @@ exports[`DataTable renders with more content component 1`] = `
|
|
|
8726
8726
|
},
|
|
8727
8727
|
"type": "ScrollView",
|
|
8728
8728
|
},
|
|
8729
|
-
{
|
|
8730
|
-
"$$typeof": Symbol(react.test.json),
|
|
8731
|
-
"children": [
|
|
8732
|
-
{
|
|
8733
|
-
"$$typeof": Symbol(react.test.json),
|
|
8734
|
-
"children": [
|
|
8735
|
-
{
|
|
8736
|
-
"$$typeof": Symbol(react.test.json),
|
|
8737
|
-
"children": [
|
|
8738
|
-
{
|
|
8739
|
-
"$$typeof": Symbol(react.test.json),
|
|
8740
|
-
"children": [
|
|
8741
|
-
{
|
|
8742
|
-
"$$typeof": Symbol(react.test.json),
|
|
8743
|
-
"children": [
|
|
8744
|
-
{
|
|
8745
|
-
"$$typeof": Symbol(react.test.json),
|
|
8746
|
-
"children": null,
|
|
8747
|
-
"props": {
|
|
8748
|
-
"accessibilityHint": "Closes the modal",
|
|
8749
|
-
"aria-label": "Close modal",
|
|
8750
|
-
"aria-role": "button",
|
|
8751
|
-
"onPress": [Function],
|
|
8752
|
-
"style": {
|
|
8753
|
-
"alignItems": "center",
|
|
8754
|
-
"bottom": -8,
|
|
8755
|
-
"flex": 1,
|
|
8756
|
-
"justifyContent": "center",
|
|
8757
|
-
"left": -8,
|
|
8758
|
-
"position": "absolute",
|
|
8759
|
-
"right": -8,
|
|
8760
|
-
"top": -8,
|
|
8761
|
-
},
|
|
8762
|
-
},
|
|
8763
|
-
"type": "Pressable",
|
|
8764
|
-
},
|
|
8765
|
-
],
|
|
8766
|
-
"props": {
|
|
8767
|
-
"style": {
|
|
8768
|
-
"alignSelf": "flex-end",
|
|
8769
|
-
"position": "relative",
|
|
8770
|
-
},
|
|
8771
|
-
"testID": undefined,
|
|
8772
|
-
},
|
|
8773
|
-
"type": "View",
|
|
8774
|
-
},
|
|
8775
|
-
{
|
|
8776
|
-
"$$typeof": Symbol(react.test.json),
|
|
8777
|
-
"children": [
|
|
8778
|
-
{
|
|
8779
|
-
"$$typeof": Symbol(react.test.json),
|
|
8780
|
-
"children": [
|
|
8781
|
-
{
|
|
8782
|
-
"$$typeof": Symbol(react.test.json),
|
|
8783
|
-
"children": [
|
|
8784
|
-
"Row ",
|
|
8785
|
-
" details",
|
|
8786
|
-
],
|
|
8787
|
-
"props": {
|
|
8788
|
-
"numberOfLines": 0,
|
|
8789
|
-
"selectable": undefined,
|
|
8790
|
-
"style": {
|
|
8791
|
-
"color": "#1C1C1C",
|
|
8792
|
-
"fontFamily": "text-regular",
|
|
8793
|
-
"fontSize": 14,
|
|
8794
|
-
"textAlign": "left",
|
|
8795
|
-
},
|
|
8796
|
-
"testID": undefined,
|
|
8797
|
-
},
|
|
8798
|
-
"type": "Text",
|
|
8799
|
-
},
|
|
8800
|
-
],
|
|
8801
|
-
"props": {},
|
|
8802
|
-
"type": "View",
|
|
8803
|
-
},
|
|
8804
|
-
],
|
|
8805
|
-
"props": {
|
|
8806
|
-
"style": {
|
|
8807
|
-
"flex": 1,
|
|
8808
|
-
"marginTop": 12,
|
|
8809
|
-
"width": "100%",
|
|
8810
|
-
},
|
|
8811
|
-
"testID": undefined,
|
|
8812
|
-
},
|
|
8813
|
-
"type": "View",
|
|
8814
|
-
},
|
|
8815
|
-
{
|
|
8816
|
-
"$$typeof": Symbol(react.test.json),
|
|
8817
|
-
"children": null,
|
|
8818
|
-
"props": {
|
|
8819
|
-
"style": {
|
|
8820
|
-
"alignSelf": "flex-end",
|
|
8821
|
-
"flexDirection": "row",
|
|
8822
|
-
"marginTop": 32,
|
|
8823
|
-
},
|
|
8824
|
-
"testID": undefined,
|
|
8825
|
-
},
|
|
8826
|
-
"type": "View",
|
|
8827
|
-
},
|
|
8828
|
-
],
|
|
8829
|
-
"props": {
|
|
8830
|
-
"style": {
|
|
8831
|
-
"alignItems": "center",
|
|
8832
|
-
"alignSelf": "center",
|
|
8833
|
-
"backgroundColor": "#FFFFFF",
|
|
8834
|
-
"borderRadius": 4,
|
|
8835
|
-
"boxShadow": "0px 4px 24px rgba(0, 0, 0, 0.5)",
|
|
8836
|
-
"elevation": 24,
|
|
8837
|
-
"margin": "auto",
|
|
8838
|
-
"maxHeight": "100%",
|
|
8839
|
-
"padding": 32,
|
|
8840
|
-
"width": "90%",
|
|
8841
|
-
"zIndex": 1,
|
|
8842
|
-
},
|
|
8843
|
-
"testID": undefined,
|
|
8844
|
-
},
|
|
8845
|
-
"type": "View",
|
|
8846
|
-
},
|
|
8847
|
-
],
|
|
8848
|
-
"props": {
|
|
8849
|
-
"onPress": [Function],
|
|
8850
|
-
"style": {
|
|
8851
|
-
"cursor": "auto",
|
|
8852
|
-
},
|
|
8853
|
-
},
|
|
8854
|
-
"type": "Pressable",
|
|
8855
|
-
},
|
|
8856
|
-
],
|
|
8857
|
-
"props": {
|
|
8858
|
-
"onPress": [Function],
|
|
8859
|
-
"style": {
|
|
8860
|
-
"alignItems": "center",
|
|
8861
|
-
"backgroundColor": "rgba(0, 0, 0, 0.5)",
|
|
8862
|
-
"flex": 1,
|
|
8863
|
-
"justifyContent": "center",
|
|
8864
|
-
},
|
|
8865
|
-
},
|
|
8866
|
-
"type": "Pressable",
|
|
8867
|
-
},
|
|
8868
|
-
],
|
|
8869
|
-
"props": {
|
|
8870
|
-
"animationType": "none",
|
|
8871
|
-
"onRequestClose": [Function],
|
|
8872
|
-
"transparent": true,
|
|
8873
|
-
"visible": false,
|
|
8874
|
-
},
|
|
8875
|
-
"type": "Modal",
|
|
8876
|
-
},
|
|
8877
8729
|
],
|
|
8878
8730
|
"props": {
|
|
8879
8731
|
"style": {
|