@btndprojects/loam-ui-native 0.1.1 → 0.2.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/dist/accordion/index.js +5 -3
- package/dist/adaptive/index.js +6 -2
- package/dist/alert/index.js +5 -2
- package/dist/analyzer/index.js +9 -6
- package/dist/announcement/index.js +8 -5
- package/dist/audio-player/index.js +5 -3
- package/dist/avatar/index.js +5 -2
- package/dist/avatar-group/index.js +7 -3
- package/dist/badge/index.js +7 -4
- package/dist/banner/index.js +5 -2
- package/dist/board/index.js +11 -6
- package/dist/button/index.js +6 -3
- package/dist/camera-permission/index.js +15 -12
- package/dist/capture-result/index.js +19 -16
- package/dist/card/index.js +6 -3
- package/dist/card-form/index.js +12 -8
- package/dist/carousel/index.js +4 -2
- package/dist/chart/index.js +8 -5
- package/dist/charts/index.js +8 -6
- package/dist/chat/index.js +16 -0
- package/dist/checkbox/index.js +6 -4
- package/dist/checklist/index.js +11 -8
- package/dist/checkout/index.js +16 -11
- package/dist/chip/index.js +7 -4
- package/dist/{chunk-XNUVB5OL.js → chunk-2OLKPG4E.js} +92 -28
- package/dist/{chunk-RUZHTGKB.js → chunk-2PKYGLQ6.js} +71 -40
- package/dist/{chunk-UC2WGUP3.js → chunk-2SWKL3AJ.js} +91 -252
- package/dist/{chunk-AI4DWZCD.js → chunk-2SY63FCH.js} +63 -16
- package/dist/{chunk-F5XNPWS7.js → chunk-2TXERVVA.js} +92 -35
- package/dist/chunk-36EC2T6P.js +581 -0
- package/dist/chunk-3DUWIYV5.js +437 -0
- package/dist/{chunk-JNY4ZHAR.js → chunk-3QMEOFW5.js} +275 -71
- package/dist/chunk-3WEZCGHX.js +265 -0
- package/dist/chunk-46MMSDGL.js +194 -0
- package/dist/{chunk-7O2FMUPT.js → chunk-4IZXHVFJ.js} +297 -92
- package/dist/{chunk-LAECSR4H.js → chunk-5LAAAXFP.js} +14 -8
- package/dist/{chunk-2A5NIQAK.js → chunk-5RENVKBQ.js} +134 -46
- package/dist/{chunk-2ZZ7TDJ4.js → chunk-5UTRIXQ6.js} +37 -31
- package/dist/{chunk-LOE5YNN3.js → chunk-5VFZRGVD.js} +37 -10
- package/dist/{chunk-52X2VYTD.js → chunk-67IZZ2MJ.js} +115 -60
- package/dist/{chunk-UYG5L34B.js → chunk-6YAQBXB3.js} +10 -4
- package/dist/{chunk-BTTFCMKG.js → chunk-74FLKD24.js} +94 -23
- package/dist/{chunk-ITTYJZWX.js → chunk-7BUIKDD6.js} +73 -18
- package/dist/{chunk-423B7SPN.js → chunk-7OVVSVEZ.js} +273 -109
- package/dist/chunk-AEB7KCHQ.js +287 -0
- package/dist/chunk-APCWFOZW.js +28 -0
- package/dist/chunk-AWKQIE5I.js +139 -0
- package/dist/{chunk-VCDBXW5H.js → chunk-B7N4ASYE.js} +86 -42
- package/dist/{chunk-IVNRBPGC.js → chunk-C4GTDLRC.js} +104 -20
- package/dist/{chunk-4ZAHCY44.js → chunk-C6APNDVA.js} +12 -5
- package/dist/{chunk-4SZYY6AN.js → chunk-CMTVNF3D.js} +18 -13
- package/dist/{chunk-HZ6CNMAF.js → chunk-CPTOADB2.js} +151 -96
- package/dist/chunk-D5N5QWI7.js +1325 -0
- package/dist/{chunk-IIQTAY3J.js → chunk-DN7MNQIP.js} +113 -29
- package/dist/{chunk-47FWHGUN.js → chunk-DVGBZ3TX.js} +84 -23
- package/dist/chunk-DW3L54DQ.js +305 -0
- package/dist/{chunk-3ARE4TES.js → chunk-E2E3I5W2.js} +69 -18
- package/dist/{chunk-DHWADYZX.js → chunk-EDCBJV7J.js} +41 -28
- package/dist/{chunk-WSW6ZFAQ.js → chunk-ENP3BMZU.js} +4 -4
- package/dist/{chunk-OOPPQH27.js → chunk-EVOIGUBI.js} +43 -19
- package/dist/{chunk-VEAYTRPX.js → chunk-EY4DD67D.js} +165 -97
- package/dist/{chunk-223Q2T2Q.js → chunk-F3H33DQX.js} +132 -61
- package/dist/{chunk-CYRBHQQZ.js → chunk-F5B3UINI.js} +68 -35
- package/dist/{chunk-6X6PQ443.js → chunk-FAJI7BSC.js} +20 -9
- package/dist/{chunk-MOUJOP55.js → chunk-FUMHAAF3.js} +96 -29
- package/dist/{chunk-6HT2LP62.js → chunk-FV6HMP7W.js} +192 -73
- package/dist/{chunk-S7F6XLTK.js → chunk-FYWNRX4F.js} +76 -47
- package/dist/{chunk-YG3ZJHGU.js → chunk-FZGAAOKS.js} +30 -8
- package/dist/{chunk-YDGVJETP.js → chunk-G3AFC24V.js} +1 -1
- package/dist/{chunk-EJBDRVIH.js → chunk-G6UESEVN.js} +15 -8
- package/dist/chunk-GDKVKNR2.js +339 -0
- package/dist/chunk-GEIGMWNF.js +10 -0
- package/dist/{chunk-JUAMLEHX.js → chunk-H7DWSL4O.js} +24 -12
- package/dist/chunk-HJFFOOJ4.js +1 -0
- package/dist/{chunk-RW6ZL2FQ.js → chunk-HJLPZA4X.js} +106 -21
- package/dist/chunk-HYEOQWT7.js +647 -0
- package/dist/chunk-I2KLQ2HA.js +19 -0
- package/dist/{chunk-CJ5EOYZE.js → chunk-I4FHVKEC.js} +11 -5
- package/dist/{chunk-JNH2TYIN.js → chunk-IDM7JJMO.js} +19 -5
- package/dist/{chunk-O4AEHWII.js → chunk-IPUNJMAQ.js} +141 -49
- package/dist/{chunk-J7Q7VCVC.js → chunk-IT6FUXXG.js} +13 -6
- package/dist/{chunk-QJJ6MADV.js → chunk-IVKMZ7BB.js} +80 -28
- package/dist/{chunk-Z7H7VSFZ.js → chunk-IXKWIFWZ.js} +17 -6
- package/dist/chunk-J64KGCGX.js +55 -0
- package/dist/chunk-JBMLWFSJ.js +270 -0
- package/dist/{chunk-4BXMXBJO.js → chunk-JJLPBRVZ.js} +22 -11
- package/dist/chunk-JLC6PM5S.js +406 -0
- package/dist/chunk-JUYWSSKW.js +335 -0
- package/dist/{chunk-7CFF4HXS.js → chunk-JV5YOTOB.js} +49 -11
- package/dist/{chunk-LZLHELAG.js → chunk-KFJGFLMW.js} +29 -8
- package/dist/{chunk-O7AE6DAF.js → chunk-KQZ3GLHR.js} +18 -8
- package/dist/{chunk-N32RGOA5.js → chunk-LKFC4CS7.js} +80 -24
- package/dist/{chunk-YC6WORFL.js → chunk-LMPHCVJJ.js} +82 -50
- package/dist/{chunk-3WPW4KUN.js → chunk-LQP4KEXZ.js} +45 -13
- package/dist/{chunk-TKQYWZ5V.js → chunk-LUMVGO2K.js} +47 -31
- package/dist/{chunk-AWJOCGFZ.js → chunk-M656FYNH.js} +25 -13
- package/dist/{chunk-35OFI3JG.js → chunk-MKSNFG7H.js} +73 -20
- package/dist/{chunk-4GBOGOTV.js → chunk-NBEF4EPJ.js} +16 -6
- package/dist/chunk-NNCOFLNE.js +24 -0
- package/dist/{chunk-4YQOR7JM.js → chunk-NTQ2F3AU.js} +73 -20
- package/dist/{chunk-QCDXZBC5.js → chunk-O5V4TG3V.js} +126 -44
- package/dist/{chunk-U7TFM2JA.js → chunk-OJQUBQWA.js} +3 -3
- package/dist/{chunk-VQHPQEUH.js → chunk-OWAMM2DK.js} +13 -6
- package/dist/chunk-PID3NJB7.js +405 -0
- package/dist/{chunk-HET4LLMX.js → chunk-PMMTGBBS.js} +27 -17
- package/dist/{chunk-RIBDXGUG.js → chunk-PNF3NKB5.js} +49 -16
- package/dist/{chunk-JXJB2X6M.js → chunk-Q6NKEPRE.js} +81 -32
- package/dist/chunk-QDZGFXQD.js +176 -0
- package/dist/{chunk-SYNOJOQO.js → chunk-QEYFDRHR.js} +60 -26
- package/dist/{chunk-VBOXAEPI.js → chunk-QHAITQIF.js} +97 -22
- package/dist/{chunk-VXDZFJGP.js → chunk-QHTVYA65.js} +230 -76
- package/dist/{chunk-TUTI5HOZ.js → chunk-QIKT7LIB.js} +14 -8
- package/dist/{chunk-3ENTMPQY.js → chunk-QP3KMOVF.js} +82 -42
- package/dist/{chunk-GNNJ4GCC.js → chunk-QPWDDJJ4.js} +62 -148
- package/dist/{chunk-QWCMU5B2.js → chunk-QRUMA22E.js} +205 -80
- package/dist/{chunk-ZVFE5QGU.js → chunk-QYPE5JX3.js} +50 -10
- package/dist/{chunk-PUPM2YGF.js → chunk-ROCUG24E.js} +76 -36
- package/dist/{chunk-NQYBUO3K.js → chunk-RU3ZPNL6.js} +333 -142
- package/dist/{chunk-TOXAGRDQ.js → chunk-RXSCIO6W.js} +14 -5
- package/dist/{chunk-FMYDDECK.js → chunk-SATMR6SG.js} +631 -203
- package/dist/{chunk-4YIP3CWS.js → chunk-SHHY5OMK.js} +7 -5
- package/dist/chunk-SKWO3SZF.js +2284 -0
- package/dist/{chunk-YF4NSSMT.js → chunk-SWS5JQIF.js} +41 -13
- package/dist/{chunk-CUMUNPXY.js → chunk-T5LTPKX6.js} +15 -7
- package/dist/{chunk-H6NIOQHK.js → chunk-TDMG26JI.js} +26 -6
- package/dist/{chunk-UWFLYMAR.js → chunk-TLCIR6RG.js} +267 -126
- package/dist/{chunk-SBMNWWBV.js → chunk-TN2ZNJUI.js} +47 -9
- package/dist/{chunk-5YNTNN5A.js → chunk-TQVAIKFD.js} +106 -41
- package/dist/chunk-TRGFFU6A.js +1456 -0
- package/dist/{chunk-2GK6PHGE.js → chunk-TY4MTKQJ.js} +100 -22
- package/dist/{chunk-AZRX6SAC.js → chunk-U23FYWME.js} +15 -7
- package/dist/{chunk-PZXZJBMP.js → chunk-U5NLHYV6.js} +26 -12
- package/dist/chunk-UQEN55EY.js +1 -0
- package/dist/chunk-UQGBTPXH.js +218 -0
- package/dist/chunk-UXGIW7OK.js +116 -0
- package/dist/{chunk-PJXUJYS6.js → chunk-UYGDJWMN.js} +55 -30
- package/dist/{chunk-QDYDBCFP.js → chunk-V2OEB75Z.js} +50 -51
- package/dist/{chunk-LSS54GLJ.js → chunk-VAOAKWUK.js} +34 -13
- package/dist/{chunk-DM5QUKKO.js → chunk-VDPK5CY4.js} +18 -6
- package/dist/chunk-W23G6JLF.js +37 -0
- package/dist/{chunk-CDRZHT42.js → chunk-W63AJTM7.js} +276 -12
- package/dist/{chunk-XXXEFXY5.js → chunk-W74TXYFB.js} +13 -5
- package/dist/{chunk-LRJNDEIA.js → chunk-WRDSPUE7.js} +144 -29
- package/dist/{chunk-C2NTXVWM.js → chunk-XBZGDDMR.js} +11 -4
- package/dist/{chunk-BV3B2HYZ.js → chunk-XIDTBCBA.js} +189 -131
- package/dist/{chunk-YTFKPRUK.js → chunk-XN4KG3P4.js} +348 -153
- package/dist/chunk-XQXMLMH3.js +211 -0
- package/dist/{chunk-HPPW424V.js → chunk-XTORZWRF.js} +19 -8
- package/dist/{chunk-P23EQNRQ.js → chunk-YAAHPATV.js} +181 -30
- package/dist/{chunk-KMI5ML5I.js → chunk-YXOAPXMU.js} +57 -18
- package/dist/{chunk-RJQOOHT2.js → chunk-ZECZOOSB.js} +59 -28
- package/dist/{chunk-QKXCPTFS.js → chunk-ZLTO5VQI.js} +121 -31
- package/dist/{chunk-BEDBFJND.js → chunk-ZVATDZOM.js} +16 -18
- package/dist/coachmark/index.js +6 -3
- package/dist/code-block/index.js +5 -3
- package/dist/color-field/index.js +6 -4
- package/dist/commerce/index.js +19 -16
- package/dist/connectivity/index.js +5 -2
- package/dist/context-menu/index.js +5 -3
- package/dist/copy-button/index.js +4 -2
- package/dist/data-grid/index.js +21 -16
- package/dist/date-range-picker/index.js +11 -8
- package/dist/description-list/index.js +3 -1
- package/dist/dialog/index.js +4 -2
- package/dist/empty-state/index.js +4 -2
- package/dist/error-summary/index.js +4 -2
- package/dist/fab/index.js +5 -2
- package/dist/file-manager/index.js +28 -0
- package/dist/file-upload/index.js +10 -7
- package/dist/filter-bar/index.js +9 -6
- package/dist/flow-run/index.js +15 -12
- package/dist/form/index.js +5 -3
- package/dist/gallery/index.js +5 -2
- package/dist/hold-to-confirm/index.js +4 -2
- package/dist/index.d.ts +9557 -2985
- package/dist/index.js +355 -122
- package/dist/infinite-list/index.js +4 -2
- package/dist/inline-edit/index.js +6 -4
- package/dist/input/index.js +5 -3
- package/dist/interactions/index.js +2 -1
- package/dist/invoice/index.js +13 -9
- package/dist/kbd/index.js +5 -1
- package/dist/keyboard/index.js +4 -2
- package/dist/list-row/index.js +6 -4
- package/dist/log-viewer/index.js +4 -2
- package/dist/map-view/index.js +5 -3
- package/dist/markdown/index.js +9 -6
- package/dist/metric/index.js +7 -4
- package/dist/money/index.js +9 -3
- package/dist/nav-drawer/index.js +4 -2
- package/dist/nav-header/index.js +9 -0
- package/dist/navigation/index.js +5 -2
- package/dist/notification-center/index.js +12 -10
- package/dist/number-roll/index.js +5 -2
- package/dist/one-handed/index.js +5 -3
- package/dist/os-surfaces/index.js +6 -3
- package/dist/otp/index.js +7 -4
- package/dist/page-header/index.js +1 -0
- package/dist/pagination/index.js +6 -0
- package/dist/payment-method/index.js +14 -10
- package/dist/payment-status/index.js +17 -14
- package/dist/permission/index.js +5 -2
- package/dist/picker/index.js +11 -6
- package/dist/progress/index.js +6 -3
- package/dist/pull-to-refresh/index.js +4 -2
- package/dist/radio-group/index.js +6 -4
- package/dist/rating/index.js +5 -2
- package/dist/receivables/index.js +21 -16
- package/dist/refund/index.js +18 -14
- package/dist/save-status/index.js +5 -3
- package/dist/scroll-area/index.js +3 -1
- package/dist/search-field/index.js +8 -0
- package/dist/segmented-control/index.js +4 -3
- package/dist/sheet/index.js +5 -3
- package/dist/skeleton/index.js +3 -1
- package/dist/slider/index.js +4 -2
- package/dist/sortable/index.js +7 -0
- package/dist/spinner/index.js +3 -1
- package/dist/split-button/index.js +9 -6
- package/dist/spotlight/index.js +3 -1
- package/dist/stage-timeline/index.js +5 -3
- package/dist/status-dot/index.js +4 -2
- package/dist/stepper/index.js +7 -4
- package/dist/streaming-text/index.js +3 -2
- package/dist/survey/index.js +18 -15
- package/dist/switch/index.js +5 -3
- package/dist/system-state/index.js +7 -4
- package/dist/tab-bar/index.js +5 -2
- package/dist/tabs/index.js +4 -2
- package/dist/tags-input/index.js +10 -0
- package/dist/textarea/index.js +6 -4
- package/dist/thinking/index.js +3 -1
- package/dist/time-field/index.js +12 -0
- package/dist/time-range-control/index.js +22 -0
- package/dist/timeline/index.js +4 -2
- package/dist/toast/index.js +4 -2
- package/dist/toolbar/index.js +4 -2
- package/dist/tour/index.js +12 -9
- package/dist/truncation-notice/index.js +5 -2
- package/dist/update-notice/index.js +12 -9
- package/dist/video-player/index.js +5 -2
- package/dist/viewfinder/index.js +6 -4
- package/dist/widget/index.js +7 -4
- package/dist/wizard/index.js +7 -4
- package/package.json +13 -12
- package/dist/chunk-6N33LFQA.js +0 -35
- package/dist/chunk-GDKZTW34.js +0 -395
- package/dist/chunk-GL7B2DOW.js +0 -134
- package/dist/chunk-NKB7BZYK.js +0 -167
- package/dist/chunk-OETCUXQP.js +0 -134
- package/dist/chunk-OPXFZ4Y5.js +0 -204
- package/dist/chunk-Q72LJOVE.js +0 -169
- package/dist/chunk-RNGLIHFA.js +0 -191
- package/dist/chunk-RQ3HASCC.js +0 -6
- package/dist/chunk-RSOJT5YW.js +0 -124
- package/dist/chunk-TKVFVF5D.js +0 -95
- package/dist/chunk-XOSCY2CW.js +0 -242
- package/dist/header/index.js +0 -5
- package/dist/search-bar/index.js +0 -5
- /package/dist/{chunk-3ECPOSKO.js → chunk-3UG6JUCV.js} +0 -0
- /package/dist/{chunk-JRLTGLN4.js → chunk-5WWRTEPS.js} +0 -0
- /package/dist/{chunk-RTIKSY6A.js → chunk-5Z5ZYMOJ.js} +0 -0
|
@@ -1,12 +1,58 @@
|
|
|
1
|
-
import { Badge } from './chunk-
|
|
2
|
-
import { useSurfaceAnnounce } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { Badge } from './chunk-TN2ZNJUI.js';
|
|
2
|
+
import { useSurfaceAnnounce } from './chunk-HJLPZA4X.js';
|
|
3
|
+
import { NAMED_ROLE } from './chunk-W23G6JLF.js';
|
|
4
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
5
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
6
|
+
import * as React2 from 'react';
|
|
5
7
|
import { View, Text, Pressable } from 'react-native';
|
|
6
8
|
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
7
9
|
import { confidenceTone, confidenceLabel } from '@btndprojects/loam-analyzer';
|
|
8
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
11
|
|
|
12
|
+
var DEFAULT_CAPTURE_RESULT_LABELS = {
|
|
13
|
+
result: "Result",
|
|
14
|
+
scanAnother: "Scan another",
|
|
15
|
+
dismissResult: "Dismiss result",
|
|
16
|
+
frozenFrame: "frozen frame \xB7 placeholder",
|
|
17
|
+
retake: "Retake",
|
|
18
|
+
analyse: "Analyse",
|
|
19
|
+
usePhoto: "Use photo",
|
|
20
|
+
lastCapture: "Last capture",
|
|
21
|
+
noCapture: "No capture yet",
|
|
22
|
+
confidence: "confidence",
|
|
23
|
+
orPossibly: "Or possibly",
|
|
24
|
+
closestWeGot: "The closest we got",
|
|
25
|
+
estimate: "Estimate",
|
|
26
|
+
quantity: "Quantity",
|
|
27
|
+
noProduct: "No product matched this code.",
|
|
28
|
+
severity: { none: "no damage", minor: "minor", moderate: "moderate" },
|
|
29
|
+
analysing: "Analysing",
|
|
30
|
+
readingAngles: "Reading six angles",
|
|
31
|
+
cancel: "Cancel",
|
|
32
|
+
stageStatus: { pending: "pending", active: "active", done: "done", failed: "failed" },
|
|
33
|
+
stageNote: (status, where) => `, ${status}, runs on ${where}`
|
|
34
|
+
};
|
|
35
|
+
var NONE = {};
|
|
36
|
+
function useCaptureResultLabels(own) {
|
|
37
|
+
const merged = useLabels("captureResult", DEFAULT_CAPTURE_RESULT_LABELS, own);
|
|
38
|
+
const provided = useLabels("captureResult", NONE);
|
|
39
|
+
return React2.useMemo(
|
|
40
|
+
() => ({
|
|
41
|
+
...merged,
|
|
42
|
+
severity: {
|
|
43
|
+
...DEFAULT_CAPTURE_RESULT_LABELS.severity,
|
|
44
|
+
...provided.severity,
|
|
45
|
+
...own?.severity
|
|
46
|
+
},
|
|
47
|
+
stageStatus: {
|
|
48
|
+
...DEFAULT_CAPTURE_RESULT_LABELS.stageStatus,
|
|
49
|
+
...provided.stageStatus,
|
|
50
|
+
...own?.stageStatus
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
[merged, provided, own]
|
|
54
|
+
);
|
|
55
|
+
}
|
|
10
56
|
var TONE_ICON = {
|
|
11
57
|
good: "check-circle",
|
|
12
58
|
warn: "alert-triangle",
|
|
@@ -15,10 +61,12 @@ var TONE_ICON = {
|
|
|
15
61
|
var ROW_CENTRED = { alignSelf: "center" };
|
|
16
62
|
function ConfidenceBadge({
|
|
17
63
|
value,
|
|
18
|
-
label
|
|
64
|
+
label,
|
|
65
|
+
labels,
|
|
19
66
|
size = "sm",
|
|
20
67
|
icon = false
|
|
21
68
|
}) {
|
|
69
|
+
const t = useCaptureResultLabels(labels);
|
|
22
70
|
const tone = confidenceTone(value);
|
|
23
71
|
const text = confidenceLabel(value);
|
|
24
72
|
return /* @__PURE__ */ jsx(
|
|
@@ -27,21 +75,19 @@ function ConfidenceBadge({
|
|
|
27
75
|
variant: tone,
|
|
28
76
|
size,
|
|
29
77
|
leadingIcon: icon ? TONE_ICON[tone] : void 0,
|
|
30
|
-
accessibilityLabel: `${text} ${label}`,
|
|
78
|
+
accessibilityLabel: `${text} ${label ?? t.confidence}`,
|
|
31
79
|
style: ROW_CENTRED,
|
|
32
80
|
children: text
|
|
33
81
|
}
|
|
34
82
|
);
|
|
35
83
|
}
|
|
36
|
-
function PhaseAnnouncement({
|
|
37
|
-
message
|
|
38
|
-
}) {
|
|
84
|
+
function PhaseAnnouncement({ message }) {
|
|
39
85
|
const surface = useSurfaceAnnounce();
|
|
40
|
-
const [own, setOwn] =
|
|
86
|
+
const [own, setOwn] = React2.useState("");
|
|
41
87
|
const { styles } = useStyles(sharedSheet);
|
|
42
|
-
const sink =
|
|
88
|
+
const sink = React2.useRef(setOwn);
|
|
43
89
|
sink.current = surface ?? setOwn;
|
|
44
|
-
|
|
90
|
+
React2.useEffect(() => {
|
|
45
91
|
if (message) sink.current(message);
|
|
46
92
|
}, [message]);
|
|
47
93
|
if (surface) return null;
|
|
@@ -57,31 +103,41 @@ function PhaseAnnouncement({
|
|
|
57
103
|
);
|
|
58
104
|
}
|
|
59
105
|
function NoteBlock({ title, description }) {
|
|
60
|
-
const theme = useLoamTheme();
|
|
106
|
+
const theme = useLoamTheme("capture-result");
|
|
61
107
|
const { styles } = useStyles(sharedSheet);
|
|
62
|
-
return /* @__PURE__ */ jsxs(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
108
|
+
return /* @__PURE__ */ jsxs(
|
|
109
|
+
View,
|
|
110
|
+
{
|
|
111
|
+
accessible: true,
|
|
112
|
+
accessibilityRole: NAMED_ROLE,
|
|
113
|
+
accessibilityLabel: `${title} ${description}`,
|
|
114
|
+
style: styles.note,
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx(Icon, { name: "info", size: theme.icon.sm, color: theme.color.infoOnSoft }),
|
|
117
|
+
/* @__PURE__ */ jsxs(View, { style: styles.noteText, children: [
|
|
118
|
+
/* @__PURE__ */ jsx(Text, { style: styles.noteTitle, children: title }),
|
|
119
|
+
/* @__PURE__ */ jsx(Text, { style: styles.noteBody, children: description })
|
|
120
|
+
] })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
69
124
|
}
|
|
70
|
-
function MatchRow({ match, onPick }) {
|
|
125
|
+
function MatchRow({ match, onPick, labels }) {
|
|
126
|
+
const t = useCaptureResultLabels(labels);
|
|
71
127
|
const { styles } = useStyles(sharedSheet);
|
|
72
128
|
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73
129
|
/* @__PURE__ */ jsxs(View, { style: styles.matchText, children: [
|
|
74
130
|
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.matchCommon, children: match.common }),
|
|
75
131
|
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.matchName, children: match.name })
|
|
76
132
|
] }),
|
|
77
|
-
/* @__PURE__ */ jsx(ConfidenceBadge, { value: match.confidence })
|
|
133
|
+
/* @__PURE__ */ jsx(ConfidenceBadge, { value: match.confidence, labels })
|
|
78
134
|
] });
|
|
79
135
|
if (!onPick) return /* @__PURE__ */ jsx(View, { style: styles.matchRow, children: inner });
|
|
80
136
|
return /* @__PURE__ */ jsx(
|
|
81
137
|
Pressable,
|
|
82
138
|
{
|
|
83
139
|
accessibilityRole: "button",
|
|
84
|
-
accessibilityLabel: `${match.common}, ${match.name}, ${confidenceLabel(match.confidence)} confidence`,
|
|
140
|
+
accessibilityLabel: `${match.common}, ${match.name}, ${confidenceLabel(match.confidence)} ${t.confidence}`,
|
|
85
141
|
style: styles.matchRow,
|
|
86
142
|
onPress: () => onPick(match),
|
|
87
143
|
children: inner
|
|
@@ -156,4 +212,4 @@ var sharedSheet = createStyleSheet((theme) => ({
|
|
|
156
212
|
}
|
|
157
213
|
}));
|
|
158
214
|
|
|
159
|
-
export { ConfidenceBadge, MatchRow, NoteBlock, PhaseAnnouncement };
|
|
215
|
+
export { ConfidenceBadge, MatchRow, NoteBlock, PhaseAnnouncement, useCaptureResultLabels };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Coachmark, CoachmarkDots } from './chunk-
|
|
2
|
-
import { useTourHost, Highlight, Beacon, useTourInsets } from './chunk-
|
|
3
|
-
import { Progress } from './chunk-
|
|
4
|
-
import { Button } from './chunk-
|
|
5
|
-
import {
|
|
1
|
+
import { Coachmark, CoachmarkDots } from './chunk-YAAHPATV.js';
|
|
2
|
+
import { useTourHost, Highlight, Beacon, useTourInsets } from './chunk-H7DWSL4O.js';
|
|
3
|
+
import { Progress } from './chunk-5UTRIXQ6.js';
|
|
4
|
+
import { Button } from './chunk-E2E3I5W2.js';
|
|
5
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
6
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
6
7
|
import * as React from 'react';
|
|
7
|
-
import { BackHandler, Pressable, View, Text } from 'react-native';
|
|
8
|
+
import { BackHandler, AccessibilityInfo, Pressable, View, Text } from 'react-native';
|
|
8
9
|
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
9
10
|
import { materializeTour, resolveText, stepsForSurface, kindFor, canAttachGate, isStepGated, highlightFor, shouldSkipMissingStep, hintRuns } from '@btndprojects/loam-engage';
|
|
10
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -20,7 +21,10 @@ var DEFAULT_LABELS = {
|
|
|
20
21
|
resume: "Resume tour",
|
|
21
22
|
beacon: "Something new here",
|
|
22
23
|
opening: "Opening",
|
|
23
|
-
|
|
24
|
+
openingRoute: (route) => `Opening ${route}`,
|
|
25
|
+
step: "Step",
|
|
26
|
+
stepOf: (step, current, total) => `${step} ${current} of ${total}`,
|
|
27
|
+
resumeWithCounter: (label, counter) => `${label} \u2014 ${counter}`
|
|
24
28
|
};
|
|
25
29
|
var TourContext = React.createContext(null);
|
|
26
30
|
function TourProvider({
|
|
@@ -28,7 +32,9 @@ function TourProvider({
|
|
|
28
32
|
defaultActiveId = null
|
|
29
33
|
}) {
|
|
30
34
|
const [activeId, setActiveId] = React.useState(defaultActiveId);
|
|
31
|
-
const listeners = React.useRef(
|
|
35
|
+
const listeners = React.useRef(
|
|
36
|
+
/* @__PURE__ */ new Set()
|
|
37
|
+
);
|
|
32
38
|
const value = React.useMemo(
|
|
33
39
|
() => ({
|
|
34
40
|
activeId,
|
|
@@ -75,12 +81,14 @@ function Tour({
|
|
|
75
81
|
onDismiss,
|
|
76
82
|
onEvent,
|
|
77
83
|
minimisable = true,
|
|
84
|
+
dismissOnBack = true,
|
|
85
|
+
renderCard,
|
|
78
86
|
labels: labelOverrides,
|
|
79
87
|
motion = "full"
|
|
80
88
|
}) {
|
|
81
89
|
const ctx = React.useContext(TourContext);
|
|
82
90
|
const host = useTourHost();
|
|
83
|
-
const labels =
|
|
91
|
+
const labels = useLabels("tour", DEFAULT_LABELS, labelOverrides);
|
|
84
92
|
const touch = surface !== "pointer";
|
|
85
93
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
86
94
|
const open = openProp ?? (id && ctx ? ctx.activeId === id : uncontrolledOpen);
|
|
@@ -187,7 +195,9 @@ function Tour({
|
|
|
187
195
|
if (timer) clearTimeout(timer);
|
|
188
196
|
};
|
|
189
197
|
}, [anchorName, host]);
|
|
190
|
-
const needsRoute = Boolean(
|
|
198
|
+
const needsRoute = Boolean(
|
|
199
|
+
open && !minimised && step?.route && route !== void 0 && route !== step.route
|
|
200
|
+
);
|
|
191
201
|
const navigatedFor = React.useRef(null);
|
|
192
202
|
React.useEffect(() => {
|
|
193
203
|
if (!needsRoute || !onNavigate || !step?.route) return;
|
|
@@ -260,19 +270,28 @@ function Tour({
|
|
|
260
270
|
if (want && route === want && before !== route) advanceRef.current("route");
|
|
261
271
|
}, [route, open, minimised, advanceOn, step]);
|
|
262
272
|
React.useEffect(() => {
|
|
263
|
-
if (!open || minimised) return;
|
|
273
|
+
if (!open || minimised || !dismissOnBack) return;
|
|
264
274
|
const sub = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
265
275
|
close("back");
|
|
266
276
|
return true;
|
|
267
277
|
});
|
|
268
278
|
return () => sub.remove();
|
|
269
|
-
}, [open, minimised, close]);
|
|
279
|
+
}, [open, minimised, dismissOnBack, close]);
|
|
280
|
+
const stepTitle = step ? t(step.title) : void 0;
|
|
281
|
+
const announced = React.useRef(index);
|
|
282
|
+
React.useEffect(() => {
|
|
283
|
+
if (!open || announced.current === index) return;
|
|
284
|
+
announced.current = index;
|
|
285
|
+
if (stepTitle)
|
|
286
|
+
AccessibilityInfo.announceForAccessibility(`${stepTitle}, ${index + 1} of ${total}`);
|
|
287
|
+
}, [open, index, total, stepTitle]);
|
|
270
288
|
if (!open || !step || total === 0) return null;
|
|
271
289
|
if (minimised) {
|
|
272
290
|
return /* @__PURE__ */ jsx(
|
|
273
291
|
TourLauncher,
|
|
274
292
|
{
|
|
275
293
|
label: labels.resume,
|
|
294
|
+
labels,
|
|
276
295
|
counter: `${index + 1}/${total}`,
|
|
277
296
|
motion,
|
|
278
297
|
onPress: () => {
|
|
@@ -301,37 +320,34 @@ function Tour({
|
|
|
301
320
|
)
|
|
302
321
|
] });
|
|
303
322
|
}
|
|
323
|
+
const cardProps = {
|
|
324
|
+
step,
|
|
325
|
+
index,
|
|
326
|
+
total,
|
|
327
|
+
titles: visible.map((s) => t(s.title) ?? ""),
|
|
328
|
+
name,
|
|
329
|
+
target: variant === "anchored" ? resolved : void 0,
|
|
330
|
+
variant,
|
|
331
|
+
gated,
|
|
332
|
+
locale,
|
|
333
|
+
defaultLocale,
|
|
334
|
+
waiting: waiting ? step.route ? labels.openingRoute(step.route) : labels.opening : void 0,
|
|
335
|
+
labels,
|
|
336
|
+
motion,
|
|
337
|
+
onNext: () => advance("next"),
|
|
338
|
+
onBack: index > 0 ? () => setIndex(index - 1) : void 0,
|
|
339
|
+
onSkipStep: () => skipStep("user-skipped"),
|
|
340
|
+
onSelectStep: setIndex,
|
|
341
|
+
onClose: () => close("user"),
|
|
342
|
+
onMinimise: minimisable ? () => {
|
|
343
|
+
setMinimised(true);
|
|
344
|
+
emitRef.current("tour_minimised");
|
|
345
|
+
} : void 0,
|
|
346
|
+
onAction: onAction ? (action) => onAction(action, step) : void 0
|
|
347
|
+
};
|
|
304
348
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
305
349
|
resolved ? /* @__PURE__ */ jsx(Highlight, { kind: highlight, target: resolved, padding: step.padding, motion }) : null,
|
|
306
|
-
/* @__PURE__ */ jsx(
|
|
307
|
-
TourStepCard,
|
|
308
|
-
{
|
|
309
|
-
step,
|
|
310
|
-
index,
|
|
311
|
-
total,
|
|
312
|
-
titles: visible.map((s) => t(s.title) ?? ""),
|
|
313
|
-
name,
|
|
314
|
-
target: variant === "anchored" ? resolved : void 0,
|
|
315
|
-
variant,
|
|
316
|
-
gated,
|
|
317
|
-
locale,
|
|
318
|
-
defaultLocale,
|
|
319
|
-
waiting: waiting ? `${labels.opening} ${step.route ?? ""}`.trim() : void 0,
|
|
320
|
-
labels,
|
|
321
|
-
motion,
|
|
322
|
-
onNext: () => advance("next"),
|
|
323
|
-
onBack: index > 0 ? () => setIndex(index - 1) : void 0,
|
|
324
|
-
onSkipStep: () => skipStep("user-skipped"),
|
|
325
|
-
onSelectStep: setIndex,
|
|
326
|
-
onClose: () => close("user"),
|
|
327
|
-
onMinimise: minimisable ? () => {
|
|
328
|
-
setMinimised(true);
|
|
329
|
-
emitRef.current("tour_minimised");
|
|
330
|
-
} : void 0,
|
|
331
|
-
onAction: onAction ? (action) => onAction(action, step) : void 0
|
|
332
|
-
},
|
|
333
|
-
index
|
|
334
|
-
)
|
|
350
|
+
/* @__PURE__ */ jsx(React.Fragment, { children: renderCard ? renderCard(cardProps) : /* @__PURE__ */ jsx(TourStepCard, { ...cardProps }) }, renderCard ? index : variant)
|
|
335
351
|
] });
|
|
336
352
|
}
|
|
337
353
|
function TourHint({ text }) {
|
|
@@ -362,9 +378,9 @@ function TourStepCard({
|
|
|
362
378
|
defaultLocale,
|
|
363
379
|
motion = "full"
|
|
364
380
|
}) {
|
|
365
|
-
const theme = useLoamTheme();
|
|
381
|
+
const theme = useLoamTheme("tour");
|
|
366
382
|
const { styles } = useStyles(sheet);
|
|
367
|
-
const labels =
|
|
383
|
+
const labels = useLabels("tour", DEFAULT_LABELS, labelOverrides);
|
|
368
384
|
const t = (value) => resolveText(value, locale, defaultLocale);
|
|
369
385
|
const isLast = index === total - 1;
|
|
370
386
|
const kind = kindFor(step.kind, Boolean(step.anchor));
|
|
@@ -401,7 +417,16 @@ function TourStepCard({
|
|
|
401
417
|
] }),
|
|
402
418
|
children: [
|
|
403
419
|
typeof step.body !== "string" && step.body ? /* @__PURE__ */ jsx(Fragment, { children: step.body }) : null,
|
|
404
|
-
cta ? /* @__PURE__ */ jsx(
|
|
420
|
+
cta ? /* @__PURE__ */ jsx(
|
|
421
|
+
Button,
|
|
422
|
+
{
|
|
423
|
+
size: "sm",
|
|
424
|
+
variant: "ghost",
|
|
425
|
+
trailingIcon: "arrow-right",
|
|
426
|
+
onPress: () => onAction?.(cta.action),
|
|
427
|
+
children: cta.label
|
|
428
|
+
}
|
|
429
|
+
) : null,
|
|
405
430
|
/* @__PURE__ */ jsx(
|
|
406
431
|
TourProgress,
|
|
407
432
|
{
|
|
@@ -409,6 +434,7 @@ function TourStepCard({
|
|
|
409
434
|
total,
|
|
410
435
|
titles,
|
|
411
436
|
stepLabel: labels.step,
|
|
437
|
+
labels,
|
|
412
438
|
onSelect: onSelectStep
|
|
413
439
|
}
|
|
414
440
|
)
|
|
@@ -421,9 +447,12 @@ function TourProgress({
|
|
|
421
447
|
total,
|
|
422
448
|
titles,
|
|
423
449
|
onSelect,
|
|
424
|
-
stepLabel
|
|
450
|
+
stepLabel: stepLabelProp,
|
|
451
|
+
labels: labelsProp
|
|
425
452
|
}) {
|
|
426
453
|
const { styles } = useStyles(sheet);
|
|
454
|
+
const labels = useLabels("tour", DEFAULT_LABELS, labelsProp);
|
|
455
|
+
const stepLabel = stepLabelProp ?? labels.step;
|
|
427
456
|
return /* @__PURE__ */ jsxs(View, { style: styles.progress, children: [
|
|
428
457
|
/* @__PURE__ */ jsx(
|
|
429
458
|
Progress,
|
|
@@ -431,7 +460,7 @@ function TourProgress({
|
|
|
431
460
|
size: "sm",
|
|
432
461
|
value: index + 1,
|
|
433
462
|
max: Math.max(1, total),
|
|
434
|
-
accessibilityLabel:
|
|
463
|
+
accessibilityLabel: labels.stepOf(stepLabel, index + 1, total)
|
|
435
464
|
}
|
|
436
465
|
),
|
|
437
466
|
/* @__PURE__ */ jsxs(View, { style: styles.progressRail, children: [
|
|
@@ -454,19 +483,22 @@ function TourProgress({
|
|
|
454
483
|
] });
|
|
455
484
|
}
|
|
456
485
|
function TourLauncher({
|
|
457
|
-
label
|
|
486
|
+
label: labelProp,
|
|
458
487
|
counter,
|
|
459
488
|
onPress,
|
|
460
|
-
pinned = true
|
|
489
|
+
pinned = true,
|
|
490
|
+
labels: labelsProp
|
|
461
491
|
}) {
|
|
462
|
-
const theme = useLoamTheme();
|
|
492
|
+
const theme = useLoamTheme("tour");
|
|
493
|
+
const labels = useLabels("tour", DEFAULT_LABELS, labelsProp);
|
|
494
|
+
const label = labelProp ?? labels.resume;
|
|
463
495
|
const { styles } = useStyles(sheet);
|
|
464
496
|
const insets = useTourInsets();
|
|
465
497
|
return /* @__PURE__ */ jsxs(
|
|
466
498
|
Pressable,
|
|
467
499
|
{
|
|
468
500
|
accessibilityRole: "button",
|
|
469
|
-
accessibilityLabel: counter ?
|
|
501
|
+
accessibilityLabel: counter ? labels.resumeWithCounter(label, counter) : label,
|
|
470
502
|
onPress,
|
|
471
503
|
style: ({ pressed }) => [
|
|
472
504
|
styles.launcher,
|
|
@@ -1,37 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
2
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
3
|
+
import { springConfig } from './chunk-J64KGCGX.js';
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { Animated, Easing, View, Pressable, Text } from 'react-native';
|
|
4
6
|
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
5
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
8
|
|
|
9
|
+
var DEFAULT_LABELS = {
|
|
10
|
+
tabWithBadge: (label, badge) => `${label}, ${badge}`
|
|
11
|
+
};
|
|
7
12
|
var INDICATOR_WIDTH = 28;
|
|
8
13
|
var BADGE_MAX = 99;
|
|
9
14
|
function Tab({
|
|
10
15
|
item,
|
|
11
16
|
selected,
|
|
12
17
|
onPress,
|
|
13
|
-
motion
|
|
18
|
+
motion,
|
|
19
|
+
bounce,
|
|
20
|
+
labels
|
|
14
21
|
}) {
|
|
15
|
-
const theme = useLoamTheme();
|
|
22
|
+
const theme = useLoamTheme("tab-bar");
|
|
16
23
|
const { styles } = useStyles(sheet);
|
|
17
24
|
const fg = selected ? theme.color.accentStrong : theme.color.text3;
|
|
18
25
|
const scale = React.useRef(new Animated.Value(1)).current;
|
|
19
26
|
const spring = (to) => {
|
|
20
27
|
if (motion === "none") return;
|
|
21
28
|
Animated.spring(scale, {
|
|
29
|
+
...springConfig(theme, "fs"),
|
|
22
30
|
toValue: to,
|
|
23
|
-
useNativeDriver: true
|
|
24
|
-
speed: 40,
|
|
25
|
-
bounciness: 4
|
|
31
|
+
useNativeDriver: true
|
|
26
32
|
}).start();
|
|
27
33
|
};
|
|
34
|
+
const badgeScale = React.useRef(new Animated.Value(1)).current;
|
|
35
|
+
const lastBadge = React.useRef(item.badge ?? 0);
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
const now = item.badge ?? 0;
|
|
38
|
+
const rose = now > lastBadge.current;
|
|
39
|
+
lastBadge.current = now;
|
|
40
|
+
if (!rose || !bounce) return;
|
|
41
|
+
badgeScale.setValue(1.3);
|
|
42
|
+
Animated.spring(badgeScale, {
|
|
43
|
+
toValue: 1,
|
|
44
|
+
useNativeDriver: true,
|
|
45
|
+
speed: 20,
|
|
46
|
+
bounciness: 12
|
|
47
|
+
}).start();
|
|
48
|
+
}, [item.badge, bounce, badgeScale]);
|
|
28
49
|
const showBadge = item.badge !== void 0 && item.badge > 0;
|
|
29
50
|
const badgeText = item.badge !== void 0 && item.badge > BADGE_MAX ? `${BADGE_MAX}+` : `${item.badge}`;
|
|
30
51
|
return /* @__PURE__ */ jsx(
|
|
31
52
|
Pressable,
|
|
32
53
|
{
|
|
33
54
|
accessibilityRole: "tab",
|
|
34
|
-
accessibilityLabel: item.label,
|
|
55
|
+
accessibilityLabel: showBadge ? labels.tabWithBadge(item.label, badgeText) : item.label,
|
|
35
56
|
accessibilityState: { selected },
|
|
36
57
|
onPress,
|
|
37
58
|
onPressIn: () => spring(0.9),
|
|
@@ -40,7 +61,7 @@ function Tab({
|
|
|
40
61
|
children: /* @__PURE__ */ jsxs(Animated.View, { style: [styles.tabInner, { transform: [{ scale }] }], children: [
|
|
41
62
|
/* @__PURE__ */ jsxs(View, { style: styles.iconWrap, children: [
|
|
42
63
|
/* @__PURE__ */ jsx(Icon, { name: item.icon, size: 22, color: fg }),
|
|
43
|
-
showBadge ? /* @__PURE__ */ jsx(View, { style: styles.badge, children: /* @__PURE__ */ jsx(Text, { style: styles.badgeText, numberOfLines: 1, children: badgeText }) }) : null
|
|
64
|
+
showBadge ? /* @__PURE__ */ jsx(Animated.View, { style: [styles.badge, { transform: [{ scale: badgeScale }] }], children: /* @__PURE__ */ jsx(Text, { style: styles.badgeText, numberOfLines: 1, children: badgeText }) }) : null
|
|
44
65
|
] }),
|
|
45
66
|
/* @__PURE__ */ jsx(Text, { style: [styles.label, { color: fg }], numberOfLines: 1, children: item.label })
|
|
46
67
|
] })
|
|
@@ -51,12 +72,15 @@ function TabBar({
|
|
|
51
72
|
items,
|
|
52
73
|
value,
|
|
53
74
|
onValueChange,
|
|
75
|
+
onReselect,
|
|
54
76
|
bottomInset = 0,
|
|
55
77
|
showIndicator = true,
|
|
56
78
|
motion = "full",
|
|
57
|
-
accessibilityLabel
|
|
79
|
+
accessibilityLabel,
|
|
80
|
+
labels: labelsProp
|
|
58
81
|
}) {
|
|
59
|
-
const theme = useLoamTheme();
|
|
82
|
+
const theme = useLoamTheme("tab-bar");
|
|
83
|
+
const labels = useLabels("tabBar", DEFAULT_LABELS, labelsProp);
|
|
60
84
|
const { styles } = useStyles(sheet);
|
|
61
85
|
const activeIndex = Math.max(
|
|
62
86
|
0,
|
|
@@ -88,7 +112,10 @@ function TabBar({
|
|
|
88
112
|
Animated.multiply(progress, segmentWidth),
|
|
89
113
|
(segmentWidth - theme.space[INDICATOR_WIDTH]) / 2
|
|
90
114
|
);
|
|
91
|
-
const select = (next) =>
|
|
115
|
+
const select = (next) => {
|
|
116
|
+
if (next === value && onReselect) onReselect(next);
|
|
117
|
+
else onValueChange?.(next);
|
|
118
|
+
};
|
|
92
119
|
return /* @__PURE__ */ jsxs(
|
|
93
120
|
View,
|
|
94
121
|
{
|
|
@@ -101,7 +128,10 @@ function TabBar({
|
|
|
101
128
|
Animated.View,
|
|
102
129
|
{
|
|
103
130
|
pointerEvents: "none",
|
|
104
|
-
style: [
|
|
131
|
+
style: [
|
|
132
|
+
styles.indicator,
|
|
133
|
+
{ width: theme.space[INDICATOR_WIDTH], transform: [{ translateX }] }
|
|
134
|
+
]
|
|
105
135
|
}
|
|
106
136
|
) : null,
|
|
107
137
|
items.map((item) => /* @__PURE__ */ jsx(
|
|
@@ -110,7 +140,9 @@ function TabBar({
|
|
|
110
140
|
item,
|
|
111
141
|
selected: item.value === value,
|
|
112
142
|
onPress: () => select(item.value),
|
|
113
|
-
motion
|
|
143
|
+
motion,
|
|
144
|
+
bounce: motion !== "none" && !theme.reduceMotion,
|
|
145
|
+
labels
|
|
114
146
|
},
|
|
115
147
|
item.value
|
|
116
148
|
))
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { NumberRoll } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { NumberRoll } from './chunk-T5LTPKX6.js';
|
|
2
|
+
import { NAMED_ROLE } from './chunk-W23G6JLF.js';
|
|
3
|
+
import { useLabels, useLoamLocale } from './chunk-APCWFOZW.js';
|
|
4
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
3
5
|
import 'react';
|
|
4
6
|
import { View, Text } from 'react-native';
|
|
5
7
|
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
6
8
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
9
|
|
|
10
|
+
var DEFAULT_LABELS = {
|
|
11
|
+
up: "Up",
|
|
12
|
+
down: "Down",
|
|
13
|
+
flat: "No change",
|
|
14
|
+
delta: (direction, text) => `${direction} ${text}`
|
|
15
|
+
};
|
|
8
16
|
var DIRECTION_GLYPH = {
|
|
9
17
|
up: "arrow-up",
|
|
10
18
|
down: "arrow-down",
|
|
11
19
|
flat: "minus"
|
|
12
20
|
};
|
|
13
|
-
var DIRECTION_WORD = {
|
|
14
|
-
up: "Up",
|
|
15
|
-
down: "Down",
|
|
16
|
-
flat: "No change"
|
|
17
|
-
};
|
|
18
21
|
function resolveDirection(delta, deltaDirection) {
|
|
19
22
|
if (deltaDirection) return deltaDirection;
|
|
20
23
|
if (typeof delta === "number") return delta > 0 ? "up" : delta < 0 ? "down" : "flat";
|
|
@@ -25,10 +28,10 @@ function toneFor(direction, invert) {
|
|
|
25
28
|
const isGood = direction === "up" ? !invert : invert;
|
|
26
29
|
return isGood ? "good" : "bad";
|
|
27
30
|
}
|
|
28
|
-
function formatDelta(delta) {
|
|
31
|
+
function formatDelta(delta, locale) {
|
|
29
32
|
if (typeof delta === "string") return delta;
|
|
30
33
|
const sign = delta > 0 ? "+" : delta < 0 ? "\u2212" : "";
|
|
31
|
-
return `${sign}${Math.abs(delta).toLocaleString()}`;
|
|
34
|
+
return `${sign}${Math.abs(delta).toLocaleString(locale)}`;
|
|
32
35
|
}
|
|
33
36
|
function Metric({
|
|
34
37
|
label,
|
|
@@ -41,37 +44,50 @@ function Metric({
|
|
|
41
44
|
caption,
|
|
42
45
|
motion = "full",
|
|
43
46
|
animateValue = false,
|
|
44
|
-
accessibilityLabel
|
|
47
|
+
accessibilityLabel,
|
|
48
|
+
labels: labelsProp
|
|
45
49
|
}) {
|
|
46
50
|
const hasDelta = delta !== void 0 && delta !== "";
|
|
47
51
|
const direction = resolveDirection(delta, deltaDirection);
|
|
48
52
|
const tone = toneFor(direction, invert);
|
|
49
|
-
const
|
|
53
|
+
const labels = useLabels("metric", DEFAULT_LABELS, labelsProp);
|
|
54
|
+
const locale = useLoamLocale();
|
|
55
|
+
const deltaText = hasDelta ? formatDelta(delta, locale) : "";
|
|
56
|
+
const directionWord = labels[direction];
|
|
50
57
|
const numeric = typeof value === "number";
|
|
51
58
|
const willAnimateValue = animateValue && numeric && motion !== "none" && motion !== "reduced";
|
|
52
59
|
const { styles } = useStyles(sheet, { size, tone });
|
|
53
|
-
const theme = useLoamTheme();
|
|
60
|
+
const theme = useLoamTheme("metric");
|
|
54
61
|
const glyphColor = tone === "good" ? theme.status.doneOnSoft : tone === "bad" ? theme.status.crashedOnSoft : theme.status.pendingOnSoft;
|
|
55
62
|
const iconSize = size === "sm" ? theme.icon.xs : size === "lg" ? theme.icon.md : theme.icon.sm;
|
|
56
|
-
return /* @__PURE__ */ jsxs(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
return /* @__PURE__ */ jsxs(
|
|
64
|
+
View,
|
|
65
|
+
{
|
|
66
|
+
style: styles.root,
|
|
67
|
+
...accessibilityLabel ? { role: "group", accessibilityLabel } : null,
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(Text, { style: styles.label, children: label }),
|
|
70
|
+
/* @__PURE__ */ jsxs(View, { style: styles.valueRow, children: [
|
|
71
|
+
willAnimateValue ? /* @__PURE__ */ jsx(NumberRoll, { value, textStyle: styles.value, motion }) : /* @__PURE__ */ jsx(Text, { style: styles.value, children: value }),
|
|
72
|
+
unit !== void 0 ? /* @__PURE__ */ jsx(Text, { style: styles.unit, children: unit }) : null
|
|
73
|
+
] }),
|
|
74
|
+
hasDelta ? /* @__PURE__ */ jsxs(
|
|
75
|
+
View,
|
|
76
|
+
{
|
|
77
|
+
accessible: true,
|
|
78
|
+
accessibilityRole: NAMED_ROLE,
|
|
79
|
+
style: styles.delta,
|
|
80
|
+
accessibilityLabel: deltaText ? labels.delta(directionWord, deltaText) : directionWord,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(Icon, { name: DIRECTION_GLYPH[direction], size: iconSize, color: glyphColor }),
|
|
83
|
+
deltaText ? /* @__PURE__ */ jsx(Text, { style: styles.deltaText, children: deltaText }) : null
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
) : null,
|
|
87
|
+
caption !== void 0 ? /* @__PURE__ */ jsx(Text, { style: styles.caption, children: caption }) : null
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
75
91
|
}
|
|
76
92
|
var sheet = createStyleSheet((theme) => ({
|
|
77
93
|
root: { alignItems: "flex-start", gap: theme.space.s1 },
|