@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.
- package/LICENSE +21 -0
- 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-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-66SG2H23.js +129 -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-DSJBXLUG.js +845 -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-FIF2M24N.js +1521 -0
- package/dist/chunk-FOKG57CR.js +993 -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-HPPW424V.js +334 -0
- package/dist/chunk-HQOQIBJI.js +1 -0
- package/dist/chunk-HU2EQNRZ.js +44 -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-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-RGQWWKLA.js +634 -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-WVKKJA6U.js +870 -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-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
- package/README.md +0 -3
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
import { ContinuousNotice, ShutterButton, TorchToggle, GridToggle, GuideOverlay, ExpertPanel, LensPicker, SequenceStrip, ShutterTray, FlipButton, TrackingOverlay, GridOverlay, FocusTapZone, FocusIndicator } from './chunk-BV3B2HYZ.js';
|
|
2
|
+
import { PlaceholderFeed } from './chunk-LAECSR4H.js';
|
|
3
|
+
import { decorativeProps, camInk, SurfaceLiveRegion, ViewfinderTopBar, GlassIconButton, GuidanceChip, GateHint, useSurfaceAnnounce } from './chunk-RW6ZL2FQ.js';
|
|
4
|
+
import { Icon } from './chunk-TKVFVF5D.js';
|
|
5
|
+
import * as React2 from 'react';
|
|
6
|
+
import { View, Animated, Easing, Text, Pressable } from 'react-native';
|
|
7
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
8
|
+
import { queueLabel, profile, caps, isFrozen, primaryCheck, TOASTS, gateHint, angleAt, viewfinderSubtitle, PRIVACY_STATEMENT, confidenceTone, confidenceLabel, CAPTURED_PILL, DONE_LABEL } from '@btndprojects/loam-analyzer';
|
|
9
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
function numericRatio(ratio) {
|
|
12
|
+
if (!ratio) return void 0;
|
|
13
|
+
const [w, h] = ratio.split(":");
|
|
14
|
+
const width = Number(w);
|
|
15
|
+
const height = Number(h);
|
|
16
|
+
if (!Number.isFinite(width) || !Number.isFinite(height) || height === 0) return void 0;
|
|
17
|
+
return width / height;
|
|
18
|
+
}
|
|
19
|
+
function CameraSurface({
|
|
20
|
+
ratio,
|
|
21
|
+
platform = "ios",
|
|
22
|
+
insets = {},
|
|
23
|
+
feed,
|
|
24
|
+
accessibilityLabel,
|
|
25
|
+
children
|
|
26
|
+
}) {
|
|
27
|
+
const { styles } = useStyles(stageSheet);
|
|
28
|
+
const aspect = numericRatio(ratio);
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
View,
|
|
31
|
+
{
|
|
32
|
+
role: "group",
|
|
33
|
+
accessibilityLabel,
|
|
34
|
+
testID: `loam-camera-surface-${platform}`,
|
|
35
|
+
style: [styles.stage, aspect === void 0 ? styles.stageFill : { aspectRatio: aspect }],
|
|
36
|
+
children: [
|
|
37
|
+
feed,
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
View,
|
|
40
|
+
{
|
|
41
|
+
testID: "loam-camera-chrome",
|
|
42
|
+
style: [
|
|
43
|
+
styles.chrome,
|
|
44
|
+
{
|
|
45
|
+
paddingTop: insets.top ?? 0,
|
|
46
|
+
paddingBottom: insets.bottom ?? 0,
|
|
47
|
+
paddingStart: insets.left ?? 0,
|
|
48
|
+
paddingEnd: insets.right ?? 0
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
function PreviewSlot({ preview, label, topInset }) {
|
|
59
|
+
const { styles } = useStyles(stageSheet);
|
|
60
|
+
return /* @__PURE__ */ jsx(View, { style: styles.previewSlot, children: preview ?? /* @__PURE__ */ jsx(PlaceholderFeed, { label, topInset }) });
|
|
61
|
+
}
|
|
62
|
+
function CaptureFlash({ token = null }) {
|
|
63
|
+
const theme = useLoamTheme();
|
|
64
|
+
const { styles } = useStyles(stageSheet);
|
|
65
|
+
const [flashes, setFlashes] = React2.useState(0);
|
|
66
|
+
const first = React2.useRef(true);
|
|
67
|
+
const opacity = React2.useRef(new Animated.Value(0)).current;
|
|
68
|
+
React2.useEffect(() => {
|
|
69
|
+
if (token === null || token === void 0) return;
|
|
70
|
+
if (first.current) {
|
|
71
|
+
first.current = false;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
setFlashes((n) => n + 1);
|
|
75
|
+
opacity.setValue(1);
|
|
76
|
+
Animated.timing(opacity, {
|
|
77
|
+
toValue: 0,
|
|
78
|
+
duration: theme.duration[100],
|
|
79
|
+
easing: Easing.bezier(...theme.easing.out),
|
|
80
|
+
useNativeDriver: true
|
|
81
|
+
}).start();
|
|
82
|
+
}, [token, opacity, theme.duration, theme.easing.out]);
|
|
83
|
+
if (flashes === 0) return null;
|
|
84
|
+
return /* @__PURE__ */ jsx(
|
|
85
|
+
Animated.View,
|
|
86
|
+
{
|
|
87
|
+
accessible: false,
|
|
88
|
+
testID: "loam-capture-flash",
|
|
89
|
+
style: [styles.flash, { opacity }],
|
|
90
|
+
...decorativeProps()
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
function QueueBadge({ count, onPress }) {
|
|
95
|
+
const theme = useLoamTheme();
|
|
96
|
+
const { styles } = useStyles(stageSheet);
|
|
97
|
+
if (count <= 0) return null;
|
|
98
|
+
const text = queueLabel(count);
|
|
99
|
+
const ink = camInk(theme);
|
|
100
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx(Icon, { name: "scan", size: theme.icon.sm, color: ink }),
|
|
102
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.badgeText, { color: ink }], children: text })
|
|
103
|
+
] });
|
|
104
|
+
if (onPress) {
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
Pressable,
|
|
107
|
+
{
|
|
108
|
+
accessibilityRole: "button",
|
|
109
|
+
accessibilityLabel: text,
|
|
110
|
+
style: styles.badge,
|
|
111
|
+
onPress,
|
|
112
|
+
children: body
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return /* @__PURE__ */ jsx(View, { accessible: true, accessibilityLabel: text, style: styles.badge, children: body });
|
|
117
|
+
}
|
|
118
|
+
var stageSheet = createStyleSheet((theme) => ({
|
|
119
|
+
stage: {
|
|
120
|
+
position: "relative",
|
|
121
|
+
width: "100%",
|
|
122
|
+
flexDirection: "column",
|
|
123
|
+
overflow: "hidden",
|
|
124
|
+
backgroundColor: theme.media.onInk
|
|
125
|
+
},
|
|
126
|
+
// A phone stage fills its screen; the web half needs a 560px floor because it
|
|
127
|
+
// can be dropped into a 200px box on a page, and a phone cannot.
|
|
128
|
+
stageFill: {
|
|
129
|
+
flexGrow: 1,
|
|
130
|
+
flexShrink: 1,
|
|
131
|
+
flexBasis: theme.space[0]
|
|
132
|
+
},
|
|
133
|
+
chrome: {
|
|
134
|
+
// `box-none` so the chrome layer never swallows a tap meant for the feed's
|
|
135
|
+
// tap-to-focus zone underneath it.
|
|
136
|
+
pointerEvents: "box-none",
|
|
137
|
+
position: "relative",
|
|
138
|
+
zIndex: theme.z.raised,
|
|
139
|
+
flexGrow: 1,
|
|
140
|
+
flexShrink: 1,
|
|
141
|
+
flexBasis: theme.space[0],
|
|
142
|
+
flexDirection: "column"
|
|
143
|
+
},
|
|
144
|
+
previewSlot: {
|
|
145
|
+
position: "absolute",
|
|
146
|
+
top: theme.space[0],
|
|
147
|
+
bottom: theme.space[0],
|
|
148
|
+
left: theme.space[0],
|
|
149
|
+
right: theme.space[0],
|
|
150
|
+
overflow: "hidden"
|
|
151
|
+
},
|
|
152
|
+
flash: {
|
|
153
|
+
pointerEvents: "none",
|
|
154
|
+
position: "absolute",
|
|
155
|
+
top: theme.space[0],
|
|
156
|
+
bottom: theme.space[0],
|
|
157
|
+
left: theme.space[0],
|
|
158
|
+
right: theme.space[0],
|
|
159
|
+
zIndex: theme.z.overlay,
|
|
160
|
+
backgroundColor: theme.media.ink
|
|
161
|
+
},
|
|
162
|
+
badge: {
|
|
163
|
+
flexDirection: "row",
|
|
164
|
+
alignItems: "center",
|
|
165
|
+
gap: theme.space[8],
|
|
166
|
+
minHeight: theme.ctl.lg,
|
|
167
|
+
paddingHorizontal: theme.space[12],
|
|
168
|
+
paddingVertical: theme.space[8],
|
|
169
|
+
borderRadius: theme.radius.full,
|
|
170
|
+
backgroundColor: theme.black.a12,
|
|
171
|
+
borderWidth: theme.borderWidth.base,
|
|
172
|
+
borderColor: theme.white.a5
|
|
173
|
+
},
|
|
174
|
+
badgeText: {
|
|
175
|
+
fontFamily: theme.font.sans,
|
|
176
|
+
fontSize: theme.fontSize[13]
|
|
177
|
+
}
|
|
178
|
+
}));
|
|
179
|
+
var SCRIM_STOP = {
|
|
180
|
+
captured: "a6",
|
|
181
|
+
done: "a7",
|
|
182
|
+
result: "a8",
|
|
183
|
+
analysing: "a10",
|
|
184
|
+
failure: "a11"
|
|
185
|
+
};
|
|
186
|
+
function feedLabel(p, phase, platform, zoom) {
|
|
187
|
+
const facing = platform === "web" ? "webcam \xB7 front" : "rear camera";
|
|
188
|
+
if (phase === "live") return `${facing} \xB7 ${p.ratio} \xB7 ${zoom}x \xB7 placeholder feed`;
|
|
189
|
+
if (phase === "captured") return `frozen frame \xB7 ${p.ratio} \xB7 placeholder`;
|
|
190
|
+
if (phase === "analysing") return "frozen frame \xB7 analysing";
|
|
191
|
+
if (phase === "result" || phase === "failure") return "frozen frame";
|
|
192
|
+
if (phase === "done") return "captured frame";
|
|
193
|
+
return `${facing} \xB7 ${p.ratio} \xB7 placeholder feed`;
|
|
194
|
+
}
|
|
195
|
+
function phaseMessage(p, phase) {
|
|
196
|
+
if (phase === "live") return `${p.label}. ${p.subject}.`;
|
|
197
|
+
if (phase === "captured") return CAPTURED_PILL;
|
|
198
|
+
if (phase === "analysing") return "Analysing";
|
|
199
|
+
if (phase === "result") return "Result ready";
|
|
200
|
+
if (phase === "failure") return "Analysis failed";
|
|
201
|
+
if (phase === "done") return DONE_LABEL;
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
function detectedChip(detected, confidence) {
|
|
205
|
+
if (confidence === void 0) {
|
|
206
|
+
return { text: detected, tone: "good", icon: "check-circle" };
|
|
207
|
+
}
|
|
208
|
+
const tone = confidenceTone(confidence);
|
|
209
|
+
const icon = tone === "good" ? "check-circle" : tone === "warn" ? "alert-triangle" : "alert-circle";
|
|
210
|
+
return { text: `${detected} \xB7 ${confidenceLabel(confidence)}`, tone, icon };
|
|
211
|
+
}
|
|
212
|
+
function PhaseAnnouncer({
|
|
213
|
+
profile: p,
|
|
214
|
+
phase,
|
|
215
|
+
detected
|
|
216
|
+
}) {
|
|
217
|
+
const announce = useSurfaceAnnounce();
|
|
218
|
+
const sink = React2.useRef(announce);
|
|
219
|
+
sink.current = announce;
|
|
220
|
+
React2.useEffect(() => {
|
|
221
|
+
const message = phaseMessage(p, phase);
|
|
222
|
+
if (message) sink.current?.(message);
|
|
223
|
+
}, [p, phase]);
|
|
224
|
+
React2.useEffect(() => {
|
|
225
|
+
if (detected) sink.current?.(detected);
|
|
226
|
+
}, [detected]);
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
function Analyzer({
|
|
230
|
+
profile: profileProp,
|
|
231
|
+
level = "guided",
|
|
232
|
+
platform = "ios",
|
|
233
|
+
phase,
|
|
234
|
+
ratio,
|
|
235
|
+
insets,
|
|
236
|
+
preview,
|
|
237
|
+
objects = [],
|
|
238
|
+
gate = { pass: true, failing: [] },
|
|
239
|
+
countdown = null,
|
|
240
|
+
detected = null,
|
|
241
|
+
detectedConfidence,
|
|
242
|
+
shots = 0,
|
|
243
|
+
angleIndex = 0,
|
|
244
|
+
queueCount = 0,
|
|
245
|
+
torch = false,
|
|
246
|
+
torchAvailable = true,
|
|
247
|
+
grid = false,
|
|
248
|
+
zoom = 1,
|
|
249
|
+
zoomStops = [2, 1, 0.5],
|
|
250
|
+
expertOpen = false,
|
|
251
|
+
expertValues = {},
|
|
252
|
+
focusPoint = null,
|
|
253
|
+
flashToken = null,
|
|
254
|
+
title,
|
|
255
|
+
privacyStatement = PRIVACY_STATEMENT,
|
|
256
|
+
children,
|
|
257
|
+
onCapture,
|
|
258
|
+
onUpload,
|
|
259
|
+
onClose,
|
|
260
|
+
onTorchChange,
|
|
261
|
+
onGridChange,
|
|
262
|
+
onZoomChange,
|
|
263
|
+
onFlip,
|
|
264
|
+
onFocusPoint,
|
|
265
|
+
onExpertOpenChange,
|
|
266
|
+
onExpertChange,
|
|
267
|
+
onSequenceRedo,
|
|
268
|
+
onSequenceRead,
|
|
269
|
+
onQueuePress,
|
|
270
|
+
onGatePass,
|
|
271
|
+
onNotify
|
|
272
|
+
}) {
|
|
273
|
+
const theme = useLoamTheme();
|
|
274
|
+
const { styles } = useStyles(analyzerSheet);
|
|
275
|
+
const p = profile(profileProp);
|
|
276
|
+
const caps$1 = caps(level);
|
|
277
|
+
const chip = detected ? detectedChip(detected, detectedConfidence) : null;
|
|
278
|
+
const live = phase === "live";
|
|
279
|
+
const frozen = isFrozen(phase);
|
|
280
|
+
const continuous = p.shutter === "continuous";
|
|
281
|
+
const tracking = objects.length > 0;
|
|
282
|
+
const trackLocked = objects.some((o) => o.locked === true);
|
|
283
|
+
const gateOpen = caps$1.gate ? gate.pass : true;
|
|
284
|
+
const blockedToast = React2.useMemo(() => {
|
|
285
|
+
const check = primaryCheck(p, gate);
|
|
286
|
+
return TOASTS.gateBlocked(check ? check.fix : gateHint(p, gate));
|
|
287
|
+
}, [p, gate]);
|
|
288
|
+
const notify = React2.useRef(onNotify);
|
|
289
|
+
notify.current = onNotify;
|
|
290
|
+
const gatePass = React2.useRef(onGatePass);
|
|
291
|
+
gatePass.current = onGatePass;
|
|
292
|
+
const wasOpen = React2.useRef(gateOpen);
|
|
293
|
+
React2.useEffect(() => {
|
|
294
|
+
if (live && gateOpen && !wasOpen.current) gatePass.current?.();
|
|
295
|
+
wasOpen.current = gateOpen;
|
|
296
|
+
}, [gateOpen, live]);
|
|
297
|
+
const blocked = React2.useCallback(
|
|
298
|
+
(toast) => notify.current?.({ title: toast, tone: "warn" }),
|
|
299
|
+
[]
|
|
300
|
+
);
|
|
301
|
+
const toggleGrid = React2.useCallback(
|
|
302
|
+
(next) => {
|
|
303
|
+
if (!caps$1.grid) return;
|
|
304
|
+
onGridChange?.(next);
|
|
305
|
+
notify.current?.({ title: TOASTS.grid(next) });
|
|
306
|
+
},
|
|
307
|
+
[caps$1.grid, onGridChange]
|
|
308
|
+
);
|
|
309
|
+
const close = React2.useCallback(() => {
|
|
310
|
+
onClose?.();
|
|
311
|
+
notify.current?.({ title: TOASTS.close });
|
|
312
|
+
}, [onClose]);
|
|
313
|
+
const angle = angleAt(p, angleIndex);
|
|
314
|
+
const subtitle = viewfinderSubtitle(p, { angleIndex, shots });
|
|
315
|
+
const sequence = caps$1.sequence && (p.frames === "multi" || typeof p.frames === "number" && p.frames > 1);
|
|
316
|
+
const scrimStop = SCRIM_STOP[phase];
|
|
317
|
+
const trayPrimary = continuous ? /* @__PURE__ */ jsx(ContinuousNotice, {}) : /* @__PURE__ */ jsx(
|
|
318
|
+
ShutterButton,
|
|
319
|
+
{
|
|
320
|
+
platform,
|
|
321
|
+
mode: p.shutter,
|
|
322
|
+
enabled: gateOpen,
|
|
323
|
+
countdown: caps$1.auto ? countdown : null,
|
|
324
|
+
blockedToast,
|
|
325
|
+
onPress: onCapture,
|
|
326
|
+
onBlocked: blocked
|
|
327
|
+
}
|
|
328
|
+
);
|
|
329
|
+
return /* @__PURE__ */ jsxs(SurfaceLiveRegion, { children: [
|
|
330
|
+
/* @__PURE__ */ jsx(PhaseAnnouncer, { profile: p, phase, detected: chip ? chip.text : null }),
|
|
331
|
+
/* @__PURE__ */ jsxs(
|
|
332
|
+
CameraSurface,
|
|
333
|
+
{
|
|
334
|
+
ratio,
|
|
335
|
+
platform,
|
|
336
|
+
insets,
|
|
337
|
+
accessibilityLabel: `${title ?? p.label} viewfinder`,
|
|
338
|
+
feed: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
339
|
+
/* @__PURE__ */ jsx(
|
|
340
|
+
PreviewSlot,
|
|
341
|
+
{
|
|
342
|
+
preview,
|
|
343
|
+
label: feedLabel(p, phase, platform, zoom),
|
|
344
|
+
topInset: insets?.top ?? 0
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
scrimStop ? /* @__PURE__ */ jsx(
|
|
348
|
+
View,
|
|
349
|
+
{
|
|
350
|
+
accessible: false,
|
|
351
|
+
testID: `loam-cam-scrim-${phase}`,
|
|
352
|
+
style: [styles.scrim, { backgroundColor: theme.black[scrimStop] }],
|
|
353
|
+
...decorativeProps()
|
|
354
|
+
}
|
|
355
|
+
) : null,
|
|
356
|
+
tracking ? /* @__PURE__ */ jsx(
|
|
357
|
+
TrackingOverlay,
|
|
358
|
+
{
|
|
359
|
+
objects,
|
|
360
|
+
frozen,
|
|
361
|
+
dimmed: phase === "analysing",
|
|
362
|
+
safeAreaBottom: insets?.bottom ?? 0
|
|
363
|
+
}
|
|
364
|
+
) : null,
|
|
365
|
+
live ? /* @__PURE__ */ jsx(GridOverlay, { visible: caps$1.grid && grid }) : null,
|
|
366
|
+
live ? /* @__PURE__ */ jsx(FocusTapZone, { onFocusPoint }) : null,
|
|
367
|
+
live ? /* @__PURE__ */ jsx(
|
|
368
|
+
FocusIndicator,
|
|
369
|
+
{
|
|
370
|
+
point: focusPoint,
|
|
371
|
+
pulseKey: focusPoint ? `${focusPoint.x},${focusPoint.y}` : 0
|
|
372
|
+
}
|
|
373
|
+
) : null,
|
|
374
|
+
/* @__PURE__ */ jsx(CaptureFlash, { token: flashToken })
|
|
375
|
+
] }),
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ jsx(View, { style: styles.topLayer, children: /* @__PURE__ */ jsxs(
|
|
378
|
+
ViewfinderTopBar,
|
|
379
|
+
{
|
|
380
|
+
title: title ?? p.label,
|
|
381
|
+
subtitle,
|
|
382
|
+
align: platform === "ios" ? "center" : "start",
|
|
383
|
+
onClose: onClose ? close : void 0,
|
|
384
|
+
children: [
|
|
385
|
+
caps$1.torch ? /* @__PURE__ */ jsx(TorchToggle, { on: torch, available: torchAvailable, onChange: onTorchChange }) : null,
|
|
386
|
+
caps$1.grid ? /* @__PURE__ */ jsx(GridToggle, { on: grid, onChange: toggleGrid }) : null,
|
|
387
|
+
caps$1.expert && onExpertOpenChange ? /* @__PURE__ */ jsx(
|
|
388
|
+
GlassIconButton,
|
|
389
|
+
{
|
|
390
|
+
icon: "sliders",
|
|
391
|
+
label: "Expert controls",
|
|
392
|
+
on: expertOpen,
|
|
393
|
+
onPress: () => onExpertOpenChange(!expertOpen)
|
|
394
|
+
}
|
|
395
|
+
) : null
|
|
396
|
+
]
|
|
397
|
+
}
|
|
398
|
+
) }),
|
|
399
|
+
/* @__PURE__ */ jsxs(View, { style: styles.band, children: [
|
|
400
|
+
live && caps$1.guide ? /* @__PURE__ */ jsx(
|
|
401
|
+
GuideOverlay,
|
|
402
|
+
{
|
|
403
|
+
kind: p.guide,
|
|
404
|
+
pass: gateOpen,
|
|
405
|
+
dimmed: trackLocked,
|
|
406
|
+
hint: angle?.hint,
|
|
407
|
+
scanning: continuous
|
|
408
|
+
}
|
|
409
|
+
) : null,
|
|
410
|
+
queueCount > 0 ? /* @__PURE__ */ jsx(View, { style: styles.queueWrap, children: /* @__PURE__ */ jsx(QueueBadge, { count: queueCount, onPress: onQueuePress }) }) : null,
|
|
411
|
+
live ? /* @__PURE__ */ jsxs(View, { style: styles.floatStack, children: [
|
|
412
|
+
caps$1.expert && expertOpen ? /* @__PURE__ */ jsx(View, { style: styles.stretch, children: /* @__PURE__ */ jsx(
|
|
413
|
+
ExpertPanel,
|
|
414
|
+
{
|
|
415
|
+
platform,
|
|
416
|
+
values: expertValues,
|
|
417
|
+
onChange: onExpertChange,
|
|
418
|
+
onClose: onExpertOpenChange ? () => onExpertOpenChange(false) : void 0
|
|
419
|
+
}
|
|
420
|
+
) }) : null,
|
|
421
|
+
caps$1.zoom ? /* @__PURE__ */ jsx(LensPicker, { stops: zoomStops, value: zoom, onChange: onZoomChange }) : null,
|
|
422
|
+
chip ? /* @__PURE__ */ jsx(GuidanceChip, { tone: chip.tone, icon: chip.icon, text: chip.text }) : null,
|
|
423
|
+
caps$1.gate ? (
|
|
424
|
+
// `live={!detected}` suspends the guidance line's announcements
|
|
425
|
+
// while a decode stands: the scanner has resolved, so there is
|
|
426
|
+
// nothing left to instruct, and "Ready" must not talk over the
|
|
427
|
+
// answer in the one live region (spec E.6).
|
|
428
|
+
/* @__PURE__ */ jsx(
|
|
429
|
+
GateHint,
|
|
430
|
+
{
|
|
431
|
+
profile: p,
|
|
432
|
+
gate,
|
|
433
|
+
countdown: caps$1.auto ? countdown : null,
|
|
434
|
+
live: !detected
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
) : null
|
|
438
|
+
] }) : null
|
|
439
|
+
] }),
|
|
440
|
+
frozen || !live ? /* @__PURE__ */ jsx(View, { style: [styles.phaseLayer, styles.raised], children }) : null,
|
|
441
|
+
live ? /* @__PURE__ */ jsxs(View, { style: [styles.liveColumn, styles.raised], children: [
|
|
442
|
+
sequence ? /* @__PURE__ */ jsx(
|
|
443
|
+
SequenceStrip,
|
|
444
|
+
{
|
|
445
|
+
total: typeof p.frames === "number" ? p.frames : 6,
|
|
446
|
+
shots,
|
|
447
|
+
current: angleIndex,
|
|
448
|
+
angles: p.angles,
|
|
449
|
+
mode: p.frames === "multi" ? "batch" : "angles",
|
|
450
|
+
onRedo: onSequenceRedo,
|
|
451
|
+
onRead: onSequenceRead
|
|
452
|
+
}
|
|
453
|
+
) : null,
|
|
454
|
+
/* @__PURE__ */ jsx(
|
|
455
|
+
ShutterTray,
|
|
456
|
+
{
|
|
457
|
+
platform,
|
|
458
|
+
start: /* @__PURE__ */ jsx(GlassIconButton, { icon: "upload", label: "Upload a photo", onPress: onUpload }),
|
|
459
|
+
primary: trayPrimary,
|
|
460
|
+
stack: continuous,
|
|
461
|
+
end: caps$1.flip ? /* @__PURE__ */ jsx(FlipButton, { onFlip }) : null
|
|
462
|
+
}
|
|
463
|
+
),
|
|
464
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.privacy, { color: camInk(theme) }], children: privacyStatement })
|
|
465
|
+
] }) : null
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
)
|
|
469
|
+
] });
|
|
470
|
+
}
|
|
471
|
+
var analyzerSheet = createStyleSheet((theme) => ({
|
|
472
|
+
scrim: {
|
|
473
|
+
pointerEvents: "none",
|
|
474
|
+
position: "absolute",
|
|
475
|
+
top: theme.space[0],
|
|
476
|
+
bottom: theme.space[0],
|
|
477
|
+
left: theme.space[0],
|
|
478
|
+
right: theme.space[0]
|
|
479
|
+
},
|
|
480
|
+
topLayer: {
|
|
481
|
+
pointerEvents: "box-none",
|
|
482
|
+
zIndex: 1
|
|
483
|
+
},
|
|
484
|
+
raised: {
|
|
485
|
+
zIndex: 1
|
|
486
|
+
},
|
|
487
|
+
band: {
|
|
488
|
+
pointerEvents: "box-none",
|
|
489
|
+
flexGrow: 1,
|
|
490
|
+
flexShrink: 1,
|
|
491
|
+
flexBasis: theme.space[0]
|
|
492
|
+
},
|
|
493
|
+
queueWrap: {
|
|
494
|
+
pointerEvents: "box-none",
|
|
495
|
+
position: "absolute",
|
|
496
|
+
top: theme.space[0],
|
|
497
|
+
right: theme.space[8]
|
|
498
|
+
},
|
|
499
|
+
floatStack: {
|
|
500
|
+
pointerEvents: "box-none",
|
|
501
|
+
position: "absolute",
|
|
502
|
+
left: theme.space[0],
|
|
503
|
+
right: theme.space[0],
|
|
504
|
+
bottom: theme.space[0],
|
|
505
|
+
flexDirection: "column",
|
|
506
|
+
alignItems: "center",
|
|
507
|
+
gap: theme.space[8],
|
|
508
|
+
paddingHorizontal: theme.space[8],
|
|
509
|
+
paddingBottom: theme.space[8]
|
|
510
|
+
},
|
|
511
|
+
stretch: {
|
|
512
|
+
alignSelf: "stretch"
|
|
513
|
+
},
|
|
514
|
+
phaseLayer: {
|
|
515
|
+
pointerEvents: "box-none",
|
|
516
|
+
flexShrink: 1,
|
|
517
|
+
flexDirection: "column",
|
|
518
|
+
justifyContent: "flex-end"
|
|
519
|
+
},
|
|
520
|
+
liveColumn: {
|
|
521
|
+
flexDirection: "column",
|
|
522
|
+
gap: theme.space[6],
|
|
523
|
+
paddingHorizontal: theme.space[8],
|
|
524
|
+
paddingBottom: theme.space[4]
|
|
525
|
+
},
|
|
526
|
+
privacy: {
|
|
527
|
+
alignSelf: "center",
|
|
528
|
+
fontFamily: theme.font.sans,
|
|
529
|
+
fontSize: theme.fontSize[10],
|
|
530
|
+
lineHeight: theme.fontSize[10] * 1.4,
|
|
531
|
+
textAlign: "center",
|
|
532
|
+
paddingHorizontal: theme.space[8],
|
|
533
|
+
paddingVertical: theme.space[2],
|
|
534
|
+
borderRadius: theme.radius.sm,
|
|
535
|
+
backgroundColor: theme.black.a12,
|
|
536
|
+
overflow: "hidden"
|
|
537
|
+
}
|
|
538
|
+
}));
|
|
539
|
+
|
|
540
|
+
export { Analyzer, CameraSurface, CaptureFlash, PreviewSlot, QueueBadge };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { NumberRoll } from './chunk-CUMUNPXY.js';
|
|
2
|
+
import { Icon } from './chunk-TKVFVF5D.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
import { View, Animated, Text } from 'react-native';
|
|
5
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function useForeground(variant) {
|
|
9
|
+
const theme = useLoamTheme();
|
|
10
|
+
switch (variant) {
|
|
11
|
+
case "accent":
|
|
12
|
+
return theme.color.accentOnSoft;
|
|
13
|
+
case "good":
|
|
14
|
+
return theme.color.goodOnSoft;
|
|
15
|
+
case "warn":
|
|
16
|
+
return theme.color.warnOnSoft;
|
|
17
|
+
case "danger":
|
|
18
|
+
return theme.color.dangerOnSoft;
|
|
19
|
+
case "info":
|
|
20
|
+
return theme.color.infoOnSoft;
|
|
21
|
+
case "neutral":
|
|
22
|
+
default:
|
|
23
|
+
return theme.color.text2;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function Badge({
|
|
27
|
+
children,
|
|
28
|
+
variant = "neutral",
|
|
29
|
+
size = "md",
|
|
30
|
+
outline = false,
|
|
31
|
+
leadingIcon,
|
|
32
|
+
dot = false,
|
|
33
|
+
dotStyle,
|
|
34
|
+
count,
|
|
35
|
+
max = 99,
|
|
36
|
+
showZero = false,
|
|
37
|
+
announce = false,
|
|
38
|
+
motion = "full",
|
|
39
|
+
animateCount = false,
|
|
40
|
+
accessibilityLabel,
|
|
41
|
+
style
|
|
42
|
+
}) {
|
|
43
|
+
const { styles } = useStyles(sheet, { variant, size, outline });
|
|
44
|
+
const theme = useLoamTheme();
|
|
45
|
+
const fg = useForeground(variant);
|
|
46
|
+
const iconSize = size === "sm" ? 12 : 14;
|
|
47
|
+
const dotSize = size === "sm" ? theme.space[6] : theme.space[7];
|
|
48
|
+
const label = typeof children === "string" ? children : void 0;
|
|
49
|
+
const isCount = count !== void 0;
|
|
50
|
+
if (isCount && count === 0 && !showZero) return null;
|
|
51
|
+
const display = isCount ? count > max ? `${max}+` : String(count) : void 0;
|
|
52
|
+
return /* @__PURE__ */ jsxs(
|
|
53
|
+
View,
|
|
54
|
+
{
|
|
55
|
+
accessibilityRole: "text",
|
|
56
|
+
accessibilityLabel: accessibilityLabel ?? (isCount ? String(count) : label),
|
|
57
|
+
accessibilityLiveRegion: announce && isCount ? "polite" : "none",
|
|
58
|
+
style: [styles.base, style],
|
|
59
|
+
children: [
|
|
60
|
+
dot && !isCount ? (
|
|
61
|
+
// `Animated.View` rather than `View` so `dotStyle` can carry an
|
|
62
|
+
// `Animated.Value`. With no override it behaves as a plain view — this
|
|
63
|
+
// is the cost of making the dot animatable at all, and it is nil.
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
Animated.View,
|
|
66
|
+
{
|
|
67
|
+
testID: "loam-badge-dot",
|
|
68
|
+
style: [
|
|
69
|
+
{
|
|
70
|
+
width: dotSize,
|
|
71
|
+
height: dotSize,
|
|
72
|
+
borderRadius: dotSize / 2,
|
|
73
|
+
backgroundColor: fg
|
|
74
|
+
},
|
|
75
|
+
dotStyle
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
) : null,
|
|
80
|
+
leadingIcon ? /* @__PURE__ */ jsx(Icon, { name: leadingIcon, size: iconSize, color: fg }) : null,
|
|
81
|
+
isCount && animateCount ? /* @__PURE__ */ jsx(
|
|
82
|
+
NumberRoll,
|
|
83
|
+
{
|
|
84
|
+
value: count,
|
|
85
|
+
formatValue: () => display ?? "",
|
|
86
|
+
textStyle: [styles.label, styles.tabular, { color: fg }],
|
|
87
|
+
motion,
|
|
88
|
+
decorative: true
|
|
89
|
+
}
|
|
90
|
+
) : isCount ? /* @__PURE__ */ jsx(Text, { style: [styles.label, styles.tabular, { color: fg }], children: display }) : label !== void 0 ? /* @__PURE__ */ jsx(Text, { style: [styles.label, { color: fg }], children: label }) : children
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
var sheet = createStyleSheet((theme) => ({
|
|
96
|
+
base: {
|
|
97
|
+
flexDirection: "row",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
alignSelf: "flex-start",
|
|
101
|
+
gap: theme.space.s1,
|
|
102
|
+
borderRadius: theme.radius.full,
|
|
103
|
+
// The edge box is on the base, not the tone, for two reasons: `theme.edge.*`
|
|
104
|
+
// is `transparent` until the contrast preference flips (so this is invisible
|
|
105
|
+
// now and a real outline then), and a width added per tone would make a
|
|
106
|
+
// `good` badge 2px larger than the `neutral` one beside it. `base` is the
|
|
107
|
+
// contrast-reactive width — it thickens to 2 where a `-soft` fill collapses
|
|
108
|
+
// to `--surface` and the pill would otherwise stop existing.
|
|
109
|
+
borderWidth: theme.borderWidth.base,
|
|
110
|
+
borderColor: "transparent",
|
|
111
|
+
variants: {
|
|
112
|
+
variant: {
|
|
113
|
+
neutral: { backgroundColor: theme.color.surface2, borderColor: theme.edge.neutral },
|
|
114
|
+
accent: { backgroundColor: theme.color.accentSoft, borderColor: theme.edge.accent },
|
|
115
|
+
good: { backgroundColor: theme.color.goodSoft, borderColor: theme.edge.good },
|
|
116
|
+
warn: { backgroundColor: theme.color.warnSoft, borderColor: theme.edge.warn },
|
|
117
|
+
danger: { backgroundColor: theme.color.dangerSoft, borderColor: theme.edge.danger },
|
|
118
|
+
info: { backgroundColor: theme.color.infoSoft, borderColor: theme.edge.info }
|
|
119
|
+
},
|
|
120
|
+
size: {
|
|
121
|
+
sm: { height: theme.space[20], paddingHorizontal: theme.space.s2 },
|
|
122
|
+
// Reference (buildWidgets chip): `padding:7px 13px` — 13px is a step of the spacing ramp.
|
|
123
|
+
// height is derived from padding + content (no fixed height in spec).
|
|
124
|
+
md: { paddingVertical: theme.space[7], paddingHorizontal: theme.space[13] }
|
|
125
|
+
},
|
|
126
|
+
outline: {
|
|
127
|
+
true: {
|
|
128
|
+
backgroundColor: "transparent",
|
|
129
|
+
borderWidth: theme.borderWidth.thin,
|
|
130
|
+
borderColor: theme.color.borderStrong
|
|
131
|
+
},
|
|
132
|
+
false: {}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
label: {
|
|
137
|
+
fontFamily: theme.font.sans,
|
|
138
|
+
fontWeight: theme.fontWeight.semibold,
|
|
139
|
+
variants: {
|
|
140
|
+
size: {
|
|
141
|
+
sm: { fontSize: theme.fontSize[12] },
|
|
142
|
+
// Reference (buildWidgets chip): `font-size:13px` — 13px, read from the ramp rather than hardcoded.
|
|
143
|
+
md: { fontSize: theme.fontSize[13] }
|
|
144
|
+
},
|
|
145
|
+
variant: {},
|
|
146
|
+
outline: {}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
// Tabular figures for count mode so the number never jitters as it updates.
|
|
150
|
+
tabular: {
|
|
151
|
+
fontVariant: ["tabular-nums"]
|
|
152
|
+
}
|
|
153
|
+
}));
|
|
154
|
+
|
|
155
|
+
export { Badge };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|