@btndprojects/loam-ui-native 0.0.0-stage → 0.1.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.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +55 -2
  3. package/dist/accordion/index.js +3 -0
  4. package/dist/adaptive/index.js +2 -0
  5. package/dist/alert/index.js +3 -0
  6. package/dist/analyzer/index.js +6 -0
  7. package/dist/announcement/index.js +6 -0
  8. package/dist/audio-player/index.js +3 -0
  9. package/dist/avatar/index.js +3 -0
  10. package/dist/avatar-group/index.js +3 -0
  11. package/dist/badge/index.js +5 -0
  12. package/dist/banner/index.js +2 -0
  13. package/dist/board/index.js +7 -0
  14. package/dist/button/index.js +5 -0
  15. package/dist/camera-permission/index.js +13 -0
  16. package/dist/capture-result/index.js +18 -0
  17. package/dist/card/index.js +4 -0
  18. package/dist/card-form/index.js +10 -0
  19. package/dist/carousel/index.js +2 -0
  20. package/dist/chart/index.js +6 -0
  21. package/dist/charts/index.js +7 -0
  22. package/dist/checkbox/index.js +7 -0
  23. package/dist/checklist/index.js +10 -0
  24. package/dist/checkout/index.js +13 -0
  25. package/dist/chip/index.js +7 -0
  26. package/dist/chunk-223Q2T2Q.js +229 -0
  27. package/dist/chunk-2A5NIQAK.js +254 -0
  28. package/dist/chunk-2GK6PHGE.js +363 -0
  29. package/dist/chunk-2WUTXHMU.js +1 -0
  30. package/dist/chunk-2ZZ7TDJ4.js +324 -0
  31. package/dist/chunk-35OFI3JG.js +499 -0
  32. package/dist/chunk-3ARE4TES.js +195 -0
  33. package/dist/chunk-3ECPOSKO.js +1 -0
  34. package/dist/chunk-3ENTMPQY.js +229 -0
  35. package/dist/chunk-3HJH6FF4.js +98 -0
  36. package/dist/chunk-3NMD74ZU.js +4 -0
  37. package/dist/chunk-3WPW4KUN.js +182 -0
  38. package/dist/chunk-423B7SPN.js +993 -0
  39. package/dist/chunk-47FWHGUN.js +394 -0
  40. package/dist/chunk-4BXMXBJO.js +141 -0
  41. package/dist/chunk-4DS5ZWVC.js +83 -0
  42. package/dist/chunk-4GBOGOTV.js +295 -0
  43. package/dist/chunk-4SZYY6AN.js +99 -0
  44. package/dist/chunk-4YIP3CWS.js +237 -0
  45. package/dist/chunk-4YQOR7JM.js +204 -0
  46. package/dist/chunk-4ZAHCY44.js +177 -0
  47. package/dist/chunk-52X2VYTD.js +228 -0
  48. package/dist/chunk-5P26LBDL.js +1 -0
  49. package/dist/chunk-5XLRYDAX.js +1 -0
  50. package/dist/chunk-5YNTNN5A.js +177 -0
  51. package/dist/chunk-6HT2LP62.js +504 -0
  52. package/dist/chunk-6N33LFQA.js +35 -0
  53. package/dist/chunk-6X6PQ443.js +432 -0
  54. package/dist/chunk-7CFF4HXS.js +126 -0
  55. package/dist/chunk-7O2FMUPT.js +755 -0
  56. package/dist/chunk-AI4DWZCD.js +162 -0
  57. package/dist/chunk-AWJOCGFZ.js +213 -0
  58. package/dist/chunk-AZRX6SAC.js +285 -0
  59. package/dist/chunk-B54QE2FN.js +1 -0
  60. package/dist/chunk-BC475SJH.js +1 -0
  61. package/dist/chunk-BEDBFJND.js +202 -0
  62. package/dist/chunk-BTTFCMKG.js +166 -0
  63. package/dist/chunk-BV3B2HYZ.js +1635 -0
  64. package/dist/chunk-C2NTXVWM.js +98 -0
  65. package/dist/chunk-CDRZHT42.js +424 -0
  66. package/dist/chunk-CJ5EOYZE.js +62 -0
  67. package/dist/chunk-CUMUNPXY.js +128 -0
  68. package/dist/chunk-CUS3ZSCU.js +1 -0
  69. package/dist/chunk-CYRBHQQZ.js +411 -0
  70. package/dist/chunk-DHWADYZX.js +144 -0
  71. package/dist/chunk-DKCSPATL.js +1 -0
  72. package/dist/chunk-DM5QUKKO.js +326 -0
  73. package/dist/chunk-DYBH2I6W.js +1 -0
  74. package/dist/chunk-DZ255O2F.js +1 -0
  75. package/dist/chunk-E35BPSGW.js +1 -0
  76. package/dist/chunk-EJBDRVIH.js +166 -0
  77. package/dist/chunk-F43NP42L.js +1 -0
  78. package/dist/chunk-F5XNPWS7.js +1024 -0
  79. package/dist/chunk-FMYDDECK.js +1521 -0
  80. package/dist/chunk-G3HOYSF7.js +1 -0
  81. package/dist/chunk-GDKZTW34.js +395 -0
  82. package/dist/chunk-GL7B2DOW.js +134 -0
  83. package/dist/chunk-GNNJ4GCC.js +471 -0
  84. package/dist/chunk-GNZ56EUI.js +1 -0
  85. package/dist/chunk-H6NIOQHK.js +346 -0
  86. package/dist/chunk-H6PC7RDA.js +1 -0
  87. package/dist/chunk-HET4LLMX.js +129 -0
  88. package/dist/chunk-HPPW424V.js +334 -0
  89. package/dist/chunk-HQOQIBJI.js +1 -0
  90. package/dist/chunk-HU2EQNRZ.js +44 -0
  91. package/dist/chunk-HZ6CNMAF.js +870 -0
  92. package/dist/chunk-IIQTAY3J.js +715 -0
  93. package/dist/chunk-ITTYJZWX.js +271 -0
  94. package/dist/chunk-IVNRBPGC.js +1018 -0
  95. package/dist/chunk-J4KLDGI4.js +1 -0
  96. package/dist/chunk-J7Q7VCVC.js +254 -0
  97. package/dist/chunk-JDEOITQ2.js +1 -0
  98. package/dist/chunk-JNH2TYIN.js +96 -0
  99. package/dist/chunk-JNY4ZHAR.js +634 -0
  100. package/dist/chunk-JRLTGLN4.js +1 -0
  101. package/dist/chunk-JTRJJLKL.js +1 -0
  102. package/dist/chunk-JUAMLEHX.js +379 -0
  103. package/dist/chunk-JXJB2X6M.js +131 -0
  104. package/dist/chunk-KMI5ML5I.js +262 -0
  105. package/dist/chunk-KTAC4MGE.js +4 -0
  106. package/dist/chunk-LAECSR4H.js +178 -0
  107. package/dist/chunk-LK4BCSGX.js +1 -0
  108. package/dist/chunk-LOE5YNN3.js +470 -0
  109. package/dist/chunk-LRJNDEIA.js +302 -0
  110. package/dist/chunk-LSS54GLJ.js +116 -0
  111. package/dist/chunk-LZLHELAG.js +137 -0
  112. package/dist/chunk-M2LUXGKZ.js +1 -0
  113. package/dist/chunk-MOUJOP55.js +425 -0
  114. package/dist/chunk-N32RGOA5.js +159 -0
  115. package/dist/chunk-N5ZNE2YE.js +1 -0
  116. package/dist/chunk-NBNCBML6.js +1 -0
  117. package/dist/chunk-NKB7BZYK.js +167 -0
  118. package/dist/chunk-NQYBUO3K.js +1795 -0
  119. package/dist/chunk-NY2U3PBI.js +59 -0
  120. package/dist/chunk-O4AEHWII.js +464 -0
  121. package/dist/chunk-O7AE6DAF.js +146 -0
  122. package/dist/chunk-OETCUXQP.js +134 -0
  123. package/dist/chunk-OOPPQH27.js +179 -0
  124. package/dist/chunk-OPXFZ4Y5.js +204 -0
  125. package/dist/chunk-P23EQNRQ.js +338 -0
  126. package/dist/chunk-PJXUJYS6.js +248 -0
  127. package/dist/chunk-PNWUWOBF.js +1 -0
  128. package/dist/chunk-PUPM2YGF.js +376 -0
  129. package/dist/chunk-PZXZJBMP.js +620 -0
  130. package/dist/chunk-Q72LJOVE.js +169 -0
  131. package/dist/chunk-QCDXZBC5.js +247 -0
  132. package/dist/chunk-QDYDBCFP.js +197 -0
  133. package/dist/chunk-QJJ6MADV.js +274 -0
  134. package/dist/chunk-QKXCPTFS.js +349 -0
  135. package/dist/chunk-QWCMU5B2.js +860 -0
  136. package/dist/chunk-RIBDXGUG.js +108 -0
  137. package/dist/chunk-RJQOOHT2.js +214 -0
  138. package/dist/chunk-RNGLIHFA.js +191 -0
  139. package/dist/chunk-RQ3HASCC.js +6 -0
  140. package/dist/chunk-RSOJT5YW.js +124 -0
  141. package/dist/chunk-RTIKSY6A.js +1 -0
  142. package/dist/chunk-RUZHTGKB.js +237 -0
  143. package/dist/chunk-RW6ZL2FQ.js +284 -0
  144. package/dist/chunk-S7F6XLTK.js +540 -0
  145. package/dist/chunk-SBMNWWBV.js +155 -0
  146. package/dist/chunk-SDTQPRRB.js +1 -0
  147. package/dist/chunk-SYNOJOQO.js +377 -0
  148. package/dist/chunk-T753XT36.js +1 -0
  149. package/dist/chunk-TKQYWZ5V.js +196 -0
  150. package/dist/chunk-TKVFVF5D.js +95 -0
  151. package/dist/chunk-TOXAGRDQ.js +144 -0
  152. package/dist/chunk-TUTI5HOZ.js +112 -0
  153. package/dist/chunk-U7TFM2JA.js +140 -0
  154. package/dist/chunk-UC2WGUP3.js +627 -0
  155. package/dist/chunk-UWFLYMAR.js +1126 -0
  156. package/dist/chunk-UWSZB7BJ.js +1 -0
  157. package/dist/chunk-UYG5L34B.js +87 -0
  158. package/dist/chunk-VBOXAEPI.js +336 -0
  159. package/dist/chunk-VCDBXW5H.js +188 -0
  160. package/dist/chunk-VCXPHHDS.js +1 -0
  161. package/dist/chunk-VEAYTRPX.js +414 -0
  162. package/dist/chunk-VFCUIDRT.js +1 -0
  163. package/dist/chunk-VQHPQEUH.js +273 -0
  164. package/dist/chunk-VXDZFJGP.js +874 -0
  165. package/dist/chunk-WS56BL3D.js +1 -0
  166. package/dist/chunk-WSW6ZFAQ.js +98 -0
  167. package/dist/chunk-XNUVB5OL.js +375 -0
  168. package/dist/chunk-XOSCY2CW.js +242 -0
  169. package/dist/chunk-XXXEFXY5.js +99 -0
  170. package/dist/chunk-Y5CSSPV4.js +1 -0
  171. package/dist/chunk-Y6DU4J47.js +1 -0
  172. package/dist/chunk-YC6WORFL.js +535 -0
  173. package/dist/chunk-YDGVJETP.js +60 -0
  174. package/dist/chunk-YF4NSSMT.js +366 -0
  175. package/dist/chunk-YG3ZJHGU.js +223 -0
  176. package/dist/chunk-YIJ55TBC.js +1 -0
  177. package/dist/chunk-YKZ4RZZF.js +1 -0
  178. package/dist/chunk-YLLCXTMC.js +37 -0
  179. package/dist/chunk-YTA74UZR.js +1 -0
  180. package/dist/chunk-YTFKPRUK.js +845 -0
  181. package/dist/chunk-Z7H7VSFZ.js +323 -0
  182. package/dist/chunk-ZK2H4O5P.js +1 -0
  183. package/dist/chunk-ZVFE5QGU.js +524 -0
  184. package/dist/coachmark/index.js +4 -0
  185. package/dist/code-block/index.js +4 -0
  186. package/dist/color-field/index.js +7 -0
  187. package/dist/commerce/index.js +20 -0
  188. package/dist/connectivity/index.js +2 -0
  189. package/dist/context-menu/index.js +5 -0
  190. package/dist/copy-button/index.js +3 -0
  191. package/dist/data-grid/index.js +24 -0
  192. package/dist/date-range-picker/index.js +13 -0
  193. package/dist/description-list/index.js +2 -0
  194. package/dist/dialog/index.js +3 -0
  195. package/dist/empty-state/index.js +3 -0
  196. package/dist/error-summary/index.js +3 -0
  197. package/dist/fab/index.js +2 -0
  198. package/dist/file-upload/index.js +9 -0
  199. package/dist/filter-bar/index.js +8 -0
  200. package/dist/flow-run/index.js +14 -0
  201. package/dist/form/index.js +3 -0
  202. package/dist/gallery/index.js +2 -0
  203. package/dist/header/index.js +5 -0
  204. package/dist/hold-to-confirm/index.js +4 -0
  205. package/dist/index.d.ts +22883 -0
  206. package/dist/index.js +158 -0
  207. package/dist/infinite-list/index.js +2 -0
  208. package/dist/inline-edit/index.js +5 -0
  209. package/dist/input/index.js +5 -0
  210. package/dist/interactions/index.js +2 -0
  211. package/dist/invoice/index.js +10 -0
  212. package/dist/kbd/index.js +1 -0
  213. package/dist/keyboard/index.js +3 -0
  214. package/dist/list-row/index.js +7 -0
  215. package/dist/log-viewer/index.js +2 -0
  216. package/dist/map-view/index.js +3 -0
  217. package/dist/markdown/index.js +6 -0
  218. package/dist/metric/index.js +4 -0
  219. package/dist/money/index.js +3 -0
  220. package/dist/nav-drawer/index.js +2 -0
  221. package/dist/navigation/index.js +2 -0
  222. package/dist/notification-center/index.js +16 -0
  223. package/dist/number-roll/index.js +3 -0
  224. package/dist/one-handed/index.js +5 -0
  225. package/dist/os-surfaces/index.js +3 -0
  226. package/dist/otp/index.js +7 -0
  227. package/dist/page-header/index.js +1 -0
  228. package/dist/payment-method/index.js +12 -0
  229. package/dist/payment-status/index.js +16 -0
  230. package/dist/permission/index.js +2 -0
  231. package/dist/picker/index.js +7 -0
  232. package/dist/progress/index.js +5 -0
  233. package/dist/pull-to-refresh/index.js +4 -0
  234. package/dist/radio-group/index.js +6 -0
  235. package/dist/rating/index.js +2 -0
  236. package/dist/receivables/index.js +20 -0
  237. package/dist/refund/index.js +16 -0
  238. package/dist/save-status/index.js +3 -0
  239. package/dist/scroll-area/index.js +1 -0
  240. package/dist/search-bar/index.js +5 -0
  241. package/dist/segmented-control/index.js +5 -0
  242. package/dist/sheet/index.js +4 -0
  243. package/dist/skeleton/index.js +2 -0
  244. package/dist/slider/index.js +5 -0
  245. package/dist/spinner/index.js +2 -0
  246. package/dist/split-button/index.js +7 -0
  247. package/dist/spotlight/index.js +2 -0
  248. package/dist/stage-timeline/index.js +4 -0
  249. package/dist/status-dot/index.js +2 -0
  250. package/dist/stepper/index.js +6 -0
  251. package/dist/streaming-text/index.js +3 -0
  252. package/dist/survey/index.js +19 -0
  253. package/dist/switch/index.js +5 -0
  254. package/dist/system-state/index.js +4 -0
  255. package/dist/tab-bar/index.js +2 -0
  256. package/dist/tabs/index.js +2 -0
  257. package/dist/textarea/index.js +6 -0
  258. package/dist/thinking/index.js +2 -0
  259. package/dist/timeline/index.js +4 -0
  260. package/dist/toast/index.js +2 -0
  261. package/dist/toolbar/index.js +2 -0
  262. package/dist/tour/index.js +11 -0
  263. package/dist/truncation-notice/index.js +2 -0
  264. package/dist/update-notice/index.js +11 -0
  265. package/dist/video-player/index.js +2 -0
  266. package/dist/viewfinder/index.js +5 -0
  267. package/dist/widget/index.js +4 -0
  268. package/dist/wizard/index.js +6 -0
  269. package/package.json +76 -3
