@btndprojects/loam-ui-native 0.0.0-stage → 0.1.1

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 (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -2
  3. package/dist/accordion/index.js +3 -0
  4. package/dist/adaptive/index.js +2 -0
  5. package/dist/alert/index.js +3 -0
  6. package/dist/analyzer/index.js +6 -0
  7. package/dist/announcement/index.js +6 -0
  8. package/dist/audio-player/index.js +3 -0
  9. package/dist/avatar/index.js +3 -0
  10. package/dist/avatar-group/index.js +3 -0
  11. package/dist/badge/index.js +5 -0
  12. package/dist/banner/index.js +2 -0
  13. package/dist/board/index.js +7 -0
  14. package/dist/button/index.js +5 -0
  15. package/dist/camera-permission/index.js +13 -0
  16. package/dist/capture-result/index.js +18 -0
  17. package/dist/card/index.js +4 -0
  18. package/dist/card-form/index.js +10 -0
  19. package/dist/carousel/index.js +2 -0
  20. package/dist/chart/index.js +6 -0
  21. package/dist/charts/index.js +7 -0
  22. package/dist/checkbox/index.js +7 -0
  23. package/dist/checklist/index.js +10 -0
  24. package/dist/checkout/index.js +13 -0
  25. package/dist/chip/index.js +7 -0
  26. package/dist/chunk-223Q2T2Q.js +229 -0
  27. package/dist/chunk-2A5NIQAK.js +254 -0
  28. package/dist/chunk-2GK6PHGE.js +363 -0
  29. package/dist/chunk-2WUTXHMU.js +1 -0
  30. package/dist/chunk-2ZZ7TDJ4.js +324 -0
  31. package/dist/chunk-35OFI3JG.js +499 -0
  32. package/dist/chunk-3ARE4TES.js +195 -0
  33. package/dist/chunk-3ECPOSKO.js +1 -0
  34. package/dist/chunk-3ENTMPQY.js +229 -0
  35. package/dist/chunk-3HJH6FF4.js +98 -0
  36. package/dist/chunk-3NMD74ZU.js +4 -0
  37. package/dist/chunk-3WPW4KUN.js +182 -0
  38. package/dist/chunk-423B7SPN.js +993 -0
  39. package/dist/chunk-47FWHGUN.js +394 -0
  40. package/dist/chunk-4BXMXBJO.js +141 -0
  41. package/dist/chunk-4DS5ZWVC.js +83 -0
  42. package/dist/chunk-4GBOGOTV.js +295 -0
  43. package/dist/chunk-4SZYY6AN.js +99 -0
  44. package/dist/chunk-4YIP3CWS.js +237 -0
  45. package/dist/chunk-4YQOR7JM.js +204 -0
  46. package/dist/chunk-4ZAHCY44.js +177 -0
  47. package/dist/chunk-52X2VYTD.js +228 -0
  48. package/dist/chunk-5P26LBDL.js +1 -0
  49. package/dist/chunk-5XLRYDAX.js +1 -0
  50. package/dist/chunk-5YNTNN5A.js +177 -0
  51. package/dist/chunk-6HT2LP62.js +504 -0
  52. package/dist/chunk-6N33LFQA.js +35 -0
  53. package/dist/chunk-6X6PQ443.js +432 -0
  54. package/dist/chunk-7CFF4HXS.js +126 -0
  55. package/dist/chunk-7O2FMUPT.js +755 -0
  56. package/dist/chunk-AI4DWZCD.js +162 -0
  57. package/dist/chunk-AWJOCGFZ.js +213 -0
  58. package/dist/chunk-AZRX6SAC.js +285 -0
  59. package/dist/chunk-B54QE2FN.js +1 -0
  60. package/dist/chunk-BC475SJH.js +1 -0
  61. package/dist/chunk-BEDBFJND.js +202 -0
  62. package/dist/chunk-BTTFCMKG.js +166 -0
  63. package/dist/chunk-BV3B2HYZ.js +1635 -0
  64. package/dist/chunk-C2NTXVWM.js +98 -0
  65. package/dist/chunk-CDRZHT42.js +424 -0
  66. package/dist/chunk-CJ5EOYZE.js +62 -0
  67. package/dist/chunk-CUMUNPXY.js +128 -0
  68. package/dist/chunk-CUS3ZSCU.js +1 -0
  69. package/dist/chunk-CYRBHQQZ.js +411 -0
  70. package/dist/chunk-DHWADYZX.js +144 -0
  71. package/dist/chunk-DKCSPATL.js +1 -0
  72. package/dist/chunk-DM5QUKKO.js +326 -0
  73. package/dist/chunk-DYBH2I6W.js +1 -0
  74. package/dist/chunk-DZ255O2F.js +1 -0
  75. package/dist/chunk-E35BPSGW.js +1 -0
  76. package/dist/chunk-EJBDRVIH.js +166 -0
  77. package/dist/chunk-F43NP42L.js +1 -0
  78. package/dist/chunk-F5XNPWS7.js +1024 -0
  79. package/dist/chunk-FMYDDECK.js +1521 -0
  80. package/dist/chunk-G3HOYSF7.js +1 -0
  81. package/dist/chunk-GDKZTW34.js +395 -0
  82. package/dist/chunk-GL7B2DOW.js +134 -0
  83. package/dist/chunk-GNNJ4GCC.js +471 -0
  84. package/dist/chunk-GNZ56EUI.js +1 -0
  85. package/dist/chunk-H6NIOQHK.js +346 -0
  86. package/dist/chunk-H6PC7RDA.js +1 -0
  87. package/dist/chunk-HET4LLMX.js +129 -0
  88. package/dist/chunk-HPPW424V.js +334 -0
  89. package/dist/chunk-HQOQIBJI.js +1 -0
  90. package/dist/chunk-HU2EQNRZ.js +44 -0
  91. package/dist/chunk-HZ6CNMAF.js +870 -0
  92. package/dist/chunk-IIQTAY3J.js +715 -0
  93. package/dist/chunk-ITTYJZWX.js +271 -0
  94. package/dist/chunk-IVNRBPGC.js +1018 -0
  95. package/dist/chunk-J4KLDGI4.js +1 -0
  96. package/dist/chunk-J7Q7VCVC.js +254 -0
  97. package/dist/chunk-JDEOITQ2.js +1 -0
  98. package/dist/chunk-JNH2TYIN.js +96 -0
  99. package/dist/chunk-JNY4ZHAR.js +634 -0
  100. package/dist/chunk-JRLTGLN4.js +1 -0
  101. package/dist/chunk-JTRJJLKL.js +1 -0
  102. package/dist/chunk-JUAMLEHX.js +379 -0
  103. package/dist/chunk-JXJB2X6M.js +131 -0
  104. package/dist/chunk-KMI5ML5I.js +262 -0
  105. package/dist/chunk-KTAC4MGE.js +4 -0
  106. package/dist/chunk-LAECSR4H.js +178 -0
  107. package/dist/chunk-LK4BCSGX.js +1 -0
  108. package/dist/chunk-LOE5YNN3.js +470 -0
  109. package/dist/chunk-LRJNDEIA.js +302 -0
  110. package/dist/chunk-LSS54GLJ.js +116 -0
  111. package/dist/chunk-LZLHELAG.js +137 -0
  112. package/dist/chunk-M2LUXGKZ.js +1 -0
  113. package/dist/chunk-MOUJOP55.js +425 -0
  114. package/dist/chunk-N32RGOA5.js +159 -0
  115. package/dist/chunk-N5ZNE2YE.js +1 -0
  116. package/dist/chunk-NBNCBML6.js +1 -0
  117. package/dist/chunk-NKB7BZYK.js +167 -0
  118. package/dist/chunk-NQYBUO3K.js +1795 -0
  119. package/dist/chunk-NY2U3PBI.js +59 -0
  120. package/dist/chunk-O4AEHWII.js +464 -0
  121. package/dist/chunk-O7AE6DAF.js +146 -0
  122. package/dist/chunk-OETCUXQP.js +134 -0
  123. package/dist/chunk-OOPPQH27.js +179 -0
  124. package/dist/chunk-OPXFZ4Y5.js +204 -0
  125. package/dist/chunk-P23EQNRQ.js +338 -0
  126. package/dist/chunk-PJXUJYS6.js +248 -0
  127. package/dist/chunk-PNWUWOBF.js +1 -0
  128. package/dist/chunk-PUPM2YGF.js +376 -0
  129. package/dist/chunk-PZXZJBMP.js +620 -0
  130. package/dist/chunk-Q72LJOVE.js +169 -0
  131. package/dist/chunk-QCDXZBC5.js +247 -0
  132. package/dist/chunk-QDYDBCFP.js +197 -0
  133. package/dist/chunk-QJJ6MADV.js +274 -0
  134. package/dist/chunk-QKXCPTFS.js +349 -0
  135. package/dist/chunk-QWCMU5B2.js +860 -0
  136. package/dist/chunk-RIBDXGUG.js +108 -0
  137. package/dist/chunk-RJQOOHT2.js +214 -0
  138. package/dist/chunk-RNGLIHFA.js +191 -0
  139. package/dist/chunk-RQ3HASCC.js +6 -0
  140. package/dist/chunk-RSOJT5YW.js +124 -0
  141. package/dist/chunk-RTIKSY6A.js +1 -0
  142. package/dist/chunk-RUZHTGKB.js +237 -0
  143. package/dist/chunk-RW6ZL2FQ.js +284 -0
  144. package/dist/chunk-S7F6XLTK.js +540 -0
  145. package/dist/chunk-SBMNWWBV.js +155 -0
  146. package/dist/chunk-SDTQPRRB.js +1 -0
  147. package/dist/chunk-SYNOJOQO.js +377 -0
  148. package/dist/chunk-T753XT36.js +1 -0
  149. package/dist/chunk-TKQYWZ5V.js +196 -0
  150. package/dist/chunk-TKVFVF5D.js +95 -0
  151. package/dist/chunk-TOXAGRDQ.js +144 -0
  152. package/dist/chunk-TUTI5HOZ.js +112 -0
  153. package/dist/chunk-U7TFM2JA.js +140 -0
  154. package/dist/chunk-UC2WGUP3.js +627 -0
  155. package/dist/chunk-UWFLYMAR.js +1126 -0
  156. package/dist/chunk-UWSZB7BJ.js +1 -0
  157. package/dist/chunk-UYG5L34B.js +87 -0
  158. package/dist/chunk-VBOXAEPI.js +336 -0
  159. package/dist/chunk-VCDBXW5H.js +188 -0
  160. package/dist/chunk-VCXPHHDS.js +1 -0
  161. package/dist/chunk-VEAYTRPX.js +414 -0
  162. package/dist/chunk-VFCUIDRT.js +1 -0
  163. package/dist/chunk-VQHPQEUH.js +273 -0
  164. package/dist/chunk-VXDZFJGP.js +874 -0
  165. package/dist/chunk-WS56BL3D.js +1 -0
  166. package/dist/chunk-WSW6ZFAQ.js +98 -0
  167. package/dist/chunk-XNUVB5OL.js +375 -0
  168. package/dist/chunk-XOSCY2CW.js +242 -0
  169. package/dist/chunk-XXXEFXY5.js +99 -0
  170. package/dist/chunk-Y5CSSPV4.js +1 -0
  171. package/dist/chunk-Y6DU4J47.js +1 -0
  172. package/dist/chunk-YC6WORFL.js +535 -0
  173. package/dist/chunk-YDGVJETP.js +60 -0
  174. package/dist/chunk-YF4NSSMT.js +366 -0
  175. package/dist/chunk-YG3ZJHGU.js +223 -0
  176. package/dist/chunk-YIJ55TBC.js +1 -0
  177. package/dist/chunk-YKZ4RZZF.js +1 -0
  178. package/dist/chunk-YLLCXTMC.js +37 -0
  179. package/dist/chunk-YTA74UZR.js +1 -0
  180. package/dist/chunk-YTFKPRUK.js +845 -0
  181. package/dist/chunk-Z7H7VSFZ.js +323 -0
  182. package/dist/chunk-ZK2H4O5P.js +1 -0
  183. package/dist/chunk-ZVFE5QGU.js +524 -0
  184. package/dist/coachmark/index.js +4 -0
  185. package/dist/code-block/index.js +4 -0
  186. package/dist/color-field/index.js +7 -0
  187. package/dist/commerce/index.js +20 -0
  188. package/dist/connectivity/index.js +2 -0
  189. package/dist/context-menu/index.js +5 -0
  190. package/dist/copy-button/index.js +3 -0
  191. package/dist/data-grid/index.js +24 -0
  192. package/dist/date-range-picker/index.js +13 -0
  193. package/dist/description-list/index.js +2 -0
  194. package/dist/dialog/index.js +3 -0
  195. package/dist/empty-state/index.js +3 -0
  196. package/dist/error-summary/index.js +3 -0
  197. package/dist/fab/index.js +2 -0
  198. package/dist/file-upload/index.js +9 -0
  199. package/dist/filter-bar/index.js +8 -0
  200. package/dist/flow-run/index.js +14 -0
  201. package/dist/form/index.js +3 -0
  202. package/dist/gallery/index.js +2 -0
  203. package/dist/header/index.js +5 -0
  204. package/dist/hold-to-confirm/index.js +4 -0
  205. package/dist/index.d.ts +22883 -0
  206. package/dist/index.js +158 -0
  207. package/dist/infinite-list/index.js +2 -0
  208. package/dist/inline-edit/index.js +5 -0
  209. package/dist/input/index.js +5 -0
  210. package/dist/interactions/index.js +2 -0
  211. package/dist/invoice/index.js +10 -0
  212. package/dist/kbd/index.js +1 -0
  213. package/dist/keyboard/index.js +3 -0
  214. package/dist/list-row/index.js +7 -0
  215. package/dist/log-viewer/index.js +2 -0
  216. package/dist/map-view/index.js +3 -0
  217. package/dist/markdown/index.js +6 -0
  218. package/dist/metric/index.js +4 -0
  219. package/dist/money/index.js +3 -0
  220. package/dist/nav-drawer/index.js +2 -0
  221. package/dist/navigation/index.js +2 -0
  222. package/dist/notification-center/index.js +16 -0
  223. package/dist/number-roll/index.js +3 -0
  224. package/dist/one-handed/index.js +5 -0
  225. package/dist/os-surfaces/index.js +3 -0
  226. package/dist/otp/index.js +7 -0
  227. package/dist/page-header/index.js +1 -0
  228. package/dist/payment-method/index.js +12 -0
  229. package/dist/payment-status/index.js +16 -0
  230. package/dist/permission/index.js +2 -0
  231. package/dist/picker/index.js +7 -0
  232. package/dist/progress/index.js +5 -0
  233. package/dist/pull-to-refresh/index.js +4 -0
  234. package/dist/radio-group/index.js +6 -0
  235. package/dist/rating/index.js +2 -0
  236. package/dist/receivables/index.js +20 -0
  237. package/dist/refund/index.js +16 -0
  238. package/dist/save-status/index.js +3 -0
  239. package/dist/scroll-area/index.js +1 -0
  240. package/dist/search-bar/index.js +5 -0
  241. package/dist/segmented-control/index.js +5 -0
  242. package/dist/sheet/index.js +4 -0
  243. package/dist/skeleton/index.js +2 -0
  244. package/dist/slider/index.js +5 -0
  245. package/dist/spinner/index.js +2 -0
  246. package/dist/split-button/index.js +7 -0
  247. package/dist/spotlight/index.js +2 -0
  248. package/dist/stage-timeline/index.js +4 -0
  249. package/dist/status-dot/index.js +2 -0
  250. package/dist/stepper/index.js +6 -0
  251. package/dist/streaming-text/index.js +3 -0
  252. package/dist/survey/index.js +19 -0
  253. package/dist/switch/index.js +5 -0
  254. package/dist/system-state/index.js +4 -0
  255. package/dist/tab-bar/index.js +2 -0
  256. package/dist/tabs/index.js +2 -0
  257. package/dist/textarea/index.js +6 -0
  258. package/dist/thinking/index.js +2 -0
  259. package/dist/timeline/index.js +4 -0
  260. package/dist/toast/index.js +2 -0
  261. package/dist/toolbar/index.js +2 -0
  262. package/dist/tour/index.js +11 -0
  263. package/dist/truncation-notice/index.js +2 -0
  264. package/dist/update-notice/index.js +11 -0
  265. package/dist/video-player/index.js +2 -0
  266. package/dist/viewfinder/index.js +5 -0
  267. package/dist/widget/index.js +4 -0
  268. package/dist/wizard/index.js +6 -0
  269. package/package.json +76 -3
@@ -0,0 +1,993 @@
1
+ import { Stepper } from './chunk-VQHPQEUH.js';
2
+ import { DescriptionList } from './chunk-TUTI5HOZ.js';
3
+ import { Input } from './chunk-ITTYJZWX.js';
4
+ import { PhaseAnnouncement, ConfidenceBadge, MatchRow, NoteBlock } from './chunk-N32RGOA5.js';
5
+ import { Badge } from './chunk-SBMNWWBV.js';
6
+ import { Card, CardHeader, CardTitle, CardContent, CardFooter } from './chunk-KMI5ML5I.js';
7
+ import { PlaceholderFeed } from './chunk-LAECSR4H.js';
8
+ import { decorativeProps, GuidanceChip, camInk } from './chunk-RW6ZL2FQ.js';
9
+ import { Button } from './chunk-3ARE4TES.js';
10
+ import { useReducedMotion } from './chunk-6N33LFQA.js';
11
+ import { Icon } from './chunk-TKVFVF5D.js';
12
+ import * as React5 from 'react';
13
+ import { Animated, View, Text, Pressable, Platform, findNodeHandle, AccessibilityInfo, PanResponder, ScrollView, Easing } from 'react-native';
14
+ import Svg, { Defs, LinearGradient, Stop, Rect } from 'react-native-svg';
15
+ import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
16
+ import { STAGE_PRIVACY, profile, pipelineFrom, PIPELINE_FOOTER, RESULT_NOTES, estimateRange, failure, failureBody, FAILURE_OFFER_PREFIX, FAILURE_SECONDARY_LABEL, failurePrimaryLabel, CAPTURED_PILL, resultPrimaryLabel, fieldFlagged, FIELD_FLAG_COPY } from '@btndprojects/loam-analyzer';
17
+ import { jsx, jsxs } from 'react/jsx-runtime';
18
+ import { money } from '@btndprojects/loam-pay';
19
+
20
+ function ScanSweep({ active = true }) {
21
+ const theme = useLoamTheme();
22
+ const reduced = useReducedMotion();
23
+ const { styles } = useStyles(analysisSheet);
24
+ const [band, setBand] = React5.useState(0);
25
+ const phase = React5.useRef(new Animated.Value(0)).current;
26
+ const still = reduced || theme.reduceMotion;
27
+ React5.useEffect(() => {
28
+ if (!active || still || band === 0) {
29
+ phase.setValue(0);
30
+ return;
31
+ }
32
+ const leg = (to) => Animated.timing(phase, {
33
+ toValue: to,
34
+ duration: theme.loop.spin * 2,
35
+ easing: Easing.bezier(...theme.easing.inOut),
36
+ useNativeDriver: true
37
+ });
38
+ const loop = Animated.loop(Animated.sequence([leg(1), leg(0)]));
39
+ loop.start();
40
+ return () => loop.stop();
41
+ }, [active, still, band, phase, theme.loop.spin, theme.easing.inOut]);
42
+ if (!active) return null;
43
+ const onLayout = (e) => setBand(e.nativeEvent.layout.height);
44
+ const translateY = still ? band : phase.interpolate({ inputRange: [0, 1], outputRange: [-band, band * 4] });
45
+ return /* @__PURE__ */ jsx(View, { accessible: false, testID: "loam-scan-sweep", style: styles.sweepRoot, ...decorativeProps(), children: /* @__PURE__ */ jsx(
46
+ Animated.View,
47
+ {
48
+ testID: still ? "loam-scan-sweep-static" : "loam-scan-sweep-band",
49
+ onLayout,
50
+ style: [styles.sweepBand, { transform: [{ translateY }] }],
51
+ children: /* @__PURE__ */ jsxs(Svg, { width: "100%", height: "100%", children: [
52
+ /* @__PURE__ */ jsx(Defs, { children: /* @__PURE__ */ jsxs(LinearGradient, { id: "loam-cam-sweep", x1: "0", y1: "0", x2: "0", y2: "1", children: [
53
+ /* @__PURE__ */ jsx(Stop, { offset: "0", stopColor: theme.color.good, stopOpacity: theme.opacity[0] }),
54
+ /* @__PURE__ */ jsx(Stop, { offset: "0.5", stopColor: theme.color.good, stopOpacity: theme.opacity[100] }),
55
+ /* @__PURE__ */ jsx(Stop, { offset: "1", stopColor: theme.color.good, stopOpacity: theme.opacity[0] })
56
+ ] }) }),
57
+ /* @__PURE__ */ jsx(Rect, { x: "0", y: "0", width: "100%", height: "100%", fill: "url(#loam-cam-sweep)" })
58
+ ] })
59
+ }
60
+ ) });
61
+ }
62
+ function StageBadge({ where }) {
63
+ const privacy = STAGE_PRIVACY[where];
64
+ return /* @__PURE__ */ jsx(View, { accessible: false, importantForAccessibility: "no-hide-descendants", ...decorativeProps(), children: /* @__PURE__ */ jsx(Badge, { variant: where === "device" ? "good" : "neutral", size: "sm", children: privacy.badge.toUpperCase() }) });
65
+ }
66
+ function StageDot({ status }) {
67
+ const theme = useLoamTheme();
68
+ const { styles } = useStyles(analysisSheet, { status });
69
+ if (status === "done") {
70
+ return /* @__PURE__ */ jsx(Icon, { name: "check-circle", size: theme.icon.sm, color: theme.color.good });
71
+ }
72
+ if (status === "failed") {
73
+ return /* @__PURE__ */ jsx(Icon, { name: "alert-circle", size: theme.icon.sm, color: theme.color.danger });
74
+ }
75
+ return /* @__PURE__ */ jsx(View, { accessible: false, style: styles.dot });
76
+ }
77
+ function StageRow({ stage, status = "pending" }) {
78
+ const { styles } = useStyles(analysisSheet, { status });
79
+ return /* @__PURE__ */ jsxs(
80
+ View,
81
+ {
82
+ role: "listitem",
83
+ accessible: true,
84
+ accessibilityLabel: `${stage.label}, ${status}, runs on ${stage.where}`,
85
+ testID: `loam-stage-${status}`,
86
+ style: styles.stageRow,
87
+ children: [
88
+ /* @__PURE__ */ jsx(StageDot, { status }),
89
+ /* @__PURE__ */ jsx(Text, { style: styles.stageLabel, children: stage.label }),
90
+ /* @__PURE__ */ jsx(StageBadge, { where: stage.where })
91
+ ]
92
+ }
93
+ );
94
+ }
95
+ function defaultTitle(p) {
96
+ return p.id === "car" ? "Reading six angles" : "Analysing";
97
+ }
98
+ function AnalysisProgress({
99
+ profile: profileProp,
100
+ index = 0,
101
+ title,
102
+ cancelLabel = "Cancel",
103
+ onCancel,
104
+ footer = PIPELINE_FOOTER,
105
+ announce = true
106
+ }) {
107
+ const { styles } = useStyles(analysisSheet);
108
+ const p = profile(profileProp);
109
+ const pipeline = pipelineFrom(p, index);
110
+ const heading = title ?? defaultTitle(p);
111
+ const active = pipeline.index >= 0 ? pipeline.stages[pipeline.index] : void 0;
112
+ const message = announce ? active ? `${active.stage.label}, runs on ${active.stage.where}` : heading : null;
113
+ return /* @__PURE__ */ jsxs(Card, { variant: "elevated", style: styles.card, children: [
114
+ /* @__PURE__ */ jsx(PhaseAnnouncement, { message }),
115
+ /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.heading, children: heading }) }) }),
116
+ /* @__PURE__ */ jsxs(CardContent, { children: [
117
+ pipeline.stages.length > 0 ? /* @__PURE__ */ jsx(View, { role: "list", style: styles.stageList, children: pipeline.stages.map((s) => /* @__PURE__ */ jsx(StageRow, { stage: s.stage, status: s.status }, s.stage.label)) }) : /* @__PURE__ */ jsx(Text, { style: styles.noPipeline, children: `${p.label} runs no analysis pipeline \u2014 the capture is kept as it is.` }),
118
+ footer ? /* @__PURE__ */ jsx(Text, { style: styles.footer, children: footer }) : null
119
+ ] }),
120
+ onCancel && pipeline.cancellable ? /* @__PURE__ */ jsx(CardFooter, { children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onPress: onCancel, children: cancelLabel }) }) : null
121
+ ] });
122
+ }
123
+ var analysisSheet = createStyleSheet((theme) => ({
124
+ sweepRoot: {
125
+ pointerEvents: "none",
126
+ position: "absolute",
127
+ top: theme.space[0],
128
+ bottom: theme.space[0],
129
+ left: theme.space[0],
130
+ right: theme.space[0],
131
+ overflow: "hidden"
132
+ },
133
+ sweepBand: {
134
+ position: "absolute",
135
+ left: theme.space[0],
136
+ right: theme.space[0],
137
+ top: theme.space[0],
138
+ height: "25%"
139
+ },
140
+ card: {
141
+ width: "100%",
142
+ maxWidth: theme.panel.lg
143
+ },
144
+ heading: {
145
+ fontFamily: theme.font.sans,
146
+ fontSize: theme.type.title3.fontSize,
147
+ fontWeight: theme.fontWeight.semibold,
148
+ color: theme.color.text
149
+ },
150
+ stageList: {
151
+ flexDirection: "column"
152
+ },
153
+ stageRow: {
154
+ flexDirection: "row",
155
+ alignItems: "center",
156
+ gap: theme.space[12],
157
+ paddingVertical: theme.space[6]
158
+ },
159
+ dot: {
160
+ flexGrow: 0,
161
+ flexShrink: 0,
162
+ width: theme.space[10],
163
+ height: theme.space[10],
164
+ borderRadius: theme.radius.full,
165
+ variants: {
166
+ status: {
167
+ pending: {
168
+ backgroundColor: theme.color.surface3,
169
+ borderWidth: theme.borderWidth.strong,
170
+ borderColor: theme.color.borderStrong
171
+ },
172
+ active: { backgroundColor: theme.color.accent },
173
+ done: {},
174
+ failed: {}
175
+ }
176
+ }
177
+ },
178
+ stageLabel: {
179
+ flexGrow: 1,
180
+ flexShrink: 1,
181
+ flexBasis: theme.space[0],
182
+ fontFamily: theme.font.sans,
183
+ fontSize: theme.fontSize[13],
184
+ variants: {
185
+ status: {
186
+ pending: { color: theme.color.text3 },
187
+ active: { color: theme.color.text, fontWeight: theme.fontWeight.semibold },
188
+ done: { color: theme.color.text },
189
+ failed: { color: theme.color.text }
190
+ }
191
+ }
192
+ },
193
+ noPipeline: {
194
+ fontFamily: theme.font.sans,
195
+ fontSize: theme.fontSize[13],
196
+ color: theme.color.text2
197
+ },
198
+ footer: {
199
+ marginTop: theme.space[12],
200
+ fontFamily: theme.font.sans,
201
+ fontSize: theme.fontSize[12],
202
+ lineHeight: theme.fontSize[12] * theme.lineHeight.relaxed,
203
+ color: theme.color.text3
204
+ }
205
+ }));
206
+ function Money({
207
+ minor,
208
+ currency,
209
+ emphasis = false
210
+ }) {
211
+ const { styles } = useStyles(bodySheet, { emphasis });
212
+ return /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.money, children: money(minor, currency) });
213
+ }
214
+ function ResultNote({ children }) {
215
+ const { styles } = useStyles(bodySheet);
216
+ return /* @__PURE__ */ jsx(Text, { style: styles.note, children });
217
+ }
218
+ function Body({
219
+ kind,
220
+ children
221
+ }) {
222
+ const { styles } = useStyles(bodySheet);
223
+ return /* @__PURE__ */ jsx(View, { testID: `loam-result-${kind}`, style: styles.body, children });
224
+ }
225
+ function SpeciesResult({
226
+ result,
227
+ onPickAlternate,
228
+ alternatesLabel = "Or possibly"
229
+ }) {
230
+ const { styles } = useStyles(bodySheet);
231
+ const { top, alternates, facts } = result;
232
+ return /* @__PURE__ */ jsxs(Body, { kind: "species", children: [
233
+ /* @__PURE__ */ jsxs(View, { style: styles.headRow, children: [
234
+ /* @__PURE__ */ jsxs(View, { style: styles.headText, children: [
235
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.heading, children: top.common }),
236
+ /* @__PURE__ */ jsxs(Text, { style: styles.subheading, children: [
237
+ /* @__PURE__ */ jsx(Text, { style: styles.italic, children: top.name }),
238
+ top.family ? ` \xB7 ${top.family}` : ""
239
+ ] })
240
+ ] }),
241
+ /* @__PURE__ */ jsx(ConfidenceBadge, { value: top.confidence, size: "md" })
242
+ ] }),
243
+ alternates.length > 0 ? /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
244
+ /* @__PURE__ */ jsx(Text, { style: styles.overline, children: alternatesLabel.toUpperCase() }),
245
+ /* @__PURE__ */ jsx(View, { style: styles.list, children: alternates.map((m) => /* @__PURE__ */ jsx(MatchRow, { match: m, onPick: onPickAlternate }, m.name)) })
246
+ ] }) : null,
247
+ facts.length > 0 ? /* @__PURE__ */ jsx(
248
+ DescriptionList,
249
+ {
250
+ layout: "inline",
251
+ density: "compact",
252
+ dividers: true,
253
+ items: facts.map(([term, description]) => ({ term, description }))
254
+ }
255
+ ) : null,
256
+ /* @__PURE__ */ jsx(ResultNote, { children: RESULT_NOTES.species })
257
+ ] });
258
+ }
259
+ var SEVERITY = {
260
+ none: { variant: "good", label: "no damage" },
261
+ minor: { variant: "info", label: "minor" },
262
+ moderate: { variant: "warn", label: "moderate" }
263
+ };
264
+ function PanelsResult({
265
+ result,
266
+ currency = "HUF",
267
+ estimateLabel = "Estimate"
268
+ }) {
269
+ const { styles } = useStyles(bodySheet);
270
+ const { vehicle, findings } = result;
271
+ const [low, high] = estimateRange(findings);
272
+ return /* @__PURE__ */ jsxs(Body, { kind: "panels", children: [
273
+ /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
274
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.heading, children: `${vehicle.year} ${vehicle.make} ${vehicle.model}` }),
275
+ /* @__PURE__ */ jsx(Text, { style: styles.subheading, children: `${vehicle.plate} \xB7 ${vehicle.colour}` }),
276
+ /* @__PURE__ */ jsx(Text, { style: styles.mono, children: vehicle.vin })
277
+ ] }),
278
+ /* @__PURE__ */ jsxs(View, { testID: "loam-estimate", style: styles.estimate, children: [
279
+ /* @__PURE__ */ jsx(Text, { style: styles.overline, children: estimateLabel.toUpperCase() }),
280
+ /* @__PURE__ */ jsxs(View, { style: styles.estimateRow, children: [
281
+ /* @__PURE__ */ jsx(Money, { minor: low, currency, emphasis: true }),
282
+ /* @__PURE__ */ jsx(Text, { style: styles.dash, children: "\u2013" }),
283
+ /* @__PURE__ */ jsx(Money, { minor: high, currency, emphasis: true })
284
+ ] })
285
+ ] }),
286
+ /* @__PURE__ */ jsx(View, { style: styles.list, children: findings.map((f) => {
287
+ const sev = SEVERITY[f.severity];
288
+ return /* @__PURE__ */ jsxs(View, { style: styles.finding, children: [
289
+ /* @__PURE__ */ jsxs(View, { style: styles.findingTop, children: [
290
+ /* @__PURE__ */ jsx(Text, { style: styles.findingPanel, children: f.panel }),
291
+ /* @__PURE__ */ jsx(Badge, { variant: sev.variant, children: sev.label })
292
+ ] }),
293
+ /* @__PURE__ */ jsxs(View, { style: styles.findingBottom, children: [
294
+ /* @__PURE__ */ jsx(Text, { style: styles.findingDamage, children: f.damage }),
295
+ /* @__PURE__ */ jsxs(View, { style: styles.findingMeta, children: [
296
+ /* @__PURE__ */ jsx(Money, { minor: f.cost, currency }),
297
+ /* @__PURE__ */ jsx(ConfidenceBadge, { value: f.confidence })
298
+ ] })
299
+ ] })
300
+ ] }, f.panel);
301
+ }) }),
302
+ /* @__PURE__ */ jsx(ResultNote, { children: RESULT_NOTES.panels })
303
+ ] });
304
+ }
305
+ function FieldRow({
306
+ field,
307
+ onChange
308
+ }) {
309
+ const theme = useLoamTheme();
310
+ const { styles } = useStyles(bodySheet, { flagged: fieldFlagged(field) });
311
+ const flagged = fieldFlagged(field);
312
+ return /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
313
+ /* @__PURE__ */ jsxs(View, { style: styles.fieldHead, children: [
314
+ /* @__PURE__ */ jsx(Text, { style: styles.fieldLabel, children: field.key }),
315
+ /* @__PURE__ */ jsx(ConfidenceBadge, { value: field.confidence })
316
+ ] }),
317
+ /* @__PURE__ */ jsx(View, { style: styles.fieldInput, children: /* @__PURE__ */ jsx(
318
+ Input,
319
+ {
320
+ size: "sm",
321
+ value: field.value,
322
+ editable: !!onChange,
323
+ accessibilityLabel: flagged ? `${field.key}, ${FIELD_FLAG_COPY}` : field.key,
324
+ accessibilityHint: flagged ? FIELD_FLAG_COPY : void 0,
325
+ onChangeText: (next) => onChange?.(field.key, next)
326
+ }
327
+ ) }),
328
+ flagged ? /* @__PURE__ */ jsxs(View, { style: styles.flagChip, children: [
329
+ /* @__PURE__ */ jsx(Icon, { name: "alert-triangle", size: theme.icon.xs, color: theme.color.warnOnSoft }),
330
+ /* @__PURE__ */ jsx(Text, { style: styles.flagText, children: FIELD_FLAG_COPY })
331
+ ] }) : null
332
+ ] });
333
+ }
334
+ function FieldsResult({ result, onFieldChange }) {
335
+ const { styles } = useStyles(bodySheet);
336
+ return /* @__PURE__ */ jsxs(Body, { kind: "fields", children: [
337
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.heading, children: result.doc }),
338
+ /* @__PURE__ */ jsx(View, { style: styles.fieldList, children: result.fields.map((f) => /* @__PURE__ */ jsx(FieldRow, { field: f, onChange: onFieldChange }, f.key)) }),
339
+ /* @__PURE__ */ jsx(ResultNote, { children: RESULT_NOTES.fields })
340
+ ] });
341
+ }
342
+ function CodeResult({
343
+ result,
344
+ currency = "HUF",
345
+ quantity = 1,
346
+ onQuantityChange,
347
+ quantityLabel = "Quantity"
348
+ }) {
349
+ const { styles } = useStyles(bodySheet);
350
+ const { product, format, value } = result;
351
+ const mono = [format, value, product?.sku].filter(Boolean).join(" \xB7 ");
352
+ return /* @__PURE__ */ jsxs(Body, { kind: "code", children: [
353
+ /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
354
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.heading, children: product ? product.name : value }),
355
+ /* @__PURE__ */ jsx(Text, { style: styles.subheading, children: product ? product.stock : "No product matched this code." })
356
+ ] }),
357
+ product ? /* @__PURE__ */ jsx(Money, { minor: product.price, currency, emphasis: true }) : null,
358
+ onQuantityChange ? /* @__PURE__ */ jsxs(View, { style: styles.quantityRow, children: [
359
+ /* @__PURE__ */ jsx(
360
+ Text,
361
+ {
362
+ accessible: false,
363
+ importantForAccessibility: "no-hide-descendants",
364
+ style: styles.fieldLabel,
365
+ children: quantityLabel
366
+ }
367
+ ),
368
+ /* @__PURE__ */ jsx(
369
+ Stepper,
370
+ {
371
+ value: quantity,
372
+ min: 1,
373
+ accessibilityLabel: quantityLabel,
374
+ onValueChange: onQuantityChange
375
+ }
376
+ )
377
+ ] }) : null,
378
+ /* @__PURE__ */ jsx(Text, { style: styles.mono, children: mono }),
379
+ /* @__PURE__ */ jsx(ResultNote, { children: RESULT_NOTES.code })
380
+ ] });
381
+ }
382
+ function VerdictResult({ result }) {
383
+ const { styles } = useStyles(bodySheet);
384
+ return /* @__PURE__ */ jsxs(Body, { kind: "verdict", children: [
385
+ /* @__PURE__ */ jsxs(View, { style: styles.headRow, children: [
386
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.heading, children: result.outcome }),
387
+ /* @__PURE__ */ jsx(ConfidenceBadge, { value: result.confidence, size: "md", icon: true })
388
+ ] }),
389
+ /* @__PURE__ */ jsx(
390
+ DescriptionList,
391
+ {
392
+ layout: "stacked",
393
+ density: "compact",
394
+ dividers: true,
395
+ items: result.lines.map(([term, description]) => ({ term, description }))
396
+ }
397
+ ),
398
+ /* @__PURE__ */ jsx(ResultNote, { children: RESULT_NOTES.verdict })
399
+ ] });
400
+ }
401
+ var bodySheet = createStyleSheet((theme) => ({
402
+ body: {
403
+ flexDirection: "column",
404
+ gap: theme.space[16]
405
+ },
406
+ headRow: {
407
+ flexDirection: "row",
408
+ alignItems: "flex-start",
409
+ justifyContent: "space-between",
410
+ gap: theme.space[12]
411
+ },
412
+ headText: {
413
+ flexGrow: 1,
414
+ flexShrink: 1,
415
+ flexBasis: theme.space[0],
416
+ flexDirection: "column",
417
+ gap: theme.space[4]
418
+ },
419
+ heading: {
420
+ fontFamily: theme.font.sans,
421
+ fontSize: theme.type.title3.fontSize,
422
+ fontWeight: theme.fontWeight.semibold,
423
+ color: theme.color.text
424
+ },
425
+ subheading: {
426
+ fontFamily: theme.font.sans,
427
+ fontSize: theme.fontSize[13],
428
+ color: theme.color.text2
429
+ },
430
+ italic: {
431
+ fontStyle: "italic"
432
+ },
433
+ mono: {
434
+ fontFamily: theme.font.mono,
435
+ fontSize: theme.fontSize[11],
436
+ color: theme.color.text3
437
+ },
438
+ overline: {
439
+ fontFamily: theme.font.sans,
440
+ fontSize: theme.fontSize[10],
441
+ letterSpacing: theme.tracking.caps,
442
+ color: theme.color.text3
443
+ },
444
+ group: {
445
+ flexDirection: "column",
446
+ gap: theme.space[6]
447
+ },
448
+ list: {
449
+ flexDirection: "column",
450
+ gap: theme.space[6]
451
+ },
452
+ fieldList: {
453
+ flexDirection: "column",
454
+ gap: theme.space[12]
455
+ },
456
+ note: {
457
+ fontFamily: theme.font.sans,
458
+ fontSize: theme.fontSize[12],
459
+ lineHeight: theme.fontSize[12] * theme.lineHeight.relaxed,
460
+ color: theme.color.text3
461
+ },
462
+ money: {
463
+ fontFamily: theme.font.sans,
464
+ fontVariant: ["tabular-nums"],
465
+ color: theme.color.text,
466
+ variants: {
467
+ emphasis: {
468
+ true: { fontSize: theme.fontSize[20], fontWeight: theme.fontWeight.bold },
469
+ false: { fontSize: theme.fontSize[13] }
470
+ }
471
+ }
472
+ },
473
+ estimate: {
474
+ flexDirection: "column",
475
+ gap: theme.space[4],
476
+ padding: theme.space[8],
477
+ borderRadius: theme.radius.md,
478
+ backgroundColor: theme.color.surface2,
479
+ borderWidth: theme.borderWidth.base,
480
+ borderColor: theme.color.border
481
+ },
482
+ estimateRow: {
483
+ flexDirection: "row",
484
+ alignItems: "baseline",
485
+ flexWrap: "wrap",
486
+ gap: theme.space[6]
487
+ },
488
+ dash: {
489
+ fontFamily: theme.font.sans,
490
+ fontSize: theme.fontSize[15],
491
+ color: theme.color.text3
492
+ },
493
+ finding: {
494
+ flexDirection: "column",
495
+ gap: theme.space[6],
496
+ paddingVertical: theme.space[12],
497
+ borderBottomWidth: theme.borderWidth.base,
498
+ borderBottomColor: theme.color.border
499
+ },
500
+ findingTop: {
501
+ flexDirection: "row",
502
+ alignItems: "flex-start",
503
+ justifyContent: "space-between",
504
+ gap: theme.space[12]
505
+ },
506
+ findingPanel: {
507
+ flexShrink: 1,
508
+ fontFamily: theme.font.sans,
509
+ fontSize: theme.fontSize[13],
510
+ fontWeight: theme.fontWeight.semibold,
511
+ color: theme.color.text
512
+ },
513
+ findingBottom: {
514
+ flexDirection: "row",
515
+ alignItems: "center",
516
+ justifyContent: "space-between",
517
+ gap: theme.space[12]
518
+ },
519
+ findingDamage: {
520
+ flexShrink: 1,
521
+ fontFamily: theme.font.sans,
522
+ fontSize: theme.fontSize[13],
523
+ color: theme.color.text2
524
+ },
525
+ findingMeta: {
526
+ flexGrow: 0,
527
+ flexShrink: 0,
528
+ flexDirection: "row",
529
+ alignItems: "center",
530
+ gap: theme.space[8]
531
+ },
532
+ fieldHead: {
533
+ flexDirection: "row",
534
+ alignItems: "baseline",
535
+ justifyContent: "space-between",
536
+ gap: theme.space[8]
537
+ },
538
+ fieldLabel: {
539
+ fontFamily: theme.font.sans,
540
+ fontSize: theme.fontSize[12],
541
+ fontWeight: theme.fontWeight.semibold,
542
+ color: theme.color.text2
543
+ },
544
+ // A warn *edge*, not a warn fill: the value stays on the field surface its
545
+ // ink was measured against, and the flag says the rest in words.
546
+ fieldInput: {
547
+ borderRadius: theme.ctl.r.sm,
548
+ variants: {
549
+ flagged: {
550
+ true: { borderWidth: theme.borderWidth.base, borderColor: theme.color.warn },
551
+ false: {}
552
+ }
553
+ }
554
+ },
555
+ flagChip: {
556
+ alignSelf: "flex-start",
557
+ flexDirection: "row",
558
+ alignItems: "center",
559
+ gap: theme.space[4],
560
+ paddingHorizontal: theme.space[8],
561
+ paddingVertical: theme.space[2],
562
+ borderRadius: theme.radius.full,
563
+ backgroundColor: theme.color.warnSoft,
564
+ borderWidth: theme.borderWidth.base,
565
+ borderColor: theme.edge.warn
566
+ },
567
+ flagText: {
568
+ fontFamily: theme.font.sans,
569
+ fontSize: theme.fontSize[12],
570
+ color: theme.color.warnOnSoft
571
+ },
572
+ quantityRow: {
573
+ flexDirection: "row",
574
+ alignItems: "center",
575
+ justifyContent: "space-between",
576
+ gap: theme.space[12]
577
+ }
578
+ }));
579
+ function FailureCard({
580
+ failure: failure$1 = "low_confidence",
581
+ alternates = [],
582
+ onRetake,
583
+ onManualEntry,
584
+ onPickAlternate,
585
+ alternatesLabel = "The closest we got",
586
+ manualLabel = FAILURE_SECONDARY_LABEL,
587
+ announce = true
588
+ }) {
589
+ const theme = useLoamTheme();
590
+ const { styles } = useStyles(failureSheet);
591
+ const resolved = failure(failure$1);
592
+ const body = failureBody(resolved.id);
593
+ const showAlternates = resolved.id === "low_confidence" && alternates.length > 0;
594
+ return /* @__PURE__ */ jsxs(Card, { variant: "elevated", style: styles.card, children: [
595
+ /* @__PURE__ */ jsx(PhaseAnnouncement, { message: announce ? `${resolved.label}. ${body}` : null }),
596
+ /* @__PURE__ */ jsx(CardHeader, { children: /* @__PURE__ */ jsxs(View, { style: styles.headRow, children: [
597
+ /* @__PURE__ */ jsx(View, { accessible: false, style: styles.toneMark, ...decorativeProps(), children: /* @__PURE__ */ jsx(Icon, { name: "alert-triangle", size: theme.icon.sm, color: theme.color.warnOnSoft }) }),
598
+ /* @__PURE__ */ jsxs(View, { style: styles.headText, children: [
599
+ /* @__PURE__ */ jsx(CardTitle, { children: /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.heading, children: resolved.label }) }),
600
+ /* @__PURE__ */ jsx(Text, { style: styles.body, children: body })
601
+ ] })
602
+ ] }) }),
603
+ /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs(View, { style: styles.stack, children: [
604
+ /* @__PURE__ */ jsx(NoteBlock, { title: FAILURE_OFFER_PREFIX, description: resolved.offer }),
605
+ showAlternates ? /* @__PURE__ */ jsxs(View, { style: styles.group, children: [
606
+ /* @__PURE__ */ jsx(Text, { style: styles.overline, children: alternatesLabel.toUpperCase() }),
607
+ /* @__PURE__ */ jsx(View, { style: styles.list, children: alternates.map((m) => /* @__PURE__ */ jsx(MatchRow, { match: m, onPick: onPickAlternate }, m.name)) })
608
+ ] }) : null
609
+ ] }) }),
610
+ /* @__PURE__ */ jsx(CardFooter, { children: /* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
611
+ /* @__PURE__ */ jsx(View, { style: styles.actionSlot, children: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "lg", fullWidth: true, onPress: onManualEntry, children: manualLabel }) }),
612
+ /* @__PURE__ */ jsx(View, { style: styles.actionSlot, children: /* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", fullWidth: true, onPress: onRetake, children: failurePrimaryLabel(resolved.id) }) })
613
+ ] }) })
614
+ ] });
615
+ }
616
+ var failureSheet = createStyleSheet((theme) => ({
617
+ card: {
618
+ width: "100%",
619
+ maxWidth: theme.panel.lg
620
+ },
621
+ headRow: {
622
+ flexDirection: "row",
623
+ alignItems: "flex-start",
624
+ gap: theme.space[12]
625
+ },
626
+ toneMark: {
627
+ flexGrow: 0,
628
+ flexShrink: 0,
629
+ width: theme.space[32],
630
+ height: theme.space[32],
631
+ alignItems: "center",
632
+ justifyContent: "center",
633
+ borderRadius: theme.radius.full,
634
+ backgroundColor: theme.color.warnSoft,
635
+ borderWidth: theme.borderWidth.base,
636
+ borderColor: theme.edge.warn
637
+ },
638
+ headText: {
639
+ flexGrow: 1,
640
+ flexShrink: 1,
641
+ flexBasis: theme.space[0],
642
+ flexDirection: "column",
643
+ gap: theme.space[4]
644
+ },
645
+ heading: {
646
+ fontFamily: theme.font.sans,
647
+ fontSize: theme.type.title3.fontSize,
648
+ fontWeight: theme.fontWeight.semibold,
649
+ color: theme.color.text
650
+ },
651
+ body: {
652
+ fontFamily: theme.font.sans,
653
+ fontSize: theme.fontSize[15],
654
+ lineHeight: theme.fontSize[15] * theme.lineHeight.relaxed,
655
+ color: theme.color.text2
656
+ },
657
+ stack: {
658
+ flexDirection: "column",
659
+ gap: theme.space[12]
660
+ },
661
+ group: {
662
+ flexDirection: "column",
663
+ gap: theme.space[6]
664
+ },
665
+ list: {
666
+ flexDirection: "column",
667
+ gap: theme.space[6]
668
+ },
669
+ overline: {
670
+ fontFamily: theme.font.sans,
671
+ fontSize: theme.fontSize[10],
672
+ letterSpacing: theme.tracking.caps,
673
+ color: theme.color.text3
674
+ },
675
+ // Shared row when both labels fit, a full-width stack when they do not —
676
+ // never a label broken across two lines inside its own button.
677
+ actions: {
678
+ flexDirection: "row",
679
+ flexWrap: "wrap",
680
+ alignItems: "center",
681
+ gap: theme.space[8],
682
+ width: "100%"
683
+ },
684
+ actionSlot: {
685
+ flexGrow: 1,
686
+ flexShrink: 0,
687
+ flexBasis: "auto"
688
+ }
689
+ }));
690
+ var SCRIM = {
691
+ captured: "a6",
692
+ done: "a7",
693
+ result: "a8",
694
+ analysing: "a10",
695
+ failure: "a11",
696
+ none: null
697
+ };
698
+ function CapturePreview({
699
+ preview,
700
+ label = "frozen frame \xB7 placeholder",
701
+ scrim = "captured",
702
+ pill = CAPTURED_PILL,
703
+ tracking,
704
+ announce = true,
705
+ children
706
+ }) {
707
+ const theme = useLoamTheme();
708
+ const { styles } = useStyles(reviewSheet);
709
+ const stop = SCRIM[scrim];
710
+ return /* @__PURE__ */ jsxs(View, { testID: `loam-capture-preview-${scrim}`, style: styles.frozen, children: [
711
+ /* @__PURE__ */ jsx(PhaseAnnouncement, { message: announce && pill ? pill : null }),
712
+ preview ?? /* @__PURE__ */ jsx(PlaceholderFeed, { label, drift: false }),
713
+ stop ? /* @__PURE__ */ jsx(
714
+ View,
715
+ {
716
+ accessible: false,
717
+ testID: `loam-capture-scrim-${scrim}`,
718
+ style: [styles.scrim, { backgroundColor: theme.black[stop] }],
719
+ ...decorativeProps()
720
+ }
721
+ ) : null,
722
+ tracking,
723
+ pill ? /* @__PURE__ */ jsx(View, { style: styles.pillRow, children: /* @__PURE__ */ jsx(GuidanceChip, { text: pill }) }) : null,
724
+ children
725
+ ] });
726
+ }
727
+ function RetakeBar({
728
+ analyse = true,
729
+ retakeLabel = "Retake",
730
+ acceptLabel,
731
+ onRetake,
732
+ onAccept
733
+ }) {
734
+ const theme = useLoamTheme();
735
+ const { styles } = useStyles(reviewSheet);
736
+ return /* @__PURE__ */ jsxs(View, { testID: "loam-retake-bar", style: styles.retakeBar, children: [
737
+ /* @__PURE__ */ jsx(
738
+ Pressable,
739
+ {
740
+ accessibilityRole: "button",
741
+ accessibilityLabel: retakeLabel,
742
+ style: [styles.retakeSlot, styles.glassAction],
743
+ onPress: onRetake,
744
+ children: /* @__PURE__ */ jsx(Text, { style: [styles.glassActionLabel, { color: camInk(theme) }], children: retakeLabel })
745
+ }
746
+ ),
747
+ /* @__PURE__ */ jsx(View, { style: styles.acceptSlot, children: /* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", fullWidth: true, onPress: onAccept, children: acceptLabel ?? (analyse ? "Analyse" : "Use photo") }) })
748
+ ] });
749
+ }
750
+ var FROZEN_PHASES = [
751
+ "captured",
752
+ "analysing",
753
+ "result",
754
+ "failure",
755
+ "done"
756
+ ];
757
+ var reviewSheet = createStyleSheet((theme) => ({
758
+ frozen: {
759
+ position: "absolute",
760
+ top: theme.space[0],
761
+ bottom: theme.space[0],
762
+ left: theme.space[0],
763
+ right: theme.space[0],
764
+ overflow: "hidden"
765
+ },
766
+ scrim: {
767
+ pointerEvents: "none",
768
+ position: "absolute",
769
+ top: theme.space[0],
770
+ bottom: theme.space[0],
771
+ left: theme.space[0],
772
+ right: theme.space[0]
773
+ },
774
+ pillRow: {
775
+ pointerEvents: "box-none",
776
+ position: "absolute",
777
+ top: theme.space[0],
778
+ left: theme.space[0],
779
+ right: theme.space[0],
780
+ alignItems: "center",
781
+ padding: theme.space[8]
782
+ },
783
+ retakeBar: {
784
+ width: "100%",
785
+ flexDirection: "row",
786
+ flexWrap: "wrap",
787
+ alignItems: "center",
788
+ gap: theme.space[8]
789
+ },
790
+ // Floored at their labels' widths and the bar wraps, so no label breaks
791
+ // inside its button; when both fit, accept keeps the 2:1 share.
792
+ retakeSlot: {
793
+ flexGrow: 1,
794
+ flexShrink: 0,
795
+ flexBasis: "auto"
796
+ },
797
+ acceptSlot: {
798
+ flexGrow: 2,
799
+ flexShrink: 0,
800
+ flexBasis: "auto"
801
+ },
802
+ glassAction: {
803
+ height: theme.ctl.lg,
804
+ alignItems: "center",
805
+ justifyContent: "center",
806
+ paddingHorizontal: theme.ctl.px.lg,
807
+ borderRadius: theme.ctl.r.lg,
808
+ backgroundColor: theme.black.a12,
809
+ borderWidth: theme.borderWidth.base,
810
+ borderColor: theme.white.a5
811
+ },
812
+ glassActionLabel: {
813
+ fontFamily: theme.font.sans,
814
+ fontSize: theme.ctl.fs.lg
815
+ }
816
+ }));
817
+ function ResultCard({
818
+ result,
819
+ profile: profileProp,
820
+ currency = "HUF",
821
+ quantity = 1,
822
+ onFieldChange,
823
+ onPickAlternate,
824
+ onQuantityChange
825
+ }) {
826
+ const stamp = typeof profileProp === "string" ? profileProp : profileProp ? profileProp.id : void 0;
827
+ return /* @__PURE__ */ jsxs(View, { testID: stamp ? `loam-result-profile-${stamp}` : void 0, children: [
828
+ result.kind === "species" ? /* @__PURE__ */ jsx(SpeciesResult, { result, onPickAlternate }) : null,
829
+ result.kind === "panels" ? /* @__PURE__ */ jsx(PanelsResult, { result, currency }) : null,
830
+ result.kind === "fields" ? /* @__PURE__ */ jsx(FieldsResult, { result, onFieldChange }) : null,
831
+ result.kind === "code" ? /* @__PURE__ */ jsx(
832
+ CodeResult,
833
+ {
834
+ result,
835
+ currency,
836
+ quantity,
837
+ onQuantityChange
838
+ }
839
+ ) : null,
840
+ result.kind === "verdict" ? /* @__PURE__ */ jsx(VerdictResult, { result }) : null
841
+ ] });
842
+ }
843
+ function ResultSheet({
844
+ title = "Result",
845
+ primaryLabel = resultPrimaryLabel("plant"),
846
+ scanAnotherLabel = "Scan another",
847
+ onScanAnother,
848
+ onKeep,
849
+ onDismiss,
850
+ autoFocus = true,
851
+ maxHeight = "82%",
852
+ dismissRatio = 0.3,
853
+ grabberLabel = "Dismiss result",
854
+ children
855
+ }) {
856
+ const theme = useLoamTheme();
857
+ const { styles } = useStyles(sheetSheet);
858
+ const panel = React5.useRef(null);
859
+ const height = React5.useRef(0);
860
+ const offset = React5.useRef(new Animated.Value(0)).current;
861
+ const dismiss = React5.useRef(onDismiss);
862
+ dismiss.current = onDismiss;
863
+ const ratio = React5.useRef(dismissRatio);
864
+ ratio.current = dismissRatio;
865
+ React5.useLayoutEffect(() => {
866
+ if (!autoFocus) return;
867
+ const node = panel.current;
868
+ if (!node || Platform.OS === "web") return;
869
+ const tag = findNodeHandle(node);
870
+ if (tag !== null) AccessibilityInfo.setAccessibilityFocus(tag);
871
+ }, [autoFocus]);
872
+ const grabberSlop = Math.max(0, (theme.hit.lg - theme.space[24]) / 2);
873
+ const pan = React5.useRef(
874
+ // eslint-disable-next-line loam/no-pan-responder
875
+ PanResponder.create({
876
+ onStartShouldSetPanResponder: () => true,
877
+ onMoveShouldSetPanResponder: (_e, g) => Math.abs(g.dy) > 2,
878
+ onPanResponderMove: (_e, g) => {
879
+ if (!dismiss.current) return;
880
+ offset.setValue(Math.max(0, g.dy));
881
+ },
882
+ onPanResponderRelease: (_e, g) => {
883
+ offset.setValue(0);
884
+ if (!dismiss.current) return;
885
+ if (height.current > 0 && Math.max(0, g.dy) > height.current * ratio.current) {
886
+ dismiss.current();
887
+ }
888
+ },
889
+ onPanResponderTerminate: () => offset.setValue(0)
890
+ })
891
+ ).current;
892
+ return /* @__PURE__ */ jsxs(
893
+ Animated.View,
894
+ {
895
+ ref: panel,
896
+ role: "dialog",
897
+ accessibilityViewIsModal: true,
898
+ accessibilityLabel: title,
899
+ testID: "loam-result-sheet",
900
+ onLayout: (e) => {
901
+ height.current = e.nativeEvent.layout.height;
902
+ },
903
+ style: [styles.sheet, { maxHeight, transform: [{ translateY: offset }] }],
904
+ children: [
905
+ onDismiss ? /* @__PURE__ */ jsx(
906
+ Pressable,
907
+ {
908
+ accessibilityRole: "button",
909
+ accessibilityLabel: grabberLabel,
910
+ testID: "loam-result-grabber",
911
+ hitSlop: { top: grabberSlop, bottom: grabberSlop },
912
+ style: styles.grabberHit,
913
+ onPress: onDismiss,
914
+ ...pan.panHandlers,
915
+ children: /* @__PURE__ */ jsx(View, { accessible: false, style: styles.grabber })
916
+ }
917
+ ) : /* @__PURE__ */ jsx(View, { accessible: false, style: styles.grabberHit, children: /* @__PURE__ */ jsx(View, { style: styles.grabber }) }),
918
+ /* @__PURE__ */ jsx(ScrollView, { style: styles.body, contentContainerStyle: styles.bodyContent, children }),
919
+ /* @__PURE__ */ jsxs(View, { style: styles.actions, children: [
920
+ /* @__PURE__ */ jsx(View, { style: styles.secondarySlot, children: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "lg", fullWidth: true, onPress: onScanAnother, children: scanAnotherLabel }) }),
921
+ /* @__PURE__ */ jsx(View, { style: styles.primarySlot, children: /* @__PURE__ */ jsx(Button, { variant: "primary", size: "lg", fullWidth: true, onPress: onKeep, children: primaryLabel }) })
922
+ ] })
923
+ ]
924
+ }
925
+ );
926
+ }
927
+ var sheetSheet = createStyleSheet((theme) => ({
928
+ sheet: {
929
+ position: "absolute",
930
+ left: theme.space[0],
931
+ right: theme.space[0],
932
+ bottom: theme.space[0],
933
+ zIndex: theme.z.modal,
934
+ flexDirection: "column",
935
+ overflow: "hidden",
936
+ borderTopLeftRadius: theme.radius.xl,
937
+ borderTopRightRadius: theme.radius.xl,
938
+ borderTopWidth: theme.borderWidth.base,
939
+ borderTopColor: theme.color.border,
940
+ backgroundColor: theme.color.surface,
941
+ ...theme.shadow.lg
942
+ },
943
+ grabberHit: {
944
+ width: "100%",
945
+ height: theme.space[24],
946
+ flexGrow: 0,
947
+ flexShrink: 0,
948
+ alignItems: "center",
949
+ justifyContent: "center"
950
+ },
951
+ grabber: {
952
+ width: theme.space[36],
953
+ height: theme.layout.sheetGrabber,
954
+ borderRadius: theme.radius.full,
955
+ backgroundColor: theme.color.text3
956
+ },
957
+ body: {
958
+ flexGrow: 1,
959
+ flexShrink: 1,
960
+ flexBasis: theme.space[0]
961
+ },
962
+ bodyContent: {
963
+ paddingHorizontal: theme.space[16],
964
+ paddingBottom: theme.space[12]
965
+ },
966
+ actions: {
967
+ flexGrow: 0,
968
+ flexShrink: 0,
969
+ flexDirection: "row",
970
+ flexWrap: "wrap",
971
+ alignItems: "center",
972
+ gap: theme.space[8],
973
+ paddingHorizontal: theme.space[16],
974
+ paddingVertical: theme.space[12],
975
+ borderTopWidth: theme.borderWidth.base,
976
+ borderTopColor: theme.color.border
977
+ },
978
+ // Both slots are floored at their own label's width and the row wraps, so a
979
+ // label never breaks inside its button ("Save to collection" did at 140pt);
980
+ // when both fit, the primary still takes two thirds of the spare width.
981
+ secondarySlot: {
982
+ flexGrow: 1,
983
+ flexShrink: 0,
984
+ flexBasis: "auto"
985
+ },
986
+ primarySlot: {
987
+ flexGrow: 2,
988
+ flexShrink: 0,
989
+ flexBasis: "auto"
990
+ }
991
+ }));
992
+
993
+ export { AnalysisProgress, CapturePreview, CodeResult, FROZEN_PHASES, FailureCard, FieldsResult, PanelsResult, ResultCard, ResultSheet, RetakeBar, ScanSweep, SpeciesResult, StageBadge, StageRow, VerdictResult };