@marktiderman/genesis-ui-native 3.7.0 → 3.8.0

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 (87) hide show
  1. package/README.md +4 -1
  2. package/dist/{chunk-KH2RVAI5.js → chunk-DHONOH6K.js} +24 -210
  3. package/dist/chunk-DHONOH6K.js.map +1 -0
  4. package/dist/{chunk-O4BMDV7I.js → chunk-FGIIBON3.js} +333 -21
  5. package/dist/chunk-FGIIBON3.js.map +1 -0
  6. package/dist/{chunk-YWDDDYDI.js → chunk-FOJJB6AB.js} +2 -2
  7. package/dist/{chunk-YWDDDYDI.js.map → chunk-FOJJB6AB.js.map} +1 -1
  8. package/dist/{chunk-IXC3LO2K.js → chunk-JZ7RAGDQ.js} +44 -36
  9. package/dist/chunk-JZ7RAGDQ.js.map +1 -0
  10. package/dist/{chunk-RTYO24SC.js → chunk-PWS2HLDE.js} +63 -31
  11. package/dist/chunk-PWS2HLDE.js.map +1 -0
  12. package/dist/{chunk-3KFUS7O6.js → chunk-PWYMRUAK.js} +43 -30
  13. package/dist/chunk-PWYMRUAK.js.map +1 -0
  14. package/dist/{chunk-GBNIBHSU.js → chunk-T7FEVT62.js} +53 -12
  15. package/dist/chunk-T7FEVT62.js.map +1 -0
  16. package/dist/{chunk-7NDKIIOT.js → chunk-UZCJDMGE.js} +353 -19
  17. package/dist/chunk-UZCJDMGE.js.map +1 -0
  18. package/dist/components/index.d.ts +229 -23
  19. package/dist/components/index.js +5 -6
  20. package/dist/data/index.d.ts +2 -1
  21. package/dist/data/index.js +7 -12
  22. package/dist/data/index.js.map +1 -1
  23. package/dist/hooks/index.d.ts +7 -3
  24. package/dist/hooks/index.js +2 -3
  25. package/dist/icons/lucide.d.ts +1 -1
  26. package/dist/icons/lucide.js +13 -3
  27. package/dist/icons/lucide.js.map +1 -1
  28. package/dist/{inbox-page-B7_Oi2fS.d.ts → inbox-page-BGqR_cBs.d.ts} +4 -1
  29. package/dist/index.d.ts +4 -4
  30. package/dist/index.js +8 -9
  31. package/dist/layouts/index.d.ts +12 -3
  32. package/dist/layouts/index.js +5 -6
  33. package/dist/{native-modules-DEJJQhDx.d.ts → native-modules-CeAaO2Dh.d.ts} +26 -2
  34. package/package.json +49 -1
  35. package/src/__tests__/native-modules-lists.test.tsx +1 -0
  36. package/src/components/__tests__/bulk-bar.test.tsx +36 -0
  37. package/src/components/__tests__/button-haptic.test.tsx +22 -0
  38. package/src/components/__tests__/composer-bar.test.tsx +116 -1
  39. package/src/components/__tests__/gallery-grid.test.tsx +2 -2
  40. package/src/components/__tests__/library-round-5.test.tsx +121 -0
  41. package/src/components/__tests__/share-sheet.test.tsx +47 -0
  42. package/src/components/__tests__/swipe-row-context-menu.test.tsx +215 -0
  43. package/src/components/__tests__/tab-bar.test.tsx +43 -0
  44. package/src/components/__tests__/thread-list.test.tsx +137 -0
  45. package/src/components/__tests__/tier-badge.test.tsx +57 -0
  46. package/src/components/__tests__/whats-new-sheet.test.tsx +29 -0
  47. package/src/components/bulk-bar.tsx +91 -0
  48. package/src/components/button.tsx +74 -35
  49. package/src/components/choice-card.tsx +104 -0
  50. package/src/components/composer-bar.tsx +20 -19
  51. package/src/components/context-menu.tsx +101 -0
  52. package/src/components/gallery-grid.tsx +10 -4
  53. package/src/components/index.ts +18 -1
  54. package/src/components/inline-alert.tsx +36 -1
  55. package/src/components/input.tsx +3 -0
  56. package/src/components/progress.tsx +24 -2
  57. package/src/components/rating.tsx +35 -16
  58. package/src/components/share-sheet.tsx +127 -0
  59. package/src/components/sheet.tsx +9 -1
  60. package/src/components/swipe-row.tsx +74 -0
  61. package/src/components/tab-bar.tsx +133 -0
  62. package/src/components/tabs.tsx +2 -0
  63. package/src/components/text.tsx +3 -0
  64. package/src/components/textarea.tsx +3 -0
  65. package/src/components/thread-list.tsx +48 -23
  66. package/src/components/tier-badge.tsx +74 -0
  67. package/src/components/whats-new-sheet.tsx +89 -0
  68. package/src/data/resource-view/NativeRecordView.tsx +3 -8
  69. package/src/data/resource-view/use-native-resource-view.ts +2 -2
  70. package/src/hooks/index.ts +1 -1
  71. package/src/hooks/use-theme-roles.ts +3 -0
  72. package/src/icon-names.ts +12 -2
  73. package/src/icons/lucide.ts +27 -7
  74. package/src/layouts/__tests__/inbox-page.test.tsx +26 -7
  75. package/src/layouts/__tests__/thread-page.test.tsx +89 -2
  76. package/src/layouts/inbox-page.tsx +28 -12
  77. package/src/layouts/thread-page.tsx +69 -8
  78. package/src/native-modules.tsx +16 -0
  79. package/dist/chunk-3KFUS7O6.js.map +0 -1
  80. package/dist/chunk-7NDKIIOT.js.map +0 -1
  81. package/dist/chunk-CAI7LGN6.js +0 -39
  82. package/dist/chunk-CAI7LGN6.js.map +0 -1
  83. package/dist/chunk-GBNIBHSU.js.map +0 -1
  84. package/dist/chunk-IXC3LO2K.js.map +0 -1
  85. package/dist/chunk-KH2RVAI5.js.map +0 -1
  86. package/dist/chunk-O4BMDV7I.js.map +0 -1
  87. package/dist/chunk-RTYO24SC.js.map +0 -1
