@terreno/ui 0.25.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.
Files changed (130) hide show
  1. package/.ai/guidelines/core.md +1 -0
  2. package/dist/ActionSheet.js.map +1 -1
  3. package/dist/AiSuggestionBox.js +1 -1
  4. package/dist/AiSuggestionBox.js.map +1 -1
  5. package/dist/Avatar.js +4 -1
  6. package/dist/Avatar.js.map +1 -1
  7. package/dist/BooleanField.js +2 -1
  8. package/dist/BooleanField.js.map +1 -1
  9. package/dist/Box.js +2 -0
  10. package/dist/Box.js.map +1 -1
  11. package/dist/Common.d.ts +7 -1
  12. package/dist/Common.js +1 -1
  13. package/dist/Common.js.map +1 -1
  14. package/dist/ConsentNavigator.js.map +1 -1
  15. package/dist/CustomSelectField.js +1 -1
  16. package/dist/CustomSelectField.js.map +1 -1
  17. package/dist/DateTimeField.js +4 -1
  18. package/dist/DateTimeField.js.map +1 -1
  19. package/dist/EmailField.js +1 -1
  20. package/dist/EmailField.js.map +1 -1
  21. package/dist/HeightField.js +3 -1
  22. package/dist/HeightField.js.map +1 -1
  23. package/dist/IconButton.js +10 -1
  24. package/dist/IconButton.js.map +1 -1
  25. package/dist/MarkdownEditorField.js +3 -1
  26. package/dist/MarkdownEditorField.js.map +1 -1
  27. package/dist/Modal.js +7 -2
  28. package/dist/Modal.js.map +1 -1
  29. package/dist/MultiselectField.js +2 -1
  30. package/dist/MultiselectField.js.map +1 -1
  31. package/dist/Page.js +1 -0
  32. package/dist/Page.js.map +1 -1
  33. package/dist/Permissions.d.ts +1 -1
  34. package/dist/Permissions.js +2 -2
  35. package/dist/Permissions.js.map +1 -1
  36. package/dist/SelectField.js +3 -1
  37. package/dist/SelectField.js.map +1 -1
  38. package/dist/SplitPage.js +3 -0
  39. package/dist/SplitPage.js.map +1 -1
  40. package/dist/SplitPage.native.js +2 -0
  41. package/dist/SplitPage.native.js.map +1 -1
  42. package/dist/TapToEdit.js +1 -0
  43. package/dist/TapToEdit.js.map +1 -1
  44. package/dist/TextField.js +3 -1
  45. package/dist/TextField.js.map +1 -1
  46. package/dist/ToastNotifications.js.map +1 -1
  47. package/dist/Unifier.js.map +1 -1
  48. package/dist/index.d.ts +8 -2
  49. package/dist/index.js +6 -2
  50. package/dist/index.js.map +1 -1
  51. package/dist/useSubmitConsent.d.ts +1 -1
  52. package/dist/useSubmitConsent.js +1 -1
  53. package/dist/useSubmitConsent.js.map +1 -1
  54. package/package.json +2 -2
  55. package/src/ActionSheet.test.tsx +1 -0
  56. package/src/ActionSheet.tsx +2 -0
  57. package/src/AiSuggestionBox.tsx +1 -1
  58. package/src/Avatar.tsx +4 -1
  59. package/src/Badge.test.tsx +1 -2
  60. package/src/BooleanField.tsx +2 -1
  61. package/src/Box.test.tsx +56 -0
  62. package/src/Box.tsx +4 -0
  63. package/src/Button.test.tsx +34 -0
  64. package/src/Common.ts +31 -1
  65. package/src/ConsentNavigator.test.tsx +1 -0
  66. package/src/ConsentNavigator.tsx +1 -0
  67. package/src/CustomSelectField.tsx +1 -1
  68. package/src/DataTable.test.tsx +1 -0
  69. package/src/DateTimeField.test.tsx +1 -0
  70. package/src/DateTimeField.tsx +4 -1
  71. package/src/EmailField.tsx +1 -1
  72. package/src/HeightField.tsx +3 -1
  73. package/src/IconButton.test.tsx +26 -0
  74. package/src/IconButton.tsx +10 -0
  75. package/src/MarkdownEditorField.tsx +3 -1
  76. package/src/Modal.test.tsx +261 -66
  77. package/src/Modal.tsx +7 -2
  78. package/src/ModalSheet.test.tsx +7 -6
  79. package/src/MultiselectField.tsx +2 -1
  80. package/src/Page.tsx +1 -0
  81. package/src/Permissions.ts +2 -2
  82. package/src/PickerSelect.test.tsx +1 -0
  83. package/src/SelectBadge.test.tsx +1 -2
  84. package/src/SelectField.tsx +3 -1
  85. package/src/Signature.test.tsx +52 -0
  86. package/src/SplitPage.native.tsx +2 -0
  87. package/src/SplitPage.test.tsx +6 -4
  88. package/src/SplitPage.tsx +3 -0
  89. package/src/TapToEdit.test.tsx +1 -0
  90. package/src/TapToEdit.tsx +2 -0
  91. package/src/Text.test.tsx +29 -0
  92. package/src/TextField.test.tsx +57 -1
  93. package/src/TextField.tsx +3 -1
  94. package/src/ToastNotifications.test.tsx +1 -0
  95. package/src/ToastNotifications.tsx +1 -0
  96. package/src/Tooltip.test.tsx +1 -1
  97. package/src/Unifier.ts +1 -0
  98. package/src/UpgradeRequiredScreen.test.tsx +40 -0
  99. package/src/UserInactivity.test.tsx +44 -1
  100. package/src/WebDropdownMenu.test.tsx +116 -1
  101. package/src/__snapshots__/DataTable.test.tsx.snap +0 -148
  102. package/src/__snapshots__/IconButton.test.tsx.snap +4 -0
  103. package/src/__snapshots__/InfoModalIcon.test.tsx.snap +255 -1088
  104. package/src/__snapshots__/Modal.test.tsx.snap +950 -1108
  105. package/src/bunSetup.ts +24 -0
  106. package/src/createWebPortal.test.tsx +17 -0
  107. package/src/index.tsx +18 -2
  108. package/src/types/react-native-swiper-flatlist.d.ts +1 -0
  109. package/src/useSubmitConsent.test.ts +2 -1
  110. package/src/useSubmitConsent.ts +2 -2
  111. package/dist/fieldElements/index.d.ts +0 -3
  112. package/dist/fieldElements/index.js +0 -4
  113. package/dist/fieldElements/index.js.map +0 -1
  114. package/dist/icons/index.d.ts +0 -5
  115. package/dist/icons/index.js +0 -6
  116. package/dist/icons/index.js.map +0 -1
  117. package/dist/login/index.d.ts +0 -2
  118. package/dist/login/index.js +0 -2
  119. package/dist/login/index.js.map +0 -1
  120. package/dist/signUp/index.d.ts +0 -6
  121. package/dist/signUp/index.js +0 -6
  122. package/dist/signUp/index.js.map +0 -1
  123. package/dist/testing/index.d.ts +0 -2
  124. package/dist/testing/index.js +0 -3
  125. package/dist/testing/index.js.map +0 -1
  126. package/src/fieldElements/index.tsx +0 -3
  127. package/src/icons/index.ts +0 -5
  128. package/src/login/index.ts +0 -2
  129. package/src/signUp/index.ts +0 -13
  130. package/src/testing/index.ts +0 -2
