@studio-piot/native-ui 0.2.5 → 0.17.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 (338) hide show
  1. package/README.md +22 -18
  2. package/dist/components/Button/Button.d.ts +20 -4
  3. package/dist/components/Button/Button.d.ts.map +1 -1
  4. package/dist/components/Button/Button.js +34 -21
  5. package/dist/components/Button/Button.js.map +1 -1
  6. package/dist/components/Button/buttonAppearance.d.ts +20 -0
  7. package/dist/components/Button/buttonAppearance.d.ts.map +1 -0
  8. package/dist/components/Button/buttonAppearance.js +28 -0
  9. package/dist/components/Button/buttonAppearance.js.map +1 -0
  10. package/dist/components/Button/buttonThemeRoles.d.ts +6 -0
  11. package/dist/components/Button/buttonThemeRoles.d.ts.map +1 -0
  12. package/dist/components/Button/buttonThemeRoles.js +8 -0
  13. package/dist/components/Button/buttonThemeRoles.js.map +1 -0
  14. package/dist/components/Button/index.d.ts +3 -1
  15. package/dist/components/Button/index.d.ts.map +1 -1
  16. package/dist/components/Button/index.js +4 -1
  17. package/dist/components/Button/index.js.map +1 -1
  18. package/dist/components/Choice/Choice.d.ts +10 -0
  19. package/dist/components/Choice/Choice.d.ts.map +1 -0
  20. package/dist/components/Choice/Choice.js +66 -0
  21. package/dist/components/Choice/Choice.js.map +1 -0
  22. package/dist/components/Choice/choiceLayout.d.ts +23 -0
  23. package/dist/components/Choice/choiceLayout.d.ts.map +1 -0
  24. package/dist/components/Choice/choiceLayout.js +32 -0
  25. package/dist/components/Choice/choiceLayout.js.map +1 -0
  26. package/dist/components/Choice/choiceThemeRoles.d.ts +9 -0
  27. package/dist/components/Choice/choiceThemeRoles.d.ts.map +1 -0
  28. package/dist/components/Choice/choiceThemeRoles.js +11 -0
  29. package/dist/components/Choice/choiceThemeRoles.js.map +1 -0
  30. package/dist/components/Choice/index.d.ts +5 -0
  31. package/dist/components/Choice/index.d.ts.map +1 -0
  32. package/dist/components/Choice/index.js +10 -0
  33. package/dist/components/Choice/index.js.map +1 -0
  34. package/dist/components/Choice/types.d.ts +33 -0
  35. package/dist/components/Choice/types.d.ts.map +1 -0
  36. package/dist/components/Choice/types.js +3 -0
  37. package/dist/components/Choice/types.js.map +1 -0
  38. package/dist/components/ErrorBanner/ErrorBanner.d.ts +1 -1
  39. package/dist/components/ErrorBanner/ErrorBanner.d.ts.map +1 -1
  40. package/dist/components/ErrorBanner/ErrorBanner.js +19 -19
  41. package/dist/components/ErrorBanner/ErrorBanner.js.map +1 -1
  42. package/dist/components/ErrorBanner/errorBannerContext.d.ts +23 -3
  43. package/dist/components/ErrorBanner/errorBannerContext.d.ts.map +1 -1
  44. package/dist/components/ErrorBanner/errorBannerContext.js +9 -5
  45. package/dist/components/ErrorBanner/errorBannerContext.js.map +1 -1
  46. package/dist/components/ErrorBanner/errorBannerLayout.d.ts +18 -0
  47. package/dist/components/ErrorBanner/errorBannerLayout.d.ts.map +1 -0
  48. package/dist/components/ErrorBanner/errorBannerLayout.js +54 -0
  49. package/dist/components/ErrorBanner/errorBannerLayout.js.map +1 -0
  50. package/dist/components/ErrorBanner/icons.d.ts +7 -5
  51. package/dist/components/ErrorBanner/icons.d.ts.map +1 -1
  52. package/dist/components/ErrorBanner/icons.js +8 -4
  53. package/dist/components/ErrorBanner/icons.js.map +1 -1
  54. package/dist/components/ErrorBanner/index.d.ts +1 -1
  55. package/dist/components/ErrorBanner/index.d.ts.map +1 -1
  56. package/dist/components/ErrorBanner/index.js.map +1 -1
  57. package/dist/components/Form/Form.d.ts +9 -1
  58. package/dist/components/Form/Form.d.ts.map +1 -1
  59. package/dist/components/Form/Form.js +56 -78
  60. package/dist/components/Form/Form.js.map +1 -1
  61. package/dist/components/Form/FormCloseButton.d.ts +3 -1
  62. package/dist/components/Form/FormCloseButton.d.ts.map +1 -1
  63. package/dist/components/Form/FormCloseButton.js +5 -4
  64. package/dist/components/Form/FormCloseButton.js.map +1 -1
  65. package/dist/components/Form/FormErrorBanner.d.ts +15 -0
  66. package/dist/components/Form/FormErrorBanner.d.ts.map +1 -0
  67. package/dist/components/Form/FormErrorBanner.js +30 -0
  68. package/dist/components/Form/FormErrorBanner.js.map +1 -0
  69. package/dist/components/Form/FormSubmitFooter.d.ts +17 -0
  70. package/dist/components/Form/FormSubmitFooter.d.ts.map +1 -0
  71. package/dist/components/Form/FormSubmitFooter.js +32 -0
  72. package/dist/components/Form/FormSubmitFooter.js.map +1 -0
  73. package/dist/components/Form/formThemeRoles.d.ts +7 -0
  74. package/dist/components/Form/formThemeRoles.d.ts.map +1 -0
  75. package/dist/components/Form/formThemeRoles.js +9 -0
  76. package/dist/components/Form/formThemeRoles.js.map +1 -0
  77. package/dist/components/Form/index.d.ts +1 -0
  78. package/dist/components/Form/index.d.ts.map +1 -1
  79. package/dist/components/Form/index.js +3 -1
  80. package/dist/components/Form/index.js.map +1 -1
  81. package/dist/components/Form/types.d.ts +14 -10
  82. package/dist/components/Form/types.d.ts.map +1 -1
  83. package/dist/components/FormSheet/FormSheet.d.ts +10 -0
  84. package/dist/components/FormSheet/FormSheet.d.ts.map +1 -0
  85. package/dist/components/FormSheet/FormSheet.js +153 -0
  86. package/dist/components/FormSheet/FormSheet.js.map +1 -0
  87. package/dist/components/FormSheet/formSheetLayout.d.ts +32 -0
  88. package/dist/components/FormSheet/formSheetLayout.d.ts.map +1 -0
  89. package/dist/components/FormSheet/formSheetLayout.js +43 -0
  90. package/dist/components/FormSheet/formSheetLayout.js.map +1 -0
  91. package/dist/components/FormSheet/formSheetThemeRoles.d.ts +8 -0
  92. package/dist/components/FormSheet/formSheetThemeRoles.d.ts.map +1 -0
  93. package/dist/components/FormSheet/formSheetThemeRoles.js +10 -0
  94. package/dist/components/FormSheet/formSheetThemeRoles.js.map +1 -0
  95. package/dist/components/FormSheet/index.d.ts +5 -0
  96. package/dist/components/FormSheet/index.d.ts.map +1 -0
  97. package/dist/components/FormSheet/index.js +10 -0
  98. package/dist/components/FormSheet/index.js.map +1 -0
  99. package/dist/components/FormSheet/types.d.ts +64 -0
  100. package/dist/components/FormSheet/types.d.ts.map +1 -0
  101. package/dist/components/FormSheet/types.js +3 -0
  102. package/dist/components/FormSheet/types.js.map +1 -0
  103. package/dist/components/HeaderButton/HeaderCapsule.d.ts +4 -0
  104. package/dist/components/HeaderButton/HeaderCapsule.d.ts.map +1 -0
  105. package/dist/components/HeaderButton/HeaderCapsule.js +32 -0
  106. package/dist/components/HeaderButton/HeaderCapsule.js.map +1 -0
  107. package/dist/components/HeaderButton/HeaderGroup.d.ts +4 -0
  108. package/dist/components/HeaderButton/HeaderGroup.d.ts.map +1 -0
  109. package/dist/components/HeaderButton/HeaderGroup.js +23 -0
  110. package/dist/components/HeaderButton/HeaderGroup.js.map +1 -0
  111. package/dist/components/HeaderButton/HeaderIcon.d.ts +4 -0
  112. package/dist/components/HeaderButton/HeaderIcon.d.ts.map +1 -0
  113. package/dist/components/HeaderButton/HeaderIcon.js +28 -0
  114. package/dist/components/HeaderButton/HeaderIcon.js.map +1 -0
  115. package/dist/components/HeaderButton/headerButtonLayout.d.ts +21 -0
  116. package/dist/components/HeaderButton/headerButtonLayout.d.ts.map +1 -0
  117. package/dist/components/HeaderButton/headerButtonLayout.js +34 -0
  118. package/dist/components/HeaderButton/headerButtonLayout.js.map +1 -0
  119. package/dist/components/HeaderButton/headerButtonThemeRoles.d.ts +5 -0
  120. package/dist/components/HeaderButton/headerButtonThemeRoles.d.ts.map +1 -0
  121. package/dist/components/HeaderButton/headerButtonThemeRoles.js +7 -0
  122. package/dist/components/HeaderButton/headerButtonThemeRoles.js.map +1 -0
  123. package/dist/components/HeaderButton/index.d.ts +7 -0
  124. package/dist/components/HeaderButton/index.d.ts.map +1 -0
  125. package/dist/components/HeaderButton/index.js +14 -0
  126. package/dist/components/HeaderButton/index.js.map +1 -0
  127. package/dist/components/HeaderButton/types.d.ts +40 -0
  128. package/dist/components/HeaderButton/types.d.ts.map +1 -0
  129. package/dist/components/HeaderButton/types.js +3 -0
  130. package/dist/components/HeaderButton/types.js.map +1 -0
  131. package/dist/components/HeaderWash/HeaderWash.d.ts +10 -0
  132. package/dist/components/HeaderWash/HeaderWash.d.ts.map +1 -0
  133. package/dist/components/HeaderWash/HeaderWash.js +19 -0
  134. package/dist/components/HeaderWash/HeaderWash.js.map +1 -0
  135. package/dist/components/HeaderWash/headerWashGradient.d.ts +8 -0
  136. package/dist/components/HeaderWash/headerWashGradient.d.ts.map +1 -0
  137. package/dist/components/HeaderWash/headerWashGradient.js +21 -0
  138. package/dist/components/HeaderWash/headerWashGradient.js.map +1 -0
  139. package/dist/components/HeaderWash/index.d.ts +2 -0
  140. package/dist/components/HeaderWash/index.d.ts.map +1 -0
  141. package/dist/components/HeaderWash/index.js +6 -0
  142. package/dist/components/HeaderWash/index.js.map +1 -0
  143. package/dist/components/Page/Page.d.ts +13 -0
  144. package/dist/components/Page/Page.d.ts.map +1 -0
  145. package/dist/components/Page/Page.js +49 -0
  146. package/dist/components/Page/Page.js.map +1 -0
  147. package/dist/components/Page/PageBleed.d.ts +9 -0
  148. package/dist/components/Page/PageBleed.d.ts.map +1 -0
  149. package/dist/components/Page/PageBleed.js +12 -0
  150. package/dist/components/Page/PageBleed.js.map +1 -0
  151. package/dist/components/Page/index.d.ts +5 -0
  152. package/dist/components/Page/index.d.ts.map +1 -0
  153. package/dist/components/Page/index.js +10 -0
  154. package/dist/components/Page/index.js.map +1 -0
  155. package/dist/components/Page/pageContext.d.ts +4 -0
  156. package/dist/components/Page/pageContext.d.ts.map +1 -0
  157. package/dist/components/Page/pageContext.js +11 -0
  158. package/dist/components/Page/pageContext.js.map +1 -0
  159. package/dist/components/Page/pageInsets.d.ts +26 -0
  160. package/dist/components/Page/pageInsets.d.ts.map +1 -0
  161. package/dist/components/Page/pageInsets.js +37 -0
  162. package/dist/components/Page/pageInsets.js.map +1 -0
  163. package/dist/components/Page/pageLayout.d.ts +5 -0
  164. package/dist/components/Page/pageLayout.d.ts.map +1 -0
  165. package/dist/components/Page/pageLayout.js +8 -0
  166. package/dist/components/Page/pageLayout.js.map +1 -0
  167. package/dist/components/Page/pageThemeRoles.d.ts +5 -0
  168. package/dist/components/Page/pageThemeRoles.d.ts.map +1 -0
  169. package/dist/components/Page/pageThemeRoles.js +7 -0
  170. package/dist/components/Page/pageThemeRoles.js.map +1 -0
  171. package/dist/components/Page/types.d.ts +22 -0
  172. package/dist/components/Page/types.d.ts.map +1 -0
  173. package/dist/components/Page/types.js +3 -0
  174. package/dist/components/Page/types.js.map +1 -0
  175. package/dist/components/Select/Select.d.ts +1 -1
  176. package/dist/components/Select/Select.d.ts.map +1 -1
  177. package/dist/components/Select/Select.js +8 -9
  178. package/dist/components/Select/Select.js.map +1 -1
  179. package/dist/components/Select/selectThemeRoles.d.ts +2 -0
  180. package/dist/components/Select/selectThemeRoles.d.ts.map +1 -1
  181. package/dist/components/Select/selectThemeRoles.js +2 -0
  182. package/dist/components/Select/selectThemeRoles.js.map +1 -1
  183. package/dist/components/Select/types.d.ts +4 -0
  184. package/dist/components/Select/types.d.ts.map +1 -1
  185. package/dist/components/TabAccessoryButton/TabAccessoryButton.d.ts +8 -0
  186. package/dist/components/TabAccessoryButton/TabAccessoryButton.d.ts.map +1 -0
  187. package/dist/components/TabAccessoryButton/TabAccessoryButton.js +77 -0
  188. package/dist/components/TabAccessoryButton/TabAccessoryButton.js.map +1 -0
  189. package/dist/components/TabAccessoryButton/index.d.ts +5 -0
  190. package/dist/components/TabAccessoryButton/index.d.ts.map +1 -0
  191. package/dist/components/TabAccessoryButton/index.js +11 -0
  192. package/dist/components/TabAccessoryButton/index.js.map +1 -0
  193. package/dist/components/TabAccessoryButton/tabAccessoryLayout.d.ts +27 -0
  194. package/dist/components/TabAccessoryButton/tabAccessoryLayout.d.ts.map +1 -0
  195. package/dist/components/TabAccessoryButton/tabAccessoryLayout.js +38 -0
  196. package/dist/components/TabAccessoryButton/tabAccessoryLayout.js.map +1 -0
  197. package/dist/components/TabAccessoryButton/tabAccessoryThemeRoles.d.ts +14 -0
  198. package/dist/components/TabAccessoryButton/tabAccessoryThemeRoles.d.ts.map +1 -0
  199. package/dist/components/TabAccessoryButton/tabAccessoryThemeRoles.js +19 -0
  200. package/dist/components/TabAccessoryButton/tabAccessoryThemeRoles.js.map +1 -0
  201. package/dist/components/TabAccessoryButton/types.d.ts +27 -0
  202. package/dist/components/TabAccessoryButton/types.d.ts.map +1 -0
  203. package/dist/components/TabAccessoryButton/types.js +3 -0
  204. package/dist/components/TabAccessoryButton/types.js.map +1 -0
  205. package/dist/components/index.d.ts +9 -3
  206. package/dist/components/index.d.ts.map +1 -1
  207. package/dist/components/index.js +30 -1
  208. package/dist/components/index.js.map +1 -1
  209. package/dist/index.d.ts +11 -4
  210. package/dist/index.d.ts.map +1 -1
  211. package/dist/index.js +34 -2
  212. package/dist/index.js.map +1 -1
  213. package/dist/layout/HeaderInsetProbe.d.ts +15 -0
  214. package/dist/layout/HeaderInsetProbe.d.ts.map +1 -0
  215. package/dist/layout/HeaderInsetProbe.js +28 -0
  216. package/dist/layout/HeaderInsetProbe.js.map +1 -0
  217. package/dist/layout/headerInset.d.ts +26 -0
  218. package/dist/layout/headerInset.d.ts.map +1 -0
  219. package/dist/layout/headerInset.js +29 -0
  220. package/dist/layout/headerInset.js.map +1 -0
  221. package/dist/layout/index.d.ts +1 -0
  222. package/dist/layout/index.d.ts.map +1 -1
  223. package/dist/layout/index.js +3 -1
  224. package/dist/layout/index.js.map +1 -1
  225. package/dist/layout/sheet.d.ts +3 -0
  226. package/dist/layout/sheet.d.ts.map +1 -0
  227. package/dist/layout/sheet.js +6 -0
  228. package/dist/layout/sheet.js.map +1 -0
  229. package/dist/theme/ThemeProvider.d.ts +4 -1
  230. package/dist/theme/ThemeProvider.d.ts.map +1 -1
  231. package/dist/theme/ThemeProvider.js +5 -2
  232. package/dist/theme/ThemeProvider.js.map +1 -1
  233. package/dist/theme/index.d.ts +2 -0
  234. package/dist/theme/index.d.ts.map +1 -1
  235. package/dist/theme/index.js +6 -1
  236. package/dist/theme/index.js.map +1 -1
  237. package/dist/theme/resolveThemeSpacing.d.ts +12 -0
  238. package/dist/theme/resolveThemeSpacing.d.ts.map +1 -0
  239. package/dist/theme/resolveThemeSpacing.js +14 -0
  240. package/dist/theme/resolveThemeSpacing.js.map +1 -0
  241. package/dist/theme/types.d.ts +2 -0
  242. package/dist/theme/types.d.ts.map +1 -1
  243. package/dist/theme/useThemeSpacing.d.ts +4 -0
  244. package/dist/theme/useThemeSpacing.d.ts.map +1 -0
  245. package/dist/theme/useThemeSpacing.js +11 -0
  246. package/dist/theme/useThemeSpacing.js.map +1 -0
  247. package/docs/components/button.md +92 -38
  248. package/docs/components/choice.md +111 -0
  249. package/docs/components/error-banner.md +46 -3
  250. package/docs/components/form-sheet.md +140 -0
  251. package/docs/components/form.md +80 -45
  252. package/docs/components/header-button.md +310 -0
  253. package/docs/components/header-wash.md +40 -0
  254. package/docs/components/page.md +183 -0
  255. package/docs/components/select.md +2 -2
  256. package/docs/components/tab-accessory-button.md +146 -0
  257. package/docs/specifications/Liquid Glass header buttons in Expo Router.md +327 -0
  258. package/package.json +1 -1
  259. package/src/components/Button/Button.tsx +82 -38
  260. package/src/components/Button/buttonAppearance.test.ts +44 -0
  261. package/src/components/Button/buttonAppearance.ts +38 -0
  262. package/src/components/Button/buttonThemeRoles.test.ts +10 -0
  263. package/src/components/Button/buttonThemeRoles.ts +6 -0
  264. package/src/components/Button/index.ts +12 -1
  265. package/src/components/Choice/Choice.tsx +120 -0
  266. package/src/components/Choice/choiceLayout.test.ts +49 -0
  267. package/src/components/Choice/choiceLayout.ts +34 -0
  268. package/src/components/Choice/choiceThemeRoles.test.ts +15 -0
  269. package/src/components/Choice/choiceThemeRoles.ts +9 -0
  270. package/src/components/Choice/index.ts +4 -0
  271. package/src/components/Choice/types.ts +33 -0
  272. package/src/components/ErrorBanner/ErrorBanner.tsx +32 -22
  273. package/src/components/ErrorBanner/errorBannerContext.tsx +31 -6
  274. package/src/components/ErrorBanner/errorBannerLayout.test.ts +49 -0
  275. package/src/components/ErrorBanner/errorBannerLayout.ts +59 -0
  276. package/src/components/ErrorBanner/icons.tsx +25 -6
  277. package/src/components/ErrorBanner/index.ts +1 -0
  278. package/src/components/Form/Form.tsx +77 -173
  279. package/src/components/Form/FormCloseButton.tsx +12 -4
  280. package/src/components/Form/FormErrorBanner.tsx +57 -0
  281. package/src/components/Form/FormSubmitFooter.tsx +70 -0
  282. package/src/components/Form/formThemeRoles.test.ts +13 -0
  283. package/src/components/Form/formThemeRoles.ts +7 -0
  284. package/src/components/Form/index.ts +1 -0
  285. package/src/components/Form/types.ts +14 -10
  286. package/src/components/FormSheet/FormSheet.tsx +279 -0
  287. package/src/components/FormSheet/formSheetLayout.test.ts +66 -0
  288. package/src/components/FormSheet/formSheetLayout.ts +55 -0
  289. package/src/components/FormSheet/formSheetThemeRoles.test.ts +14 -0
  290. package/src/components/FormSheet/formSheetThemeRoles.ts +8 -0
  291. package/src/components/FormSheet/index.ts +7 -0
  292. package/src/components/FormSheet/types.ts +66 -0
  293. package/src/components/HeaderButton/HeaderCapsule.tsx +63 -0
  294. package/src/components/HeaderButton/HeaderGroup.tsx +36 -0
  295. package/src/components/HeaderButton/HeaderIcon.tsx +56 -0
  296. package/src/components/HeaderButton/headerButtonLayout.test.ts +47 -0
  297. package/src/components/HeaderButton/headerButtonLayout.ts +36 -0
  298. package/src/components/HeaderButton/headerButtonThemeRoles.test.ts +9 -0
  299. package/src/components/HeaderButton/headerButtonThemeRoles.ts +5 -0
  300. package/src/components/HeaderButton/index.ts +14 -0
  301. package/src/components/HeaderButton/types.ts +40 -0
  302. package/src/components/HeaderWash/HeaderWash.tsx +20 -0
  303. package/src/components/HeaderWash/headerWashGradient.test.ts +22 -0
  304. package/src/components/{Form/withAlpha.ts → HeaderWash/headerWashGradient.ts} +9 -0
  305. package/src/components/HeaderWash/index.ts +1 -0
  306. package/src/components/Page/Page.tsx +80 -0
  307. package/src/components/Page/PageBleed.tsx +14 -0
  308. package/src/components/Page/index.ts +4 -0
  309. package/src/components/Page/pageContext.ts +8 -0
  310. package/src/components/Page/pageInsets.test.ts +73 -0
  311. package/src/components/Page/pageInsets.ts +52 -0
  312. package/src/components/Page/pageThemeRoles.test.ts +9 -0
  313. package/src/components/Page/pageThemeRoles.ts +5 -0
  314. package/src/components/Page/types.ts +26 -0
  315. package/src/components/Select/Select.tsx +11 -4
  316. package/src/components/Select/selectThemeRoles.test.ts +5 -0
  317. package/src/components/Select/selectThemeRoles.ts +2 -0
  318. package/src/components/Select/types.ts +4 -0
  319. package/src/components/TabAccessoryButton/TabAccessoryButton.tsx +150 -0
  320. package/src/components/TabAccessoryButton/index.ts +12 -0
  321. package/src/components/TabAccessoryButton/tabAccessoryLayout.test.ts +42 -0
  322. package/src/components/TabAccessoryButton/tabAccessoryLayout.ts +43 -0
  323. package/src/components/TabAccessoryButton/tabAccessoryThemeRoles.test.ts +28 -0
  324. package/src/components/TabAccessoryButton/tabAccessoryThemeRoles.ts +22 -0
  325. package/src/components/TabAccessoryButton/types.ts +27 -0
  326. package/src/components/index.ts +64 -2
  327. package/src/index.ts +61 -2
  328. package/src/layout/headerInset.test.ts +60 -0
  329. package/src/layout/headerInset.ts +41 -0
  330. package/src/layout/index.ts +1 -0
  331. package/src/layout/sheet.ts +2 -0
  332. package/src/theme/ThemeProvider.tsx +9 -1
  333. package/src/theme/index.ts +6 -0
  334. package/src/theme/resolveThemeSpacing.test.ts +29 -0
  335. package/src/theme/resolveThemeSpacing.ts +21 -0
  336. package/src/theme/types.ts +3 -0
  337. package/src/theme/useThemeSpacing.ts +8 -0
  338. package/src/components/Form/withAlpha.test.ts +0 -13
