@terreno/ui 0.14.1 → 0.15.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 (70) hide show
  1. package/dist/ActionSheet.js +15 -27
  2. package/dist/ActionSheet.js.map +1 -1
  3. package/dist/Badge.js +1 -0
  4. package/dist/Badge.js.map +1 -1
  5. package/dist/Banner.d.ts +8 -0
  6. package/dist/Banner.js +2 -2
  7. package/dist/Banner.js.map +1 -1
  8. package/dist/MarkdownView.js +20 -7
  9. package/dist/MarkdownView.js.map +1 -1
  10. package/dist/PickerSelect.js +6 -2
  11. package/dist/PickerSelect.js.map +1 -1
  12. package/dist/Signature.d.ts +8 -1
  13. package/dist/Signature.js +93 -18
  14. package/dist/Signature.js.map +1 -1
  15. package/dist/Signature.native.d.ts +15 -0
  16. package/dist/Signature.native.js +116 -21
  17. package/dist/Signature.native.js.map +1 -1
  18. package/dist/TapToEdit.js +1 -1
  19. package/dist/TapToEdit.js.map +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/useConsentHistory.d.ts +6 -1
  24. package/dist/useConsentHistory.js +2 -1
  25. package/dist/useConsentHistory.js.map +1 -1
  26. package/package.json +2 -4
  27. package/src/ActionSheet.test.tsx +554 -0
  28. package/src/ActionSheet.tsx +24 -37
  29. package/src/Badge.test.tsx +7 -0
  30. package/src/Badge.tsx +1 -0
  31. package/src/Banner.test.tsx +58 -3
  32. package/src/Banner.tsx +3 -3
  33. package/src/DataTable.test.tsx +176 -1
  34. package/src/DateTimeField.test.tsx +942 -2
  35. package/src/Field.test.tsx +23 -0
  36. package/src/HeightActionSheet.test.tsx +1 -1
  37. package/src/HeightField.test.tsx +35 -0
  38. package/src/HeightFieldDesktop.test.tsx +19 -0
  39. package/src/MarkdownView.test.tsx +28 -0
  40. package/src/MarkdownView.tsx +69 -7
  41. package/src/MobileAddressAutoComplete.test.tsx +6 -2
  42. package/src/PickerSelect.test.tsx +265 -0
  43. package/src/PickerSelect.tsx +24 -8
  44. package/src/Signature.native.tsx +147 -30
  45. package/src/Signature.test.tsx +2 -49
  46. package/src/Signature.tsx +128 -22
  47. package/src/SignatureField.test.tsx +0 -9
  48. package/src/SplitPage.test.tsx +299 -43
  49. package/src/TapToEdit.test.tsx +46 -0
  50. package/src/TapToEdit.tsx +1 -1
  51. package/src/ToastNotifications.test.tsx +748 -1
  52. package/src/Tooltip.test.tsx +707 -1
  53. package/src/WebAddressAutocomplete.test.tsx +99 -0
  54. package/src/WebDropdownMenu.test.tsx +28 -2
  55. package/src/__snapshots__/Banner.test.tsx.snap +125 -0
  56. package/src/__snapshots__/CustomSelectField.test.tsx.snap +5 -4
  57. package/src/__snapshots__/DataTable.test.tsx.snap +366 -0
  58. package/src/__snapshots__/Field.test.tsx.snap +377 -0
  59. package/src/__snapshots__/MarkdownView.test.tsx.snap +284 -74
  60. package/src/__snapshots__/PickerSelect.test.tsx.snap +5 -4
  61. package/src/__snapshots__/SegmentedControl.test.tsx.snap +9 -0
  62. package/src/__snapshots__/SelectField.test.tsx.snap +5 -4
  63. package/src/__snapshots__/Signature.test.tsx.snap +13 -3
  64. package/src/__snapshots__/SignatureField.test.tsx.snap +10 -3
  65. package/src/__snapshots__/SplitPage.test.tsx.snap +698 -46
  66. package/src/bunSetup.ts +0 -19
  67. package/src/index.tsx +1 -1
  68. package/src/login/LoginScreen.test.tsx +12 -0
  69. package/src/useConsentHistory.test.ts +20 -13
  70. package/src/useConsentHistory.ts +7 -2
package/src/bunSetup.ts CHANGED
@@ -548,21 +548,6 @@ mock.module("@react-native-async-storage/async-storage", () => ({
548
548
  setItem: mock(() => Promise.resolve()),
549
549
  }));
550
550
 
551
- // Mock react-native-signature-canvas
552
- mock.module("react-native-signature-canvas", () => ({
553
- Signature: mock(() => null),
554
- }));
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
551
  // Mock react-native-portalize. The real `Host` wraps children in an extra View
567
552
  // whose presence makes snapshots brittle, and individual tests already mock
568
553
  // this to render inline; hoisting the mock to setup keeps test ordering from
@@ -1189,10 +1174,6 @@ mock.module("react-native/Libraries/vendor/core/ErrorUtils", () => ({
1189
1174
  },
1190
1175
  }));
1191
1176
 
