@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
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { Sheet } from './chunk-QYPE5JX3.js';
|
|
2
|
+
import { expandedProps } from './chunk-W23G6JLF.js';
|
|
3
|
+
import { Button } from './chunk-E2E3I5W2.js';
|
|
4
|
+
import { haptics } from './chunk-NY2U3PBI.js';
|
|
5
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
6
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
7
|
+
import { useResolvedMotion } from './chunk-J64KGCGX.js';
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { Animated, Platform, View, Text, Pressable } from 'react-native';
|
|
10
|
+
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
11
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var MIN_SCALE = 0.85;
|
|
14
|
+
var TILT = 50;
|
|
15
|
+
function WheelPicker({
|
|
16
|
+
items,
|
|
17
|
+
value,
|
|
18
|
+
onValueChange,
|
|
19
|
+
visibleRows = 5,
|
|
20
|
+
accessibilityLabel,
|
|
21
|
+
motion = "full",
|
|
22
|
+
style,
|
|
23
|
+
testID
|
|
24
|
+
}) {
|
|
25
|
+
const theme = useLoamTheme("picker");
|
|
26
|
+
const { styles } = useStyles(sheet);
|
|
27
|
+
const level = useResolvedMotion(motion, "picker");
|
|
28
|
+
const row = theme.tapMin;
|
|
29
|
+
const pad = row * (visibleRows - 1) / 2;
|
|
30
|
+
const selectedIndex = Math.max(
|
|
31
|
+
0,
|
|
32
|
+
items.findIndex((item) => item.value === value)
|
|
33
|
+
);
|
|
34
|
+
const scrollY = React.useRef(new Animated.Value(selectedIndex * row)).current;
|
|
35
|
+
const scroller = React.useRef(null);
|
|
36
|
+
const live = React.useRef(selectedIndex);
|
|
37
|
+
const settled = React.useRef(selectedIndex);
|
|
38
|
+
const indexAt = (y) => Math.min(items.length - 1, Math.max(0, Math.round(y / row)));
|
|
39
|
+
React.useLayoutEffect(() => {
|
|
40
|
+
if (Platform.OS === "web")
|
|
41
|
+
scroller.current?.scrollTo({ y: selectedIndex * row, animated: false });
|
|
42
|
+
}, []);
|
|
43
|
+
React.useEffect(() => {
|
|
44
|
+
if (selectedIndex === settled.current) return;
|
|
45
|
+
settled.current = selectedIndex;
|
|
46
|
+
live.current = selectedIndex;
|
|
47
|
+
scroller.current?.scrollTo({ y: selectedIndex * row, animated: level === "full" });
|
|
48
|
+
}, [selectedIndex, row, level]);
|
|
49
|
+
const commit = (index) => {
|
|
50
|
+
settled.current = index;
|
|
51
|
+
const item = items[index];
|
|
52
|
+
if (item && item.value !== value) onValueChange?.(item.value);
|
|
53
|
+
};
|
|
54
|
+
const onScroll = Animated.event([{ nativeEvent: { contentOffset: { y: scrollY } } }], {
|
|
55
|
+
useNativeDriver: true,
|
|
56
|
+
listener: (e) => {
|
|
57
|
+
const i = indexAt(e.nativeEvent.contentOffset.y);
|
|
58
|
+
if (i !== live.current) {
|
|
59
|
+
live.current = i;
|
|
60
|
+
haptics.selection();
|
|
61
|
+
}
|
|
62
|
+
if (idle.current) clearTimeout(idle.current);
|
|
63
|
+
idle.current = setTimeout(() => commit(i), 150);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
const idle = React.useRef(null);
|
|
67
|
+
React.useEffect(
|
|
68
|
+
() => () => {
|
|
69
|
+
if (idle.current) clearTimeout(idle.current);
|
|
70
|
+
},
|
|
71
|
+
[]
|
|
72
|
+
);
|
|
73
|
+
const onEnd = (e) => {
|
|
74
|
+
if (idle.current) clearTimeout(idle.current);
|
|
75
|
+
commit(indexAt(e.nativeEvent.contentOffset.y));
|
|
76
|
+
};
|
|
77
|
+
const step = (delta) => {
|
|
78
|
+
const next = Math.min(items.length - 1, Math.max(0, settled.current + delta));
|
|
79
|
+
if (next === settled.current) return;
|
|
80
|
+
haptics.selection();
|
|
81
|
+
live.current = next;
|
|
82
|
+
scroller.current?.scrollTo({ y: next * row, animated: level === "full" });
|
|
83
|
+
commit(next);
|
|
84
|
+
};
|
|
85
|
+
const current = items[selectedIndex];
|
|
86
|
+
return /* @__PURE__ */ jsxs(
|
|
87
|
+
View,
|
|
88
|
+
{
|
|
89
|
+
testID,
|
|
90
|
+
accessible: true,
|
|
91
|
+
accessibilityRole: "adjustable",
|
|
92
|
+
accessibilityLabel,
|
|
93
|
+
accessibilityValue: { text: current?.label },
|
|
94
|
+
...{ role: "slider", "aria-valuetext": current?.label },
|
|
95
|
+
accessibilityActions: [{ name: "increment" }, { name: "decrement" }],
|
|
96
|
+
onAccessibilityAction: (e) => step(e.nativeEvent.actionName === "increment" ? 1 : -1),
|
|
97
|
+
style: [styles.wheel, { height: row * visibleRows }, style],
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ jsx(View, { pointerEvents: "none", style: [styles.band, { top: pad, height: row }] }),
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
101
|
+
Animated.ScrollView,
|
|
102
|
+
{
|
|
103
|
+
ref: scroller,
|
|
104
|
+
showsVerticalScrollIndicator: false,
|
|
105
|
+
snapToInterval: row,
|
|
106
|
+
decelerationRate: "fast",
|
|
107
|
+
contentOffset: { x: 0, y: selectedIndex * row },
|
|
108
|
+
contentContainerStyle: { paddingVertical: pad },
|
|
109
|
+
scrollEventThrottle: 16,
|
|
110
|
+
onScroll,
|
|
111
|
+
onMomentumScrollEnd: onEnd,
|
|
112
|
+
style: Platform.OS === "web" ? { scrollSnapType: "y mandatory" } : void 0,
|
|
113
|
+
...{ "aria-hidden": true },
|
|
114
|
+
children: items.map((item, i) => {
|
|
115
|
+
const at = i * row;
|
|
116
|
+
const range = [at - 2 * row, at - row, at, at + row, at + 2 * row];
|
|
117
|
+
const opacity = scrollY.interpolate({
|
|
118
|
+
inputRange: range,
|
|
119
|
+
outputRange: [0.3, 0.6, 1, 0.6, 0.3],
|
|
120
|
+
extrapolate: "clamp"
|
|
121
|
+
});
|
|
122
|
+
const turn = level === "full" ? [
|
|
123
|
+
{ perspective: row * 8 },
|
|
124
|
+
{
|
|
125
|
+
rotateX: scrollY.interpolate({
|
|
126
|
+
inputRange: range,
|
|
127
|
+
outputRange: [
|
|
128
|
+
`${-TILT}deg`,
|
|
129
|
+
`${-TILT / 2}deg`,
|
|
130
|
+
"0deg",
|
|
131
|
+
`${TILT / 2}deg`,
|
|
132
|
+
`${TILT}deg`
|
|
133
|
+
],
|
|
134
|
+
extrapolate: "clamp"
|
|
135
|
+
})
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
scale: scrollY.interpolate({
|
|
139
|
+
inputRange: range,
|
|
140
|
+
outputRange: [
|
|
141
|
+
MIN_SCALE,
|
|
142
|
+
(1 + MIN_SCALE) / 2,
|
|
143
|
+
1,
|
|
144
|
+
(1 + MIN_SCALE) / 2,
|
|
145
|
+
MIN_SCALE
|
|
146
|
+
],
|
|
147
|
+
extrapolate: "clamp"
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
] : [];
|
|
151
|
+
return /* @__PURE__ */ jsx(
|
|
152
|
+
Animated.View,
|
|
153
|
+
{
|
|
154
|
+
style: [
|
|
155
|
+
styles.row,
|
|
156
|
+
{ height: row, opacity, transform: turn },
|
|
157
|
+
Platform.OS === "web" ? { scrollSnapAlign: "center" } : null
|
|
158
|
+
],
|
|
159
|
+
children: /* @__PURE__ */ jsx(
|
|
160
|
+
Text,
|
|
161
|
+
{
|
|
162
|
+
style: [styles.label, i === selectedIndex && styles.labelSelected],
|
|
163
|
+
numberOfLines: 1,
|
|
164
|
+
children: item.label
|
|
165
|
+
}
|
|
166
|
+
)
|
|
167
|
+
},
|
|
168
|
+
item.value
|
|
169
|
+
);
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
var sheet = createStyleSheet((theme) => ({
|
|
178
|
+
wheel: { alignSelf: "stretch", overflow: "hidden" },
|
|
179
|
+
band: {
|
|
180
|
+
position: "absolute",
|
|
181
|
+
left: 0,
|
|
182
|
+
right: 0,
|
|
183
|
+
borderRadius: theme.radius.md,
|
|
184
|
+
backgroundColor: theme.color.accentSoft,
|
|
185
|
+
// The tint collapses to the surface under `contrast: 'more'`, where
|
|
186
|
+
// `edge.accent` turns opaque and keeps the selection band drawn.
|
|
187
|
+
borderWidth: theme.borderWidth.base,
|
|
188
|
+
borderColor: theme.edge.accent
|
|
189
|
+
},
|
|
190
|
+
row: { alignItems: "center", justifyContent: "center" },
|
|
191
|
+
label: {
|
|
192
|
+
fontFamily: theme.font.sans,
|
|
193
|
+
fontSize: theme.fontSize[20],
|
|
194
|
+
color: theme.color.text
|
|
195
|
+
},
|
|
196
|
+
labelSelected: { fontWeight: theme.fontWeight.semibold, color: theme.color.accentOnSoft }
|
|
197
|
+
}));
|
|
198
|
+
var DEFAULT_LABELS = {
|
|
199
|
+
select: "Select\u2026",
|
|
200
|
+
done: "Done"
|
|
201
|
+
};
|
|
202
|
+
function Picker({
|
|
203
|
+
items,
|
|
204
|
+
value,
|
|
205
|
+
onValueChange,
|
|
206
|
+
placeholder: placeholderProp,
|
|
207
|
+
title,
|
|
208
|
+
disabled = false,
|
|
209
|
+
size = "md",
|
|
210
|
+
accessibilityLabel,
|
|
211
|
+
variant = "list",
|
|
212
|
+
motion = "full",
|
|
213
|
+
labels: labelsProp
|
|
214
|
+
}) {
|
|
215
|
+
const labels = useLabels("picker", DEFAULT_LABELS, labelsProp);
|
|
216
|
+
const placeholder = placeholderProp ?? labels.select;
|
|
217
|
+
const [open, setOpen] = React.useState(false);
|
|
218
|
+
const [draft, setDraft] = React.useState(value);
|
|
219
|
+
React.useEffect(() => {
|
|
220
|
+
if (open) setDraft(value ?? items[0]?.value);
|
|
221
|
+
}, [open]);
|
|
222
|
+
const theme = useLoamTheme("picker");
|
|
223
|
+
const selected = items.find((item) => item.value === value);
|
|
224
|
+
const isPlaceholder = selected == null;
|
|
225
|
+
const displayText = selected?.label ?? placeholder;
|
|
226
|
+
const { styles } = useStyles(sheet2, { size, disabled, placeholder: isPlaceholder });
|
|
227
|
+
const iconSize = theme.ctl.icon[size];
|
|
228
|
+
const slopY = Math.max(0, (theme.hit[size] - theme.ctl[size]) / 2);
|
|
229
|
+
const handleSelect = (next) => {
|
|
230
|
+
haptics.selection();
|
|
231
|
+
onValueChange?.(next);
|
|
232
|
+
setOpen(false);
|
|
233
|
+
};
|
|
234
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
235
|
+
/* @__PURE__ */ jsxs(
|
|
236
|
+
Pressable,
|
|
237
|
+
{
|
|
238
|
+
accessibilityRole: "button",
|
|
239
|
+
accessibilityLabel: accessibilityLabel ? `${accessibilityLabel}, ${displayText}` : displayText,
|
|
240
|
+
accessibilityState: { disabled, expanded: open },
|
|
241
|
+
...expandedProps(open),
|
|
242
|
+
disabled,
|
|
243
|
+
onPress: disabled ? void 0 : () => setOpen(true),
|
|
244
|
+
hitSlop: { top: slopY, bottom: slopY },
|
|
245
|
+
style: styles.trigger,
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ jsx(Text, { style: styles.value, numberOfLines: 1, children: displayText }),
|
|
248
|
+
/* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: iconSize, color: theme.color.text3 })
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
/* @__PURE__ */ jsxs(
|
|
253
|
+
Sheet,
|
|
254
|
+
{
|
|
255
|
+
open,
|
|
256
|
+
onClose: () => setOpen(false),
|
|
257
|
+
title,
|
|
258
|
+
footer: variant === "wheel" ? /* @__PURE__ */ jsx(
|
|
259
|
+
Button,
|
|
260
|
+
{
|
|
261
|
+
fullWidth: true,
|
|
262
|
+
onPress: () => {
|
|
263
|
+
if (draft != null && draft !== value) onValueChange?.(draft);
|
|
264
|
+
setOpen(false);
|
|
265
|
+
},
|
|
266
|
+
children: labels.done
|
|
267
|
+
}
|
|
268
|
+
) : void 0,
|
|
269
|
+
children: [
|
|
270
|
+
variant === "wheel" ? /* @__PURE__ */ jsx(
|
|
271
|
+
WheelPicker,
|
|
272
|
+
{
|
|
273
|
+
items,
|
|
274
|
+
value: draft,
|
|
275
|
+
onValueChange: setDraft,
|
|
276
|
+
accessibilityLabel: title ?? accessibilityLabel ?? placeholder,
|
|
277
|
+
motion
|
|
278
|
+
}
|
|
279
|
+
) : null,
|
|
280
|
+
variant === "wheel" ? null : items.map((item) => {
|
|
281
|
+
const isSelected = item.value === value;
|
|
282
|
+
return /* @__PURE__ */ jsxs(
|
|
283
|
+
Pressable,
|
|
284
|
+
{
|
|
285
|
+
accessibilityRole: "button",
|
|
286
|
+
accessibilityLabel: item.label,
|
|
287
|
+
accessibilityState: { selected: isSelected },
|
|
288
|
+
onPress: () => handleSelect(item.value),
|
|
289
|
+
style: ({ pressed }) => [
|
|
290
|
+
styles.option,
|
|
291
|
+
isSelected ? styles.optionSelected : null,
|
|
292
|
+
pressed ? styles.optionPressed : null
|
|
293
|
+
],
|
|
294
|
+
children: [
|
|
295
|
+
/* @__PURE__ */ jsx(
|
|
296
|
+
Text,
|
|
297
|
+
{
|
|
298
|
+
style: [styles.optionLabel, isSelected ? styles.optionLabelSelected : null],
|
|
299
|
+
children: item.label
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
isSelected ? /* @__PURE__ */ jsx(Icon, { name: "check", size: theme.icon.md, color: theme.color.accentOnSoft }) : null
|
|
303
|
+
]
|
|
304
|
+
},
|
|
305
|
+
item.value
|
|
306
|
+
);
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
] });
|
|
312
|
+
}
|
|
313
|
+
var sheet2 = createStyleSheet((theme) => ({
|
|
314
|
+
trigger: {
|
|
315
|
+
flexDirection: "row",
|
|
316
|
+
alignItems: "center",
|
|
317
|
+
backgroundColor: theme.color.surface2,
|
|
318
|
+
// The reference draws a `1.5px` field edge — the static `w2` weight.
|
|
319
|
+
borderWidth: theme.borderWidth.thick,
|
|
320
|
+
borderColor: theme.color.borderStrong,
|
|
321
|
+
variants: {
|
|
322
|
+
// Height, padding, gap and corner radius all resolve from one control-size
|
|
323
|
+
// tier (26 / 30 / 36 / 44), matching {@link Input}.
|
|
324
|
+
size: {
|
|
325
|
+
xs: {
|
|
326
|
+
height: theme.ctl.xs,
|
|
327
|
+
paddingHorizontal: theme.ctl.px.xs,
|
|
328
|
+
gap: theme.ctl.gap.xs,
|
|
329
|
+
borderRadius: theme.ctl.r.xs
|
|
330
|
+
},
|
|
331
|
+
sm: {
|
|
332
|
+
height: theme.ctl.sm,
|
|
333
|
+
paddingHorizontal: theme.ctl.px.sm,
|
|
334
|
+
gap: theme.ctl.gap.sm,
|
|
335
|
+
borderRadius: theme.ctl.r.sm
|
|
336
|
+
},
|
|
337
|
+
md: {
|
|
338
|
+
height: theme.ctl.md,
|
|
339
|
+
paddingHorizontal: theme.ctl.px.md,
|
|
340
|
+
gap: theme.ctl.gap.md,
|
|
341
|
+
borderRadius: theme.ctl.r.md
|
|
342
|
+
},
|
|
343
|
+
lg: {
|
|
344
|
+
height: theme.ctl.lg,
|
|
345
|
+
paddingHorizontal: theme.ctl.px.lg,
|
|
346
|
+
gap: theme.ctl.gap.lg,
|
|
347
|
+
borderRadius: theme.ctl.r.lg
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
disabled: {
|
|
351
|
+
true: { opacity: theme.state.disabledOpacity },
|
|
352
|
+
false: {}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
value: {
|
|
357
|
+
flex: 1,
|
|
358
|
+
fontFamily: theme.font.sans,
|
|
359
|
+
variants: {
|
|
360
|
+
size: {
|
|
361
|
+
xs: { fontSize: theme.fontSize[14] },
|
|
362
|
+
sm: { fontSize: theme.fontSize[14] },
|
|
363
|
+
md: { fontSize: theme.fontSize[16] },
|
|
364
|
+
lg: { fontSize: theme.fontSize[16] }
|
|
365
|
+
},
|
|
366
|
+
placeholder: {
|
|
367
|
+
true: { color: theme.color.text3 },
|
|
368
|
+
false: { color: theme.color.text }
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
option: {
|
|
373
|
+
flexDirection: "row",
|
|
374
|
+
alignItems: "center",
|
|
375
|
+
gap: theme.space.s3,
|
|
376
|
+
minHeight: theme.space[48],
|
|
377
|
+
paddingHorizontal: theme.space.s3,
|
|
378
|
+
paddingVertical: theme.space.s2,
|
|
379
|
+
borderRadius: theme.radius.md,
|
|
380
|
+
// Every row carries the edge weight so selecting one does not shift the text.
|
|
381
|
+
borderWidth: theme.borderWidth.base,
|
|
382
|
+
borderColor: "transparent"
|
|
383
|
+
},
|
|
384
|
+
// The reference's selection band: an `accentSoft` `radius.md` plate behind the
|
|
385
|
+
// centred option. `-soft` tints collapse at high contrast, so it carries the
|
|
386
|
+
// matching tone edge.
|
|
387
|
+
optionSelected: {
|
|
388
|
+
backgroundColor: theme.color.accentSoft,
|
|
389
|
+
borderWidth: theme.borderWidth.base,
|
|
390
|
+
borderColor: theme.edge.accent
|
|
391
|
+
},
|
|
392
|
+
optionPressed: { backgroundColor: theme.color.surface2 },
|
|
393
|
+
optionLabel: {
|
|
394
|
+
flex: 1,
|
|
395
|
+
fontFamily: theme.font.sans,
|
|
396
|
+
fontSize: theme.fontSize[16],
|
|
397
|
+
color: theme.color.text2
|
|
398
|
+
},
|
|
399
|
+
optionLabelSelected: {
|
|
400
|
+
fontWeight: theme.fontWeight.semibold,
|
|
401
|
+
color: theme.color.accentOnSoft
|
|
402
|
+
}
|
|
403
|
+
}));
|
|
404
|
+
|
|
405
|
+
export { Picker, WheelPicker };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Skeleton } from './chunk-
|
|
2
|
-
import { CardBrandMark, OrDivider } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Skeleton } from './chunk-PNF3NKB5.js';
|
|
2
|
+
import { DEFAULT_LABELS, CardBrandMark, OrDivider } from './chunk-ROCUG24E.js';
|
|
3
|
+
import { usePayLabels } from './chunk-GEIGMWNF.js';
|
|
4
|
+
import { Badge } from './chunk-TN2ZNJUI.js';
|
|
5
|
+
import { Button } from './chunk-E2E3I5W2.js';
|
|
6
|
+
import { useLabels, useLoamLocale } from './chunk-APCWFOZW.js';
|
|
5
7
|
import 'react';
|
|
6
8
|
import { View, Text } from 'react-native';
|
|
7
9
|
import { createStyleSheet, useStyles } from '@btndprojects/loam-theme-native';
|
|
8
|
-
import { mask, methodsFor } from '@btndprojects/loam-pay';
|
|
10
|
+
import { mask, methodsFor, methodText } from '@btndprojects/loam-pay';
|
|
9
11
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
10
12
|
|
|
11
13
|
function SavedCardChip({
|
|
@@ -15,22 +17,24 @@ function SavedCardChip({
|
|
|
15
17
|
isDefault = false,
|
|
16
18
|
onUseAnother,
|
|
17
19
|
onManage,
|
|
18
|
-
useAnotherLabel
|
|
19
|
-
manageLabel
|
|
20
|
+
useAnotherLabel,
|
|
21
|
+
manageLabel,
|
|
22
|
+
labels: labelsProp,
|
|
20
23
|
style,
|
|
21
24
|
testID
|
|
22
25
|
}) {
|
|
26
|
+
const labels = useLabels("paymentMethod", DEFAULT_LABELS, labelsProp);
|
|
23
27
|
const { styles } = useStyles(sheet);
|
|
24
28
|
return /* @__PURE__ */ jsxs(View, { testID, style: [styles.chip, style], children: [
|
|
25
29
|
/* @__PURE__ */ jsxs(View, { style: styles.chipFacts, children: [
|
|
26
|
-
/* @__PURE__ */ jsx(CardBrandMark, { brand, size: "md" }),
|
|
30
|
+
/* @__PURE__ */ jsx(CardBrandMark, { brand, size: "md", labels: labelsProp }),
|
|
27
31
|
/* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.chipMask, children: mask(brand, last4) }),
|
|
28
|
-
expiry ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.chipExpiry, children:
|
|
29
|
-
isDefault ? /* @__PURE__ */ jsx(Badge, { style: styles.rowBadge, variant: "neutral", size: "sm", children:
|
|
32
|
+
expiry ? /* @__PURE__ */ jsx(Text, { numberOfLines: 1, style: styles.chipExpiry, children: labels.expires(expiry) }) : null,
|
|
33
|
+
isDefault ? /* @__PURE__ */ jsx(Badge, { style: styles.rowBadge, variant: "neutral", size: "sm", children: labels.defaultBadge }) : null
|
|
30
34
|
] }),
|
|
31
35
|
/* @__PURE__ */ jsxs(View, { style: styles.chipActions, children: [
|
|
32
|
-
onManage ? /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onPress: onManage, children: manageLabel }) : null,
|
|
33
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onPress: onUseAnother, children: useAnotherLabel })
|
|
36
|
+
onManage ? /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onPress: onManage, children: manageLabel ?? labels.manageCards }) : null,
|
|
37
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onPress: onUseAnother, children: useAnotherLabel ?? labels.useDifferentCard })
|
|
34
38
|
] })
|
|
35
39
|
] });
|
|
36
40
|
}
|
|
@@ -39,16 +43,22 @@ function ExpressPayRow({
|
|
|
39
43
|
platform,
|
|
40
44
|
label,
|
|
41
45
|
secondary,
|
|
42
|
-
dividerLabel
|
|
43
|
-
resolvingLabel
|
|
46
|
+
dividerLabel,
|
|
47
|
+
resolvingLabel: resolvingLabelProp,
|
|
44
48
|
onExpressPay,
|
|
49
|
+
loading = false,
|
|
45
50
|
onInstalments,
|
|
51
|
+
labels: labelsProp,
|
|
46
52
|
style,
|
|
47
53
|
testID
|
|
48
54
|
}) {
|
|
55
|
+
const labels = useLabels("paymentMethod", DEFAULT_LABELS, labelsProp);
|
|
56
|
+
const pay = usePayLabels(labelsProp);
|
|
57
|
+
const locale = useLoamLocale();
|
|
58
|
+
const resolvingLabel = resolvingLabelProp ?? labels.checkingWallet;
|
|
49
59
|
const { styles, theme } = useStyles(sheet);
|
|
50
60
|
const express = methodsFor({ platform }).find((m) => m.kind === "express");
|
|
51
|
-
const buttonLabel = label ?? (express ?
|
|
61
|
+
const buttonLabel = label ?? (express ? labels.payWith((methodText(express.id, pay)?.label ?? express.label).toLocaleLowerCase(locale)) : labels.expressPay);
|
|
52
62
|
if (state === "unavailable") return null;
|
|
53
63
|
return /* @__PURE__ */ jsxs(View, { testID, style: [styles.express, style], children: [
|
|
54
64
|
state === "resolving" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -73,10 +83,10 @@ function ExpressPayRow({
|
|
|
73
83
|
}
|
|
74
84
|
)
|
|
75
85
|
] }) : /* @__PURE__ */ jsxs(View, { style: styles.expressButtons, children: [
|
|
76
|
-
/* @__PURE__ */ jsx(Button, { size: "lg", fullWidth: true, leadingIcon: "lock", onPress: onExpressPay, children: buttonLabel }),
|
|
86
|
+
/* @__PURE__ */ jsx(Button, { size: "lg", fullWidth: true, leadingIcon: "lock", loading, onPress: onExpressPay, children: buttonLabel }),
|
|
77
87
|
onInstalments && secondary ? /* @__PURE__ */ jsx(Button, { variant: "outline", size: "lg", fullWidth: true, onPress: onInstalments, children: secondary }) : null
|
|
78
88
|
] }),
|
|
79
|
-
/* @__PURE__ */ jsx(OrDivider, { label: dividerLabel })
|
|
89
|
+
/* @__PURE__ */ jsx(OrDivider, { label: dividerLabel ?? labels.orPayWithCard, labels: labelsProp })
|
|
80
90
|
] });
|
|
81
91
|
}
|
|
82
92
|
var sheet = createStyleSheet((theme) => ({
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { Animated, Easing, AccessibilityInfo, View } from 'react-native';
|
|
3
4
|
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
var DEFAULT_LABELS = {
|
|
8
|
+
loading: "Loading"
|
|
9
|
+
};
|
|
7
10
|
var CIRCLE_DEFAULT = 40;
|
|
8
11
|
var TEXT_HEIGHT = 14;
|
|
9
12
|
var RECT_HEIGHT = 120;
|
|
@@ -13,10 +16,14 @@ function Skeleton({
|
|
|
13
16
|
height,
|
|
14
17
|
radius,
|
|
15
18
|
style,
|
|
16
|
-
accessibilityLabel
|
|
19
|
+
accessibilityLabel: accessibilityLabelProp,
|
|
20
|
+
decorative = false,
|
|
21
|
+
labels: labelsProp,
|
|
17
22
|
testID
|
|
18
23
|
}) {
|
|
19
|
-
const theme = useLoamTheme();
|
|
24
|
+
const theme = useLoamTheme("skeleton");
|
|
25
|
+
const labels = useLabels("skeleton", DEFAULT_LABELS, labelsProp);
|
|
26
|
+
const accessibilityLabel = accessibilityLabelProp ?? labels.loading;
|
|
20
27
|
const { styles } = useStyles(sheet, { variant });
|
|
21
28
|
let resolvedWidth;
|
|
22
29
|
let resolvedHeight;
|
|
@@ -61,9 +68,16 @@ function Skeleton({
|
|
|
61
68
|
return /* @__PURE__ */ jsx(
|
|
62
69
|
Animated.View,
|
|
63
70
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
71
|
+
...decorative ? {
|
|
72
|
+
accessible: false,
|
|
73
|
+
accessibilityElementsHidden: true,
|
|
74
|
+
importantForAccessibility: "no-hide-descendants",
|
|
75
|
+
"aria-hidden": true
|
|
76
|
+
} : {
|
|
77
|
+
accessibilityRole: "image",
|
|
78
|
+
accessibilityLabel,
|
|
79
|
+
accessibilityState: { busy: true }
|
|
80
|
+
},
|
|
67
81
|
testID,
|
|
68
82
|
style: [
|
|
69
83
|
styles.base,
|
|
@@ -79,18 +93,37 @@ function SkeletonText({
|
|
|
79
93
|
lastLineWidth = "60%",
|
|
80
94
|
lineHeight = TEXT_HEIGHT,
|
|
81
95
|
style,
|
|
96
|
+
accessibilityLabel: accessibilityLabelProp,
|
|
97
|
+
labels: labelsProp,
|
|
82
98
|
testID
|
|
83
99
|
}) {
|
|
84
|
-
const theme = useLoamTheme();
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
const theme = useLoamTheme("skeleton");
|
|
101
|
+
const labels = useLabels("skeleton", DEFAULT_LABELS, labelsProp);
|
|
102
|
+
const accessibilityLabel = accessibilityLabelProp ?? labels.loading;
|
|
103
|
+
return (
|
|
104
|
+
// One labelled "Loading" image for the group; the bones are hidden.
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
View,
|
|
107
|
+
{
|
|
108
|
+
accessible: true,
|
|
109
|
+
accessibilityRole: "image",
|
|
110
|
+
accessibilityLabel,
|
|
111
|
+
accessibilityState: { busy: true },
|
|
112
|
+
style: [{ gap: theme.space.s2 }, style],
|
|
113
|
+
testID,
|
|
114
|
+
children: Array.from({ length: Math.max(0, lines) }).map((_, i) => /* @__PURE__ */ jsx(
|
|
115
|
+
Skeleton,
|
|
116
|
+
{
|
|
117
|
+
variant: "text",
|
|
118
|
+
decorative: true,
|
|
119
|
+
height: lineHeight,
|
|
120
|
+
style: i === lines - 1 ? { width: lastLineWidth } : void 0
|
|
121
|
+
},
|
|
122
|
+
i
|
|
123
|
+
))
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
);
|
|
94
127
|
}
|
|
95
128
|
var sheet = createStyleSheet((theme) => ({
|
|
96
129
|
base: {
|