@btndprojects/loam-ui-native 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/index.js +5 -3
- package/dist/adaptive/index.js +6 -2
- package/dist/alert/index.js +5 -2
- package/dist/analyzer/index.js +9 -6
- package/dist/announcement/index.js +8 -5
- package/dist/audio-player/index.js +5 -3
- package/dist/avatar/index.js +5 -2
- package/dist/avatar-group/index.js +7 -3
- package/dist/badge/index.js +7 -4
- package/dist/banner/index.js +5 -2
- package/dist/board/index.js +11 -6
- package/dist/button/index.js +6 -3
- package/dist/camera-permission/index.js +15 -12
- package/dist/capture-result/index.js +19 -16
- package/dist/card/index.js +6 -3
- package/dist/card-form/index.js +12 -8
- package/dist/carousel/index.js +4 -2
- package/dist/chart/index.js +8 -5
- package/dist/charts/index.js +8 -6
- package/dist/chat/index.js +16 -0
- package/dist/checkbox/index.js +6 -4
- package/dist/checklist/index.js +11 -8
- package/dist/checkout/index.js +16 -11
- package/dist/chip/index.js +7 -4
- package/dist/{chunk-XNUVB5OL.js → chunk-2OLKPG4E.js} +92 -28
- package/dist/{chunk-RUZHTGKB.js → chunk-2PKYGLQ6.js} +71 -40
- package/dist/{chunk-UC2WGUP3.js → chunk-2SWKL3AJ.js} +91 -252
- package/dist/{chunk-AI4DWZCD.js → chunk-2SY63FCH.js} +63 -16
- package/dist/{chunk-F5XNPWS7.js → chunk-2TXERVVA.js} +92 -35
- package/dist/chunk-36EC2T6P.js +581 -0
- package/dist/chunk-3DUWIYV5.js +437 -0
- package/dist/{chunk-JNY4ZHAR.js → chunk-3QMEOFW5.js} +275 -71
- package/dist/chunk-3WEZCGHX.js +265 -0
- package/dist/chunk-46MMSDGL.js +194 -0
- package/dist/{chunk-7O2FMUPT.js → chunk-4IZXHVFJ.js} +297 -92
- package/dist/{chunk-LAECSR4H.js → chunk-5LAAAXFP.js} +14 -8
- package/dist/{chunk-2A5NIQAK.js → chunk-5RENVKBQ.js} +134 -46
- package/dist/{chunk-2ZZ7TDJ4.js → chunk-5UTRIXQ6.js} +37 -31
- package/dist/{chunk-LOE5YNN3.js → chunk-5VFZRGVD.js} +37 -10
- package/dist/{chunk-52X2VYTD.js → chunk-67IZZ2MJ.js} +115 -60
- package/dist/{chunk-UYG5L34B.js → chunk-6YAQBXB3.js} +10 -4
- package/dist/{chunk-BTTFCMKG.js → chunk-74FLKD24.js} +94 -23
- package/dist/{chunk-ITTYJZWX.js → chunk-7BUIKDD6.js} +73 -18
- package/dist/{chunk-423B7SPN.js → chunk-7OVVSVEZ.js} +273 -109
- package/dist/chunk-AEB7KCHQ.js +287 -0
- package/dist/chunk-APCWFOZW.js +28 -0
- package/dist/chunk-AWKQIE5I.js +139 -0
- package/dist/{chunk-VCDBXW5H.js → chunk-B7N4ASYE.js} +86 -42
- package/dist/{chunk-IVNRBPGC.js → chunk-C4GTDLRC.js} +104 -20
- package/dist/{chunk-4ZAHCY44.js → chunk-C6APNDVA.js} +12 -5
- package/dist/{chunk-4SZYY6AN.js → chunk-CMTVNF3D.js} +18 -13
- package/dist/{chunk-HZ6CNMAF.js → chunk-CPTOADB2.js} +151 -96
- package/dist/chunk-D5N5QWI7.js +1325 -0
- package/dist/{chunk-IIQTAY3J.js → chunk-DN7MNQIP.js} +113 -29
- package/dist/{chunk-47FWHGUN.js → chunk-DVGBZ3TX.js} +84 -23
- package/dist/chunk-DW3L54DQ.js +305 -0
- package/dist/{chunk-3ARE4TES.js → chunk-E2E3I5W2.js} +69 -18
- package/dist/{chunk-DHWADYZX.js → chunk-EDCBJV7J.js} +41 -28
- package/dist/{chunk-WSW6ZFAQ.js → chunk-ENP3BMZU.js} +4 -4
- package/dist/{chunk-OOPPQH27.js → chunk-EVOIGUBI.js} +43 -19
- package/dist/{chunk-VEAYTRPX.js → chunk-EY4DD67D.js} +165 -97
- package/dist/{chunk-223Q2T2Q.js → chunk-F3H33DQX.js} +132 -61
- package/dist/{chunk-CYRBHQQZ.js → chunk-F5B3UINI.js} +68 -35
- package/dist/{chunk-6X6PQ443.js → chunk-FAJI7BSC.js} +20 -9
- package/dist/{chunk-MOUJOP55.js → chunk-FUMHAAF3.js} +96 -29
- package/dist/{chunk-6HT2LP62.js → chunk-FV6HMP7W.js} +192 -73
- package/dist/{chunk-S7F6XLTK.js → chunk-FYWNRX4F.js} +76 -47
- package/dist/{chunk-YG3ZJHGU.js → chunk-FZGAAOKS.js} +30 -8
- package/dist/{chunk-YDGVJETP.js → chunk-G3AFC24V.js} +1 -1
- package/dist/{chunk-EJBDRVIH.js → chunk-G6UESEVN.js} +15 -8
- package/dist/chunk-GDKVKNR2.js +339 -0
- package/dist/chunk-GEIGMWNF.js +10 -0
- package/dist/{chunk-JUAMLEHX.js → chunk-H7DWSL4O.js} +24 -12
- package/dist/chunk-HJFFOOJ4.js +1 -0
- package/dist/{chunk-RW6ZL2FQ.js → chunk-HJLPZA4X.js} +106 -21
- package/dist/chunk-HYEOQWT7.js +647 -0
- package/dist/chunk-I2KLQ2HA.js +19 -0
- package/dist/{chunk-CJ5EOYZE.js → chunk-I4FHVKEC.js} +11 -5
- package/dist/{chunk-JNH2TYIN.js → chunk-IDM7JJMO.js} +19 -5
- package/dist/{chunk-O4AEHWII.js → chunk-IPUNJMAQ.js} +141 -49
- package/dist/{chunk-J7Q7VCVC.js → chunk-IT6FUXXG.js} +13 -6
- package/dist/{chunk-QJJ6MADV.js → chunk-IVKMZ7BB.js} +80 -28
- package/dist/{chunk-Z7H7VSFZ.js → chunk-IXKWIFWZ.js} +17 -6
- package/dist/chunk-J64KGCGX.js +55 -0
- package/dist/chunk-JBMLWFSJ.js +270 -0
- package/dist/{chunk-4BXMXBJO.js → chunk-JJLPBRVZ.js} +22 -11
- package/dist/chunk-JLC6PM5S.js +406 -0
- package/dist/chunk-JUYWSSKW.js +335 -0
- package/dist/{chunk-7CFF4HXS.js → chunk-JV5YOTOB.js} +49 -11
- package/dist/{chunk-LZLHELAG.js → chunk-KFJGFLMW.js} +29 -8
- package/dist/{chunk-O7AE6DAF.js → chunk-KQZ3GLHR.js} +18 -8
- package/dist/{chunk-N32RGOA5.js → chunk-LKFC4CS7.js} +80 -24
- package/dist/{chunk-YC6WORFL.js → chunk-LMPHCVJJ.js} +82 -50
- package/dist/{chunk-3WPW4KUN.js → chunk-LQP4KEXZ.js} +45 -13
- package/dist/{chunk-TKQYWZ5V.js → chunk-LUMVGO2K.js} +47 -31
- package/dist/{chunk-AWJOCGFZ.js → chunk-M656FYNH.js} +25 -13
- package/dist/{chunk-35OFI3JG.js → chunk-MKSNFG7H.js} +73 -20
- package/dist/{chunk-4GBOGOTV.js → chunk-NBEF4EPJ.js} +16 -6
- package/dist/chunk-NNCOFLNE.js +24 -0
- package/dist/{chunk-4YQOR7JM.js → chunk-NTQ2F3AU.js} +73 -20
- package/dist/{chunk-QCDXZBC5.js → chunk-O5V4TG3V.js} +126 -44
- package/dist/{chunk-U7TFM2JA.js → chunk-OJQUBQWA.js} +3 -3
- package/dist/{chunk-VQHPQEUH.js → chunk-OWAMM2DK.js} +13 -6
- package/dist/chunk-PID3NJB7.js +405 -0
- package/dist/{chunk-HET4LLMX.js → chunk-PMMTGBBS.js} +27 -17
- package/dist/{chunk-RIBDXGUG.js → chunk-PNF3NKB5.js} +49 -16
- package/dist/{chunk-JXJB2X6M.js → chunk-Q6NKEPRE.js} +81 -32
- package/dist/chunk-QDZGFXQD.js +176 -0
- package/dist/{chunk-SYNOJOQO.js → chunk-QEYFDRHR.js} +60 -26
- package/dist/{chunk-VBOXAEPI.js → chunk-QHAITQIF.js} +97 -22
- package/dist/{chunk-VXDZFJGP.js → chunk-QHTVYA65.js} +230 -76
- package/dist/{chunk-TUTI5HOZ.js → chunk-QIKT7LIB.js} +14 -8
- package/dist/{chunk-3ENTMPQY.js → chunk-QP3KMOVF.js} +82 -42
- package/dist/{chunk-GNNJ4GCC.js → chunk-QPWDDJJ4.js} +62 -148
- package/dist/{chunk-QWCMU5B2.js → chunk-QRUMA22E.js} +205 -80
- package/dist/{chunk-ZVFE5QGU.js → chunk-QYPE5JX3.js} +50 -10
- package/dist/{chunk-PUPM2YGF.js → chunk-ROCUG24E.js} +76 -36
- package/dist/{chunk-NQYBUO3K.js → chunk-RU3ZPNL6.js} +333 -142
- package/dist/{chunk-TOXAGRDQ.js → chunk-RXSCIO6W.js} +14 -5
- package/dist/{chunk-FMYDDECK.js → chunk-SATMR6SG.js} +631 -203
- package/dist/{chunk-4YIP3CWS.js → chunk-SHHY5OMK.js} +7 -5
- package/dist/chunk-SKWO3SZF.js +2284 -0
- package/dist/{chunk-YF4NSSMT.js → chunk-SWS5JQIF.js} +41 -13
- package/dist/{chunk-CUMUNPXY.js → chunk-T5LTPKX6.js} +15 -7
- package/dist/{chunk-H6NIOQHK.js → chunk-TDMG26JI.js} +26 -6
- package/dist/{chunk-UWFLYMAR.js → chunk-TLCIR6RG.js} +267 -126
- package/dist/{chunk-SBMNWWBV.js → chunk-TN2ZNJUI.js} +47 -9
- package/dist/{chunk-5YNTNN5A.js → chunk-TQVAIKFD.js} +106 -41
- package/dist/chunk-TRGFFU6A.js +1456 -0
- package/dist/{chunk-2GK6PHGE.js → chunk-TY4MTKQJ.js} +100 -22
- package/dist/{chunk-AZRX6SAC.js → chunk-U23FYWME.js} +15 -7
- package/dist/{chunk-PZXZJBMP.js → chunk-U5NLHYV6.js} +26 -12
- package/dist/chunk-UQEN55EY.js +1 -0
- package/dist/chunk-UQGBTPXH.js +218 -0
- package/dist/chunk-UXGIW7OK.js +116 -0
- package/dist/{chunk-PJXUJYS6.js → chunk-UYGDJWMN.js} +55 -30
- package/dist/{chunk-QDYDBCFP.js → chunk-V2OEB75Z.js} +50 -51
- package/dist/{chunk-LSS54GLJ.js → chunk-VAOAKWUK.js} +34 -13
- package/dist/{chunk-DM5QUKKO.js → chunk-VDPK5CY4.js} +18 -6
- package/dist/chunk-W23G6JLF.js +37 -0
- package/dist/{chunk-CDRZHT42.js → chunk-W63AJTM7.js} +276 -12
- package/dist/{chunk-XXXEFXY5.js → chunk-W74TXYFB.js} +13 -5
- package/dist/{chunk-LRJNDEIA.js → chunk-WRDSPUE7.js} +144 -29
- package/dist/{chunk-C2NTXVWM.js → chunk-XBZGDDMR.js} +11 -4
- package/dist/{chunk-BV3B2HYZ.js → chunk-XIDTBCBA.js} +189 -131
- package/dist/{chunk-YTFKPRUK.js → chunk-XN4KG3P4.js} +348 -153
- package/dist/chunk-XQXMLMH3.js +211 -0
- package/dist/{chunk-HPPW424V.js → chunk-XTORZWRF.js} +19 -8
- package/dist/{chunk-P23EQNRQ.js → chunk-YAAHPATV.js} +181 -30
- package/dist/{chunk-KMI5ML5I.js → chunk-YXOAPXMU.js} +57 -18
- package/dist/{chunk-RJQOOHT2.js → chunk-ZECZOOSB.js} +59 -28
- package/dist/{chunk-QKXCPTFS.js → chunk-ZLTO5VQI.js} +121 -31
- package/dist/{chunk-BEDBFJND.js → chunk-ZVATDZOM.js} +16 -18
- package/dist/coachmark/index.js +6 -3
- package/dist/code-block/index.js +5 -3
- package/dist/color-field/index.js +6 -4
- package/dist/commerce/index.js +19 -16
- package/dist/connectivity/index.js +5 -2
- package/dist/context-menu/index.js +5 -3
- package/dist/copy-button/index.js +4 -2
- package/dist/data-grid/index.js +21 -16
- package/dist/date-range-picker/index.js +11 -8
- package/dist/description-list/index.js +3 -1
- package/dist/dialog/index.js +4 -2
- package/dist/empty-state/index.js +4 -2
- package/dist/error-summary/index.js +4 -2
- package/dist/fab/index.js +5 -2
- package/dist/file-manager/index.js +28 -0
- package/dist/file-upload/index.js +10 -7
- package/dist/filter-bar/index.js +9 -6
- package/dist/flow-run/index.js +15 -12
- package/dist/form/index.js +5 -3
- package/dist/gallery/index.js +5 -2
- package/dist/hold-to-confirm/index.js +4 -2
- package/dist/index.d.ts +9557 -2985
- package/dist/index.js +355 -122
- package/dist/infinite-list/index.js +4 -2
- package/dist/inline-edit/index.js +6 -4
- package/dist/input/index.js +5 -3
- package/dist/interactions/index.js +2 -1
- package/dist/invoice/index.js +13 -9
- package/dist/kbd/index.js +5 -1
- package/dist/keyboard/index.js +4 -2
- package/dist/list-row/index.js +6 -4
- package/dist/log-viewer/index.js +4 -2
- package/dist/map-view/index.js +5 -3
- package/dist/markdown/index.js +9 -6
- package/dist/metric/index.js +7 -4
- package/dist/money/index.js +9 -3
- package/dist/nav-drawer/index.js +4 -2
- package/dist/nav-header/index.js +9 -0
- package/dist/navigation/index.js +5 -2
- package/dist/notification-center/index.js +12 -10
- package/dist/number-roll/index.js +5 -2
- package/dist/one-handed/index.js +5 -3
- package/dist/os-surfaces/index.js +6 -3
- package/dist/otp/index.js +7 -4
- package/dist/page-header/index.js +1 -0
- package/dist/pagination/index.js +6 -0
- package/dist/payment-method/index.js +14 -10
- package/dist/payment-status/index.js +17 -14
- package/dist/permission/index.js +5 -2
- package/dist/picker/index.js +11 -6
- package/dist/progress/index.js +6 -3
- package/dist/pull-to-refresh/index.js +4 -2
- package/dist/radio-group/index.js +6 -4
- package/dist/rating/index.js +5 -2
- package/dist/receivables/index.js +21 -16
- package/dist/refund/index.js +18 -14
- package/dist/save-status/index.js +5 -3
- package/dist/scroll-area/index.js +3 -1
- package/dist/search-field/index.js +8 -0
- package/dist/segmented-control/index.js +4 -3
- package/dist/sheet/index.js +5 -3
- package/dist/skeleton/index.js +3 -1
- package/dist/slider/index.js +4 -2
- package/dist/sortable/index.js +7 -0
- package/dist/spinner/index.js +3 -1
- package/dist/split-button/index.js +9 -6
- package/dist/spotlight/index.js +3 -1
- package/dist/stage-timeline/index.js +5 -3
- package/dist/status-dot/index.js +4 -2
- package/dist/stepper/index.js +7 -4
- package/dist/streaming-text/index.js +3 -2
- package/dist/survey/index.js +18 -15
- package/dist/switch/index.js +5 -3
- package/dist/system-state/index.js +7 -4
- package/dist/tab-bar/index.js +5 -2
- package/dist/tabs/index.js +4 -2
- package/dist/tags-input/index.js +10 -0
- package/dist/textarea/index.js +6 -4
- package/dist/thinking/index.js +3 -1
- package/dist/time-field/index.js +12 -0
- package/dist/time-range-control/index.js +22 -0
- package/dist/timeline/index.js +4 -2
- package/dist/toast/index.js +4 -2
- package/dist/toolbar/index.js +4 -2
- package/dist/tour/index.js +12 -9
- package/dist/truncation-notice/index.js +5 -2
- package/dist/update-notice/index.js +12 -9
- package/dist/video-player/index.js +5 -2
- package/dist/viewfinder/index.js +6 -4
- package/dist/widget/index.js +7 -4
- package/dist/wizard/index.js +7 -4
- package/package.json +13 -12
- package/dist/chunk-6N33LFQA.js +0 -35
- package/dist/chunk-GDKZTW34.js +0 -395
- package/dist/chunk-GL7B2DOW.js +0 -134
- package/dist/chunk-NKB7BZYK.js +0 -167
- package/dist/chunk-OETCUXQP.js +0 -134
- package/dist/chunk-OPXFZ4Y5.js +0 -204
- package/dist/chunk-Q72LJOVE.js +0 -169
- package/dist/chunk-RNGLIHFA.js +0 -191
- package/dist/chunk-RQ3HASCC.js +0 -6
- package/dist/chunk-RSOJT5YW.js +0 -124
- package/dist/chunk-TKVFVF5D.js +0 -95
- package/dist/chunk-XOSCY2CW.js +0 -242
- package/dist/header/index.js +0 -5
- package/dist/search-bar/index.js +0 -5
- /package/dist/{chunk-3ECPOSKO.js → chunk-3UG6JUCV.js} +0 -0
- /package/dist/{chunk-JRLTGLN4.js → chunk-5WWRTEPS.js} +0 -0
- /package/dist/{chunk-RTIKSY6A.js → chunk-5Z5ZYMOJ.js} +0 -0
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { Input } from './chunk-
|
|
2
|
-
import {
|
|
1
|
+
import { Input } from './chunk-7BUIKDD6.js';
|
|
2
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
3
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { Animated, View, Pressable, Text } from 'react-native';
|
|
5
6
|
import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
|
|
6
7
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
8
|
|
|
9
|
+
var DEFAULT_LABELS = {
|
|
10
|
+
save: "Save",
|
|
11
|
+
cancel: "Cancel",
|
|
12
|
+
failure: "Couldn't save that change. Your edit is still here, so you can try again.",
|
|
13
|
+
readValue: (label, value) => `${label}, ${value}`
|
|
14
|
+
};
|
|
8
15
|
function valueFontSize(theme, size) {
|
|
9
16
|
return size === "md" || size === "lg" ? theme.fontSize[16] : theme.fontSize[14];
|
|
10
17
|
}
|
|
@@ -18,13 +25,17 @@ function InlineEdit({
|
|
|
18
25
|
disabled = false,
|
|
19
26
|
multiline = false,
|
|
20
27
|
optimistic = true,
|
|
21
|
-
|
|
28
|
+
failureMessage,
|
|
29
|
+
motion = "full",
|
|
30
|
+
labels: labelsProp
|
|
22
31
|
}) {
|
|
23
|
-
const
|
|
32
|
+
const labels = useLabels("inlineEdit", DEFAULT_LABELS, labelsProp);
|
|
33
|
+
const theme = useLoamTheme("inline-edit");
|
|
24
34
|
const { styles } = useStyles(sheet, { size, disabled, multiline });
|
|
25
35
|
const [editing, setEditing] = React.useState(false);
|
|
26
36
|
const [draft, setDraft] = React.useState(value);
|
|
27
37
|
const [optimisticValue, setOptimisticValue] = React.useState(null);
|
|
38
|
+
const [failed, setFailed] = React.useState(false);
|
|
28
39
|
React.useEffect(() => {
|
|
29
40
|
setOptimisticValue(null);
|
|
30
41
|
}, [value]);
|
|
@@ -39,13 +50,22 @@ function InlineEdit({
|
|
|
39
50
|
const skipBlurRef = React.useRef(false);
|
|
40
51
|
const enterEdit = () => {
|
|
41
52
|
if (disabled) return;
|
|
53
|
+
setFailed(false);
|
|
42
54
|
setDraft(display);
|
|
43
55
|
setEditing(true);
|
|
44
56
|
};
|
|
45
57
|
const finalize = (next) => {
|
|
46
58
|
if (next === displayRef.current) return;
|
|
47
59
|
if (optimistic) setOptimisticValue(next);
|
|
48
|
-
onChange(next);
|
|
60
|
+
const result = onChange(next);
|
|
61
|
+
if (result && typeof result.then === "function") {
|
|
62
|
+
result.then(void 0, () => {
|
|
63
|
+
setOptimisticValue(null);
|
|
64
|
+
setDraft(next);
|
|
65
|
+
setFailed(true);
|
|
66
|
+
setEditing(true);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
49
69
|
};
|
|
50
70
|
const save = () => {
|
|
51
71
|
skipBlurRef.current = true;
|
|
@@ -88,53 +108,66 @@ function InlineEdit({
|
|
|
88
108
|
}).start();
|
|
89
109
|
}, [editing, motion, actionOpacity, theme.reduceMotion, theme.motion.enter.duration]);
|
|
90
110
|
if (editing) {
|
|
91
|
-
return /* @__PURE__ */ jsxs(View, { style: styles.
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
Input,
|
|
94
|
-
{
|
|
95
|
-
autoFocus: true,
|
|
96
|
-
value: draft,
|
|
97
|
-
onChangeText: setDraft,
|
|
98
|
-
placeholder,
|
|
99
|
-
size,
|
|
100
|
-
multiline,
|
|
101
|
-
accessibilityLabel: label,
|
|
102
|
-
onSubmitEditing: onSubmit,
|
|
103
|
-
onBlur,
|
|
104
|
-
onFocus: (e) => e.currentTarget.setNativeProps?.({ selection: { start: 0, end: draft.length } }),
|
|
105
|
-
containerStyle: styles.field,
|
|
106
|
-
style: { fontWeight }
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ jsxs(Animated.View, { style: [styles.actions, { opacity: actionOpacity }], children: [
|
|
111
|
+
return /* @__PURE__ */ jsxs(View, { style: styles.editColumn, children: [
|
|
112
|
+
/* @__PURE__ */ jsxs(View, { style: styles.editRow, children: [
|
|
110
113
|
/* @__PURE__ */ jsx(
|
|
111
|
-
|
|
114
|
+
Input,
|
|
112
115
|
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
autoFocus: true,
|
|
117
|
+
value: draft,
|
|
118
|
+
onChangeText: (t) => {
|
|
119
|
+
setDraft(t);
|
|
120
|
+
setFailed(false);
|
|
121
|
+
},
|
|
122
|
+
error: failed,
|
|
123
|
+
placeholder,
|
|
124
|
+
size,
|
|
125
|
+
multiline,
|
|
126
|
+
accessibilityLabel: label,
|
|
127
|
+
onSubmitEditing: onSubmit,
|
|
128
|
+
onBlur,
|
|
129
|
+
onFocus: (e) => e.currentTarget.setNativeProps?.({ selection: { start: 0, end: draft.length } }),
|
|
130
|
+
containerStyle: styles.field,
|
|
131
|
+
style: { fontWeight }
|
|
118
132
|
}
|
|
119
133
|
),
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
/* @__PURE__ */ jsxs(Animated.View, { style: [styles.actions, { opacity: actionOpacity }], children: [
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
Pressable,
|
|
137
|
+
{
|
|
138
|
+
accessibilityRole: "button",
|
|
139
|
+
accessibilityLabel: labels.save,
|
|
140
|
+
onPress: save,
|
|
141
|
+
style: ({ pressed }) => [
|
|
142
|
+
styles.action,
|
|
143
|
+
pressed && { backgroundColor: theme.state.pressed }
|
|
144
|
+
],
|
|
145
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "check", size: iconSize, color: theme.color.good })
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
Pressable,
|
|
150
|
+
{
|
|
151
|
+
accessibilityRole: "button",
|
|
152
|
+
accessibilityLabel: labels.cancel,
|
|
153
|
+
onPress: cancel,
|
|
154
|
+
style: ({ pressed }) => [
|
|
155
|
+
styles.action,
|
|
156
|
+
pressed && { backgroundColor: theme.state.pressed }
|
|
157
|
+
],
|
|
158
|
+
children: /* @__PURE__ */ jsx(Icon, { name: "x", size: iconSize, color: theme.color.text2 })
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
] })
|
|
162
|
+
] }),
|
|
163
|
+
failed ? /* @__PURE__ */ jsx(Text, { accessibilityRole: "alert", style: styles.failure, children: failureMessage ?? labels.failure }) : null
|
|
131
164
|
] });
|
|
132
165
|
}
|
|
133
166
|
return /* @__PURE__ */ jsxs(
|
|
134
167
|
Pressable,
|
|
135
168
|
{
|
|
136
169
|
accessibilityRole: "button",
|
|
137
|
-
accessibilityLabel: isPlaceholder ? label :
|
|
170
|
+
accessibilityLabel: isPlaceholder ? label : labels.readValue(label, display),
|
|
138
171
|
accessibilityState: { disabled },
|
|
139
172
|
disabled,
|
|
140
173
|
onPress: enterEdit,
|
|
@@ -162,6 +195,13 @@ function InlineEdit({
|
|
|
162
195
|
);
|
|
163
196
|
}
|
|
164
197
|
var sheet = createStyleSheet((theme) => ({
|
|
198
|
+
editColumn: { gap: theme.space.s1 },
|
|
199
|
+
failure: {
|
|
200
|
+
fontFamily: theme.font.sans,
|
|
201
|
+
fontSize: theme.type.footnote.fontSize,
|
|
202
|
+
lineHeight: theme.type.footnote.lineHeight,
|
|
203
|
+
color: theme.color.danger
|
|
204
|
+
},
|
|
165
205
|
editRow: { flexDirection: "row", alignItems: "flex-start", gap: theme.space.s2 },
|
|
166
206
|
field: { flex: 1 },
|
|
167
207
|
actions: { flexDirection: "row", alignItems: "center", gap: theme.space.s1 },
|
|
@@ -1,145 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import '
|
|
1
|
+
import { useFormFactor } from './chunk-AWKQIE5I.js';
|
|
2
|
+
import { useLabels } from './chunk-APCWFOZW.js';
|
|
3
|
+
import { Icon } from './chunk-UXGIW7OK.js';
|
|
4
|
+
import { useResolvedMotion, springConfig } from './chunk-J64KGCGX.js';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { Animated, View, Text, Pressable } from 'react-native';
|
|
7
|
+
import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
|
|
5
8
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
9
|
|
|
7
|
-
var FORM_FACTORS = [
|
|
8
|
-
"phone",
|
|
9
|
-
"phoneLandscape",
|
|
10
|
-
"foldable",
|
|
11
|
-
"tablet",
|
|
12
|
-
"tabletLarge"
|
|
13
|
-
];
|
|
14
|
-
var FOLD_LIST_FLEX = 1;
|
|
15
|
-
var FOLD_DETAIL_FLEX = 1.25;
|
|
16
|
-
var TABLET_LIST_FLEX = 0.85;
|
|
17
|
-
var TABLET_DETAIL_FLEX = 1.3;
|
|
18
|
-
var FORM_FACTOR_SPECS = {
|
|
19
|
-
phone: {
|
|
20
|
-
formFactor: "phone",
|
|
21
|
-
token: "--bp-phone 430px",
|
|
22
|
-
label: "390 \xD7 844 \xB7 compact width",
|
|
23
|
-
panes: 1,
|
|
24
|
-
nav: "bottom",
|
|
25
|
-
drawerAllowed: false,
|
|
26
|
-
hinge: false,
|
|
27
|
-
listFlex: 1,
|
|
28
|
-
detailFlex: 0,
|
|
29
|
-
asideFlex: 0,
|
|
30
|
-
collapseLargeTitle: false,
|
|
31
|
-
halveVerticalPadding: false,
|
|
32
|
-
modal: "fullWidthSheet",
|
|
33
|
-
fab: "floating",
|
|
34
|
-
rule: "Single column. Detail is a push. Sheets go full-width and respect the bottom safe area."
|
|
35
|
-
},
|
|
36
|
-
phoneLandscape: {
|
|
37
|
-
formFactor: "phoneLandscape",
|
|
38
|
-
token: "--bp-phone-land 740px",
|
|
39
|
-
label: "844 \xD7 390 \xB7 compact height",
|
|
40
|
-
panes: 1,
|
|
41
|
-
nav: "rail",
|
|
42
|
-
drawerAllowed: false,
|
|
43
|
-
hinge: false,
|
|
44
|
-
listFlex: 1,
|
|
45
|
-
detailFlex: 0,
|
|
46
|
-
asideFlex: 0,
|
|
47
|
-
collapseLargeTitle: true,
|
|
48
|
-
halveVerticalPadding: true,
|
|
49
|
-
modal: "fullWidthSheet",
|
|
50
|
-
fab: "floating",
|
|
51
|
-
rule: "Landscape phone: collapse large titles to inline, move nav to a rail, halve vertical padding, never a bottom bar over the keyboard."
|
|
52
|
-
},
|
|
53
|
-
foldable: {
|
|
54
|
-
formFactor: "foldable",
|
|
55
|
-
token: "--bp-fold 585px",
|
|
56
|
-
label: "585 \xD7 800 \xB7 medium width \xB7 hinge gutter",
|
|
57
|
-
panes: 2,
|
|
58
|
-
nav: "rail",
|
|
59
|
-
drawerAllowed: false,
|
|
60
|
-
hinge: true,
|
|
61
|
-
listFlex: FOLD_LIST_FLEX,
|
|
62
|
-
detailFlex: FOLD_DETAIL_FLEX,
|
|
63
|
-
asideFlex: 0,
|
|
64
|
-
collapseLargeTitle: false,
|
|
65
|
-
halveVerticalPadding: false,
|
|
66
|
-
modal: "fullWidthSheet",
|
|
67
|
-
fab: "floating",
|
|
68
|
-
rule: "Treat the hinge as a hard gutter \u2014 no interactive element straddles it. Support half-opened (tabletop) by keeping controls in the bottom half."
|
|
69
|
-
},
|
|
70
|
-
tablet: {
|
|
71
|
-
formFactor: "tablet",
|
|
72
|
-
token: "--bp-tablet 768px",
|
|
73
|
-
label: "768 \xD7 1024 \xB7 expanded width",
|
|
74
|
-
panes: 2,
|
|
75
|
-
nav: "rail",
|
|
76
|
-
drawerAllowed: true,
|
|
77
|
-
hinge: false,
|
|
78
|
-
listFlex: TABLET_LIST_FLEX,
|
|
79
|
-
detailFlex: TABLET_DETAIL_FLEX,
|
|
80
|
-
asideFlex: 0,
|
|
81
|
-
collapseLargeTitle: false,
|
|
82
|
-
halveVerticalPadding: false,
|
|
83
|
-
modal: "centeredDialog",
|
|
84
|
-
fab: "toolbarButton",
|
|
85
|
-
rule: "List\u2013detail side by side, one selection always visible. Modals become centred dialogs; FAB becomes a toolbar button."
|
|
86
|
-
},
|
|
87
|
-
tabletLarge: {
|
|
88
|
-
formFactor: "tabletLarge",
|
|
89
|
-
token: "--bp-tablet-lg 1024px",
|
|
90
|
-
label: "1024 \xD7 768 \xB7 expanded width",
|
|
91
|
-
panes: 3,
|
|
92
|
-
nav: "rail",
|
|
93
|
-
drawerAllowed: true,
|
|
94
|
-
hinge: false,
|
|
95
|
-
listFlex: TABLET_LIST_FLEX,
|
|
96
|
-
detailFlex: TABLET_DETAIL_FLEX,
|
|
97
|
-
// The spec's Expanded row reads "Two–three" panes; the third pane mirrors
|
|
98
|
-
// the list's weight so the detail stays the widest column.
|
|
99
|
-
asideFlex: TABLET_LIST_FLEX,
|
|
100
|
-
collapseLargeTitle: false,
|
|
101
|
-
halveVerticalPadding: false,
|
|
102
|
-
modal: "centeredDialog",
|
|
103
|
-
fab: "toolbarButton",
|
|
104
|
-
rule: "List\u2013detail(\u2013aside) side by side, one selection always visible. Modals become centred dialogs; FAB becomes a toolbar button."
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
function classifyFormFactor({ width, height }) {
|
|
108
|
-
if (height < breakpoints.phone && (width >= breakpoints.phoneLand || width > height)) {
|
|
109
|
-
return "phoneLandscape";
|
|
110
|
-
}
|
|
111
|
-
if (width >= breakpoints.tabletLg) return "tabletLarge";
|
|
112
|
-
if (width >= breakpoints.tablet) return "tablet";
|
|
113
|
-
if (width >= breakpoints.fold) return "foldable";
|
|
114
|
-
return "phone";
|
|
115
|
-
}
|
|
116
|
-
function adaptivePadding(formFactor, screenPad) {
|
|
117
|
-
const { halveVerticalPadding } = FORM_FACTOR_SPECS[formFactor];
|
|
118
|
-
return {
|
|
119
|
-
paddingHorizontal: screenPad,
|
|
120
|
-
paddingVertical: halveVerticalPadding ? screenPad / 2 : screenPad
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function useFormFactor(override) {
|
|
124
|
-
const theme = useLoamTheme();
|
|
125
|
-
const { width, height } = useWindowDimensions();
|
|
126
|
-
const formFactor = override ?? classifyFormFactor({ width, height });
|
|
127
|
-
const spec = FORM_FACTOR_SPECS[formFactor];
|
|
128
|
-
const padding = adaptivePadding(formFactor, theme.layout.screenPad);
|
|
129
|
-
return {
|
|
130
|
-
...spec,
|
|
131
|
-
...padding,
|
|
132
|
-
width,
|
|
133
|
-
height,
|
|
134
|
-
isLandscape: width > height,
|
|
135
|
-
isCompactHeight: height < breakpoints.phone,
|
|
136
|
-
reachZoneY: height * theme.layout.reachZone,
|
|
137
|
-
readingMeasure: theme.type.body.fontSize * 0.5 * theme.measure.base
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
10
|
var HINGE_GUTTER_WIDTH = 8;
|
|
141
11
|
var NAV_RAIL_WIDTH = 64;
|
|
142
|
-
function
|
|
12
|
+
function SplitPane({
|
|
143
13
|
list,
|
|
144
14
|
detail,
|
|
145
15
|
detailVisible = false,
|
|
@@ -150,14 +20,46 @@ function SplitView({
|
|
|
150
20
|
capMeasure = true,
|
|
151
21
|
formFactor,
|
|
152
22
|
style,
|
|
153
|
-
testID
|
|
23
|
+
testID,
|
|
24
|
+
motion = "full"
|
|
154
25
|
}) {
|
|
155
26
|
const info = useFormFactor(formFactor);
|
|
156
27
|
const { styles } = useStyles(sheet);
|
|
28
|
+
const theme = useLoamTheme("adaptive");
|
|
29
|
+
const level = useResolvedMotion(motion, "adaptive");
|
|
157
30
|
const multiPane = info.panes > 1;
|
|
158
31
|
const showAside = info.panes > 2 && aside != null;
|
|
159
32
|
const listHidden = !multiPane && detailVisible && detail != null;
|
|
160
33
|
const detailHidden = !multiPane && !listHidden;
|
|
34
|
+
const swap = React.useRef(new Animated.Value(1)).current;
|
|
35
|
+
const dir = React.useRef(0);
|
|
36
|
+
const shown = multiPane ? detailVisible ? "detail" : "placeholder" : listHidden ? "detail" : "list";
|
|
37
|
+
const prevShown = React.useRef(shown);
|
|
38
|
+
if (prevShown.current !== shown) {
|
|
39
|
+
dir.current = multiPane || level !== "full" ? 0 : shown === "detail" ? 1 : -1;
|
|
40
|
+
}
|
|
41
|
+
React.useEffect(() => {
|
|
42
|
+
if (prevShown.current === shown) return;
|
|
43
|
+
prevShown.current = shown;
|
|
44
|
+
if (level === "none") return;
|
|
45
|
+
swap.setValue(0);
|
|
46
|
+
const run = Animated.spring(swap, {
|
|
47
|
+
...springConfig(theme, dir.current ? "ds" : "de"),
|
|
48
|
+
toValue: 1,
|
|
49
|
+
useNativeDriver: true
|
|
50
|
+
});
|
|
51
|
+
run.start();
|
|
52
|
+
return () => run.stop();
|
|
53
|
+
}, [shown, multiPane, level, swap, theme]);
|
|
54
|
+
const step = theme.space.s6;
|
|
55
|
+
const swapStyle = {
|
|
56
|
+
opacity: swap,
|
|
57
|
+
transform: [
|
|
58
|
+
{
|
|
59
|
+
translateX: swap.interpolate({ inputRange: [0, 1], outputRange: [dir.current * step, 0] })
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
};
|
|
161
63
|
return /* @__PURE__ */ jsxs(View, { style: [styles.container, style], testID, children: [
|
|
162
64
|
/* @__PURE__ */ jsxs(
|
|
163
65
|
View,
|
|
@@ -172,7 +74,7 @@ function SplitView({
|
|
|
172
74
|
],
|
|
173
75
|
children: [
|
|
174
76
|
listTitle ? /* @__PURE__ */ jsx(PaneHeader, { title: listTitle, emphasis: "display" }) : null,
|
|
175
|
-
/* @__PURE__ */ jsx(View, { style: styles.paneBody, children: list })
|
|
77
|
+
/* @__PURE__ */ jsx(Animated.View, { style: [styles.paneBody, multiPane ? null : swapStyle], children: list })
|
|
176
78
|
]
|
|
177
79
|
}
|
|
178
80
|
),
|
|
@@ -203,11 +105,12 @@ function SplitView({
|
|
|
203
105
|
children: [
|
|
204
106
|
detailTitle ? /* @__PURE__ */ jsx(PaneHeader, { title: detailTitle, emphasis: "body" }) : null,
|
|
205
107
|
/* @__PURE__ */ jsx(
|
|
206
|
-
View,
|
|
108
|
+
Animated.View,
|
|
207
109
|
{
|
|
208
110
|
style: [
|
|
209
111
|
styles.paneBody,
|
|
210
|
-
capMeasure ? { maxWidth: info.readingMeasure, width: "100%" } : null
|
|
112
|
+
capMeasure ? { maxWidth: info.readingMeasure, width: "100%" } : null,
|
|
113
|
+
swapStyle
|
|
211
114
|
],
|
|
212
115
|
children: detailVisible || !multiPane ? detail : detailPlaceholder
|
|
213
116
|
}
|
|
@@ -233,15 +136,20 @@ function PaneHeader({
|
|
|
233
136
|
const { styles } = useStyles(sheet, { emphasis });
|
|
234
137
|
return /* @__PURE__ */ jsx(View, { style: styles.paneHeader, children: /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", numberOfLines: 1, style: styles.paneHeaderTitle, children: title }) });
|
|
235
138
|
}
|
|
139
|
+
var DEFAULT_LABELS = {
|
|
140
|
+
main: "Main"
|
|
141
|
+
};
|
|
236
142
|
function AdaptiveNav({
|
|
237
143
|
items,
|
|
238
144
|
activeKey,
|
|
239
145
|
onSelect,
|
|
240
146
|
kind,
|
|
241
147
|
formFactor,
|
|
242
|
-
accessibilityLabel
|
|
148
|
+
accessibilityLabel,
|
|
149
|
+
labels: labelsProp,
|
|
243
150
|
testID
|
|
244
151
|
}) {
|
|
152
|
+
const labels = useLabels("adaptive", DEFAULT_LABELS, labelsProp);
|
|
245
153
|
const info = useFormFactor(formFactor);
|
|
246
154
|
const placement = kind ?? info.nav;
|
|
247
155
|
const { styles } = useStyles(sheet, { placement });
|
|
@@ -249,7 +157,7 @@ function AdaptiveNav({
|
|
|
249
157
|
View,
|
|
250
158
|
{
|
|
251
159
|
accessibilityRole: "tablist",
|
|
252
|
-
accessibilityLabel,
|
|
160
|
+
accessibilityLabel: accessibilityLabel ?? labels.main,
|
|
253
161
|
style: styles.nav,
|
|
254
162
|
testID,
|
|
255
163
|
children: items.map((item) => /* @__PURE__ */ jsx(
|
|
@@ -271,7 +179,7 @@ function NavItem({
|
|
|
271
179
|
selected,
|
|
272
180
|
onSelect
|
|
273
181
|
}) {
|
|
274
|
-
const theme = useLoamTheme();
|
|
182
|
+
const theme = useLoamTheme("adaptive");
|
|
275
183
|
const { styles } = useStyles(sheet, { placement, selected });
|
|
276
184
|
return /* @__PURE__ */ jsxs(
|
|
277
185
|
Pressable,
|
|
@@ -427,8 +335,14 @@ var sheet = createStyleSheet((theme) => ({
|
|
|
427
335
|
selected: {
|
|
428
336
|
// The rail marks the selection with a state layer; the bottom bar
|
|
429
337
|
// relies on the accent glyph + label, as the reference draws it.
|
|
430
|
-
|
|
431
|
-
|
|
338
|
+
// The state layer collapses under high contrast: the accent edge is
|
|
339
|
+
// what marks the destination there (transparent otherwise).
|
|
340
|
+
true: {
|
|
341
|
+
backgroundColor: theme.state.selected,
|
|
342
|
+
borderWidth: theme.borderWidth.base,
|
|
343
|
+
borderColor: theme.edge.accent
|
|
344
|
+
},
|
|
345
|
+
false: { borderWidth: theme.borderWidth.base, borderColor: "transparent" }
|
|
432
346
|
}
|
|
433
347
|
}
|
|
434
348
|
},
|
|
@@ -468,4 +382,4 @@ var sheet = createStyleSheet((theme) => ({
|
|
|
468
382
|
}
|
|
469
383
|
}));
|
|
470
384
|
|
|
471
|
-
export { AdaptiveNav, AdaptiveShell,
|
|
385
|
+
export { AdaptiveNav, AdaptiveShell, HINGE_GUTTER_WIDTH, NAV_RAIL_WIDTH, SplitPane };
|