@btndprojects/loam-ui-native 0.1.0 → 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/README.md +56 -0
- 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-RGQWWKLA.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-FOKG57CR.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-WVKKJA6U.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-66SG2H23.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-FIF2M24N.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-DSJBXLUG.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,16 +1,24 @@
|
|
|
1
1
|
import { isConnectorTraversed, resolveStepState, NODE_STATE_ICON } from './chunk-YLLCXTMC.js';
|
|
2
|
-
import { Button } from './chunk-
|
|
3
|
-
import {
|
|
2
|
+
import { Button } from './chunk-E2E3I5W2.js';
|
|
3
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
4
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
5
|
+
import { useResolvedMotion, springConfig } from './chunk-J64KGCGX.js';
|
|
4
6
|
import * as React from 'react';
|
|
5
|
-
import { Animated, View, Text } from 'react-native';
|
|
7
|
+
import { Animated, AccessibilityInfo, View, Text } from 'react-native';
|
|
6
8
|
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
7
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
10
|
|
|
11
|
+
var DEFAULT_LABELS = {
|
|
12
|
+
back: "Back",
|
|
13
|
+
next: "Next",
|
|
14
|
+
finish: "Finish",
|
|
15
|
+
stepOf: (current, total, title) => `Step ${current} of ${total}${title ? `: ${title}` : ""}`
|
|
16
|
+
};
|
|
9
17
|
function clamp(n, lo, hi) {
|
|
10
18
|
return Math.min(hi, Math.max(lo, n));
|
|
11
19
|
}
|
|
12
20
|
function useDotForeground(done, active) {
|
|
13
|
-
const theme = useLoamTheme();
|
|
21
|
+
const theme = useLoamTheme("wizard");
|
|
14
22
|
if (done) return theme.color.goodInk;
|
|
15
23
|
if (active) return theme.color.accentOnSoft;
|
|
16
24
|
return theme.color.text3;
|
|
@@ -24,12 +32,19 @@ function StepDot({
|
|
|
24
32
|
const done = stepState === "done";
|
|
25
33
|
const active = stepState === "working";
|
|
26
34
|
const { styles } = useStyles(sheet, { state: done ? "done" : active ? "active" : "upcoming" });
|
|
27
|
-
const theme = useLoamTheme();
|
|
35
|
+
const theme = useLoamTheme("wizard");
|
|
28
36
|
const fg = useDotForeground(done, active);
|
|
29
37
|
const currentAttr = active ? { "aria-current": "step" } : {};
|
|
30
38
|
return /* @__PURE__ */ jsxs(View, { style: styles.dotCol, children: [
|
|
31
39
|
/* @__PURE__ */ jsx(View, { style: styles.dot, ...currentAttr, children: done ? /* @__PURE__ */ jsx(Icon, { name: NODE_STATE_ICON.done, size: theme.icon.sm, color: fg }) : /* @__PURE__ */ jsx(Text, { style: [styles.dotNum, { color: fg }], children: index + 1 }) }),
|
|
32
|
-
title ? /* @__PURE__ */ jsx(
|
|
40
|
+
title ? /* @__PURE__ */ jsx(
|
|
41
|
+
Text,
|
|
42
|
+
{
|
|
43
|
+
numberOfLines: 2,
|
|
44
|
+
style: [styles.dotLabel, { color: index <= current ? void 0 : fg }],
|
|
45
|
+
children: title
|
|
46
|
+
}
|
|
47
|
+
) : null
|
|
33
48
|
] });
|
|
34
49
|
}
|
|
35
50
|
function Wizard({
|
|
@@ -38,96 +53,102 @@ function Wizard({
|
|
|
38
53
|
defaultStep = 0,
|
|
39
54
|
onStepChange,
|
|
40
55
|
onFinish,
|
|
41
|
-
backLabel
|
|
42
|
-
nextLabel
|
|
43
|
-
finishLabel
|
|
44
|
-
motion = "full"
|
|
56
|
+
backLabel: backLabelProp,
|
|
57
|
+
nextLabel: nextLabelProp,
|
|
58
|
+
finishLabel: finishLabelProp,
|
|
59
|
+
motion = "full",
|
|
60
|
+
keepMounted = true,
|
|
61
|
+
onStepInvalid,
|
|
62
|
+
showHeader = true,
|
|
63
|
+
renderFooter,
|
|
64
|
+
labels: labelsProp
|
|
45
65
|
}) {
|
|
66
|
+
const labels = useLabels("wizard", DEFAULT_LABELS, labelsProp);
|
|
67
|
+
const backLabel = backLabelProp ?? labels.back;
|
|
68
|
+
const nextLabel = nextLabelProp ?? labels.next;
|
|
69
|
+
const finishLabel = finishLabelProp ?? labels.finish;
|
|
46
70
|
const isControlled = step !== void 0;
|
|
47
71
|
const last = Math.max(0, steps.length - 1);
|
|
48
72
|
const [internal, setInternal] = React.useState(() => clamp(defaultStep, 0, last));
|
|
49
73
|
const current = clamp(isControlled ? step : internal, 0, last);
|
|
50
74
|
const { styles } = useStyles(sheet);
|
|
51
|
-
const theme = useLoamTheme();
|
|
75
|
+
const theme = useLoamTheme("wizard");
|
|
52
76
|
const activeStep = steps[current];
|
|
53
77
|
const isFirst = current <= 0;
|
|
54
78
|
const isLast = current >= last;
|
|
55
79
|
const prev = React.useRef(current);
|
|
56
80
|
const opacity = React.useRef(new Animated.Value(1)).current;
|
|
57
81
|
const translateX = React.useRef(new Animated.Value(0)).current;
|
|
82
|
+
const level = useResolvedMotion(motion, "wizard");
|
|
58
83
|
React.useEffect(() => {
|
|
59
|
-
if (
|
|
60
|
-
|
|
84
|
+
if (prev.current === current) return;
|
|
85
|
+
const direction = current > prev.current ? 1 : -1;
|
|
86
|
+
prev.current = current;
|
|
87
|
+
AccessibilityInfo.announceForAccessibility?.(
|
|
88
|
+
labels.stepOf(current + 1, steps.length, steps[current]?.title)
|
|
89
|
+
);
|
|
90
|
+
if (level === "none") {
|
|
61
91
|
opacity.setValue(1);
|
|
62
92
|
translateX.setValue(0);
|
|
63
93
|
return;
|
|
64
94
|
}
|
|
65
|
-
const reduced = motion === "reduced" || theme.reduceMotion;
|
|
66
|
-
const direction = current >= prev.current ? 1 : -1;
|
|
67
|
-
prev.current = current;
|
|
68
95
|
opacity.setValue(0);
|
|
69
|
-
translateX.setValue(
|
|
96
|
+
translateX.setValue(level === "full" ? direction * theme.space.s6 : 0);
|
|
70
97
|
Animated.parallel([
|
|
71
|
-
Animated.
|
|
98
|
+
Animated.spring(opacity, {
|
|
99
|
+
...springConfig(theme, "de"),
|
|
72
100
|
toValue: 1,
|
|
73
|
-
duration: theme.duration.base,
|
|
74
101
|
useNativeDriver: true
|
|
75
102
|
}),
|
|
76
|
-
|
|
77
|
-
...reduced ? [] : [
|
|
103
|
+
...level === "full" ? [
|
|
78
104
|
Animated.spring(translateX, {
|
|
105
|
+
...springConfig(theme, "ds"),
|
|
79
106
|
toValue: 0,
|
|
80
|
-
useNativeDriver: true
|
|
81
|
-
speed: 18,
|
|
82
|
-
bounciness: 6
|
|
107
|
+
useNativeDriver: true
|
|
83
108
|
})
|
|
84
|
-
]
|
|
109
|
+
] : []
|
|
85
110
|
]).start();
|
|
86
|
-
}, [current,
|
|
111
|
+
}, [current, level, opacity, translateX, theme, steps]);
|
|
87
112
|
const goTo = (next) => {
|
|
88
113
|
const clamped = clamp(next, 0, last);
|
|
89
114
|
if (clamped === current) return;
|
|
90
115
|
if (!isControlled) setInternal(clamped);
|
|
91
116
|
onStepChange?.(clamped);
|
|
92
117
|
};
|
|
118
|
+
const visited = React.useRef(/* @__PURE__ */ new Set());
|
|
119
|
+
if (activeStep) visited.current.add(activeStep.key);
|
|
93
120
|
const onNext = () => {
|
|
121
|
+
if (activeStep?.validate && !activeStep.validate()) {
|
|
122
|
+
onStepInvalid?.(current);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
94
125
|
if (isLast) onFinish?.();
|
|
95
126
|
else goTo(current + 1);
|
|
96
127
|
};
|
|
97
128
|
return /* @__PURE__ */ jsxs(View, { style: styles.container, children: [
|
|
98
|
-
/* @__PURE__ */ jsx(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
)
|
|
124
|
-
) : null,
|
|
125
|
-
/* @__PURE__ */ jsx(StepDot, { index: i, current, title: s.title })
|
|
126
|
-
] }, s.key))
|
|
127
|
-
}
|
|
128
|
-
),
|
|
129
|
-
/* @__PURE__ */ jsx(Animated.View, { style: [styles.content, { opacity, transform: [{ translateX }] }], children: activeStep?.content }),
|
|
130
|
-
/* @__PURE__ */ jsxs(View, { style: styles.footer, children: [
|
|
129
|
+
showHeader ? /* @__PURE__ */ jsx(WizardSteps, { steps, current }) : null,
|
|
130
|
+
/* @__PURE__ */ jsx(Animated.View, { style: [styles.content, { opacity, transform: [{ translateX }] }], children: steps.map((s, i) => {
|
|
131
|
+
const isActive = i === current;
|
|
132
|
+
if (!isActive && !(keepMounted && visited.current.has(s.key))) return null;
|
|
133
|
+
return /* @__PURE__ */ jsx(
|
|
134
|
+
View,
|
|
135
|
+
{
|
|
136
|
+
style: isActive ? void 0 : styles.hiddenStep,
|
|
137
|
+
"aria-hidden": isActive ? void 0 : true,
|
|
138
|
+
importantForAccessibility: isActive ? "auto" : "no-hide-descendants",
|
|
139
|
+
children: s.content
|
|
140
|
+
},
|
|
141
|
+
s.key
|
|
142
|
+
);
|
|
143
|
+
}) }),
|
|
144
|
+
renderFooter ? renderFooter({
|
|
145
|
+
index: current,
|
|
146
|
+
count: steps.length,
|
|
147
|
+
isFirst,
|
|
148
|
+
isLast,
|
|
149
|
+
next: onNext,
|
|
150
|
+
back: () => goTo(current - 1)
|
|
151
|
+
}) : /* @__PURE__ */ jsxs(View, { style: styles.footer, children: [
|
|
131
152
|
/* @__PURE__ */ jsx(
|
|
132
153
|
Button,
|
|
133
154
|
{
|
|
@@ -138,11 +159,61 @@ function Wizard({
|
|
|
138
159
|
children: backLabel
|
|
139
160
|
}
|
|
140
161
|
),
|
|
141
|
-
/* @__PURE__ */ jsx(
|
|
162
|
+
/* @__PURE__ */ jsx(
|
|
163
|
+
Button,
|
|
164
|
+
{
|
|
165
|
+
variant: "primary",
|
|
166
|
+
trailingIcon: isLast ? "check" : "arrow-right",
|
|
167
|
+
onPress: onNext,
|
|
168
|
+
children: isLast ? finishLabel : nextLabel
|
|
169
|
+
}
|
|
170
|
+
)
|
|
142
171
|
] })
|
|
143
172
|
] });
|
|
144
173
|
}
|
|
174
|
+
function WizardSteps({
|
|
175
|
+
steps,
|
|
176
|
+
current,
|
|
177
|
+
labels: labelsProp
|
|
178
|
+
}) {
|
|
179
|
+
const { styles } = useStyles(sheet);
|
|
180
|
+
const labels = useLabels("wizard", DEFAULT_LABELS, labelsProp);
|
|
181
|
+
const theme = useLoamTheme("wizard");
|
|
182
|
+
const activeStep = steps[current];
|
|
183
|
+
return /* @__PURE__ */ jsx(
|
|
184
|
+
View,
|
|
185
|
+
{
|
|
186
|
+
style: styles.rail,
|
|
187
|
+
accessibilityRole: "progressbar",
|
|
188
|
+
accessibilityLabel: labels.stepOf(current + 1, steps.length, activeStep?.title),
|
|
189
|
+
accessibilityValue: { min: 1, max: steps.length, now: current + 1 },
|
|
190
|
+
"aria-valuemin": 1,
|
|
191
|
+
"aria-valuemax": steps.length,
|
|
192
|
+
"aria-valuenow": current + 1,
|
|
193
|
+
children: steps.map((s, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
194
|
+
i > 0 ? (
|
|
195
|
+
// The connector carries the state: solid in the done tone once the
|
|
196
|
+
// step it leaves has been traversed, muted otherwise — the shared
|
|
197
|
+
// rule, and the same green the completed dots now use.
|
|
198
|
+
/* @__PURE__ */ jsx(
|
|
199
|
+
View,
|
|
200
|
+
{
|
|
201
|
+
style: [
|
|
202
|
+
styles.line,
|
|
203
|
+
{
|
|
204
|
+
backgroundColor: isConnectorTraversed(resolveStepState(i - 1, current)) ? theme.color.good : theme.color.surface3
|
|
205
|
+
}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
) : null,
|
|
210
|
+
/* @__PURE__ */ jsx(StepDot, { index: i, current, title: s.title })
|
|
211
|
+
] }, s.key))
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
}
|
|
145
215
|
var sheet = createStyleSheet((theme) => ({
|
|
216
|
+
hiddenStep: { display: "none" },
|
|
146
217
|
// The wizard owns its own gutter: it is a whole flow, not a control dropped
|
|
147
218
|
// into someone else's padded box, and without one the footer buttons sat flush
|
|
148
219
|
// against whatever container it was placed in.
|
|
@@ -226,4 +297,4 @@ var sheet = createStyleSheet((theme) => ({
|
|
|
226
297
|
}
|
|
227
298
|
}));
|
|
228
299
|
|
|
229
|
-
export { Wizard };
|
|
300
|
+
export { Wizard, WizardSteps };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
2
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { View, Text, Pressable, Animated, Easing, PanResponder } from 'react-native';
|
|
4
5
|
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
@@ -19,28 +20,49 @@ var SEVERITY_DURATION = {
|
|
|
19
20
|
function severityColors(theme, severity) {
|
|
20
21
|
switch (severity) {
|
|
21
22
|
case "success":
|
|
22
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
accent: theme.color.good,
|
|
25
|
+
glyph: theme.color.goodOnSoft,
|
|
26
|
+
soft: theme.color.goodSoft,
|
|
27
|
+
edge: theme.edge.good
|
|
28
|
+
};
|
|
23
29
|
case "warning":
|
|
24
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
accent: theme.color.warn,
|
|
32
|
+
glyph: theme.color.warnOnSoft,
|
|
33
|
+
soft: theme.color.warnSoft,
|
|
34
|
+
edge: theme.edge.warn
|
|
35
|
+
};
|
|
25
36
|
case "error":
|
|
26
37
|
return {
|
|
38
|
+
accent: theme.color.danger,
|
|
27
39
|
glyph: theme.color.dangerOnSoft,
|
|
28
40
|
soft: theme.color.dangerSoft,
|
|
29
41
|
edge: theme.edge.danger
|
|
30
42
|
};
|
|
31
43
|
default:
|
|
32
|
-
return {
|
|
44
|
+
return {
|
|
45
|
+
accent: theme.color.info,
|
|
46
|
+
glyph: theme.color.infoOnSoft,
|
|
47
|
+
soft: theme.color.infoSoft,
|
|
48
|
+
edge: theme.edge.info
|
|
49
|
+
};
|
|
33
50
|
}
|
|
34
51
|
}
|
|
52
|
+
var DEFAULT_LABELS = {
|
|
53
|
+
dismiss: "Dismiss"
|
|
54
|
+
};
|
|
35
55
|
function ToastCard({
|
|
36
56
|
message,
|
|
37
57
|
severity = "info",
|
|
38
58
|
action,
|
|
39
59
|
countdown,
|
|
40
|
-
onPress
|
|
60
|
+
onPress,
|
|
61
|
+
labels: labelsProp
|
|
41
62
|
}) {
|
|
63
|
+
const labels = useLabels("toast", DEFAULT_LABELS, labelsProp);
|
|
42
64
|
const { styles } = useStyles(sheet);
|
|
43
|
-
const theme = useLoamTheme();
|
|
65
|
+
const theme = useLoamTheme("toast");
|
|
44
66
|
const colors = severityColors(theme, severity);
|
|
45
67
|
const actionHitSlop = Math.max(0, Math.round((theme.tapMin - theme.ctl.sm) / 2));
|
|
46
68
|
const copy = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -55,32 +77,41 @@ function ToastCard({
|
|
|
55
77
|
),
|
|
56
78
|
/* @__PURE__ */ jsx(Text, { style: styles.message, children: message })
|
|
57
79
|
] });
|
|
58
|
-
return /* @__PURE__ */ jsxs(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
View,
|
|
82
|
+
{
|
|
83
|
+
style: [
|
|
84
|
+
styles.card,
|
|
85
|
+
{ borderStartColor: colors.accent, borderStartWidth: theme.borderWidth.heavy }
|
|
86
|
+
],
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxs(View, { style: styles.body, children: [
|
|
89
|
+
onPress ? /* @__PURE__ */ jsx(
|
|
90
|
+
Pressable,
|
|
91
|
+
{
|
|
92
|
+
accessibilityRole: "button",
|
|
93
|
+
accessibilityLabel: labels.dismiss,
|
|
94
|
+
onPress,
|
|
95
|
+
style: styles.copyRegion,
|
|
96
|
+
children: copy
|
|
97
|
+
}
|
|
98
|
+
) : /* @__PURE__ */ jsx(View, { style: styles.copyRegion, children: copy }),
|
|
99
|
+
action ? /* @__PURE__ */ jsx(
|
|
100
|
+
Pressable,
|
|
101
|
+
{
|
|
102
|
+
accessibilityRole: "button",
|
|
103
|
+
accessibilityLabel: action.label,
|
|
104
|
+
onPress: action.onPress,
|
|
105
|
+
hitSlop: actionHitSlop,
|
|
106
|
+
style: styles.action,
|
|
107
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles.actionLabel, children: action.label })
|
|
108
|
+
}
|
|
109
|
+
) : null
|
|
110
|
+
] }),
|
|
111
|
+
countdown ? /* @__PURE__ */ jsx(View, { style: styles.countdownTrack, children: countdown }) : null
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
);
|
|
84
115
|
}
|
|
85
116
|
var TRAVEL = 12;
|
|
86
117
|
function Toast({
|
|
@@ -92,9 +123,10 @@ function Toast({
|
|
|
92
123
|
onDismiss,
|
|
93
124
|
countdown = false,
|
|
94
125
|
motion = "full",
|
|
95
|
-
safeAreaTop = 0
|
|
126
|
+
safeAreaTop = 0,
|
|
127
|
+
labels
|
|
96
128
|
}) {
|
|
97
|
-
const theme = useLoamTheme();
|
|
129
|
+
const theme = useLoamTheme("toast");
|
|
98
130
|
const { styles } = useStyles(sheet);
|
|
99
131
|
const reduced = theme.reduceMotion || motion === "reduced";
|
|
100
132
|
const instant = motion === "none";
|
|
@@ -229,7 +261,8 @@ function Toast({
|
|
|
229
261
|
severity,
|
|
230
262
|
action,
|
|
231
263
|
countdown: bar,
|
|
232
|
-
onPress: requestDismiss
|
|
264
|
+
onPress: requestDismiss,
|
|
265
|
+
labels
|
|
233
266
|
}
|
|
234
267
|
)
|
|
235
268
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Icon } from './chunk-
|
|
1
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
2
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
3
|
+
import { useResolvedMotion } from './chunk-J64KGCGX.js';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { Animated, PanResponder, Pressable, View, Text, Easing } from 'react-native';
|
|
5
6
|
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
@@ -50,6 +51,13 @@ function touchDistance(e) {
|
|
|
50
51
|
if (!a || !b) return 0;
|
|
51
52
|
return Math.hypot(a.pageX - b.pageX, a.pageY - b.pageY);
|
|
52
53
|
}
|
|
54
|
+
var DEFAULT_LABELS = {
|
|
55
|
+
zoomIn: "Zoom in",
|
|
56
|
+
zoomOut: "Zoom out",
|
|
57
|
+
recenter: "Recenter",
|
|
58
|
+
attribution: "\xA9 map data",
|
|
59
|
+
placeAction: (action, name) => `${action}, ${name}`
|
|
60
|
+
};
|
|
53
61
|
function BaseLayer({ width, height }) {
|
|
54
62
|
const { styles } = useStyles(sheet);
|
|
55
63
|
const columns = width > 0 ? Math.floor((width - SPEC.gridW) / SPEC.gridX) : 6;
|
|
@@ -66,7 +74,8 @@ function MapView({
|
|
|
66
74
|
activePinId,
|
|
67
75
|
onSelectPin,
|
|
68
76
|
place,
|
|
69
|
-
attribution
|
|
77
|
+
attribution: attributionProp,
|
|
78
|
+
labels: labelsProp,
|
|
70
79
|
onZoomIn,
|
|
71
80
|
onZoomOut,
|
|
72
81
|
onRecenter,
|
|
@@ -77,9 +86,11 @@ function MapView({
|
|
|
77
86
|
motion = "full",
|
|
78
87
|
children
|
|
79
88
|
}) {
|
|
89
|
+
const labels = useLabels("mapView", DEFAULT_LABELS, labelsProp);
|
|
90
|
+
const attribution = attributionProp ?? labels.attribution;
|
|
80
91
|
const { styles } = useStyles(sheet);
|
|
81
|
-
const theme = useLoamTheme();
|
|
82
|
-
const animateZoom = useResolvedMotion(motion) === "full";
|
|
92
|
+
const theme = useLoamTheme("map-view");
|
|
93
|
+
const animateZoom = useResolvedMotion(motion, "map-view") === "full";
|
|
83
94
|
const animateZoomRef = React.useRef(animateZoom);
|
|
84
95
|
animateZoomRef.current = animateZoom;
|
|
85
96
|
const [viewport, setViewport] = React.useState({ width: 0, height: 0 });
|
|
@@ -178,7 +189,7 @@ function MapView({
|
|
|
178
189
|
const controls = [
|
|
179
190
|
{
|
|
180
191
|
icon: "plus",
|
|
181
|
-
label:
|
|
192
|
+
label: labels.zoomIn,
|
|
182
193
|
handler: onZoomIn,
|
|
183
194
|
onPress: () => {
|
|
184
195
|
zoomTo(zoom.current * ZOOM.step, true);
|
|
@@ -187,7 +198,7 @@ function MapView({
|
|
|
187
198
|
},
|
|
188
199
|
{
|
|
189
200
|
icon: "minus",
|
|
190
|
-
label:
|
|
201
|
+
label: labels.zoomOut,
|
|
191
202
|
handler: onZoomOut,
|
|
192
203
|
onPress: () => {
|
|
193
204
|
zoomTo(zoom.current / ZOOM.step, true);
|
|
@@ -196,7 +207,7 @@ function MapView({
|
|
|
196
207
|
},
|
|
197
208
|
{
|
|
198
209
|
icon: "navigation",
|
|
199
|
-
label:
|
|
210
|
+
label: labels.recenter,
|
|
200
211
|
handler: onRecenter,
|
|
201
212
|
onPress: recenter
|
|
202
213
|
}
|
|
@@ -265,7 +276,7 @@ function MapView({
|
|
|
265
276
|
Pressable,
|
|
266
277
|
{
|
|
267
278
|
accessibilityRole: "button",
|
|
268
|
-
accessibilityLabel:
|
|
279
|
+
accessibilityLabel: labels.placeAction(place.actionLabel, place.name),
|
|
269
280
|
onPress: place.onAction,
|
|
270
281
|
hitSlop: Math.max(0, (theme.hit.md - theme.ctl.md) / 2),
|
|
271
282
|
style: styles.cardAction,
|