@@ -7,8 +7,9 @@ const react_native_1 = require("react-native");
7
7
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
8
8
  const buttonRadius_1 = require("../Button/buttonRadius");
9
9
  const useResolvedFieldColor_1 = require("../Field/useResolvedFieldColor");
10
- const screenPadding_1 = require("../../layout/screenPadding");
10
+ const useThemeSpacing_1 = require("../../theme/useThemeSpacing");
11
11
  const errorBannerCopy_1 = require("./errorBannerCopy");
12
+ const errorBannerLayout_1 = require("./errorBannerLayout");
12
13
  const errorBannerThemeRoles_1 = require("./errorBannerThemeRoles");
13
14
  const icons_1 = require("./icons");
14
15
  const BOTTOM_RADIUS = (0, buttonRadius_1.buttonRadiusValue)("xl");
@@ -17,7 +18,9 @@ const BOTTOM_RADIUS = (0, buttonRadius_1.buttonRadiusValue)("xl");
17
18
  * exit animation can play. It is not tied to a form shell: pass `errors`,
18
19
  * `onJump`, and `onDismiss`. `Form` does that by default.
19
20
  */
20
- function ErrorBanner({ open, errors, onJump, onDismiss, onHeightChange, safeAreaTop, paddingHorizontal = screenPadding_1.screenPaddingHorizontal, backgroundColor: backgroundColorProp, textColor: textColorProp, secondaryColor: secondaryColorProp, dividerColor: dividerColorProp, accentColor: accentColorProp, }) {
21
+ function ErrorBanner({ open, errors, onJump, onDismiss, onHeightChange, safeAreaTop, paddingHorizontal: paddingHorizontalProp, backgroundColor: backgroundColorProp, textColor: textColorProp, secondaryColor: secondaryColorProp, dividerColor: dividerColorProp, accentColor: accentColorProp, }) {
22
+ const spacing = (0, useThemeSpacing_1.useThemeSpacing)();
23
+ const paddingHorizontal = paddingHorizontalProp ?? spacing.screen;
21
24
  const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
22
25
  const topInset = safeAreaTop ?? insets.top;
23
26
  const backgroundColor = (0, useResolvedFieldColor_1.useResolvedFieldColor)(backgroundColorProp, errorBannerThemeRoles_1.ERROR_BANNER_THEME_ROLES.backgroundColor);
@@ -63,7 +66,7 @@ function ErrorBanner({ open, errors, onJump, onDismiss, onHeightChange, safeArea
63
66
  setHeight((current) => (current === next ? current : next));
64
67
  onHeightChange?.(next);
65
68
  };
66
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [open ? (0, jsx_runtime_1.jsx)(react_native_1.StatusBar, { animated: true, barStyle: "light-content" }) : null, (0, jsx_runtime_1.jsxs)(react_native_1.Animated.View, { accessibilityRole: "alert", accessibilityElementsHidden: !open, importantForAccessibility: open ? "auto" : "no-hide-descendants", onLayout: onLayout, pointerEvents: open ? "auto" : "none", style: [
69
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [open ? (0, jsx_runtime_1.jsx)(react_native_1.StatusBar, { animated: true, barStyle: (0, errorBannerLayout_1.errorBannerBarStyle)(backgroundColor) }) : null, (0, jsx_runtime_1.jsxs)(react_native_1.Animated.View, { accessibilityRole: "alert", accessibilityElementsHidden: !open, importantForAccessibility: open ? "auto" : "no-hide-descendants", onLayout: onLayout, pointerEvents: open ? "auto" : "none", style: [
67
70
  styles.banner,
68
71
  {
69
72
  backgroundColor,
@@ -73,11 +76,11 @@ function ErrorBanner({ open, errors, onJump, onDismiss, onHeightChange, safeArea
73
76
  borderBottomRightRadius: BOTTOM_RADIUS,
74
77
  },
75
78
  motion,
76
- ], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.header, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.iconDisc, { backgroundColor: accentColor }], children: (0, jsx_runtime_1.jsx)(icons_1.Megaphone, { color: backgroundColor }) }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.title, { color: textColor }], children: title }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityLabel: "Dismiss", accessibilityRole: "button", hitSlop: 12, onPress: onDismiss, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.dismiss, { color: secondaryColor }], children: "\u2715" }) })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.rows, children: errors.map((error) => ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityLabel: `${error.short}. Go to field.`, accessibilityRole: "button", hitSlop: { top: 4, bottom: 4 }, onPress: () => onJump(error.field), style: ({ pressed }) => [
79
+ ], children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: styles.header, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: [styles.iconDisc, { backgroundColor: accentColor }], children: (0, jsx_runtime_1.jsx)(icons_1.Megaphone, { color: backgroundColor, size: errorBannerLayout_1.ERROR_BANNER_MEGAPHONE_SIZE }) }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.title, { color: textColor }], children: title }), (0, jsx_runtime_1.jsx)(react_native_1.Pressable, { accessibilityLabel: "Dismiss", accessibilityRole: "button", hitSlop: 12, onPress: onDismiss, children: (0, jsx_runtime_1.jsx)(icons_1.Cross, { color: secondaryColor, size: errorBannerLayout_1.ERROR_BANNER_DISMISS_SIZE }) })] }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.rows, children: errors.map((error) => ((0, jsx_runtime_1.jsxs)(react_native_1.Pressable, { accessibilityLabel: `${error.short}. Go to field.`, accessibilityRole: "button", onPress: () => onJump(error.field), style: ({ pressed }) => [
77
80
  styles.row,
78
81
  { borderTopColor: dividerColor },
79
82
  pressed && styles.pressed,
80
- ], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.rowLabel, { color: textColor }], children: error.short }), (0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: (0, jsx_runtime_1.jsx)(icons_1.ArrowRight, { color: secondaryColor }) })] }, error.field))) })] })] }));
83
+ ], children: [(0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [styles.rowLabel, { color: textColor }], children: error.short }), (0, jsx_runtime_1.jsx)(react_native_1.View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", children: (0, jsx_runtime_1.jsx)(icons_1.ArrowRight, { color: secondaryColor, size: errorBannerLayout_1.ERROR_BANNER_ARROW_SIZE }) })] }, error.field))) })] })] }));
81
84
  }