@@ -1,11 +1,12 @@
1
- import { useHaptics, useGenesisModules, useThemeRoles, useMotion } from './chunk-RTYO24SC.js';
1
+ import { usePressFeedback, useThemeRoles, useGenesisModules, useMotion, useHaptics } from './chunk-PWS2HLDE.js';
2
2
  import { cn } from './chunk-OHZD7KRO.js';
3
3
  import { cva } from 'class-variance-authority';
4
- import { Text, Pressable, ActivityIndicator, View, Platform, RefreshControl, TextInput, Animated, Easing } from 'react-native';
4
+ import { Text, Pressable, Animated, View, ActivityIndicator, ScrollView, Dimensions, Platform, Modal, KeyboardAvoidingView, RefreshControl, TextInput, Easing, AccessibilityInfo } from 'react-native';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import { useOptionalTheme, brandGradientCss } from '@marktiderman/genesis-design-system';
7
+ import { createContext, useState, useEffect, useContext, useRef, useCallback } from 'react';
8
+ import { SafeAreaProvider, useSafeAreaInsets, SafeAreaView } from 'react-native-safe-area-context';
6
9
  import { nativeColors } from '@marktiderman/genesis-design-system/tokens/native';
7
- import { useEffect, useRef } from 'react';
8
- import { SafeAreaView } from 'react-native-safe-area-context';
9
10
 
