@terreno/ui 0.31.0 → 56.0.0-beta.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 (133) hide show
  1. package/LICENSE +203 -21
  2. package/dist/ActionSheet.d.ts +1 -1
  3. package/dist/Avatar.js +1 -4
  4. package/dist/Avatar.js.map +1 -1
  5. package/dist/Box.js +45 -9
  6. package/dist/Box.js.map +1 -1
  7. package/dist/Common.d.ts +21 -39
  8. package/dist/Common.js.map +1 -1
  9. package/dist/ConflictSheet.d.ts +53 -0
  10. package/dist/ConflictSheet.js +132 -0
  11. package/dist/ConflictSheet.js.map +1 -0
  12. package/dist/DateTimeActionSheet.d.ts +2 -1
  13. package/dist/DecimalRangeActionSheet.d.ts +1 -1
  14. package/dist/EmojiSelector.d.ts +1 -1
  15. package/dist/ErrorPage.d.ts +1 -1
  16. package/dist/HeightActionSheet.d.ts +1 -1
  17. package/dist/Hyperlink.d.ts +2 -1
  18. package/dist/Hyperlink.js +2 -1
  19. package/dist/Hyperlink.js.map +1 -1
  20. package/dist/Image.d.ts +1 -1
  21. package/dist/ImageBackground.d.ts +1 -1
  22. package/dist/MobileAddressAutoComplete.d.ts +1 -1
  23. package/dist/NumberPickerActionSheet.d.ts +1 -1
  24. package/dist/Page.d.ts +3 -3
  25. package/dist/PickerSelect.d.ts +1 -1
  26. package/dist/SidebarNavigation.js +1 -1
  27. package/dist/SidebarNavigation.js.map +1 -1
  28. package/dist/SidebarNavigation.native.js +1 -1
  29. package/dist/SidebarNavigation.native.js.map +1 -1
  30. package/dist/SplitPage.d.ts +1 -1
  31. package/dist/SplitPage.js +1 -4
  32. package/dist/SplitPage.js.map +1 -1
  33. package/dist/SplitPage.native.d.ts +1 -1
  34. package/dist/SyncStatusBanner.d.ts +46 -0
  35. package/dist/SyncStatusBanner.js +29 -0
  36. package/dist/SyncStatusBanner.js.map +1 -0
  37. package/dist/Theme.d.ts +1 -1
  38. package/dist/Theme.js +0 -1
  39. package/dist/Theme.js.map +1 -1
  40. package/dist/Toast.d.ts +9 -1
  41. package/dist/Toast.js +20 -7
  42. package/dist/Toast.js.map +1 -1
  43. package/dist/ToastNotifications.js +23 -1
  44. package/dist/ToastNotifications.js.map +1 -1
  45. package/dist/UnifiedAddressAutoComplete.d.ts +1 -1
  46. package/dist/Unifier.js +1 -1
  47. package/dist/Unifier.js.map +1 -1
  48. package/dist/conflictFieldDiff.d.ts +14 -0
  49. package/dist/conflictFieldDiff.js +62 -0
  50. package/dist/conflictFieldDiff.js.map +1 -0
  51. package/dist/icons/OfflineIcon.d.ts +1 -1
  52. package/dist/icons/OnlineIcon.d.ts +1 -1
  53. package/dist/icons/OutOfficeIcon.d.ts +1 -1
  54. package/dist/index.d.ts +5 -3
  55. package/dist/index.js +5 -3
  56. package/dist/index.js.map +1 -1
  57. package/dist/pdfHtmlTemplate.d.ts +30 -0
  58. package/dist/pdfHtmlTemplate.js +170 -0
  59. package/dist/pdfHtmlTemplate.js.map +1 -0
  60. package/dist/table/TableTitle.js +1 -3
  61. package/dist/table/TableTitle.js.map +1 -1
  62. package/dist/useAppLaunchOrForeground.d.ts +9 -0
  63. package/dist/useAppLaunchOrForeground.js +27 -0
  64. package/dist/useAppLaunchOrForeground.js.map +1 -0
  65. package/package.json +45 -39
  66. package/src/ActionSheet.test.tsx +37 -80
  67. package/src/Box.test.tsx +39 -9
  68. package/src/Box.tsx +46 -7
  69. package/src/Common.ts +21 -50
  70. package/src/ConflictSheet.test.tsx +461 -0
  71. package/src/ConflictSheet.tsx +399 -0
  72. package/src/ConsentNavigator.test.tsx +8 -6
  73. package/src/DateTimeField.test.tsx +0 -36
  74. package/src/Hyperlink.tsx +1 -1
  75. package/src/PickerSelect.test.tsx +12 -23
  76. package/src/SidebarNavigation.native.tsx +1 -1
  77. package/src/SidebarNavigation.tsx +1 -1
  78. package/src/SyncStatusBanner.test.tsx +204 -0
  79. package/src/SyncStatusBanner.tsx +148 -0
  80. package/src/TerrenoProvider.test.tsx +3 -4
  81. package/src/Theme.tsx +0 -1
  82. package/src/Toast.test.tsx +60 -0
  83. package/src/Toast.tsx +46 -1
  84. package/src/ToastNotifications.test.tsx +82 -0
  85. package/src/ToastNotifications.tsx +25 -1
  86. package/src/Unifier.ts +1 -1
  87. package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +0 -3
  88. package/src/__snapshots__/Body.test.tsx.snap +0 -16
  89. package/src/__snapshots__/Box.test.tsx.snap +4 -13
  90. package/src/__snapshots__/Card.test.tsx.snap +0 -1
  91. package/src/__snapshots__/Page.test.tsx.snap +0 -84
  92. package/src/__snapshots__/SplitPage.test.tsx.snap +24 -120
  93. package/src/__snapshots__/TapToEdit.test.tsx.snap +5 -16
  94. package/src/__snapshots__/Toast.test.tsx.snap +4 -2
  95. package/src/bunSetup.ts +21 -6
  96. package/src/conflictFieldDiff.test.ts +26 -0
  97. package/src/conflictFieldDiff.ts +78 -0
  98. package/src/index.tsx +5 -3
  99. package/src/login/__snapshots__/LoginScreen.test.tsx.snap +0 -9
  100. package/src/pdfHtmlTemplate.ts +219 -0
  101. package/src/signUp/__snapshots__/OAuthButtons.test.tsx.snap +0 -1
  102. package/src/signUp/__snapshots__/PasswordRequirements.test.tsx.snap +2 -16
  103. package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +1 -17
  104. package/src/signUp/__snapshots__/Swiper.test.tsx.snap +0 -1
  105. package/src/table/__snapshots__/Table.test.tsx.snap +22 -87
  106. package/src/table/__snapshots__/TableHeader.test.tsx.snap +10 -50
  107. package/src/table/__snapshots__/TableHeaderCell.test.tsx.snap +10 -84
  108. package/src/table/__snapshots__/TableRow.test.tsx.snap +12 -77
  109. package/src/useAppLaunchOrForeground.test.tsx +54 -0
  110. package/src/useAppLaunchOrForeground.ts +30 -0
  111. package/dist/ConsentHistory.d.ts +0 -9
  112. package/dist/ConsentHistory.js +0 -70
  113. package/dist/ConsentHistory.js.map +0 -1
  114. package/dist/EditableCard.d.ts +0 -3
  115. package/dist/EditableCard.js +0 -23
  116. package/dist/EditableCard.js.map +0 -1
  117. package/dist/generateConsentHistoryPdf.d.ts +0 -2
  118. package/dist/generateConsentHistoryPdf.js +0 -185
  119. package/dist/generateConsentHistoryPdf.js.map +0 -1
  120. package/dist/useConsentHistory.d.ts +0 -63
  121. package/dist/useConsentHistory.js +0 -40
  122. package/dist/useConsentHistory.js.map +0 -1
  123. package/src/ConsentHistory.test.tsx +0 -224
  124. package/src/ConsentHistory.tsx +0 -249
  125. package/src/DraggableList.test.tsx +0 -377
  126. package/src/EditableCard.test.tsx +0 -69
  127. package/src/EditableCard.tsx +0 -73
  128. package/src/SidebarNavigation.test.tsx +0 -339
  129. package/src/__snapshots__/EditableCard.test.tsx.snap +0 -242
  130. package/src/generateConsentHistoryPdf.test.ts +0 -253
  131. package/src/generateConsentHistoryPdf.ts +0 -211
  132. package/src/useConsentHistory.test.ts +0 -106
  133. package/src/useConsentHistory.ts +0 -94
