@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
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
2
|
+
import { useResolvedMotion, springConfig } from './chunk-J64KGCGX.js';
|
|
3
|
+
import { DEFAULT_DATE_LABELS, localeNames, monthGrid, weekdayOrder, dayDisabled, dayLabel } from '@btndprojects/loam-date';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ScrollView, View, Text, Animated, Pressable, StyleSheet } from 'react-native';
|
|
6
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var DEFAULT_LABELS = {
|
|
10
|
+
...DEFAULT_DATE_LABELS,
|
|
11
|
+
pickDate: "Pick a date",
|
|
12
|
+
pickRange: "Pick a range",
|
|
13
|
+
triggerNamed: (label, value) => `${label}, ${value}`,
|
|
14
|
+
triggerHint: "Double tap to change the date range",
|
|
15
|
+
startTime: "Start time, 24-hour",
|
|
16
|
+
endTime: "End time, 24-hour",
|
|
17
|
+
timeTo: "to",
|
|
18
|
+
clearButton: "Clear",
|
|
19
|
+
goToToday: "Go to today",
|
|
20
|
+
cancel: "Cancel",
|
|
21
|
+
apply: "Apply",
|
|
22
|
+
pickOtherEnd: (stamp) => `${stamp} \u2014 pick the other end`,
|
|
23
|
+
reResolvesNote: "Re-resolves on load",
|
|
24
|
+
dayToday: "today",
|
|
25
|
+
dayWholeRange: "the whole range",
|
|
26
|
+
dayRangeStart: "range start",
|
|
27
|
+
dayRangeEnd: "range end",
|
|
28
|
+
dayInRange: "in the range",
|
|
29
|
+
dayUnavailable: (reason) => `unavailable: ${reason}`
|
|
30
|
+
};
|
|
31
|
+
function MonthList({
|
|
32
|
+
Z,
|
|
33
|
+
anchorMs,
|
|
34
|
+
radius,
|
|
35
|
+
ctx,
|
|
36
|
+
from,
|
|
37
|
+
to,
|
|
38
|
+
constraints,
|
|
39
|
+
dayMeta,
|
|
40
|
+
weekNumbers = false,
|
|
41
|
+
onPick,
|
|
42
|
+
scrollNonce = 0,
|
|
43
|
+
motion = "full",
|
|
44
|
+
labels: labelsProp
|
|
45
|
+
}) {
|
|
46
|
+
const { styles } = useStyles(sheet);
|
|
47
|
+
const labels = useLabels("dateRangePicker", DEFAULT_LABELS, labelsProp);
|
|
48
|
+
const names = localeNames(ctx.locale);
|
|
49
|
+
const level = useResolvedMotion(motion, "date-range-picker");
|
|
50
|
+
const months = React.useMemo(() => {
|
|
51
|
+
const out = [];
|
|
52
|
+
for (let i = -radius; i <= radius; i += 1) {
|
|
53
|
+
out.push(monthGrid(Z, Z.addMonths(Z.startOfMonth(anchorMs), i), ctx));
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}, [Z, anchorMs, radius, ctx]);
|
|
57
|
+
const order = weekdayOrder(ctx.weekStartsOn ?? 1);
|
|
58
|
+
const scroller = React.useRef(null);
|
|
59
|
+
const offsets = React.useRef([]);
|
|
60
|
+
const anchorKey = Z.monthKey(anchorMs);
|
|
61
|
+
React.useEffect(() => {
|
|
62
|
+
const y = offsets.current[radius];
|
|
63
|
+
if (y != null) scroller.current?.scrollTo({ y, animated: false });
|
|
64
|
+
}, [anchorKey, radius, scrollNonce]);
|
|
65
|
+
const [snaps, setSnaps] = React.useState(void 0);
|
|
66
|
+
const measure = (index) => (event) => {
|
|
67
|
+
offsets.current[index] = event.nativeEvent.layout.y;
|
|
68
|
+
const all = offsets.current;
|
|
69
|
+
if (all.length === months.length && all.every((y) => y != null)) {
|
|
70
|
+
setSnaps(
|
|
71
|
+
(prev) => prev && prev.length === all.length && prev.every((y, i) => y === all[i]) ? prev : [...all]
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
if (index === radius)
|
|
75
|
+
scroller.current?.scrollTo({ y: event.nativeEvent.layout.y, animated: false });
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
ScrollView,
|
|
79
|
+
{
|
|
80
|
+
ref: scroller,
|
|
81
|
+
showsVerticalScrollIndicator: true,
|
|
82
|
+
snapToOffsets: snaps,
|
|
83
|
+
snapToEnd: false,
|
|
84
|
+
decelerationRate: "fast",
|
|
85
|
+
testID: "date-range-month-list",
|
|
86
|
+
children: months.map((item, index) => /* @__PURE__ */ jsxs(View, { style: styles.month, onLayout: measure(index), children: [
|
|
87
|
+
/* @__PURE__ */ jsx(Text, { style: styles.monthLabel, role: "heading", ...{ "aria-level": 3 }, children: item.label }),
|
|
88
|
+
/* @__PURE__ */ jsxs(View, { style: styles.weekdayRow, children: [
|
|
89
|
+
weekNumbers ? /* @__PURE__ */ jsx(View, { style: styles.weekNumber }) : null,
|
|
90
|
+
order.map((dow) => /* @__PURE__ */ jsx(View, { style: styles.weekdayCell, children: /* @__PURE__ */ jsx(Text, { style: styles.weekdayText, ...{ "aria-hidden": true }, children: names.dayAbbr[dow] }) }, dow))
|
|
91
|
+
] }),
|
|
92
|
+
item.weeks.map((week) => /* @__PURE__ */ jsxs(View, { style: styles.weekRow, children: [
|
|
93
|
+
weekNumbers ? /* @__PURE__ */ jsx(View, { style: styles.weekNumber, children: /* @__PURE__ */ jsx(Text, { style: styles.weekNumberText, children: week.week }) }) : null,
|
|
94
|
+
week.days.map(
|
|
95
|
+
(day) => (
|
|
96
|
+
// A day borrowed from the neighbouring month is **not** rendered
|
|
97
|
+
// as a cell here, unlike in the web picker's two-month view. In a
|
|
98
|
+
// continuous scroll that month is a thumb-flick away, so a
|
|
99
|
+
// borrowed day is not a shortcut — it is the same date appearing
|
|
100
|
+
// twice, pickable twice, and announced twice. The blank keeps the
|
|
101
|
+
// six-row height so the grid does not jump.
|
|
102
|
+
day.inMonth ? /* @__PURE__ */ jsx(
|
|
103
|
+
DayCell,
|
|
104
|
+
{
|
|
105
|
+
Z,
|
|
106
|
+
day,
|
|
107
|
+
ctx,
|
|
108
|
+
from,
|
|
109
|
+
to,
|
|
110
|
+
constraints,
|
|
111
|
+
meta: dayMeta?.(day.ms),
|
|
112
|
+
level,
|
|
113
|
+
labels,
|
|
114
|
+
names: names.days,
|
|
115
|
+
onPick
|
|
116
|
+
},
|
|
117
|
+
day.key
|
|
118
|
+
) : /* @__PURE__ */ jsx(View, { style: styles.dayBlank }, day.key)
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
] }, `${week.week}-${week.days[0].key}`))
|
|
122
|
+
] }, `${item.y}-${item.mo}`))
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function DayCell({
|
|
127
|
+
Z,
|
|
128
|
+
day,
|
|
129
|
+
ctx,
|
|
130
|
+
from,
|
|
131
|
+
to,
|
|
132
|
+
constraints,
|
|
133
|
+
meta,
|
|
134
|
+
level,
|
|
135
|
+
labels,
|
|
136
|
+
names,
|
|
137
|
+
onPick
|
|
138
|
+
}) {
|
|
139
|
+
const { styles } = useStyles(sheet);
|
|
140
|
+
const theme = useLoamTheme("date-range-picker");
|
|
141
|
+
const reason = dayDisabled(Z, day.ms, constraints, ctx, meta);
|
|
142
|
+
const disabled = reason !== false || meta?.loading === true;
|
|
143
|
+
const today = Z.sameDay(day.ms, ctx.now ?? Date.now());
|
|
144
|
+
const dayEnd = Z.endOfDay(day.ms);
|
|
145
|
+
const isStart = from != null && Z.sameDay(day.ms, from);
|
|
146
|
+
const isEnd = to != null && Z.sameDay(day.ms, to - 1);
|
|
147
|
+
const inside = from != null && to != null && day.ms >= from && dayEnd < to;
|
|
148
|
+
const selection = isStart && isEnd ? "both" : isStart ? "start" : isEnd ? "end" : inside ? "inside" : "none";
|
|
149
|
+
const wash = React.useRef(new Animated.Value(inside ? 1 : 0)).current;
|
|
150
|
+
const land = React.useRef(new Animated.Value(1)).current;
|
|
151
|
+
const endpoint = isStart || isEnd;
|
|
152
|
+
const daysIn = inside && from != null ? Math.round((day.ms - from) / 864e5) : 0;
|
|
153
|
+
React.useEffect(() => {
|
|
154
|
+
if (level !== "full") {
|
|
155
|
+
wash.setValue(inside ? 1 : 0);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const run = Animated.sequence([
|
|
159
|
+
// loam-audit-ignore raw-duration — the shared 30ms stagger, capped at 8
|
|
160
|
+
Animated.delay(inside ? Math.min(daysIn, 8) * 30 : 0),
|
|
161
|
+
Animated.spring(wash, {
|
|
162
|
+
...springConfig(theme, "fe"),
|
|
163
|
+
toValue: inside ? 1 : 0,
|
|
164
|
+
useNativeDriver: true
|
|
165
|
+
})
|
|
166
|
+
]);
|
|
167
|
+
run.start();
|
|
168
|
+
return () => run.stop();
|
|
169
|
+
}, [inside, level]);
|
|
170
|
+
const wasEnd = React.useRef(endpoint);
|
|
171
|
+
React.useEffect(() => {
|
|
172
|
+
if (endpoint && !wasEnd.current && level === "full") {
|
|
173
|
+
land.setValue(0);
|
|
174
|
+
Animated.spring(land, {
|
|
175
|
+
...springConfig(theme, "fs"),
|
|
176
|
+
toValue: 1,
|
|
177
|
+
useNativeDriver: true
|
|
178
|
+
}).start();
|
|
179
|
+
}
|
|
180
|
+
wasEnd.current = endpoint;
|
|
181
|
+
}, [endpoint, level]);
|
|
182
|
+
const parts = [
|
|
183
|
+
`${names[day.dow]} ${dayLabel(Z, day.ms, { longMonth: true, locale: ctx.locale })}`
|
|
184
|
+
];
|
|
185
|
+
if (today) parts.push(labels.dayToday);
|
|
186
|
+
if (selection === "both") parts.push(labels.dayWholeRange);
|
|
187
|
+
else if (selection === "start") parts.push(labels.dayRangeStart);
|
|
188
|
+
else if (selection === "end") parts.push(labels.dayRangeEnd);
|
|
189
|
+
else if (selection === "inside") parts.push(labels.dayInRange);
|
|
190
|
+
if (reason) parts.push(labels.dayUnavailable(reason));
|
|
191
|
+
const name = parts.join(", ");
|
|
192
|
+
return /* @__PURE__ */ jsxs(
|
|
193
|
+
Pressable,
|
|
194
|
+
{
|
|
195
|
+
accessibilityRole: "button",
|
|
196
|
+
accessibilityLabel: name,
|
|
197
|
+
accessibilityState: { selected: selection !== "none", disabled },
|
|
198
|
+
disabled,
|
|
199
|
+
onPress: () => onPick(day.ms),
|
|
200
|
+
style: ({ pressed }) => [styles.day, pressed && !disabled && styles.pressed],
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
203
|
+
Animated.View,
|
|
204
|
+
{
|
|
205
|
+
pointerEvents: "none",
|
|
206
|
+
style: [StyleSheet.absoluteFill, styles.dayInside, { opacity: wash }]
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
endpoint ? /* @__PURE__ */ jsx(
|
|
210
|
+
Animated.View,
|
|
211
|
+
{
|
|
212
|
+
pointerEvents: "none",
|
|
213
|
+
style: [
|
|
214
|
+
StyleSheet.absoluteFill,
|
|
215
|
+
styles.dayEnd,
|
|
216
|
+
{
|
|
217
|
+
transform: [
|
|
218
|
+
{ scale: land.interpolate({ inputRange: [0, 1], outputRange: [0.9, 1] }) }
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
) : null,
|
|
224
|
+
/* @__PURE__ */ jsx(
|
|
225
|
+
Text,
|
|
226
|
+
{
|
|
227
|
+
style: [
|
|
228
|
+
styles.dayText,
|
|
229
|
+
today && styles.dayToday,
|
|
230
|
+
(isStart || isEnd) && styles.dayEndText,
|
|
231
|
+
disabled && styles.dayDisabled
|
|
232
|
+
],
|
|
233
|
+
children: day.day
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
meta?.density != null && meta.density > 0 ? /* @__PURE__ */ jsx(
|
|
237
|
+
View,
|
|
238
|
+
{
|
|
239
|
+
style: [
|
|
240
|
+
styles.densityBar,
|
|
241
|
+
{
|
|
242
|
+
height: Math.max(theme.borderWidth.heavy, Math.round(meta.density * theme.space.s2))
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
) : null
|
|
247
|
+
]
|
|
248
|
+
}
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
var sheet = createStyleSheet((theme) => ({
|
|
252
|
+
month: { gap: theme.space.s1, paddingBottom: theme.space.s4 },
|
|
253
|
+
monthLabel: {
|
|
254
|
+
fontFamily: theme.font.sans,
|
|
255
|
+
fontSize: theme.type.headline.fontSize,
|
|
256
|
+
lineHeight: theme.type.headline.lineHeight,
|
|
257
|
+
fontWeight: theme.type.headline.fontWeight,
|
|
258
|
+
color: theme.color.text,
|
|
259
|
+
paddingVertical: theme.space.s1
|
|
260
|
+
},
|
|
261
|
+
weekdayRow: { flexDirection: "row" },
|
|
262
|
+
weekdayCell: { flex: 1, alignItems: "center", paddingVertical: theme.space[2] },
|
|
263
|
+
weekdayText: {
|
|
264
|
+
fontFamily: theme.font.sans,
|
|
265
|
+
fontSize: theme.type.caption2.fontSize,
|
|
266
|
+
lineHeight: theme.type.caption2.lineHeight,
|
|
267
|
+
color: theme.color.text2
|
|
268
|
+
},
|
|
269
|
+
weekRow: { flexDirection: "row", alignItems: "stretch" },
|
|
270
|
+
weekNumber: { width: theme.space.s6, alignItems: "center", justifyContent: "center" },
|
|
271
|
+
weekNumberText: {
|
|
272
|
+
fontFamily: theme.font.mono,
|
|
273
|
+
fontSize: theme.type.caption2.fontSize,
|
|
274
|
+
color: theme.color.text3
|
|
275
|
+
},
|
|
276
|
+
day: {
|
|
277
|
+
flex: 1,
|
|
278
|
+
minHeight: theme.tapMin,
|
|
279
|
+
alignItems: "center",
|
|
280
|
+
justifyContent: "center",
|
|
281
|
+
gap: theme.space[1]
|
|
282
|
+
},
|
|
283
|
+
// The in-range wash is a state layer, not a tint: it has to composite over the
|
|
284
|
+
// sheet surface and over a pressed cell without either turning muddy.
|
|
285
|
+
dayInside: { backgroundColor: theme.state.selected },
|
|
286
|
+
dayEnd: { backgroundColor: theme.color.accent, borderRadius: theme.radius.md },
|
|
287
|
+
dayText: {
|
|
288
|
+
fontFamily: theme.font.sans,
|
|
289
|
+
fontSize: theme.type.subheadline.fontSize,
|
|
290
|
+
lineHeight: theme.type.subheadline.lineHeight,
|
|
291
|
+
color: theme.color.text
|
|
292
|
+
},
|
|
293
|
+
dayBlank: { flex: 1, minHeight: theme.tapMin },
|
|
294
|
+
dayToday: { fontWeight: theme.fontWeight.bold, color: theme.color.accentOnSoft },
|
|
295
|
+
dayEndText: { color: theme.color.accentInk, fontWeight: theme.fontWeight.bold },
|
|
296
|
+
dayDisabled: { color: theme.color.text3, textDecorationLine: "line-through" },
|
|
297
|
+
densityBar: {
|
|
298
|
+
width: theme.space.s3,
|
|
299
|
+
borderRadius: theme.radius.full,
|
|
300
|
+
backgroundColor: theme.color.accent
|
|
301
|
+
},
|
|
302
|
+
pressed: { opacity: theme.state.pressedOpacity }
|
|
303
|
+
}));
|
|
304
|
+
|
|
305
|
+
export { DEFAULT_LABELS, MonthList };
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { HoldToConfirm } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { HoldToConfirm } from './chunk-M656FYNH.js';
|
|
2
|
+
import { haptics } from './chunk-NY2U3PBI.js';
|
|
3
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
4
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
5
|
+
import { springConfig } from './chunk-J64KGCGX.js';
|
|
3
6
|
import * as React from 'react';
|
|
4
7
|
import { Animated, Pressable, ActivityIndicator, Text } from 'react-native';
|
|
5
8
|
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
6
9
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
10
|
|
|
11
|
+
var DEFAULT_LABELS = {
|
|
12
|
+
loading: "Loading"
|
|
13
|
+
};
|
|
8
14
|
function holdSizeFor(size) {
|
|
9
15
|
return size === "xs" ? "sm" : size;
|
|
10
16
|
}
|
|
11
17
|
function useForeground(variant, disabled) {
|
|
12
|
-
const theme = useLoamTheme();
|
|
18
|
+
const theme = useLoamTheme("button");
|
|
13
19
|
if (disabled) return theme.color.text3;
|
|
14
20
|
switch (variant) {
|
|
15
21
|
case "primary":
|
|
@@ -30,20 +36,44 @@ function Button({
|
|
|
30
36
|
loading = false,
|
|
31
37
|
disabled = false,
|
|
32
38
|
fullWidth = false,
|
|
39
|
+
softDisabled = false,
|
|
40
|
+
disabledReason,
|
|
41
|
+
onDisabledPress,
|
|
33
42
|
leadingIcon,
|
|
34
43
|
trailingIcon,
|
|
35
44
|
onPress,
|
|
36
45
|
accessibilityLabel,
|
|
37
46
|
motion = "full",
|
|
38
47
|
hold = false,
|
|
48
|
+
haptic,
|
|
39
49
|
onConfirm,
|
|
40
50
|
holdDuration,
|
|
41
|
-
confirmingLabel
|
|
51
|
+
confirmingLabel,
|
|
52
|
+
labels: labelsProp
|
|
42
53
|
}) {
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
54
|
+
const labels = useLabels("button", DEFAULT_LABELS, labelsProp);
|
|
55
|
+
const theme = useLoamTheme("button");
|
|
56
|
+
const soft = softDisabled && !disabled;
|
|
57
|
+
const { styles } = useStyles(sheet, { variant, size, disabled: disabled || soft, fullWidth });
|
|
58
|
+
const fg = useForeground(variant, disabled || soft);
|
|
46
59
|
const scale = React.useRef(new Animated.Value(1)).current;
|
|
60
|
+
const kick = React.useRef(new Animated.Value(0)).current;
|
|
61
|
+
const [checked, setChecked] = React.useState(false);
|
|
62
|
+
const [pending, setPending] = React.useState(false);
|
|
63
|
+
const [spin, setSpin] = React.useState(false);
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
if (!pending) {
|
|
66
|
+
setSpin(false);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const t = setTimeout(() => setSpin(true), 500);
|
|
70
|
+
return () => clearTimeout(t);
|
|
71
|
+
}, [pending]);
|
|
72
|
+
React.useEffect(() => {
|
|
73
|
+
if (!checked) return;
|
|
74
|
+
const t = setTimeout(() => setChecked(false), 1500);
|
|
75
|
+
return () => clearTimeout(t);
|
|
76
|
+
}, [checked]);
|
|
47
77
|
if (hold && variant === "danger") {
|
|
48
78
|
return /* @__PURE__ */ jsx(
|
|
49
79
|
HoldToConfirm,
|
|
@@ -63,33 +93,54 @@ function Button({
|
|
|
63
93
|
}
|
|
64
94
|
);
|
|
65
95
|
}
|
|
66
|
-
const busy = loading;
|
|
67
|
-
const interactive = !disabled && !busy;
|
|
96
|
+
const busy = loading || pending;
|
|
97
|
+
const interactive = !disabled && !busy && !soft;
|
|
68
98
|
const iconSize = theme.ctl.icon[size];
|
|
69
99
|
const slopY = Math.max(0, (theme.hit[size] - theme.ctl[size]) / 2);
|
|
70
100
|
const animatePress = motion === "full" && !theme.reduceMotion;
|
|
101
|
+
const tapHaptic = haptic ?? (variant === "primary" || variant === "danger");
|
|
71
102
|
const spring = (to) => Animated.spring(scale, {
|
|
103
|
+
...springConfig(theme, "fs"),
|
|
72
104
|
toValue: to,
|
|
73
|
-
useNativeDriver: true
|
|
74
|
-
speed: 40,
|
|
75
|
-
bounciness: 6
|
|
105
|
+
useNativeDriver: true
|
|
76
106
|
}).start();
|
|
107
|
+
const press = () => {
|
|
108
|
+
const result = onPress?.();
|
|
109
|
+
if (!result || typeof result.then !== "function") return;
|
|
110
|
+
setPending(true);
|
|
111
|
+
result.then(
|
|
112
|
+
() => {
|
|
113
|
+
setPending(false);
|
|
114
|
+
if (motion !== "none") setChecked(true);
|
|
115
|
+
},
|
|
116
|
+
() => {
|
|
117
|
+
setPending(false);
|
|
118
|
+
if (!animatePress) return;
|
|
119
|
+
kick.setValue(4);
|
|
120
|
+
Animated.spring(kick, { ...springConfig(theme, "fs", { thrown: true }), toValue: 0, useNativeDriver: true }).start();
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
};
|
|
77
124
|
return /* @__PURE__ */ jsx(
|
|
78
125
|
Pressable,
|
|
79
126
|
{
|
|
80
127
|
accessibilityRole: "button",
|
|
81
128
|
accessibilityLabel,
|
|
82
|
-
|
|
129
|
+
accessibilityHint: soft ? disabledReason : void 0,
|
|
130
|
+
accessibilityState: { disabled: disabled || soft, busy },
|
|
83
131
|
disabled,
|
|
84
|
-
onPress: interactive ?
|
|
85
|
-
onPressIn: interactive && animatePress
|
|
132
|
+
onPress: soft && !busy ? onDisabledPress : interactive ? press : void 0,
|
|
133
|
+
onPressIn: interactive && (animatePress || tapHaptic) ? () => {
|
|
134
|
+
if (tapHaptic) haptics.impact(variant === "danger" ? "medium" : "light");
|
|
135
|
+
if (animatePress) spring(0.96);
|
|
136
|
+
} : void 0,
|
|
86
137
|
onPressOut: interactive && animatePress ? () => spring(1) : void 0,
|
|
87
138
|
hitSlop: { top: slopY, bottom: slopY },
|
|
88
139
|
style: fullWidth ? fullWidthStyle : void 0,
|
|
89
|
-
children: /* @__PURE__ */ jsxs(Animated.View, { style: [styles.base, { transform: [{ scale }] }], children: [
|
|
90
|
-
loading ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: fg, accessibilityLabel:
|
|
140
|
+
children: /* @__PURE__ */ jsxs(Animated.View, { style: [styles.base, { transform: [{ scale }, { translateX: kick }] }], children: [
|
|
141
|
+
checked ? /* @__PURE__ */ jsx(Icon, { name: "check", size: iconSize, color: fg }) : loading || pending && spin ? /* @__PURE__ */ jsx(ActivityIndicator, { size: "small", color: fg, accessibilityLabel: labels.loading }) : leadingIcon ? /* @__PURE__ */ jsx(Icon, { name: leadingIcon, size: iconSize, color: fg }) : null,
|
|
91
142
|
typeof children === "string" ? /* @__PURE__ */ jsx(Text, { style: [styles.label, { color: fg }], children }) : children,
|
|
92
|
-
!loading && trailingIcon ? /* @__PURE__ */ jsx(Icon, { name: trailingIcon, size: iconSize, color: fg }) : null
|
|
143
|
+
!loading && !checked && trailingIcon ? /* @__PURE__ */ jsx(Icon, { name: trailingIcon, size: iconSize, color: fg }) : null
|
|
93
144
|
] })
|
|
94
145
|
}
|
|
95
146
|
);
|
|
@@ -1,45 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NAMED_ROLE } from './chunk-W23G6JLF.js';
|
|
2
|
+
import { Avatar } from './chunk-V2OEB75Z.js';
|
|
3
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
4
|
+
import { springConfig } from './chunk-J64KGCGX.js';
|
|
2
5
|
import * as React from 'react';
|
|
3
6
|
import { Animated, Easing, View, Text, Pressable } from 'react-native';
|
|
4
7
|
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
5
|
-
import {
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
9
|
|
|
7
10
|
var SIZE_PX = { xs: 28, sm: 36, md: 48, lg: 60, xl: 76 };
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
var DEFAULT_LABELS = {
|
|
12
|
+
none: "No people",
|
|
13
|
+
summary: (total, names, hidden) => {
|
|
14
|
+
const noun = total === 1 ? "person" : "people";
|
|
15
|
+
const parts = hidden > 0 ? [...names, `+${hidden}`] : names;
|
|
16
|
+
return `${total} ${noun}: ${parts.join(", ")}`;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function summarise(names, visibleCount, labels) {
|
|
20
|
+
const total = names.length;
|
|
21
|
+
if (total === 0) return labels.none;
|
|
22
|
+
return labels.summary(total, names.slice(0, visibleCount), total - visibleCount);
|
|
16
23
|
}
|
|
17
|
-
function
|
|
24
|
+
function AvatarGroup({
|
|
18
25
|
avatars,
|
|
19
|
-
|
|
26
|
+
children,
|
|
27
|
+
max = 3,
|
|
20
28
|
size = "md",
|
|
21
29
|
onPress,
|
|
22
30
|
ring = true,
|
|
23
31
|
motion = "reduced",
|
|
24
|
-
label
|
|
32
|
+
label,
|
|
33
|
+
labels: labelsProp
|
|
25
34
|
}) {
|
|
35
|
+
const labels = useLabels("avatarGroup", DEFAULT_LABELS, labelsProp);
|
|
26
36
|
const { styles } = useStyles(sheet, { size });
|
|
27
|
-
const theme = useLoamTheme();
|
|
37
|
+
const theme = useLoamTheme("avatar-group");
|
|
28
38
|
const dim = SIZE_PX[size];
|
|
29
39
|
const overlap = Math.round(dim * 0.3);
|
|
30
40
|
const ringWidth = theme.borderWidth.thick;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
const cells = avatars ? avatars.map((a) => ({ key: a.id, name: a.name, node: /* @__PURE__ */ jsx(Avatar, { name: a.name, src: a.src, size }) })) : React.Children.toArray(children).filter(React.isValidElement).map((child, i) => ({
|
|
42
|
+
key: child.key ?? i,
|
|
43
|
+
name: child.props.name ?? "",
|
|
44
|
+
node: React.cloneElement(child, { size })
|
|
45
|
+
}));
|
|
46
|
+
const visible = cells.slice(0, Math.max(0, max));
|
|
47
|
+
const hidden = cells.length - visible.length;
|
|
48
|
+
const summary = label ?? summarise(
|
|
49
|
+
cells.map((c) => c.name),
|
|
50
|
+
visible.length,
|
|
51
|
+
labels
|
|
52
|
+
);
|
|
34
53
|
const cellCount = visible.length + (hidden > 0 ? 1 : 0);
|
|
35
54
|
const pressAnimated = Boolean(onPress) && motion !== "none" && !theme.reduceMotion;
|
|
36
55
|
const scale = React.useRef(new Animated.Value(1)).current;
|
|
37
|
-
const springTo = (to) => Animated.spring(scale, {
|
|
38
|
-
toValue: to,
|
|
39
|
-
useNativeDriver: true,
|
|
40
|
-
speed: 40,
|
|
41
|
-
bounciness: 6
|
|
42
|
-
}).start();
|
|
56
|
+
const springTo = (to) => Animated.spring(scale, { ...springConfig(theme, "fs"), toValue: to, useNativeDriver: true }).start();
|
|
43
57
|
const staggerAnimated = motion === "full" && !theme.reduceMotion;
|
|
44
58
|
const enter = React.useMemo(
|
|
45
59
|
() => Array.from({ length: cellCount }, () => new Animated.Value(staggerAnimated ? 0 : 1)),
|
|
@@ -80,7 +94,7 @@ function AvatarStack({
|
|
|
80
94
|
};
|
|
81
95
|
};
|
|
82
96
|
const content = /* @__PURE__ */ jsxs(Animated.View, { style: [styles.row, pressAnimated ? { transform: [{ scale }] } : null], children: [
|
|
83
|
-
visible.map((
|
|
97
|
+
visible.map((c, i) => /* @__PURE__ */ jsx(Animated.View, { style: [cellStyle(i), enterStyle(i)], children: c.node }, c.key)),
|
|
84
98
|
hidden > 0 ? /* @__PURE__ */ jsx(Animated.View, { style: [cellStyle(visible.length), enterStyle(visible.length)], children: /* @__PURE__ */ jsx(View, { style: styles.chip, children: /* @__PURE__ */ jsxs(Text, { style: styles.chipText, children: [
|
|
85
99
|
"+",
|
|
86
100
|
hidden
|
|
@@ -100,15 +114,14 @@ function AvatarStack({
|
|
|
100
114
|
}
|
|
101
115
|
);
|
|
102
116
|
}
|
|
103
|
-
return /* @__PURE__ */ jsx(View, { accessible: true, accessibilityLabel: summary, style: styles.pressable, children: content });
|
|
117
|
+
return /* @__PURE__ */ jsx(View, { accessible: true, accessibilityRole: NAMED_ROLE, accessibilityLabel: summary, style: styles.pressable, children: content });
|
|
104
118
|
}
|
|
105
119
|
var sheet = createStyleSheet((theme) => ({
|
|
106
120
|
// `alignSelf: 'flex-start'` so the stack hugs its avatars instead of stretching
|
|
107
121
|
// across the parent and letting taps land on empty space.
|
|
108
122
|
pressable: { alignSelf: "flex-start" },
|
|
109
123
|
row: { flexDirection: "row", alignItems: "center" },
|
|
110
|
-
// The `+N` chip: a same-sized circle in the neutral surface-2 fill
|
|
111
|
-
// the overflow bubble the lightweight AvatarGroup draws.
|
|
124
|
+
// The `+N` chip: a same-sized circle in the neutral surface-2 fill.
|
|
112
125
|
chip: {
|
|
113
126
|
alignItems: "center",
|
|
114
127
|
justifyContent: "center",
|
|
@@ -141,4 +154,4 @@ var sheet = createStyleSheet((theme) => ({
|
|
|
141
154
|
}
|
|
142
155
|
}));
|
|
143
156
|
|
|
144
|
-
export {
|
|
157
|
+
export { AvatarGroup };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useResolvedMotion } from './chunk-
|
|
1
|
+
import { useResolvedMotion } from './chunk-J64KGCGX.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Animated, Easing, Text } from 'react-native';
|
|
4
4
|
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
5
5
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
function StreamFade({ children, inline = false, style }) {
|
|
8
|
-
const theme = useLoamTheme();
|
|
8
|
+
const theme = useLoamTheme("streaming-text");
|
|
9
9
|
const opacity = React.useRef(new Animated.Value(0)).current;
|
|
10
10
|
React.useEffect(() => {
|
|
11
11
|
Animated.timing(opacity, {
|
|
@@ -19,7 +19,7 @@ function StreamFade({ children, inline = false, style }) {
|
|
|
19
19
|
return /* @__PURE__ */ jsx(Comp, { style: [{ opacity }, style], children });
|
|
20
20
|
}
|
|
21
21
|
function Caret() {
|
|
22
|
-
const theme = useLoamTheme();
|
|
22
|
+
const theme = useLoamTheme("streaming-text");
|
|
23
23
|
const opacity = React.useRef(new Animated.Value(1)).current;
|
|
24
24
|
const blink = theme.duration[500];
|
|
25
25
|
React.useEffect(() => {
|
|
@@ -63,7 +63,7 @@ function StreamingText({
|
|
|
63
63
|
style
|
|
64
64
|
}) {
|
|
65
65
|
const { styles } = useStyles(sheet);
|
|
66
|
-
const resolved = useResolvedMotion(motion);
|
|
66
|
+
const resolved = useResolvedMotion(motion, "streaming-text");
|
|
67
67
|
const animate = resolved === "full";
|
|
68
68
|
const content = text ?? (typeof children === "string" ? children : void 0);
|
|
69
69
|
const prevRef = React.useRef("");
|