@terreno/ui 57.18.0 → 57.20.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 (361) hide show
  1. package/.ai/guidelines/core.md +1 -1
  2. package/CHANGELOG.md +2074 -0
  3. package/dist/Accordion.d.ts.map +1 -1
  4. package/dist/Accordion.js +3 -3
  5. package/dist/Accordion.js.map +1 -1
  6. package/dist/AreaChart.d.ts.map +1 -1
  7. package/dist/AreaChart.js +2 -2
  8. package/dist/AreaChart.js.map +1 -1
  9. package/dist/Avatar.d.ts.map +1 -1
  10. package/dist/Avatar.js +3 -1
  11. package/dist/Avatar.js.map +1 -1
  12. package/dist/BarChart.d.ts.map +1 -1
  13. package/dist/BarChart.js +2 -2
  14. package/dist/BarChart.js.map +1 -1
  15. package/dist/Box.d.ts.map +1 -1
  16. package/dist/Box.js +66 -8
  17. package/dist/Box.js.map +1 -1
  18. package/dist/Card.d.ts.map +1 -1
  19. package/dist/Card.js +5 -4
  20. package/dist/Card.js.map +1 -1
  21. package/dist/ChartCard.d.ts.map +1 -1
  22. package/dist/ChartCard.js +4 -2
  23. package/dist/ChartCard.js.map +1 -1
  24. package/dist/Common.d.ts +240 -14
  25. package/dist/Common.d.ts.map +1 -1
  26. package/dist/Common.js.map +1 -1
  27. package/dist/ConsentFormScreen.d.ts +1 -1
  28. package/dist/ConsentFormScreen.d.ts.map +1 -1
  29. package/dist/ConsentFormScreen.js +13 -4
  30. package/dist/ConsentFormScreen.js.map +1 -1
  31. package/dist/DateTimeField.d.ts.map +1 -1
  32. package/dist/DateTimeField.js +5 -3
  33. package/dist/DateTimeField.js.map +1 -1
  34. package/dist/DonutChart.d.ts.map +1 -1
  35. package/dist/DonutChart.js +2 -2
  36. package/dist/DonutChart.js.map +1 -1
  37. package/dist/Field.d.ts.map +1 -1
  38. package/dist/Field.js +2 -0
  39. package/dist/Field.js.map +1 -1
  40. package/dist/FormContainer.d.ts +68 -0
  41. package/dist/FormContainer.d.ts.map +1 -0
  42. package/dist/FormContainer.js +79 -0
  43. package/dist/FormContainer.js.map +1 -0
  44. package/dist/GPTChat.d.ts.map +1 -1
  45. package/dist/GPTChat.js +2 -1
  46. package/dist/GPTChat.js.map +1 -1
  47. package/dist/Heading.d.ts +1 -1
  48. package/dist/Heading.d.ts.map +1 -1
  49. package/dist/Heading.js +5 -2
  50. package/dist/Heading.js.map +1 -1
  51. package/dist/Icon.d.ts +4 -0
  52. package/dist/Icon.d.ts.map +1 -1
  53. package/dist/Icon.js +43 -2
  54. package/dist/Icon.js.map +1 -1
  55. package/dist/LabeledCheckBox.d.ts +22 -0
  56. package/dist/LabeledCheckBox.d.ts.map +1 -0
  57. package/dist/LabeledCheckBox.js +30 -0
  58. package/dist/LabeledCheckBox.js.map +1 -0
  59. package/dist/LineChart.d.ts.map +1 -1
  60. package/dist/LineChart.js +2 -2
  61. package/dist/LineChart.js.map +1 -1
  62. package/dist/ListDetailLayout.d.ts +36 -0
  63. package/dist/ListDetailLayout.d.ts.map +1 -0
  64. package/dist/ListDetailLayout.js +153 -0
  65. package/dist/ListDetailLayout.js.map +1 -0
  66. package/dist/MarkdownEditor.d.ts.map +1 -1
  67. package/dist/MarkdownEditor.js +2 -1
  68. package/dist/MarkdownEditor.js.map +1 -1
  69. package/dist/MediaQuery.d.ts +1 -1
  70. package/dist/MediaQuery.d.ts.map +1 -1
  71. package/dist/MediaQuery.js +1 -1
  72. package/dist/MediaQuery.js.map +1 -1
  73. package/dist/OtpField.d.ts +60 -0
  74. package/dist/OtpField.d.ts.map +1 -0
  75. package/dist/OtpField.js +154 -0
  76. package/dist/OtpField.js.map +1 -0
  77. package/dist/Page.d.ts +1 -0
  78. package/dist/Page.d.ts.map +1 -1
  79. package/dist/Page.js +10 -1
  80. package/dist/Page.js.map +1 -1
  81. package/dist/ProvisionalConsentSigner.d.ts +21 -0
  82. package/dist/ProvisionalConsentSigner.d.ts.map +1 -0
  83. package/dist/ProvisionalConsentSigner.js +199 -0
  84. package/dist/ProvisionalConsentSigner.js.map +1 -0
  85. package/dist/ResponsiveBreakpoint.d.ts +5 -0
  86. package/dist/ResponsiveBreakpoint.d.ts.map +1 -1
  87. package/dist/ResponsiveBreakpoint.js +7 -0
  88. package/dist/ResponsiveBreakpoint.js.map +1 -1
  89. package/dist/Scorecard.d.ts.map +1 -1
  90. package/dist/Scorecard.js +5 -2
  91. package/dist/Scorecard.js.map +1 -1
  92. package/dist/Skeleton.d.ts +39 -0
  93. package/dist/Skeleton.d.ts.map +1 -0
  94. package/dist/Skeleton.js +195 -0
  95. package/dist/Skeleton.js.map +1 -0
  96. package/dist/SocialLoginButton.d.ts +10 -0
  97. package/dist/SocialLoginButton.d.ts.map +1 -1
  98. package/dist/SocialLoginButton.js +26 -8
  99. package/dist/SocialLoginButton.js.map +1 -1
  100. package/dist/SplitPage.d.ts +12 -1
  101. package/dist/SplitPage.d.ts.map +1 -1
  102. package/dist/SplitPage.js +14 -7
  103. package/dist/SplitPage.js.map +1 -1
  104. package/dist/SplitPage.native.d.ts +1 -1
  105. package/dist/SplitPage.native.d.ts.map +1 -1
  106. package/dist/SplitPage.native.js +6 -3
  107. package/dist/SplitPage.native.js.map +1 -1
  108. package/dist/SplitPageLoading.d.ts +14 -0
  109. package/dist/SplitPageLoading.d.ts.map +1 -0
  110. package/dist/SplitPageLoading.js +19 -0
  111. package/dist/SplitPageLoading.js.map +1 -0
  112. package/dist/SyncStatusBanner.d.ts +7 -1
  113. package/dist/SyncStatusBanner.d.ts.map +1 -1
  114. package/dist/SyncStatusBanner.js +20 -4
  115. package/dist/SyncStatusBanner.js.map +1 -1
  116. package/dist/Text.d.ts +3 -1
  117. package/dist/Text.d.ts.map +1 -1
  118. package/dist/Text.js +2 -0
  119. package/dist/Text.js.map +1 -1
  120. package/dist/TextField.d.ts.map +1 -1
  121. package/dist/TextField.js +44 -10
  122. package/dist/TextField.js.map +1 -1
  123. package/dist/charts/ChartFrame.d.ts +2 -2
  124. package/dist/charts/ChartFrame.d.ts.map +1 -1
  125. package/dist/charts/ChartFrame.js +9 -2
  126. package/dist/charts/ChartFrame.js.map +1 -1
  127. package/dist/fieldElements/FieldError.d.ts.map +1 -1
  128. package/dist/fieldElements/FieldError.js +1 -1
  129. package/dist/fieldElements/FieldError.js.map +1 -1
  130. package/dist/index.d.ts +21 -3
  131. package/dist/index.d.ts.map +1 -1
  132. package/dist/index.js +16 -1
  133. package/dist/index.js.map +1 -1
  134. package/dist/lazyBoundaries/heavyOptionalExports.d.ts +3 -0
  135. package/dist/lazyBoundaries/heavyOptionalExports.d.ts.map +1 -1
  136. package/dist/lazyBoundaries/heavyOptionalExports.js +2 -0
  137. package/dist/lazyBoundaries/heavyOptionalExports.js.map +1 -1
  138. package/dist/login/LastUsedBadge.d.ts +14 -0
  139. package/dist/login/LastUsedBadge.d.ts.map +1 -0
  140. package/dist/login/LastUsedBadge.js +23 -0
  141. package/dist/login/LastUsedBadge.js.map +1 -0
  142. package/dist/login/LoginAccountCard.d.ts +38 -0
  143. package/dist/login/LoginAccountCard.d.ts.map +1 -0
  144. package/dist/login/LoginAccountCard.js +72 -0
  145. package/dist/login/LoginAccountCard.js.map +1 -0
  146. package/dist/login/LoginAccountList.d.ts +33 -0
  147. package/dist/login/LoginAccountList.d.ts.map +1 -0
  148. package/dist/login/LoginAccountList.js +30 -0
  149. package/dist/login/LoginAccountList.js.map +1 -0
  150. package/dist/login/LoginScreen.d.ts +4 -4
  151. package/dist/login/LoginScreen.d.ts.map +1 -1
  152. package/dist/login/LoginScreen.js +294 -13
  153. package/dist/login/LoginScreen.js.map +1 -1
  154. package/dist/login/OutlinePill.d.ts +28 -0
  155. package/dist/login/OutlinePill.d.ts.map +1 -0
  156. package/dist/login/OutlinePill.js +48 -0
  157. package/dist/login/OutlinePill.js.map +1 -0
  158. package/dist/login/TwoFactorChallengeScreen.d.ts +26 -0
  159. package/dist/login/TwoFactorChallengeScreen.d.ts.map +1 -0
  160. package/dist/login/TwoFactorChallengeScreen.js +139 -0
  161. package/dist/login/TwoFactorChallengeScreen.js.map +1 -0
  162. package/dist/login/loginMethods.d.ts +27 -0
  163. package/dist/login/loginMethods.d.ts.map +1 -0
  164. package/dist/login/loginMethods.js +37 -0
  165. package/dist/login/loginMethods.js.map +1 -0
  166. package/dist/login/loginTypes.d.ts +202 -5
  167. package/dist/login/loginTypes.d.ts.map +1 -1
  168. package/dist/pdfHtmlTemplate.d.ts +17 -0
  169. package/dist/pdfHtmlTemplate.d.ts.map +1 -1
  170. package/dist/pdfHtmlTemplate.js +78 -0
  171. package/dist/pdfHtmlTemplate.js.map +1 -1
  172. package/dist/security/AccountSecurityScreen.d.ts +10 -0
  173. package/dist/security/AccountSecurityScreen.d.ts.map +1 -0
  174. package/dist/security/AccountSecurityScreen.js +50 -0
  175. package/dist/security/AccountSecurityScreen.js.map +1 -0
  176. package/dist/security/LinkedAccountsCard.d.ts +32 -0
  177. package/dist/security/LinkedAccountsCard.d.ts.map +1 -0
  178. package/dist/security/LinkedAccountsCard.js +145 -0
  179. package/dist/security/LinkedAccountsCard.js.map +1 -0
  180. package/dist/security/PasskeysCard.d.ts +39 -0
  181. package/dist/security/PasskeysCard.d.ts.map +1 -0
  182. package/dist/security/PasskeysCard.js +168 -0
  183. package/dist/security/PasskeysCard.js.map +1 -0
  184. package/dist/security/PasswordCard.d.ts +32 -0
  185. package/dist/security/PasswordCard.d.ts.map +1 -0
  186. package/dist/security/PasswordCard.js +198 -0
  187. package/dist/security/PasswordCard.js.map +1 -0
  188. package/dist/security/SessionsCard.d.ts +39 -0
  189. package/dist/security/SessionsCard.d.ts.map +1 -0
  190. package/dist/security/SessionsCard.js +168 -0
  191. package/dist/security/SessionsCard.js.map +1 -0
  192. package/dist/security/TwoFactorSettingsCard.d.ts +55 -0
  193. package/dist/security/TwoFactorSettingsCard.d.ts.map +1 -0
  194. package/dist/security/TwoFactorSettingsCard.js +458 -0
  195. package/dist/security/TwoFactorSettingsCard.js.map +1 -0
  196. package/dist/security/securityMethods.d.ts +40 -0
  197. package/dist/security/securityMethods.d.ts.map +1 -0
  198. package/dist/security/securityMethods.js +66 -0
  199. package/dist/security/securityMethods.js.map +1 -0
  200. package/dist/security/securityTypes.d.ts +467 -0
  201. package/dist/security/securityTypes.d.ts.map +1 -0
  202. package/dist/security/securityTypes.js +2 -0
  203. package/dist/security/securityTypes.js.map +1 -0
  204. package/dist/security/userAgent.d.ts +26 -0
  205. package/dist/security/userAgent.d.ts.map +1 -0
  206. package/dist/security/userAgent.js +80 -0
  207. package/dist/security/userAgent.js.map +1 -0
  208. package/dist/signUp/OAuthButtons.d.ts +28 -5
  209. package/dist/signUp/OAuthButtons.d.ts.map +1 -1
  210. package/dist/signUp/OAuthButtons.js +44 -5
  211. package/dist/signUp/OAuthButtons.js.map +1 -1
  212. package/dist/signUp/SignUpScreen.d.ts.map +1 -1
  213. package/dist/signUp/SignUpScreen.js +50 -5
  214. package/dist/signUp/SignUpScreen.js.map +1 -1
  215. package/dist/signUp/signUpTypes.d.ts +21 -1
  216. package/dist/signUp/signUpTypes.d.ts.map +1 -1
  217. package/dist/useConsentForms.d.ts +9 -0
  218. package/dist/useConsentForms.d.ts.map +1 -1
  219. package/dist/useConsentForms.js +18 -0
  220. package/dist/useConsentForms.js.map +1 -1
  221. package/dist/useProvisionalConsent.d.ts +124 -0
  222. package/dist/useProvisionalConsent.d.ts.map +1 -0
  223. package/dist/useProvisionalConsent.js +79 -0
  224. package/dist/useProvisionalConsent.js.map +1 -0
  225. package/dist/withLoading.d.ts +20 -0
  226. package/dist/withLoading.d.ts.map +1 -0
  227. package/dist/withLoading.js +24 -0
  228. package/dist/withLoading.js.map +1 -0
  229. package/package.json +4 -2
  230. package/src/Accordion.test.tsx +5 -0
  231. package/src/Accordion.tsx +3 -8
  232. package/src/AreaChart.test.tsx +15 -0
  233. package/src/AreaChart.tsx +6 -0
  234. package/src/Avatar.test.tsx +8 -0
  235. package/src/Avatar.tsx +2 -0
  236. package/src/BarChart.test.tsx +15 -0
  237. package/src/BarChart.tsx +6 -0
  238. package/src/Box.test.tsx +131 -1
  239. package/src/Box.tsx +77 -8
  240. package/src/Card.test.tsx +48 -0
  241. package/src/Card.tsx +13 -2
  242. package/src/ChartCard.test.tsx +30 -0
  243. package/src/ChartCard.tsx +18 -1
  244. package/src/Common.ts +263 -14
  245. package/src/ConsentFormScreen.test.tsx +84 -0
  246. package/src/ConsentFormScreen.tsx +28 -4
  247. package/src/DateTimeField.tsx +5 -3
  248. package/src/DonutChart.test.tsx +15 -0
  249. package/src/DonutChart.tsx +6 -0
  250. package/src/Field.tsx +2 -0
  251. package/src/FilePickerButton.test.tsx +35 -0
  252. package/src/FormContainer.test.tsx +242 -0
  253. package/src/FormContainer.tsx +177 -0
  254. package/src/GPTChat.test.tsx +16 -0
  255. package/src/GPTChat.tsx +8 -2
  256. package/src/Heading.test.tsx +14 -0
  257. package/src/Heading.tsx +6 -1
  258. package/src/Icon.test.tsx +52 -1
  259. package/src/Icon.tsx +92 -3
  260. package/src/IconButton.test.tsx +85 -0
  261. package/src/LabeledCheckBox.test.tsx +45 -0
  262. package/src/LabeledCheckBox.tsx +89 -0
  263. package/src/LineChart.test.tsx +18 -0
  264. package/src/LineChart.tsx +6 -0
  265. package/src/ListDetailLayout.tsx +247 -0
  266. package/src/MarkdownEditor.tsx +2 -1
  267. package/src/MediaQuery.ts +1 -0
  268. package/src/OtpField.test.tsx +280 -0
  269. package/src/OtpField.tsx +307 -0
  270. package/src/Page.test.tsx +38 -0
  271. package/src/Page.tsx +38 -19
  272. package/src/ProvisionalConsentSigner.test.tsx +625 -0
  273. package/src/ProvisionalConsentSigner.tsx +423 -0
  274. package/src/ResponsiveBreakpoint.test.tsx +7 -0
  275. package/src/ResponsiveBreakpoint.tsx +14 -0
  276. package/src/RootImportRegression.test.tsx +3 -0
  277. package/src/Scorecard.test.tsx +11 -0
  278. package/src/Scorecard.tsx +21 -0
  279. package/src/Skeleton.test.tsx +262 -0
  280. package/src/Skeleton.tsx +430 -0
  281. package/src/SocialLoginButton.test.tsx +14 -0
  282. package/src/SocialLoginButton.tsx +51 -7
  283. package/src/SplitPage.native.tsx +16 -3
  284. package/src/SplitPage.tsx +29 -12
  285. package/src/SplitPageLoading.test.tsx +51 -0
  286. package/src/SplitPageLoading.tsx +53 -0
  287. package/src/SyncStatusBanner.test.tsx +61 -4
  288. package/src/SyncStatusBanner.tsx +29 -3
  289. package/src/Text.tsx +4 -1
  290. package/src/TextField.test.tsx +150 -0
  291. package/src/TextField.tsx +66 -8
  292. package/src/__snapshots__/AddressField.test.tsx.snap +12 -0
  293. package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +15 -0
  294. package/src/__snapshots__/Avatar.test.tsx.snap +1 -0
  295. package/src/__snapshots__/CustomSelectField.test.tsx.snap +3 -0
  296. package/src/__snapshots__/EmailField.test.tsx.snap +6 -0
  297. package/src/__snapshots__/Field.test.tsx.snap +37 -0
  298. package/src/__snapshots__/HeightField.test.tsx.snap +2 -0
  299. package/src/__snapshots__/MobileAddressAutoComplete.test.tsx.snap +3 -0
  300. package/src/__snapshots__/NumberField.test.tsx.snap +3 -0
  301. package/src/__snapshots__/Page.test.tsx.snap +28 -5
  302. package/src/__snapshots__/PhoneNumberField.test.tsx.snap +12 -0
  303. package/src/__snapshots__/Slider.test.tsx.snap +1 -0
  304. package/src/__snapshots__/SocialLoginButton.test.tsx.snap +43 -22
  305. package/src/__snapshots__/SplitPage.test.tsx.snap +16 -0
  306. package/src/__snapshots__/TapToEdit.test.tsx.snap +3 -0
  307. package/src/__snapshots__/TextArea.test.tsx.snap +17 -1
  308. package/src/__snapshots__/TextField.test.tsx.snap +19 -2
  309. package/src/__snapshots__/TypedSignatureField.test.tsx.snap +3 -0
  310. package/src/__snapshots__/UnifiedAddressAutoComplete.test.tsx.snap +18 -0
  311. package/src/__snapshots__/WebAddressAutocomplete.test.tsx.snap +12 -0
  312. package/src/bunSetup.ts +13 -1
  313. package/src/charts/ChartFrame.tsx +19 -8
  314. package/src/fieldElements/FieldError.tsx +1 -0
  315. package/src/fieldElements/__snapshots__/FieldError.test.tsx.snap +2 -0
  316. package/src/index.tsx +44 -1
  317. package/src/isolated/ListDetailLayout.isolated.tsx +634 -0
  318. package/src/lazyBoundaries/heavyOptionalExports.tsx +7 -0
  319. package/src/login/LastUsedBadge.tsx +40 -0
  320. package/src/login/LoginAccountCard.tsx +205 -0
  321. package/src/login/LoginAccountList.tsx +115 -0
  322. package/src/login/LoginScreen.test.tsx +837 -1
  323. package/src/login/LoginScreen.tsx +674 -91
  324. package/src/login/OutlinePill.tsx +110 -0
  325. package/src/login/TwoFactorChallengeScreen.test.tsx +376 -0
  326. package/src/login/TwoFactorChallengeScreen.tsx +307 -0
  327. package/src/login/__snapshots__/LoginScreen.test.tsx.snap +1454 -334
  328. package/src/login/loginMethods.test.ts +53 -0
  329. package/src/login/loginMethods.ts +60 -0
  330. package/src/login/loginTypes.ts +208 -5
  331. package/src/pdfHtmlTemplate.test.ts +243 -4
  332. package/src/pdfHtmlTemplate.ts +93 -0
  333. package/src/security/AccountSecurityScreen.test.tsx +262 -0
  334. package/src/security/AccountSecurityScreen.tsx +156 -0
  335. package/src/security/LinkedAccountsCard.test.tsx +371 -0
  336. package/src/security/LinkedAccountsCard.tsx +297 -0
  337. package/src/security/PasskeysCard.test.tsx +378 -0
  338. package/src/security/PasskeysCard.tsx +371 -0
  339. package/src/security/PasswordCard.test.tsx +445 -0
  340. package/src/security/PasswordCard.tsx +342 -0
  341. package/src/security/SessionsCard.test.tsx +349 -0
  342. package/src/security/SessionsCard.tsx +362 -0
  343. package/src/security/TwoFactorSettingsCard.test.tsx +700 -0
  344. package/src/security/TwoFactorSettingsCard.tsx +872 -0
  345. package/src/security/securityMethods.test.ts +101 -0
  346. package/src/security/securityMethods.ts +104 -0
  347. package/src/security/securityTypes.ts +480 -0
  348. package/src/security/userAgent.test.ts +119 -0
  349. package/src/security/userAgent.ts +102 -0
  350. package/src/signUp/OAuthButtons.test.tsx +27 -0
  351. package/src/signUp/OAuthButtons.tsx +153 -19
  352. package/src/signUp/SignUpScreen.test.tsx +170 -1
  353. package/src/signUp/SignUpScreen.tsx +87 -25
  354. package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +22 -11
  355. package/src/signUp/signUpTypes.ts +23 -1
  356. package/src/useConsentForms.test.ts +37 -1
  357. package/src/useConsentForms.ts +25 -0
  358. package/src/useProvisionalConsent.test.ts +256 -0
  359. package/src/useProvisionalConsent.ts +218 -0
  360. package/src/withLoading.test.tsx +61 -0
  361. package/src/withLoading.tsx +50 -0
