@btndprojects/loam-ui-native 0.0.0-stage → 0.1.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 (269) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accordion/index.js +3 -0
  3. package/dist/adaptive/index.js +2 -0
  4. package/dist/alert/index.js +3 -0
  5. package/dist/analyzer/index.js +6 -0
  6. package/dist/announcement/index.js +6 -0
  7. package/dist/audio-player/index.js +3 -0
  8. package/dist/avatar/index.js +3 -0
  9. package/dist/avatar-group/index.js +3 -0
  10. package/dist/badge/index.js +5 -0
  11. package/dist/banner/index.js +2 -0
  12. package/dist/board/index.js +7 -0
  13. package/dist/button/index.js +5 -0
  14. package/dist/camera-permission/index.js +13 -0
  15. package/dist/capture-result/index.js +18 -0
  16. package/dist/card/index.js +4 -0
  17. package/dist/card-form/index.js +10 -0
  18. package/dist/carousel/index.js +2 -0
  19. package/dist/chart/index.js +6 -0
  20. package/dist/charts/index.js +7 -0
  21. package/dist/checkbox/index.js +7 -0
  22. package/dist/checklist/index.js +10 -0
  23. package/dist/checkout/index.js +13 -0
  24. package/dist/chip/index.js +7 -0
  25. package/dist/chunk-223Q2T2Q.js +229 -0
  26. package/dist/chunk-2A5NIQAK.js +254 -0
  27. package/dist/chunk-2GK6PHGE.js +363 -0
  28. package/dist/chunk-2WUTXHMU.js +1 -0
  29. package/dist/chunk-2ZZ7TDJ4.js +324 -0
  30. package/dist/chunk-35OFI3JG.js +499 -0
  31. package/dist/chunk-3ARE4TES.js +195 -0
  32. package/dist/chunk-3ECPOSKO.js +1 -0
  33. package/dist/chunk-3ENTMPQY.js +229 -0
  34. package/dist/chunk-3HJH6FF4.js +98 -0
  35. package/dist/chunk-3NMD74ZU.js +4 -0
  36. package/dist/chunk-3WPW4KUN.js +182 -0
  37. package/dist/chunk-47FWHGUN.js +394 -0
  38. package/dist/chunk-4BXMXBJO.js +141 -0
  39. package/dist/chunk-4DS5ZWVC.js +83 -0
  40. package/dist/chunk-4GBOGOTV.js +295 -0
  41. package/dist/chunk-4SZYY6AN.js +99 -0
  42. package/dist/chunk-4YIP3CWS.js +237 -0
  43. package/dist/chunk-4YQOR7JM.js +204 -0
  44. package/dist/chunk-4ZAHCY44.js +177 -0
  45. package/dist/chunk-52X2VYTD.js +228 -0
  46. package/dist/chunk-5P26LBDL.js +1 -0
  47. package/dist/chunk-5XLRYDAX.js +1 -0
  48. package/dist/chunk-5YNTNN5A.js +177 -0
  49. package/dist/chunk-66SG2H23.js +129 -0
  50. package/dist/chunk-6HT2LP62.js +504 -0
  51. package/dist/chunk-6N33LFQA.js +35 -0
  52. package/dist/chunk-6X6PQ443.js +432 -0
  53. package/dist/chunk-7CFF4HXS.js +126 -0
  54. package/dist/chunk-7O2FMUPT.js +755 -0
  55. package/dist/chunk-AI4DWZCD.js +162 -0
  56. package/dist/chunk-AWJOCGFZ.js +213 -0
  57. package/dist/chunk-AZRX6SAC.js +285 -0
  58. package/dist/chunk-B54QE2FN.js +1 -0
  59. package/dist/chunk-BC475SJH.js +1 -0
  60. package/dist/chunk-BEDBFJND.js +202 -0
  61. package/dist/chunk-BTTFCMKG.js +166 -0
  62. package/dist/chunk-BV3B2HYZ.js +1635 -0
  63. package/dist/chunk-C2NTXVWM.js +98 -0
  64. package/dist/chunk-CDRZHT42.js +424 -0
  65. package/dist/chunk-CJ5EOYZE.js +62 -0
  66. package/dist/chunk-CUMUNPXY.js +128 -0
  67. package/dist/chunk-CUS3ZSCU.js +1 -0
  68. package/dist/chunk-CYRBHQQZ.js +411 -0
  69. package/dist/chunk-DHWADYZX.js +144 -0
  70. package/dist/chunk-DKCSPATL.js +1 -0
  71. package/dist/chunk-DM5QUKKO.js +326 -0
  72. package/dist/chunk-DSJBXLUG.js +845 -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-FIF2M24N.js +1521 -0
  80. package/dist/chunk-FOKG57CR.js +993 -0
  81. package/dist/chunk-G3HOYSF7.js +1 -0
  82. package/dist/chunk-GDKZTW34.js +395 -0
  83. package/dist/chunk-GL7B2DOW.js +134 -0
  84. package/dist/chunk-GNNJ4GCC.js +471 -0
  85. package/dist/chunk-GNZ56EUI.js +1 -0
  86. package/dist/chunk-H6NIOQHK.js +346 -0
  87. package/dist/chunk-H6PC7RDA.js +1 -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-IIQTAY3J.js +715 -0
  92. package/dist/chunk-ITTYJZWX.js +271 -0
  93. package/dist/chunk-IVNRBPGC.js +1018 -0
  94. package/dist/chunk-J4KLDGI4.js +1 -0
  95. package/dist/chunk-J7Q7VCVC.js +254 -0
  96. package/dist/chunk-JDEOITQ2.js +1 -0
  97. package/dist/chunk-JNH2TYIN.js +96 -0
  98. package/dist/chunk-JRLTGLN4.js +1 -0
  99. package/dist/chunk-JTRJJLKL.js +1 -0
  100. package/dist/chunk-JUAMLEHX.js +379 -0
  101. package/dist/chunk-JXJB2X6M.js +131 -0
  102. package/dist/chunk-KMI5ML5I.js +262 -0
  103. package/dist/chunk-KTAC4MGE.js +4 -0
  104. package/dist/chunk-LAECSR4H.js +178 -0
  105. package/dist/chunk-LK4BCSGX.js +1 -0
  106. package/dist/chunk-LOE5YNN3.js +470 -0
  107. package/dist/chunk-LRJNDEIA.js +302 -0
  108. package/dist/chunk-LSS54GLJ.js +116 -0
  109. package/dist/chunk-LZLHELAG.js +137 -0
  110. package/dist/chunk-M2LUXGKZ.js +1 -0
  111. package/dist/chunk-MOUJOP55.js +425 -0
  112. package/dist/chunk-N32RGOA5.js +159 -0
  113. package/dist/chunk-N5ZNE2YE.js +1 -0
  114. package/dist/chunk-NBNCBML6.js +1 -0
  115. package/dist/chunk-NKB7BZYK.js +167 -0
  116. package/dist/chunk-NQYBUO3K.js +1795 -0
  117. package/dist/chunk-NY2U3PBI.js +59 -0
  118. package/dist/chunk-O4AEHWII.js +464 -0
  119. package/dist/chunk-O7AE6DAF.js +146 -0
  120. package/dist/chunk-OETCUXQP.js +134 -0
  121. package/dist/chunk-OOPPQH27.js +179 -0
  122. package/dist/chunk-OPXFZ4Y5.js +204 -0
  123. package/dist/chunk-P23EQNRQ.js +338 -0
  124. package/dist/chunk-PJXUJYS6.js +248 -0
  125. package/dist/chunk-PNWUWOBF.js +1 -0
  126. package/dist/chunk-PUPM2YGF.js +376 -0
  127. package/dist/chunk-PZXZJBMP.js +620 -0
  128. package/dist/chunk-Q72LJOVE.js +169 -0
  129. package/dist/chunk-QCDXZBC5.js +247 -0
  130. package/dist/chunk-QDYDBCFP.js +197 -0
  131. package/dist/chunk-QJJ6MADV.js +274 -0
  132. package/dist/chunk-QKXCPTFS.js +349 -0
  133. package/dist/chunk-QWCMU5B2.js +860 -0
  134. package/dist/chunk-RGQWWKLA.js +634 -0
  135. package/dist/chunk-RIBDXGUG.js +108 -0
  136. package/dist/chunk-RJQOOHT2.js +214 -0
  137. package/dist/chunk-RNGLIHFA.js +191 -0
  138. package/dist/chunk-RQ3HASCC.js +6 -0
  139. package/dist/chunk-RSOJT5YW.js +124 -0
  140. package/dist/chunk-RTIKSY6A.js +1 -0
  141. package/dist/chunk-RUZHTGKB.js +237 -0
  142. package/dist/chunk-RW6ZL2FQ.js +284 -0
  143. package/dist/chunk-S7F6XLTK.js +540 -0
  144. package/dist/chunk-SBMNWWBV.js +155 -0
  145. package/dist/chunk-SDTQPRRB.js +1 -0
  146. package/dist/chunk-SYNOJOQO.js +377 -0
  147. package/dist/chunk-T753XT36.js +1 -0
  148. package/dist/chunk-TKQYWZ5V.js +196 -0
  149. package/dist/chunk-TKVFVF5D.js +95 -0
  150. package/dist/chunk-TOXAGRDQ.js +144 -0
  151. package/dist/chunk-TUTI5HOZ.js +112 -0
  152. package/dist/chunk-U7TFM2JA.js +140 -0
  153. package/dist/chunk-UC2WGUP3.js +627 -0
  154. package/dist/chunk-UWFLYMAR.js +1126 -0
  155. package/dist/chunk-UWSZB7BJ.js +1 -0
  156. package/dist/chunk-UYG5L34B.js +87 -0
  157. package/dist/chunk-VBOXAEPI.js +336 -0
  158. package/dist/chunk-VCDBXW5H.js +188 -0
  159. package/dist/chunk-VCXPHHDS.js +1 -0
  160. package/dist/chunk-VEAYTRPX.js +414 -0
  161. package/dist/chunk-VFCUIDRT.js +1 -0
  162. package/dist/chunk-VQHPQEUH.js +273 -0
  163. package/dist/chunk-VXDZFJGP.js +874 -0
  164. package/dist/chunk-WS56BL3D.js +1 -0
  165. package/dist/chunk-WSW6ZFAQ.js +98 -0
  166. package/dist/chunk-WVKKJA6U.js +870 -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-Z7H7VSFZ.js +323 -0
  181. package/dist/chunk-ZK2H4O5P.js +1 -0
  182. package/dist/chunk-ZVFE5QGU.js +524 -0
  183. package/dist/coachmark/index.js +4 -0
  184. package/dist/code-block/index.js +4 -0
  185. package/dist/color-field/index.js +7 -0
  186. package/dist/commerce/index.js +20 -0
  187. package/dist/connectivity/index.js +2 -0
  188. package/dist/context-menu/index.js +5 -0
  189. package/dist/copy-button/index.js +3 -0
  190. package/dist/data-grid/index.js +24 -0
  191. package/dist/date-range-picker/index.js +13 -0
  192. package/dist/description-list/index.js +2 -0
  193. package/dist/dialog/index.js +3 -0
  194. package/dist/empty-state/index.js +3 -0
  195. package/dist/error-summary/index.js +3 -0
  196. package/dist/fab/index.js +2 -0
  197. package/dist/file-upload/index.js +9 -0
  198. package/dist/filter-bar/index.js +8 -0
  199. package/dist/flow-run/index.js +14 -0
  200. package/dist/form/index.js +3 -0
  201. package/dist/gallery/index.js +2 -0
  202. package/dist/header/index.js +5 -0
  203. package/dist/hold-to-confirm/index.js +4 -0
  204. package/dist/index.d.ts +22883 -0
  205. package/dist/index.js +158 -0
  206. package/dist/infinite-list/index.js +2 -0
  207. package/dist/inline-edit/index.js +5 -0
  208. package/dist/input/index.js +5 -0
  209. package/dist/interactions/index.js +2 -0
  210. package/dist/invoice/index.js +10 -0
  211. package/dist/kbd/index.js +1 -0
  212. package/dist/keyboard/index.js +3 -0
  213. package/dist/list-row/index.js +7 -0
  214. package/dist/log-viewer/index.js +2 -0
  215. package/dist/map-view/index.js +3 -0
  216. package/dist/markdown/index.js +6 -0
  217. package/dist/metric/index.js +4 -0
  218. package/dist/money/index.js +3 -0
  219. package/dist/nav-drawer/index.js +2 -0
  220. package/dist/navigation/index.js +2 -0
  221. package/dist/notification-center/index.js +16 -0
  222. package/dist/number-roll/index.js +3 -0
  223. package/dist/one-handed/index.js +5 -0
  224. package/dist/os-surfaces/index.js +3 -0
  225. package/dist/otp/index.js +7 -0
  226. package/dist/page-header/index.js +1 -0
  227. package/dist/payment-method/index.js +12 -0
  228. package/dist/payment-status/index.js +16 -0
  229. package/dist/permission/index.js +2 -0
  230. package/dist/picker/index.js +7 -0
  231. package/dist/progress/index.js +5 -0
  232. package/dist/pull-to-refresh/index.js +4 -0
  233. package/dist/radio-group/index.js +6 -0
  234. package/dist/rating/index.js +2 -0
  235. package/dist/receivables/index.js +20 -0
  236. package/dist/refund/index.js +16 -0
  237. package/dist/save-status/index.js +3 -0
  238. package/dist/scroll-area/index.js +1 -0
  239. package/dist/search-bar/index.js +5 -0
  240. package/dist/segmented-control/index.js +5 -0
  241. package/dist/sheet/index.js +4 -0
  242. package/dist/skeleton/index.js +2 -0
  243. package/dist/slider/index.js +5 -0
  244. package/dist/spinner/index.js +2 -0
  245. package/dist/split-button/index.js +7 -0
  246. package/dist/spotlight/index.js +2 -0
  247. package/dist/stage-timeline/index.js +4 -0
  248. package/dist/status-dot/index.js +2 -0
  249. package/dist/stepper/index.js +6 -0
  250. package/dist/streaming-text/index.js +3 -0
  251. package/dist/survey/index.js +19 -0
  252. package/dist/switch/index.js +5 -0
  253. package/dist/system-state/index.js +4 -0
  254. package/dist/tab-bar/index.js +2 -0
  255. package/dist/tabs/index.js +2 -0
  256. package/dist/textarea/index.js +6 -0
  257. package/dist/thinking/index.js +2 -0
  258. package/dist/timeline/index.js +4 -0
  259. package/dist/toast/index.js +2 -0
  260. package/dist/toolbar/index.js +2 -0
  261. package/dist/tour/index.js +11 -0
  262. package/dist/truncation-notice/index.js +2 -0
  263. package/dist/update-notice/index.js +11 -0
  264. package/dist/video-player/index.js +2 -0
  265. package/dist/viewfinder/index.js +5 -0
  266. package/dist/widget/index.js +4 -0
  267. package/dist/wizard/index.js +6 -0
  268. package/package.json +76 -3
  269. package/README.md +0 -3