@@ -0,0 +1,170 @@
1
+ import { DateTime } from "luxon";
2
+ import { Platform } from "react-native";
3
+ const escapeHtml = (text) => {
4
+ return text
5
+ .replace(/&/g, "&")
6
+ .replace(/</g, "&lt;")
7
+ .replace(/>/g, "&gt;")
8
+ .replace(/"/g, "&quot;");
9
+ };
10
+ const renderField = (field) => {
11
+ return `<tr>
12
+ <td class="field-label">${escapeHtml(field.label)}</td>
13
+ <td class="field-value">${escapeHtml(field.value)}</td>
14
+ </tr>`;
15
+ };
16
+ export const buildConsentPdfHtml = (data) => {
17
+ const now = DateTime.now().toLocaleString(DateTime.DATETIME_FULL);
18
+ const fieldsHtml = data.fields.map(renderField).join("\n");
19
+ const userInfoHtml = data.userInfo
20
+ ? `<div class="section">
21
+ <h2>User Information</h2>
22
+ <table>${renderField({ label: "User ID:", value: data.userInfo.userId })}
23
+ ${data.userInfo.name ? renderField({ label: "Name:", value: data.userInfo.name }) : ""}
24
+ ${data.userInfo.email ? renderField({ label: "Email:", value: data.userInfo.email }) : ""}
25
+ </table>
26
+ </div>`
27
+ : "";
28
+ const checkboxesHtml = data.checkboxes && data.checkboxes.length > 0
29
+ ? `<div class="section">
30
+ <h2>Checkbox Responses</h2>
31
+ ${data.checkboxes
32
+ .map((cb) => `<div class="checkbox-row">${cb.checked ? "&#9745;" : "&#9744;"} ${escapeHtml(cb.label)}</div>`)
33
+ .join("\n")}
34
+ </div>`
35
+ : "";
36
+ const auditTrailHtml = data.auditTrail && data.auditTrail.length > 0
37
+ ? `<div class="section">
38
+ <h2>Audit Trail</h2>
39
+ <table>${data.auditTrail.map(renderField).join("\n")}</table>
40
+ </div>`
41
+ : "";
42
+ const signatureHtml = data.signature
43
+ ? `<div class="section">
44
+ <h2>Signature</h2>
45
+ <img src="${escapeHtml(data.signature)}" class="signature-img" />
46
+ </div>`
47
+ : "";
48
+ const contentSnapshotHtml = data.contentSnapshot
49
+ ? `<div class="section">
50
+ <h2>Content Snapshot</h2>
51
+ <div class="content-snapshot">${escapeHtml(data.contentSnapshot)}</div>
52
+ </div>`
53
+ : "";
54
+ return `<!DOCTYPE html>
55
+ <html>
56
+ <head>
57
+ <meta charset="utf-8" />
58
+ <style>
59
+ body {
60
+ font-family: Helvetica, Arial, sans-serif;
61
+ margin: 0;
62
+ color: #000;
63
+ font-size: 10pt;
64
+ line-height: 1.4;
65
+ }
66
+ h1 {
67
+ font-size: 18pt;
68
+ margin: 0 0 4mm 0;
69
+ }
70
+ .form-title {
71
+ font-size: 14pt;
72
+ font-weight: normal;
73
+ margin: 0 0 6mm 0;
74
+ }
75
+ hr {
76
+ border: none;
77
+ border-top: 1px solid #c8c8c8;
78
+ margin: 4mm 0;
79
+ }
80
+ h2 {
81
+ font-size: 12pt;
82
+ margin: 6mm 0 4mm 0;
83
+ }
84
+ table {
85
+ border-collapse: collapse;
86
+ }
87
+ .field-label {
88
+ font-size: 9pt;
89
+ font-weight: bold;
90
+ color: #646464;
91
+ width: 45mm;
92
+ padding: 1mm 0;
93
+ vertical-align: top;
94
+ }
95
+ .field-value {
96
+ font-size: 10pt;
97
+ padding: 1mm 0;
98
+ }
99
+ .checkbox-row {
100
+ font-size: 10pt;
101
+ margin-left: 4mm;
102
+ padding: 1mm 0;
103
+ }
104
+ .signature-img {
105
+ width: 80mm;
106
+ height: 30mm;
107
+ object-fit: contain;
108
+ }
109
+ .content-snapshot {
110
+ font-size: 9pt;
111
+ color: #323232;
112
+ white-space: pre-wrap;
113
+ word-wrap: break-word;
114
+ }
115
+ .footer {
116
+ margin-top: 8mm;
117
+ border-top: 1px solid #c8c8c8;
118
+ padding-top: 3mm;
119
+ font-size: 8pt;
120
+ font-style: italic;
121
+ color: #969696;
122
+ display: flex;
123
+ justify-content: space-between;
124
+ }
125
+ .section {
126
+ margin-bottom: 4mm;
127
+ }
128
+ @page {
129
+ size: A4;
130
+ margin: 20mm;
131
+ }
132
+ </style>
133
+ </head>
134
+ <body>
135
+ <h1>${escapeHtml(data.title)}</h1>
136
+ <div class="form-title">${escapeHtml(data.formTitle)}</div>
137
+ <hr />
138
+
139
+ <div class="section">
140
+ <h2>Response Details</h2>
141
+ <table>${fieldsHtml}</table>
142
+ </div>
143
+
144
+ ${userInfoHtml}
145
+ ${checkboxesHtml}
146
+ ${auditTrailHtml}
147
+ ${signatureHtml}
148
+ ${contentSnapshotHtml}
149
+
150
+ <div class="footer">
151
+ <span>Generated ${escapeHtml(now)}</span>
152
+ ${data.responseId ? `<span>Response ID: ${escapeHtml(data.responseId)}</span>` : ""}
153
+ </div>
154
+ </body>
155
+ </html>`;
156
+ };
157
+ export const sharePdfFromHtml = async (options) => {
158
+ if (Platform.OS === "web") {
159
+ throw new Error("sharePdfFromHtml is only supported on mobile platforms");
160
+ }
161
+ const Print = await import("expo-print");
162
+ const Sharing = await import("expo-sharing");
163
+ const { uri } = await Print.printToFileAsync({ html: options.html });
164
+ await Sharing.shareAsync(uri, {
165
+ dialogTitle: options.filename,
166
+ mimeType: "application/pdf",
167
+ UTI: "com.adobe.pdf",
168
+ });
169
+ };
170
+ //# sourceMappingUR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;;;;;;;;;;;;;;;;;;;;;;;QAiFD,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;4BACF,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC;;;;;aAKzC,UAAU;;;IAGnB,YAAY;IACZ,cAAc;IACd,cAAc;IACd,aAAa;IACb,mBAAmB;;;sBAGD,UAAU,CAAC,GAAG,CAAC;MAC/B,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,sBAAsB,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;;;QAG/E,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,OAGtC,EAAiB,EAAE;IAClB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC;IAE7C,MAAM,EAAC,GAAG,EAAC,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAC,CAAC,CAAC;IAEjE,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE;QAC5B,WAAW,EAAE,OAAO,CAAC,QAAQ;QAC7B,QAAQ,EAAE,iBAAiB;QAC3B,GAAG,EAAE,eAAe;KACrB,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -3,9 +3,7 @@ import { Text } from "react-native";
3
3
  import { useTheme } from "../Theme";
4
4
  export const TableTitle = ({ title, align = "left" }) => {
5
5
  const { theme } = useTheme();
6
- return (
7
- // No hint needed for a title.
8
- _jsx(Text, { "aria-label": `Table title: ${title}`, "aria-role": "header", ellipsizeMode: "tail" // ensures that the text is clipped at the end of the line for all platforms
6
+ return (_jsx(Text, { "aria-label": `Table title: ${title}`, "aria-role": "header", ellipsizeMode: "tail" // ensures that the text is clipped at the end of the line for all platforms
9
7
  , numberOfLines: 3, style: {
10
8
  color: theme.text.primary,
11
9
  flexWrap: "wrap",
@@ -1 +1 @@
1
- {"version":3,"file":"TableTitle.js","sourceRoot":"","sources":["../../src/table/TableTitle.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAElC,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,EAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAC,EAAE,EAAE;IACzE,MAAM,EAAC,KAAK,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC3B,OAAO;IACL,8BAA8B;IAC9B,KAAC,IAAI,kBACS,gBAAgB,KAAK,EAAE,eACzB,QAAQ,EAClB,aAAa,EAAC,MAAM,CAAC,4EAA4E;UACjG,aAAa,EAAE,CAAC,EAChB,KAAK,EAAE;YACL,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO;YACzB,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,QAAQ;YAClB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,WAAW;SAC3B,YAEA,KAAK,GACD,CACR,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"TableTitle.js","sourceRoot":"","sources":["../../src/table/TableTitle.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAGlC,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAElC,MAAM,CAAC,MAAM,UAAU,GAAwB,CAAC,EAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAC,EAAE,EAAE;IACzE,MAAM,EAAC,KAAK,EAAC,GAAG,QAAQ,EAAE,CAAC;IAC3B,OAAO,CAEL,KAAC,IAAI,kBACS,gBAAgB,KAAK,EAAE,eACzB,QAAQ,EAClB,aAAa,EAAC,MAAM,CAAC,4EAA4E;UACjG,aAAa,EAAE,CAAC,EAChB,KAAK,EAAE;YACL,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO;YACzB,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,MAAM;YAClB,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,KAAK;YACjB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,QAAQ;YAClB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,WAAW;SAC3B,YAEA,KAAK,GACD,CACR,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Runs `onAppForeground` once on mount (app launch) and again every time the app returns to the
3
+ * foreground (AppState transitions to "active"). Useful for refetching data, revalidating auth, or
4
+ * kicking off a sync when the user comes back to the app.
5
+ *
6
+ * The callback is a dependency of the effect, so wrap it in `useCallback` in the caller to avoid
7
+ * re-subscribing on every render.
8
+ */
9
+ export declare const useAppLaunchOrForeground: (onAppForeground: () => void) => void;
@@ -0,0 +1,27 @@
1
+ import { useEffect } from "react";
2
+ import { AppState } from "react-native";
3
+ /**
4
+ * Runs `onAppForeground` once on mount (app launch) and again every time the app returns to the
5
+ * foreground (AppState transitions to "active"). Useful for refetching data, revalidating auth, or
6
+ * kicking off a sync when the user comes back to the app.
7
+ *
8
+ * The callback is a dependency of the effect, so wrap it in `useCallback` in the caller to avoid
9
+ * re-subscribing on every render.
10
+ */
11
+ export const useAppLaunchOrForeground = (onAppForeground) => {
12
+ // Run on app launch or whenever the app returns to the foreground.
13
+ useEffect(() => {
14
+ // Runs on app launch (mount).
15
+ onAppForeground();
16
+ const handleAppStateChange = (nextAppState) => {
17
+ if (nextAppState === "active") {
18
+ onAppForeground();
19
+ }
20
+ };
21
+ const subscription = AppState.addEventListener("change", handleAppStateChange);
22
+ return () => {
23
+ subscription.remove();
24
+ };
25
+ }, [onAppForeground]);
26
+ };
27
+ //# sourceMappingURL=useAppLaunchOrForeground.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppLaunchOrForeground.js","sourceRoot":"","sources":["../src/useAppLaunchOrForeground.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,QAAQ,EAAsB,MAAM,cAAc,CAAC;AAE3D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,eAA2B,EAAQ,EAAE;IAC5E,mEAAmE;IACnE,SAAS,CAAC,GAAG,EAAE;QACb,8BAA8B;QAC9B,eAAe,EAAE,CAAC;QAElB,MAAM,oBAAoB,GAAG,CAAC,YAA4B,EAAQ,EAAE;YAClE,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;gBAC9B,eAAe,EAAE,CAAC;YACpB,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,YAAY,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;QAE/E,OAAO,GAAS,EAAE;YAChB,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;AACxB,CAAC,CAAC"}
package/package.json CHANGED
@@ -23,32 +23,32 @@
23
23
  "@expo-google-fonts/nunito": "^0.4.2",
24
24
  "@expo-google-fonts/sacramento": "^0.4.1",
25
25
  "@expo-google-fonts/titillium-web": "^0.4.1",
26
- "@expo/vector-icons": "^15.0.3",
26
+ "@expo/vector-icons": "^15.1.1",
27
27
  "@react-native-async-storage/async-storage": "2.2.0",
28
28
  "@react-native-community/blur": "^4.4.0",
29
- "@react-native-community/datetimepicker": "8.6.0",
30
- "@react-native-community/slider": "5.0.1",
29
+ "@react-native-community/datetimepicker": "9.1.0",
30
+ "@react-native-community/slider": "5.2.0",
31
31
  "@react-native-picker/picker": "2.11.4",
32
32
  "@react-navigation/native": "^7.1.8",
33
- "@shopify/react-native-skia": "2.2.12",
33
+ "@shopify/react-native-skia": "2.6.2",
34
34
  "emoji-datasource": "^16.0.0",
35
- "expo-clipboard": "~8.0.8",
36
- "expo-document-picker": "~14.0.8",
37
- "expo-font": "~14.0.10",
38
- "expo-haptics": "~15.0.8",
39
- "expo-image-manipulator": "~14.0.8",
40
- "expo-image-picker": "~17.0.10",
41
- "expo-linear-gradient": "~15.0.8",
42
- "expo-linking": "~8.0.10",
43
- "expo-localization": "~17.0.8",
44
- "expo-notifications": "^0.32.15",
45
- "expo-router": "~6.0.19",
46
- "expo-splash-screen": "~31.0.12",
47
- "expo-updates": "^29.0.15",
48
- "expo-web-browser": "~15.0.10",
49
- "jspdf": "^4.2.0",
35
+ "expo-clipboard": "~56.0.4",
36
+ "expo-document-picker": "~56.0.4",
37
+ "expo-font": "~56.0.7",
38
+ "expo-haptics": "~56.0.3",
39
+ "expo-image-manipulator": "~56.0.19",
40
+ "expo-image-picker": "~56.0.18",
41
+ "expo-linear-gradient": "~56.0.4",
42
+ "expo-linking": "~56.0.14",
43
+ "expo-localization": "~56.0.6",
44
+ "expo-notifications": "~56.0.18",
45
+ "expo-print": "~56.0.4",
46
+ "expo-router": "~56.2.11",
47
+ "expo-sharing": "~56.0.18",
48
+ "expo-updates": "~56.0.19",
49
+ "expo-web-browser": "~56.0.5",
50
50
  "libphonenumber-js": "^1.13.8",
51
- "linkify-it": "^5.0.0",
51
+ "linkify-it": "^5.0.2",
52
52
  "lodash": "^4.18.1",
53
53
  "luxon": "^3.7.2",
54
54
  "pressto": "^0.6.1",
@@ -56,31 +56,31 @@
56
56
  "react-date-picker": "^12.0.1",
57
57
  "react-datetime-picker": "^7.0.1",
58
58
  "react-dev-utils": "^12.0.1",
59
- "react-dom": "19.1.0",
59
+ "react-dom": "19.2.3",
60
60
  "react-keyed-flatten-children": "^5.1.1",
61
- "react-native": "0.81.5",
61
+ "react-native": "0.85.3",
62
62
  "react-native-actions-sheet": "^0.9.3",
63
63
  "react-native-calendars": "^1.1312.1",
64
64
  "react-native-drawer-layout": "4.2.0",
65
- "react-native-gesture-handler": "~2.28.0",
65
+ "react-native-gesture-handler": "~2.31.1",
66
66
  "react-native-google-places-autocomplete": "^2.6.4",
67
67
  "react-native-markdown-display": "^7.0.2",
68
68
  "react-native-modalize": "^2.1.1",
69
69
  "react-native-permissions": "^5.4.4",
70
70
  "react-native-picker-select": "^9.1.3",
71
71
  "react-native-portalize": "^1.0.7",
72
- "react-native-reanimated": "~4.1.1",
73
- "react-native-safe-area-context": "~5.6.0",
74
- "react-native-screens": "~4.16.0",
75
- "react-native-svg": "15.12.1",
72
+ "react-native-reanimated": "4.3.1",
73
+ "react-native-safe-area-context": "~5.7.0",
74
+ "react-native-screens": "4.25.2",
75
+ "react-native-svg": "15.15.4",
76
76
  "react-native-swiper-flatlist": "^3.2.5",
77
- "react-native-web": "~0.21.0",
78
- "react-native-webview": "13.15.0",
77
+ "react-native-web": "^0.21.2",
78
+ "react-native-webview": "13.16.1",
79
79
  "react-time-picker": "^8.0.2"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@biomejs/biome": "^2.3.6",
83
- "@expo/config-plugins": "~54.0.4",
83
+ "@expo/config-plugins": "~56.0.9",
84
84
  "@happy-dom/global-registrator": "^17.4.4",
85
85
  "@testing-library/react-native": "^13.2.0",
86
86
  "@types/bun": "^1.3.8",
@@ -88,35 +88,41 @@
88
88
  "@types/luxon": "^3.7.1",
89
89
  "@types/mdurl": "^2.0.0",
90
90
  "@types/minimatch": "^6.0.0",
91
- "@types/react": "~19.1.10",
91
+ "@types/react": "~19.2.14",
92
92
  "@types/react-datetime-picker": "^5.0.0",
93
93
  "@types/react-time-picker": "^6.0.0",
94
94
  "babel-preset-react-app": "^10.0.1",
95
- "expo-modules-core": "~3.0.29",
95
+ "expo-modules-core": "~56.0.17",
96
96
  "mdurl": "^2.0.0",
97
97
  "prettier": "^3.3.3",
98
- "react": "19.1.0",
98
+ "react": "19.2.3",
99
99
  "react-router": "^6.26.2",
100
100
  "react-router-dom": "^6.30.1",
101
- "react-test-renderer": "19.1.0",
101
+ "react-test-renderer": "19.2.3",
102
102
  "tsc-watch": "^7.1.1",
103
103
  "typedoc": "^0.28.17",
104
- "typescript": "~5.9.2"
104
+ "typescript": "~6.0.3"
105
105
  },
106
106
  "files": [
107
- "LICENSE",
108
107
  "dist/**/*",
109
108
  "src/**/*",
110
109
  ".ai/**/*"
111
110
  ],
112
- "license": "MIT",
111
+ "license": "Apache-2.0",
113
112
  "main": "dist/index.js",
114
113
  "name": "@terreno/ui",
115
114
  "peerDependencies": {
116
- "react": "19.1.0",
115
+ "react": "19.2.3",
116
+ "react-dom": "^19.2.0",
117
+ "react-native": "~0.85.0",
117
118
  "react-router": "^6.26.2",
118
119
  "react-router-dom": "^6.30.1"
119
120
  },
121
+ "peerDependenciesMeta": {
122
+ "react-dom": {
123
+ "optional": true
124
+ }
125
+ },
120
126
  "prettier": {
121
127
  "arrowParens": "always",
122
128
  "bracketSpacing": false,
@@ -142,5 +148,5 @@
142
148
  "test:coverage": "TZ=America/New_York bun run ../scripts/check-coverage.ts",
143
149
  "types": "bun typedoc"
144
150
  },
145
- "version": "0.31.0"
151
+ "version": "56.0.0-beta.0"
146
152
  }
@@ -1,9 +1,9 @@
1
1
  // noExplicitAny: test mock typing
2
2
  // biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
3
- import {afterAll, afterEach, beforeAll, describe, expect, it, type Mock, mock} from "bun:test";
3
+ import {afterAll, afterEach, beforeAll, describe, expect, it, mock} from "bun:test";
4
4
  import {act, render} from "@testing-library/react-native";
5
- import {createRef, type RefObject} from "react";
6
- import {Animated, Dimensions, type KeyboardEvent, Text} from "react-native";
5
+ import {createRef} from "react";
6
+ import {Text} from "react-native";
7
7
 
8
8
  import {
9
9
  ActionSheet,
@@ -614,44 +614,6 @@ describe("ActionSheet", () => {
614
614
  });
615
615
 
616
616
  describe("_onKeyboardShow", () => {
617
- const timing = (Animated as unknown as {timing: Mock<(...args: never[]) => unknown>}).timing;
618
-
619
- /**
620
- * Focuses a field at `pageY` with a 40pt height and measures it synchronously, mirroring
621
- * how UIManager.measure calls back on a real device.
622
- */
623
- const withFocusedField = (pageY: number, run: () => void): void => {
624
- const {TextInput: MockTextInput, UIManager: MockUIManager} = require("react-native");
625
- const origState = MockTextInput.State;
626
- const origMeasure = MockUIManager.measure;
627
- MockTextInput.State = {currentlyFocusedField: () => 42};
628
- MockUIManager.measure = (
629
- _node: number,
630
- callback: (
631
- originX: number,
632
- originY: number,
633
- width: number,
634
- height: number,
635
- pageX: number,
636
- pageY: number
637
- ) => void
638
- ): void => {
639
- callback(0, 0, 100, 40, 0, pageY);
640
- };
641
- try {
642
- run();
643
- } finally {
644
- MockTextInput.State = origState;
645
- MockUIManager.measure = origMeasure;
646
- }
647
- };
648
-
649
- const showKeyboard = (ref: RefObject<ActionSheet | null>, keyboardHeight: number): void => {
650
- ref.current?._onKeyboardShow({
651
- endCoordinates: {height: keyboardHeight, screenX: 0, screenY: 500, width: 400},
652
- } as KeyboardEvent);
653
- };
654
-
655
617
  it("sets keyboard state to true and handles no focused field", () => {
656
618
  const ref = createRef<ActionSheet>();
657
619
  render(
@@ -666,16 +628,16 @@ describe("ActionSheet", () => {
666
628
  MockTextInput.State = {
667
629
  currentlyFocusedField: () => null,
668
630
  };
669
- const timingCallsBefore = timing.mock.calls.length;
670
631
  act(() => {
671
- showKeyboard(ref, 300);
632
+ (ref.current as any)._onKeyboardShow({
633
+ endCoordinates: {height: 300, screenX: 0, screenY: 500, width: 400},
634
+ });
672
635
  });
673
636
  expect(ref.current!.state.keyboard).toBe(true);
674
- expect(timing.mock.calls.length).toBe(timingCallsBefore);
675
637
  MockTextInput.State = origState;
676
638
  });
677
639
 
678
- it("does not animate when the focused field stays above the keyboard", () => {
640
+ it("handles keyboard show with focused field", () => {
679
641
  const ref = createRef<ActionSheet>();
680
642
  render(
681
643
  <ThemeProvider>
@@ -684,19 +646,26 @@ describe("ActionSheet", () => {
684
646
  </ActionSheet>
685
647
  </ThemeProvider>
686
648
  );
687
- const timingCallsBefore = timing.mock.calls.length;
688
- withFocusedField(400, () => {
689
- act(() => {
690
- showKeyboard(ref, 300);
649
+ const {TextInput: MockTextInput, UIManager: MockUIManager} = require("react-native");
650
+ const origState = MockTextInput.State;
651
+ const origMeasure = MockUIManager.measure;
652
+ MockTextInput.State = {
653
+ currentlyFocusedField: () => 42,
654
+ };
655
+ MockUIManager.measure = (_node: any, cb: any) => {
656
+ cb(0, 0, 100, 40, 0, 400);
657
+ };
658
+ act(() => {
659
+ (ref.current as any)._onKeyboardShow({
660
+ endCoordinates: {height: 300, screenX: 0, screenY: 500, width: 400},
691
661
  });
692
662
  });
693
663
  expect(ref.current!.state.keyboard).toBe(true);
694
- // windowHeight (896) - keyboardHeight (300) - (pageY (400) + fieldHeight (40)) = 156 above
695
- // the keyboard, so no animation is needed.
696
- expect(timing.mock.calls.length).toBe(timingCallsBefore);
664
+ MockTextInput.State = origState;
665
+ MockUIManager.measure = origMeasure;
697
666
  });
698
667
 
699
- it("animates the sheet up by the overlap when the keyboard covers the focused field", () => {
668
+ it("handles keyboard show with enough gap (no animation needed)", () => {
700
669
  const ref = createRef<ActionSheet>();
701
670
  render(
702
671
  <ThemeProvider>
@@ -705,35 +674,23 @@ describe("ActionSheet", () => {
705
674
  </ActionSheet>
706
675
  </ThemeProvider>
707
676
  );
708
- const timingCallsBefore = timing.mock.calls.length;
709
- withFocusedField(800, () => {
710
- act(() => {
711
- showKeyboard(ref, 300);
712
- });
713
- });
714
- const {height: windowHeight} = Dimensions.get("window");
715
- const gap = windowHeight - 300 - (800 + 40);
716
- expect(timing.mock.calls.length).toBe(timingCallsBefore + 1);
717
- expect(timing.mock.calls[timingCallsBefore][1].toValue).toBe(gap - 10);
718
- });
719
-
720
- it("shifts by the keyboard height instead of the overlap in position keyboard mode", () => {
721
- const ref = createRef<ActionSheet>();
722
- render(
723
- <ThemeProvider>
724
- <ActionSheet keyboardMode="position" ref={ref}>
725
- <Text>Content</Text>
726
- </ActionSheet>
727
- </ThemeProvider>
728
- );
729
- const timingCallsBefore = timing.mock.calls.length;
730
- withFocusedField(800, () => {
731
- act(() => {
732
- showKeyboard(ref, 300);
677
+ const {TextInput: MockTextInput, UIManager: MockUIManager} = require("react-native");
678
+ const origState = MockTextInput.State;
679
+ const origMeasure = MockUIManager.measure;
680
+ MockTextInput.State = {
681
+ currentlyFocusedField: () => 42,
682
+ };
683
+ MockUIManager.measure = (_node: any, cb: any) => {
684
+ cb(0, 0, 100, 40, 0, 100);
685
+ };
686
+ act(() => {
687
+ (ref.current as any)._onKeyboardShow({
688
+ endCoordinates: {height: 100, screenX: 0, screenY: 500, width: 400},
733
689
  });
734
690
  });
735
- expect(timing.mock.calls.length).toBe(timingCallsBefore + 1);
736
- expect(timing.mock.calls[timingCallsBefore][1].toValue).toBe(-(300 + 15));
691
+ expect(ref.current!.state.keyboard).toBe(true);
692
+ MockTextInput.State = origState;
693
+ MockUIManager.measure = origMeasure;
737
694
  });
738
695
  });
739
696
 
package/src/Box.test.tsx CHANGED
@@ -502,6 +502,36 @@ describe("Box", () => {
502
502
  expect(root).toBeTruthy();
503
503
  // Just verify the component renders without error when onScroll is provided
504
504
  });
505
+
506
+ // Behavior props leaking into style reach the native view as unserializable
507
+ // values: a ref object in style is cyclical (host instance points back at the
508
+ // node) and gets dev-frozen, so React throws when detaching it on unmount.
509
+ it("should keep behavior props out of the ScrollView style", () => {
510
+ const scrollRef = React.createRef<any>();
511
+ const {root} = renderWithTheme(
512
+ <Box onScroll={mock(() => {})} scroll scrollRef={scrollRef}>
513
+ <Text>Scrollable</Text>
514
+ </Box>
515
+ );
516
+
517
+ const scrollView = root.findByType("ScrollView" as any);
518
+ expect(scrollView.props.style).not.toHaveProperty("scrollRef");
519
+ expect(scrollView.props.style).not.toHaveProperty("scroll");
520
+ expect(scrollView.props.style).not.toHaveProperty("onScroll");
521
+ expect(scrollView.props.style).not.toHaveProperty("testID");
522
+ });
523
+
524
+ it("should keep behavior props out of the View style", () => {
525
+ const {root} = renderWithTheme(
526
+ <Box avoidKeyboard keyboardOffset={12} onLayout={mock(() => {})} testID="behavior-box" />
527
+ );
528
+
529
+ const view = root.findByType("View");
530
+ expect(view.props.style).not.toHaveProperty("onLayout");
531
+ expect(view.props.style).not.toHaveProperty("avoidKeyboard");
532
+ expect(view.props.style).not.toHaveProperty("keyboardOffset");
533
+ expect(view.props.style).not.toHaveProperty("testID");
534
+ });
505
535
  });
506
536
 
507
537
  describe("keyboard avoidance", () => {
@@ -601,12 +631,10 @@ describe("Box", () => {
601
631
  });
602
632
 
603
633
  describe("warnings", () => {
604
- it("should warn when using wrap and alignItems together", () => {
634
+ it("should not warn when using wrap and alignItems together", () => {
605
635
  const consoleSpy = spyOn(console, "warn").mockImplementation(() => {});
606
636
  renderWithTheme(<Box alignItems="center" wrap />);
607
- expect(consoleSpy).toHaveBeenCalledWith(
608
- "React Native doesn't support wrap and alignItems together."
609
- );
637
+ expect(consoleSpy).not.toHaveBeenCalled();
610
638
  consoleSpy.mockRestore();
611
639
  });
612
640
  });
@@ -807,11 +835,13 @@ describe("Box", () => {
807
835
  expect(view.props.style.height).toBe(84);
808
836
  });
809
837
 
810
- it("warns when wrap is combined with alignItems on native", () => {
811
- const warnSpy = spyOn(console, "warn").mockImplementation(() => {});
812
- renderWithTheme(<Box alignItems="center" wrap />);
813
- expect(warnSpy).toHaveBeenCalled();
814
- warnSpy.mockRestore();
838
+ it("keeps an explicit alignItems when combined with wrap", () => {
839
+ const {root} = renderWithTheme(<Box alignItems="center" wrap />);
840
+ const view = root.findByType("View");
841
+ expect(view.props.style).toMatchObject({
842
+ alignItems: "center",
843
+ flexWrap: "wrap",
844
+ });
815
845
  });
816
846
 
817
847
  it("applies dangerouslySetInlineStyle overrides", () => {