1192
- mock.module("react-native/Libraries/Core/ReactNativeVersion", () => ({
1193
- version: {major: 0, minor: 81, patch: 5},
1194
- }));
1195
-
1196
1177
  mock.module("react-native/Libraries/Core/NativeExceptionsManager", () => ({
1197
1178
  default: null,
1198
1179
  }));
package/src/index.tsx CHANGED
@@ -8,7 +8,7 @@ export * from "./AiSuggestionBox";
8
8
  export * from "./AttachmentPreview";
9
9
  export * from "./Avatar";
10
10
  export * from "./Badge";
11
- export * from "./Banner";
11
+ export {Banner, hideBanner} from "./Banner";
12
12
  export * from "./Body";
13
13
  export * from "./BooleanField";
14
14
  export * from "./Box";
@@ -131,6 +131,18 @@ describe("LoginScreen", () => {
131
131
  expect(queryByTestId("login-screen-signup-link")).toBeNull();
132
132
  });
133
133
 
134
+ it("calls onSubmit when submit button is pressed and fields filled", async () => {
135
+ const onSubmit = mock(() => Promise.resolve());
136
+ const {getByTestId} = renderWithTheme(
137
+ <LoginScreen fields={defaultFields} onSubmit={onSubmit} />
138
+ );
139
+ fireEvent.changeText(getByTestId("login-screen-email-input"), "user@test.com");
140
+ fireEvent.changeText(getByTestId("login-screen-password-input"), "secret123");
141
+ fireEvent.press(getByTestId("login-screen-submit-button"));
142
+ await new Promise((r) => setTimeout(r, 600));
143
+ expect(onSubmit).toHaveBeenCalled();
144
+ });
145
+
134
146
  it("renders correctly with all props", () => {
135
147
  const {toJSON} = renderWithTheme(
136
148
  <LoginScreen
@@ -25,17 +25,22 @@ describe("useConsentHistory", () => {
25
25
  refetch,
26
26
  }));
27
27
  const api = {
28
- injectEndpoints: mock((opts: MockInjectOpts) => {
29
- const build = {
30
- query: mock((def: MockQueryDef) => {
31
- // Exercise the URL builder so the closure captures `base`
32
- const url = def.query();
33
- expect(url).toContain("/consents/my");
34
- return "my-consents-query";
28
+ enhanceEndpoints: mock((opts: {addTagTypes: string[]}) => {
29
+ expect(opts.addTagTypes).toContain("MyConsents");
30
+ return {
31
+ injectEndpoints: mock((injectOpts: MockInjectOpts) => {
32
+ const build = {
33
+ query: mock((def: MockQueryDef) => {
34
+ // Exercise the URL builder so the closure captures `base`
35
+ const url = def.query();
36
+ expect(url).toContain("/consents/my");
37
+ return "my-consents-query";
38
+ }),
39
+ };
40
+ injectOpts.endpoints(build);
41
+ return {useGetMyConsentsQuery};
35
42
  }),
36
43
  };
37
- opts.endpoints(build);
38
- return {useGetMyConsentsQuery};
39
44
  }),
40
45
  };
41
46
  return {api, refetch};
@@ -84,10 +89,12 @@ describe("useConsentHistory", () => {
84
89
  refetch,
85
90
  }));
86
91
  const api = {
87
- injectEndpoints: () => {
88
- injectCallCount += 1;
89
- return {useGetMyConsentsQuery};
90
- },
92
+ enhanceEndpoints: () => ({
93
+ injectEndpoints: () => {
94
+ injectCallCount += 1;
95
+ return {useGetMyConsentsQuery};
96
+ },
97
+ }),
91
98
  };
92
99
  const {rerender} = renderHook(() => useConsentHistory(api as unknown as ConsentHistoryApi));
93
100
  rerender(undefined);
@@ -39,13 +39,17 @@ interface ConsentHistoryEnhancedApi {
39
39
  useGetMyConsentsQuery: () => ConsentHistoryHookState;
40
40
  }
41
41
 
42
- interface ConsentHistoryApi {
42
+ interface ConsentHistoryApiWithTags {
43
43
  injectEndpoints: (options: {
44
44
  endpoints: (build: ConsentHistoryQueryBuilder) => {getMyConsents: unknown};
45
45
  overrideExisting: boolean;
46
46
  }) => ConsentHistoryEnhancedApi;
47
47
  }
48
48
 
49
+ interface ConsentHistoryApi {
50
+ enhanceEndpoints: (options: {addTagTypes: string[]}) => ConsentHistoryApiWithTags;
51
+ }
52
+
49
53
  /**
50
54
  * Cache the enhanced api per (api, baseUrl). `injectEndpoints` logs a console
51
55
  * error in development whenever an endpoint with the same name is re-injected
@@ -65,7 +69,8 @@ const getEnhancedApi = (api: ConsentHistoryApi, base: string): ConsentHistoryEnh
65
69
  if (cached) {
66
70
  return cached;
67
71
  }
68
- const enhanced = api.injectEndpoints({
72
+ const apiWithConsentTags = api.enhanceEndpoints({addTagTypes: ["MyConsents"]});
73
+ const enhanced = apiWithConsentTags.injectEndpoints({
69
74
  endpoints: (build) => ({
70
75
  getMyConsents: build.query({
71
76
  providesTags: ["MyConsents"],