package/src/bunSetup.ts CHANGED
@@ -614,6 +614,30 @@ mock.module("./DateTimeActionSheet", () => ({
614
614
  DateTimeActionSheet: mock(() => null),
615
615
  }));
616
616
 
617
+ // Mock react-native-actions-sheet so the native Modal branch is testable. The real component
618
+ // defers rendering until opened via native animation (which react-test-renderer never triggers),
619
+ // so the mock tracks the imperative visibility state instead: it renders its children
620
+ // synchronously when opened via the ref (setModalVisible/show) and renders nothing when closed.
621
+ // This keeps opened content assertable while still letting tests verify the closed/hidden state.
622
+ mock.module("react-native-actions-sheet", () => ({
623
+ __esModule: true,
624
+ default: React.forwardRef(function ActionSheetMock(
625
+ {children}: {children?: React.ReactNode},
626
+ ref: React.Ref<unknown>
627
+ ) {
628
+ const [isVisible, setIsVisible] = React.useState(false);
629
+ React.useImperativeHandle(ref, () => ({
630
+ hide: () => setIsVisible(false),
631
+ setModalVisible: (visible?: boolean) => setIsVisible(Boolean(visible)),
632
+ show: () => setIsVisible(true),
633
+ }));
634
+ if (!isVisible) {
635
+ return null;
636
+ }
637
+ return React.createElement("ActionSheetMock", {}, children);
638
+ }),
639
+ }));
640
+
617
641
  // Mock MediaQuery