package/src/ChartCard.tsx CHANGED
@@ -5,9 +5,12 @@ import {Box} from "./Box";
5
5
  import {Card} from "./Card";
6
6
  import type {ChartCardProps} from "./Common";
7
7
  import {Heading} from "./Heading";
8
+ import {Skeleton} from "./Skeleton";
8
9
  import {Text} from "./Text";
9
10
  import {resolveTestID} from "./testing/resolveTestId";
10
11
 
12
+ const CHART_SKELETON_HEIGHT = 160;
13
+
11
14
  interface PeriodBadgeProps {
12
15
  label: string;
13
16
  onPress?: () => void;
@@ -44,6 +47,10 @@ const PeriodBadge: FC<PeriodBadgeProps> = ({label, onPress, testID}) => {
44
47
  export const ChartCard: FC<ChartCardProps> = ({
45
48
  children,
46
49
  filterSummary,
50
+ loading,
51
+ loadingAnimation,
52
+ loadingComponent,
53
+ loadingLabel,
47
54
  onPeriodPress,
48
55
  periodLabel,
49
56
  testID,
@@ -70,7 +77,17 @@ export const ChartCard: FC<ChartCardProps> = ({
70
77
  {filterSummary}
71
78
  </Text>
72
79
  ) : null}
73
- <Box minWidth={0} width="100%">
80
+ <Box
81
+ loading={loading}
82
+ loadingAnimation={loadingAnimation}
83
+ loadingComponent={
84
+ loadingComponent ?? <Skeleton height={CHART_SKELETON_HEIGHT} rounding="md" />
85
+ }
86
+ loadingLabel={loadingLabel}
87
+ minWidth={0}
88
+ testID={loading ? resolveTestID(testID, "loading") : undefined}
89
+ width="100%"
90
+ >
74
91
  {children}
75
92
  </Box>
76
93
  </Card>
package/src/Common.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type {Block, BlockAction, BlocksDocument, InlineDataset} from "@terreno/blocks";
2
+ import type {Href, Stack} from "expo-router";
2
3
  import type {CountryCode} from "libphonenumber-js";
3
4
  import type React from "react";
4
- import type {FC, ReactElement, ReactNode} from "react";
5
+ import type {ComponentProps, FC, ReactElement, ReactNode} from "react";
5
6
  import type {
6
7
  ImageStyle,
7
8
  ListRenderItemInfo,
@@ -89,7 +90,7 @@ export interface AccordionProps extends InfoModalIconProps {
89
90
 
90
91
  /**
91
92
  * If true, the accordion will be collapsed.
92
- * @default true
93
+ * @default false
93
94
  */
94
95
  isCollapsed?: boolean;
95
96
 
@@ -683,16 +684,132 @@ export interface AccessibilityProps {
683
684
  accessibilityRole?: string;
684
685
  }
685
686
 
686
- /** Checked and disabled state a `Box` reports to screen readers. */
687
+ /** Checked, disabled, and selected state a `Box` reports to screen readers. */
687
688
  export interface BoxAccessibilityState {
689
+ /** Set automatically while `loading` is true; sent as `aria-busy` on web. */
690
+ busy?: boolean;
688
691
  checked?: boolean;
689
692
  disabled?: boolean;
693
+ selected?: boolean;
694
+ }
695
+
696
+ /** How skeleton placeholders animate. `none` renders a static block. */
697
+ export type SkeletonAnimation = "pulse" | "shimmer" | "none";
698
+
699
+ /**
700
+ * Shared loading contract. Box, Card, ChartCard, Scorecard, Page, SplitPage, and the charts
701
+ * accept it, and custom components can extend it and hand it to a `Box` or `withLoading`.
702
+ */
703
+ export interface LoadingProps {
704
+ /** When true, renders `loadingComponent` in place of the children. */
705
+ loading?: boolean;
706
+ /**
707
+ * Placeholder rendered while `loading` is true, usually built from `Skeleton`, `SkeletonText`,
708
+ * `SkeletonCircle`, `SkeletonCard`, or `SkeletonList`. Each component documents its default.
709
+ */
710
+ loadingComponent?: ReactNode;
711
+ /**
712
+ * Animation for skeletons inside `loadingComponent` that do not set their own `animation`.
713
+ * Falls back to `none` when the OS reduce-motion setting is on.
714
+ * @default "pulse"
715
+ */
716
+ loadingAnimation?: SkeletonAnimation;
717
+ /**
718
+ * Screen reader label announced while loading.
719
+ * @default "Loading"
720
+ */
721
+ loadingLabel?: string;
722
+ }
723
+
724
+ export interface SkeletonProps extends WithTestID {
725
+ /**
726
+ * Overrides the nearest `SkeletonGroup` (or loading container) animation.
727
+ * @default "pulse"
728
+ */
729
+ animation?: SkeletonAnimation;
730
+ /**
731
+ * Placeholder fill.
732
+ * @default "neutralExtraLight"
733
+ */
734
+ color?: SurfaceColor;
735
+ /** @default 16 */
736
+ height?: NumberOrPercentage;
737
+ /** @default "sm" */
738
+ rounding?: Rounding | "circle";
739
+ /** @default "100%" */
740
+ width?: NumberOrPercentage;
741
+ }
742
+
743
+ export interface SkeletonTextProps extends WithTestID {
744
+ animation?: SkeletonAnimation;
745
+ /**
746
+ * Width of the final line, so a paragraph does not end flush.
747
+ * @default "60%"
748
+ */
749
+ lastLineWidth?: NumberOrPercentage;
750
+ /** @default 3 */
751
+ lines?: number;
752
+ /**
753
+ * Matches the line height of `Text` at this size.
754
+ * @default "md"
755
+ */
756
+ size?: TextSize;
757
+ }
758
+
759
+ export interface SkeletonCircleProps extends WithTestID {
760
+ animation?: SkeletonAnimation;
761
+ /**
762
+ * Diameter in pixels.
763
+ * @default 40
764
+ */
765
+ size?: number;
766
+ }
767
+
768
+ export interface SkeletonCardProps extends WithTestID {
769
+ animation?: SkeletonAnimation;
770
+ /** @default 2 */
771
+ lines?: number;
772
+ /**
773
+ * Height of the media block when `showMedia` is true.
774
+ * @default 160
775
+ */
776
+ mediaHeight?: number;
777
+ /** @default true */
778
+ showAvatar?: boolean;
779
+ /** Adds a full-width media block above the text, like a display `Card` with an image. */
780
+ showMedia?: boolean;
781
+ }
782
+
783
+ export interface SkeletonListProps extends WithTestID {
784
+ animation?: SkeletonAnimation;
785
+ /**
786
+ * Text lines per row.
787
+ * @default 2
788
+ */
789
+ lines?: number;
790
+ /** @default 3 */
791
+ rows?: number;
792
+ /** @default true */
793
+ showAvatar?: boolean;
794
+ }
795
+
796
+ export interface SkeletonGroupProps {
797
+ /**
798
+ * Animation inherited by every skeleton inside the group. Skeletons in one group pulse in sync.
799
+ * @default "pulse"
800
+ */
801
+ animation?: SkeletonAnimation;
802
+ children?: ReactNode;
690
803
  }
691
804
 
692
- export interface BoxPropsBase extends WithTestID {
805
+ export interface BoxPropsBase extends WithTestID, LoadingProps {
693
806
  /**
694
- * Checked and disabled state for screen readers, sent as `accessibilityState` and as
695
- * `aria-checked` / `aria-disabled`. On a clickable Box, `disabled: true` also stops presses.
807
+ * Checked, disabled, and selected state for screen readers, sent as `accessibilityState` and as
808
+ * `aria-checked` / `aria-disabled`. `selected` is sent as `aria-selected` on a selectable
809
+ * `accessibilityRole` (`tab`, `option`, `row`, ...) and as `aria-current="true"` on any other Box,
810
+ * such as a clickable list row. On web that row does not also keep `selected` in
811
+ * `accessibilityState`, because react-native-web would emit `aria-selected` on the button.
812
+ * On a clickable Box, `disabled: true` also stops presses.
696
813
  */
697
814
  accessibilityState?: BoxAccessibilityState;
698
815
  /**
@@ -987,6 +1104,11 @@ export interface HelperTextProps {
987
1104
 
988
1105
  export interface ErrorTextProps {
989
1106
  errorText?: string;
1107
+ /**
1108
+ * Where `errorText` sits relative to the control.
1109
+ * @default "above"
1110
+ */
1111
+ errorPosition?: "above" | "below";
990
1112
  }
991
1113
 
992
1114
  export interface AiSuggestionProps {
@@ -1019,7 +1141,24 @@ export interface TextFieldProps extends BaseFieldProps, HelperTextProps, ErrorTe
1019
1141
  */
1020
1142
  showVisibilityToggle?: boolean;
1021
1143
 
1022
- autoComplete?: "current-password" | "on" | "off" | "username";
1144
+ /**
1145
+ * Autofill hint. On web it is set as the input's `autocomplete` attribute; `"username webauthn"`
1146
+ * asks the browser to offer saved passkeys in the field's autofill. On native it is sent as
1147
+ * React Native's `autoComplete` (Android's autofill hint) and as the matching iOS
1148
+ * `textContentType`: `username` → `username`, `email` → `emailAddress`, `current-password` →
1149
+ * `password`, `new-password` → `newPassword` (iOS offers a strong password), `one-time-code` →
1150
+ * `oneTimeCode`, `off` → `none`. Without it (or with `"on"`) the field's `type` picks the iOS
1151
+ * hint.
1152
+ */
1153
+ autoComplete?:
1154
+ | "current-password"
1155
+ | "email"
1156
+ | "new-password"
1157
+ | "on"
1158
+ | "off"
1159
+ | "one-time-code"
1160
+ | "username"
1161
+ | "username webauthn";
1023
1162
  returnKeyType?: "done" | "go" | "next" | "search" | "send";
1024
1163
 
1025
1164
  grow?: boolean;
@@ -1033,8 +1172,15 @@ export interface TextFieldProps extends BaseFieldProps, HelperTextProps, ErrorTe
1033
1172
 
1034
1173
  inputRef?: (ref: TextInput | null) => void;
1035
1174
  trimOnBlur?: boolean;
1175
+ /** Renders the value in a monospace face with tracking, for codes such as backup codes. */
1176
+ mono?: boolean;
1036
1177
 
1037
1178
  aiSuggestion?: AiSuggestionProps;
1179
+
1180
+ /**
1181
+ * Accessible name for the input. Screen readers otherwise announce "Text input field".
1182
+ */
1183
+ accessibilityLabel?: string;
1038
1184
  }
1039
1185
 
1040
1186
  export interface TextAreaProps extends Omit<TextFieldProps, "multiline" | "type"> {}
@@ -1143,6 +1289,12 @@ export interface HeadingProps extends WithTestID {
1143
1289
  align?: "left" | "right" | "center" | "justify"; // default "left"
1144
1290
  children?: React.ReactNode;
1145
1291
  color?: TextColor;
1292
+ /**
1293
+ * Outline level, 1 for the page title. When set, the heading is exposed to assistive
1294
+ * technology as a heading: `role="heading"` with `aria-level` (an `<h1>`–`<h6>` on web, the
1295
+ * header accessibility role on native). When omitted, the heading is plain text.
1296
+ */
1297
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
1146
1298
  overflow?: "normal" | "breakWord"; // default "breakWord"
1147
1299
  size?: "sm" | "md" | "lg" | "xl" | "2xl"; // default "sm"
1148
1300
  truncate?: boolean; // default false
@@ -1234,7 +1386,8 @@ export interface SplitPageListItem {
1234
1386
  id: string;
1235
1387
  }
1236
1388
 
1237
- export interface SplitPageProps<TItem extends SplitPageListItem = SplitPageListItem> {
1389
+ export interface SplitPageProps<TItem extends SplitPageListItem = SplitPageListItem>
1390
+ extends LoadingProps {
1238
1391
  /**
1239
1392
  * can accept either one React Child or any array of ReactChild. If this is not provided,
1240
1393
  * renderContent must return one or many ReactChild.
@@ -1316,6 +1469,79 @@ export interface SplitPageProps<TItem extends SplitPageListItem = SplitPageListI
1316
1469
  childColumnRounding?: Rounding;
1317
1470
  }
1318
1471
 
1472
+ /**
1473
+ * Props for ListDetailLayout, the route-driven list/detail layout used as a route group's
1474
+ * `_layout.tsx`. The group's `index.tsx` renders `ListDetailIndex`, and a dynamic child route
1475
+ * (default `[id].tsx`) renders the detail.
1476
+ */
1477
+ export interface ListDetailLayoutProps {
1478
+ /**
1479
+ * The list. Rendered in the left pane when split, and by `ListDetailIndex` when not split.
1480
+ */
1481
+ list: ReactElement;
1482
+ /**
1483
+ * Where selecting an item navigates, e.g. `(id) => \`/mail/${id}\``.
1484
+ */
1485
+ detailHref: (id: string) => Href;
1486
+ /**
1487
+ * The group's own path, e.g. `/mail`. `clear()` returns here, and `selectedId` is only read
1488
+ * from routes directly below it.
1489
+ */
1490
+ indexHref: string;
1491
+ /**
1492
+ * Shown in the detail pane when split and no item is open.
1493
+ */
1494
+ emptyDetail?: ReactElement;
1495
+ /**
1496
+ * Split into list and detail panes when the layout's measured width is at least this many
1497
+ * pixels. Defaults to 768.
1498
+ */
1499
+ splitAtWidth?: number;
1500
+ /**
1501
+ * Width in pixels of the list pane when split. Defaults to 360.
1502
+ */
1503
+ listWidth?: number;
1504
+ /**
1505
+ * The child route name that holds the detail. Defaults to `"[id]"`.
1506
+ */
1507
+ detailRoute?: string;
1508
+ /**
1509
+ * The route param that holds the item id. Defaults to `"id"`.
1510
+ */
1511
+ paramName?: string;
1512
+ /**
1513
+ * Screen options passed through to the underlying expo-router Stack.
1514
+ */
1515
+ screenOptions?: ComponentProps<typeof Stack>["screenOptions"];
1516
+ /**
1517
+ * Optional `Stack.Screen` definitions passed through to the underlying expo-router Stack.
1518
+ */
1519
+ children?: React.ReactNode;
1520
+ }
1521
+
1522
+ /**
1523
+ * The value returned by `useListDetail()` inside a ListDetailLayout.
1524
+ */
1525
+ export interface ListDetailState {
1526
+ /**
1527
+ * True when the list and detail panes are shown side by side.
1528
+ */
1529
+ isSplit: boolean;
1530
+ /**
1531
+ * The id of the open item, read from the detail route. Undefined on the index route.
1532
+ */
1533
+ selectedId?: string;
1534
+ /**
1535
+ * Open an item. Pushes the detail route, or replaces the open detail when split, so back
1536
+ * always returns to the list.
1537
+ */
1538
+ select: (id: string) => void;
1539
+ /**
1540
+ * Close the open item and return to the group's index route.
1541
+ */
1542
+ clear: () => void;
1543
+ }
1544
+
1319
1545
  export type PermissionKind =
1320
1546
  | "location"
1321
1547
  | "locationAlways"
@@ -2185,6 +2411,11 @@ export interface ButtonProps extends WithTestID {
2185
2411
  * Used for OAuth social login buttons (Google, GitHub, Apple).
2186
2412
  */
2187
2413
  export interface SocialLoginButtonProps extends WithTestID {
2414
+ /**
2415
+ * Accessible name. Defaults to the button text.
2416
+ */
2417
+ accessibilityLabel?: string;
2418
+
2188
2419
  /**
2189
2420
  * The OAuth provider for the social login.
2190
2421
  */
@@ -2204,11 +2435,19 @@ export interface SocialLoginButtonProps extends WithTestID {
2204
2435
  /**
2205
2436
  * The visual variant of the button.
2206
2437
  * - "primary": Uses the provider's brand colors
2207
- * - "outline": Uses an outline style with neutral colors
2438
+ * - "outline": Neutral outline pill, matching the other sign-in methods
2208
2439
  * @default "primary"
2209
2440
  */
2210
2441
  variant?: "primary" | "outline";
2211
2442
 
2443
+ /**
2444
+ * When set on the outline variant, highlights the pill and shows this label inside it.
2445
+ */
2446
+ lastUsedLabel?: string;
2447
+
2448
+ /** Test ID of the last-used label. Requires `lastUsedLabel`. */
2449
+ lastUsedTestID?: string;
2450
+
2212
2451
  /**
2213
2452
  * If true, the button will be disabled.
2214
2453
  * @default false
@@ -2577,7 +2816,7 @@ export interface NumberPickerActionSheetProps {
2577
2816
  actionSheetRef: React.RefObject<any>;
2578
2817
  }
2579
2818
 
2580
- export interface PageProps extends WithTestID {
2819
+ export interface PageProps extends WithTestID, LoadingProps {
2581
2820
  // noExplicitAny: React Navigation type varies by navigation stack configuration
2582
2821
  // biome-ignore lint/suspicious/noExplicitAny: React Navigation type varies by navigation stack configuration
2583
2822
  navigation?: any;
@@ -2834,7 +3073,7 @@ export interface PaginationProps extends WithTestID {
2834
3073
  totalPages: number;
2835
3074
  }
2836
3075
 
2837
- export interface LineChartProps extends WithTestID {
3076
+ export interface LineChartProps extends WithTestID, LoadingProps {
2838
3077
  /** Summary announced for the whole chart. */
2839
3078
  accessibilityLabel?: string;
2840
3079
  /** Optional previous-period values drawn as a dotted overlay. */
@@ -2849,7 +3088,9 @@ export interface LineChartProps extends WithTestID {
2849
3088
  height?: number;
2850
3089
  /** Series name shown under the plot. */
2851
3090
  legendLabel?: string;
2852
- /** When true, shows a spinner instead of the plot. */
3091
+ /**
3092
+ * When true, shows `loadingComponent` (default: a spinner) instead of the plot.
3093
+ */
2853
3094
  loading?: boolean;
2854
3095
  /** Makes `periodLabel` pressable when provided. */
2855
3096
  onPeriodPress?: () => void;
@@ -2874,7 +3115,11 @@ export interface SparklineChartProps extends WithTestID {
2874
3115
  height?: number;
2875
3116
  }
2876
3117
 
2877
- export interface ChartCardProps extends WithTestID {
3118
+ /**
3119
+ * While `loading`, the title row stays visible and the body shows `loadingComponent`
3120
+ * (default: a 160px `Skeleton`).
3121
+ */
3122
+ export interface ChartCardProps extends WithTestID, LoadingProps {
2878
3123
  children: React.ReactNode;
2879
3124
  /** Optional context shown below the title row. */
2880
3125
  filterSummary?: string;
@@ -2886,7 +3131,11 @@ export interface ChartCardProps extends WithTestID {
2886
3131
  title: string;
2887
3132
  }
2888
3133
 
2889
- export interface ScorecardProps extends WithTestID {
3134
+ /**
3135
+ * While `loading`, the title row stays visible and the value shows `loadingComponent`
3136
+ * (default: a heading-sized `Skeleton`).
3137
+ */
3138
+ export interface ScorecardProps extends WithTestID, LoadingProps {
2890
3139
  /** Optional previous-period sparkline values. */
2891
3140
  comparisonData?: Array<{label: string; value: number}>;
2892
3141
  /** Formats numeric values. String values render unchanged. */
@@ -1,6 +1,7 @@
1
1
  import {afterEach, describe, expect, it, mock} from "bun:test";
2
2
  import {act, fireEvent, render, waitFor} from "@testing-library/react-native";
3
3
  import {assert} from "chai";
4
+ import {DateTime} from "luxon";
4
5
  import {Platform} from "react-native";
5
6
 
6
7
  import {ConsentFormScreen} from "./ConsentFormScreen";
@@ -35,6 +36,89 @@ const waitForConsentMarkdown = async (getByText: (text: string) => unknown): Pro
35
36
  };
36
37
 
37
38
  describe("ConsentFormScreen", () => {
39
+ describe("provisional signature notice", () => {
40
+ const signedAt = "2026-10-20T15:30:00.000Z";
41
+
42
+ it("shows who signed on the user's behalf and when", () => {
43
+ const {getByTestId} = renderWithTheme(
44
+ <ConsentFormScreen
45
+ form={{...baseForm, provisionalSignature: {signedAt, signedByName: "Dana Rivera"}}}
46
+ locale="en"
47
+ onAgree={() => {}}
48
+ />
49
+ );
50
+ const expectedDate = DateTime.fromISO(signedAt)
51
+ .setLocale("en")
52
+ .toLocaleString(DateTime.DATETIME_MED);
53
+ const notice = getByTestId("consent-form-provisional-notice");
54
+ expect(notice).toBeTruthy();
55
+ expect(getByTestId("consent-form-provisional-notice-text").props.children).toBe(
56
+ `Signed on your behalf by Dana Rivera on ${expectedDate}`
57
+ );
58
+ });
59
+
60
+ it("leaves the date off when the signing date cannot be parsed", () => {
61
+ const {getByTestId} = renderWithTheme(
62
+ <ConsentFormScreen
63
+ form={{...baseForm, provisionalSignature: {signedAt: "bad", signedByName: "Dana Rivera"}}}
64
+ locale="en"
65
+ onAgree={() => {}}
66
+ />
67
+ );
68
+ expect(getByTestId("consent-form-provisional-notice-text").props.children).toBe(
69
+ "Signed on your behalf by Dana Rivera"
70
+ );
71
+ });
72
+
73
+ it("shows no notice when the form has no provisional signature", () => {
74
+ const {queryByTestId} = renderWithTheme(
75
+ <ConsentFormScreen form={baseForm} locale="en" onAgree={() => {}} />
76
+ );
77
+ expect(queryByTestId("consent-form-provisional-notice")).toBeNull();
78
+ });
79
+
80
+ it("still requires the user's own checkboxes and signature to agree", () => {
81
+ const onAgree = mock(() => {});
82
+ const {getByTestId} = renderWithTheme(
83
+ <ConsentFormScreen
84
+ form={{
85
+ ...baseForm,
86
+ captureSignature: true,
87
+ checkboxes: [{label: "I understand", required: true}],
88
+ provisionalSignature: {signedAt, signedByName: "Dana Rivera"},
89
+ }}
90
+ locale="en"
91
+ onAgree={onAgree}
92
+ />
93
+ );
94
+ expect(getByTestId("consent-form-agree-button").props.accessibilityState?.disabled).toBe(
95
+ true
96
+ );
97
+ expect(getByTestId("consent-footer-checkboxes-hint")).toBeTruthy();
98
+ expect(getByTestId("consent-footer-signature-hint")).toBeTruthy();
99
+ fireEvent.press(getByTestId("consent-form-agree-button"));
100
+ expect(onAgree).not.toHaveBeenCalled();
101
+ });
102
+
103
+ it("lets the user decline a provisionally signed form", async () => {
104
+ const onDecline = mock(() => {});
105
+ const {getByTestId} = renderWithTheme(
106
+ <ConsentFormScreen
107
+ form={{...baseForm, provisionalSignature: {signedAt, signedByName: "Dana Rivera"}}}
108
+ locale="en"
109
+ onAgree={() => {}}
110
+ onDecline={onDecline}
111
+ />
112
+ );
113
+ act(() => {
114
+ fireEvent.press(getByTestId("consent-form-decline-button"));
115
+ });
116
+ await waitFor(() => {
117
+ expect(onDecline).toHaveBeenCalledTimes(1);
118
+ });
119
+ });
120
+ });
121
+
38
122
  it("renders with default state and a locale fallback", () => {
39
123
  const onAgree = mock(() => {});
40
124
  const {getByTestId, getByText} = renderWithTheme(
@@ -1,3 +1,4 @@
1
+ import {DateTime} from "luxon";
1
2
  import React, {useCallback, useRef, useState} from "react";
2
3
  import {
3
4
  type LayoutChangeEvent,
@@ -17,7 +18,7 @@ import {Modal} from "./Modal";
17
18
  import {Page} from "./Page";
18
19
  import {SignatureField} from "./SignatureField";
19
20
  import {Text} from "./Text";
20
- import type {ConsentFormPublic} from "./useConsentForms";
21
+ import {applyConsentVariables, type ConsentFormPublic} from "./useConsentForms";
21
22
 
22
23
  interface ConsentFormScreenProps {
23
24
  form: ConsentFormPublic;
@@ -49,9 +50,19 @@ export const ConsentFormScreen: React.FC<ConsentFormScreenProps> = ({
49
50
  const scrollViewRef = useRef<ScrollView>(null);
50
51
 
51
52
  const rawContent = form.content[locale] ?? form.content[form.defaultLocale] ?? "";
52
- const content = variables
53
- ? rawContent.replace(/\{\{(\w+)\}\}/g, (match, key) => variables[key] ?? match)
54
- : rawContent;
53
+ const content = applyConsentVariables(rawContent, variables);
54
+
55
+ // Staff may have signed provisionally; the user still reads and answers the form.
56
+ const provisionalSignedAt = form.provisionalSignature
57
+ ? DateTime.fromISO(form.provisionalSignature.signedAt).setLocale(locale)
58
+ : undefined;
59
+ const provisionalNotice = form.provisionalSignature
60
+ ? `Signed on your behalf by ${form.provisionalSignature.signedByName}${
61
+ provisionalSignedAt?.isValid
62
+ ? ` on ${provisionalSignedAt.toLocaleString(DateTime.DATETIME_MED)}`
63
+ : ""
64
+ }`
65
+ : undefined;
55
66
 
56
67
  const allRequiredCheckboxesChecked = form.checkboxes.every((checkbox, index) => {
57
68
  if (!checkbox.required) {
@@ -244,6 +255,19 @@ export const ConsentFormScreen: React.FC<ConsentFormScreenProps> = ({
244
255
  testID="consent-form-scroll-view"
245
256
  >
246
257
  <Box direction="column" gap={3} paddingY={2}>
258
+ {Boolean(provisionalNotice) && (
259
+ <Box
260
+ border="default"
261
+ color="secondaryExtraLight"
262
+ padding={3}
263
+ rounding="md"
264
+ testID="consent-form-provisional-notice"
265
+ >
266
+ <Text size="md" testID="consent-form-provisional-notice-text">
267
+ {provisionalNotice}
268
+ </Text>
269
+ </Box>
270
+ )}
247
271
  <MarkdownView onLoad={handleMarkdownLoad}>{content}</MarkdownView>
248
272
 
249
273
  {form.checkboxes.length > 0 && (
@@ -461,20 +461,22 @@ export const DateTimeField: FC<DateTimeFieldProps> = ({
461
461
  providedTimezone ?? DateTime.local().zoneName ?? "UTC"
462
462
  );
463
463
 
464
- const breakpoint = 395; // Breakpoint for switching to action sheet
464
+ // Parent width, in pt, below which inline controls do not fit. This is the field's own
465
+ // minimum, not a viewport breakpoint.
466
+ const inlineControlsMinWidth = 395;
465
467
  let minimumWidth = 230; // Minimum width for the field container
466
468
  if (type === "date") {
467
469
  minimumWidth = 200;
468
470
  }
469
471
 
470
- let maximumWidth = breakpoint; // Maximum width for the field container
472
+ let maximumWidth = inlineControlsMinWidth; // Maximum width for the field container
471
473
  if (["date", "time"].includes(type)) {
472
474
  maximumWidth = minimumWidth + 10;
473
475
  }
474
476
 
475
477
  const [parentWidth, setParentWidth] = useState<number | null>(null);
476
478
  const parentIsLessThanBreakpointOrIsMobile =
477
- (parentWidth !== null && parentWidth < breakpoint) || isNarrowViewport();
479
+ (parentWidth !== null && parentWidth < inlineControlsMinWidth) || isNarrowViewport();
478
480
 
479
481
  // We need to store the pending value in a ref because the state changes don't trigger
480
482
  // immediately, so onBlur may use stale values.
@@ -177,6 +177,21 @@ describe("DonutChart", () => {
177
177
  expect(queryByTestId("chart.tooltip")).toBeNull();
178
178
  });
179
179
 
180
+ it("records a positive plot width from layout", () => {
181
+ const {getByTestId} = renderWithTheme(<DonutChart data={POINTS} testID="chart" />);
182
+
183
+ act(() => {
184
+ fireEvent(getByTestId("chart.plot"), "layout", {
185
+ nativeEvent: {layout: {height: 0, width: 0}},
186
+ });
187
+ fireEvent(getByTestId("chart.plot"), "layout", {
188
+ nativeEvent: {layout: {height: 180, width: 320}},
189
+ });
190
+ });
191
+
192
+ expect(getByTestId("chart.plot")).toBeTruthy();
193
+ });
194
+
180
195
  it("does not open URLs from slice legend labels", () => {
181
196
  const {getByText} = renderWithTheme(
182
197
  <DonutChart data={[{label: "https://evil.example", value: 10}]} />
@@ -55,6 +55,9 @@ export const DonutChart: FC<DonutChartProps> = ({
55
55
  formatValue = String,
56
56
  height = DEFAULT_SIZE,
57
57
  loading = false,
58
+ loadingAnimation,
59
+ loadingComponent,
60
+ loadingLabel,
58
61
  onPeriodPress,
59
62
  periodLabel,
60
63
  testID,
@@ -94,6 +97,9 @@ export const DonutChart: FC<DonutChartProps> = ({
94
97
  emptyText={emptyText}
95
98
  isEmpty={data.length === 0}
96
99
  loading={loading}
100
+ loadingAnimation={loadingAnimation}
101
+ loadingComponent={loadingComponent}
102
+ loadingLabel={loadingLabel}
97
103
  testID={testID}
98
104
  tooltipText={tooltipText}
99
105
  >
package/src/Field.tsx CHANGED
@@ -90,6 +90,8 @@ export const Field: FC<FieldProps> = ({type, ...rest}) => {
90
90
  }
91
91
  }
92
92
 
93
+ // Defaults only: a password field that sets a new password passes autoComplete="new-password",
94
+ // which the spread below applies.
93
95
  return (
94
96
  <TextField
95
97
  autoComplete={autoComplete}