10
11
  var textVariants = cva("text-foreground", {
11
12
  variants: {
@@ -48,7 +49,8 @@ var buttonVariants = cva(
48
49
  secondary: "bg-secondary",
49
50
  outline: "border border-input bg-transparent",
50
51
  ghost: "bg-transparent",
51
- destructive: "bg-destructive"
52
+ destructive: "bg-destructive",
53
+ gradient: "bg-primary"
52
54
  },
53
55
  size: {
54
56
  sm: "h-9 px-3 gap-1.5",
@@ -69,7 +71,8 @@ var buttonTextVariants = cva("font-medium text-center", {
69
71
  secondary: "text-secondary-foreground",
70
72
  outline: "text-foreground",
71
73
  ghost: "text-foreground",
72
- destructive: "text-destructive-foreground"
74
+ destructive: "text-destructive-foreground",
75
+ gradient: "text-primary-foreground"
73
76
  },
74
77
  size: {
75
78
  sm: "text-sm",
@@ -82,6 +85,11 @@ var buttonTextVariants = cva("font-medium text-center", {
82
85
  size: "md"
83
86
  }
84
87
  });
88
+ var contentVariants = cva("flex-row items-center justify-center", {
89
+ variants: { size: { sm: "gap-1.5", md: "gap-2", lg: "gap-2" } },
90
+ defaultVariants: { size: "md" }
91
+ });
92
+ var contentClasses = (className) => className?.split(/\s+/).filter((c) => /^(flex-(row|col)|justify-|items-|gap-)/.test(c)).join(" ");
85
93
  function NativeButton({
86
94
  className,
87
95
  textClassName,
@@ -93,16 +101,19 @@ function NativeButton({
93
101
  loading,
94
102
  accessibilityState,
95
103
  haptic,
104
+ style,
96
105
  ...props
97
106
  }) {
98
107
  const isDisabled = disabled || loading;
99
- const play = useHaptics();
100
- const press = haptic && haptic !== "select" && onPress ? () => {
101
- play(haptic);
108
+ const theme = useOptionalTheme();
109
+ const gradient = variant === "gradient" && theme ? brandGradientCss(theme.brand) : void 0;
110
+ const gradientStyle = gradient ? { experimental_backgroundImage: gradient } : void 0;
111
+ const feedback = usePressFeedback({ haptic: onPress ? haptic ?? false : false, disabled: Boolean(isDisabled) });
112
+ const press = onPress ? () => {
113
+ feedback.confirm();
102
114
  onPress();
103
- } : onPress;
104
- const tick = haptic === "select" && onPress ? () => play("select") : void 0;
105
- return /* @__PURE__ */ jsxs(
115
+ } : void 0;
116
+ return /* @__PURE__ */ jsx(
106
117
  Pressable,
107
118
  {
108
119
  className: cn(
@@ -111,12 +122,14 @@ function NativeButton({
111
122
  className
112
123
  ),
113
124
  onPress: press,
114
- onPressIn: tick,
125
+ onPressIn: feedback.onPressIn,
126
+ onPressOut: feedback.onPressOut,
115
127
  disabled: isDisabled,
116
128
  accessibilityRole: "button",
117
- accessibilityState: { ...accessibilityState, disabled: isDisabled, busy: loading },
129
+ accessibilityState: { ...accessibilityState, disabled: isDisabled, busy: loading ?? accessibilityState?.busy },
118
130
  ...props,
119
- children: [
131
+ style: gradientStyle ? style ? [gradientStyle, style] : gradientStyle : style,
132
+ children: /* @__PURE__ */ jsx(Animated.View, { style: [{ flexGrow: 1 }, feedback.style], children: /* @__PURE__ */ jsxs(View, { className: cn(contentVariants({ size }), contentClasses(className)), children: [
120
133
  loading ? /* @__PURE__ */ jsx(
121
134
  ActivityIndicator,
122
135
  {
@@ -134,10 +147,215 @@ function NativeButton({
134
147
  children
135
148
  }
136
149
  ) : children
137
- ]
150
+ ] }) })
151
+ }
152
+ );
153
+ }
154
+ var REQUIRED_EXPORTS = ["BottomSheetModal", "BottomSheetView", "BottomSheetBackdrop", "BottomSheetModalProvider"];
155
+ var SheetLibraryContext = createContext(null);
156
+ function NativeSheetProvider({ bottomSheet, children }) {
157
+ const [library] = useState(() => isSheetLibrary(bottomSheet) ? bottomSheet : null);
158
+ const [problem] = useState(() => library ? null : invalidLibraryMessage(bottomSheet));
159
+ useEffect(() => {
160
+ if (problem) console.error(problem);
161
+ }, [problem]);
162
+ if (!library) return /* @__PURE__ */ jsx(Fragment, { children });
163
+ const Provider = library.BottomSheetModalProvider;
164
+ return /* @__PURE__ */ jsx(SheetLibraryContext.Provider, { value: library, children: /* @__PURE__ */ jsx(Provider, { children }) });
165
+ }
166
+ function isSheetLibrary(value) {
167
+ if (!value || typeof value !== "object") return false;
168
+ const mod = value;
169
+ return REQUIRED_EXPORTS.every((name) => mod[name] != null);
170
+ }
171
+ function invalidLibraryMessage(value) {
172
+ const mod = value && typeof value === "object" ? value : {};
173
+ const missing = REQUIRED_EXPORTS.filter((name) => mod[name] == null);
174
+ return `NativeSheetProvider: \`bottomSheet\` is missing ${missing.join(", ")}, so sheets use the native modal. Pass the whole module: \`import * as BottomSheet from "@gorhom/bottom-sheet"\`.`;
175
+ }
176
+ function NativeSheet(props) {
177
+ const library = useContext(SheetLibraryContext);
178
+ if (library) return /* @__PURE__ */ jsx(LibrarySheet, { library, ...props });
179
+ return /* @__PURE__ */ jsx(ModalSheet, { ...props });
180
+ }
181
+ function NativeSheetScrollView({ style, ...props }) {
182
+ const library = useContext(SheetLibraryContext);
183
+ const Scroll = library?.BottomSheetScrollView ?? ScrollView;
184
+ const own = { flexGrow: 0 };
185
+ return /* @__PURE__ */ jsx(Scroll, { style: [own, ...Array.isArray(style) ? style : style ? [style] : []], ...props });
186
+ }
187
+ function LibrarySheet({
188
+ library,
189
+ open,
190
+ onOpenChange,
191
+ snapPoints = ["50%", "90%"],
192
+ initialSnapIndex = 0,
193
+ disableBackdropDismiss = false,
194
+ fitContent = false,
195
+ onDismissed,
196
+ testID,
197
+ children
198
+ }) {
199
+ const sheet = useRef(null);
200
+ const wanted = useRef(open);
201
+ const onOpenChangeRef = useRef(onOpenChange);
202
+ onOpenChangeRef.current = onOpenChange;
203
+ const onDismissedRef = useRef(onDismissed);
204
+ onDismissedRef.current = onDismissed;
205
+ useEffect(() => {
206
+ wanted.current = open;
207
+ if (open) sheet.current?.present();
208
+ else sheet.current?.dismiss();
209
+ }, [open]);
210
+ const BottomSheetModal = library.BottomSheetModal;
211
+ const BottomSheetView = library.BottomSheetView;
212
+ const BottomSheetBackdrop = library.BottomSheetBackdrop;
213
+ const onDismiss = useCallback(() => {
214
+ if (wanted.current) {
215
+ wanted.current = false;
216
+ onOpenChangeRef.current(false);
217
+ }
218
+ onDismissedRef.current?.();
219
+ }, []);
220
+ const backdrop = useCallback(
221
+ (p) => /* @__PURE__ */ jsx(
222
+ BottomSheetBackdrop,
223
+ {
224
+ ...p,
225
+ appearsOnIndex: 0,
226
+ disappearsOnIndex: -1,
227
+ pressBehavior: disableBackdropDismiss ? "none" : "close"
228
+ }
229
+ ),
230
+ [BottomSheetBackdrop, disableBackdropDismiss]
231
+ );
232
+ return /* @__PURE__ */ jsx(
233
+ BottomSheetModal,
234
+ {
235
+ ref: sheet,
236
+ snapPoints: fitContent ? void 0 : snapPoints,
237
+ index: fitContent ? 0 : initialSnapIndex,
238
+ enableDynamicSizing: fitContent,
239
+ ...fitContent ? { maxDynamicContentSize: Math.round(Dimensions.get("window").height * 0.9) } : {},
240
+ onDismiss,
241
+ enablePanDownToClose: !disableBackdropDismiss,
242
+ backdropComponent: backdrop,
243
+ children: /* @__PURE__ */ jsx(BottomSheetView, { testID: testID ?? "native-sheet", children })
138
244
  }
139
245
  );
140
246
  }
247
+ function useReduceMotionAnswer() {
248
+ const [reduced, setReduced] = useState(null);
249
+ useEffect(() => {
250
+ let mounted = true;
251
+ AccessibilityInfo.isReduceMotionEnabled().then(
252
+ (value) => mounted && setReduced(value),
253
+ () => mounted && setReduced(false)
254
+ );
255
+ const sub = AccessibilityInfo.addEventListener("reduceMotionChanged", (value) => setReduced(value));
256
+ return () => {
257
+ mounted = false;
258
+ sub?.remove?.();
259
+ };
260
+ }, []);
261
+ return reduced;
262
+ }
263
+ function ModalSheet({ open, onOpenChange, disableBackdropDismiss = false, fitContent = false, onDismissed, testID, children }) {
264
+ const reducedMotion = useReduceMotionAnswer();
265
+ const roles = useThemeRoles();
266
+ const requestClose = () => {
267
+ if (!disableBackdropDismiss) onOpenChange(false);
268
+ };
269
+ const visible = open && reducedMotion !== null;
270
+ const animationType = reducedMotion ? "none" : "slide";
271
+ const id = testID ?? "native-sheet";
272
+ const ios = Platform.OS === "ios";
273
+ if (ios && !fitContent) {
274
+ return /* @__PURE__ */ jsx(
275
+ Modal,
276
+ {
277
+ visible,
278
+ animationType,
279
+ presentationStyle: "pageSheet",
280
+ allowSwipeDismissal: !disableBackdropDismiss,
281
+ backdropColor: roles.background,
282
+ onRequestClose: requestClose,
283
+ onDismiss: onDismissed,
284
+ children: /* @__PURE__ */ jsx(SafeAreaProvider, { children: /* @__PURE__ */ jsx(
285
+ SheetBody,
286
+ {
287
+ testID: id,
288
+ onAccessibilityEscape: disableBackdropDismiss ? void 0 : requestClose,
289
+ style: { flex: 1, backgroundColor: roles.background },
290
+ children
291
+ }
292
+ ) })
293
+ }
294
+ );
295
+ }
296
+ return /* @__PURE__ */ jsx(
297
+ Modal,
298
+ {
299
+ visible,
300
+ transparent: true,
301
+ animationType,
302
+ statusBarTranslucent: true,
303
+ navigationBarTranslucent: true,
304
+ onRequestClose: requestClose,
305
+ onDismiss: onDismissed,
306
+ children: /* @__PURE__ */ jsx(SafeAreaProvider, { children: /* @__PURE__ */ jsxs(KeyboardPanel, { ios, children: [
307
+ /* @__PURE__ */ jsx(
308
+ Pressable,
309
+ {
310
+ testID: `${id}-backdrop`,
311
+ accessibilityRole: "button",
312
+ accessibilityLabel: "Close",
313
+ disabled: disableBackdropDismiss,
314
+ importantForAccessibility: disableBackdropDismiss ? "no-hide-descendants" : "auto",
315
+ onPress: requestClose,
316
+ style: { position: "absolute", top: 0, right: 0, bottom: 0, left: 0, backgroundColor: "rgba(0,0,0,0.4)" }
317
+ }
318
+ ),
319
+ /* @__PURE__ */ jsxs(
320
+ SheetBody,
321
+ {
322
+ testID: id,
323
+ onAccessibilityEscape: disableBackdropDismiss ? void 0 : requestClose,
324
+ style: {
325
+ maxHeight: "90%",
326
+ borderTopLeftRadius: 28,
327
+ borderTopRightRadius: 28,
328
+ backgroundColor: roles.surface,
329
+ paddingTop: 12
330
+ },
331
+ children: [
332
+ /* @__PURE__ */ jsx(
333
+ View,
334
+ {
335
+ style: { alignSelf: "center", width: 32, height: 4, borderRadius: 2, marginBottom: 8, backgroundColor: roles.tertiaryLabel }
336
+ }
337
+ ),
338
+ children
339
+ ]
340
+ }
341
+ )
342
+ ] }) })
343
+ }
344
+ );
345
+ }
346
+ function KeyboardPanel({ ios, children }) {
347
+ const insets = useSafeAreaInsets();
348
+ return /* @__PURE__ */ jsx(KeyboardAvoidingView, { behavior: ios ? "padding" : void 0, keyboardVerticalOffset: ios ? -insets.bottom : 0, style: { flex: 1, justifyContent: "flex-end" }, children });
349
+ }
350
+ function SheetBody({
351
+ testID,
352
+ style,
353
+ onAccessibilityEscape,
354
+ children
355
+ }) {
356
+ const insets = useSafeAreaInsets();
357
+ return /* @__PURE__ */ jsx(View, { testID, accessibilityViewIsModal: true, onAccessibilityEscape, style: { ...style, paddingBottom: insets.bottom }, children });
358
+ }
141
359
  var defaults = {
142
360
  "first-run": { title: "Nothing here yet", tone: "text-muted-foreground" },
143
361
  "no-results": { title: "No results", tone: "text-muted-foreground" },
@@ -225,19 +443,19 @@ function NativeEmptyState({
225
443
 
226
444
  // src/icon-names.ts
227
445
  var SF_SYMBOLS = {
446
+ aperture: "camera.aperture",
228
447
  "arrow-left": "arrow.left",
229
448
  "arrow-up": "arrow.up",
230
- aperture: "camera.aperture",
231
449
  bell: "bell",
232
450
  calendar: "calendar",
233
451
  camera: "camera",
234
452
  "camera-flip": "arrow.triangle.2.circlepath.camera",
235
453
  check: "checkmark",
236
- clapperboard: "movieclapper",
237
454
  "chevron-down": "chevron.down",
238
455
  "chevron-left": "chevron.left",
239
456
  "chevron-right": "chevron.right",
240
457
  "chevron-up": "chevron.up",
458
+ clapperboard: "movieclapper",
241
459
  clock: "clock",
242
460
  close: "xmark",
243
461
  compose: "square.and.pencil",
@@ -247,13 +465,18 @@ var SF_SYMBOLS = {
247
465
  error: "xmark.circle",
248
466
  expand: "arrow.up.left.and.arrow.down.right",
249
467
  "external-link": "arrow.up.right.square",
468
+ eye: "eye",
250
469
  file: "doc",
251
470
  filter: "line.3.horizontal.decrease",
252
471
  "folder-plus": "folder.badge.plus",
472
+ grid: "square.grid.2x2",
473
+ grip: "line.3.horizontal",
253
474
  heart: "heart",
254
475
  home: "house",
255
476
  image: "photo",
256
477
  info: "info.circle",
478
+ link: "link",
479
+ list: "list.bullet",
257
480
  lock: "lock",
258
481
  "log-out": "rectangle.portrait.and.arrow.right",
259
482
  mail: "envelope",
@@ -269,6 +492,7 @@ var SF_SYMBOLS = {
269
492
  play: "play.fill",
270
493
  plus: "plus",
271
494
  radio: "dot.radiowaves.left.and.right",
495
+ redo: "arrow.uturn.forward",
272
496
  refresh: "arrow.clockwise",
273
497
  reply: "arrowshape.turn.up.left",
274
498
  search: "magnifyingglass",
@@ -276,10 +500,14 @@ var SF_SYMBOLS = {
276
500
  "settings-2": "slider.horizontal.3",
277
501
  share: "square.and.arrow.up",
278
502
  smile: "face.smiling",
503
+ sort: "arrow.up.arrow.down",
279
504
  star: "star",
280
505
  stop: "stop.fill",
281
506
  success: "checkmark.circle",
507
+ table: "tablecells",
282
508
  trash: "trash",
509
+ undo: "arrow.uturn.backward",
510
+ upload: "tray.and.arrow.up",
283
511
  user: "person",
284
512
  video: "video",
285
513
  volume: "speaker.wave.2.fill",
@@ -631,7 +859,91 @@ function NativeLoadingState({
631
859
  }
632
860
  );
633
861
  }
862
+ var IOS_DISMISS_FALLBACK_MS = 600;
863
+ function NativeContextMenu({ open, onOpenChange, actions, title, cancelLabel = "Cancel", testID = "context-menu" }) {
864
+ const colors = useThemeRoles();
865
+ const play = useHaptics();
866
+ const opened = useRef(false);
867
+ const tapped = useRef(null);
868
+ const ran = useRef(false);
869
+ const fallback = useRef(null);
870
+ useEffect(() => {
871
+ if (open && !opened.current) {
872
+ play("medium");
873
+ ran.current = false;
874
+ }
875
+ opened.current = open;
876
+ }, [open, play]);
877
+ const runTapped = () => {
878
+ if (fallback.current) clearTimeout(fallback.current);
879
+ fallback.current = null;
880
+ const action = tapped.current;
881
+ tapped.current = null;
882
+ action?.();
883
+ };
884
+ const run = (action) => {
885
+ if (ran.current) return;
886
+ ran.current = true;
887
+ tapped.current = action.onPress;
888
+ onOpenChange(false);
889
+ if (Platform.OS === "ios") fallback.current = setTimeout(runTapped, IOS_DISMISS_FALLBACK_MS);
890
+ else runTapped();
891
+ };
892
+ return /* @__PURE__ */ jsx(NativeSheet, { open, onOpenChange, fitContent: true, onDismissed: runTapped, testID, children: /* @__PURE__ */ jsxs(View, { style: { paddingHorizontal: 16, paddingBottom: 8 }, children: [
893
+ title ? /* @__PURE__ */ jsx(NativeText, { testID: `${testID}-title`, accessibilityRole: "header", numberOfLines: 2, style: { paddingVertical: 8, color: colors.secondaryLabel, fontSize: 13, lineHeight: 18, textAlign: "center" }, children: title }) : null,
894
+ actions.map((action) => /* @__PURE__ */ jsx(
895
+ Pressable,
896
+ {
897
+ testID: `${testID}-action-${action.id}`,
898
+ accessibilityRole: "button",
899
+ accessibilityLabel: action.label,
900
+ onPress: () => run(action),
901
+ style: { minHeight: 48, alignItems: "center", justifyContent: "center" },
902
+ children: /* @__PURE__ */ jsx(NativeText, { style: { color: action.destructive ? colors.destructive : colors.tint, fontSize: 17, lineHeight: 22 }, children: action.label })
903
+ },
904
+ action.id
905
+ )),
906
+ /* @__PURE__ */ jsx(Pressable, { testID: `${testID}-cancel`, accessibilityRole: "button", accessibilityLabel: cancelLabel, onPress: () => onOpenChange(false), style: { minHeight: 48, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(NativeText, { style: { color: colors.label, fontSize: 17, lineHeight: 22, fontWeight: "600" }, children: cancelLabel }) })
907
+ ] }) });
908
+ }
909
+ var ACTION_WIDTH = 80;
910
+ function NativeSwipeRow({ actions, children, testID = "swipe-row" }) {
911
+ const { swipeable: Swipeable } = useGenesisModules();
912
+ const colors = useThemeRoles();
913
+ const play = useHaptics();
914
+ const swipe = useRef(null);
915
+ if (!Swipeable || actions.length === 0) return /* @__PURE__ */ jsx(Fragment, { children });
916
+ const leading = actions.filter((a) => a.side === "leading");
917
+ const trailing = actions.filter((a) => a.side !== "leading");
918
+ const group = (list) => () => /* @__PURE__ */ jsx(View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: { flexDirection: "row" }, children: list.map((action) => /* @__PURE__ */ jsx(
919
+ Pressable,
920
+ {
921
+ testID: `${testID}-action-${action.id}`,
922
+ onPress: () => {
923
+ swipe.current?.close?.();
924
+ action.onPress();
925
+ },
926
+ style: { width: ACTION_WIDTH, alignItems: "center", justifyContent: "center", backgroundColor: action.destructive ? colors.destructive : colors.tint },
927
+ children: /* @__PURE__ */ jsx(NativeText, { className: action.destructive ? "text-destructive-foreground" : "text-primary-foreground", preset: "label", children: action.label })
928
+ },
929
+ action.id
930
+ )) });
931
+ return /* @__PURE__ */ jsx(
932
+ Swipeable,
933
+ {
934
+ ref: swipe,
935
+ testID,
936
+ friction: 2,
937
+ overshootLeft: false,
938
+ overshootRight: false,
939
+ onSwipeableWillOpen: () => play("medium"),
940
+ renderLeftActions: leading.length ? group(leading) : void 0,
941
+ renderRightActions: trailing.length ? group(trailing) : void 0,
942
+ children
943
+ }
944
+ );
945
+ }
634
946
 
635
- export { NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeSkeleton, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants };
636
- //# sourceMappingURL=chunk-O4BMDV7I.js.map
637
- //# sourceMappingURL=chunk-O4BMDV7I.js.map
947
+ export { NATIVE_ICON_NAMES, NativeBadge, NativeButton, NativeContextMenu, NativeEmptyState, NativeIcon, NativeInput, NativeListItem, NativeListItemDivider, NativeLoadingState, NativeRefreshControl, NativeSectionListHeader, NativeSheet, NativeSheetProvider, NativeSheetScrollView, NativeSkeleton, NativeSwipeRow, NativeText, SF_SYMBOLS, badgeTextVariants, badgeVariants, buttonTextVariants, buttonVariants, textVariants };
948
+ //# sourceMappingURL=chunk-FGIIBON3.js.map
949
+ //# sourceMappingURL=chunk-FGIIBON3.js.map