618
642
  mock.module("./MediaQuery", () => ({
619
643
  isMobileDevice: mock(() => false),
@@ -1,8 +1,25 @@
1
1
  import {describe, expect, it} from "bun:test";
2
+ import {assert} from "chai";
2
3
  import React from "react";
3
4
 
5
+ import {createWebPortal} from "./createWebPortal";
4
6
  import {createWebPortal as createNativePortal} from "./createWebPortal.native";
5
7
 
8
+ describe("createWebPortal (web)", () => {
9
+ it("creates a portal targeting the provided container", () => {
10
+ const container = {nodeType: 1} as unknown as Element;
11
+ const children = React.createElement("div", null, "web-content");
12
+
13
+ const portal = createWebPortal({children, container}) as unknown as {
14
+ children: unknown;
15
+ containerInfo: unknown;
16
+ };
17
+
18
+ assert.strictEqual(portal.children, children);
19
+ assert.strictEqual(portal.containerInfo, container);
20
+ });
21
+ });
22
+
6
23
  describe("createWebPortal (native)", () => {
7
24
  it("returns the children unchanged without creating a portal", () => {
8
25
  const container = {nodeType: 1} as unknown as Element;
package/src/index.tsx CHANGED
@@ -48,7 +48,8 @@ export * from "./ImageBackground";
48
48
  export * from "./InfoModalIcon";
49
49
  export * from "./InfoTooltipButton";
50
50
  export * from "./Link";
51
- export * from "./login";
51
+ export * from "./login/LoginScreen";
52
+ export type {LoginFieldConfig, LoginScreenProps} from "./login/loginTypes";
52
53
  export * from "./MarkdownEditor";
53
54
  export * from "./MarkdownEditorField";
54
55
  export * from "./MarkdownView";
@@ -80,7 +81,22 @@ export * from "./Slider";
80
81
  export * from "./SocialLoginButton";
81
82
  export * from "./Spinner";
82
83
  export * from "./SplitPage";
83
- export * from "./signUp";
84
+ export {OAuthButtons} from "./signUp/OAuthButtons";
85
+ export {PasswordRequirements} from "./signUp/PasswordRequirements";
86
+ export {
87
+ defaultPasswordRequirements,
88
+ simplePasswordRequirements,
89
+ } from "./signUp/passwordPresets";
90
+ export {SignUpScreen} from "./signUp/SignUpScreen";
91
+ export {Swiper} from "./signUp/Swiper";
92
+ export type {
93
+ OAuthProvider,
94
+ OAuthProviderConfig,
95
+ OnboardingPage,
96
+ PasswordRequirement,
97
+ SignUpFieldConfig,
98
+ SignUpScreenProps,
99
+ } from "./signUp/signUpTypes";
84
100
  export * from "./TapToEdit";
85
101
  export * from "./TerrenoProvider";
86
102
  export * from "./Text";
@@ -41,6 +41,7 @@ declare module "react-native-swiper-flatlist" {
41
41
  }
42
42
 
43
43
  export const SwiperFlatList: React.ForwardRefExoticComponent<
44
+ // noExplicitAny: declaration must use any for the generic to allow consumers to specify their data type without explicit type args
44
45
  // biome-ignore lint/suspicious/noExplicitAny: declaration must use any for the generic to allow consumers to specify their data type without explicit type args
45
46
  SwiperFlatListProps<any> & React.RefAttributes<SwiperFlatListRefProps>
46
47
  >;
@@ -64,7 +64,8 @@ describe("useSubmitConsent", () => {
64
64
  });
65
65
  expect(submitMutation).toHaveBeenCalled();
66
66
  expect(unwrap).toHaveBeenCalled();
67
- expect(response).toEqual({success: true});
67
+ // submit resolves to void; it awaits unwrap() internally and does not surface the payload.
68
+ expect(response).toBeUndefined();
68
69
  });
69
70
 
70
71
  it("uses empty baseUrl when none provided", () => {
@@ -88,8 +88,8 @@ export const useSubmitConsent = (api: SubmitConsentApi, baseUrl?: string) => {
88
88
  const [submitMutation, {isLoading: isSubmitting, error}] =
89
89
  enhancedApi.useSubmitConsentResponseMutation();
90
90
 
91
- const submit = async (body: SubmitConsentBody) => {
92
- return submitMutation(body).unwrap();
91
+ const submit = async (body: SubmitConsentBody): Promise<void> => {
92
+ await submitMutation(body).unwrap();
93
93
  };
94
94
 
95
95
  return {error, isSubmitting, submit};
@@ -1,3 +0,0 @@
1
- export * from "./FieldError";
2
- export * from "./FieldHelperText";
3
- export * from "./FieldTitle";
@@ -1,4 +0,0 @@
1
- export * from "./FieldError";
2
- export * from "./FieldHelperText";
3
- export * from "./FieldTitle";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fieldElements/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from "./MobileIcon";
2
- export * from "./OfflineIcon";
3
- export * from "./OnlineIcon";
4
- export * from "./OutOfficeIcon";
5
- export * from "./SparklesIcon";
@@ -1,6 +0,0 @@
1
- export * from "./MobileIcon";
2
- export * from "./OfflineIcon";
3
- export * from "./OnlineIcon";
4
- export * from "./OutOfficeIcon";
5
- export * from "./SparklesIcon";
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/icons/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -1,2 +0,0 @@
1
- export { LoginScreen } from "./LoginScreen";
2
- export type { LoginFieldConfig, LoginScreenProps } from "./loginTypes";
@@ -1,2 +0,0 @@
1
- export { LoginScreen } from "./LoginScreen";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC"}
@@ -1,6 +0,0 @@
1
- export { OAuthButtons } from "./OAuthButtons";
2
- export { PasswordRequirements } from "./PasswordRequirements";
3
- export { defaultPasswordRequirements, simplePasswordRequirements } from "./passwordPresets";
4
- export { SignUpScreen } from "./SignUpScreen";
5
- export { Swiper } from "./Swiper";
6
- export type { OAuthProvider, OAuthProviderConfig, OnboardingPage, PasswordRequirement, SignUpFieldConfig, SignUpScreenProps, } from "./signUpTypes";
@@ -1,6 +0,0 @@
1
- export { OAuthButtons } from "./OAuthButtons";
2
- export { PasswordRequirements } from "./PasswordRequirements";
3
- export { defaultPasswordRequirements, simplePasswordRequirements } from "./passwordPresets";
4
- export { SignUpScreen } from "./SignUpScreen";
5
- export { Swiper } from "./Swiper";
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signUp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,2BAA2B,EAAE,0BAA0B,EAAC,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./resolveTestId";
2
- export * from "./types";
@@ -1,3 +0,0 @@
1
- export * from "./resolveTestId";
2
- export * from "./types";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./FieldError";
2
- export * from "./FieldHelperText";
3
- export * from "./FieldTitle";
@@ -1,5 +0,0 @@
1
- export * from "./MobileIcon";
2
- export * from "./OfflineIcon";
3
- export * from "./OnlineIcon";
4
- export * from "./OutOfficeIcon";
5
- export * from "./SparklesIcon";
@@ -1,2 +0,0 @@
1
- export {LoginScreen} from "./LoginScreen";
2
- export type {LoginFieldConfig, LoginScreenProps} from "./loginTypes";
@@ -1,13 +0,0 @@
1
- export {OAuthButtons} from "./OAuthButtons";
2
- export {PasswordRequirements} from "./PasswordRequirements";
3
- export {defaultPasswordRequirements, simplePasswordRequirements} from "./passwordPresets";
4
- export {SignUpScreen} from "./SignUpScreen";
5
- export {Swiper} from "./Swiper";
6
- export type {
7
- OAuthProvider,
8
- OAuthProviderConfig,
9
- OnboardingPage,
10
- PasswordRequirement,
11
- SignUpFieldConfig,
12
- SignUpScreenProps,
13
- } from "./signUpTypes";
@@ -1,2 +0,0 @@
1
- export * from "./resolveTestId";
2
- export * from "./types";