82
85
  const styles = react_native_1.StyleSheet.create({
83
86
  banner: {
@@ -87,7 +90,7 @@ const styles = react_native_1.StyleSheet.create({
87
90
  right: 0,
88
91
  zIndex: 100,
89
92
  paddingBottom: 10,
90
- shadowColor: "#22201D",
93
+ shadowColor: "#000000",
91
94
  shadowOpacity: 0.25,
92
95
  shadowRadius: 12,
93
96
  shadowOffset: { width: 0, height: 8 },
@@ -96,32 +99,29 @@ const styles = react_native_1.StyleSheet.create({
96
99
  header: {
97
100
  flexDirection: "row",
98
101
  alignItems: "center",
99
- gap: 10,
102
+ gap: errorBannerLayout_1.ERROR_BANNER_HEADER_GAP,
100
103
  },
101
104
  iconDisc: {
102
- width: 28,
103
- height: 28,
104
- borderRadius: 14,
105
+ width: errorBannerLayout_1.ERROR_BANNER_DISC_SIZE,
106
+ height: errorBannerLayout_1.ERROR_BANNER_DISC_SIZE,
107
+ borderRadius: errorBannerLayout_1.ERROR_BANNER_DISC_SIZE / 2,
105
108
  alignItems: "center",
106
109
  justifyContent: "center",
107
110
  },
108
111
  title: {
109
112
  flex: 1,
110
- fontSize: 15,
111
- lineHeight: 20,
113
+ fontSize: errorBannerLayout_1.ERROR_BANNER_FONT_SIZE,
114
+ lineHeight: errorBannerLayout_1.ERROR_BANNER_LINE_HEIGHT,
112
115
  fontWeight: "600",
113
116
  },
114
- dismiss: {
115
- fontSize: 15,
116
- },
117
117
  rows: {
118
118
  marginTop: 6,
119
119
  },
120
120
  row: {
121
121
  flexDirection: "row",
122
122
  alignItems: "center",
123
- minHeight: 36,
124
- marginLeft: 38,
123
+ minHeight: errorBannerLayout_1.ERROR_BANNER_ROW_MIN_HEIGHT,
124
+ marginLeft: errorBannerLayout_1.ERROR_BANNER_ROW_INSET,
125
125
  borderTopWidth: 1,
126
126
  },
127
127
  pressed: {
@@ -129,8 +129,8 @@ const styles = react_native_1.StyleSheet.create({
129
129
  },
130
130
  rowLabel: {
131
131
  flex: 1,
132
- fontSize: 15,
133
- lineHeight: 20,
132
+ fontSize: errorBannerLayout_1.ERROR_BANNER_FONT_SIZE,
133
+ lineHeight: errorBannerLayout_1.ERROR_BANNER_LINE_HEIGHT,
134
134
  },
135
135
  });
136
136
  //# sourceMappingURL=ErrorBanner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBanner.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/ErrorBanner.tsx"],"names":[],"mappings":";;AA4BA,kCAoJC;;AAhLD,iCAAoD;AACpD,+CAUsB;AACtB,mFAAmE;AACnE,yDAA2D;AAC3D,0EAAuE;AACvE,8DAAqE;AACrE,uDAAqD;AACrD,mEAAmE;AACnE,mCAAgD;AAGhD,MAAM,aAAa,GAAG,IAAA,gCAAiB,EAAC,IAAI,CAAC,CAAC;AAE9C;;;;GAIG;AACH,SAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,MAAM,EACN,MAAM,EACN,SAAS,EACT,cAAc,EACd,WAAW,EACX,iBAAiB,GAAG,uCAAuB,EAC3C,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,aAAa,EACxB,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,eAAe,GACX;IACjB,MAAM,MAAM,GAAG,IAAA,kDAAiB,GAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC;IAC3C,MAAM,eAAe,GAAG,IAAA,6CAAqB,EAC3C,mBAAmB,EACnB,gDAAwB,CAAC,eAAe,CACzC,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,6CAAqB,EACrC,aAAa,EACb,gDAAwB,CAAC,SAAS,CACnC,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,6CAAqB,EAC1C,kBAAkB,EAClB,gDAAwB,CAAC,cAAc,CACxC,CAAC;IACF,MAAM,YAAY,GAAG,IAAA,6CAAqB,EACxC,gBAAgB,EAChB,gDAAwB,CAAC,YAAY,CACtC,CAAC;IACF,MAAM,WAAW,GAAG,IAAA,6CAAqB,EACvC,eAAe,EACf,gDAAwB,CAAC,WAAW,CACrC,C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B,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,CAAC;KAClB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,GAAG;KACb;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;KACf;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"ErrorBanner.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/ErrorBanner.tsx"],"names":[],"mappings":";;AAwCA,kCAqJC;;AA7LD,iCAAoD;AACpD,+CAUsB;AACtB,mFAAmE;AACnE,yDAA2D;AAC3D,0EAAuE;AACvE,iEAA8D;AAC9D,uDAAqD;AACrD,2DAW6B;AAC7B,mEAAmE;AACnE,mCAAuD;AAGvD,MAAM,aAAa,GAAG,IAAA,gCAAiB,EAAC,IAAI,CAAC,CAAC;AAE9C;;;;GAIG;AACH,SAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,MAAM,EACN,MAAM,EACN,SAAS,EACT,cAAc,EACd,WAAW,EACX,iBAAiB,EAAE,qBAAqB,EACxC,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,aAAa,EACxB,cAAc,EAAE,kBAAkB,EAClC,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,eAAe,GACX;IACjB,MAAM,OAAO,GAAG,IAAA,iCAAe,GAAE,CAAC;IAClC,MAAM,iBAAiB,GAAG,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;IAClE,MAAM,MAAM,GAAG,IAAA,kDAAiB,GAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC;IAC3C,MAAM,eAAe,GAAG,IAAA,6CAAqB,EAC3C,mBAAmB,EACnB,gDAAwB,CAAC,eAAe,CACzC,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,6CAAqB,EACrC,aAAa,EACb,gDAAwB,CAAC,SAAS,CACnC,CAAC;IAC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QACL,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,0CAAsB;QAChC,UAAU,EAAE,4CAAwB;QACpC,UAAU,EAAE,KAAK;KAClB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,CAAC;KACb;IACD,GAAG,EAAE;QACH,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,+CAA2B;QACtC,UAAU,EAAE,0CAAsB;QAClC,cAAc,EAAE,CAAC;KAClB;IACD,OAAO,EAAE;QACP,OAAO,EAAE,GAAG;KACb;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,0CAAsB;QAChC,UAAU,EAAE,4CAAwB;KACrC;CACF,CAAC,CAAC"}
@@ -1,6 +1,13 @@
1
1
  import { type ReactNode, type RefObject } from "react";
2
- import { View, type ScrollView } from "react-native";
2
+ import { View } from "react-native";
3
3
  import type { FieldError } from "./types";
4
+ /** Anything that scrolls: a ScrollView, a KeyboardAwareScrollView, a BottomSheetScrollView. */
5
+ export type ErrorBannerScrollTarget = {
6
+ scrollTo(options: {
7
+ y: number;
8
+ animated?: boolean;
9
+ }): void;
10
+ };
4
11
  export type ErrorBannerAnchor = {
5
12
  view: View;
6
13
  focus?: () => void;
@@ -21,12 +28,25 @@ export declare function useErrorBannerField(name: string | undefined, focus?: ()
21
28
  viewRef: RefObject<View | null>;
22
29
  listed: FieldError | undefined;
23
30
  };
24
- export declare function ErrorBannerProvider({ children, scrollRef, errors, onDismiss, bannerHeightRef, }: {
31
+ export declare function ErrorBannerProvider({ children, scrollRef, errors, onDismiss, bannerHeightRef, measureRef, onBeforeJump, scrollYForField, }: {
25
32
  children: ReactNode;
26
- scrollRef: RefObject<ScrollView | null>;
33
+ scrollRef: RefObject<ErrorBannerScrollTarget | null>;
27
34
  errors: readonly FieldError[];
28
35
  onDismiss: () => void;
36
+ /** How far the banner covers the top of the scroll area. */
29
37
  bannerHeightRef: RefObject<number>;
38
+ /**
39
+ * View that field positions are measured against: the scroll content's
40
+ * top. Defaults to `scrollRef`, which works for a plain ScrollView.
41
+ */
42
+ measureRef?: RefObject<View | null>;
43
+ /** Runs before scrolling to a field, e.g. to expand a sheet. */
44
+ onBeforeJump?: () => void;
45
+ /**
46
+ * Scroll offset for a field at content y `fieldY`. Defaults to clearing
47
+ * `bannerHeightRef` from the top of the scroll area.
48
+ */
49
+ scrollYForField?: (fieldY: number) => number;
30
50
  }): import("react").JSX.Element;
31
51
  export declare function ErrorBannerField({ name, children, }: {
32
52
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"errorBannerContext.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBanner/errorBannerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAA2B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;IACpE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAIF,wBAAgB,qBAAqB,IAAI,uBAAuB,GAAG,IAAI,CAEtE;AAED,wBAAgB,qBAAqB,IAAI,MAAM,IAAI,CAGlD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,CAAC,EAAE,MA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pE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAIF,wBAAgB,qBAAqB,IAAI,uBAAuB,GAAG,IAAI,CAEtE;AAED,wBAAgB,qBAAqB,IAAI,MAAM,IAAI,CAGlD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,KAAK,CAAC,EAAE,MAAM,IAAI;;;EA2BnB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EACT,MAAM,EACN,SAAS,EACT,eAAe,EACf,UAAU,EACV,YAAY,EACZ,eAAe,GAChB,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;IACrD,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,4DAA4D;IAC5D,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACnC;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;IACpC,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9C,+BA4CA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAOA"}
@@ -45,7 +45,7 @@ function useErrorBannerField(name, focus) {
45
45
  : undefined;
46
46
  return { viewRef, listed };
47
47
  }
48
- function ErrorBannerProvider({ children, scrollRef, errors, onDismiss, bannerHeightRef, }) {
48
+ function ErrorBannerProvider({ children, scrollRef, errors, onDismiss, bannerHeightRef, measureRef, onBeforeJump, scrollYForField, }) {
49
49
  const anchors = (0, react_1.useRef)(new Map());
50
50
  const register = (0, react_1.useCallback)((field, anchor) => {
51
51
  if (!anchor) {
@@ -57,17 +57,21 @@ function ErrorBannerProvider({ children, scrollRef, errors, onDismiss, bannerHei
57
57
  const jump = (0, react_1.useCallback)((field) => {
58
58
  const anchor = anchors.current.get(field);
59
59
  const scroll = scrollRef.current;
60
- if (!anchor || !scroll) {
60
+ const relativeTo = measureRef?.current ?? scroll;
61
+ if (!anchor || !scroll || !relativeTo) {
61
62
  return;
62
63
  }
63
- anchor.view.measureLayout(scroll, (_x, y) => {
64
+ onBeforeJump?.();
65
+ anchor.view.measureLayout(relativeTo, (_x, y) => {
64
66
  scroll.scrollTo({
65
- y: (0, errorBannerCopy_1.fieldScrollY)(y, bannerHeightRef.current ?? 0),
67
+ y: scrollYForField
68
+ ? scrollYForField(y)
69
+ : (0, errorBannerCopy_1.fieldScrollY)(y, bannerHeightRef.current ?? 0),
66
70
  animated: true,
67
71
  });
68
72
  anchor.focus?.();
69
73
  }, () => undefined);
70
- }, [bannerHeightRef, scrollRef]);
74
+ }, [bannerHeightRef, measureRef, onBeforeJump, scrollRef, scrollYForField]);
71
75
  const value = (0, react_1.useMemo)(() => ({ errors, register, dismiss: onDismiss, jump }), [errors, jump, onDismiss, register]);
72
76
  return ((0, jsx_runtime_1.jsx)(ErrorBannerContext.Provider, { value: value, children: children }));
73
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"errorBannerContext.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/errorBannerContext.tsx"],"names":[],"mappings":";;AA4BA,sDAEC;AAED,sDAGC;AAMD,kDA6BC;AAED,kDAoDC;AAED,4CAaC;;AA3ID,iCASe;AACf,+CAA8E;AAC9E,uDAAiD;AAejD,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EAAiC,IAAI,CAAC,CAAC;AAE/E,SAAgB,qBAAqB;IACnC,OAAO,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,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EACtD,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CACpC,CAAC;IAEF,OAAO,CACL,uBAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACtC,QAAQ,GACmB,CAC/B,CAAC;AACJ,CAAC;AAED,SAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,GAIT;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,CACL,uBAAC,mBAAI,IAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,YACnC,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"errorBannerContext.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/errorBannerContext.tsx"],"names":[],"mappings":";;AAiCA,sDAEC;AAED,sDAGC;AAMD,kDA6BC;AAED,kDAwEC;AAED,4CAaC;;AApKD,iCASe;AACf,+CAA6D;AAC7D,uDAAiD;AAoBjD,MAAM,kBAAkB,GAAG,IAAA,qBAAa,EAAiC,IAAI,CAAC,CAAC;AAE/E,SAAgB,qBAAqB;IACnC,OAAO,IAAA,kBAAU,EAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC;AAED,SAAgB,qBAAqB;IACnC,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,kBAAkB,CAAC,CAAC;IAC3C,OAAO,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;AAC3C,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,IAAwB,EACxB,KAAkB;IAElB,MAAM,GAAG,GAAG,IAAA,kBAAU,EAAC,kBAAkB,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAA,cAAM,EAAO,I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CAAC,CACpC,CAAC;IAEF,OAAO,CACL,uBAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACtC,QAAQ,GACmB,CAC/B,CAAC;AACJ,CAAC;AAED,SAAgB,gBAAgB,CAAC,EAC/B,IAAI,EACJ,QAAQ,GAIT;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,CACL,uBAAC,mBAAI,IAAC,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,YACnC,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** Title and rows, matching the 17pt body text of Button, Field and Select. */
2
+ export declare const ERROR_BANNER_FONT_SIZE = 17;
3
+ export declare const ERROR_BANNER_LINE_HEIGHT = 22;
4
+ export declare const ERROR_BANNER_DISC_SIZE = 32;
5
+ export declare const ERROR_BANNER_MEGAPHONE_SIZE = 18;
6
+ export declare const ERROR_BANNER_ARROW_SIZE = 20;
7
+ export declare const ERROR_BANNER_DISMISS_SIZE = 18;
8
+ export declare const ERROR_BANNER_HEADER_GAP = 12;
9
+ export declare const ERROR_BANNER_ROW_MIN_HEIGHT = 44;
10
+ /** Rows start under the title, past the disc and gap. */
11
+ export declare const ERROR_BANNER_ROW_INSET: number;
12
+ export type ErrorBannerBarStyle = "light-content" | "dark-content" | "default";
13
+ /**
14
+ * Status bar text that stays readable over the banner fill: light text on a
15
+ * dark banner, dark text on a light one. Pure so it can be unit-tested.
16
+ */
17
+ export declare function errorBannerBarStyle(backgroundColor: string): ErrorBannerBarStyle;
18
+ //# sourceMappingURL=errorBannerLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorBannerLayout.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBanner/errorBannerLayout.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAC5C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAC9C,yDAAyD;AACzD,eAAO,MAAM,sBAAsB,QACe,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,cAAc,GAAG,SAAS,CAAC;AA8B/E;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,GAAG,mBAAmB,CAWhF"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERROR_BANNER_ROW_INSET = exports.ERROR_BANNER_ROW_MIN_HEIGHT = exports.ERROR_BANNER_HEADER_GAP = exports.ERROR_BANNER_DISMISS_SIZE = exports.ERROR_BANNER_ARROW_SIZE = exports.ERROR_BANNER_MEGAPHONE_SIZE = exports.ERROR_BANNER_DISC_SIZE = exports.ERROR_BANNER_LINE_HEIGHT = exports.ERROR_BANNER_FONT_SIZE = void 0;
4
+ exports.errorBannerBarStyle = errorBannerBarStyle;
5
+ /** Title and rows, matching the 17pt body text of Button, Field and Select. */
6
+ exports.ERROR_BANNER_FONT_SIZE = 17;
7
+ exports.ERROR_BANNER_LINE_HEIGHT = 22;
8
+ exports.ERROR_BANNER_DISC_SIZE = 32;
9
+ exports.ERROR_BANNER_MEGAPHONE_SIZE = 18;
10
+ exports.ERROR_BANNER_ARROW_SIZE = 20;
11
+ exports.ERROR_BANNER_DISMISS_SIZE = 18;
12
+ exports.ERROR_BANNER_HEADER_GAP = 12;
13
+ exports.ERROR_BANNER_ROW_MIN_HEIGHT = 44;
14
+ /** Rows start under the title, past the disc and gap. */
15
+ exports.ERROR_BANNER_ROW_INSET = exports.ERROR_BANNER_DISC_SIZE + exports.ERROR_BANNER_HEADER_GAP;
16
+ function parseRgb(color) {
17
+ const value = color.trim();
18
+ const hex = /^#([0-9a-f]{3,8})$/i.exec(value)?.[1];
19
+ if (hex) {
20
+ const full = hex.length === 3 || hex.length === 4
21
+ ? hex
22
+ .slice(0, 3)
23
+ .split("")
24
+ .map((c) => c + c)
25
+ .join("")
26
+ : hex.slice(0, 6);
27
+ if (full.length !== 6) {
28
+ return null;
29
+ }
30
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16));
31
+ }
32
+ const rgb = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(value);
33
+ if (rgb) {
34
+ return [Number(rgb[1]), Number(rgb[2]), Number(rgb[3])];
35
+ }
36
+ return null;
37
+ }
38
+ /**
39
+ * Status bar text that stays readable over the banner fill: light text on a
40
+ * dark banner, dark text on a light one. Pure so it can be unit-tested.
41
+ */
42
+ function errorBannerBarStyle(backgroundColor) {
43
+ const rgb = parseRgb(backgroundColor);
44
+ if (!rgb) {
45
+ return "default";
46
+ }
47
+ const [r, g, b] = rgb.map((c) => {
48
+ const s = c / 255;
49
+ return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
50
+ });
51
+ const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
52
+ return luminance > 0.179 ? "dark-content" : "light-content";
53
+ }
54
+ //# sourceMappingURL=errorBannerLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorBannerLayout.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/errorBannerLayout.ts"],"names":[],"mappings":";;;AA+CA,kDAWC;AA1DD,+EAA+E;AAClE,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAC5B,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAC9B,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAC5B,QAAA,2BAA2B,GAAG,EAAE,CAAC;AACjC,QAAA,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CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,eAAuB;IACzD,MAAM,GAAG,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;IACtC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;QAClB,OAAO,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;IACvD,OAAO,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;AAC9D,CAAC"}
@@ -1,7 +1,9 @@
1
- export declare function Megaphone({ color }: {
1
+ type IconProps = {
2
2
  color: string;
3
- }): import("react").JSX.Element;
4
- export declare function ArrowRight({ color }: {
5
- color: string;
6
- }): import("react").JSX.Element;
3
+ size: number;
4
+ };
5
+ export declare function Megaphone({ color, size }: IconProps): import("react").JSX.Element;
6
+ export declare function ArrowRight({ color, size }: IconProps): import("react").JSX.Element;
7
+ export declare function Cross({ color, size }: IconProps): import("react").JSX.Element;
8
+ export {};
7
9
  //# sourceMappingURL=icons.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBanner/icons.tsx"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,+BAiBrD;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,+BAgBtD"}
1
+ {"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBanner/icons.tsx"],"names":[],"mappings":"AAEA,KAAK,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,+BAiBnD;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,+BAgBpD;AAED,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,+BAe/C"}
@@ -35,12 +35,16 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Megaphone = Megaphone;
37
37
  exports.ArrowRight = ArrowRight;
38
+ exports.Cross = Cross;
38
39
  const jsx_runtime_1 = require("react/jsx-runtime");
39
40
  const react_native_svg_1 = __importStar(require("react-native-svg"));
40
- function Megaphone({ color }) {
41
- return ((0, jsx_runtime_1.jsx)(react_native_svg_1.default, { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 1.8, children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { strokeLinecap: "round", strokeLinejoin: "round", d: "M10.34 15.84c-.688-.06-1.386-.09-2.09-.09H7.5a4.5 4.5 0 1 1 0-9h.75c.704 0 1.402-.03 2.09-.09m0 9.18c.253.962.584 1.892.985 2.783.247.55.06 1.21-.463 1.511l-.657.38c-.551.318-1.26.117-1.527-.461a20.845 20.845 0 0 1-1.44-4.282m3.102.069a18.03 18.03 0 0 1-.59-4.59c0-1.586.205-3.124.59-4.59m0 9.18a23.848 23.848 0 0 1 8.835 2.535M10.34 6.66a23.847 23.847 0 0 0 8.835-2.535m0 0A23.74 23.74 0 0 0 18.795 3m.38 1.125a23.91 23.91 0 0 1 1.014 5.395m-1.014 8.855c-.118.38-.245.754-.38 1.125m.38-1.125a23.91 23.91 0 0 0 1.014-5.395m0-3.46c.495.413.811 1.035.811 1.73 0 .695-.316 1.317-.811 1.73m0-3.46a24.347 24.347 0 0 1 0 3.46" }) }));
41
+ function Megaphone({ color, size }) {
42
+ return ((0, jsx_runtime_1.jsx)(react_native_svg_1.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 1.8, children: (0, jsx_runtime_1.jsx)(react_native_svg_1.Path, { strokeLinecap: "round", strokeLinejoin: "round", d: "M10.34 15.84c-.688-.06-1.386-.09-2.09-.09H7.5a4.5 4.5 0 1 1 0-9h.75c.704 0 1.402-.03 2.09-.09m0 9.18c.253.962.584 1.892.985 2.783.247.55.06 1.21-.463 1.511l-.657.38c-.551.318-1.26.117-1.527-.461a20.845 20.845 0 0 1-1.44-4.282m3.102.069a18.03 18.03 0 0 1-.59-4.59c0-1.586.205-3.124.59-4.59m0 9.18a23.848 23.848 0 0 1 8.835 2.535M10.34 6.66a23.847 23.847 0 0 0 8.835-2.535m0 0A23.74 23.74 0 0 0 18.795 3m.38 1.125a23.91 23.91 0 0 1 1.014 5.395m-1.014 8.855c-.118.38-.245.754-.38 1.125m.38-1.125a23.91 23.91 0 0 0 1.014-5.395m0-3.46c.495.413.811 1.035.811 1.73 0 .695-.316 1.317-.811 1.73m0-3.46a24.347 24.347 0 0 1 0 3.46" }) }));
42
43
  }
43
- function ArrowRight({ color }) {
44
- return ((0, jsx_runtime_1.jsxs)(react_native_svg_1.default, { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2.25, strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Line, { x1: 5, y1: 12, x2: 19, y2: 12 }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Polyline, { points: "13 6 19 12 13 18" })] }));
44
+ function ArrowRight({ color, size }) {
45
+ return ((0, jsx_runtime_1.jsxs)(react_native_svg_1.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2.25, strokeLinecap: "round", strokeLinejoin: "round", children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Line, { x1: 5, y1: 12, x2: 19, y2: 12 }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Polyline, { points: "13 6 19 12 13 18" })] }));
46
+ }
47
+ function Cross({ color, size }) {
48
+ return ((0, jsx_runtime_1.jsxs)(react_native_svg_1.default, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: 2.25, strokeLinecap: "round", children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Line, { x1: 6, y1: 6, x2: 18, y2: 18 }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Line, { x1: 18, y1: 6, x2: 6, y2: 18 })] }));
45
49
  }
46
50
  //# sourceMappingURL=icons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/icons.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,8BAiBC;AAED,gCAgBC;;AArCD,qEAA6D;AAE7D,SAAgB,SAAS,CAAC,EAAE,KAAK,EAAqB;IACpD,OAAO,CACL,uBAAC,0BAAG,IACF,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,GAAG,YAEhB,uBAAC,uBAAI,IACH,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,CAAC,EAAC,6mBAA6mB,GAC/mB,GACE,CACP,CAAC;AACJ,CAAC;AAED,SAAgB,UAAU,CAAC,EAAE,KAAK,EAAqB;IACrD,OAAO,CACL,wBAAC,0BAAG,IACF,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,IAAI,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,aAEtB,uBAAC,uBAAI,IAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAI,EACvC,uBAAC,2BAAQ,IAAC,MAAM,EAAC,kBAAkB,GAAG,IAClC,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/icons.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,8BAiBC;AAED,gCAgBC;AAED,sBAeC;;AAxDD,qEAA6D;AAI7D,SAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAa;IAClD,OAAO,CACL,uBAAC,0BAAG,IACF,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,GAAG,YAEhB,uBAAC,uBAAI,IACH,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,CAAC,EAAC,6mBAA6mB,GAC/mB,GACE,CACP,CAAC;AACJ,CAAC;AAED,SAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAa;IACnD,OAAO,CACL,wBAAC,0BAAG,IACF,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,IAAI,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,aAEtB,uBAAC,uBAAI,IAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAI,EACvC,uBAAC,2BAAQ,IAAC,MAAM,EAAC,kBAAkB,GAAG,IAClC,CACP,CAAC;AACJ,CAAC;AAED,SAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAa;IAC9C,OAAO,CACL,wBAAC,0BAAG,IACF,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,KAAK,EACb,WAAW,EAAE,IAAI,EACjB,aAAa,EAAC,OAAO,aAErB,uBAAC,uBAAI,IAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAI,EACtC,uBAAC,uBAAI,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,GAAI,IAClC,CACP,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { ErrorBanner } from "./ErrorBanner";
2
- export { ErrorBannerField, ErrorBannerProvider, useErrorBannerContext, useErrorBannerDismiss, useErrorBannerField, } from "./errorBannerContext";
2
+ export { ErrorBannerField, ErrorBannerProvider, useErrorBannerContext, useErrorBannerDismiss, useErrorBannerField, type ErrorBannerScrollTarget, } from "./errorBannerContext";
3
3
  export { ERROR_BANNER_THEME_ROLES, type ErrorBannerThemeColorProp, } from "./errorBannerThemeRoles";
4
4
  export { useErrorBanner } from "./useErrorBanner";
5
5
  export type { ErrorBannerProps, FieldError } from "./types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBanner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorBanner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,KAAK,uBAAuB,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,GAC/B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2DAM8B;AAL5B,sHAAA,gBAAgB,OAAA;AAChB,yHAAA,mBAAmB,OAAA;AACnB,2HAAA,qBAAqB,OAAA;AACrB,2HAAA,qBAAqB,OAAA;AACrB,yHAAA,mBAAmB,OAAA;AAErB,iEAGiC;AAF/B,iIAAA,wBAAwB,OAAA;AAG1B,mDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ErrorBanner/index.ts"],"names":[],"mappings":";;;AAAA,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,2DAO8B;AAN5B,sHAAA,gBAAgB,OAAA;AAChB,yHAAA,mBAAmB,OAAA;AACnB,2HAAA,qBAAqB,OAAA;AACrB,2HAAA,qBAAqB,OAAA;AACrB,yHAAA,mBAAmB,OAAA;AAGrB,iEAGiC;AAF/B,iIAAA,wBAAwB,OAAA;AAG1B,mDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
@@ -1,3 +1,11 @@
1
1
  import type { FormProps } from "./types";
2
- export declare function Form({ title, children, onClose, onSubmit, errors, submitLabel, submitting, submitDisabled, closeButton, submitRadius, paddingHorizontal, backgroundColor: backgroundColorProp, titleColor: titleColorProp, footerBackgroundColor: footerBackgroundColorProp, buttonBackgroundColor: buttonBackgroundColorProp, buttonLabelColor: buttonLabelColorProp, }: FormProps): import("react").JSX.Element;
2
+ /**
3
+ * A full-screen form under the native stack header. Set the title and the
4
+ * close button in the screen's stack options. The scroll view is the
5
+ * screen's first child, so iOS insets it for the header (including a large
6
+ * title) and content scrolls behind the bar. Render `Form` as the screen's
7
+ * root element. For a wash behind a transparent header, use `HeaderWash` as
8
+ * the stack's `headerBackground`.
9
+ */
10
+ export declare function Form({ children, onSubmit, errors, submitLabel, submitting, submitDisabled, submitRadius, headerHeight: headerHeightProp, paddingHorizontal: paddingHorizontalProp, backgroundColor: backgroundColorProp, footerBackgroundColor: footerBackgroundColorProp, buttonBackgroundColor, buttonLabelColor, }: FormProps): import("react").JSX.Element;
3
11
  //# sourceMappingURL=Form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAuCzC,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,MAAW,EACX,WAAoB,EACpB,UAAkB,EAClB,cAAsB,EACtB,WAAW,EACX,YAAmB,EACnB,iBAA2C,EAC3C,eAAe,EAAE,mBAAmB,EACpC,UAAU,EAAE,cAAc,EAC1B,qBAAqB,EAAE,yBAAyB,EAChD,qBAAqB,EAAE,yBAAyB,EAChD,gBAAgB,EAAE,oBAAoB,GACvC,EAAE,SAAS,+BA4IX"}
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAazC;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,QAAQ,EACR,MAAW,EACX,WAAoB,EACpB,UAAkB,EAClB,cAAsB,EACtB,YAAmB,EACnB,YAAY,EAAE,gBAAgB,EAC9B,iBAAiB,EAAE,qBAAqB,EACxC,eAAe,EAAE,mBAAmB,EACpC,qBAAqB,EAAE,yBAAyB,EAChD,qBAAqB,EACrB,gBAAgB,GACjB,EAAE,SAAS,+BAwGX"}
@@ -5,19 +5,15 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const react_native_1 = require("react-native");
7
7
  const react_native_keyboard_controller_1 = require("react-native-keyboard-controller");
8
- const ErrorBanner_1 = require("../ErrorBanner");
9
8
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
10
- const screenPadding_1 = require("../../layout/screenPadding");
11
- const Button_1 = require("../Button/Button");
12
- const FormCloseButton_1 = require("./FormCloseButton");
9
+ const headerInset_1 = require("../../layout/headerInset");
10
+ const useThemeSpacing_1 = require("../../theme/useThemeSpacing");
11
+ const ErrorBanner_1 = require("../ErrorBanner");
12
+ const errorBannerCopy_1 = require("../ErrorBanner/errorBannerCopy");
13
+ const FormErrorBanner_1 = require("./FormErrorBanner");
14
+ const FormSubmitFooter_1 = require("./FormSubmitFooter");
15
+ const formThemeRoles_1 = require("./formThemeRoles");
13
16
  const useResolvedThemeColor_1 = require("./useResolvedThemeColor");
14
- const withAlpha_1 = require("./withAlpha");
15
- /** How far the header wash continues below the buttons. */
16
- const FADE_TAIL = 32;
17
- function FormErrorBanner({ open, errors, onDismiss, onHeightChange, }) {
18
- const ctx = (0, ErrorBanner_1.useErrorBannerContext)();
19
- return ((0, jsx_runtime_1.jsx)(ErrorBanner_1.ErrorBanner, { errors: errors, onDismiss: onDismiss, onHeightChange: onHeightChange, onJump: (field) => ctx?.jump(field), open: open }));
20
- }
21
17
  /** Space kept between the focused field and the top of the footer. */
22
18
  const FIELD_GAP = 12;
23
19
  /**
@@ -25,89 +21,71 @@ const FIELD_GAP = 12;
25
21
  * the rest of the control below the caret so the rounded bottom stays visible.
26
22
  */
27
23
  const FIELD_BELOW_CARET = 36;
28
- function Form({ title, children, onClose, onSubmit, errors = [], submitLabel = "Save", submitting = false, submitDisabled = false, closeButton, submitRadius = "lg", paddingHorizontal = screenPadding_1.screenPaddingHorizontal, backgroundColor: backgroundColorProp, titleColor: titleColorProp, footerBackgroundColor: footerBackgroundColorProp, buttonBackgroundColor: buttonBackgroundColorProp, buttonLabelColor: buttonLabelColorProp, }) {
24
+ /**
25
+ * A full-screen form under the native stack header. Set the title and the
26
+ * close button in the screen's stack options. The scroll view is the
27
+ * screen's first child, so iOS insets it for the header (including a large
28
+ * title) and content scrolls behind the bar. Render `Form` as the screen's
29
+ * root element. For a wash behind a transparent header, use `HeaderWash` as
30
+ * the stack's `headerBackground`.
31
+ */
32
+ function Form({ children, onSubmit, errors = [], submitLabel = "Save", submitting = false, submitDisabled = false, submitRadius = "lg", headerHeight: headerHeightProp, paddingHorizontal: paddingHorizontalProp, backgroundColor: backgroundColorProp, footerBackgroundColor: footerBackgroundColorProp, buttonBackgroundColor, buttonLabelColor, }) {
33
+ const spacing = (0, useThemeSpacing_1.useThemeSpacing)();
29
34
  const insets = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
30
- const background = (0, useResolvedThemeColor_1.useResolvedThemeColor)(backgroundColorProp, "background");
31
- const titleColor = (0, useResolvedThemeColor_1.useResolvedThemeColor)(titleColorProp, "text");
32
- const footerBackground = (0, useResolvedThemeColor_1.useResolvedThemeColor)(footerBackgroundColorProp, "surface");
33
- const buttonBackground = (0, useResolvedThemeColor_1.useResolvedThemeColor)(buttonBackgroundColorProp, "buttonBackground");
34
- const buttonLabel = (0, useResolvedThemeColor_1.useResolvedThemeColor)(buttonLabelColorProp, "buttonLabel");
35
+ const paddingHorizontal = paddingHorizontalProp ?? spacing.screen;
36
+ const background = (0, useResolvedThemeColor_1.useResolvedThemeColor)(backgroundColorProp, formThemeRoles_1.FORM_THEME_ROLES.backgroundColor);
37
+ const footerBackground = (0, useResolvedThemeColor_1.useResolvedThemeColor)(footerBackgroundColorProp, formThemeRoles_1.FORM_THEME_ROLES.footerBackgroundColor);
35
38
  const scrollRef = (0, react_1.useRef)(null);
36
39
  const bannerHeightRef = (0, react_1.useRef)(0);
40
+ const scrollTopRef = (0, react_1.useRef)(0);
41
+ const headerHeight = headerHeightProp ?? (0, headerInset_1.estimateHeaderHeight)(react_native_1.Platform.OS, insets.top);
42
+ const headerHeightRef = (0, react_1.useRef)(headerHeight);
43
+ headerHeightRef.current = headerHeight;
37
44
  const banner = (0, ErrorBanner_1.useErrorBanner)(errors);
38
45
  const [footerHeight, setFooterHeight] = (0, react_1.useState)(0);
39
- const [cancelWidth, setCancelWidth] = (0, react_1.useState)(0);
40
- const [barHeight, setBarHeight] = (0, react_1.useState)(0);
41
- const resolvedBar = barHeight || insets.top + 52;
42
46
  const onFooterLayout = (event) => {
43
47
  const next = Math.round(event.nativeEvent.layout.height);
44
48
  setFooterHeight((current) => (current === next ? current : next));
45
49
  };
46
- const resolvedClose = closeButton ?? ((0, jsx_runtime_1.jsx)(FormCloseButton_1.FormCloseButton, { onPress: onClose }));
47
- return ((0, jsx_runtime_1.jsx)(ErrorBanner_1.ErrorBannerProvider, { bannerHeightRef: bannerHeightRef, errors: errors, onDismiss: banner.dismiss, scrollRef: scrollRef, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [styles.screen, { backgroundColor: background }], children: [(0, jsx_runtime_1.jsx)(react_native_keyboard_controller_1.KeyboardAwareScrollView, { ref: scrollRef, automaticallyAdjustKeyboardInsets: false, bottomOffset: footerHeight + FIELD_GAP + FIELD_BELOW_CARET, contentContainerStyle: [
48
- styles.content,
49
- {
50
- paddingTop: resolvedBar + FADE_TAIL,
51
- paddingHorizontal,
52
- },
53
- ], contentInsetAdjustmentBehavior: "never", keyboardDismissMode: "interactive", keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: false, style: styles.scroll, children: children }), (0, jsx_runtime_1.jsx)(react_native_1.View, { pointerEvents: "box-none", style: [
54
- styles.fade,
55
- {
56
- height: resolvedBar + FADE_TAIL,
57
- experimental_backgroundImage: `linear-gradient(to bottom, ${(0, withAlpha_1.withAlpha)(background, 0.98)} 0%, ${(0, withAlpha_1.withAlpha)(background, 0.92)} 55%, ${(0, withAlpha_1.withAlpha)(background, 0)} 100%)`,
58
- },
59
- ], children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { onLayout: (event) => {
60
- const next = Math.round(event.nativeEvent.layout.height);
61
- setBarHeight((current) => (current === next ? current : next));
62
- }, pointerEvents: "box-none", style: [
63
- styles.header,
64
- { paddingTop: insets.top, paddingHorizontal },
65
- ], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { onLayout: (event) => {
66
- const next = Math.round(event.nativeEvent.layout.width);
67
- setCancelWidth((current) => (current === next ? current : next));
68
- }, children: resolvedClose }), (0, jsx_runtime_1.jsx)(react_native_1.Text, { accessibilityRole: "header", numberOfLines: 1, pointerEvents: "none", style: [styles.title, { flex: 1, color: titleColor }], children: title }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { width: cancelWidth } })] }) }), (0, jsx_runtime_1.jsx)(react_native_keyboard_controller_1.KeyboardStickyView, { offset: { closed: 0, opened: insets.bottom }, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [styles.footerShell, { backgroundColor: footerBackground }], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { onLayout: onFooterLayout, style: [styles.footer, { paddingHorizontal }], children: (0, jsx_runtime_1.jsx)(Button_1.Button, { backgroundColor: buttonBackground, disabled: submitDisabled, label: submitLabel, labelColor: buttonLabel, loading: submitting, onPress: () => {
69
- banner.present();
70
- onSubmit();
71
- }, radius: submitRadius }) }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { height: insets.bottom } })] }) }), (0, jsx_runtime_1.jsx)(FormErrorBanner, { errors: errors, onDismiss: banner.dismiss, onHeightChange: (height) => {
72
- bannerHeightRef.current = height;
73
- }, open: banner.open })] }) }));
50
+ // Window y of the scroll view: 0 under a transparent header, the header's
51
+ // bottom under an opaque one.
52
+ const onScrollLayout = (event) => {
53
+ event.currentTarget.measureInWindow((_x, y) => {
54
+ scrollTopRef.current = Math.round(y);
55
+ });
56
+ };
57
+ // A banner row scrolls its field clear of the header and the banner.
58
+ const scrollYForField = (0, react_1.useCallback)((fieldY) => {
59
+ const scrollTop = scrollTopRef.current;
60
+ const header = headerHeightRef.current;
61
+ // iOS draws the banner over the window top; Android inside the screen.
62
+ const bannerTop = react_native_1.Platform.OS === "ios" ? 0 : scrollTop;
63
+ return (0, headerInset_1.formFieldScrollY)({
64
+ fieldY,
65
+ scrollTop,
66
+ visibleTop: Math.max(scrollTop, header),
67
+ bannerBottom: bannerTop + bannerHeightRef.current,
68
+ // Under a transparent header iOS rests the content at -(header).
69
+ minScrollY: Math.min(0, scrollTop - header),
70
+ gap: errorBannerCopy_1.ERROR_BANNER_SCROLL_GAP,
71
+ });
72
+ }, []);
73
+ return ((0, jsx_runtime_1.jsxs)(ErrorBanner_1.ErrorBannerProvider, { bannerHeightRef: bannerHeightRef, errors: errors, onDismiss: banner.dismiss, scrollRef: scrollRef, scrollYForField: scrollYForField, children: [(0, jsx_runtime_1.jsx)(react_native_keyboard_controller_1.KeyboardAwareScrollView, { ref: scrollRef, automaticallyAdjustKeyboardInsets: false, bottomOffset: footerHeight + FIELD_GAP + FIELD_BELOW_CARET, contentContainerStyle: [
74
+ styles.content,
75
+ { paddingTop: spacing.pageTop, paddingHorizontal },
76
+ ], contentInsetAdjustmentBehavior: "automatic", keyboardDismissMode: "interactive", keyboardShouldPersistTaps: "handled", onLayout: onScrollLayout, showsVerticalScrollIndicator: false, style: [styles.scroll, { backgroundColor: background }], children: children }), (0, jsx_runtime_1.jsx)(FormSubmitFooter_1.FormSubmitFooter, { backgroundColor: footerBackground, buttonBackgroundColor: buttonBackgroundColor, buttonLabelColor: buttonLabelColor, disabled: submitDisabled, label: submitLabel, onLayout: onFooterLayout, onPress: () => {
77
+ banner.present();
78
+ onSubmit();
79
+ }, paddingHorizontal: paddingHorizontal, radius: submitRadius, submitting: submitting }), (0, jsx_runtime_1.jsx)(FormErrorBanner_1.FormErrorBanner, { errors: errors, onDismiss: banner.dismiss, onHeightChange: (height) => {
80
+ bannerHeightRef.current = height;
81
+ }, open: banner.open })] }));
74
82
  }
75
83
  const styles = react_native_1.StyleSheet.create({
76
- screen: {
77
- flex: 1,
78
- },
79
84
  scroll: {
80
85
  flex: 1,
81
86
  },
82
87
  content: {
83
- paddingTop: 20,
84
88
  paddingBottom: 24,
85
89
  },
86
- fade: {
87
- position: "absolute",
88
- top: 0,
89
- left: 0,
90
- right: 0,
91
- },
92
- header: {
93
- flexDirection: "row",
94
- alignItems: "center",
95
- },
96
- title: {
97
- fontSize: 17,
98
- fontWeight: "600",
99
- textAlign: "center",
100
- },
101
- footerShell: {
102
- // Cast upward so the sticky footer separates from the scroll body.
103
- shadowColor: "#000",
104
- shadowOffset: { width: 0, height: -4 },
105
- shadowOpacity: 0.08,
106
- shadowRadius: 12,
107
- elevation: 8,
108
- },
109
- footer: {
110
- paddingVertical: 12,
111
- },
112
90
  });
113
91
  //# sourceMappingURL=Form.js.map