@@ -0,0 +1,504 @@
1
+ import { Amount, PriceRow } from './chunk-VBOXAEPI.js';
2
+ import { DescriptionList } from './chunk-TUTI5HOZ.js';
3
+ import { Badge } from './chunk-SBMNWWBV.js';
4
+ import { Button } from './chunk-3ARE4TES.js';
5
+ import { Icon } from './chunk-TKVFVF5D.js';
6
+ import 'react';
7
+ import { View, Text } from 'react-native';
8
+ import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
9
+ import { dateZone, dayLabel } from '@btndprojects/loam-date';
10
+ import { INVOICE_STATUS, TAX_MODES, REVERSE_CHARGE_NOTE } from '@btndprojects/loam-pay';
11
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
12
+
13
+ function InvoiceStatusStamp({
14
+ stamp: value,
15
+ size = "md",
16
+ style
17
+ }) {
18
+ const theme = useLoamTheme();
19
+ const { styles } = useStyles(sheet);
20
+ const plate = stampPlate(theme, value.tone);
21
+ return /* @__PURE__ */ jsx(
22
+ View,
23
+ {
24
+ testID: `invoice-stamp-${value.tone}`,
25
+ accessibilityRole: "text",
26
+ accessibilityLabel: value.label,
27
+ style: [
28
+ styles.stamp,
29
+ size === "lg" ? styles.stampLg : styles.stampMd,
30
+ { borderColor: plate.edge, backgroundColor: plate.fill },
31
+ style
32
+ ],
33
+ children: /* @__PURE__ */ jsx(
34
+ Text,
35
+ {
36
+ style: [
37
+ styles.stampLabel,
38
+ size === "lg" ? styles.stampLabelLg : styles.stampLabelMd,
39
+ { color: plate.ink }
40
+ ],
41
+ children: value.label
42
+ }
43
+ )
44
+ }
45
+ );
46
+ }
47
+ function stampPlate(theme, tone) {
48
+ switch (tone) {
49
+ case "good":
50
+ return { fill: theme.color.goodSoft, edge: theme.color.good, ink: theme.color.goodOnSoft };
51
+ case "warn":
52
+ return { fill: theme.color.warnSoft, edge: theme.color.warn, ink: theme.color.warnOnSoft };
53
+ case "danger":
54
+ return {
55
+ fill: theme.color.dangerSoft,
56
+ edge: theme.color.danger,
57
+ ink: theme.color.dangerOnSoft
58
+ };
59
+ case "info":
60
+ default:
61
+ return { fill: theme.color.infoSoft, edge: theme.color.info, ink: theme.color.infoOnSoft };
62
+ }
63
+ }
64
+ function InvoiceStatusBadge({
65
+ status,
66
+ label,
67
+ size = "sm"
68
+ }) {
69
+ const meta = INVOICE_STATUS[status];
70
+ return /* @__PURE__ */ jsx(Badge, { variant: meta.tone, size, children: label ?? meta.label });
71
+ }
72
+ var sheet = createStyleSheet((theme) => ({
73
+ stamp: {
74
+ alignSelf: "flex-start",
75
+ alignItems: "center",
76
+ justifyContent: "center",
77
+ borderRadius: theme.radius.md,
78
+ // The static thick weight: the plate outline is part of the drawing.
79
+ borderWidth: theme.borderWidth.thick
80
+ },
81
+ stampMd: { paddingHorizontal: theme.space.s3, paddingVertical: theme.space.s1 },
82
+ stampLg: { paddingHorizontal: theme.space.s4, paddingVertical: theme.space.s2 },
83
+ stampLabel: {
84
+ fontFamily: theme.font.sans,
85
+ fontWeight: theme.fontWeight.bold,
86
+ textTransform: "uppercase"
87
+ },
88
+ stampLabelMd: {
89
+ fontSize: theme.type.footnote.fontSize,
90
+ lineHeight: theme.type.footnote.lineHeight,
91
+ letterSpacing: theme.tracking.wide
92
+ },
93
+ stampLabelLg: {
94
+ fontSize: theme.fontSize[17],
95
+ lineHeight: theme.type.body.lineHeight,
96
+ letterSpacing: theme.tracking.wider
97
+ }
98
+ }));
99
+ function discountLabel(discounts) {
100
+ const list = discounts ?? [];
101
+ if (list.length === 0) return "Discount";
102
+ return list.map((d) => d.kind === "pct" ? `${d.label} \xB7 ${d.value}%` : d.label).join(" \xB7 ");
103
+ }
104
+ function InvoiceDocument({
105
+ invoice,
106
+ totals: t,
107
+ stamp,
108
+ dense = false,
109
+ showPayAction = false,
110
+ locale,
111
+ zone,
112
+ onPay,
113
+ onDownloadPdf,
114
+ title = "Invoice",
115
+ payLabel = "Pay by card instead",
116
+ style
117
+ }) {
118
+ const theme = useLoamTheme();
119
+ const { styles } = useStyles(sheet2);
120
+ const Z = zone ?? dateZone();
121
+ const day = (ms) => dayLabel(Z, ms, { longMonth: true, locale });
122
+ const cy = invoice.currency;
123
+ const mode = TAX_MODES[invoice.taxMode];
124
+ const zeroRated = invoice.taxMode === "reverse" || invoice.taxMode === "exempt";
125
+ return /* @__PURE__ */ jsxs(
126
+ View,
127
+ {
128
+ role: "region",
129
+ accessibilityLabel: `${title} ${invoice.number}`,
130
+ style: [styles.doc, dense ? styles.docDense : null, style],
131
+ children: [
132
+ /* @__PURE__ */ jsxs(View, { style: styles.header, children: [
133
+ /* @__PURE__ */ jsxs(View, { style: styles.sellerBlock, children: [
134
+ /* @__PURE__ */ jsx(Text, { style: styles.sellerName, children: invoice.seller.name }),
135
+ /* @__PURE__ */ jsx(Text, { style: styles.sellerAddr, children: invoice.seller.addr }),
136
+ invoice.seller.vat ? /* @__PURE__ */ jsx(Text, { style: styles.sellerMeta, children: `VAT ${invoice.seller.vat}` }) : null,
137
+ invoice.seller.reg ? /* @__PURE__ */ jsx(Text, { style: styles.sellerMeta, children: `Reg. ${invoice.seller.reg}` }) : null
138
+ ] }),
139
+ /* @__PURE__ */ jsxs(View, { style: styles.titleBlock, children: [
140
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.docTitle, children: title }),
141
+ /* @__PURE__ */ jsx(Text, { style: styles.mono, children: invoice.number }),
142
+ /* @__PURE__ */ jsx(InvoiceStatusStamp, { stamp, size: "lg" })
143
+ ] })
144
+ ] }),
145
+ /* @__PURE__ */ jsx(Block, { title: "Billed to", children: /* @__PURE__ */ jsx(DescriptionList, { layout: "inline", density: "compact", items: partyEntries(invoice.buyer, styles.mono) }) }),
146
+ /* @__PURE__ */ jsx(Block, { title: "Dates", children: /* @__PURE__ */ jsx(
147
+ DescriptionList,
148
+ {
149
+ layout: "inline",
150
+ density: "compact",
151
+ items: [
152
+ { term: "Issued", description: day(invoice.issued) },
153
+ {
154
+ term: "Due",
155
+ description: /* @__PURE__ */ jsx(Text, { style: styles.strongValue, children: day(invoice.due) })
156
+ },
157
+ { term: "Terms", description: invoice.terms }
158
+ ]
159
+ }
160
+ ) }),
161
+ /* @__PURE__ */ jsx(Block, { title: "References", children: /* @__PURE__ */ jsx(
162
+ DescriptionList,
163
+ {
164
+ layout: "inline",
165
+ density: "compact",
166
+ items: [
167
+ { term: "Invoice", description: /* @__PURE__ */ jsx(Text, { style: styles.mono, children: invoice.number }) },
168
+ ...invoice.po ? [{ term: "PO", description: /* @__PURE__ */ jsx(Text, { style: styles.mono, children: invoice.po }) }] : [],
169
+ { term: "Tax mode", description: mode.label },
170
+ { term: "Currency", description: `${t.c.code} \xB7 ${t.c.label}` }
171
+ ]
172
+ }
173
+ ) }),
174
+ /* @__PURE__ */ jsx(Block, { title: `Lines \xB7 all amounts in ${t.c.code}`, children: t.lines.length === 0 ? /* @__PURE__ */ jsx(Text, { style: styles.empty, children: "This invoice has no lines." }) : /* @__PURE__ */ jsx(View, { role: "list", accessibilityRole: "list", style: styles.lines, children: t.lines.map((line, index) => /* @__PURE__ */ jsxs(
175
+ View,
176
+ {
177
+ role: "listitem",
178
+ style: [styles.line, dense ? styles.lineDense : null],
179
+ children: [
180
+ /* @__PURE__ */ jsx(Text, { style: styles.lineDesc, children: line.desc }),
181
+ line.detail ? /* @__PURE__ */ jsx(Text, { style: styles.lineDetail, children: line.detail }) : null,
182
+ /* @__PURE__ */ jsxs(View, { style: styles.lineFoot, children: [
183
+ /* @__PURE__ */ jsx(Text, { style: styles.lineMeta, children: `${line.qty} \xD7` }),
184
+ /* @__PURE__ */ jsx(
185
+ Amount,
186
+ {
187
+ minor: line.unit,
188
+ currency: cy,
189
+ size: "sm",
190
+ noSymbol: true,
191
+ locale
192
+ }
193
+ ),
194
+ /* @__PURE__ */ jsx(Text, { style: styles.lineMeta, children: `\xB7 ${zeroRated ? 0 : line.tax}% tax` }),
195
+ /* @__PURE__ */ jsx(View, { style: styles.pushEnd, children: /* @__PURE__ */ jsx(
196
+ Amount,
197
+ {
198
+ minor: line.amount,
199
+ currency: cy,
200
+ size: "sm",
201
+ weight: "bold",
202
+ noSymbol: true,
203
+ locale,
204
+ align: "end"
205
+ }
206
+ ) })
207
+ ] })
208
+ ]
209
+ },
210
+ `${invoice.id}-line-${index}`
211
+ )) }) }),
212
+ /* @__PURE__ */ jsxs(Block, { title: "How to pay", children: [
213
+ /* @__PURE__ */ jsx(
214
+ DescriptionList,
215
+ {
216
+ layout: "inline",
217
+ density: "compact",
218
+ items: [
219
+ ...invoice.seller.iban ? [{ term: "IBAN", description: /* @__PURE__ */ jsx(Text, { style: styles.mono, children: invoice.seller.iban }) }] : [],
220
+ ...invoice.seller.bic ? [
221
+ {
222
+ term: "BIC / SWIFT",
223
+ description: /* @__PURE__ */ jsx(Text, { style: styles.mono, children: invoice.seller.bic })
224
+ }
225
+ ] : [],
226
+ { term: "Reference", description: /* @__PURE__ */ jsx(Text, { style: styles.mono, children: invoice.number }) },
227
+ { term: "Payable by", description: day(invoice.due) }
228
+ ]
229
+ }
230
+ ),
231
+ showPayAction ? /* @__PURE__ */ jsx(View, { style: styles.payAction, children: /* @__PURE__ */ jsx(Button, { variant: "tonal", size: "sm", leadingIcon: "card", onPress: onPay, children: payLabel }) }) : null
232
+ ] }),
233
+ /* @__PURE__ */ jsx(Block, { title: "Totals", children: /* @__PURE__ */ jsxs(View, { style: dense ? styles.totalsDense : styles.totals, children: [
234
+ /* @__PURE__ */ jsx(PriceRow, { label: "Subtotal", minor: t.gross, currency: cy, noSymbol: true, locale }),
235
+ t.discount !== 0 ? /* @__PURE__ */ jsx(
236
+ PriceRow,
237
+ {
238
+ label: discountLabel(invoice.discounts),
239
+ minor: -t.discount,
240
+ currency: cy,
241
+ tone: "good",
242
+ noSymbol: true,
243
+ locale
244
+ }
245
+ ) : null,
246
+ t.discount !== 0 ? /* @__PURE__ */ jsx(PriceRow, { label: "Net", minor: t.net, currency: cy, noSymbol: true, locale, rule: true }) : null,
247
+ invoice.taxMode === "inclusive" ? /* @__PURE__ */ jsxs(Fragment, { children: [
248
+ /* @__PURE__ */ jsx(
249
+ PriceRow,
250
+ {
251
+ label: "Taxable amount",
252
+ minor: t.taxable,
253
+ currency: cy,
254
+ noSymbol: true,
255
+ locale
256
+ }
257
+ ),
258
+ /* @__PURE__ */ jsx(
259
+ PriceRow,
260
+ {
261
+ label: `${invoice.taxLabel} \xB7 included above`,
262
+ minor: t.tax,
263
+ currency: cy,
264
+ noSymbol: true,
265
+ locale
266
+ }
267
+ )
268
+ ] }) : /* @__PURE__ */ jsx(
269
+ PriceRow,
270
+ {
271
+ label: zeroRated ? `${invoice.taxLabel} \xB7 ${mode.label.toLowerCase()}` : invoice.taxLabel,
272
+ minor: t.tax,
273
+ currency: cy,
274
+ noSymbol: true,
275
+ locale
276
+ }
277
+ ),
278
+ (invoice.credits ?? []).map((c) => /* @__PURE__ */ jsx(
279
+ PriceRow,
280
+ {
281
+ label: c.label,
282
+ minor: -c.amount,
283
+ currency: cy,
284
+ tone: "good",
285
+ noSymbol: true,
286
+ locale
287
+ },
288
+ c.label
289
+ )),
290
+ /* @__PURE__ */ jsx(PriceRow, { label: "Total", minor: t.total, currency: cy, strong: true, rule: true, locale }),
291
+ (invoice.payments ?? []).map((p) => /* @__PURE__ */ jsx(
292
+ PriceRow,
293
+ {
294
+ label: `${p.label} \xB7 ${day(p.at)}`,
295
+ minor: -p.amount,
296
+ currency: cy,
297
+ tone: "good",
298
+ noSymbol: true,
299
+ locale
300
+ },
301
+ `${p.label}-${p.at}`
302
+ )),
303
+ /* @__PURE__ */ jsx(PriceRow, { label: "Amount due", minor: t.due, currency: cy, strong: true, rule: true, locale })
304
+ ] }) }),
305
+ invoice.taxMode === "reverse" ? /* @__PURE__ */ jsxs(View, { style: styles.legalBox, children: [
306
+ /* @__PURE__ */ jsx(Icon, { name: "info", size: theme.icon.sm, color: theme.color.text2 }),
307
+ /* @__PURE__ */ jsxs(View, { style: styles.legalBody, children: [
308
+ /* @__PURE__ */ jsx(Text, { style: styles.legalTitle, children: mode.label }),
309
+ /* @__PURE__ */ jsx(Text, { style: styles.legalNote, children: REVERSE_CHARGE_NOTE })
310
+ ] })
311
+ ] }) : null,
312
+ /* @__PURE__ */ jsxs(View, { style: styles.footer, children: [
313
+ invoice.notes ? /* @__PURE__ */ jsx(Text, { style: styles.notes, children: invoice.notes }) : null,
314
+ /* @__PURE__ */ jsx(Text, { style: styles.taxFooter, children: `${mode.label} \u2014 ${mode.note}` })
315
+ ] }),
316
+ onDownloadPdf ? /* @__PURE__ */ jsx(View, { style: styles.docActions, children: /* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", leadingIcon: "download", onPress: onDownloadPdf, children: "Download PDF" }) }) : null
317
+ ]
318
+ }
319
+ );
320
+ }
321
+ function partyEntries(party, mono) {
322
+ const out = [
323
+ { term: "Name", description: party.name },
324
+ { term: "Address", description: party.addr }
325
+ ];
326
+ if (party.vat) out.push({ term: "VAT", description: /* @__PURE__ */ jsx(Text, { style: mono, children: party.vat }) });
327
+ if (party.reg)
328
+ out.push({ term: "Registration", description: /* @__PURE__ */ jsx(Text, { style: mono, children: party.reg }) });
329
+ if (party.contact) out.push({ term: "Contact", description: party.contact });
330
+ return out;
331
+ }
332
+ function Block({
333
+ title,
334
+ children
335
+ }) {
336
+ const { styles } = useStyles(sheet2);
337
+ return /* @__PURE__ */ jsxs(View, { style: styles.block, children: [
338
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.overline, children: title }),
339
+ children
340
+ ] });
341
+ }
342
+ var sheet2 = createStyleSheet((theme) => ({
343
+ doc: {
344
+ alignSelf: "stretch",
345
+ gap: theme.space.s5,
346
+ padding: theme.space.s5,
347
+ borderRadius: theme.radius.lg,
348
+ borderWidth: theme.borderWidth.base,
349
+ borderColor: theme.color.border,
350
+ backgroundColor: theme.color.surface
351
+ },
352
+ docDense: { gap: theme.space.s4, padding: theme.space.s4 },
353
+ header: {
354
+ flexDirection: "row",
355
+ flexWrap: "wrap",
356
+ alignItems: "flex-start",
357
+ justifyContent: "space-between",
358
+ gap: theme.space.s4
359
+ },
360
+ sellerBlock: { flexShrink: 1, gap: theme.space.s1 },
361
+ sellerName: {
362
+ fontFamily: theme.font.display,
363
+ fontWeight: theme.font.displayWeight,
364
+ fontSize: theme.type.title3.fontSize,
365
+ lineHeight: theme.type.title3.lineHeight,
366
+ color: theme.color.text
367
+ },
368
+ sellerAddr: {
369
+ fontFamily: theme.font.sans,
370
+ fontSize: theme.type.footnote.fontSize,
371
+ lineHeight: theme.type.footnote.lineHeight,
372
+ color: theme.color.text2
373
+ },
374
+ sellerMeta: {
375
+ fontFamily: theme.font.sans,
376
+ fontSize: theme.type.caption1.fontSize,
377
+ lineHeight: theme.type.caption1.lineHeight,
378
+ color: theme.color.text3
379
+ },
380
+ titleBlock: { alignItems: "flex-end", gap: theme.space.s2 },
381
+ docTitle: {
382
+ fontFamily: theme.font.display,
383
+ fontWeight: theme.font.displayWeight,
384
+ fontSize: theme.type.title1.fontSize,
385
+ lineHeight: theme.type.title1.lineHeight,
386
+ letterSpacing: theme.type.title1.letterSpacing,
387
+ color: theme.color.text
388
+ },
389
+ mono: {
390
+ fontFamily: theme.font.mono,
391
+ fontVariant: ["tabular-nums"],
392
+ fontSize: theme.type.footnote.fontSize,
393
+ lineHeight: theme.type.footnote.lineHeight,
394
+ color: theme.color.text
395
+ },
396
+ strongValue: {
397
+ fontFamily: theme.font.sans,
398
+ fontWeight: theme.fontWeight.bold,
399
+ fontSize: theme.type.footnote.fontSize,
400
+ lineHeight: theme.type.footnote.lineHeight,
401
+ color: theme.color.text
402
+ },
403
+ block: { gap: theme.space.s2 },
404
+ overline: {
405
+ fontFamily: theme.font.sans,
406
+ fontWeight: theme.fontWeight.bold,
407
+ fontSize: theme.type.caption2.fontSize,
408
+ lineHeight: theme.type.caption2.lineHeight,
409
+ letterSpacing: theme.tracking.caps,
410
+ textTransform: "uppercase",
411
+ color: theme.color.text3
412
+ },
413
+ lines: { gap: theme.space.s2 },
414
+ line: {
415
+ gap: theme.space.s1,
416
+ padding: theme.space.s3,
417
+ borderRadius: theme.radius.md,
418
+ borderWidth: theme.borderWidth.base,
419
+ borderColor: theme.color.border,
420
+ backgroundColor: theme.color.surface2
421
+ },
422
+ lineDense: { padding: theme.space.s2 },
423
+ lineDesc: {
424
+ fontFamily: theme.font.sans,
425
+ fontWeight: theme.fontWeight.semibold,
426
+ fontSize: theme.type.footnote.fontSize,
427
+ lineHeight: theme.type.footnote.lineHeight,
428
+ color: theme.color.text
429
+ },
430
+ lineDetail: {
431
+ fontFamily: theme.font.sans,
432
+ fontSize: theme.type.caption1.fontSize,
433
+ lineHeight: theme.type.caption1.lineHeight,
434
+ color: theme.color.text3
435
+ },
436
+ lineFoot: {
437
+ flexDirection: "row",
438
+ flexWrap: "wrap",
439
+ alignItems: "baseline",
440
+ gap: theme.space.s1
441
+ },
442
+ lineMeta: {
443
+ fontFamily: theme.font.sans,
444
+ fontVariant: ["tabular-nums"],
445
+ fontSize: theme.type.caption1.fontSize,
446
+ lineHeight: theme.type.caption1.lineHeight,
447
+ color: theme.color.text2
448
+ },
449
+ pushEnd: { marginStart: "auto" },
450
+ empty: {
451
+ fontFamily: theme.font.sans,
452
+ fontSize: theme.type.footnote.fontSize,
453
+ lineHeight: theme.type.footnote.lineHeight,
454
+ color: theme.color.text3
455
+ },
456
+ payAction: { alignSelf: "flex-start", paddingTop: theme.space.s1 },
457
+ totals: { gap: theme.space.s2 },
458
+ totalsDense: { gap: theme.space.s1 },
459
+ legalBox: {
460
+ flexDirection: "row",
461
+ alignItems: "flex-start",
462
+ gap: theme.space.s3,
463
+ padding: theme.space.s4,
464
+ borderRadius: theme.radius.md,
465
+ borderWidth: theme.borderWidth.base,
466
+ borderColor: theme.color.border,
467
+ backgroundColor: theme.color.surface2
468
+ },
469
+ legalBody: { flex: 1, gap: theme.space.s1 },
470
+ legalTitle: {
471
+ fontFamily: theme.font.sans,
472
+ fontWeight: theme.fontWeight.bold,
473
+ fontSize: theme.type.footnote.fontSize,
474
+ lineHeight: theme.type.footnote.lineHeight,
475
+ color: theme.color.text
476
+ },
477
+ legalNote: {
478
+ fontFamily: theme.font.sans,
479
+ fontSize: theme.type.footnote.fontSize,
480
+ lineHeight: theme.type.footnote.fontSize * theme.lineHeight.normal,
481
+ color: theme.color.text2
482
+ },
483
+ footer: {
484
+ gap: theme.space.s2,
485
+ paddingTop: theme.space.s4,
486
+ borderTopWidth: theme.borderWidth.base,
487
+ borderTopColor: theme.color.border
488
+ },
489
+ notes: {
490
+ fontFamily: theme.font.sans,
491
+ fontSize: theme.type.footnote.fontSize,
492
+ lineHeight: theme.type.footnote.fontSize * theme.lineHeight.normal,
493
+ color: theme.color.text2
494
+ },
495
+ taxFooter: {
496
+ fontFamily: theme.font.sans,
497
+ fontSize: theme.type.caption1.fontSize,
498
+ lineHeight: theme.type.caption1.fontSize * theme.lineHeight.normal,
499
+ color: theme.color.text3
500
+ },
501
+ docActions: { flexDirection: "row", flexWrap: "wrap", gap: theme.space.s2 }
502
+ }));
503
+
504
+ export { InvoiceDocument, InvoiceStatusBadge, InvoiceStatusStamp };
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import { AccessibilityInfo } from 'react-native';
3
+
4
+ // src/lib/motion.ts
5
+ function useReducedMotion() {
6
+ const [reduced, setReduced] = React.useState(false);
7
+ React.useEffect(() => {
8
+ let cancelled = false;
9
+ let sub;
10
+ try {
11
+ const query = AccessibilityInfo.isReduceMotionEnabled?.();
12
+ query?.then((value) => {
13
+ if (!cancelled) setReduced(value);
14
+ }).catch(() => {
15
+ });
16
+ sub = AccessibilityInfo.addEventListener?.("reduceMotionChanged", (value) => {
17
+ setReduced(value);
18
+ });
19
+ } catch {
20
+ }
21
+ return () => {
22
+ cancelled = true;
23
+ sub?.remove?.();
24
+ };
25
+ }, []);
26
+ return reduced;
27
+ }
28
+ function useResolvedMotion(motion = "full") {
29
+ const osReduced = useReducedMotion();
30
+ if (motion === "none") return "none";
31
+ if (motion === "reduced") return "reduced";
32
+ return osReduced ? "reduced" : "full";
33
+ }
34
+
35
+ export { useReducedMotion, useResolvedMotion };