@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.
- package/LICENSE +21 -0
- package/README.md +55 -2
- package/dist/accordion/index.js +3 -0
- package/dist/adaptive/index.js +2 -0
- package/dist/alert/index.js +3 -0
- package/dist/analyzer/index.js +6 -0
- package/dist/announcement/index.js +6 -0
- package/dist/audio-player/index.js +3 -0
- package/dist/avatar/index.js +3 -0
- package/dist/avatar-group/index.js +3 -0
- package/dist/badge/index.js +5 -0
- package/dist/banner/index.js +2 -0
- package/dist/board/index.js +7 -0
- package/dist/button/index.js +5 -0
- package/dist/camera-permission/index.js +13 -0
- package/dist/capture-result/index.js +18 -0
- package/dist/card/index.js +4 -0
- package/dist/card-form/index.js +10 -0
- package/dist/carousel/index.js +2 -0
- package/dist/chart/index.js +6 -0
- package/dist/charts/index.js +7 -0
- package/dist/checkbox/index.js +7 -0
- package/dist/checklist/index.js +10 -0
- package/dist/checkout/index.js +13 -0
- package/dist/chip/index.js +7 -0
- package/dist/chunk-223Q2T2Q.js +229 -0
- package/dist/chunk-2A5NIQAK.js +254 -0
- package/dist/chunk-2GK6PHGE.js +363 -0
- package/dist/chunk-2WUTXHMU.js +1 -0
- package/dist/chunk-2ZZ7TDJ4.js +324 -0
- package/dist/chunk-35OFI3JG.js +499 -0
- package/dist/chunk-3ARE4TES.js +195 -0
- package/dist/chunk-3ECPOSKO.js +1 -0
- package/dist/chunk-3ENTMPQY.js +229 -0
- package/dist/chunk-3HJH6FF4.js +98 -0
- package/dist/chunk-3NMD74ZU.js +4 -0
- package/dist/chunk-3WPW4KUN.js +182 -0
- package/dist/chunk-423B7SPN.js +993 -0
- package/dist/chunk-47FWHGUN.js +394 -0
- package/dist/chunk-4BXMXBJO.js +141 -0
- package/dist/chunk-4DS5ZWVC.js +83 -0
- package/dist/chunk-4GBOGOTV.js +295 -0
- package/dist/chunk-4SZYY6AN.js +99 -0
- package/dist/chunk-4YIP3CWS.js +237 -0
- package/dist/chunk-4YQOR7JM.js +204 -0
- package/dist/chunk-4ZAHCY44.js +177 -0
- package/dist/chunk-52X2VYTD.js +228 -0
- package/dist/chunk-5P26LBDL.js +1 -0
- package/dist/chunk-5XLRYDAX.js +1 -0
- package/dist/chunk-5YNTNN5A.js +177 -0
- package/dist/chunk-6HT2LP62.js +504 -0
- package/dist/chunk-6N33LFQA.js +35 -0
- package/dist/chunk-6X6PQ443.js +432 -0
- package/dist/chunk-7CFF4HXS.js +126 -0
- package/dist/chunk-7O2FMUPT.js +755 -0
- package/dist/chunk-AI4DWZCD.js +162 -0
- package/dist/chunk-AWJOCGFZ.js +213 -0
- package/dist/chunk-AZRX6SAC.js +285 -0
- package/dist/chunk-B54QE2FN.js +1 -0
- package/dist/chunk-BC475SJH.js +1 -0
- package/dist/chunk-BEDBFJND.js +202 -0
- package/dist/chunk-BTTFCMKG.js +166 -0
- package/dist/chunk-BV3B2HYZ.js +1635 -0
- package/dist/chunk-C2NTXVWM.js +98 -0
- package/dist/chunk-CDRZHT42.js +424 -0
- package/dist/chunk-CJ5EOYZE.js +62 -0
- package/dist/chunk-CUMUNPXY.js +128 -0
- package/dist/chunk-CUS3ZSCU.js +1 -0
- package/dist/chunk-CYRBHQQZ.js +411 -0
- package/dist/chunk-DHWADYZX.js +144 -0
- package/dist/chunk-DKCSPATL.js +1 -0
- package/dist/chunk-DM5QUKKO.js +326 -0
- package/dist/chunk-DYBH2I6W.js +1 -0
- package/dist/chunk-DZ255O2F.js +1 -0
- package/dist/chunk-E35BPSGW.js +1 -0
- package/dist/chunk-EJBDRVIH.js +166 -0
- package/dist/chunk-F43NP42L.js +1 -0
- package/dist/chunk-F5XNPWS7.js +1024 -0
- package/dist/chunk-FMYDDECK.js +1521 -0
- package/dist/chunk-G3HOYSF7.js +1 -0
- package/dist/chunk-GDKZTW34.js +395 -0
- package/dist/chunk-GL7B2DOW.js +134 -0
- package/dist/chunk-GNNJ4GCC.js +471 -0
- package/dist/chunk-GNZ56EUI.js +1 -0
- package/dist/chunk-H6NIOQHK.js +346 -0
- package/dist/chunk-H6PC7RDA.js +1 -0
- package/dist/chunk-HET4LLMX.js +129 -0
- package/dist/chunk-HPPW424V.js +334 -0
- package/dist/chunk-HQOQIBJI.js +1 -0
- package/dist/chunk-HU2EQNRZ.js +44 -0
- package/dist/chunk-HZ6CNMAF.js +870 -0
- package/dist/chunk-IIQTAY3J.js +715 -0
- package/dist/chunk-ITTYJZWX.js +271 -0
- package/dist/chunk-IVNRBPGC.js +1018 -0
- package/dist/chunk-J4KLDGI4.js +1 -0
- package/dist/chunk-J7Q7VCVC.js +254 -0
- package/dist/chunk-JDEOITQ2.js +1 -0
- package/dist/chunk-JNH2TYIN.js +96 -0
- package/dist/chunk-JNY4ZHAR.js +634 -0
- package/dist/chunk-JRLTGLN4.js +1 -0
- package/dist/chunk-JTRJJLKL.js +1 -0
- package/dist/chunk-JUAMLEHX.js +379 -0
- package/dist/chunk-JXJB2X6M.js +131 -0
- package/dist/chunk-KMI5ML5I.js +262 -0
- package/dist/chunk-KTAC4MGE.js +4 -0
- package/dist/chunk-LAECSR4H.js +178 -0
- package/dist/chunk-LK4BCSGX.js +1 -0
- package/dist/chunk-LOE5YNN3.js +470 -0
- package/dist/chunk-LRJNDEIA.js +302 -0
- package/dist/chunk-LSS54GLJ.js +116 -0
- package/dist/chunk-LZLHELAG.js +137 -0
- package/dist/chunk-M2LUXGKZ.js +1 -0
- package/dist/chunk-MOUJOP55.js +425 -0
- package/dist/chunk-N32RGOA5.js +159 -0
- package/dist/chunk-N5ZNE2YE.js +1 -0
- package/dist/chunk-NBNCBML6.js +1 -0
- package/dist/chunk-NKB7BZYK.js +167 -0
- package/dist/chunk-NQYBUO3K.js +1795 -0
- package/dist/chunk-NY2U3PBI.js +59 -0
- package/dist/chunk-O4AEHWII.js +464 -0
- package/dist/chunk-O7AE6DAF.js +146 -0
- package/dist/chunk-OETCUXQP.js +134 -0
- package/dist/chunk-OOPPQH27.js +179 -0
- package/dist/chunk-OPXFZ4Y5.js +204 -0
- package/dist/chunk-P23EQNRQ.js +338 -0
- package/dist/chunk-PJXUJYS6.js +248 -0
- package/dist/chunk-PNWUWOBF.js +1 -0
- package/dist/chunk-PUPM2YGF.js +376 -0
- package/dist/chunk-PZXZJBMP.js +620 -0
- package/dist/chunk-Q72LJOVE.js +169 -0
- package/dist/chunk-QCDXZBC5.js +247 -0
- package/dist/chunk-QDYDBCFP.js +197 -0
- package/dist/chunk-QJJ6MADV.js +274 -0
- package/dist/chunk-QKXCPTFS.js +349 -0
- package/dist/chunk-QWCMU5B2.js +860 -0
- package/dist/chunk-RIBDXGUG.js +108 -0
- package/dist/chunk-RJQOOHT2.js +214 -0
- package/dist/chunk-RNGLIHFA.js +191 -0
- package/dist/chunk-RQ3HASCC.js +6 -0
- package/dist/chunk-RSOJT5YW.js +124 -0
- package/dist/chunk-RTIKSY6A.js +1 -0
- package/dist/chunk-RUZHTGKB.js +237 -0
- package/dist/chunk-RW6ZL2FQ.js +284 -0
- package/dist/chunk-S7F6XLTK.js +540 -0
- package/dist/chunk-SBMNWWBV.js +155 -0
- package/dist/chunk-SDTQPRRB.js +1 -0
- package/dist/chunk-SYNOJOQO.js +377 -0
- package/dist/chunk-T753XT36.js +1 -0
- package/dist/chunk-TKQYWZ5V.js +196 -0
- package/dist/chunk-TKVFVF5D.js +95 -0
- package/dist/chunk-TOXAGRDQ.js +144 -0
- package/dist/chunk-TUTI5HOZ.js +112 -0
- package/dist/chunk-U7TFM2JA.js +140 -0
- package/dist/chunk-UC2WGUP3.js +627 -0
- package/dist/chunk-UWFLYMAR.js +1126 -0
- package/dist/chunk-UWSZB7BJ.js +1 -0
- package/dist/chunk-UYG5L34B.js +87 -0
- package/dist/chunk-VBOXAEPI.js +336 -0
- package/dist/chunk-VCDBXW5H.js +188 -0
- package/dist/chunk-VCXPHHDS.js +1 -0
- package/dist/chunk-VEAYTRPX.js +414 -0
- package/dist/chunk-VFCUIDRT.js +1 -0
- package/dist/chunk-VQHPQEUH.js +273 -0
- package/dist/chunk-VXDZFJGP.js +874 -0
- package/dist/chunk-WS56BL3D.js +1 -0
- package/dist/chunk-WSW6ZFAQ.js +98 -0
- package/dist/chunk-XNUVB5OL.js +375 -0
- package/dist/chunk-XOSCY2CW.js +242 -0
- package/dist/chunk-XXXEFXY5.js +99 -0
- package/dist/chunk-Y5CSSPV4.js +1 -0
- package/dist/chunk-Y6DU4J47.js +1 -0
- package/dist/chunk-YC6WORFL.js +535 -0
- package/dist/chunk-YDGVJETP.js +60 -0
- package/dist/chunk-YF4NSSMT.js +366 -0
- package/dist/chunk-YG3ZJHGU.js +223 -0
- package/dist/chunk-YIJ55TBC.js +1 -0
- package/dist/chunk-YKZ4RZZF.js +1 -0
- package/dist/chunk-YLLCXTMC.js +37 -0
- package/dist/chunk-YTA74UZR.js +1 -0
- package/dist/chunk-YTFKPRUK.js +845 -0
- package/dist/chunk-Z7H7VSFZ.js +323 -0
- package/dist/chunk-ZK2H4O5P.js +1 -0
- package/dist/chunk-ZVFE5QGU.js +524 -0
- package/dist/coachmark/index.js +4 -0
- package/dist/code-block/index.js +4 -0
- package/dist/color-field/index.js +7 -0
- package/dist/commerce/index.js +20 -0
- package/dist/connectivity/index.js +2 -0
- package/dist/context-menu/index.js +5 -0
- package/dist/copy-button/index.js +3 -0
- package/dist/data-grid/index.js +24 -0
- package/dist/date-range-picker/index.js +13 -0
- package/dist/description-list/index.js +2 -0
- package/dist/dialog/index.js +3 -0
- package/dist/empty-state/index.js +3 -0
- package/dist/error-summary/index.js +3 -0
- package/dist/fab/index.js +2 -0
- package/dist/file-upload/index.js +9 -0
- package/dist/filter-bar/index.js +8 -0
- package/dist/flow-run/index.js +14 -0
- package/dist/form/index.js +3 -0
- package/dist/gallery/index.js +2 -0
- package/dist/header/index.js +5 -0
- package/dist/hold-to-confirm/index.js +4 -0
- package/dist/index.d.ts +22883 -0
- package/dist/index.js +158 -0
- package/dist/infinite-list/index.js +2 -0
- package/dist/inline-edit/index.js +5 -0
- package/dist/input/index.js +5 -0
- package/dist/interactions/index.js +2 -0
- package/dist/invoice/index.js +10 -0
- package/dist/kbd/index.js +1 -0
- package/dist/keyboard/index.js +3 -0
- package/dist/list-row/index.js +7 -0
- package/dist/log-viewer/index.js +2 -0
- package/dist/map-view/index.js +3 -0
- package/dist/markdown/index.js +6 -0
- package/dist/metric/index.js +4 -0
- package/dist/money/index.js +3 -0
- package/dist/nav-drawer/index.js +2 -0
- package/dist/navigation/index.js +2 -0
- package/dist/notification-center/index.js +16 -0
- package/dist/number-roll/index.js +3 -0
- package/dist/one-handed/index.js +5 -0
- package/dist/os-surfaces/index.js +3 -0
- package/dist/otp/index.js +7 -0
- package/dist/page-header/index.js +1 -0
- package/dist/payment-method/index.js +12 -0
- package/dist/payment-status/index.js +16 -0
- package/dist/permission/index.js +2 -0
- package/dist/picker/index.js +7 -0
- package/dist/progress/index.js +5 -0
- package/dist/pull-to-refresh/index.js +4 -0
- package/dist/radio-group/index.js +6 -0
- package/dist/rating/index.js +2 -0
- package/dist/receivables/index.js +20 -0
- package/dist/refund/index.js +16 -0
- package/dist/save-status/index.js +3 -0
- package/dist/scroll-area/index.js +1 -0
- package/dist/search-bar/index.js +5 -0
- package/dist/segmented-control/index.js +5 -0
- package/dist/sheet/index.js +4 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/index.js +5 -0
- package/dist/spinner/index.js +2 -0
- package/dist/split-button/index.js +7 -0
- package/dist/spotlight/index.js +2 -0
- package/dist/stage-timeline/index.js +4 -0
- package/dist/status-dot/index.js +2 -0
- package/dist/stepper/index.js +6 -0
- package/dist/streaming-text/index.js +3 -0
- package/dist/survey/index.js +19 -0
- package/dist/switch/index.js +5 -0
- package/dist/system-state/index.js +4 -0
- package/dist/tab-bar/index.js +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/textarea/index.js +6 -0
- package/dist/thinking/index.js +2 -0
- package/dist/timeline/index.js +4 -0
- package/dist/toast/index.js +2 -0
- package/dist/toolbar/index.js +2 -0
- package/dist/tour/index.js +11 -0
- package/dist/truncation-notice/index.js +2 -0
- package/dist/update-notice/index.js +11 -0
- package/dist/video-player/index.js +2 -0
- package/dist/viewfinder/index.js +5 -0
- package/dist/widget/index.js +4 -0
- package/dist/wizard/index.js +6 -0
- package/package.json +76 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
import { SummaryItemRow, PriceRow, Amount, FxNote } from './chunk-VBOXAEPI.js';
|
|
2
|
+
import { Sheet } from './chunk-ZVFE5QGU.js';
|
|
3
|
+
import { Input } from './chunk-ITTYJZWX.js';
|
|
4
|
+
import { expandedProps } from './chunk-RQ3HASCC.js';
|
|
5
|
+
import { Button } from './chunk-3ARE4TES.js';
|
|
6
|
+
import { Icon } from './chunk-TKVFVF5D.js';
|
|
7
|
+
import * as React3 from 'react';
|
|
8
|
+
import { Text, View, Pressable } from 'react-native';
|
|
9
|
+
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
10
|
+
import { SHEET_DISMISS_FRACTION } from '@btndprojects/loam-pay';
|
|
11
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
12
|
+
import { icons } from '@btndprojects/loam-icons';
|
|
13
|
+
|
|
14
|
+
function CheckoutSheet({
|
|
15
|
+
open,
|
|
16
|
+
title,
|
|
17
|
+
titleLevel,
|
|
18
|
+
description,
|
|
19
|
+
children,
|
|
20
|
+
commit,
|
|
21
|
+
trust,
|
|
22
|
+
dismissible = true,
|
|
23
|
+
safeAreaBottom = 0,
|
|
24
|
+
closeLabel = "Close",
|
|
25
|
+
style,
|
|
26
|
+
onDismiss
|
|
27
|
+
}) {
|
|
28
|
+
const theme = useLoamTheme();
|
|
29
|
+
const { styles } = useStyles(sheet);
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
Sheet,
|
|
32
|
+
{
|
|
33
|
+
open,
|
|
34
|
+
title,
|
|
35
|
+
titleLevel,
|
|
36
|
+
dismissible,
|
|
37
|
+
closeLabel,
|
|
38
|
+
dismissFraction: SHEET_DISMISS_FRACTION,
|
|
39
|
+
onClose: onDismiss,
|
|
40
|
+
footer: (
|
|
41
|
+
/* The commit bar, outside the scroller. `safeAreaBottom` is padding on
|
|
42
|
+
the bar rather than a margin under it — or `Sheet.safeAreaBottom`, a
|
|
43
|
+
slot padding that would push this bar's own fill up off the screen
|
|
44
|
+
edge — so the surface still reaches the home indicator. */
|
|
45
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.commitBar, { paddingBottom: theme.space.s4 + safeAreaBottom }], children: [
|
|
46
|
+
commit,
|
|
47
|
+
trust
|
|
48
|
+
] })
|
|
49
|
+
),
|
|
50
|
+
children: [
|
|
51
|
+
description ? /* @__PURE__ */ jsx(Text, { style: styles.description, children: description }) : null,
|
|
52
|
+
/* @__PURE__ */ jsx(View, { style: [styles.body, style], children })
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
var sheet = createStyleSheet((theme) => ({
|
|
58
|
+
description: {
|
|
59
|
+
fontFamily: theme.font.sans,
|
|
60
|
+
fontSize: theme.type.footnote.fontSize,
|
|
61
|
+
lineHeight: theme.type.footnote.fontSize * theme.lineHeight.normal,
|
|
62
|
+
color: theme.color.text2
|
|
63
|
+
},
|
|
64
|
+
body: { gap: theme.space.s4 },
|
|
65
|
+
// The bar reads as a bar rather than as another block in the form: its own
|
|
66
|
+
// fill, a hairline above it, and the safe-area inset folded into its bottom
|
|
67
|
+
// padding at the use site. The horizontal padding is the bar's own now that it
|
|
68
|
+
// lives in `Sheet`'s footer slot, which is deliberately full-bleed — so the
|
|
69
|
+
// hairline spans the panel while the button keeps the body's gutter.
|
|
70
|
+
commitBar: {
|
|
71
|
+
gap: theme.space.s3,
|
|
72
|
+
paddingTop: theme.space.s4,
|
|
73
|
+
paddingHorizontal: theme.space[22],
|
|
74
|
+
borderTopWidth: theme.borderWidth.base,
|
|
75
|
+
borderTopColor: theme.color.border,
|
|
76
|
+
backgroundColor: theme.color.surface
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
function PayButton({
|
|
80
|
+
label,
|
|
81
|
+
state,
|
|
82
|
+
busyLabel = "Paying\u2026",
|
|
83
|
+
validatingLabel = "Checking\u2026",
|
|
84
|
+
doneLabel = "Paid",
|
|
85
|
+
showLock = true,
|
|
86
|
+
fullWidth = true,
|
|
87
|
+
size = "lg",
|
|
88
|
+
accessibilityLabel,
|
|
89
|
+
style,
|
|
90
|
+
onPress
|
|
91
|
+
}) {
|
|
92
|
+
const theme = useLoamTheme();
|
|
93
|
+
const { styles } = useStyles(sheet2);
|
|
94
|
+
const [idleWidth, setIdleWidth] = React3.useState(null);
|
|
95
|
+
const resting = state === "idle";
|
|
96
|
+
const busy = state === "validating" || state === "busy";
|
|
97
|
+
const onLayout = (event) => {
|
|
98
|
+
if (!resting || fullWidth) return;
|
|
99
|
+
const next = event.nativeEvent.layout.width;
|
|
100
|
+
if (next <= 0) return;
|
|
101
|
+
setIdleWidth((prev) => prev !== null && Math.abs(prev - next) < 1 ? prev : next);
|
|
102
|
+
};
|
|
103
|
+
const currentLabel = resting ? label : state === "validating" ? validatingLabel : state === "busy" ? busyLabel : doneLabel;
|
|
104
|
+
const leadingIcon = resting && showLock ? "lock" : state === "done" ? "check" : void 0;
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
View,
|
|
107
|
+
{
|
|
108
|
+
onLayout,
|
|
109
|
+
style: [
|
|
110
|
+
fullWidth ? styles.wrapFull : styles.wrapAuto,
|
|
111
|
+
// The frozen width, and only while the label is not the resting one.
|
|
112
|
+
!resting && !fullWidth && idleWidth !== null ? { minWidth: idleWidth } : null,
|
|
113
|
+
style
|
|
114
|
+
],
|
|
115
|
+
children: /* @__PURE__ */ jsx(
|
|
116
|
+
Button,
|
|
117
|
+
{
|
|
118
|
+
size,
|
|
119
|
+
fullWidth: true,
|
|
120
|
+
loading: busy,
|
|
121
|
+
leadingIcon,
|
|
122
|
+
accessibilityLabel,
|
|
123
|
+
onPress: () => {
|
|
124
|
+
if (!resting) return;
|
|
125
|
+
onPress();
|
|
126
|
+
},
|
|
127
|
+
children: typeof currentLabel === "string" ? currentLabel : /* @__PURE__ */ jsx(View, { style: styles.labelRow, children: typeof currentLabel === "number" ? /* @__PURE__ */ jsx(Text, { style: [styles.label, { color: theme.color.accentInk }], children: currentLabel }) : currentLabel })
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
var sheet2 = createStyleSheet((theme) => ({
|
|
134
|
+
wrapFull: { alignSelf: "stretch" },
|
|
135
|
+
wrapAuto: { alignSelf: "flex-start" },
|
|
136
|
+
labelRow: {
|
|
137
|
+
flexDirection: "row",
|
|
138
|
+
alignItems: "center",
|
|
139
|
+
justifyContent: "center",
|
|
140
|
+
gap: theme.ctl.gap.lg
|
|
141
|
+
},
|
|
142
|
+
label: {
|
|
143
|
+
fontFamily: theme.font.sans,
|
|
144
|
+
fontWeight: theme.fontWeight.bold,
|
|
145
|
+
fontSize: theme.type.body.fontSize,
|
|
146
|
+
lineHeight: theme.type.body.lineHeight,
|
|
147
|
+
letterSpacing: theme.type.body.letterSpacing
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
function summaryIcon(name) {
|
|
151
|
+
if (name === void 0) return void 0;
|
|
152
|
+
return Object.prototype.hasOwnProperty.call(icons, name) ? name : void 0;
|
|
153
|
+
}
|
|
154
|
+
function OrderSummary({
|
|
155
|
+
variant,
|
|
156
|
+
items,
|
|
157
|
+
rows,
|
|
158
|
+
total,
|
|
159
|
+
currency,
|
|
160
|
+
title = "Order summary",
|
|
161
|
+
totalLabel = "Total",
|
|
162
|
+
coupon,
|
|
163
|
+
fxNote,
|
|
164
|
+
locale,
|
|
165
|
+
style,
|
|
166
|
+
onCouponDraftChange,
|
|
167
|
+
onApplyCoupon,
|
|
168
|
+
onRemoveCoupon
|
|
169
|
+
}) {
|
|
170
|
+
const theme = useLoamTheme();
|
|
171
|
+
const { styles } = useStyles(sheet3);
|
|
172
|
+
const couponLabelId = React3.useId();
|
|
173
|
+
const couponErrorId = React3.useId();
|
|
174
|
+
const heading = `${title} \xB7 ${currency}`;
|
|
175
|
+
const showItems = variant === "itemised" && items !== void 0 && items.length > 0;
|
|
176
|
+
return /* @__PURE__ */ jsxs(
|
|
177
|
+
View,
|
|
178
|
+
{
|
|
179
|
+
role: "region",
|
|
180
|
+
accessibilityLabel: heading,
|
|
181
|
+
style: [styles.section, style],
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: styles.overline, children: heading }),
|
|
184
|
+
showItems ? /* @__PURE__ */ jsx(View, { role: "list", accessibilityRole: "list", style: styles.itemList, children: items.map((item) => /* @__PURE__ */ jsx(View, { role: "listitem", children: /* @__PURE__ */ jsx(
|
|
185
|
+
SummaryItemRow,
|
|
186
|
+
{
|
|
187
|
+
name: item.name,
|
|
188
|
+
detail: item.detail,
|
|
189
|
+
qty: item.qty,
|
|
190
|
+
minor: item.qty * item.unit,
|
|
191
|
+
currency,
|
|
192
|
+
icon: summaryIcon(item.icon),
|
|
193
|
+
locale,
|
|
194
|
+
noSymbol: true
|
|
195
|
+
}
|
|
196
|
+
) }, `${item.name}-${item.unit}`)) }) : null,
|
|
197
|
+
rows.length > 0 ? /* @__PURE__ */ jsx(View, { style: [styles.rowStack, showItems ? styles.rowStackRuled : null], children: rows.map((row, index) => /* @__PURE__ */ jsx(
|
|
198
|
+
PriceRow,
|
|
199
|
+
{
|
|
200
|
+
label: row.label,
|
|
201
|
+
minor: row.minor,
|
|
202
|
+
currency,
|
|
203
|
+
tone: row.tone,
|
|
204
|
+
strong: row.strong,
|
|
205
|
+
rule: row.rule,
|
|
206
|
+
locale,
|
|
207
|
+
noSymbol: true
|
|
208
|
+
},
|
|
209
|
+
`${index}-${String(row.label)}`
|
|
210
|
+
)) }) : null,
|
|
211
|
+
coupon ? /* @__PURE__ */ jsx(View, { style: styles.couponBlock, children: coupon.applied ? /* @__PURE__ */ jsxs(View, { style: styles.appliedRow, children: [
|
|
212
|
+
/* @__PURE__ */ jsx(Icon, { name: "tag", size: theme.icon.sm, color: theme.color.goodOnSoft }),
|
|
213
|
+
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.appliedCode, children: coupon.applied }),
|
|
214
|
+
onRemoveCoupon ? /* @__PURE__ */ jsx(View, { style: styles.pushEnd, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "xs", onPress: onRemoveCoupon, children: "Remove" }) }) : null
|
|
215
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
216
|
+
/* @__PURE__ */ jsx(Text, { nativeID: couponLabelId, style: styles.fieldLabel, children: coupon.label ?? "Discount code" }),
|
|
217
|
+
/* @__PURE__ */ jsxs(View, { style: styles.couponRow, children: [
|
|
218
|
+
/* @__PURE__ */ jsx(View, { style: styles.couponField, children: /* @__PURE__ */ jsx(
|
|
219
|
+
Input,
|
|
220
|
+
{
|
|
221
|
+
"aria-labelledby": couponLabelId,
|
|
222
|
+
"aria-describedby": coupon.error ? couponErrorId : void 0,
|
|
223
|
+
"aria-invalid": coupon.error !== void 0 || void 0,
|
|
224
|
+
value: coupon.draft,
|
|
225
|
+
placeholder: coupon.placeholder,
|
|
226
|
+
autoComplete: "off",
|
|
227
|
+
autoCorrect: false,
|
|
228
|
+
loading: coupon.busy ?? false,
|
|
229
|
+
error: coupon.error !== void 0,
|
|
230
|
+
onChangeText: (next) => onCouponDraftChange?.(next)
|
|
231
|
+
}
|
|
232
|
+
) }),
|
|
233
|
+
/* @__PURE__ */ jsx(
|
|
234
|
+
Button,
|
|
235
|
+
{
|
|
236
|
+
variant: "outline",
|
|
237
|
+
loading: coupon.busy ?? false,
|
|
238
|
+
onPress: () => onApplyCoupon?.(coupon.draft),
|
|
239
|
+
children: "Apply"
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
] }),
|
|
243
|
+
coupon.error ? /* @__PURE__ */ jsx(Text, { nativeID: couponErrorId, style: styles.fieldError, children: coupon.error }) : null
|
|
244
|
+
] }) }) : null,
|
|
245
|
+
/* @__PURE__ */ jsxs(View, { style: styles.totalRow, children: [
|
|
246
|
+
/* @__PURE__ */ jsx(Text, { style: styles.totalLabel, children: totalLabel }),
|
|
247
|
+
/* @__PURE__ */ jsx(Amount, { minor: total, currency, size: "hero", locale })
|
|
248
|
+
] }),
|
|
249
|
+
fxNote ? /* @__PURE__ */ jsx(FxNote, { currency: fxNote.currency, rateLine: fxNote.rateLine }) : null
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
function CollapsedSummaryBar({
|
|
255
|
+
total,
|
|
256
|
+
currency,
|
|
257
|
+
open,
|
|
258
|
+
children,
|
|
259
|
+
label = "Order summary",
|
|
260
|
+
locale,
|
|
261
|
+
style,
|
|
262
|
+
onToggle
|
|
263
|
+
}) {
|
|
264
|
+
const theme = useLoamTheme();
|
|
265
|
+
const { styles } = useStyles(sheet3);
|
|
266
|
+
const panelId = React3.useId();
|
|
267
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.bar, style], children: [
|
|
268
|
+
/* @__PURE__ */ jsxs(
|
|
269
|
+
Pressable,
|
|
270
|
+
{
|
|
271
|
+
accessibilityRole: "button",
|
|
272
|
+
accessibilityState: { expanded: open },
|
|
273
|
+
...expandedProps(open),
|
|
274
|
+
"aria-controls": panelId,
|
|
275
|
+
onPress: () => onToggle(!open),
|
|
276
|
+
style: ({ pressed }) => [styles.trigger, pressed ? styles.triggerPressed : null],
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ jsx(
|
|
279
|
+
Icon,
|
|
280
|
+
{
|
|
281
|
+
name: open ? "chevron-up" : "chevron-down",
|
|
282
|
+
size: theme.icon.sm,
|
|
283
|
+
color: theme.color.text3
|
|
284
|
+
}
|
|
285
|
+
),
|
|
286
|
+
/* @__PURE__ */ jsx(Text, { style: styles.triggerLabel, children: label }),
|
|
287
|
+
/* @__PURE__ */ jsx(View, { style: styles.pushEnd, children: /* @__PURE__ */ jsx(Amount, { minor: total, currency, size: "md", weight: "bold", locale }) })
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
),
|
|
291
|
+
open ? /* @__PURE__ */ jsx(View, { nativeID: panelId, style: styles.panel, children }) : null
|
|
292
|
+
] });
|
|
293
|
+
}
|
|
294
|
+
var sheet3 = createStyleSheet((theme) => ({
|
|
295
|
+
section: { gap: theme.space.s3 },
|
|
296
|
+
overline: {
|
|
297
|
+
fontFamily: theme.font.sans,
|
|
298
|
+
fontWeight: theme.fontWeight.bold,
|
|
299
|
+
fontSize: theme.type.caption2.fontSize,
|
|
300
|
+
lineHeight: theme.type.caption2.lineHeight,
|
|
301
|
+
letterSpacing: theme.tracking.caps,
|
|
302
|
+
textTransform: "uppercase",
|
|
303
|
+
color: theme.color.text3
|
|
304
|
+
},
|
|
305
|
+
itemList: { gap: theme.space.s3 },
|
|
306
|
+
rowStack: { gap: theme.space.s2 },
|
|
307
|
+
rowStackRuled: {
|
|
308
|
+
paddingTop: theme.space.s3,
|
|
309
|
+
borderTopWidth: theme.borderWidth.base,
|
|
310
|
+
borderTopColor: theme.color.border
|
|
311
|
+
},
|
|
312
|
+
couponBlock: { gap: theme.space.s1 },
|
|
313
|
+
appliedRow: {
|
|
314
|
+
flexDirection: "row",
|
|
315
|
+
alignItems: "center",
|
|
316
|
+
gap: theme.space.s2,
|
|
317
|
+
padding: theme.space.s2,
|
|
318
|
+
borderRadius: theme.radius.md,
|
|
319
|
+
// The soft tint always carries its tone edge: `goodSoft` collapses to the
|
|
320
|
+
// plain surface under high contrast, and the edge is the only thing left
|
|
321
|
+
// drawing the block.
|
|
322
|
+
borderWidth: theme.borderWidth.base,
|
|
323
|
+
borderColor: theme.edge.good,
|
|
324
|
+
backgroundColor: theme.color.goodSoft
|
|
325
|
+
},
|
|
326
|
+
appliedCode: {
|
|
327
|
+
flexShrink: 1,
|
|
328
|
+
fontFamily: theme.font.sans,
|
|
329
|
+
fontWeight: theme.fontWeight.semibold,
|
|
330
|
+
fontSize: theme.type.footnote.fontSize,
|
|
331
|
+
lineHeight: theme.type.footnote.lineHeight,
|
|
332
|
+
color: theme.color.goodOnSoft
|
|
333
|
+
},
|
|
334
|
+
pushEnd: { marginStart: "auto" },
|
|
335
|
+
fieldLabel: {
|
|
336
|
+
fontFamily: theme.font.sans,
|
|
337
|
+
fontWeight: theme.fontWeight.semibold,
|
|
338
|
+
fontSize: theme.type.caption1.fontSize,
|
|
339
|
+
lineHeight: theme.type.caption1.lineHeight,
|
|
340
|
+
color: theme.color.text2
|
|
341
|
+
},
|
|
342
|
+
couponRow: { flexDirection: "row", alignItems: "flex-start", gap: theme.space.s2 },
|
|
343
|
+
couponField: { flex: 1 },
|
|
344
|
+
fieldError: {
|
|
345
|
+
fontFamily: theme.font.sans,
|
|
346
|
+
fontWeight: theme.fontWeight.bold,
|
|
347
|
+
fontSize: theme.type.caption1.fontSize,
|
|
348
|
+
lineHeight: theme.type.caption1.lineHeight,
|
|
349
|
+
color: theme.color.danger
|
|
350
|
+
},
|
|
351
|
+
totalRow: {
|
|
352
|
+
flexDirection: "row",
|
|
353
|
+
alignItems: "baseline",
|
|
354
|
+
justifyContent: "space-between",
|
|
355
|
+
gap: theme.space.s4,
|
|
356
|
+
paddingTop: theme.space.s3,
|
|
357
|
+
borderTopWidth: theme.borderWidth.base,
|
|
358
|
+
borderTopColor: theme.color.border
|
|
359
|
+
},
|
|
360
|
+
totalLabel: {
|
|
361
|
+
fontFamily: theme.font.sans,
|
|
362
|
+
fontWeight: theme.fontWeight.bold,
|
|
363
|
+
fontSize: theme.type.footnote.fontSize,
|
|
364
|
+
lineHeight: theme.type.footnote.lineHeight,
|
|
365
|
+
color: theme.color.text
|
|
366
|
+
},
|
|
367
|
+
bar: {
|
|
368
|
+
borderRadius: theme.radius.md,
|
|
369
|
+
borderWidth: theme.borderWidth.base,
|
|
370
|
+
borderColor: theme.color.border,
|
|
371
|
+
backgroundColor: theme.color.surface
|
|
372
|
+
},
|
|
373
|
+
trigger: {
|
|
374
|
+
flexDirection: "row",
|
|
375
|
+
alignItems: "center",
|
|
376
|
+
gap: theme.space.s3,
|
|
377
|
+
minHeight: theme.ctl.lg,
|
|
378
|
+
padding: theme.space.s3
|
|
379
|
+
},
|
|
380
|
+
triggerPressed: { backgroundColor: theme.state.pressed },
|
|
381
|
+
triggerLabel: {
|
|
382
|
+
fontFamily: theme.font.sans,
|
|
383
|
+
fontWeight: theme.fontWeight.semibold,
|
|
384
|
+
fontSize: theme.type.footnote.fontSize,
|
|
385
|
+
lineHeight: theme.type.footnote.lineHeight,
|
|
386
|
+
color: theme.color.text
|
|
387
|
+
},
|
|
388
|
+
panel: {
|
|
389
|
+
padding: theme.space.s3,
|
|
390
|
+
borderTopWidth: theme.borderWidth.base,
|
|
391
|
+
borderTopColor: theme.color.border
|
|
392
|
+
}
|
|
393
|
+
}));
|
|
394
|
+
|
|
395
|
+
export { CheckoutSheet, CollapsedSummaryBar, OrderSummary, PayButton, summaryIcon };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Icon } from './chunk-TKVFVF5D.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { Pressable, Text, View } from 'react-native';
|
|
4
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function statusMeta(status, queued) {
|
|
8
|
+
const changes = `${queued} change${queued === 1 ? "" : "s"}`;
|
|
9
|
+
switch (status) {
|
|
10
|
+
case "offline":
|
|
11
|
+
return { icon: "wifi-off", label: `Offline \xB7 ${changes} queued` };
|
|
12
|
+
case "syncing":
|
|
13
|
+
return { icon: "refresh", label: "Back online \xB7 syncing" };
|
|
14
|
+
default:
|
|
15
|
+
return { icon: "check-circle", label: "All changes synced" };
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function ConnectivityBanner({
|
|
19
|
+
status,
|
|
20
|
+
queuedCount = 0,
|
|
21
|
+
onRetry,
|
|
22
|
+
message
|
|
23
|
+
}) {
|
|
24
|
+
const { styles } = useStyles(sheet, { status });
|
|
25
|
+
const theme = useLoamTheme();
|
|
26
|
+
const meta = statusMeta(status, queuedCount);
|
|
27
|
+
const fg = status === "offline" ? (
|
|
28
|
+
// The offline banner rests on `surface3`, where neutral `text2` measures
|
|
29
|
+
// only 4.4:1 (WCAG fail); primary `text` clears 4.5:1.
|
|
30
|
+
theme.color.text
|
|
31
|
+
) : status === "syncing" ? theme.color.warnOnSoft : theme.color.goodOnSoft;
|
|
32
|
+
return /* @__PURE__ */ jsxs(
|
|
33
|
+
Pressable,
|
|
34
|
+
{
|
|
35
|
+
accessibilityRole: onRetry ? "button" : "text",
|
|
36
|
+
accessibilityLabel: message ?? meta.label,
|
|
37
|
+
accessibilityState: onRetry ? {} : { disabled: true },
|
|
38
|
+
onPress: onRetry,
|
|
39
|
+
style: ({ pressed }) => [styles.banner, pressed && onRetry ? styles.pressed : null],
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Icon, { name: meta.icon, size: 15, color: fg }),
|
|
42
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.label, { color: fg }], numberOfLines: 1, ellipsizeMode: "tail", children: message ?? meta.label }),
|
|
43
|
+
status === "offline" && onRetry ? /* @__PURE__ */ jsx(Text, { style: styles.retry, children: "RETRY" }) : null
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
var SYNC_META = {
|
|
49
|
+
queued: { icon: "refresh", label: "Queued \u2014 waiting for a connection" },
|
|
50
|
+
syncing: { icon: "refresh", label: "Syncing" },
|
|
51
|
+
synced: { icon: "check", label: "Synced" },
|
|
52
|
+
failed: { icon: "alert-circle", label: "Failed to sync" }
|
|
53
|
+
};
|
|
54
|
+
function SyncBadge({
|
|
55
|
+
state,
|
|
56
|
+
accessibilityLabel,
|
|
57
|
+
size = 26
|
|
58
|
+
}) {
|
|
59
|
+
const { styles } = useStyles(sheet, { state });
|
|
60
|
+
const theme = useLoamTheme();
|
|
61
|
+
const meta = SYNC_META[state];
|
|
62
|
+
const fg = state === "synced" ? theme.color.goodOnSoft : state === "failed" ? theme.color.dangerOnSoft : theme.color.warnOnSoft;
|
|
63
|
+
return /* @__PURE__ */ jsx(
|
|
64
|
+
View,
|
|
65
|
+
{
|
|
66
|
+
accessibilityRole: "image",
|
|
67
|
+
accessibilityLabel: accessibilityLabel ?? meta.label,
|
|
68
|
+
style: [styles.badge, { width: size, height: size }],
|
|
69
|
+
children: /* @__PURE__ */ jsx(Icon, { name: meta.icon, size: Math.round(size * 0.54), color: fg })
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
var sheet = createStyleSheet((theme) => ({
|
|
74
|
+
banner: {
|
|
75
|
+
flexDirection: "row",
|
|
76
|
+
alignItems: "center",
|
|
77
|
+
gap: theme.space[9],
|
|
78
|
+
paddingVertical: theme.space[10],
|
|
79
|
+
paddingHorizontal: theme.space.s4,
|
|
80
|
+
borderBottomWidth: theme.borderWidth.base,
|
|
81
|
+
variants: {
|
|
82
|
+
status: {
|
|
83
|
+
offline: {
|
|
84
|
+
backgroundColor: theme.color.surface3,
|
|
85
|
+
borderBottomColor: theme.color.border
|
|
86
|
+
},
|
|
87
|
+
syncing: {
|
|
88
|
+
backgroundColor: theme.color.warnSoft,
|
|
89
|
+
borderBottomColor: theme.edge.warn
|
|
90
|
+
},
|
|
91
|
+
online: {
|
|
92
|
+
backgroundColor: theme.color.goodSoft,
|
|
93
|
+
borderBottomColor: theme.edge.good
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
state: {}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
// `minWidth: 0` lets the copy truncate rather than push `RETRY` off the edge.
|
|
100
|
+
label: {
|
|
101
|
+
flex: 1,
|
|
102
|
+
minWidth: 0,
|
|
103
|
+
fontFamily: theme.font.sans,
|
|
104
|
+
fontWeight: theme.fontWeight.semibold,
|
|
105
|
+
fontSize: theme.type.caption1.fontSize,
|
|
106
|
+
variants: { status: {}, state: {} }
|
|
107
|
+
},
|
|
108
|
+
retry: {
|
|
109
|
+
fontFamily: theme.font.mono,
|
|
110
|
+
fontSize: theme.fontSize[10],
|
|
111
|
+
// Shown only on the offline banner's `surface3` fill, where `text3` is
|
|
112
|
+
// 4.16:1 (WCAG fail); primary `text` clears 4.5:1.
|
|
113
|
+
color: theme.color.text,
|
|
114
|
+
variants: { status: {}, state: {} }
|
|
115
|
+
},
|
|
116
|
+
badge: {
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
borderRadius: theme.radius.full,
|
|
120
|
+
borderWidth: theme.borderWidth.base,
|
|
121
|
+
variants: {
|
|
122
|
+
state: {
|
|
123
|
+
queued: { backgroundColor: theme.color.warnSoft, borderColor: theme.edge.warn },
|
|
124
|
+
syncing: { backgroundColor: theme.color.warnSoft, borderColor: theme.edge.warn },
|
|
125
|
+
synced: { backgroundColor: theme.color.goodSoft, borderColor: theme.edge.good },
|
|
126
|
+
failed: { backgroundColor: theme.color.dangerSoft, borderColor: theme.edge.danger }
|
|
127
|
+
},
|
|
128
|
+
status: {}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
pressed: { opacity: theme.state.pressedOpacity }
|
|
132
|
+
}));
|
|
133
|
+
|
|
134
|
+
export { ConnectivityBanner, SyncBadge };
|