@@ -0,0 +1,326 @@
1
+ import { MAX_OVERSCROLL_PX, REFRESH_ARM_PX, SCROLL_TOP_SLOP_PX, overscrollOffset, overscrollIntent } from './chunk-HU2EQNRZ.js';
2
+ import { haptics } from './chunk-NY2U3PBI.js';
3
+ import { Icon } from './chunk-TKVFVF5D.js';
4
+ import * as React from 'react';
5
+ import { Animated, Easing, View, Text, Pressable, ScrollView } from 'react-native';
6
+ import { createStyleSheet, useStyles, useLoamTheme } from '@btndprojects/loam-theme-native';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+
9
+ function touchPageY(e) {
10
+ const ne = e.nativeEvent;
11
+ if (typeof ne.pageY === "number") return ne.pageY;
12
+ const touch = ne.touches?.[0] ?? ne.changedTouches?.[0];
13
+ return typeof touch?.pageY === "number" ? touch.pageY : null;
14
+ }
15
+ function isThenable(v) {
16
+ return typeof v?.then === "function";
17
+ }
18
+ function PullToRefresh({
19
+ onRefresh,
20
+ onArm,
21
+ refreshing,
22
+ phase,
23
+ indicator,
24
+ armLabel = "Release to refresh",
25
+ refreshingLabel = "Refreshing",
26
+ refreshAccessibilityLabel = "Refresh",
27
+ children,
28
+ ...rest
29
+ }) {
30
+ const { styles } = useStyles(sheet);
31
+ const theme = useLoamTheme();
32
+ const isAndroid = (indicator ?? (theme.platform === "Android" ? "android" : "ios")) === "android";
33
+ const reduce = theme.reduceMotion;
34
+ const controlled = phase != null;
35
+ const [ownRefreshing, setOwnRefreshing] = React.useState(false);
36
+ const isRefreshing = refreshing ?? ownRefreshing;
37
+ const [armed, setArmed] = React.useState(false);
38
+ const armedRef = React.useRef(false);
39
+ const displayRefreshing = controlled ? phase === "refreshing" : isRefreshing;
40
+ const displayArmed = controlled ? phase === "armed" : armed && !isRefreshing;
41
+ const statusText = displayRefreshing ? refreshingLabel : displayArmed ? armLabel : "";
42
+ const showText = statusText !== "";
43
+ const ringSize = theme.icon.lg;
44
+ const clearance = theme.space.s3;
45
+ const spinnerBox = isAndroid ? ringSize + clearance * 2 : ringSize;
46
+ const gap = theme.space.s2;
47
+ const textBlockH = theme.icon.md + theme.space.s1 * 2;
48
+ const chromeH = spinnerBox + (showText ? gap + textBlockH : 0);
49
+ const holdOffset = Math.min(spinnerBox + gap + textBlockH + clearance * 2, MAX_OVERSCROLL_PX);
50
+ const offset = React.useRef(new Animated.Value(0)).current;
51
+ const spin = React.useRef(new Animated.Value(0)).current;
52
+ const scrollTop = React.useRef(0);
53
+ const startY = React.useRef(null);
54
+ const band = React.useRef(0);
55
+ React.useEffect(() => {
56
+ if (!displayRefreshing || reduce) {
57
+ spin.setValue(0);
58
+ return;
59
+ }
60
+ const loop = Animated.loop(
61
+ Animated.sequence([
62
+ Animated.timing(spin, {
63
+ toValue: 1,
64
+ duration: theme.loop.spin,
65
+ easing: Easing.linear,
66
+ useNativeDriver: true
67
+ })
68
+ ])
69
+ );
70
+ loop.start();
71
+ return () => loop.stop();
72
+ }, [displayRefreshing, spin, theme.loop.spin, reduce]);
73
+ const settle = React.useCallback(
74
+ (to) => (
75
+ // `motion.exit` closing, `motion.enter` opening — exit is always faster.
76
+ Animated.timing(offset, {
77
+ toValue: to,
78
+ duration: to === 0 ? theme.motion.exit.duration : theme.motion.enter.duration,
79
+ easing: Easing.bezier(...to === 0 ? theme.motion.exit.easing : theme.motion.enter.easing),
80
+ useNativeDriver: true
81
+ }).start()
82
+ ),
83
+ [offset, theme.motion.enter, theme.motion.exit]
84
+ );
85
+ React.useEffect(() => {
86
+ if (!controlled) return;
87
+ const target = phase === "idle" ? 0 : phase === "pulling" ? Math.min(REFRESH_ARM_PX * 0.6, holdOffset) : holdOffset;
88
+ offset.setValue(target);
89
+ }, [controlled, phase, holdOffset, offset]);
90
+ React.useEffect(() => {
91
+ if (controlled) return;
92
+ if (reduce) settle(isRefreshing || armed ? holdOffset : 0);
93
+ else settle(isRefreshing ? holdOffset : 0);
94
+ }, [controlled, reduce, isRefreshing, armed, holdOffset, settle]);
95
+ const setArmedState = (next) => {
96
+ if (next === armedRef.current) return;
97
+ armedRef.current = next;
98
+ setArmed(next);
99
+ if (next) {
100
+ haptics.impact("light");
101
+ onArm?.();
102
+ }
103
+ };
104
+ const beginRefresh = React.useCallback(() => {
105
+ const result = onRefresh?.();
106
+ if (refreshing == null && isThenable(result)) {
107
+ setOwnRefreshing(true);
108
+ const done = () => setOwnRefreshing(false);
109
+ void result.then(done, done);
110
+ settle(holdOffset);
111
+ return;
112
+ }
113
+ settle(0);
114
+ }, [onRefresh, refreshing, holdOffset, settle]);
115
+ const onTouchStart = (e) => {
116
+ if (controlled) return;
117
+ const y = touchPageY(e);
118
+ if (y != null && scrollTop.current <= SCROLL_TOP_SLOP_PX && !isRefreshing) startY.current = y;
119
+ };
120
+ const onTouchMove = (e) => {
121
+ if (controlled || startY.current == null) return;
122
+ const y = touchPageY(e);
123
+ if (y == null) return;
124
+ band.current = overscrollOffset(y - startY.current);
125
+ setArmedState(band.current > REFRESH_ARM_PX);
126
+ if (!reduce) offset.setValue(band.current);
127
+ };
128
+ const onTouchEnd = () => {
129
+ if (controlled || startY.current == null) return;
130
+ startY.current = null;
131
+ const intent = overscrollIntent(band.current, { refresh: true });
132
+ band.current = 0;
133
+ setArmedState(false);
134
+ if (intent !== "refresh" || isRefreshing) {
135
+ settle(0);
136
+ return;
137
+ }
138
+ beginRefresh();
139
+ };
140
+ const chromeY = reduce ? 0 : Animated.subtract(Animated.multiply(offset, 0.5), chromeH / 2);
141
+ const revealIn = Math.max(1, chromeH * 0.6);
142
+ const revealFull = Math.max(revealIn + 1, chromeH + clearance);
143
+ const reveal = offset.interpolate({
144
+ inputRange: [0, revealIn, revealFull],
145
+ outputRange: [0, 0, 1],
146
+ extrapolate: "clamp"
147
+ });
148
+ const chromeScale = reduce ? 1 : reveal;
149
+ const rotate = reduce ? "0deg" : Animated.add(
150
+ // The ring winds up with the drag, then the loop takes over.
151
+ offset.interpolate({
152
+ inputRange: [0, MAX_OVERSCROLL_PX],
153
+ outputRange: [0, 440],
154
+ extrapolate: "clamp"
155
+ }),
156
+ spin.interpolate({ inputRange: [0, 1], outputRange: [0, 360] })
157
+ ).interpolate({ inputRange: [0, 360], outputRange: ["0deg", "360deg"] });
158
+ return /* @__PURE__ */ jsxs(View, { style: styles.root, children: [
159
+ /* @__PURE__ */ jsxs(
160
+ Animated.View,
161
+ {
162
+ style: [
163
+ styles.chrome,
164
+ { opacity: reveal, transform: [{ translateY: chromeY }, { scale: chromeScale }] }
165
+ ],
166
+ children: [
167
+ /* @__PURE__ */ jsx(
168
+ View,
169
+ {
170
+ accessibilityElementsHidden: true,
171
+ importantForAccessibility: "no-hide-descendants",
172
+ "aria-hidden": true,
173
+ style: [
174
+ styles.spinnerBox,
175
+ isAndroid ? styles.spinnerBoxAndroid : null,
176
+ { width: spinnerBox, height: spinnerBox }
177
+ ],
178
+ children: /* @__PURE__ */ jsx(
179
+ Animated.View,
180
+ {
181
+ style: [
182
+ styles.ring,
183
+ {
184
+ width: ringSize,
185
+ height: ringSize,
186
+ borderWidth: theme.icon.strokeBold,
187
+ transform: [{ rotate }]
188
+ }
189
+ ]
190
+ }
191
+ )
192
+ }
193
+ ),
194
+ /* @__PURE__ */ jsx(
195
+ View,
196
+ {
197
+ accessibilityRole: "text",
198
+ role: "status",
199
+ accessibilityLiveRegion: "polite",
200
+ accessibilityState: { busy: displayRefreshing },
201
+ style: showText ? [styles.status, { marginTop: gap }] : styles.statusHidden,
202
+ children: showText ? /* @__PURE__ */ jsx(Text, { style: styles.statusText, children: statusText }) : null
203
+ }
204
+ )
205
+ ]
206
+ }
207
+ ),
208
+ /* @__PURE__ */ jsx(
209
+ Pressable,
210
+ {
211
+ onPress: isRefreshing ? void 0 : beginRefresh,
212
+ accessibilityRole: "button",
213
+ accessibilityLabel: refreshAccessibilityLabel,
214
+ accessibilityState: { busy: isRefreshing, disabled: isRefreshing },
215
+ "aria-busy": isRefreshing || void 0,
216
+ hitSlop: theme.space.s2,
217
+ style: styles.refreshButton,
218
+ children: /* @__PURE__ */ jsx(Icon, { name: "refresh", size: theme.icon.sm, color: theme.color.text })
219
+ }
220
+ ),
221
+ /* @__PURE__ */ jsx(Animated.View, { style: [styles.content, { transform: [{ translateY: offset }] }], children: /* @__PURE__ */ jsx(
222
+ ScrollView,
223
+ {
224
+ ...rest,
225
+ focusable: true,
226
+ scrollEventThrottle: 16,
227
+ contentContainerStyle: [
228
+ rest.contentContainerStyle,
229
+ displayRefreshing ? { paddingBottom: holdOffset } : null
230
+ ],
231
+ onScroll: (e) => {
232
+ scrollTop.current = e.nativeEvent.contentOffset.y;
233
+ rest.onScroll?.(e);
234
+ },
235
+ onTouchStart: (e) => {
236
+ onTouchStart(e);
237
+ rest.onTouchStart?.(e);
238
+ },
239
+ onTouchMove: (e) => {
240
+ onTouchMove(e);
241
+ rest.onTouchMove?.(e);
242
+ },
243
+ onTouchEnd: (e) => {
244
+ onTouchEnd();
245
+ rest.onTouchEnd?.(e);
246
+ },
247
+ onTouchCancel: (e) => {
248
+ onTouchEnd();
249
+ rest.onTouchCancel?.(e);
250
+ },
251
+ children
252
+ }
253
+ ) })
254
+ ] });
255
+ }
256
+ var sheet = createStyleSheet((theme) => ({
257
+ root: { flex: 1, overflow: "hidden" },
258
+ content: { flex: 1 },
259
+ // Anchored at the very top of the band; the transform centres it in the gap.
260
+ chrome: {
261
+ position: "absolute",
262
+ top: 0,
263
+ alignSelf: "center",
264
+ zIndex: theme.z.raised,
265
+ alignItems: "center",
266
+ justifyContent: "flex-start",
267
+ // Decorative — the gesture lives on the scroller underneath.
268
+ pointerEvents: "none"
269
+ },
270
+ spinnerBox: {
271
+ alignItems: "center",
272
+ justifyContent: "center"
273
+ },
274
+ // Android: a raised circular puck. iOS keeps the bare inline spinner.
275
+ // Each of the three floaters below is a `surface` shape over live content,
276
+ // held off it by elevation alone — and elevation is zeroed under high
277
+ // contrast. `edge.neutral` is `transparent` at normal contrast and a solid ink
278
+ // there, which is what keeps the puck, the pill and the button legible over
279
+ // whatever the pulled band reveals, at no cost to the resting design.
280
+ spinnerBoxAndroid: {
281
+ borderRadius: theme.radius.full,
282
+ backgroundColor: theme.color.surface,
283
+ borderWidth: theme.borderWidth.base,
284
+ borderColor: theme.edge.neutral,
285
+ ...theme.shadow.md
286
+ },
287
+ ring: {
288
+ borderRadius: theme.radius.full,
289
+ borderColor: theme.color.surface3,
290
+ borderTopColor: theme.color.accent
291
+ },
292
+ // The status copy sits on a surface pill so `theme.color.text` clears AA in
293
+ // both modes regardless of what the freed band reveals behind it.
294
+ status: {
295
+ paddingVertical: theme.space.s1,
296
+ paddingHorizontal: theme.space.s3,
297
+ borderRadius: theme.radius.full,
298
+ backgroundColor: theme.color.surface,
299
+ borderWidth: theme.borderWidth.base,
300
+ borderColor: theme.edge.neutral,
301
+ ...theme.shadow.sm
302
+ },
303
+ statusHidden: { width: 0, height: 0, overflow: "hidden" },
304
+ statusText: {
305
+ color: theme.color.text,
306
+ fontSize: theme.icon.sm - 3,
307
+ fontWeight: theme.fontWeight.semibold
308
+ },
309
+ refreshButton: {
310
+ position: "absolute",
311
+ top: theme.space.s2,
312
+ end: theme.space.s2,
313
+ zIndex: theme.z.sticky,
314
+ width: theme.tapMin,
315
+ height: theme.tapMin,
316
+ alignItems: "center",
317
+ justifyContent: "center",
318
+ borderRadius: theme.radius.full,
319
+ backgroundColor: theme.color.surface,
320
+ borderWidth: theme.borderWidth.base,
321
+ borderColor: theme.edge.neutral,
322
+ ...theme.shadow.sm
323
+ }
324
+ }));
325
+
326
+ export { PullToRefresh };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,166 @@
1
+ import { ContextMenuOverlay } from './chunk-PZXZJBMP.js';
2
+ import { expandedProps } from './chunk-RQ3HASCC.js';
3
+ import { Button } from './chunk-3ARE4TES.js';
4
+ import { Icon } from './chunk-TKVFVF5D.js';
5
+ import * as React from 'react';
6
+ import { Animated, View, Pressable } from 'react-native';
7
+ import { createStyleSheet, useLoamTheme, useStyles } from '@btndprojects/loam-theme-native';
8
+ import { jsxs, jsx } from 'react/jsx-runtime';
9
+
10
+ function useChevronColors(variant, disabled) {
11
+ const theme = useLoamTheme();
12
+ if (disabled) return { bg: theme.color.surface3, fg: theme.color.text3 };
13
+ switch (variant) {
14
+ case "primary":
15
+ return { bg: theme.color.accent, fg: theme.color.accentInk };
16
+ case "tonal":
17
+ return { bg: theme.color.accentSoft, fg: theme.color.accentOnSoft };
18
+ case "outline":
19
+ return { bg: "transparent", fg: theme.color.text, border: theme.color.borderStrong };
20
+ }
21
+ }
22
+ function SplitButton({
23
+ children,
24
+ onPress,
25
+ items,
26
+ variant = "primary",
27
+ size = "md",
28
+ leadingIcon,
29
+ disabled = false,
30
+ loading = false,
31
+ menuLabel = "More actions",
32
+ motion = "full"
33
+ }) {
34
+ const theme = useLoamTheme();
35
+ const isDisabled = disabled || loading;
36
+ const { styles } = useStyles(sheet, { size });
37
+ const colors = useChevronColors(variant, isDisabled);
38
+ const [open, setOpen] = React.useState(false);
39
+ const [anchor, setAnchor] = React.useState(null);
40
+ const anchorRef = React.useRef(null);
41
+ const slop = Math.max(0, (theme.hit[size] - theme.ctl[size]) / 2);
42
+ const pressEnabled = motion === "full";
43
+ const scale = React.useRef(new Animated.Value(1)).current;
44
+ const spring = (to) => {
45
+ if (!pressEnabled) return;
46
+ Animated.spring(scale, {
47
+ toValue: to,
48
+ useNativeDriver: true,
49
+ speed: 40,
50
+ bounciness: 6
51
+ }).start();
52
+ };
53
+ const openMenu = () => {
54
+ if (isDisabled) return;
55
+ const node = anchorRef.current;
56
+ if (node && typeof node.measureInWindow === "function") {
57
+ node.measureInWindow((x, y, width, height) => setAnchor({ x, y, width, height }));
58
+ }
59
+ setOpen(true);
60
+ };
61
+ const menuItems = React.useMemo(
62
+ () => items.map((item, i) => ({
63
+ key: String(i),
64
+ label: item.label,
65
+ icon: item.icon,
66
+ destructive: item.danger,
67
+ onSelect: item.onSelect
68
+ })),
69
+ [items]
70
+ );
71
+ return /* @__PURE__ */ jsxs(View, { style: styles.row, children: [
72
+ /* @__PURE__ */ jsx(View, { style: styles.primary, children: /* @__PURE__ */ jsx(
73
+ Button,
74
+ {
75
+ variant,
76
+ size,
77
+ leadingIcon,
78
+ loading,
79
+ disabled,
80
+ onPress,
81
+ children
82
+ }
83
+ ) }),
84
+ /* @__PURE__ */ jsx(View, { style: styles.divider }),
85
+ /* @__PURE__ */ jsx(View, { ref: anchorRef, collapsable: false, children: /* @__PURE__ */ jsx(
86
+ Pressable,
87
+ {
88
+ accessibilityRole: "button",
89
+ accessibilityLabel: menuLabel,
90
+ accessibilityState: { disabled: isDisabled, expanded: open },
91
+ ...expandedProps(open),
92
+ disabled: isDisabled,
93
+ onPress: openMenu,
94
+ onPressIn: () => spring(0.97),
95
+ onPressOut: () => spring(1),
96
+ hitSlop: { top: slop, bottom: slop, left: slop, right: slop },
97
+ children: /* @__PURE__ */ jsx(
98
+ Animated.View,
99
+ {
100
+ style: [
101
+ styles.chevron,
102
+ { backgroundColor: colors.bg },
103
+ colors.border ? { borderWidth: theme.borderWidth.thin, borderColor: colors.border } : null,
104
+ { transform: [{ scale }, { rotate: open ? "180deg" : "0deg" }] }
105
+ ],
106
+ children: /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: theme.ctl.icon[size], color: colors.fg })
107
+ }
108
+ )
109
+ }
110
+ ) }),
111
+ /* @__PURE__ */ jsx(
112
+ ContextMenuOverlay,
113
+ {
114
+ open,
115
+ onClose: () => setOpen(false),
116
+ items: menuItems,
117
+ anchor,
118
+ accessibilityLabel: menuLabel
119
+ }
120
+ )
121
+ ] });
122
+ }
123
+ var sheet = createStyleSheet((theme) => ({
124
+ row: {
125
+ flexDirection: "row",
126
+ alignSelf: "flex-start",
127
+ alignItems: "stretch"
128
+ },
129
+ // The primary segment butts flush against the seam; its leading corners keep
130
+ // the ramp radius (via Button).
131
+ primary: { alignSelf: "stretch" },
132
+ divider: {
133
+ alignSelf: "stretch",
134
+ width: theme.borderWidth.hair,
135
+ backgroundColor: theme.color.border
136
+ },
137
+ chevron: {
138
+ alignItems: "center",
139
+ justifyContent: "center",
140
+ // Only the trailing end rounds; the seam side stays square.
141
+ variants: {
142
+ size: {
143
+ sm: {
144
+ height: theme.ctl.sm,
145
+ width: theme.ctl.sm,
146
+ borderTopEndRadius: theme.ctl.r.sm,
147
+ borderBottomEndRadius: theme.ctl.r.sm
148
+ },
149
+ md: {
150
+ height: theme.ctl.md,
151
+ width: theme.ctl.md,
152
+ borderTopEndRadius: theme.ctl.r.md,
153
+ borderBottomEndRadius: theme.ctl.r.md
154
+ },
155
+ lg: {
156
+ height: theme.ctl.lg,
157
+ width: theme.ctl.lg,
158
+ borderTopEndRadius: theme.ctl.r.lg,
159
+ borderBottomEndRadius: theme.ctl.r.lg
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }));
165
+
166
+ export { SplitButton };
@@ -0,0 +1 @@
1
+